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


Java Layers类代码示例

本文整理汇总了Java中org.mapsforge.map.layer.Layers的典型用法代码示例。如果您正苦于以下问题:Java Layers类的具体用法?Java Layers怎么用?Java Layers使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: createLayers

import org.mapsforge.map.layer.Layers; //导入依赖的package包/类
@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,代码行数:35,代码来源:MapFragment.java

示例2: updateCurrentLocation

import org.mapsforge.map.layer.Layers; //导入依赖的package包/类
/**
 * Updates the users location based on the location
 *
 * @param location Location
 */
private void updateCurrentLocation(Location location) {
    if (location != null) {
        mCurrentLocation = location;
    } else if (mLastLocation != null && mCurrentLocation == null) {
        mCurrentLocation = mLastLocation;
    }
    if (mCurrentLocation != null) {
        LatLong mcLatLong = new LatLong(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude());
        if (Tracking.getTracking().isTracking()) {
            MapHandler.getMapHandler().addTrackPoint(mcLatLong);
            Tracking.getTracking().addPoint(mCurrentLocation);
        }
        Layers layers = mapView.getLayerManager().getLayers();
        MapHandler.getMapHandler().removeLayer(layers, mPositionMarker);
        mPositionMarker = MapHandler.getMapHandler().createMarker(mcLatLong, R.drawable.ic_my_location_dark_24dp);
        layers.add(mPositionMarker);
        mapActions.showPositionBtn.setImageResource(R.drawable.ic_my_location_white_24dp);
    } else {
        mapActions.showPositionBtn.setImageResource(R.drawable.ic_location_searching_white_24dp);
    }
}
 
开发者ID:junjunguo,项目名称:PocketMaps,代码行数:27,代码来源:MapActivity.java

示例3: addMarkers

import org.mapsforge.map.layer.Layers; //导入依赖的package包/类
public void addMarkers(LatLong startPoint, LatLong endPoint) {
    Layers layers = mapView.getLayerManager().getLayers();
    //        if (startPoint != null && endPoint != null) {
    //            setShortestPathRunning(true);
    //        }
    if (startPoint != null) {
        removeLayer(layers, startMarker);
        startMarker = createMarker(startPoint, R.drawable.ic_location_start_24dp);
        layers.add(startMarker);
    }
    if (endPoint != null) {
        removeLayer(layers, endMarker);
        endMarker = createMarker(endPoint, R.drawable.ic_location_end_24dp);
        layers.add(endMarker);
    }
}
 
开发者ID:junjunguo,项目名称:PocketMaps,代码行数:17,代码来源:MapHandler.java

示例4: removeMarkers

import org.mapsforge.map.layer.Layers; //导入依赖的package包/类
/**
 * remove all markers and polyline from layers
 */
public void removeMarkers() {
    Layers layers = mapView.getLayerManager().getLayers();
    if (startMarker != null) {
        removeLayer(layers, startMarker);
    }
    if (startMarker != null) {
        removeLayer(layers, endMarker);
    }
    if (polylinePath != null) {
        removeLayer(layers, polylinePath);
    }
}
 
开发者ID:junjunguo,项目名称:PocketMaps,代码行数:16,代码来源:MapHandler.java

示例5: addLayers

import org.mapsforge.map.layer.Layers; //导入依赖的package包/类
private BoundingBox addLayers(MapView mapView, List<File> mapFiles) {
	Layers layers = mapView.getLayerManager().getLayers();

	// layers.add(createTileDownloadLayer(tileCache,
	// mapView.getModel().mapViewPosition));
	BoundingBox result = null;
	for (int i = 0; i < mapFiles.size(); i++) {
		File mapFile = mapFiles.get(i);
		TileRendererLayer tileRendererLayer = createTileRendererLayer(
				createTileCache(i), mapView.getModel().mapViewPosition,
				true, true, mapFile);
		BoundingBox boundingBox = tileRendererLayer.getMapDataStore()
				.boundingBox();
		result = result == null ? boundingBox : result.extend(boundingBox);
		layers.add(tileRendererLayer);
	}
	if (SHOW_DEBUG_LAYERS) {
		layers.add(new TileGridLayer(GRAPHIC_FACTORY,
				mapView.getModel().displayModel));
		layers.add(new TileCoordinatesLayer(GRAPHIC_FACTORY, mapView
				.getModel().displayModel));
	}
	return result;
}
 
