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


Java AndroidGraphicFactory.convertToBitmap方法代码示例

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


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

示例1: initDetailsServerOnMap

import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
private void initDetailsServerOnMap() {
    if (markerList != null && markerList.size() > 0) {
        for (Marker marker : markerList) {
            layers.remove(marker);
        }
    }
    List<Server> serverList = dbHelper.getServersWithGPS();

    markerList = new ArrayList<Marker>();
    for (Server server : serverList) {
        LatLong position = new LatLong(server.getLat(), server.getLon());
        Bitmap bitmap = AndroidGraphicFactory.convertToBitmap(ContextCompat.getDrawable(this,
                getResources().getIdentifier(ConnectionQuality.getSimplePointIcon(server.getQuality()),
                        "drawable",
                        getPackageName())));
        Marker serverMarker = new Marker(position, bitmap, 0, 0);
        markerList.add(serverMarker);
        layers.add(serverMarker);
    }
}
 
开发者ID:MaxSmile,项目名称:EasyVPN-Free,代码行数:21,代码来源:HomeActivity.java

示例2: onHeatmapCompleted

import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
@Override
public final void onHeatmapCompleted(final Bitmap backbuffer) {
	// zoom level has changed in the mean time - regenerate
	if (mMapView.getModel().mapViewPosition.getZoomLevel() != zoomAtTrigger) {
		updatePending = false;
		Log.i(TAG, "Zoom level has changed - have to re-generate heat-map");
		clearLayer();
		proceedAfterHeatmapCompleted();
		return;
	}

	final BitmapDrawable drawable = new BitmapDrawable(backbuffer);
	final org.mapsforge.core.graphics.Bitmap mfBitmap = AndroidGraphicFactory.convertToBitmap(drawable);
	if (heatmapLayer != null && mfBitmap != null) {
		heatmapLayer.setBitmap(mfBitmap);
	} else {
		Log.w(TAG, "Skipped heatmap draw: either layer or bitmap is null");
	}
	updatePending = false;
	//saveHeatmapToFile(backbuffer);
}
 
开发者ID:saintbyte,项目名称:openbmap,代码行数:22,代码来源:WifiDetailsMap.java

示例3: onHeatmapCompleted

