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 ();
        }
Beispiel #2
0
 public void OnMoveEnd(MoveGestureDetector detector)
 {
     this.Change ();
 }
Beispiel #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);
        }
 public virtual void OnMoveEnd(MoveGestureDetector detector)
 {
 }
 public virtual bool OnMoveBegin(MoveGestureDetector detector)
 {
     return(true);
 }
 public virtual bool OnMove(MoveGestureDetector detector)
 {
     return(false);
 }
Beispiel #7
0
        public bool OnMoveBegin(MoveGestureDetector detector)
        {
            _deltaScale = 1;
            _deltaDegrees = 0;
            _deltaX = 0;
            _deltaY = 0;

            return true;
        }
Beispiel #8
0
			public virtual bool OnMoveBegin (MoveGestureDetector detector) {		return true;
			}
Beispiel #9
0
			public virtual void OnMoveEnd (MoveGestureDetector detector) {
				// do nothing, overridden implementation may be used.
			}
Beispiel #10
0
 public virtual void OnMoveEnd(MoveGestureDetector detector)
 {
     // do nothing, overridden implementation may be used.
 }
Beispiel #11
0
			public virtual bool OnMove (MoveGestureDetector detector) {
				return false;
			}
Beispiel #12
0
 public void OnMoveEnd(MoveGestureDetector detector)
 {
     Log("OnMoveEnd");
     UpdateDropbox();
 }
Beispiel #13
0
        public bool OnMove(MoveGestureDetector detector)
        {
            var positionOffset = detector.FocusDelta;

            var view = CurrentView;

            view.TranslationX += positionOffset.X;
            view.TranslationY += positionOffset.Y;

            view.Monkey.X = view.TranslationX / (float)Metrics.WidthPixels;
            view.Monkey.Y = view.TranslationY / (float)Metrics.HeightPixels;

            Log("OnMove");
            return true;
        }
Beispiel #14
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;
        }
Beispiel #15
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));
        }
        /// <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;
        }
Beispiel #17
0
        public bool OnMove(MoveGestureDetector detector)
        {
            global::Android.Graphics.PointF d = detector.FocusDelta;
            _deltaX = d.X;
            _deltaY = d.Y;

            return true;
        }
 public void OnMoveEnd(MoveGestureDetector detector)
 {
     this.TriggerRendering();
 }
Beispiel #19
0
 public void OnMoveEnd(MoveGestureDetector detector)
 {
 }
		public MoveGestureDetector(Context context, MoveGestureDetector.IOnMoveGestureListener
			 listener) : base(context)
		{
			mListener = listener;
		}