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


Java OverlayItem类代码示例

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


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

示例1: setBoundingBox

import org.osmdroid.views.overlay.OverlayItem; //导入依赖的package包/类
private void setBoundingBox() {
    double minLat = Integer.MAX_VALUE;
    double maxLat = Integer.MIN_VALUE;
    double minLong = Integer.MAX_VALUE;
    double maxLong = Integer.MIN_VALUE;

    for (OverlayItem item : placeMarkers) {
        GeoPoint point = new GeoPoint(item.getPoint().getLatitude(), item.getPoint().getLongitude());
        if (point.getLatitude() < minLat)
            minLat = point.getLatitude();
        if (point.getLatitude() > maxLat)
            maxLat = point.getLatitude();
        if (point.getLongitude() < minLong)
            minLong = point.getLongitude();
        if (point.getLongitude() > maxLong)
            maxLong = point.getLongitude();
    }

    BoundingBox boundingBox = new BoundingBox(maxLat, maxLong, minLat, minLong);
    map.zoomToBoundingBox(boundingBox, true);
}
 
开发者ID:hamzux,项目名称:cosi,代码行数:22,代码来源:PlacesFragment.java

示例2: updateMarker

import org.osmdroid.views.overlay.OverlayItem; //导入依赖的package包/类
private void updateMarker(GeoPoint pt, boolean center) {
    final String markerTitle = "Fake Location", markerDescription = "You seem to be here.";

    // add marker for new location
    markerOverlay = new OverlayItem(markerTitle, markerDescription, pt);
    markerOverlay.setMarker(myMarker);

    // replace marker. there's no method for updating it directly
    markersOverlay.removeAllItems();
    markersOverlay.addItem(markerOverlay);

    // pan map?
    if (center) {
        mapController.setCenter(pt);
    } else {
        // redraw map to show new marker
        findViewById(R.id.map).invalidate();
    }
}
 
开发者ID:spezifisch,项目名称:ThreeStepsAhead,代码行数:20,代码来源:MainActivity.java

示例3: run

import org.osmdroid.views.overlay.OverlayItem; //导入依赖的package包/类
public void run()
{
    try {
        JSONArray jr3 = Utils.getJSON("https://applications002.brest-metropole.fr/WIPOD01/Transport.svc/getGeolocatedVehiclesPosition?format=json&route_id=" + product + "&trip_headsign=" + terminus.replace(" ", "%20"));
        Resources res = getResources();
        overlayItemArray.clear();
        mMap.getOverlays().clear();
        mMap.invalidate();
        for (int i = 0; i < jr3.length(); i++) {
            JSONObject object = (JSONObject) jr3.getJSONObject(i);
            OverlayItem overlayItem = new OverlayItem("0, 0", "0, 0", new GeoPoint(Double.valueOf(object.getString("Lat")), Double.valueOf(object.getDouble("Lon"))));
            overlayItem.setMarker(res.getDrawable(R.drawable.icone_bus));
            overlayItemArray.add(overlayItem);
        }
        ItemizedIconOverlay<OverlayItem> anotherItemizedIconOverlay = new ItemizedIconOverlay<OverlayItem>(getActivity(), overlayItemArray, null);
        mMap.getOverlays().add(roadOverlay);
        mMap.getOverlays().add(anotherItemizedIconOverlay);
    } catch (Exception ex) { ex.getMessage(); }

    mHandler.postDelayed(m_Runnable, 60000);
}
 
开发者ID:Darkitty,项目名称:BTB,代码行数:22,代码来源:Fragment_traceLine.java

示例4: DelayedSetCenterZoom

import org.osmdroid.views.overlay.OverlayItem; //导入依赖的package包/类
/** calculate min/max from all Markers in all overlaysWithMarkers */
public DelayedSetCenterZoom(ArrayList<OverlayItem> overlaysWithMarkers, int zoomLevel) {
    if (overlaysWithMarkers.size() > 0) {
        OverlayItem first = overlaysWithMarkers.get(0);
        final IGeoPoint firstPoint = first.getPoint();
        GeoPoint min = new GeoPoint(firstPoint.getLatitudeE6(), firstPoint.getLongitudeE6());
        GeoPoint max = null;
        if (overlaysWithMarkers.size() > 1) {
            max = min.clone();
            for (OverlayItem item : overlaysWithMarkers) {
                getMinMax(min, max, item.getPoint());
            }
        }
        mMin = min;
        mMax = max;
    }
    mZoomLevel = zoomLevel;
}
 