开发者ID:ianmalcolm,项目名称:DeadReckoning,代码行数:25,代码来源:MainFrame.java

示例6: createLocationLayer

import org.mapsforge.map.layer.Layers; //导入依赖的package包/类
@AfterPermissionGranted(PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION)
private void createLocationLayer() {
    this.mMyLocationOverlay = null;
    if (EasyPermissions.hasPermissions(getContext(), Manifest.permission.ACCESS_FINE_LOCATION)) {
        final Layers layers = this.mapView.getLayerManager().getLayers();
        final MapViewPosition mapViewPosition = this.mapView.getModel().mapViewPosition;

        // overlay with a marker to show the actual position
        Drawable drawable = ContextCompat.getDrawable(getContext(), R.drawable.ic_marker_own_position);
        if (drawable != null) {
            Bitmap bitmap = AndroidGraphicFactory.convertToBitmap(drawable);

            this.mMyLocationOverlay = new LocationOverlay(getActivity(), mapViewPosition, bitmap);
            this.mMyLocationOverlay.setSnapToLocationEnabled(false);
            layers.add(this.mMyLocationOverlay);
        }
    } else {
        EasyPermissions.requestPermissions(
                this,
                "",
                PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION,
                Manifest.permission.ACCESS_FINE_LOCATION);
    }
}
 
开发者ID:marunjar,项目名称:anewjkuapp,代码行数:25,代码来源:MapFragment.java

示例7: onCreateView

