org.osmdroid.views.MapView Java Examples

The following examples show how to use org.osmdroid.views.MapView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MapUtils.java    From AndroidApp with Mozilla Public License 2.0 7 votes vote down vote up
public static void addMarker(Context context, MapView map, Element element) {
    Marker marker = new Marker(map);
    marker.setPosition(new GeoPoint(element.lat, element.lon));
    marker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
    map.getOverlays().add(marker);
    map.invalidate();
    marker.setIcon(context.getResources().getDrawable(R.drawable.ic_location));

    marker.setTitle(String.valueOf(""));
    for (Map.Entry<String, String> tag : element.tags.entrySet()) {
        if (tag.getKey().equals("name")) {
            marker.setTitle(String.valueOf(tag.getValue()));
            break;
        }
    }
    if (marker.getTitle().equals(""))
        marker.setTitle(String.valueOf(element.id));

}
 
Example #2
Source File: MarkerAnimation.java    From osmdroid with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
public static ValueAnimator animateMarkerToHC(final MapView map, final Marker marker, final GeoPoint finalPosition, final GeoPointInterpolator GeoPointInterpolator) {
    final GeoPoint startPosition = marker.getPosition();

    ValueAnimator valueAnimator = new ValueAnimator();
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float v = animation.getAnimatedFraction();
            GeoPoint newPosition = GeoPointInterpolator.interpolate(v, startPosition, finalPosition);
            marker.setPosition(newPosition);
            map.invalidate();

        }
    });
    valueAnimator.setFloatValues(0, 1); // Ignored.
    valueAnimator.setDuration(3000);
    valueAnimator.start();
    return valueAnimator;
}
 
Example #3
Source File: OsmMapShapeConverter.java    From osmdroid with Apache License 2.0 6 votes vote down vote up
/**
 * Add a LatLng to the map
 *
 * @param map
 * @param latLng
 * @param options
 * @return
 */
public static Marker addLatLngToMap(MapView map, GeoPoint latLng,
                                    MarkerOptions options) {
    Marker m = new Marker(map);
    m.setPosition(latLng);
    if (options!=null) {
        if (options.getIcon()!=null){
            m.setIcon(options.getIcon());
        }
        m.setAlpha(options.getAlpha());
        m.setTitle(options.getTitle());
        m.setSubDescription(options.getSubdescription());
        m.setInfoWindow(new BasicInfoWindow(R.layout.bonuspack_bubble, map));
    }
    map.getOverlayManager().add(m);
    return m;
}
 
Example #4
Source File: ShowEditPlace.java    From FancyPlaces with GNU General Public License v3.0 6 votes vote down vote up
protected void updateElementIDs() {
    // title
    currentViewElements.titleEditText = (EditText) findViewById(R.id.sep_title_edit_text);

    // map
    currentViewElements.mapCard = (VerticalCardView) findViewById(R.id.sep_map_card);
    currentViewElements.mapUpdateButton = (Button) findViewById(R.id.sep_map_update_button);
    currentViewElements.mapView = (MapView) findViewById(R.id.sep_map);

    // notes
    currentViewElements.notesCard = (VerticalCardView) findViewById(R.id.sep_notes_card);
    currentViewElements.notesEditText = (EditText) findViewById(R.id.sep_notes_edit_text);
    currentViewElements.notesTextView = (TextView) findViewById(R.id.sep_notes_text_view);

    // image
    currentViewElements.imageView = (ImageView) findViewById(R.id.sep_image);

    // scrollview
    currentViewElements.scrollView = (ObservableScrollView) findViewById(R.id.sep_scroll_view);
}
 
