当前位置: 首页>>代码示例>>Java>>正文


Java AndroidGraphicFactory.INSTANCE属性代码示例

本文整理汇总了Java中org.mapsforge.map.android.graphics.AndroidGraphicFactory.INSTANCE属性的典型用法代码示例。如果您正苦于以下问题:Java AndroidGraphicFactory.INSTANCE属性的具体用法?Java AndroidGraphicFactory.INSTANCE怎么用?Java AndroidGraphicFactory.INSTANCE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.mapsforge.map.android.graphics.AndroidGraphicFactory的用法示例。


在下文中一共展示了AndroidGraphicFactory.INSTANCE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createLayers

@AfterPermissionGranted(PERMISSIONS_REQUEST_READ_STORAGE)
private void createLayers() {
    if (EasyPermissions.hasPermissions(getContext(), Manifest.permission.READ_EXTERNAL_STORAGE)) {
        TileCache tileCache = AndroidUtil.createTileCache(getContext(),
                "mapFragment",
                this.mapView.getModel().displayModel.getTileSize(),
                1.0f,
                this.mapView.getModel().frameBufferModel.getOverdrawFactor());

        final Layers layers = this.mapView.getLayerManager().getLayers();
        final MapViewPosition mapViewPosition = this.mapView.getModel().mapViewPosition;

        initializePosition(mapViewPosition);

        TileRendererLayer tileRendererLayer = createTileRendererLayer(tileCache, mapViewPosition,
                getMapFile(), getRenderTheme());
        layers.add(tileRendererLayer);

        LabelLayer labelLayer = new LabelLayer(AndroidGraphicFactory.INSTANCE, tileRendererLayer.getLabelStore());
        mapView.getLayerManager().getLayers().add(labelLayer);

        // overlay with a marker to show the goal position
        this.goalLocationOverlay = new Marker(null, null, 0, 0);
        layers.add(this.goalLocationOverlay);

        createLocationLayer();
    } else {
        EasyPermissions.requestPermissions(
                this,
                "",
                PERMISSIONS_REQUEST_READ_STORAGE,
                Manifest.permission.READ_EXTERNAL_STORAGE);
    }
}
 
开发者ID:marunjar,项目名称:anewjkuapp,代码行数:34,代码来源:MapFragment.java

示例2: MapsforgeOSMTileSource

public MapsforgeOSMTileSource(@NonNull Context context,
                              @NonNull String name,
                              @NonNull String mapFile,
                              @NonNull TileCache cache) {
    this.context = context;
    this.name = name;
    this.mapFile = mapFile;
    //this.tileCache = cache;
    //this.tileWeakCache = new WeakHashMap<>();

    MapDatabase mapDatabase = new MapDatabase();
    mapGenerator = new DatabaseRenderer(mapDatabase, AndroidGraphicFactory.INSTANCE);
    xmlRenderTheme = new RenderTheme();
    displayModel = new Model().displayModel;

    mapDatabase.closeFile();
    mapDatabase.openFile(new File(mapFile));
    mapBounds = mapDatabase.getMapFileInfo().boundingBox;
    zoomBounds = -1;
}
 
开发者ID:yuviii,项目名称:OfflineMap,代码行数:20,代码来源:MapsforgeOSMTileSource.java

示例3: createPolygons