开发者ID:k3b,项目名称:LocationMapViewer,代码行数:19,代码来源:LocationMapViewer.java

示例5: onItemSingleTapUp

import org.osmdroid.views.overlay.OverlayItem; //导入依赖的package包/类
@Override
public boolean onItemSingleTapUp(int index, OverlayItem item) {
	//
	Intent intent = new Intent(context, App2Activity.class);
	intent.putExtra("restaurant", responseWs.getRestaurants()
			.get(index));
	// intent.putExtra("stwing", "FAAAAAKE !!!");
	startActivity(intent);

	// Toast.makeText(
	// myApp.this,
	// item.getSnippet() + "\n" + item.getTitle() + "\n"
	// + item.getPoint().getLatitudeE6() + " : "
	// + item.getPoint().getLongitudeE6(),
	// Toast.LENGTH_LONG).show();
	return true;
}
 
开发者ID:TareeqH,项目名称:GeoWork,代码行数:18,代码来源:myApp.java

示例6: onItemSingleTapUp

import org.osmdroid.views.overlay.OverlayItem; //导入依赖的package包/类
@Override
public boolean onItemSingleTapUp(int index, OverlayItem item) {

	Intent intent = new Intent(context, App2Activity.class);
	// intent.putExtra("restaurant", responseWs.getRestaurants()
	// .get(index));
	intent.putExtra("stwing", "FAAAAAKE !!!");
	startActivity(intent);

	// Toast.makeText(
	// AndroidOpenStreetMapViewActivity.this,
	// item.getSnippet() + "\n" + item.getTitle() + "\n"
	// + item.getPoint().getLatitudeE6() + " : "
	// + item.getPoint().getLongitudeE6(),
	// Toast.LENGTH_LONG).show();
	return true;
}
 
开发者ID:TareeqH,项目名称:GeoWork,代码行数:18,代码来源:AndroidOpenStreetMapViewActivity.java

示例7: StationsOverlay

import org.osmdroid.views.overlay.OverlayItem; //导入依赖的package包/类
public StationsOverlay(
		Context context,
		List<Station> stations,
		StationClickListener clickListener) {

	super(
			context.getResources().getDrawable(android.R.drawable.presence_online),
			new ResourceProxyImpl(context));

	Assert.assertNotNull(context, stations);

	this.stations.addAll(stations);
	this.clickListener = clickListener;

	for (Station station : stations) {
		String name = station.getStationName();
		if (station.getLatitude() != null && station.getLongitude() != null) {
			GeoPoint point = new GeoPoint(station.getLatitude(), station.getLongitude());
			overlayItems.add(new OverlayItem(name, name, point));
		}
	}

	populate();
}
 
开发者ID:jvalue,项目名称:hochwasser-app,代码行数:25,代码来源:StationsOverlay.java

示例8: onItemLongPress

import org.osmdroid.views.overlay.OverlayItem; //导入依赖的package包/类
@Override
public boolean onItemLongPress(int arg0, OverlayItem overlay) {
	synchronized (hashMapMutex) {
		String recipentName = overlay.getTitle();
		String recipentFacebookID = overlayItemToFacebookIDMap
				.get(overlay);

		if (recipentFacebookID != null && !recipentFacebookID.isEmpty()) {
			// show the user ialog, sending the messages to the server
			// backend is done there as well
			Dialog pokeDialog = GameDialogs.createUserPokeDialog(
					getActivity(), MainActivity.getInstance()
							.getFacebookID(getActivity()),
					recipentName, recipentFacebookID);

			pokeDialog.show();
		}
	}

	return true;
}
 
开发者ID:tum-social-gaming,项目名称:SocialGamingClient,代码行数:22,代码来源:MapSectionFragment.java

示例9: drawMarker