Example #5
Source File: PolyOverlayWithIW.java    From osmdroid with Apache License 2.0 6 votes vote down vote up
/**
   * Used to be in both {@link Polyline} and {@link Polygon}
   * Default listener for a single tap event on a Poly:
   * set the infowindow at the tapped position, and open the infowindow (if any).
   * @return true if tapped
   */
  @Override
  public boolean onSingleTapConfirmed(final MotionEvent pEvent, final MapView pMapView){
final Projection projection = pMapView.getProjection();
final GeoPoint eventPos = (GeoPoint) projection.fromPixels((int)pEvent.getX(), (int)pEvent.getY());
      final GeoPoint geoPoint;
      if (mPath != null) {
	final boolean tapped = contains(pEvent);
	if (tapped) {
		geoPoint = eventPos;
	} else {
		geoPoint = null;
	}
} else {
	final double tolerance = mOutlinePaint.getStrokeWidth() * mDensity * mDensityMultiplier;
	geoPoint = getCloseTo(eventPos, tolerance, pMapView);
}
      if (geoPoint != null) {
          return click(pMapView, geoPoint);
      }
      return false;
  }
 
Example #6
Source File: OsmMapShapeConverter.java    From osmdroid with Apache License 2.0 6 votes vote down vote up
/**
 * Add a Polygon to the map
 *
 * @param map
 * @param polygon
 * @return
 */
public static org.osmdroid.views.overlay.Polygon addPolygonToMap(
    MapView map,
    org.osmdroid.views.overlay.Polygon polygon, PolygonOptions options) {

    if (options!=null) {
        polygon.getFillPaint().setColor(options.getFillColor());
        polygon.setTitle(options.getTitle());
        polygon.getOutlinePaint().setColor(options.getStrokeColor());
        polygon.getOutlinePaint().setStrokeWidth(options.getStrokeWidth());
        polygon.setSubDescription(options.getSubtitle());
        polygon.setInfoWindow(new BasicInfoWindow(R.layout.bonuspack_bubble, map));

    }


    map.getOverlayManager().add(polygon);
    return polygon;
}
 
Example #7
Source File: PregrabActivity.java    From AppleWifiNlpBackend with Apache License 2.0 6 votes vote down vote up
@Override
protected void draw(Canvas c, MapView osmv, boolean shadow) {
    final int zoomDiff = mapView.getMaxZoomLevel() - mapView.getZoomLevel();
    Point pnt = new Point();
    for (WifiOverlayItem item : items) {
        mapView.getProjection().toPixels(item.point, pnt);
        if (item.size == 0) {
            c.drawCircle(pnt.x, pnt.y, 20, errorPaint);
        } else {
            float radius = (float) (item.size / TileSystem.GroundResolution(item.latitude,
                    mapView.getZoomLevel()));
            circlePaint.setAlpha(50);
            circlePaint.setStyle(Paint.Style.FILL);
            c.drawCircle(pnt.x, pnt.y, radius, circlePaint);

            circlePaint.setAlpha(150);
            circlePaint.setStyle(Paint.Style.STROKE);
            c.drawCircle(pnt.x, pnt.y, radius, circlePaint);
        }
    }
}
 
Example #8
Source File: CellTowerMarker.java    From AIMSICDL with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean onMarkerClick(Marker marker, MapView mapView) {
    CellTowerMarker cellTowerMarker = (CellTowerMarker) marker;
    AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
    dialog.setTitle(cellTowerMarker.getTitle());
    dialog.setView(getInfoContents(cellTowerMarker.getMarkerData()));
    dialog.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            dialogInterface.dismiss();
        }
    });
    dialog.show();

    return true;
}
 
Example #9
Source File: SimpleFastPointOverlay.java    From osmdroid with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onTouchEvent(MotionEvent event, final MapView mapView) {
    if(mStyle.mAlgorithm !=
            SimpleFastPointOverlayOptions.RenderingAlgorithm.MAXIMUM_OPTIMIZATION) return false;
    switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
            startBoundingBox = mapView.getBoundingBox();
            startProjection = mapView.getProjection();
            break;

        case MotionEvent.ACTION_MOVE:
            hasMoved = true;
            break;

        case MotionEvent.ACTION_UP:
            hasMoved = false;
            startBoundingBox = mapView.getBoundingBox();
            startProjection = mapView.getProjection();
            mapView.invalidate();
            break;
    }
    return false;
}
 