private void createPolygons(JSONArray coordinates) {
    Polygon polygon = new Polygon(paintFill, paintStroke,
            AndroidGraphicFactory.INSTANCE);

    List<LatLong> polygonList = polygon.getLatLongs();

    for (int j = 0; j < coordinates.length(); j++) {
        try {
            JSONArray arrLatLong = new JSONArray(coordinates.get(j).toString());
            polygonList.add(new LatLong(arrLatLong.getDouble(1), arrLatLong.getDouble(0)));
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    layers.add(polygon);
}
 
开发者ID:MaxSmile,项目名称:EasyVPN-Free,代码行数:17,代码来源:MapCreator.java

示例4: onCreate

@Override
public final void onCreate(final Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setHasOptionsMenu(true);

	// get shared preferences
	prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());

	// Register our gps broadcast mReceiver
	registerReceiver();

	catalogObjects = new ArrayList<Layer>();
	sessionObjects = new ArrayList<Layer>();
	gpxObjects = new Polyline(MapUtils.createPaint(AndroidGraphicFactory.INSTANCE.createColor(Color.BLACK), STROKE_GPX_WIDTH,
			Style.STROKE), AndroidGraphicFactory.INSTANCE);
}
 
开发者ID:saintbyte,项目名称:openbmap,代码行数:16,代码来源:MapViewActivity.java

示例5: createPolyline

/**
 * draws a connected series of line segments specified by a list of LatLongs.
 *
 * @param pointList
 * @param color:       the color of the polyline
 * @param strokeWidth: the stroke width of the polyline
 * @return Polyline
 */
public Polyline createPolyline(PointList pointList, int color, int strokeWidth) {
    Paint paintStroke = AndroidGraphicFactory.INSTANCE.createPaint();

    paintStroke.setStyle(Style.STROKE);
    paintStroke.setStrokeJoin(Join.ROUND);
    paintStroke.setStrokeCap(Cap.ROUND);
    paintStroke.setColor(color);
    //        paintStroke.setDashPathEffect(new float[]{25, 25});
    paintStroke.setStrokeWidth(strokeWidth);

    // TODO: new mapsforge version wants an mapsforge-paint, not an android paint.
    // This doesn't seem to support transparceny
    //paintStroke.setAlpha(128);
    Polyline line = new Polyline((Paint) paintStroke, AndroidGraphicFactory.INSTANCE);
    List<LatLong> geoPoints = line.getLatLongs();
    PointList tmp = pointList;
    for (int i = 0; i < pointList.getSize(); i++) {
        geoPoints.add(new LatLong(tmp.getLatitude(i), tmp.getLongitude(i)));
    }
    return line;
}
 
开发者ID:junjunguo,项目名称:PocketMaps,代码行数:29,代码来源:MapHandler.java

示例6: onGpxLoaded

/**
 * Callback function for loadGpxObjects()
 */
@Override
public final void onGpxLoaded(final List<LatLong> points) {
    Log.d(TAG, "Loading " + points.size() + " gpx objects");

    clearGpxLayer();

    if (mMapView == null) {
        return;
    }

    mGpxObjects = new Polyline(MapUtils.createPaint(AndroidGraphicFactory.INSTANCE.createColor(Color.GREEN), STROKE_GPX_WIDTH,
            Style.STROKE), AndroidGraphicFactory.INSTANCE);

    for (final LatLong point : points) {
        mGpxObjects.getLatLongs().add(point);
    }

    synchronized (this) {
        mMapView.getLayerManager().getLayers().add(mGpxObjects);
    }

    mRefreshGpxPending = false;
}
 
开发者ID:openbmap,项目名称:radiocells-scanner-android,代码行数:26,代码来源:MapViewActivity.java

示例7: addOnlineLayer

/**
 * Creates a long-press enabled offline map layer
 */
private void addOnlineLayer() {
    final OnlineTileSource onlineTileSource = MapUtils.createOnlineTileSource();

    mMapDownloadLayer = new TileDownloadLayer(mTileCache,
            mMapView.getModel().mapViewPosition, onlineTileSource,
            AndroidGraphicFactory.INSTANCE) {
        @Override
        public boolean onLongPress(LatLong tapLatLong, Point thisXY, Point tapXY) {
                onLongPress(tapLatLong, thisXY, tapXY);
                return true;
        }
    };
    mMapView.getLayerManager().getLayers().add(mMapDownloadLayer);
    mMapDownloadLayer.onResume();
}
 
开发者ID:openbmap,项目名称:radiocells-scanner-android,代码行数:18,代码来源:MapViewActivity.java

示例8: onCreate

@Override public void onCreate(Bundle bundle) {
	super.onCreate(bundle);
	if (DEBUG) { Log.d(TAG, "Map.onCreate"); }
	AndroidGraphicFactory.createInstance(getActivity().getApplication());
	mapView = new MapView(getActivity());
	//
	mapView.setClickable(true);
	mapView.getMapScaleBar().setVisible(true);
	mapView.setBuiltInZoomControls(true);
	mapView.getMapZoomControls().setZoomLevelMin((byte)2);
	mapView.getMapZoomControls().setZoomLevelMax((byte)18);
	mapView.getMapZoomControls().setShowMapZoomControls(true);
	mapView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
	tileCache = AndroidUtil.createTileCache(getActivity(), "mapcache", mapView.getModel().displayModel.getTileSize(),
		1f, mapView.getModel().frameBufferModel.getOverdrawFactor());

	polyline = new AlternatingLine(AndroidGraphicFactory.INSTANCE);
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:18,代码来源:Map.java

示例9: createExternalStorageTileCache

static TileCache createExternalStorageTileCache(Context c, String id, int firstLevelSize, int tileSize) {
	Log.d(TAG, "createExternalStorageTileCache firstLevelSize=" + firstLevelSize);
	TileCache firstLevelTileCache = new InMemoryTileCache(firstLevelSize);
	if (storage != null) { // storage will be null if full
		String cacheDirectoryName = storage.getAbsolutePath() + File.separator + id;
		File cacheDirectory = new File(cacheDirectoryName);
		if (cacheDirectory.exists() || cacheDirectory.mkdirs()) {
			int tileCacheFiles = estimateSizeOfFileSystemCache(cacheDirectoryName, firstLevelSize, tileSize);
			if (cacheDirectory.canWrite() && tileCacheFiles > 0) {
				try {
					Log.d(TAG, "createExternalStorageTileCache tileCacheFiles=" + tileCacheFiles);
					TileCache secondLevelTileCache = new FileSystemTileCache(tileCacheFiles,
						cacheDirectory, AndroidGraphicFactory.INSTANCE, true, 25, true);
					return new TwoLevelTileCache(firstLevelTileCache, secondLevelTileCache);
				} catch (IllegalArgumentException e) {
					Log.w(TAG, "createExternalStorageTileCache e=" + e);
				}
			}
		}
		else {
			Log.w(TAG, "createExternalStorageTileCache can't");
		}
	}
	return firstLevelTileCache;
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:25,代码来源:Map.java

示例10: onStart

@Override public void onStart() {
	super.onStart();
	if (DEBUG) { Log.d(TAG, "Map.onStart"); }
	// warp to 'unter den linden'
	mapView.getModel().mapViewPosition.setCenter(new LatLong(52.517037, 13.38886));
	mapView.getModel().mapViewPosition.setZoomLevel((byte)12);
	MultiMapDataStore multiMapDataStore = new MultiMapDataStore(MultiMapDataStore.DataPolicy.DEDUPLICATE);
	tileLayer = new TileRendererLayer(tileCache, multiMapDataStore, mapView.getModel().mapViewPosition,
		false, true, AndroidGraphicFactory.INSTANCE);
	multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE1)), true, true);
	multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE2)), false, false);
	tileLayer.setXmlRenderTheme(InternalRenderTheme.OSMARENDER);
	mapView.getLayerManager().getLayers().add(tileLayer);
	Bitmap bitmap = AndroidGraphicFactory.convertToBitmap(getResources().getDrawable(R.drawable.poi_black));
	bitmap.incrementRefCount();
	Marker marker = new Marker(new LatLong(52.517037, 13.38886), bitmap, 0, -bitmap.getHeight() / 2) {
		@Override public boolean onTap(LatLong geoPoint, Point viewPosition, Point tapPoint) {
			if (contains(viewPosition, tapPoint)) {
				Toast.makeText(getActivity(), "Unter den Linden Ecke Friedrichstraße, Berlin", Toast.LENGTH_SHORT).show();
				return true;
			}
			return false;
		}
	};
	mapView.getLayerManager().getLayers().add(marker);
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:26,代码来源:Map.java

