• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Circle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ThreeStateLocationOverlay

import org.mapsforge.map.layer.overlay.Circle; //导入依赖的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


示例2: createCircle

import org.mapsforge.map.layer.overlay.Circle; //导入依赖的package包/类
/**
   * Draws a circle on the map view.
   * @param latLong
   * @param radius	Note: The radius is in meters!
   * @param fillColor
   * @param strokeColor
   * @param strokeWidth
   * @return identifier for the object.
   */
  public int createCircle(LatLong latLong, float radius, Color fillColor, Color strokeColor, float strokeWidth) {
  	Paint paintFill = mGraphicFactory.createPaint();
  	paintFill.setColor(fillColor);
  	paintFill.setStyle(Style.FILL);
  	
  	Paint paintStroke = mGraphicFactory.createPaint();
  	paintStroke.setColor(strokeColor);
  	paintStroke.setStrokeWidth(strokeWidth);
  	paintStroke.setStyle(Style.STROKE);
  	
  	Circle c = new Circle(latLong, radius, paintFill, paintStroke);
MapView mapView = (MapView) getNativeView();
  	mapView.getLayerManager().getLayers().add(c);
  	mLayers.put(Integer.toString(c.hashCode()), c);
mapView.getLayerManager().redrawLayers();

  	return c.hashCode();
  }
 
开发者ID:snowciety,项目名称:sc.mapsforge,代码行数:28,代码来源:MapsforgeView.java


示例3: MyLocationOverlay

import org.mapsforge.map.layer.overlay.Circle; //导入依赖的package包/类
/**
 * Constructs a new {@code MyLocationOverlay} with the given circle paints.
 *
 * @param activity        a reference to the activity.
 * @param mapViewPosition the {@code MapViewPosition} whose location will be updated.
 * @param bitmap          a bitmap to display at the current location (might be null).
 * @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 MyLocationOverlay(Activity activity, MapViewPosition mapViewPosition, Bitmap bitmap, Paint circleFill,
                         Paint circleStroke) {
    super();
    this.activity = activity;
    this.mapViewPosition = mapViewPosition;
    this.locationManager = (LocationManager) activity.getSystemService(Context.LOCATION_SERVICE);
    this.marker = new Marker(null, bitmap, 0, 0);
    this.circle = new Circle(null, 0, circleFill, circleStroke);
}
 
开发者ID:marunjar,项目名称:anewjkuapp,代码行数:19,代码来源:MyLocationOverlay.java


示例4: applyLocationProviderStyle

import org.mapsforge.map.layer.overlay.Circle; //导入依赖的package包/类
/**
 * Applies a style to the map overlays associated with a given location provider.
 * 
 * This method changes the style (effectively, the color) of the circle and
 * marker overlays. Its main purpose is to switch the color of the overlays
 * between gray and the provider color.
 * 
 * @param context The context of the caller
 * @param provider The name of the location provider, as returned by
 * {@link LocationProvider.getName()}.
 * @param styleName The name of the style to apply. If it is null, the
 * default style for the provider as returned by 
 * assignLocationProviderStyle() is applied. 
 */
protected void applyLocationProviderStyle(Context context, String provider, String styleName) {
	String sn = (styleName != null)?styleName:assignLocationProviderStyle(provider);

	Boolean isStyleChanged = !sn.equals(providerAppliedStyles.get(provider));
	Boolean needsRedraw = false;

	Resources res = context.getResources();
	TypedArray style = res.obtainTypedArray(res.getIdentifier(sn, "array", context.getPackageName()));

	// Circle layer
	Circle circle = mapCircles.get(provider);
	if (circle != null) {
		circle.getPaintFill().setColor(style.getColor(Const.STYLE_FILL, R.color.circle_gray_fill));
		circle.getPaintStroke().setColor(style.getColor(Const.STYLE_STROKE, R.color.circle_gray_stroke));
		needsRedraw = isStyleChanged && circle.isVisible();
	}

	//Marker layer
	Marker marker = mapMarkers.get(provider);
	if (marker != null) {
		Drawable drawable = style.getDrawable(Const.STYLE_MARKER);
		Bitmap bitmap = AndroidGraphicFactory.convertToBitmap(drawable);
		marker.setBitmap(bitmap);
		needsRedraw = needsRedraw || (isStyleChanged && marker.isVisible());
	}

	if (needsRedraw)
		mapMap.getLayerManager().redrawLayers();
	providerAppliedStyles.put(provider, sn);
	style.recycle();
}
 