Example #10
Source File: SpeechBalloonOverlay.java    From osmdroid with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onTouchEvent(final MotionEvent event, final MapView mapView) {
	if (mDraggable && mIsDragged) {
		if (event.getAction() == MotionEvent.ACTION_UP) {
			mDragDeltaX = event.getX() - mDragStartX;
			mDragDeltaY = event.getY() - mDragStartY;
			mOffsetX += mDragDeltaX;
			mOffsetY += mDragDeltaY;
			mDragDeltaX = 0;
			mDragDeltaY = 0;
			mIsDragged = false;
			mapView.invalidate();
			return true;
		} else if (event.getAction() == MotionEvent.ACTION_MOVE) {
			mDragDeltaX = event.getX() - mDragStartX;
			mDragDeltaY = event.getY() - mDragStartY;
			mapView.invalidate();
			return true;
		}
	}
	return false;
}
 
Example #11
Source File: NativeOpenStreetMapController.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onLongPress(MotionEvent event, MapView mapView) {
  boolean touched = contains(event);
  if (touched){
    if (mDraggable){
      mIsDragged = true;
      closeInfoWindow();
      mDragStartPoint = event;
      if (mOnDragListener != null) {
        mOnDragListener.onDragStart( this );
      }
      moveToEventPosition(event, mDragStartPoint, mapView);
    } else if (mOnClickListener != null) {
      mOnClickListener.onLongClick( this, mapView,
          (GeoPoint) mapView.getProjection().fromPixels( (int) event.getX(),
              (int) event.getY() ) );
    }
  }
  return touched;
}
 
Example #12
Source File: Marker.java    From osmdroid with Apache License 2.0 6 votes vote down vote up
@Override public boolean onTouchEvent(final MotionEvent event, final MapView mapView) {
	if (mDraggable && mIsDragged){
		if (event.getAction() == MotionEvent.ACTION_UP) {
			mIsDragged = false;
			if (mOnMarkerDragListener != null)
				mOnMarkerDragListener.onMarkerDragEnd(this);
			return true;
		} else if (event.getAction() == MotionEvent.ACTION_MOVE){
			moveToEventPosition(event, mapView);
			if (mOnMarkerDragListener != null)
					mOnMarkerDragListener.onMarkerDrag(this);
			return true;
		} else 
			return false;
	} else 
		return false;
}
 
Example #13
Source File: BoundingBox.java    From osmdroid with Apache License 2.0 6 votes vote down vote up
/**
 * @since 6.0.0
 */
public void set(final double north, final double east, final double south, final double west) {
	mLatNorth = north;
	mLonEast = east;
	mLatSouth = south;
	mLonWest = west;
	//validate the values
	//  30 > 0 OK
	// 30 < 0 not ok

       final TileSystem tileSystem = org.osmdroid.views.MapView.getTileSystem();
	if (!tileSystem.isValidLatitude(north))
		throw new IllegalArgumentException("north must be in " + tileSystem.toStringLatitudeSpan());
	if (!tileSystem.isValidLatitude(south))
		throw new IllegalArgumentException("south must be in " + tileSystem.toStringLatitudeSpan());
	if (!tileSystem.isValidLongitude(west))
		throw new IllegalArgumentException("west must be in " + tileSystem.toStringLongitudeSpan());
	if (!tileSystem.isValidLongitude(east))
		throw new IllegalArgumentException("east must be in " + tileSystem.toStringLongitudeSpan());
}
 
