protected override void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            // Add our touch handlers.
            PinchDetector = new ScaleGestureDetector(this, this);
            MoveDetector = new MoveGestureDetector(this, this);
            RotationDetector = new RotateGestureDetector(this, this);

            Detector = new GestureDetector(this, this);
            Detector.IsLongpressEnabled = false;

            MainLayout = (RelativeLayout)FindViewById (Resource.Id.main);
            MainLayout.Touch += HandleTouch;

            // Disable touch handling by the views themselves.
            for(var i = 0; i < MainLayout.ChildCount; i++) {
                var view = MainLayout.GetChildAt(i);
                Log("OnCreate", "View {0} disabled.", i);
                view.Focusable = true;
                view.FocusableInTouchMode = true;
                view.RequestFocus();
            }

            BootstrapDropbox ();
        }
Esempio n. 2
0
        public bool OnRotate(RotateGestureDetector detector)
        {
            _deltaDegrees = detector.RotationDegreesDelta;

            OsmSharp.Logging.Log.TraceEvent("OsmSharp.Android.UI.MapView", System.Diagnostics.TraceEventType.Information,
                string.Format("OnRotate:[{0},{1}] {2}s {3}d", _deltaX, _deltaY, _deltaScale, _deltaDegrees));

            return true;
        }
Esempio n. 3
0
        /// <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);
        }
Esempio n. 4
0
 public virtual void OnRotateEnd(RotateGestureDetector detector)
 {
     // do nothing, overridden implementation may be used.
 }
Esempio n. 5
0
 public virtual bool OnRotateBegin(RotateGestureDetector detector)
 {
     return(true);
 }
Esempio n. 6
0
			public virtual void OnRotateEnd (RotateGestureDetector detector) {
				// do nothing, overridden implementation may be used.
			}
Esempio n. 7
0
        public bool OnRotateBegin(RotateGestureDetector detector)
        {
            _deltaScale = 1;
            _deltaDegrees = 0;
            _deltaX = 0;
            _deltaY = 0;

            return true;
        }
Esempio n. 8
0
        /// <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));
        }
			public virtual bool OnRotateBegin(RotateGestureDetector detector)
			{
				return true;
			}
			public virtual bool OnRotate(RotateGestureDetector detector)
			{
				return false;
			}
Esempio n. 11
0
        /// <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;
        }
Esempio n. 12
0
        public bool OnRotate(RotateGestureDetector detector)
        {
            var view = CurrentView;
            var bounds = view.Drawable.Bounds;

            Log("OnRotate", "Rotating {0:F3} degrees to {1:F3}.", detector.RotationDegreesDelta, view.RotationX);

            view.PivotX = bounds.ExactCenterX();
            view.PivotY = bounds.ExactCenterY();

            view.Monkey.Rotation -= detector.RotationDegreesDelta ; // In decimal degrees.
            view.Rotation = view.Monkey.Rotation;

            return true;
        }
Esempio n. 13
0
        /// <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;
        }
Esempio n. 14
0
 public virtual void OnRotateEnd(RotateGestureDetector detector)
 {
 }
Esempio n. 15
0
        public bool OnRotateBegin(RotateGestureDetector detector)
        {
            _deltaScale = 1;
            _deltaDegrees = 0;
            _deltaX = 0;
            _deltaY = 0;

            OsmSharp.Logging.Log.TraceEvent("OsmSharp.Android.UI.MapView", System.Diagnostics.TraceEventType.Information,
                string.Format("OnRotateBegin"));

            return true;
        }
Esempio n. 16
0
        public void OnRotateEnd(RotateGestureDetector detector)
        {
            _deltaDegrees = 0;

            OsmSharp.Logging.Log.TraceEvent("OsmSharp.Android.UI.MapView", System.Diagnostics.TraceEventType.Information,
                string.Format("OnRotateEnd"));
        }
			public virtual void OnRotateEnd(RotateGestureDetector detector)
			{
			}
Esempio n. 18
0
        public bool OnRotate(RotateGestureDetector detector)
        {
            _deltaDegrees = detector.RotationDegreesDelta;

            return true;
        }
		public RotateGestureDetector(Context context, RotateGestureDetector.IOnRotateGestureListener
			 listener) : base(context)
		{
			mListener = listener;
		}
Esempio n. 20
0
 public void OnRotateEnd(RotateGestureDetector detector)
 {
     _deltaDegrees = 0;
 }
Esempio n. 21
0
 public virtual bool OnRotate(RotateGestureDetector detector)
 {
     return(false);
 }