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


Java OverlayItem类代码示例

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


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

示例1: addMarker

import com.google.android.maps.OverlayItem; //导入依赖的package包/类
@Override
public void addMarker(final Marker aMarker) {
	if (mItemizedOverlay == null) {
		mItemizedOverlay = new GoogleItemizedOverlay(mMapView.getContext().getResources().getDrawable(R.drawable.marker_default));
		mMapView.getOverlays().add(mItemizedOverlay);
	}
	final OverlayItem item = new OverlayItem(new GeoPoint((int)(aMarker.latitude*1E6), (int)(aMarker.longitude*1E6)), aMarker.title, aMarker.snippet);
	if (aMarker.bitmap != null || aMarker.icon != 0) {
		final Drawable drawable = aMarker.bitmap != null
		? new BitmapDrawable(mMapView.getResources(), aMarker.bitmap)
		: mMapView.getResources().getDrawable(aMarker.icon);
		if (aMarker.anchor == Marker.Anchor.CENTER) {
			GoogleItemizedOverlay.setOverlayMarkerCentered(item, drawable);
		} else {
			item.setMarker(drawable);
	}}
	mItemizedOverlay.addOverlay(item);
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:19,代码来源:GoogleV1MapWrapper.java

示例2: onFocusChanged

import com.google.android.maps.OverlayItem; //导入依赖的package包/类
public void onFocusChanged(ItemizedOverlay itemizedoverlay, OverlayItem overlayItem) {
	try{
		//Log.v(TAG, "onFocusChanged(..) called.");
		//Log.d(TAG, "focused OverlayItem overlayitem == " + overlayItem );
		
		// Make the selected view visible. 
		if( null == overlayItem ){
			selectAreaItemView.setVisibility(View.GONE);
		}else{
			// Set the selected view's properties.
			selectAreaItemTitleView.setText(overlayItem.getTitle());
			selectAreaItemSnippetView.setText(overlayItem.getSnippet());
			selectAreaItemView.setVisibility(View.VISIBLE);
			// TODO: Add icon image when available.
		}
	}catch(HandledException h){ // Ignore.
	}catch(Exception exp){
		Log.e(TAG, "ERR0005W", exp);
		ErrorUtil.handleExceptionFinish("ERR0005W", exp, mActivity);
	}
}
 
开发者ID:SpencerRiddering,项目名称:flingtap-done,代码行数:22,代码来源:SelectGlobalPositionPart.java

示例3: onPostExecute

import com.google.android.maps.OverlayItem; //导入依赖的package包/类
@Override
protected void onPostExecute(Location loc) {
	//add our overlay
	OverlayItem overlay = new OverlayItem(loc.center.asGeoPoint(), loc.name, loc.description);
	overlay.setMarker(transparent);
	PointOfInterest poi = new PointOfInterest(loc, overlay);
	poiMap.put(loc.id, poi);
	pois.add(poi);
	populate();
	
	//and select it
	POILayer.this.animate = animate;
	setLastFocusedIndex(pois.indexOf(poi));
	onTap(pois.indexOf(poi));
	POILayer.this.animate = true;
}
 
开发者ID:almajeas,项目名称:RHITMobile-Android,代码行数:17,代码来源:POILayer.java

示例4: onCreate

import com.google.android.maps.OverlayItem; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Get the location manager
    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    UserData.setLocation(locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER));
    locationListener = new MapLocationListener();

    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, minTime, minMeters, locationListener);

    // Find the most recent lat/lon or if none use the default
    GeoPoint point = new GeoPoint(UserData.getLatitudeE6(), UserData.getLongitudeE6());

    // Move the map view to the point
    mapController.animateTo(point);

    // Get the overlays and add our GPS point
    mapOverlays = mapView.getOverlays();
    icon = getResources().getDrawable(R.drawable.icon);
    gpsOverlay = new HashMapItemizedOverlay(icon);
    overlayItem = new OverlayItem(point, "MyGps", "The current position of my GPS");
    gpsOverlay.addOverlay(overlayItem);
    mapOverlays.add(gpsOverlay);
}
 
开发者ID:phishman3579,项目名称:android-openmap-framework,代码行数:29,代码来源:CenteredMapActivity.java

示例5: onLocationChanged