Example #14
Source File: SampleCacheDownloaderCustomUI.java    From osmdroid with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View root = inflater.inflate(R.layout.sample_cachemgr, container, false);

    //prevent the action bar/toolbar menu in order to prevent tile source changes.
    //if this is enabled, playstore users could actually download large volumes of tiles
    //from tile sources that do not allow it., causing our app to get banned, which would be
    //bad
    setHasOptionsMenu(false);

    mMapView = new MapView(getActivity());
    mMapView.setTileSource(TileSourceFactory.USGS_SAT);
    ((LinearLayout) root.findViewById(R.id.mapview)).addView(mMapView);
    btnCache = root.findViewById(R.id.btnCache);
    btnCache.setOnClickListener(this);
    mgr = new CacheManager(mMapView);
    return root;
}
 
Example #15
Source File: InfoWindow.java    From osmdroid with Apache License 2.0 6 votes vote down vote up
/**
 * refresh the infowindow drawing. Must be called every time the view changes (drag, zoom,...).
 * Best practice is to call this method in the draw method of its overlay.
 */
public void draw(){
    if (!mIsVisible)
        return;
    try {
        MapView.LayoutParams lp = new MapView.LayoutParams(
                MapView.LayoutParams.WRAP_CONTENT,
                MapView.LayoutParams.WRAP_CONTENT,
                mPosition, MapView.LayoutParams.BOTTOM_CENTER,
                mOffsetX, mOffsetY);
        mMapView.updateViewLayout(mView, lp); // supposed to work only on the UI Thread
    } catch(Exception e) {
        if (MapSnapshot.isUIThread()) {
            throw e;
        }
        // in order to avoid a CalledFromWrongThreadException crash
    }
}
 
Example #16
Source File: PoiDetailsFragment.java    From AndroidApp with Mozilla Public License 2.0 6 votes vote down vote up
private void setupMapPreview(double lat, double lon, String markerTitle) {
    //important! set your user agent to prevent getting banned from the osm servers
    Configuration.getInstance().load(getDialog().getContext(), PreferenceManager.getDefaultSharedPreferences(getDialog().getContext()));

    map = (MapView) getDialog().findViewById(R.id.poiDialogMap);
    map.setTileSource(TileSourceFactory.MAPNIK);
    map.setTilesScaledToDpi(true);
    map.setMultiTouchControls(true);

    // add compass to map
    CompassOverlay compassOverlay = new CompassOverlay(getDialog().getContext(), new InternalCompassOrientationProvider(getDialog().getContext()), map);
    compassOverlay.enableCompass();
    map.getOverlays().add(compassOverlay);

    // get map controller
    IMapController controller = map.getController();
    GeoPoint position = new GeoPoint(lat, lon);
    controller.setCenter(position);
    controller.setZoom(18);

    MapUtils.addMarker(getActivity(), map, lat, lon, markerTitle);
}
 
Example #17
Source File: InfoWindow.java    From osmdroid with Apache License 2.0 6 votes vote down vote up
/**
 * open the InfoWindow at the specified GeoPosition + offset.
 * If it was already opened, close it before reopening.
 *
 * @param object   the graphical object on which is hooked the view
 * @param position to place the window on the map
 * @param offsetX  (&offsetY) the offset of the view to the position, in pixels.
 *                 This allows to offset the view from the object position.
 */
public void open(Object object, GeoPoint position, int offsetX, int offsetY) {
    close(); //if it was already opened
    mRelatedObject = object;
    mPosition = position;
    mOffsetX = offsetX;
    mOffsetY = offsetY;
    onOpen(object);
    MapView.LayoutParams lp = new MapView.LayoutParams(
        MapView.LayoutParams.WRAP_CONTENT,
        MapView.LayoutParams.WRAP_CONTENT,
        mPosition, MapView.LayoutParams.BOTTOM_CENTER,
        mOffsetX, mOffsetY);

    if (mMapView != null && mView != null) {
        mMapView.addView(mView, lp);
        mIsVisible = true;
    } else {
        Log.w(IMapView.LOGTAG, "Error trapped, InfoWindow.open mMapView: " + (mMapView == null ? "null" : "ok") + " mView: " + (mView == null ? "null" : "ok"));
    }
}
 