import org.mapsforge.map.layer.Layers; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {
	View rootView = inflater.inflate(R.layout.fragment_item_detail,
			container, false);

	if (this.dummyItem != null) {
		this.mapView = (MapView) rootView.findViewById(R.id.mapView);
		this.mapView.setClickable(true);
		this.mapView.getFpsCounter().setVisible(true);
		this.mapView.getMapScaleBar().setVisible(true);

		LayerManager layerManager = this.mapView.getLayerManager();
		Layers layers = layerManager.getLayers();

		MapViewPosition mapViewPosition = this.mapView.getModel().mapViewPosition;
		mapViewPosition.setZoomLevel((byte) 16);
		this.tileCache = AndroidUtil.createTileCache(this.getActivity(),
				"fragments",
				this.mapView.getModel().displayModel.getTileSize(), 1.0f,
				1.5);

		mapViewPosition.setCenter(this.dummyItem.location);
		layers.add(AndroidUtil.createTileRendererLayer(this.tileCache,
				mapViewPosition, getMapFile(),
				InternalRenderTheme.OSMARENDER, false, true));

	}

	return rootView;
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:32,代码来源:ItemDetailFragment.java

示例8: destroyLayers

import org.mapsforge.map.layer.Layers; //导入依赖的package包/类
/**
 * Destroys layers and associated tile caches for the map view.
 * 
 * @param destroyOverlays Whether to destroy overlays (markers and circles) or just the tile layers
 */
private void destroyLayers(boolean destroyOverlays) {
	Layers layers = null;
	if (mapMap != null)
		layers = mapMap.getLayerManager().getLayers();
	
	if (mapDownloadLayer != null) {
		if (layers != null)
			layers.remove(mapDownloadLayer);
		mapDownloadLayer.onDestroy();
		mapDownloadLayer = null;
	}
	
	if (mapRendererLayer != null) {
		if (layers != null)
			layers.remove(mapRendererLayer);
		mapRendererLayer.onDestroy();
		mapRendererLayer = null;
	}
	
	if (mapDownloadTileCache != null) {
		mapDownloadTileCache.destroy();
		mapDownloadTileCache = null;
	}

	if (mapRendererTileCache != null) {
		mapRendererTileCache.destroy();
		mapRendererTileCache = null;
	}

	if (destroyOverlays && (layers != null))
		for (Layer layer : layers) {
			layer.onDestroy();
			layers.remove(layer);
		}
}
 
开发者ID:mvglasow,项目名称:satstat,代码行数:41,代码来源:MapSectionFragment.java

示例9: MapCreator

import org.mapsforge.map.layer.Layers; //导入依赖的package包/类
public MapCreator(Context context, Layers layers) {
    this.context = context;
    this.layers = layers;

    paintFill = AndroidGraphicFactory.INSTANCE.createPaint();
    paintFill.setColor(ContextCompat.getColor(context,R.color.mapFill));
    paintFill.setStyle(Style.FILL);

    paintStroke = AndroidGraphicFactory.INSTANCE.createPaint();
    paintStroke.setStrokeWidth(1);
    paintStroke.setColor(ContextCompat.getColor(context,R.color.mapStroke));
    paintStroke.setStyle(Style.STROKE);
}
 
开发者ID:MaxSmile,项目名称:EasyVPN-Free,代码行数:14,代码来源:MapCreator.java

示例10: addLayers

import org.mapsforge.map.layer.Layers; //导入依赖的package包/类
private static void addLayers(MapView mapView, String MapPath) {
    LayerManager layerManager = mapView.getLayerManager();
    Layers layers = layerManager.getLayers();
    TileCache tileCache = createTileCache();
    layers.clear();
    layers.add(createTileRendererLayer(tileCache, mapView.getModel().mapViewPosition, layerManager, MapPath));
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:8,代码来源:MapPanel.java

示例11: onPause

import org.mapsforge.map.layer.Layers; //导入依赖的package包/类
@Override
public void onPause() {
	super.onPause();
	if (DEBUG) Log.d(TAG, "Track.onPause");
	MapView mapView = ((Tabulae) getActivity()).getMapView();
	Layers layers = mapView.getLayerManager().getLayers();
	for (Layer polyline: polylines) {
		((AlternatingLine)polyline).getLatLongs().clear();
		layers.remove(polyline, false);
	}
	polylines.clear();
}
 
开发者ID:emdete,项目名称:tabulae,代码行数:13,代码来源:Track.java

示例12: addOverlayLayers

import org.mapsforge.map.layer.Layers; //导入依赖的package包/类
@Override
protected void addOverlayLayers(Layers layers) {
	Polyline polyline = new Polyline(Utils.createPaint(
			AndroidGraphicFactory.INSTANCE.createColor(Color.BLUE), 8,
			Style.STROKE), AndroidGraphicFactory.INSTANCE);
	List<LatLong> latLongs = polyline.getLatLongs();
	latLongs.add(latLong2);
	latLongs.add(latLong3);
	layers.add(polyline);
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:11,代码来源:ZoomToBounds.java

示例13: addOverlayLayers

import org.mapsforge.map.layer.Layers; //导入依赖的package包/类
protected void addOverlayLayers(Layers layers) {
	marker_start = Utils.createMarker(this, R.drawable.marker_departure,
			gpsStartPoint);
	marker_destination = Utils.createMarker(this,
			R.drawable.marker_destination, gpsEndPoint);
	marker_set_start = Utils.createMarker(this,
			R.drawable.marker_departure, departurePoint);
	marker_set_destination = Utils.createMarker(this,
			R.drawable.marker_destination, destinationPoint);
	for (int i = 0; i < marker_viapoints.size(); i++) {
		marker_viapoints.set(i, Utils.createTappableMarker(this,
				R.drawable.marker_via, viaPoints.get(i)));
		layers.add(marker_viapoints.get(i));
	}

	layers.add(marker_start);
	layers.add(marker_destination);
	layers.add(marker_set_start);
	layers.add(marker_set_destination);

	polyline_track = new Polyline(Utils.createPaint(
			AndroidGraphicFactory.INSTANCE.createColor(Color.BLUE), 8,
			Style.STROKE), AndroidGraphicFactory.INSTANCE);
	latLongs_track = polyline_track.getLatLongs();
	if (tmpLatLongs_track != null) {
		for (int i = 0; i < tmpLatLongs_track.size(); i++) {

			latLongs_track.add(tmpLatLongs_track.get(i));

		}
	}
	Log.i("LatLongs in Overlay", String.valueOf(latLongs_track));

	layers.add(polyline_track);

}
 
开发者ID:nirabpudasaini,项目名称:Mero-Bhada-Meter,代码行数:37,代码来源:OfflineMapActivity.java

示例14: initServerOnMap

import org.mapsforge.map.layer.Layers; //导入依赖的package包/类
private void initServerOnMap(Layers layers) {
    Type listType = new TypeToken<ArrayList<Country>>(){}.getType();
    countryLatLonList =  new Gson().fromJson(LoadData.fromFile(COUNTRY_FILE_NAME, this), listType);

    for (Server server : countryList) {
        for (Country country : countryLatLonList) {
            if (server.getCountryShort().equals(country.getCountryCode())) {
                LatLong position = new LatLong(country.getCapitalLatitude(), country.getCapitalLongitude());
                Bitmap bitmap = AndroidGraphicFactory.convertToBitmap(ContextCompat.getDrawable(this,
                        getResources().getIdentifier(ConnectionQuality.getPointIcon(server.getQuality()),
                                "drawable",
                                getPackageName())));

                MyMarker countryMarker = new MyMarker(position, bitmap, 0, 0, server) {
                    @Override
                    public boolean onTap(LatLong geoPoint, Point viewPosition,
                                         Point tapPoint) {

                        if (contains(viewPosition, tapPoint)) {
                            onSelectCountry((Server)getRelationObject());
                            return true;
                        }
                        return false;
                    }
                };

                layers.add(countryMarker);


                String localeCountryName = localeCountries.get(country.getCountryCode()) != null ?
                        localeCountries.get(country.getCountryCode()) : country.getCountryName();

                Drawable drawable = new BitmapDrawable(getResources(), BitmapGenerator.getTextAsBitmap(localeCountryName, 20, ContextCompat.getColor(this,R.color.mapNameCountry)));
                Bitmap bitmapName = AndroidGraphicFactory.convertToBitmap(drawable);

                Marker countryNameMarker = new Marker(position, bitmapName, 0, bitmap.getHeight() / 2);

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

示例15: onCatalogLoaded

import org.mapsforge.map.layer.Layers; //导入依赖的package包/类
@Override
public final void onCatalogLoaded(final ArrayList<LatLong> points) {
	Log.d(TAG, "Loaded catalog objects");
	final Layers layers = this.mMapView.getLayerManager().getLayers();

	clearCatalogLayer(); 

	// redraw
	for (final LatLong point : points) {
		final Circle circle = new Circle(point, CIRCLE_WIFI_CATALOG_WIDTH, paintCatalogFill, paintCatalogStroke);
		catalogObjects.add(circle);
	}

	/**
	 * Draw stack (z-order):
	 *   base map
	 *   catalog objects
	 *   session objects
	 */
	int insertAfter = -1;
	synchronized (catalogObjects) {
		if (layers.size() > 0) {
			// base map 
			insertAfter = 1;
		} else {
			// no map 
			insertAfter = 0;
		}

		for (int i = 0; i < catalogObjects.size(); i++) {
			layers.add(insertAfter + i, catalogObjects.get(i));
		}  
	}

	// enable next refresh
	mRefreshCatalogPending = false;
	Log.d(TAG, "Drawed catalog objects");

}
 
开发者ID:saintbyte,项目名称:openbmap,代码行数:40,代码来源:MapViewActivity.java


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