Example #1
0
  private void updateMapLocation(GeoPoint geoPoint) {
    Log.d(TAG, "updateMapLocation():  ");
    ItemizedOverlay<OverlayItem> locationOverlay;
    ResourceProxy resourceProxy =
        new DefaultResourceProxyImpl(getActivity().getApplicationContext());

    if (geoPoint != null) {
      ArrayList<OverlayItem> items = new ArrayList<OverlayItem>();
      items.add(new OverlayItem("Here", "SampleDescription", geoPoint));

      locationOverlay =
          new ItemizedIconOverlay<OverlayItem>(
              items,
              new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
                @Override
                public boolean onItemSingleTapUp(final int index, final OverlayItem item) {
                  return true;
                }

                @Override
                public boolean onItemLongPress(final int index, final OverlayItem item) {
                  return false;
                }
              },
              resourceProxy);

      mapView.getOverlays().clear();
      mapView.getOverlays().add(locationOverlay);
      mapView.getController().setCenter(geoPoint);
      mapView.invalidate();
    } else {
      mapView.getOverlays().clear();
      mapView.invalidate();
    }
  }
  /**
   * @see com.brantapps.polaris.api.Mappable#addMarker(com.brantapps.polaris.api.MapMarkerOptions)
   */
  @Override
  public MapMarker<?> addMarker(final MapMarkerOptions<?> mapMarkerOptions) {
    if (itemisedOverlay == null) {
      itemisedOverlay =
          new ItemizedOverlayWithFocus<OverlayItem>(
              new ArrayList<OverlayItem>(), this, getResourceProxy());
      itemisedOverlay.setFocusItemsOnTap(true);
      mapView.setUseSafeCanvas(false);
      mapView.getOverlays().add(itemisedOverlay);
    }

    final Marker marker = (Marker) mapMarkerOptions.get();
    final OverlayItem item =
        new OverlayItem(
            marker.title,
            marker.snippet,
            new org.osmdroid.util.GeoPoint(marker.latitude, marker.longitude));
    if (marker.bitmap != null) {
      item.setMarker(new BitmapDrawable(mapView.getResources(), marker.bitmap));
    } else if (marker.icon != 0) {
      item.setMarker(mapView.getResources().getDrawable(marker.icon));
    }
    if (marker.anchor == Marker.Anchor.CENTER) {
      item.setMarkerHotspot(OverlayItem.HotspotPlace.CENTER);
    }

    itemisedOverlay.addItem(item);
    final MapMarker<Marker> osmMapMarker = new OpenStreetMapMarker(marker);
    overlayItemToMarker.put(item, osmMapMarker);
    return osmMapMarker;
  }
Example #3
0
  // ======================================================================
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    MapView mapView = (MapView) findViewById(R.id.mapview);
    mapView.setUseSafeCanvas(false);
    mapView.setBuiltInZoomControls(true);
    mapView.setMultiTouchControls(true);

    locationHandler = new LocationHandler();
    ResourceProxy resourceProxy = new DefaultResourceProxyImpl(getApplicationContext());

    Drawable marker = getResources().getDrawable(android.R.drawable.presence_offline);
    int markerWidth = marker.getIntrinsicWidth();
    int markerHeight = marker.getIntrinsicHeight();
    marker.setBounds(0, markerHeight, markerWidth, 0);

    Drawable currMarker = getResources().getDrawable(android.R.drawable.presence_online);
    markerWidth = marker.getIntrinsicWidth();
    markerHeight = marker.getIntrinsicHeight();
    currMarker.setBounds(0, markerHeight, markerWidth, 0);

    prevLocationsOverlay = new MyItemizedOverlay(marker, resourceProxy);
    currLocationOverlay = new MyItemizedOverlay(currMarker, resourceProxy);
    mapView.getOverlays().add(prevLocationsOverlay);
    mapView.getOverlays().add(currLocationOverlay);

    DeviceDb devDb = DeviceDb.getInstance();
    devDb.init(getApplicationContext());
  }
  private boolean onUp(MotionEvent event, MapView mapView) {
    if (this.onTargetClickListener != null && this.isAClick) {
      this.clickUpCoords[0] = event.getX();
      this.clickUpCoords[1] = event.getY();

      if (Math.abs(this.clickUpCoords[0] - this.clickDownCoords[0]) < 10
          && Math.abs(this.clickUpCoords[1] - this.clickDownCoords[1]) < 10) {
        IGeoPoint igeoPoint =
            mapView.getProjection().fromPixels((int) event.getX(), (int) event.getY());
        GeoPoint geoPoint = new GeoPoint(igeoPoint.getLatitudeE6(), igeoPoint.getLongitudeE6());
        if (event.getEventTime() - this.clickDownTime
                < android.view.ViewConfiguration.getLongPressTimeout()
            && isEventOnTarget(event, mapView)) {
          this.lockPosition = true;
          this.onTargetClickListener.onClick(getMyLocation());
          return true;
        } else if (this.lockPosition == false
            && event.getEventTime() - this.clickDownTime
                >= 0) { // android.view.ViewConfiguration.getP) {
          setLocation(geoPoint);
          mapView.invalidate();
          return true;
        }
      }
      this.isAClick = false;
    }
    return false;
  }