Example #18
Source File: DefaultOverlayManager.java    From osmdroid with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onPrepareOptionsMenu(final Menu pMenu, final int menuIdOffset, final MapView mapView) {
    for (final Overlay overlay : this.overlaysReversed()) {
        if (overlay instanceof IOverlayMenuProvider) {
            final IOverlayMenuProvider overlayMenuProvider = (IOverlayMenuProvider) overlay;
            if (overlayMenuProvider.isOptionsMenuEnabled()) {
                overlayMenuProvider.onPrepareOptionsMenu(pMenu, menuIdOffset, mapView);
            }
        }
    }

    if (mTilesOverlay != null && mTilesOverlay.isOptionsMenuEnabled()) {
        mTilesOverlay.onPrepareOptionsMenu(pMenu, menuIdOffset, mapView);
    }

    return true;
}
 
Example #19
Source File: SimpleFastPointOverlay.java    From osmdroid with Apache License 2.0 5 votes vote down vote up
private void updateGrid(MapView mapView) {
    viewWid = mapView.getWidth();
    viewHei = mapView.getHeight();
    gridWid = (int) Math.floor((float) viewWid / mStyle.mCellSize) + 1;
    gridHei = (int) Math.floor((float) viewHei / mStyle.mCellSize) + 1;
    gridBool = new boolean[gridWid][gridHei];

    // TODO the measures on first draw are not the final values.
    // MapView should propagate onLayout to overlays
}
 
Example #20
Source File: ItemizedIconOverlay.java    From osmdroid with Apache License 2.0 5 votes vote down vote up
/**
 * Each of these methods performs a item sensitive check. If the item is located its
 * corresponding method is called. The result of the call is returned.
 *
 * Helper methods are provided so that child classes may more easily override behavior without
 * resorting to overriding the ItemGestureListener methods.
 */
@Override
public boolean onSingleTapConfirmed(final MotionEvent event, final MapView mapView) {
	return (activateSelectedItems(event, mapView, new ActiveItem() {
		@Override
		public boolean run(final int index) {
			final ItemizedIconOverlay<Item> that = ItemizedIconOverlay.this;
			if (that.mOnItemGestureListener == null) {
				return false;
			}
			return onSingleTapUpHelper(index, that.mItemList.get(index), mapView);
		}
	})) ? true : super.onSingleTapConfirmed(event, mapView);
}
 
Example #21
Source File: TilesOverlay.java    From osmdroid with Apache License 2.0 5 votes vote down vote up
@Override
public void onDetach(final MapView pMapView) {
	this.mTileProvider.detach();
	ctx=null;
	BitmapPool.getInstance().asyncRecycle(mLoadingTile);
	mLoadingTile=null;
	BitmapPool.getInstance().asyncRecycle(userSelectedLoadingDrawable);
	userSelectedLoadingDrawable=null;
}
 
Example #22
Source File: TilesOverlay.java    From osmdroid with Apache License 2.0 5 votes vote down vote up
@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 #23
Source File: MarkerAnimation.java    From osmdroid with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public static ObjectAnimator animateMarkerToICS(final MapView map, Marker marker, GeoPoint finalPosition, final GeoPointInterpolator GeoPointInterpolator) {
    TypeEvaluator<GeoPoint> typeEvaluator = new TypeEvaluator<GeoPoint>() {
        @Override
        public GeoPoint evaluate(float fraction, GeoPoint startValue, GeoPoint endValue) {
            return GeoPointInterpolator.interpolate(fraction, startValue, endValue);
        }
    };
    Property<Marker, GeoPoint> property = Property.of(Marker.class, GeoPoint.class, "position");
    ObjectAnimator animator = ObjectAnimator.ofObject(marker, property, typeEvaluator, finalPosition);
    animator.setDuration(3000);
    animator.start();
    return animator;
}
 
