/// <summary> /// Called when a tab is detected. /// </summary> /// <param name="detector"></param> /// <returns></returns> public bool OnTap(TapGestureDetector detector) { // recreate the view. View2D view = this.CreateView(); // calculate the new center in pixels. double x = detector.X; double y = detector.Y; // calculate the new center from the view. double[] sceneCenter = view.FromViewPort(this.SurfaceWidth, this.SurfaceHeight, x, y); // convert to the projected center. _mapView.RaiseMapTapEvent(this.Map.Projection.ToGeoCoordinates(sceneCenter[0], sceneCenter[1])); return true; }
public virtual bool OnTap(TapGestureDetector detector) { return false; }
/// <summary> /// Initialize implementation from IMapView. /// </summary> /// <param name="mapLayout"></param> void IMapViewSurface.Initialize(MapView mapLayout) { this.MapAllowPan = true; this.MapAllowTilt = true; this.MapAllowZoom = true; // register default invalidation trigger. (this as IInvalidatableMapSurface).RegisterListener(new DefaultTrigger(this)); _mapView = mapLayout; this.SetWillNotDraw(false); // this.SetWillNotCacheDrawing(true); this.MapMinZoomLevel = 0; this.MapMaxZoomLevel = 20; // gets the system density. _density = global::Android.Content.Res.Resources.System.DisplayMetrics.Density; _bufferFactor = _density; // set default scale factor relative to density. // create the renderer. _renderer = new MapRenderer<global::Android.Graphics.Canvas>( new CanvasRenderer2D(1)); // initialize the gesture detection. this.SetOnTouchListener(this); _scaleGestureDetector = new ScaleGestureDetector( this.Context, this); _rotateGestureDetector = new RotateGestureDetector( this.Context, this); _moveGestureDetector = new MoveGestureDetector( this.Context, this); _tagGestureDetector = new TapGestureDetector( this.Context, this); _makerLayer = new LayerPrimitives( new WebMercator()); // initialize all the caching stuff. _backgroundColor = SimpleColor.FromKnownColor(KnownColor.White).Value; _cacheRenderer = new MapRenderer<global::Android.Graphics.Canvas>( new CanvasRenderer2D(1)); }
/// <summary> /// Initialize implementation from IMapView. /// </summary> /// <param name="mapLayout"></param> void IMapViewSurface.Initialize(MapView mapLayout) { _mapView = mapLayout; this.SetWillNotDraw(false); this.MapMinZoomLevel = 10; this.MapMaxZoomLevel = 20; _renderer = new MapRenderer<global::Android.Graphics.Canvas>( new CanvasRenderer2D()); // initialize the gesture detection. this.SetOnTouchListener(this); _scaleGestureDetector = new ScaleGestureDetector( this.Context, this); _rotateGestureDetector = new RotateGestureDetector( this.Context, this); _moveGestureDetector = new MoveGestureDetector( this.Context, this); _tagGestureDetector = new TapGestureDetector( this.Context, this); _makerLayer = new LayerPrimitives( new WebMercator()); // initialize all the caching stuff. _cacheRenderer = new MapRenderer<global::Android.Graphics.Canvas>( new CanvasRenderer2D()); _scene = new Scene2DSimple(); _scene.BackColor = SimpleColor.FromKnownColor(KnownColor.White).Value; new Timer(InvalidateSimple, null, 0, 50); }
public virtual bool OnTap(TapGestureDetector detector) { return(false); }
/// <summary> /// Initialize implementation from IMapView. /// </summary> /// <param name="mapLayout"></param> void IMapViewSurface.Initialize(MapView mapLayout) { // create the Open GL 2D target. _target = new OpenGLTarget2D(); this.SetRenderer(_target); _mapView = mapLayout; this.SetWillNotDraw(false); this.MapMinZoomLevel = 10; this.MapMaxZoomLevel = 20; // create the renderer. _renderer = new MapRenderer<OpenGLTarget2D>( new OpenGLRenderer2D()); // initialize the gesture detection. this.SetOnTouchListener(this); _scaleGestureDetector = new ScaleGestureDetector( this.Context, this); _rotateGestureDetector = new RotateGestureDetector( this.Context, this); _moveGestureDetector = new MoveGestureDetector( this.Context, this); _tagGestureDetector = new TapGestureDetector( this.Context, this); _makerLayer = new LayerPrimitives( new WebMercator()); _scene = new Scene2D(new WebMercator(), 16); _scene.BackColor = SimpleColor.FromKnownColor(KnownColor.White).Value; }
/// <summary> /// Diposes of all resources associated with this object. /// </summary> /// <param name="disposing"></param> protected override void Dispose(bool disposing) { if (disposing == true) { //someone wants the deterministic release of all resources //Let us release all the managed resources } else { // Do nothing, no one asked a dispose, the object went out of // scope and finalized is called so lets next round of GC // release these resources } StopRenderingLoop (); // Release the unmanaged resource in any case as they will not be // released by GC this._cacheRenderer = null; if (this._offScreenBuffer != null) { // dispose of the map view surface. this._offScreenBuffer.Dispose(); this._offScreenBuffer = null; } if (this._onScreenBuffer != null) { // dispose of the map view surface. this._onScreenBuffer.Dispose(); this._onScreenBuffer = null; } if (this._mapViewAnimator != null) { _mapViewAnimator.Stop(); _mapViewAnimator = null; } if (this._map != null) { this._map = null; } this._scaleGestureDetector = null; this._tagGestureDetector = null; this._moveGestureDetector = null; this._rotateGestureDetector = null; }