Example #1
0
 public Marker(MapView mapView, final ResourceProxy resourceProxy) {
   super(resourceProxy);
   mBearing = 0.0f;
   mAlpha = 1.0f; // opaque
   mPosition = new GeoPoint(0.0, 0.0);
   mAnchorU = ANCHOR_CENTER;
   mAnchorV = ANCHOR_CENTER;
   mIWAnchorU = ANCHOR_CENTER;
   mIWAnchorV = ANCHOR_TOP;
   mDraggable = false;
   mIsDragged = false;
   mPositionPixels = new Point();
   mPanToView = true;
   mFlat = false; // billboard
   mOnMarkerClickListener = null;
   mOnMarkerDragListener = null;
   if (mDefaultIcon == null) mDefaultIcon = resourceProxy.getDrawable(bitmap.marker_default);
   mIcon = mDefaultIcon;
   if (mDefaultInfoWindow == null || mDefaultInfoWindow.mMapView != mapView) {
     // build default bubble, that will be shared between all markers using the default one:
     /* pre-aar version
     Context context = mapView.getContext();
     String packageName = context.getPackageName();
     int defaultLayoutResId = context.getResources().getIdentifier("bonuspack_bubble", "layout", packageName);
     if (defaultLayoutResId == 0)
     	Log.e(BonusPackHelper.LOG_TAG, "Marker: layout/bonuspack_bubble not found in "+packageName);
     else
     	mDefaultInfoWindow = new MarkerInfoWindow(defaultLayoutResId, mapView);
     */
     // get the default layout now included in the aar library
     mDefaultInfoWindow = new MarkerInfoWindow(R.layout.bonuspack_bubble, mapView);
   }
   setInfoWindow(mDefaultInfoWindow);
 }
 public CastLocationOverlay(
     Context context,
     OnItemGestureListener<OverlayItem> pOnItemGestureListener,
     ResourceProxy pResourceProxy) {
   super(
       new ArrayList<OverlayItem>(),
       pResourceProxy.getDrawable(ResourceProxy.bitmap.marker_default),
       pOnItemGestureListener,
       pResourceProxy);
   mContext = context;
 }
 public ItemizedOverlayWithFocus(
     final List<Item> aList,
     final OnItemGestureListener<Item> aOnItemTapListener,
     final ResourceProxy pResourceProxy) {
   this(
       aList,
       pResourceProxy.getDrawable(ResourceProxy.bitmap.marker_default),
       null,
       NOT_SET,
       aOnItemTapListener,
       pResourceProxy);
 }
Example #4
0
  protected String scaleBarLengthText(
      final int meters, final boolean imperial, final boolean nautical) {
    if (this.imperial) {
      if (meters >= METERS_PER_STATUTE_MILE * 5) {
        return resourceProxy.getString(
            ResourceProxy.string.format_distance_miles, (int) (meters / METERS_PER_STATUTE_MILE));

      } else if (meters >= METERS_PER_STATUTE_MILE / 5) {
        return resourceProxy.getString(
            ResourceProxy.string.format_distance_miles,
            ((int) (meters / (METERS_PER_STATUTE_MILE / 10.0))) / 10.0);
      } else {
        return resourceProxy.getString(
            ResourceProxy.string.format_distance_feet, (int) (meters * FEET_PER_METER));
      }
    } else if (this.nautical) {
      if (meters >= METERS_PER_NAUTICAL_MILE * 5) {
        return resourceProxy.getString(
            ResourceProxy.string.format_distance_nautical_miles,
            ((int) (meters / METERS_PER_NAUTICAL_MILE)));
      } else if (meters >= METERS_PER_NAUTICAL_MILE / 5) {
        return resourceProxy.getString(
            ResourceProxy.string.format_distance_nautical_miles,
            (((int) (meters / (METERS_PER_NAUTICAL_MILE / 10.0))) / 10.0));
      } else {
        return resourceProxy.getString(
            ResourceProxy.string.format_distance_feet, ((int) (meters * FEET_PER_METER)));
      }
    } else {
      if (meters >= 1000 * 5) {
        return resourceProxy.getString(
            ResourceProxy.string.format_distance_kilometers, (meters / 1000));
      } else if (meters >= 1000 / 5) {
        return resourceProxy.getString(
            ResourceProxy.string.format_distance_kilometers, (int) (meters / 100.0) / 10.0);
      } else {
        return resourceProxy.getString(ResourceProxy.string.format_distance_meters, meters);
      }
    }
  }
  public ItemizedOverlayWithFocus(
      final List<Item> aList,
      final Drawable pMarker,
      final Drawable pMarkerFocused,
      final int pFocusedBackgroundColor,
      final OnItemGestureListener<Item> aOnItemTapListener,
      final ResourceProxy pResourceProxy) {

    super(aList, pMarker, aOnItemTapListener, pResourceProxy);

    UNKNOWN = mResourceProxy.getString(ResourceProxy.string.unknown);

    if (pMarkerFocused == null) {
      this.mMarkerFocusedBase =
          boundToHotspot(
              mResourceProxy.getDrawable(ResourceProxy.bitmap.marker_default_focused_base),
              HotspotPlace.BOTTOM_CENTER);
    } else this.mMarkerFocusedBase = pMarkerFocused;

    this.mMarkerFocusedBackgroundColor =
        (pFocusedBackgroundColor != NOT_SET)
            ? pFocusedBackgroundColor
            : DEFAULTMARKER_BACKGROUNDCOLOR;

    this.mMarkerBackgroundPaint = new Paint(); // Color is set in onDraw(...)

    // max width = screen width - 10 pixels (for box border)
    DESCRIPTION_MAXWIDTH = pResourceProxy.getWindowManagerDisplay().getWidth() - 10;
    DESCRIPTION_LINE_HEIGHT = Math.round(mScale * 16f);
    DESCRIPTION_TITLE_EXTRA_LINE_HEIGHT = Math.round(mScale * 2f);

    this.mDescriptionPaint = new Paint();
    this.mDescriptionPaint.setAntiAlias(true);
    this.mTitlePaint = new Paint();
    this.mTitlePaint.setFakeBoldText(true);
    this.mTitlePaint.setAntiAlias(true);
    this.unSetFocusedItem();
  }