import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
@Override
public final void onHeatmapCompleted(final Bitmap backbuffer) {
	// zoom level has changed in the mean time - regenerate
	if (mMapView.getModel().mapViewPosition.getZoomLevel() != mZoomAtTrigger) {
		mUpdatePending = false;
		Log.i(TAG, "Zoom level has changed - have to re-generate heat-map");
		clearLayer();
		proceedAfterHeatmapCompleted();
		return;
	}

	final BitmapDrawable drawable = new BitmapDrawable(backbuffer);
	final org.mapsforge.core.graphics.Bitmap mfBitmap = AndroidGraphicFactory.convertToBitmap(drawable);
	if (mHeatmapLayer != null && mfBitmap != null) {
		mHeatmapLayer.setBitmap(mfBitmap);
	} else {
		Log.w(TAG, "Skipped heatmap draw: either layer or bitmap is null");
	}
	mUpdatePending = false;
	//saveHeatmapToFile(backbuffer);

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

示例4: createLocationLayer

import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的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

示例5: createTappableMarker

import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
static Marker createTappableMarker(final Context c, int resourceIdentifier,
		LatLong latLong) {
	Drawable drawable = c.getResources().getDrawable(resourceIdentifier);
	Bitmap bitmap = AndroidGraphicFactory.convertToBitmap(drawable);
	bitmap.incrementRefCount();
	return new Marker(latLong, bitmap, 0, -bitmap.getHeight() / 2) {
		@Override
		public boolean onTap(LatLong geoPoint, Point viewPosition,
				Point tapPoint) {
			if (contains(viewPosition, tapPoint)) {
				Toast.makeText(c,
						"The Marker was tapped " + geoPoint.toString(),
						Toast.LENGTH_SHORT).show();
				return true;
			}
			return false;
		}
	};
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:20,代码来源:Utils.java

示例6: onStart

import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
@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,代码行数:27,代码来源:Map.java

示例7: ThreeStateLocationOverlay

import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
/**
 * Constructs a new {@code ThreeStateLocationOverlay} with the given circle paints.
 *
 * @param context
 *            a reference to the application context.
 * @param mapViewPosition
 *            the {@code MapViewPosition} whose location will be updated.
 * @param circleFill
 *            the {@code Paint} used to fill the circle that represents the accuracy of the current location (might be null).
 * @param circleStroke
 *            the {@code Paint} used to stroke the circle that represents the accuracy of the current location (might be null).
 */
public ThreeStateLocationOverlay(Context context, MapViewPosition mapViewPosition, Paint circleFill,
						Paint circleStroke) {
	super();
	this.mapViewPosition = mapViewPosition;
	locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
	map_needle_pinned = new Marker(null, AndroidGraphicFactory.convertToBitmap(
		context.getResources().getDrawable(R.drawable.map_needle_pinned)), 0, 0);
	map_needle = new RotatingMarker(null, AndroidGraphicFactory.convertToBitmap(
		context.getResources().getDrawable(R.drawable.map_needle)), 0, 0);
	map_needle_off = new Marker(null, AndroidGraphicFactory.convertToBitmap(
		context.getResources().getDrawable(R.drawable.map_needle_off)), 0, 0);
	marker = map_needle_off;
	showAccuracy = true;
	circle = new Circle(null, 0, circleFill, circleStroke);
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:28,代码来源:ThreeStateLocationOverlay.java

示例8: createTappableMarker

import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
static Marker createTappableMarker(Context c, int resourceIdentifier,
		LatLong latLong) {
	Drawable drawable = c.getResources().getDrawable(resourceIdentifier);
	Bitmap bitmap = AndroidGraphicFactory.convertToBitmap(drawable);
	return new Marker(latLong, bitmap, 0, -bitmap.getHeight() / 2) {
		@Override
		public boolean onTap(LatLong geoPoint, Point viewPosition,
				Point tapPoint) {
			if (contains(viewPosition, tapPoint)) {
				Log.w("Tapp", "The Marker was touched with onTap: "
						+ this.getLatLong().toString());
				return true;
			}
			return false;
		}
	};
}
 
开发者ID:monossido,项目名称:CoopTDMOrienteering,代码行数:18,代码来源:Utils.java

示例9: addLayers

import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
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,代码行数:24,代码来源:MapsActivity.java

示例10: resizeBitmap

import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
private static Bitmap resizeBitmap(Bitmap bitmap, int width, int height) {
/*
 * TODO Is this really the easiest way to resize a bitmap
 *  when using mapsforge?
 */
debugMsg(String.format("Resizing bitmap from %dx%d to %dx%d", bitmap.getWidth(), bitmap.getHeight(), width, height));
android.graphics.Bitmap aBitmap = AndroidGraphicFactory.getBitmap(bitmap);
android.graphics.Bitmap scaled = android.graphics.Bitmap.createScaledBitmap(aBitmap, width, height, false);
Drawable d = new BitmapDrawable(scaled);
bitmap = AndroidGraphicFactory.convertToBitmap(d);
//Bitmaps are evil, null references to ensure they get GC'd
d = null;
scaled = null;
aBitmap = null;
return bitmap;
  }
 
开发者ID:snowciety,项目名称:sc.mapsforge,代码行数:17,代码来源:MapsforgeView.java

示例11: createMarker

import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
static Marker createMarker(final Context c, final int resourceIdentifier, final LatLong latLong) {
	final Drawable drawable = c.getResources().getDrawable(resourceIdentifier);
	final Bitmap bitmap = AndroidGraphicFactory.convertToBitmap(drawable);
	return new Marker(latLong, bitmap, 0, -bitmap.getHeight() / 2);
}
 
开发者ID:saintbyte,项目名称:openbmap,代码行数:6,代码来源:MapUtils.java

示例12: viewToBitmap

import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
static Bitmap viewToBitmap(final Context c, final View view) {
	view.measure(MeasureSpec.getSize(view.getMeasuredWidth()), MeasureSpec.getSize(view.getMeasuredHeight()));
	view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
	view.setDrawingCacheEnabled(true);
	final Drawable drawable = new BitmapDrawable(c.getResources(), android.graphics.Bitmap.createBitmap(view
			.getDrawingCache()));
	view.setDrawingCacheEnabled(false);
	return AndroidGraphicFactory.convertToBitmap(drawable);
}
 
开发者ID:saintbyte,项目名称:openbmap,代码行数:10,代码来源:MapUtils.java

示例13: viewToBitmap

import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
public static Bitmap viewToBitmap(Context c, View view) {
    view.measure(MeasureSpec.getSize(view.getMeasuredWidth()),
            MeasureSpec.getSize(view.getMeasuredHeight()));
    view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
    view.setDrawingCacheEnabled(true);
    Drawable drawable = new BitmapDrawable(c.getResources(),
            android.graphics.Bitmap.createBitmap(view.getDrawingCache()));
    view.setDrawingCacheEnabled(false);
    return AndroidGraphicFactory.convertToBitmap(drawable);
}
 
开发者ID:marunjar,项目名称:anewjkuapp,代码行数:11,代码来源:MapUtils.java

示例14: onCreate

import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle sis) {
	Drawable drawableGreen = getResources().getDrawable(
			R.drawable.marker_green);
	Drawable drawableRed = getResources()
			.getDrawable(R.drawable.marker_red);
	bitmapRed = AndroidGraphicFactory.convertToBitmap(drawableRed);
	bitmapGreen = AndroidGraphicFactory.convertToBitmap(drawableGreen);
	marker = new Marker(latLong, bitmapGreen, 0,
			-bitmapGreen.getHeight() / 2);
	super.onCreate(sis);
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:13,代码来源:ChangingBitmaps.java

示例15: createLayers

import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
@Override
protected void createLayers() {
	super.createLayers();

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

	// create the overlay and tell it to follow the location
	this.myLocationOverlay = new MyLocationOverlay(this,
			this.mapView.getModel().mapViewPosition, bitmap);
	this.myLocationOverlay.setSnapToLocationEnabled(true);
	mapView.getLayerManager().getLayers().add(this.myLocationOverlay);
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:15,代码来源:LocationOverlayMapViewer.java


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