Example #24
Source File: SampleMyLocationWithClick.java    From osmdroid with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onSingleTapConfirmed(MotionEvent e, MapView map) {
    if (getLastFix() != null)
        Toast.makeText(map.getContext(), "Tap! I am at " + getLastFix().getLatitude() + "," + getLastFix().getLongitude(), Toast.LENGTH_LONG).show();
    return true;

}
 
Example #25
Source File: MainActivity.java    From spidey with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void draw(Canvas canvas, MapView map, boolean shadow) {
	Point mapCenterPoint = new Point();
	 map.getProjection().toPixels(gp, mapCenterPoint);
	
	 GeoPoint gp2 = gp.destinationPoint(radius*30, 60);
	 Point mapCirclePoint = new Point();
	 map.getProjection().toPixels(gp2, mapCirclePoint);
	 
	int newRadius = mapCirclePoint.x - mapCenterPoint.x;
	
	// double metersPerPixel = TileSystem.GroundResolution(map.getMapCenter().getLatitude(), map.getZoomLevel());
	 
	 //int newRadius = (int)(metersPerPixel/radius);				 
	 
	 paint.setStyle(Paint.Style.STROKE);
	 paint.setColor(Color.RED);
	 paint.setStrokeWidth(5);
	 canvas.drawCircle(mapCenterPoint.x, mapCenterPoint.y, newRadius, paint);
	 
	 paint.setStyle(Paint.Style.FILL_AND_STROKE);
	 paint.setColor(Color.DKGRAY);
	 paint.setStrokeWidth(2);
	 paint.setTextSize(40);
	 canvas.drawText(label, mapCenterPoint.x, mapCenterPoint.y+newRadius, paint);
	 
}
 
Example #26
Source File: CompassOverlay.java    From osmdroid with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(final MenuItem pItem, final int pMenuIdOffset,
                                     final MapView pMapView) {
    final int menuId = pItem.getItemId() - pMenuIdOffset;
    if (menuId == MENU_COMPASS) {
        if (this.isCompassEnabled()) {
            this.disableCompass();
        } else {
            this.enableCompass();
        }
        return true;
    } else {
        return false;
    }
}
 
Example #27
Source File: DefaultOverlayManager.java    From osmdroid with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onKeyDown(final int keyCode, final KeyEvent event, final MapView pMapView) {
    for (final Overlay overlay : this.overlaysReversed()) {
        if (overlay.onKeyDown(keyCode, event, pMapView)) {
            return true;
        }
    }

    return false;
}
 
Example #28
Source File: MapUtils.java    From AndroidApp with Mozilla Public License 2.0 5 votes vote down vote up
public static void addMarker(Context context, MapView map, double latitude, double longitude, String markerTitle) {
    Marker marker = new Marker(map);
    marker.setPosition(new GeoPoint(latitude, longitude));
    marker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
    map.getOverlays().add(marker);
    map.invalidate();
    marker.setIcon(context.getResources().getDrawable(R.drawable.ic_location));
    marker.setTitle(markerTitle);
}
 
Example #29
Source File: OsmMarkerInfoWindow.java    From FancyPlaces with GNU General Public License v3.0 5 votes vote down vote up
public static void closeAllInfoWindowsOn(MapView mapView) {
    ArrayList opened = getOpenedInfoWindowsOn(mapView);
    Iterator var3 = opened.iterator();

    while(var3.hasNext()) {
        OsmMarkerInfoWindow infoWindow = (OsmMarkerInfoWindow)var3.next();
        infoWindow.close();
    }

}
 
Example #30
Source File: OsmMarker.java    From FancyPlaces with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onSingleTapConfirmed(MotionEvent event, MapView mapView) {
    if (isHit(event, mapView)) {
        toogleInfoWindow();
        mapView.getController().animateTo(Position);
        return true;
    }
    return false;
}