Example #5
0
 public void initialmap() {
   mapview = (MapView) this.findViewById(R.id.mapview);
   mapview.setTileSource(TileSourceFactory.MAPQUESTOSM);
   mapview.setBuiltInZoomControls(true);
   mapview.setMultiTouchControls(true);
   mcontrol = (MapController) this.mapview.getController();
   mcontrol.setZoom(15);
 }
 @Override
 public void onRotate(float deltaAngle) {
   currentAngle += deltaAngle;
   if (System.currentTimeMillis() - deltaTime > timeLastSet) {
     timeLastSet = System.currentTimeMillis();
     mMapView.setMapOrientation(mMapView.getMapOrientation() + currentAngle);
   }
 }
Example #7
0
  @Override
  public void onSaveInstanceState(Bundle outState) {
    outState.putParcelable(STATE_MAP_POSITION, (Parcelable) mMapView.getMapCenter());
    outState.putInt(STATE_MAP_ZOOM_LEVEL, mMapView.getZoomLevel());
    outState.putDouble(STATE_INDOOR_LEVEL, mIndoorLevel);

    super.onSaveInstanceState(outState);
  }
 /**
  * @param layoutResId the id of the view resource.
  * @param mapView the mapview on which is hooked the view
  */
 public InfoWindow(int layoutResId, MapView mapView) {
   mMapView = mapView;
   mIsVisible = false;
   ViewGroup parent = (ViewGroup) mapView.getParent();
   Context context = mapView.getContext();
   LayoutInflater inflater =
       (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
   mView = inflater.inflate(layoutResId, parent, false);
 }
 /** @see com.brantapps.polaris.api.Mappable#animateCamera(GeoPoint, int) */
 @Override
 public void animateCamera(final GeoPoint geoPoint, final int zoomLevel) {
   // FIXME: Need to run this on the UI thread. @ForActivity qualify the Context & cast using
   // activity graphs.
   mapView.getController().setZoom(zoomLevel);
   mapView
       .getController()
       .setCenter(new org.osmdroid.util.GeoPoint(geoPoint.getLatitude(), geoPoint.getLongitude()));
 }
 public MapDataManager(MapView mMapView, ResourceProxy rProxy) {
   mapView = mMapView;
   mContext = mMapView.getContext();
   mResourceProxy = rProxy;
   initializeOverlays(mContext);
   mapView.setMapListener(this);
   loadMapTask = new LoadMapDataTask();
   loadMapTask.execute(); // load graph and nodes to display
 }
Example #11
0
  @Override
  protected void draw(Canvas canvas, MapView mapView, boolean shadow) {
    if (shadow) {
      return;
    }
    MapView.Projection p = mapView.getProjection();

    int idx = 0;
    int geoTrackSize = geoTracks.size();
    boolean isFirstDraw = false;
    for (GeoTrack geoTrack : geoTracks) {
      idx++;
      // Log.d(TAG, "User selected new date range: MIN=" + (geoTrack.time
      // >= seletedRangeBeginTimeInMs) + "ms, MAX=" + (geoTrack.time <=
      // seletedRangeEndTimeInMs)+ ", geoTrack.time="+geoTrack.time);

      if (!seletedRangeActivated
          || (geoTrack.time >= seletedRangeBeginTimeInMs
              && geoTrack.time <= seletedRangeEndTimeInMs)) {
        GeoPoint geoPoint = geoTrack.asGeoPoint();
        p.toMapPixels(geoPoint, myScreenCoords);
        // Line Path
        boolean isLast = geoTrackSize == idx;
        if (isFirstDraw) {
          canvas.drawLine(
              lastScreenCoords.x, lastScreenCoords.y, myScreenCoords.x, myScreenCoords.y, mPaint);
        }
        // Point
        canvas.drawCircle(myScreenCoords.x, myScreenCoords.y, 4, mGeoPointPaint);
        if (isLast) {
          canvas.drawCircle(
              myScreenCoords.x, myScreenCoords.y, 8, mGeoPointAccuracyCirclePaintBorder);
          canvas.drawCircle(
              myScreenCoords.x, myScreenCoords.y, 12, mGeoPointAccuracyCirclePaintBorder);
        }
        // End Loop
        lastScreenCoords.x = myScreenCoords.x;
        lastScreenCoords.y = myScreenCoords.y;
        isFirstDraw = true;
      }
    }

    // Draw Selected
    if (selectedGeoTrack != null) {
      // Select Point
      GeoTrack lastFix = selectedGeoTrack;
      GeoPoint geoPoint = lastFix.asGeoPoint();
      p.toMapPixels(geoPoint, myScreenCoords);
      // Compute Radius Accuracy
      final float groundResolutionInM =
          lastFix.computeGroundResolutionInMForZoomLevel(mapView.getZoomLevel());
      final float radius = ((float) lastFix.getAccuracy()) / groundResolutionInM;
      canvas.drawCircle(myScreenCoords.x, myScreenCoords.y, radius, mGeoPointAccuracyCirclePaint);
      canvas.drawCircle(
          myScreenCoords.x, myScreenCoords.y, radius, mGeoPointAccuracyCirclePaintBorder);
    }
  }
Example #12
0
 /**
  * Animated equivalent to {@link MapController#scrollBy(int, int)}. Scroll by a given amount using
  * the default animation, in pixels.
  *
  * <p><strong>Limitations</strong>: This method internally uses {@link
  * MapController#animateTo(com.google.android.maps.GeoPoint)} which doesn't animate anything if
  * the point is really far (in pixels) from the current point. In this case, nothing will be
  * animated at all.
  *
  * @param mapView The {@link MapView} to scroll
  * @param dx The horizontal scroll amount in pixels.
  * @param dy The vertical scroll amount in pixels.
  */
 public static void smoothScrollBy(MapView mapView, int dx, int dy) {
   final Projection projection = mapView.getProjection();
   final Point tmpPoint = TEMP_POINT;
   projection.toPixels(mapView.getMapCenter(), tmpPoint);
   tmpPoint.offset(dx, dy);
   IGeoPoint geoPoint = projection.fromPixels(tmpPoint.x, tmpPoint.y);
   //        mapView.getController().animateTo(geoPoint);
   mapView.getController().setCenter(geoPoint);
 }
Example #13
0
  private void config() {
    mMap.setTileSource(TileSourceFactory.MAPQUESTOSM);
    mMap.setMultiTouchControls(true);
    mMap.setBuiltInZoomControls(true);

    mController = mMap.getController();
    mController.setZoom(18);

    mTreasureMapTileSource =
        new XYTileSource(
            "mbtiles",
            ResourceProxy.string.offline_mode,
            1,
            20,
            256,
            ".png",
            "http://appquest.hsr.ch/hsr.mbtiles");

    try {
      setOfflineMap("hsr.mbtiles");
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }

    ResourceProxy resourceProxy = new DefaultResourceProxyImpl(mContext);
    Drawable drawableMarker = mContext.getResources().getDrawable(R.drawable.marker);
    int markerWidth = drawableMarker.getIntrinsicWidth();
    int markerHeight = drawableMarker.getIntrinsicHeight();
    drawableMarker.setBounds(0, markerHeight, markerWidth, 0);

    mMarkerOverlay = new MarkerOverlay(drawableMarker, resourceProxy);

    mMap.getOverlays().add(mMarkerOverlay);

    SharedPreferences.Editor editor = sharedPreferences.edit();
    editor.commit();

    List<GeoPoint> points = new ArrayList<GeoPoint>();

    try {
      String mapPointsString = sharedPreferences.getString(MAP_POINTS, "");

      JSONObject mapPointsJson = new JSONObject(mapPointsString);
      JSONArray array = mapPointsJson.getJSONArray("points");

      for (int i = 0; i < array.length(); i++) {
        JSONObject mapPoint = array.getJSONObject(i);
        points.add(new GeoPoint(mapPoint.getDouble("lat"), mapPoint.getDouble("lon")));
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    for (GeoPoint point : points) {
      addMarker(point);
    }
  }
Example #14
0
 /** Clear all schedules on the map */
 public void clearSchedules() {
   randomStudent = null;
   OverlayManager om = mapView.getOverlayManager();
   om.clear();
   scheduleOverlay.clear();
   buildingOverlay.removeAllItems();
   om.addAll(scheduleOverlay);
   om.add(buildingOverlay);
   mapView.invalidate();
 }
 /**
  * @see com.brantapps.polaris.api.Mappable#addToView(android.support.v4.app.FragmentActivity, int)
  */
 @Override
 public void addToView(final FragmentActivity activity, final int parentViewId) {
   if (mapView.getParent() != null) {
     ((ViewGroup) mapView.getParent()).removeView(mapView);
   }
   ((ViewGroup) activity.findViewById(parentViewId))
       .addView(
           mapView,
           new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
   mapReadyListener.onMapReady();
 }
Example #16
0
  @NonNull
  private MapView setupDefaultMapView() {
    final MapView mapView =
        new MapView(
            getContext(),
            getTileSize(),
            new DefaultResourceProxyImpl(getContext().getApplicationContext()));
    mapView.setTileSource(TileSourceFactory.MAPNIK);

    return mapView;
  }
Example #17
0
  private boolean tapZoom(final MotionEvent event) {
    if (zoomIn_.hit(event)) {
      if (zoomIn_.enabled()) mapView_.getController().zoomIn();
      return true;
    } // if ...
    if (zoomOut_.hit(event)) {
      if (zoomOut_.enabled()) mapView_.getController().zoomOut();
      return true;
    } // if ...

    return false;
  } // tapPrevNext
Example #18
0
  /** Save map's zoom level and centre. You should not need to touch this method */
  @Override
  public void onSaveInstanceState(Bundle outState) {
    Log.d(LOG_TAG, "onSaveInstanceState");
    super.onSaveInstanceState(outState);

    if (mapView != null) {
      outState.putInt("zoomLevel", mapView.getZoomLevel());
      IGeoPoint cntr = mapView.getMapCenter();
      outState.putInt("latE6", cntr.getLatitudeE6());
      outState.putInt("lonE6", cntr.getLongitudeE6());
      Log.i("MapSave", "Zoom: " + mapView.getZoomLevel());
    }
  }
 public static ArrayList<InfoWindow> getOpenedInfoWindowsOn(MapView mapView) {
   int count = mapView.getChildCount();
   ArrayList<InfoWindow> opened = new ArrayList<InfoWindow>(count);
   for (int i = 0; i < count; i++) {
     final View child = mapView.getChildAt(i);
     Object tag = child.getTag();
     if (tag != null && tag instanceof InfoWindow) {
       InfoWindow infoWindow = (InfoWindow) tag;
       opened.add(infoWindow);
     }
   }
   return opened;
 }
  /**
   * Populates this bubble with all item info:
   *
   * <ul>
   *   title and description in any case,
   * </ul>
   *
   * <ul>
   *   image and sub-description if any.
   * </ul>
   *
   * and centers the map on the item. <br>
   */
  public void showBubble(ExtendedOverlayItem item, InfoWindow bubble, MapView mapView) {
    Log.d(TAG, "showBubble");
    // offset the bubble to be top-centered on the marker:
    Drawable marker = getMarker(mapView.getZoomLevel());
    int markerWidth = marker.getIntrinsicWidth();
    int markerHeight = marker.getIntrinsicHeight();

    Point markerH = item.getHotspot(HotspotPlace.BOTTOM_CENTER, markerWidth, markerHeight);
    Point bubbleH = item.getHotspot(HotspotPlace.BOTTOM_CENTER, markerWidth, markerHeight);
    bubbleH.offset(-markerH.x, -markerH.y - markerHeight);
    bubble.open(item, bubbleH.x, bubbleH.y);

    mapView.getController().animateTo(item.getPoint());
  }
  /**
   * Enable location updates and show your current location on the map. By default this will request
   * location updates as frequently as possible, but you can change the frequency and/or distance by
   * calling {@link setLocationUpdateMinTime(long)} and/or {@link
   * setLocationUpdateMinDistance(float)} before calling this method. You will want to call
   * enableMyLocation() probably from your Activity's Activity.onResume() method, to enable the
   * features of this overlay. Remember to call the corresponding disableMyLocation() in your
   * Activity's Activity.onPause() method to turn off updates when in the background.
   */
  public boolean enableMyLocation() {
    boolean result = true;

    if (mLocationListener == null) {
      mLocationListener = new LocationListenerProxy(mLocationManager);
      result =
          mLocationListener.startListening(
              this, mLocationUpdateMinTime, mLocationUpdateMinDistance);
    }

    // set initial location when enabled
    if (isFollowLocationEnabled()) {
      mLocation = LocationUtils.getLastKnownLocation(mLocationManager);
      if (mLocation != null) {
        mMapController.animateTo(new GeoPoint(mLocation));
      }
    }

    // Update the screen to see changes take effect
    if (mMapView != null) {
      mMapView.postInvalidate();
    }

    return result;
  }
  @Override
  public boolean onSingleTapConfirmed(MotionEvent e, MapView mapView) {
    final Projection pj = mapView.getProjection();
    final Rect screenRect = pj.getIntrinsicScreenRect();
    final int size = this.size();

    for (int i = 0; i < size; i++) {
      final Item item = getItem(i);
      if (item == null) {
        continue;
      }

      pj.toPixels(item.getPoint(), mCurScreenCoords);

      final int state =
          (mDrawFocusedItem && (mFocusedItem == item) ? OverlayItem.ITEM_STATE_FOCUSED_MASK : 0);
      final Drawable marker =
          (item.getMarker(state) == null) ? getDefaultMarker(state) : item.getMarker(state);
      boundToHotspot(marker, item.getMarkerHotspot());
      if (hitTest(
          item,
          marker,
          -mCurScreenCoords.x + screenRect.left + (int) e.getX(),
          -mCurScreenCoords.y + screenRect.top + (int) e.getY())) {
        // We have a hit, do we get a response from onTap?
        if (onTap(i)) {
          // We got a response so consume the event
          return true;
        }
      }
    }

    return super.onSingleTapConfirmed(e, mapView);
  }
  protected void drawPointingdirection(
      Canvas canvas, MapView mapView, Location lastFix, GeoPoint myLocation) {
    Projection p = mapView.getProjection();
    Point loc = p.toPixels(myLocation, null);
    int orientation = getOrientation();
    // Pythagore

    double cb = 42; // canvas.getWidth();// Math.hypot(canvas.getWidth(), canvas.getHeight());
    // canvas.drawText("Orientation " + getOrientation(), loc.x, loc.y, paintDirection);
    double orientationRad = Math.toRadians(orientation);
    double ca = Math.cos(orientationRad) * cb;
    double ab = Math.sqrt(cb * cb - ca * ca) * (Math.signum(orientation) * -1);
    // Point
    float startX = loc.x;
    float startY = (float) (loc.y - ca);
    float stopY = loc.y;
    // float stopY = (float) (loc.y + ca);
    float stopX = loc.x;
    if (orientation > 180) {
      startX = (float) (loc.x + ab);
      // stopX = (float) (loc.x - ab);
    } else {
      startX = (float) (loc.x - ab);
      // stopX = (float) (loc.x + ab);
    }
    // paintDirection.setStrokeMiter(5);
    canvas.drawLine(startX, startY, stopX, stopY, paintDirection);
  }
  public void onLocationChanged(final Location location) {
    if (DEBUGMODE) {
      logger.debug("onLocationChanged(" + location + ")");
    }
    // ignore temporary non-gps fix
    if (mIgnorer.shouldIgnore(location.getProvider(), System.currentTimeMillis())) {
      logger.debug("Ignore temporary non-gps location");
      return;
    }

    mLocation = location;
    if (mFollow) {
      mMapController.setCenter(new GeoPoint(location));
    } else {
      mMapView.postInvalidate(); // redraw the my location icon
    }

    for (final Runnable runnable : mRunOnFirstFix) {
      new Thread(runnable).start();
    }
    mRunOnFirstFix.clear();

    sogTxt.setText(
        String.valueOf((double) Math.round(location.getSpeed() * 1.94 * 100) / 100) + "kts | ");
    cogTxt.setText(String.valueOf(location.getBearing()) + "\u00B0 ");
  }
Example #25
0
 /**
  * open the window at the specified position.
  *
  * @param item the item on which is hooked the view
  * @param offsetX (&offsetY) the offset of the view to the position, in pixels. This allows to
  *     offset the view from the marker position.
  */
 public void open(ExtendedOverlayItem item, int offsetX, int offsetY) {
   onOpen(item);
   GeoPoint position = item.getPoint();
   MapView.LayoutParams lp =
       new MapView.LayoutParams(
           MapView.LayoutParams.WRAP_CONTENT,
           MapView.LayoutParams.WRAP_CONTENT,
           position,
           MapView.LayoutParams.BOTTOM_CENTER,
           offsetX,
           offsetY);
   // close(); //if it was already opened
   mMapView.removeAllViews();
   mMapView.addView(mView, lp);
   mIsVisible = true;
 }
 @Override
 public boolean onSingleTapNotHitOverlays() {
   // TODO Auto-generated method stub
   hideBalloonOverlay();
   mapView.postInvalidate();
   return false;
 }
Example #27
0
  @Override
  public boolean onPrepareOptionsMenu(
      final Menu pMenu, final int pMenuIdOffset, final MapView pMapView) {
    final int index =
        TileSourceFactory.getTileSources().indexOf(pMapView.getTileProvider().getTileSource());
    if (index >= 0) {
      pMenu.findItem(MENU_TILE_SOURCE_STARTING_ID + index + pMenuIdOffset).setChecked(true);
    }

    pMenu
        .findItem(MENU_OFFLINE + pMenuIdOffset)
        .setTitle(
            pMapView.useDataConnection() ? R.string.set_mode_offline : R.string.set_mode_online);

    return true;
  }
Example #28
0
  @Override
  public boolean onCreateOptionsMenu(
      final Menu pMenu, final int pMenuIdOffset, final MapView pMapView) {
    final SubMenu mapMenu =
        pMenu
            .addSubMenu(0, MENU_MAP_MODE + pMenuIdOffset, Menu.NONE, R.string.map_mode)
            .setIcon(R.drawable.ic_menu_mapmode);

    for (int a = 0; a < TileSourceFactory.getTileSources().size(); a++) {
      final ITileSource tileSource = TileSourceFactory.getTileSources().get(a);
      mapMenu.add(
          MENU_MAP_MODE + pMenuIdOffset,
          MENU_TILE_SOURCE_STARTING_ID + a + pMenuIdOffset,
          Menu.NONE,
          tileSource.name());
    }
    mapMenu.setGroupCheckable(MENU_MAP_MODE + pMenuIdOffset, true, true);

    if (ctx != null) {
      final String title =
          ctx.getString(
              pMapView.useDataConnection() ? R.string.set_mode_offline : R.string.set_mode_online);
      final Drawable icon = ctx.getResources().getDrawable(R.drawable.ic_menu_offline);
      pMenu.add(0, MENU_OFFLINE + pMenuIdOffset, Menu.NONE, title).setIcon(icon);
    }
    return true;
  }
Example #29
0
  @Override
  protected void draw(Canvas c, MapView osmv, boolean shadow) {

    if (DEBUGMODE) {
      Log.d(IMapView.LOGTAG, "onDraw(" + shadow + ")");
    }

    if (shadow) {
      return;
    }

    Projection projection = osmv.getProjection();

    // Get the area we are drawing to
    Rect screenRect = projection.getScreenRect();
    // No overflow detected here! Log.d(IMapView.LOGTAG, "BEFORE Rect is " + screenRect.toString() +
    // mTopLeftMercator.toString());
    projection.toMercatorPixels(screenRect.left, screenRect.top, mTopLeftMercator);

    projection.toMercatorPixels(screenRect.right, screenRect.bottom, mBottomRightMercator);
    // No overflow detected here! Log.d(IMapView.LOGTAG, "AFTER Rect is " + screenRect.toString()  +
    // mTopLeftMercator.toString() + mBottomRightMercator.toString());
    mViewPort.set(
        mTopLeftMercator.x, mTopLeftMercator.y, mBottomRightMercator.x, mBottomRightMercator.y);
    // No overflow detected here! Log.d(IMapView.LOGTAG, "AFTER Rect is " + mViewPort.toString());

    // Draw the tiles!
    drawTiles(c, projection, projection.getZoomLevel(), TileSystem.getTileSize(), mViewPort);
  }
Example #30
0
 @Override
 public void onRangeTimelineValuesChanged(int minValue, int maxValue, boolean isRangeDefine) {
   seletedRangeActivated = isRangeDefine;
   seletedRangeBeginTimeInMs = timeBeginInMs + minValue * 1000;
   seletedRangeEndTimeInMs = timeBeginInMs + maxValue * 1000;
   mapView.postInvalidate();
 }