import org.osmdroid.views.overlay.OverlayItem; //导入依赖的package包/类
private void drawMarker(final Canvas canvas,
                        final IProjection projection,
                        final OverlayItem marker)
{
  if(marker == null)
    return;

  projection.toPixels(marker.mGeoPoint, screenPos_);

  canvas.getMatrix(canvasTransform_);
  canvasTransform_.getValues(transformValues_);

  final BitmapDrawable thingToDraw = (BitmapDrawable)marker.getDrawable();
  final int halfWidth = thingToDraw.getIntrinsicWidth()/2;
  final int halfHeight = thingToDraw.getIntrinsicHeight()/2;
  bitmapTransform_.setTranslate(-halfWidth, -halfHeight);
  bitmapTransform_.postScale(1/transformValues_[Matrix.MSCALE_X], 1/transformValues_[Matrix.MSCALE_Y]);
  bitmapTransform_.postTranslate(screenPos_.x, screenPos_.y);
  canvas.drawBitmap(thingToDraw.getBitmap(), bitmapTransform_, bitmapPaint_);
}
 
开发者ID:MobileAppCodes,项目名称:CycleStreets-Android-app-,代码行数:21,代码来源:TapToRouteOverlay.java

示例10: refresh

import org.osmdroid.views.overlay.OverlayItem; //导入依赖的package包/类
public void refresh() {
	wayPointItems.clear();
	
	Cursor c = this.pContentResolver.query(
			TrackContentProvider.waypointsUri(trackId),
			null, null, null, TrackContentProvider.Schema.COL_TIMESTAMP + " asc");

	for(c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {
		OverlayItem i = new OverlayItem(
				c.getString(c.getColumnIndex(Schema.COL_NAME)),
				c.getString(c.getColumnIndex(Schema.COL_NAME)),
				new GeoPoint(
						c.getDouble(c.getColumnIndex(Schema.COL_LATITUDE)),
						c.getDouble(c.getColumnIndex(Schema.COL_LONGITUDE)))
				);
		wayPointItems.add(i);
	}
	c.close();
	populate();
}
 
开发者ID:WanderWiki,项目名称:WanderWiki-client,代码行数:21,代码来源:WayPointsOverlay.java

示例11: showDealersOnMap

import org.osmdroid.views.overlay.OverlayItem; //导入依赖的package包/类
private void showDealersOnMap(DealersList aDealersList) {
  Log.i(LOGTAG, "Showing dealers on map");
  if (aDealersList == null) {
    return;
  }
  List<Dealer> tmpDealers = aDealersList.getDealers();
  if (tmpDealers == null) {
    return;
  }
  ArrayList<OverlayItem> tmpMarkers = new ArrayList<OverlayItem>();
  for (Dealer tmpDealer : tmpDealers) {
    tmpMarkers.add(new OverlayItem(tmpDealer.getName(), "Test", new GeoPoint(tmpDealer.getLatitude(), tmpDealer.getLongitude())));
  }
  // TODO insert tap action
  ItemizedIconOverlay<OverlayItem> tmpDealerOverlay = new ItemizedIconOverlay<OverlayItem>(tmpMarkers, null, resourceProxy);
  mMap.getOverlays().add(tmpDealerOverlay);
}
 
开发者ID:guerda,项目名称:Matekarte,代码行数:18,代码来源:MapActivity.java

示例12: addIcons

import org.osmdroid.views.overlay.OverlayItem; //导入依赖的package包/类
private void addIcons(int count) {
      /* Create a static ItemizedOverlay showing some Markers on various cities. */
     final ArrayList<OverlayItem> items = new ArrayList<>();
     for (int i = 0; i < count; i++) {
          double random_lon = (Math.random() * 360) - 180;
          double random_lat = (Math.random() * 180) - 90;
          overlayItem = new OverlayItem("A random point", "SampleDescription", new GeoPoint(random_lat,
                  random_lon));
          int index = (int) (Math.random() * (icons.size()));
          if (index == icons.size()) {
               index--;
          }
          overlayItem.setMarker(icons.get(index));
          items.add(overlayItem);

     }
     itemOverlay.addItems(items);
     mMapView.invalidate();
     Toast.makeText(getActivity(), count + " icons added! Current size: " + itemOverlay.size(), Toast.LENGTH_SHORT).show();

}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:22,代码来源:SampleMilitaryIconsItemizedIcons.java

示例13: putMarkerItem

import org.osmdroid.views.overlay.OverlayItem; //导入依赖的package包/类
/**
 * add (or replace) an item in markerOverlays. p position.
 */
public ExtendedOverlayItem putMarkerItem(ExtendedOverlayItem item,
		GeoPoint p, int index, int titleResId, int markerResId,
		int iconResId) {
	if (item != null) {
		itineraryMarkers.removeItem(item);
	}
	Drawable marker = getResources().getDrawable(markerResId);
	String title = getResources().getString(titleResId);
	ExtendedOverlayItem overlayItem = new ExtendedOverlayItem(title, "", p,
			this);
	overlayItem.setMarkerHotspot(OverlayItem.HotspotPlace.BOTTOM_CENTER);
	overlayItem.setMarker(marker);
	if (iconResId != -1)
		overlayItem.setImage(getResources().getDrawable(iconResId));
	overlayItem.setRelatedObject(index);
	itineraryMarkers.addItem(overlayItem);
	mv.invalidate();
	// Start geocoding task to update the description of the marker with its
	// address:
	new GeocodingTask().execute(overlayItem);
	return overlayItem;
}
 
开发者ID:nirabpudasaini,项目名称:Mero-Bhada-Meter,代码行数:26,代码来源:MapActivity.java

示例14: putRoadNodes

import org.osmdroid.views.overlay.OverlayItem; //导入依赖的package包/类
private void putRoadNodes(Road road) {
	roadNodeMarkers.removeAllItems();
	Drawable marker = getResources().getDrawable(R.drawable.marker_node);
	int n = road.mNodes.size();
	TypedArray iconIds = getResources().obtainTypedArray(
			R.array.direction_icons);
	for (int i = 0; i < n; i++) {
		RoadNode node = road.mNodes.get(i);
		String instructions = (node.mInstructions == null ? ""
				: node.mInstructions);
		ExtendedOverlayItem nodeMarker = new ExtendedOverlayItem("Step "
				+ (i + 1), instructions, node.mLocation, this);
		nodeMarker.setSubDescription(road.getLengthDurationText(
				node.mLength, node.mDuration));
		nodeMarker.setMarkerHotspot(OverlayItem.HotspotPlace.CENTER);
		nodeMarker.setMarker(marker);
		int iconId = iconIds.getResourceId(node.mManeuverType,
				R.drawable.ic_empty);
		if (iconId != R.drawable.ic_empty) {
			Drawable icon = getResources().getDrawable(iconId);
			nodeMarker.setImage(icon);
		}
		roadNodeMarkers.addItem(nodeMarker);
	}
}
 
开发者ID:nirabpudasaini,项目名称:Mero-Bhada-Meter,代码行数:26,代码来源:MapActivity.java

示例15: onCreate

import org.osmdroid.views.overlay.OverlayItem; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_rider_view_request);

    // unpacking the bundle to get the position of request
    Bundle bundle = getIntent().getExtras();

    int position = bundle.getInt("position");
    request = RequestController.getRiderInstance().get(position);

    setTitle("Request");

    map = (MapView) findViewById(R.id.map);
    map.setTileSource(TileSourceFactory.MAPNIK);
    map.setBuiltInZoomControls(true);
    map.setMultiTouchControls(true);

    startPoint = new GeoPoint(request.getStart());
    endPoint = new GeoPoint(request.getEnd());

    mapController = map.getController();
    mapController.setCenter(getCenter());
    zoomToBounds(getBoundingBox(startPoint, endPoint));

    ArrayList<OverlayItem> overlayItems = new ArrayList<>();
    overlayItems.add(new OverlayItem("Starting Point", "This is the starting point", startPoint));
    overlayItems.add(new OverlayItem("Destination", "This is the destination point", endPoint));

    setViews();
    setMarkers();
    getRoadAsync();
}
 
开发者ID:CMPUT301F16T01,项目名称:Carrier,代码行数:34,代码来源:RiderRequestActivity.java


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