开发者ID:mvglasow,项目名称:satstat,代码行数:46,代码来源:MapSectionFragment.java


示例5: onCatalogLoaded

import org.mapsforge.map.layer.overlay.Circle; //导入依赖的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


示例6: onCatalogLoaded

import org.mapsforge.map.layer.overlay.Circle; //导入依赖的package包/类
@Override
public final void onCatalogLoaded(final List<LatLong> points) {
    Log.d(TAG, "Loaded catalog objects");
    if (mMapView == null) {
        return;
    }

    final Layers layers = mMapView.getLayerManager().getLayers();

    clearCatalogLayer();

    // redraw
    for (final LatLong point : points) {
        final Circle circle = new Circle(point, CIRCLE_WIFI_CATALOG_WIDTH, mPaintCatalogFill, mPaintCatalogStroke);
        mCatalogObjects.add(circle);
    }

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

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

    // enable next refresh
    mRefreshCatalogPending = false;
    Log.d(TAG, "Drawed catalog objects");
}
 
开发者ID:openbmap,项目名称:radiocells-scanner-android,代码行数:43,代码来源:MapViewActivity.java


示例7: onLocationChanged

import org.mapsforge.map.layer.overlay.Circle; //导入依赖的package包/类
/**
 * Called when a new location is found by a registered location provider.
 * Stores the location and updates GPS display and map view.
 */
public void onLocationChanged(Location location) {
	// some providers may report NaN for latitude and longitude:
	// if that happens, do not process this location and mark any previous
	// location from that provider as stale
	if (Double.isNaN(location.getLatitude()) || Double.isNaN(location.getLongitude())) {
		markLocationAsStale(providerLocations.get(location.getProvider()));
		applyLocationProviderStyle(this.getContext(), location.getProvider(), Const.LOCATION_PROVIDER_GRAY);
		return;
	}

	if (providerLocations.containsKey(location.getProvider()))
		providerLocations.put(location.getProvider(), new Location(location));

	LatLong latLong = new LatLong(location.getLatitude(), location.getLongitude());

	Circle circle = mapCircles.get(location.getProvider());
	Marker marker = mapMarkers.get(location.getProvider());

	if (circle != null) {
		circle.setLatLong(latLong);
		if (location.hasAccuracy()) {
			circle.setVisible(true);
			circle.setRadius(location.getAccuracy());
		} else {
			Log.d("MainActivity", "Location from " + location.getProvider() + " has no accuracy");
			circle.setVisible(false);
		}
	}

	if (marker != null) {
		marker.setLatLong(latLong);
		marker.setVisible(true);
	}

	applyLocationProviderStyle(this.getContext(), location.getProvider(), null);

	Runnable invalidator = providerInvalidators.get(location.getProvider());
	if (invalidator != null) {
		providerInvalidationHandler.removeCallbacks(invalidator);
		providerInvalidationHandler.postDelayed(invalidator, PROVIDER_EXPIRATION_DELAY);
	}

	// redraw, move locations into view and zoom out as needed
	if ((circle != null) || (marker != null) || (invalidator != null))
		updateMap();
}
 
开发者ID:mvglasow,项目名称:satstat,代码行数:51,代码来源:MapSectionFragment.java


示例8: MyLocationOverlay

import org.mapsforge.map.layer.overlay.Circle; //导入依赖的package包/类
/**
 * Constructs a new {@code MyLocationOverlay} with the given circle paints.
 *
 * @param context
 *            a reference to the application context.
 * @param mapViewPosition
 *            the {@code MapViewPosition} whose location will be updated.
 * @param bitmap
 *            a bitmap to display at the current location (might be null).
 * @param circleFill
 *            the {@code Paint} used to fill the circle that represents the
 *            current location (might be null).
 * @param circleStroke
 *            the {@code Paint} used to stroke the circle that represents
 *            the current location (might be null).
 */
public MyLocationOverlay(Context context, MapViewPosition mapViewPosition, Bitmap bitmap, Paint circleFill,
		Paint circleStroke, String userText) {
	super();

	this.mapViewPosition = mapViewPosition;
	this.locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
	this.marker = new Marker(null, bitmap, 0, 0);
	this.circle = new Circle(null, 0, circleFill, circleStroke);
	this.userText = userText;
	this.context = context;
}
 
开发者ID:monossido,项目名称:CoopTDMOrienteering,代码行数:28,代码来源:MyLocationOverlay.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PageId类代码示例发布时间:2022-05-22
下一篇:
Java GenericUDTF类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap