Inheritance: Caliburn.Micro.PropertyChangedBase
Exemple #1
0
 private void BCircleIconReleased(object sender, IconMovedEventArgs e)
 {
     if (!firstMove) return;
     CanBeDragged = true;
     measure = null;
 }
Exemple #2
0
        private void BCircleIconMoved(object sender, IconMovedEventArgs e)
        {
            if (measure == null) firstMove = true;
            if (CanBeDragged && measure == null)
            {
                measure = new Route { Layer = layer, Mode = "driving" };

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

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

                measure.Init(layer, mpStart, mpFinish, Resources);

                CanBeDragged = false;
                //e.TouchDevice.Capture(bCircle);
                //e.Handled = true;
            }
            else
            {
                if (measure == null) return;
                var pos = e.Position;
                var w = AppState.ViewDef.ViewToWorld(pos.X, pos.Y);
                measure.UpdatePoint(state, (MapPoint)Mercator.FromGeographic(new MapPoint(w.Y, w.X)));
                UpdateDistance();
                //_center = e.GetTouchPoint(AppState.MapControl).Position;
                //e.TouchDevice.Capture(bCircle);
                //e.Handled = true;
            }
        }
Exemple #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;

            var binding = DataContext as DataBinding;
            if (binding != null)
            {
                var db = binding;
                measure = db.Attributes["measure"] as Route;
                state = db.Attributes["state"].ToString();
                if (measure != null) 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;
            }
        }