Esempio n. 1
0
 private void BCircleIconTapped(object sender, IconMovedEventArgs e)
 {
     ShowInfo = !ShowInfo;
     
 }
Esempio n. 2
0
        private void BCircleIconMoved(object sender, IconMovedEventArgs e)
        {
            if (_direction == null) _firstMove = true;
            if (CanBeDragged && _direction == null)
            {
                _direction = new DirectionTool() { Layer = this._layer };


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

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

                var eSender = (FrameworkElement) sender;

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

                CanBeDragged = false;

                //e.TouchDevice.Capture(bCircle);
                //e.Handled = true;
            }
            else
            {
                if (_direction != null)
                {
                    var pos = e.Position;
                    var w = AppState.ViewDef.ViewToWorld(pos.X, pos.Y);
                    _direction.UpdatePoint(_state, (MapPoint)Mercator.FromGeographic(new MapPoint(w.Y, w.X)));
                    UpdateDirection();
                    //_center = e.GetTouchPoint(AppState.MapControl).Position;
                    //e.TouchDevice.Capture(bCircle);
                    //e.Handled = true;

                }
            }


        }
Esempio n. 3
0
        private void BCircleIconMoved(object sender, IconMovedEventArgs e)
        {
            if (CanBeDragged)
            {
                var p = e.Position;
                var pos = AppState.ViewDef.ViewToWorld(p.X, p.Y);
                graphic = new Graphic { Geometry = Mercator.FromGeographic(new MapPoint(pos.Y, pos.X)) };
                graphic.Attributes["position"] = new MapPoint(pos.Y, pos.X);

                graphic.Symbol = FindResource("BagGeoCodingTool") as Symbol;
                graphic.Attributes["graphic"] = graphic;
                gLayer.Graphics.Add(graphic);

                CanBeDragged = false;
            }
            else
            {
                var w = AppState.ViewDef.ViewToWorld(e.Position.X, e.Position.Y);
                //Position = 
                if (graphic == null) return;
                graphic.Attributes["position"] = new MapPoint(w.Y, w.X);
                if (!gLayer.Graphics.Contains(graphic))
                {
                    gLayer.Graphics.Add(graphic);
                }
                if (graphic != null)
                {
                    graphic.Geometry = Mercator.FromGeographic(new MapPoint(w.Y, w.X));
                }
            }
        }
Esempio n. 4
0
 private void BCircleIconReleased(object sender, IconMovedEventArgs e)
 {
     if (_firstMove)
     {
         CanBeDragged = true;
         _direction = null;
     }
 }
Esempio n. 5
0
        private void BCircleIconMoved(object sender, IconMovedEventArgs e)
        {
            if (_measure == null) _firstMove = true;
            if (CanBeDragged && _measure == null)
            {
                _measure = new Range() { 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)));
                    UpdateDistance();
                    //_center = e.GetTouchPoint(AppState.MapControl).Position;
                    //e.TouchDevice.Capture(bCircle);
                    //e.Handled = true;

                }
            }
        }
Esempio n. 6
0
        private void BCircleIconReleased(object sender, IconMovedEventArgs e)
        {
            if (!firstMove) return;
            if (!Remove(this, null)) return;
            var pos = AppState.ViewDef.ViewToWorld(e.Position.X, e.Position.Y);
            var g = new Graphic { Geometry = Mercator.FromGeographic(new MapPoint(pos.Y, pos.X)) };
            g.Attributes["position"] = new MapPoint(pos.Y, pos.X);
            g.Attributes["graphic"] = g;
            g.Attributes["menuenabled"] = true;
            g.Symbol = FindResource("BagGeoCodingTool") as Symbol;
            gLayer.Graphics.Add(g);

            CanBeDragged = true;
        }
Esempio n. 7
0
 private void BCircleIconReleased(object sender, IconMovedEventArgs e)
 {
     if (!firstMove) return;
     CanBeDragged = true;
     measure = null;
 }
Esempio n. 8
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;
            }
        }
Esempio n. 9
0
        private void InitFov(IconMovedEventArgs e)
        {
            fov = new FieldOfView
            {
                Layer = _layer
            };


            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));

            fov.Init(_layer, mpStart, mpFinish, Resources);
            CanBeDragged = false;
        }