import com.google.android.maps.OverlayItem; //导入依赖的package包/类
public void onLocationChanged(Location location) {
    if (location != null) {
        List<Overlay> mapOverlays = mapView.getOverlays();
        Drawable drawable = LocateActivity.this.getResources().getDrawable(R.drawable.curloc);
        MapOverlayItem itemizedoverlay = new MapOverlayItem(drawable, LocateActivity.this);

        curLoc = new GeoPoint((int) (location.getLatitude() * 1E6), (int) (location.getLongitude() * 1E6));

        UserModel.getInstance().setCurrentLocation(curLoc);

        if (Math.abs(curLoc.getLatitudeE6() - previousLoc.getLatitudeE6()) > 1E4
                && Math.abs(curLoc.getLongitudeE6() - previousLoc.getLongitudeE6()) > 1E3) {
            mapView.getController().animateTo(curLoc);
            mapView.getController().setZoom(15);
        }

        OverlayItem overlayitem = new OverlayItem(curLoc, getString(R.string.me), getString(R.string.my_cur_loc));
        itemizedoverlay.addOverlay(overlayitem);
        if (previousLocOverlay != null) {
            mapOverlays.remove(previousLocOverlay);
        }
        mapOverlays.add(itemizedoverlay);
        previousLocOverlay = itemizedoverlay;
        previousLoc = curLoc;
    }
}
 
开发者ID:wpinnoo,项目名称:PharmaApp,代码行数:27,代码来源:LocateActivity.java

示例6: createItem

import com.google.android.maps.OverlayItem; //导入依赖的package包/类
@Override
public OverlayItem createItem(int i) {
    VenueOverlayItem item = (VenueOverlayItem)super.createItem(i);
    Stats stats = item.getVenue().getStats();
    if (stats != null && stats.getBeenhere() != null && stats.getBeenhere().me()) {
        if (DEBUG) Log.d(TAG, "using the beenThereMarker for: " + item.getVenue());
        item.setMarker(mBeenThereMarker);
    }
    return item;
}
 
开发者ID:Kamshak,项目名称:foursquared,代码行数:11,代码来源:SearchVenuesMapActivity.java

示例7: onTap

import com.google.android.maps.OverlayItem; //导入依赖的package包/类
@Override
public void onTap(OverlayItem itemSelected, OverlayItem itemLastSelected, CheckinGroup cg) {
	mTappedVenue = cg.getVenue();
    mCallout.setTitle(cg.getVenue().getName());
    mCallout.setMessage(cg.getDescription());
    mCallout.setVisibility(View.VISIBLE);

    mMapController.animateTo(new GeoPoint(cg.getLatE6(), cg.getLonE6()));
}
 
开发者ID:Kamshak,项目名称:foursquared,代码行数:10,代码来源:FriendsMapActivity.java

示例8: createItem

import com.google.android.maps.OverlayItem; //导入依赖的package包/类
@Override
protected OverlayItem createItem(int i) {
    Tip tip = (Tip)group.get(i);
    if (DEBUG) Log.d(TAG, "creating tip overlayItem: " + tip.getVenue().getName());
    int lat = (int)(Double.parseDouble(tip.getVenue().getGeolat()) * 1E6);
    int lng = (int)(Double.parseDouble(tip.getVenue().getGeolong()) * 1E6);
    GeoPoint point = new GeoPoint(lat, lng);
    return new TipOverlayItem(point, tip);
}
 
开发者ID:Kamshak,项目名称:foursquared,代码行数:10,代码来源:TipItemizedOverlay.java

示例9: createItem

import com.google.android.maps.OverlayItem; //导入依赖的package包/类
@Override
protected OverlayItem createItem(int i) {
    Venue venue = (Venue)group.get(i);
    GeoPoint point = GeoUtils.stringLocationToGeoPoint(
            venue.getGeolat(), venue.getGeolong());
    return new VenueOverlayItem(point, venue, mContext, mRrm);
}
 
开发者ID:Kamshak,项目名称:foursquared,代码行数:8,代码来源:VenueItemizedOverlayWithIcons.java

示例10: createItem