示例11: addLayers

protected void addLayers(TileCache tileCache, MapViewPosition mapViewPosition) {
    if (isNetworkAvailable()) {
        downloadLayer = new TileDownloadLayer(this.tileCache,
                mapViewPosition, OpenStreetMapMapnik.INSTANCE,
                AndroidGraphicFactory.INSTANCE);
        layerManager.getLayers().add(downloadLayer);
    } else {
        Layer layer = Utils.createTileRendererLayer(tileCache, mapViewPosition, getMapFile());
        layerManager.getLayers().add(layer);
    }

    // a marker to show at the position
    Drawable drawable = getResources().getDrawable(R.drawable.pin);
    Bitmap bitmap = AndroidGraphicFactory.convertToBitmap(drawable);

    // create the overlay and tell it to follow the location
    myLocationOverlay = new MyLocationOverlay(this,
            mapViewPosition, bitmap, Utils.createPaint(AndroidGraphicFactory.INSTANCE.createColor(90, 15, 20, 25), 0,
            Style.FILL), null, user);
    myLocationOverlay.setSnapToLocationEnabled(false);

    layerManager.getLayers().add(this.myLocationOverlay);
}
 
开发者ID:monossido,项目名称:CoopTDMOrienteering,代码行数:23,代码来源:MapsActivity.java

示例12: onStart