Esempio n. 10
0
        private void BCircleIconMoved(object sender, IconMovedEventArgs e)
        {
            if (fov != null) fov.RemoveImage();
            var fe = iIcon;
            hitResultsList = new List<DependencyObject>();
            var pt = fe.TranslatePoint(new Point(0, 0), null);
            var r = new Rect(pt, new Size(fe.ActualWidth / 2, fe.ActualHeight / 2));
            r.X -= fe.ActualWidth / 2;
            r.Y -= fe.ActualHeight / 2;
            if (CanAttach)
            {
                var vg = new List<Graphic>();
                GetVisibleGraphics(r, AppState.ViewDef.Layers, ref vg);
                //var s = vg.OrderBy(k=>SphericalMercator.Distance(k.Geometry as MapPoint, camera.startPoint.Mp))
                focus = vg.FirstOrDefault();
                if (focus != null)
                {
                    //camera.Attach(_state,focus);
                    _attached = true;
                    fe.Opacity = 0.5;
                }
                else
                {
                    _attached = false;
                    fe.Opacity = 1;
                }
            }

            // Set up a callback to receive the hit test result enumeration, 
            // but no hit test filter enumeration.
            //VisualTreeHelper.HitTest(Application.Current.MainWindow,
            //                  null,  // No hit test filtering. 
            //                  new HitTestResultCallback(MyHitTestResult),
            //                  new PointHitTestParameters(pt));


            if (fov == null)
            {
                _firstMove = true;
            }
            else
            {
                fov.StopRotation();
            }
            if (CanBeDragged && fov == null)
            {
                InitFov(e);



                //e.TouchDevice.Capture(bCircle);
                //e.Handled = true;
            }
            else
            {
                if (fov != null)
                {
                    var pos = e.Position;
                    var w = AppState.ViewDef.ViewToWorld(pos.X, pos.Y);
                    fov.UpdatePoint(_state, (MapPoint)Mercator.FromGeographic(new MapPoint(w.Y, w.X)));

                    //_center = e.GetTouchPoint(AppState.MapControl).Position;
                    //e.TouchDevice.Capture(bCircle);
                    //e.Handled = true;
                }
            }
        }
Esempio n. 11
0
        private void BCircleIconReleased(object sender, IconMovedEventArgs e)
        {
            if (fov != null) fov.Calculate();
            if (_firstMove)
            {
                CanBeDragged = true;
                fov = null;
            }
            bCircle.Visibility = (_attached)
                                     ? Visibility.Collapsed
                                     : Visibility.Visible;
            if (focus != null && focus.Geometry is MapPoint && fov != null)
            {
                fov.Attach(_state, focus);
                //bRotateFix.Visibility = Visibility.Visible;
            }


        }
Esempio n. 12
0
 private void BCircleIconReleased(object sender, IconMovedEventArgs e)
 {
     //todo Layer.CheckDirty();
     // TODO: Add event handler implementation here.
 }
Esempio n. 13
0
 private void BCircleIconTapped(object sender, IconMovedEventArgs e)
 {
     if (Graphic == null) return;
     //PoI.EffectiveStyle.CallOutFillColor = PoI.EffectiveStyle.CallOutFillColor;
     Graphic.TappedByExternalMapControlMapGesture(new MapPoint(e.Position.X,e.Position.Y));
     //todo if (Layer.DataService.ClickBehaviour == PoIClickBehaviour.popup)
     //{
         //Layer.OpenPoiPopup(this.PoI);                
     //}
 }
Esempio n. 14
0
 public void UpdatePosition(IconMovedEventArgs e)
 {
     try
     {
         if (PoI == null || !PoI.NEffectiveStyle.CanMove.Value) return;
         var s = AppState.ViewDef.ViewToWorld(e.Position.X, e.Position.Y);
         PoI.Position = new Position(s.Y, s.X);
     }
     catch (Exception et)
     {
         Logger.Log("Poi Update", "Error positioning PoI", et.Message, Logger.Level.Error);
     }
 }
Esempio n. 15
0
        //private void BCircleTap(object sender, RoutedEventArgs e)
        //{
           
        //}


        private void BCircleIconMoved(object sender, IconMovedEventArgs e)
        {
            UpdatePosition(e);
        }