import com.google.android.maps.OverlayItem; //导入依赖的package包/类
@Override
protected OverlayItem createItem(int i) {
    Venue venue = (Venue)group.get(i);
    if (DEBUG) Log.d(TAG, "creating venue overlayItem: " + venue.getName());
    int lat = (int)(Double.parseDouble(venue.getGeolat()) * 1E6);
    int lng = (int)(Double.parseDouble(venue.getGeolong()) * 1E6);
    GeoPoint point = new GeoPoint(lat, lng);
    return new VenueOverlayItem(point, venue);
}
 
开发者ID:Kamshak,项目名称:foursquared,代码行数:10,代码来源:VenueItemizedOverlay.java

示例11: createItem

import com.google.android.maps.OverlayItem; //导入依赖的package包/类
@Override
protected OverlayItem createItem(int i) {
    Checkin checkin = (Checkin)group.get(i);
    if (DEBUG) Log.d(TAG, "creating checkin overlayItem: " + checkin.getVenue().getName());
    int lat = (int)(Double.parseDouble(checkin.getVenue().getGeolat()) * 1E6);
    int lng = (int)(Double.parseDouble(checkin.getVenue().getGeolong()) * 1E6);
    GeoPoint point = new GeoPoint(lat, lng);
    return new CheckinOverlayItem(point, checkin);
}
 
开发者ID:Kamshak,项目名称:foursquared,代码行数:10,代码来源:CheckinItemizedOverlay.java

示例12: onTap

import com.google.android.maps.OverlayItem; //导入依赖的package包/类
@Override
public void onTap(OverlayItem itemSelected, OverlayItem itemLastSelected, Venue venue) {
    mTappedVenueId = venue.getId();
    mCallout.setTitle(venue.getName());
    mCallout.setMessage(venue.getAddress());
    mCallout.setVisibility(View.VISIBLE);

    mMapController.animateTo(GeoUtils.stringLocationToGeoPoint(
            venue.getGeolat(), venue.getGeolong()));
}
 
开发者ID:Kamshak,项目名称:foursquared,代码行数:11,代码来源:NearbyVenuesMapActivity.java

示例13: MarkersOverlay

import com.google.android.maps.OverlayItem; //导入依赖的package包/类
public MarkersOverlay(ViajaFacilActivity context) {
		this(context.getResources().getDrawable(R.drawable.markera));
		mContext = context;
/*		GeoPoint point1 = new GeoPoint((int)(-34.62671 * 1E6),(int)(-58.380489 * 1E6));
		GeoPoint point2 = new GeoPoint((int)(-34.609122 * 1E6),(int)(-58.407869 * 1E6));*/
		GeoPoint point1 = new GeoPoint(0, 0);
		GeoPoint point2 = new GeoPoint(0, 0);
		OverlayItem markerA = new OverlayItem(point1, mContext.getResources().getString(R.string.from), mContext.getResources().getString(R.string.from));
		OverlayItem markerB = new OverlayItem(point2, mContext.getResources().getString(R.string.to), mContext.getResources().getString(R.string.to));
		setOverlay(markerA, mContext.getResources().getDrawable(R.drawable.markera), ViajaFacilActivity.FROM);
		setOverlay(markerB, mContext.getResources().getDrawable(R.drawable.markerb), ViajaFacilActivity.TO);
		populate();
	}
 
开发者ID:Hellek1,项目名称:viaja-facil,代码行数:14,代码来源:MarkersOverlay.java

示例14: createItem

import com.google.android.maps.OverlayItem; //导入依赖的package包/类
@Override
protected OverlayItem createItem(int index) {
  if (index == 0) {
    return firstOverlayItem;
  } else if (index == 1) {
    return secondOverlayItem;
  }
  return null;
}
 
开发者ID:qx,项目名称:FullRobolectricTestSample,代码行数:10,代码来源:ItemizedOverlayTest.java

示例15: addOverlay

import com.google.android.maps.OverlayItem; //导入依赖的package包/类
/**
 * Add an item to the overall overlay list
 * @param overlay {@link com.google.android.maps.OverlayItem} to be added
 * @param marker {@link android.graphics.drawable.Drawable} of this item
 */
public void addOverlay(OverlayItem overlay, Drawable marker)
{
	// set marker for this item
	overlay.setMarker(boundCenterBottom(marker));
    mOverlays.add(overlay);
    populate();
}
 
开发者ID:BlackHawk90,项目名称:myStress,代码行数:13,代码来源:MapViewerOverlay.java


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