@Override public void onStart() {
	super.onStart();
	if (DEBUG) { Log.d(TAG, "Map.onStart"); }
	// warp to 'unter den linden'
	mapView.getModel().mapViewPosition.setCenter(new LatLong(52.517037, 13.38886));
	mapView.getModel().mapViewPosition.setZoomLevel((byte)12);
	MultiMapDataStore multiMapDataStore = new MultiMapDataStore(MultiMapDataStore.DataPolicy.DEDUPLICATE);
	tileLayer = new TileRendererLayer(tileCache, multiMapDataStore, mapView.getModel().mapViewPosition,
		false, true, AndroidGraphicFactory.INSTANCE);
	tileLayer.setTextScale(1.5f);
	multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE1)), true, true);
	multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE2)), false, false);
	multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE0)), false, false);
	try {
		tileLayer.setXmlRenderTheme(new ExternalRenderTheme(new File(THEMEFILE))); // set a different render theme
	}
	catch (FileNotFoundException ignore) {
		tileLayer.setXmlRenderTheme(InternalRenderTheme.OSMARENDER); // fallback if not founr
	}
	mapView.getLayerManager().getLayers().add(tileLayer);
	mapView.getLayerManager().getLayers().add( // add a grid around each tile
		new TileGridLayer(AndroidGraphicFactory.INSTANCE, mapView.getModel().displayModel));
	mapView.getLayerManager().getLayers().add( // add text to show x/y/z of each tile
		new TileCoordinatesLayer(AndroidGraphicFactory.INSTANCE, mapView.getModel().displayModel));
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:25,代码来源:Map.java

示例13: onStart

@Override public void onStart() {
	super.onStart();
	if (DEBUG) { Log.d(TAG, "Map.onStart"); }
	// warp to 'unter den linden'
	mapView.getModel().mapViewPosition.setCenter(new LatLong(52.517037, 13.38886));
	mapView.getModel().mapViewPosition.setZoomLevel((byte)12);
	MultiMapDataStore multiMapDataStore = new MultiMapDataStore(MultiMapDataStore.DataPolicy.DEDUPLICATE);
	tileLayer = new TileRendererLayer(tileCache, multiMapDataStore, mapView.getModel().mapViewPosition,
		false, true, AndroidGraphicFactory.INSTANCE);
	multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE1)), true, true);
	multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE2)), false, false);
	multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE0)), false, false);
	tileLayer.setXmlRenderTheme(InternalRenderTheme.OSMARENDER);
	mapView.getLayerManager().getLayers().add(tileLayer);
	myLocationOverlay = new ThreeStateLocationOverlay(getActivity(), mapView.getModel().mapViewPosition);
	myLocationOverlay.setSnapToLocationEnabled(true);
	mapView.getLayerManager().getLayers().add(myLocationOverlay);
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:18,代码来源:Map.java

示例14: createExternalStorageTileCache

/**
 * @param c
 *            the Android context
 * @param id
 *            name for the directory
 * @return a new cache created on the external storage
 */
@Deprecated
public static TileCache createExternalStorageTileCache(final Context c, final String id) {
	final TileCache firstLevelTileCache = new InMemoryTileCache(32);
	final String cacheDirectoryName = c.getExternalCacheDir().getAbsolutePath() + File.separator + id;
	final File cacheDirectory = new File(cacheDirectoryName);
	if (!cacheDirectory.exists()) {
		cacheDirectory.mkdir();
	}
	final TileCache secondLevelTileCache = new FileSystemTileCache(1024, cacheDirectory, AndroidGraphicFactory.INSTANCE);
	return new TwoLevelTileCache(firstLevelTileCache, secondLevelTileCache);
}
 
开发者ID:saintbyte,项目名称:openbmap,代码行数:18,代码来源:MapUtils.java

示例15: loadMap

/**
 * load map to mapView
 *
 * @param areaFolder
 */
public void loadMap(File areaFolder) {
    logToast("Loading map: " + currentArea);
    File mapFile = new File(areaFolder, currentArea + ".map");
    mapView.getLayerManager().getLayers().clear();
    TileRendererLayer tileRendererLayer =
            new TileRendererLayer(tileCache, mapView.getModel().mapViewPosition, false, true,
                    AndroidGraphicFactory.INSTANCE) {
                @Override public boolean onTap(LatLong tapLatLong, Point layerXY, Point tapXY) {
                    return myOnTap(tapLatLong, layerXY, tapXY);
                }
            };
    tileRendererLayer.setMapFile(mapFile);
    tileRendererLayer.setTextScale(0.8f);
    tileRendererLayer.setXmlRenderTheme(InternalRenderTheme.OSMARENDER);
    //        log("last location " + Variable.getVariable().getLastLocation());
    if (Variable.getVariable().getLastLocation() == null) {
        centerPointOnMap(tileRendererLayer.getMapDatabase().getMapFileInfo().boundingBox.getCenterPoint(), 6);
    } else {
        centerPointOnMap(Variable.getVariable().getLastLocation(), Variable.getVariable().getLastZoomLevel());
    }

    mapView.getLayerManager().getLayers().add(tileRendererLayer);
    ViewGroup.LayoutParams params =
            new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    activity.addContentView(mapView, params);
    loadGraphStorage();
}
 
开发者ID:junjunguo,项目名称:PocketMaps,代码行数:32,代码来源:MapHandler.java


注:本文中的org.mapsforge.map.android.graphics.AndroidGraphicFactory.INSTANCE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。