Inheritance: PropertyChangedBase
Esempio n. 1
0
 private void BCircleIconReleased(object sender, IconMovedEventArgs e)
 {
     if (_firstMove)
     {
         CanBeDragged = true;
         _direction = null;
     }
 }
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 OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {

            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;
                _direction = db.Attributes["direction"] as DirectionTool;
                _state = db.Attributes["state"].ToString();
                _direction.PropertyChanged += DirectionOnPropertyChanged;

                AppState.ViewDef.MapManipulationDelta += ViewDef_MapManipulationDelta;

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

            }

            if (!CanBeDragged)
            {
                ShowInfo = true;
            }

            

//            _effectsPlugin = IoC.Get<IEffectsMapToolPlugin>();
//            ImbSubscribe();

//            GetChemicalNames();
//            GetUnits();
//            GetModels();

            /*
            GetModelParameters("BLEVE (Static or Dynamic model)");

            var bleveFi = new FileInfo(@"Plugins\Effects\Data\Bleve.json");
            JObject bleveParams = null;
            if (bleveFi.Exists)
            {
                using (var reader = bleveFi.OpenText())
                {
                    var strBleveParams = reader.ReadToEnd();
                    bleveParams = JObject.Parse(strBleveParams);
                    reader.Close();
                }
            }

            if (bleveParams != null)
            {
                var inputParams = new JArray(bleveParams["Parameters"].Children().Where(p => !(bool) p["IsResult"]));
                var requestBody = new JObject(
                        new JProperty("CalculationRequest", new JObject(
                                new JProperty("ModelName", "BLEVE (Static or Dynamic model)"),
                                new JProperty("Parameters", inputParams)
                            ))
                    );
                
                CalculationRequest(requestBody.ToString());
            }
             */
        }