Inheritance: Caliburn.Micro.PropertyChangedBase
Beispiel #1
0
 private void BCircleIconReleased(object sender, IconMovedEventArgs e)
 {
     if (_firstMove)
     {
         CanBeDragged = true;
         _measure = null;
     }
 }
Beispiel #2
0
        private void BCircleIconMoved(object sender, IconMovedEventArgs e)
        {
            if (_measure == null) _firstMove = true;
            if (CanBeDragged && _measure == null)
            {
                _measure = new Measure() { Layer = this._layer };

                Point p = e.Position;
                SharpMap.Geometries.Point pos = AppState.ViewDef.ViewToWorld(p.X, p.Y);
                MapPoint mpStart = (MapPoint)Mercator.FromGeographic(new MapPoint(pos.Y, pos.X));

                Point p2 = e.Position;
                SharpMap.Geometries.Point pos2 = AppState.ViewDef.ViewToWorld(p2.X + 65, p2.Y - 65);
                MapPoint mpFinish = (MapPoint)Mercator.FromGeographic(new MapPoint(pos2.Y, pos2.X));

                _measure.Init(_layer, mpStart, mpFinish, this.Resources);




                CanBeDragged = false;

                //e.TouchDevice.Capture(bCircle);
                //e.Handled = true;
            }
            else
            {


                if (_measure != null)
                {
                    Point pos = e.Position;
                    SharpMap.Geometries.Point w = AppState.ViewDef.ViewToWorld(pos.X, pos.Y);
                    _measure.UpdatePoint(_state, (MapPoint)Mercator.FromGeographic(new MapPoint(w.Y, w.X)));
                    UpdateDataLabel();
                    //_center = e.GetTouchPoint(AppState.MapControl).Position;
                    //e.TouchDevice.Capture(bCircle);
                    //e.Handled = true;

                }
            }
        }
Beispiel #3
0
        private void UcPlacemarkLoaded(object sender, RoutedEventArgs e)
        {

            if (ReferenceEquals(Tag, "First"))
            {
                CanBeDragged = true;
            }
            else
            {
                bCircle.IsExpanded = true;
            }

            bCircle.Background = Brushes.Black;

            //bCircle.PreviewMouseDown += UcGeorefenceMouseDown;
            //bCircle.PreviewMouseMove += UcGeorefenceMouseMove;
            //bCircle.PreviewMouseUp += UcGeorefenceMouseUp;

            //bCircle.PreviewTouchDown += BCircleTouchDown;
            //bCircle.PreviewTouchMove += BCircleTouchMove;
            //bCircle.PreviewTouchUp += BCircleTouchUp;

            bCircle.RelativeElement = AppState.ViewDef.MapControl;
            bCircle.IconMoved += BCircleIconMoved;
            bCircle.IconTapped += BCircleIconTapped;
            bCircle.IconReleased += BCircleIconReleased;


            if (DataContext is DataBinding)
            {
                var db = (DataBinding)DataContext;
                this._measure = db.Attributes["measure"] as Measure;
                _state = db.Attributes["state"].ToString();
                _measure.PropertyChanged += _measure_PropertyChanged;

                AppState.ViewDef.MapManipulationDelta += ViewDef_MapManipulationDelta;

                Menu = Convert.ToBoolean(db.Attributes["menuenabled"]);

                //switch (db.Attributes["state"].ToString())
                //{
                //    case "StartMeasure":
                //        if (_start != null)
                //        {
                //            Position = (MapPoint)Mercator.ToGeographic(_start.Geometry);
                //            _start.AttributeValueChanged += StartAttributeValueChanged;
                //        }
                //        break;
                //    case "FinishMeasure":
                //        if (_finish != null)
                //        {
                //            Position = (MapPoint)Mercator.ToGeographic(_finish.Geometry);
                //            _finish.AttributeValueChanged += StartAttributeValueChanged;
                //        }
                //        break;

                //}


            }

            if (!CanBeDragged)
            {
                ShowInfo = true;
            }
        }