Exemplo n.º 1
0
 private void Events_MapDragBehavourChanged(Map map, MapEventArgs args)
 {
     ClearDrawLeader();
     if (map.DragMode == Map.DragBehavior.Draw)
     {
         ClearShapes();
         
         map.Events.EnableMouseClicks = true;
         map.Events.EnableMouseWheel = true;
         map.Events.EnableMapZoom = true;
         map.Events.EnableKeyboard = false;
         map.Events.EnableMapZoomOnDoubleClick = false;
     }
 }
Exemplo n.º 2
0
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Snf.Silver.Main;component/MainPage.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.FromsStack = ((System.Windows.Controls.StackPanel)(this.FindName("FromsStack")));
     this.TitleTextBox = ((System.Windows.Controls.TextBlock)(this.FindName("TitleTextBox")));
     this.BorderRectangle = ((System.Windows.Shapes.Rectangle)(this.FindName("BorderRectangle")));
     this.FormsPanel = ((System.Windows.Controls.StackPanel)(this.FindName("FormsPanel")));
     this.MapGrid = ((System.Windows.Controls.Grid)(this.FindName("MapGrid")));
     this.map = ((BIT.AVL.Silver.Map.Map)(this.FindName("map")));
     this.ToolBarItemsPanel = ((BIT.AVL.Silver.Map.ToolBarItems)(this.FindName("ToolBarItemsPanel")));
     this.ProductsCmb = ((System.Windows.Controls.ComboBox)(this.FindName("ProductsCmb")));
     this.ProductsAcmb = ((JobPlan.Controls.AutoCompleteComboBox)(this.FindName("ProductsAcmb")));
     this.FranchiseTbl = ((System.Windows.Controls.TextBlock)(this.FindName("FranchiseTbl")));
     this.FranchiseCmb = ((System.Windows.Controls.ComboBox)(this.FindName("FranchiseCmb")));
     this.StartDatePicker = ((System.Windows.Controls.DatePicker)(this.FindName("StartDatePicker")));
     this.EndDatePicker = ((System.Windows.Controls.DatePicker)(this.FindName("EndDatePicker")));
     this.ProvinceRadioStack = ((System.Windows.Controls.StackPanel)(this.FindName("ProvinceRadioStack")));
     this.ShareRadio = ((System.Windows.Controls.RadioButton)(this.FindName("ShareRadio")));
     this.ShareRangeStack = ((System.Windows.Controls.StackPanel)(this.FindName("ShareRangeStack")));
     this.RedTreshTbx = ((System.Windows.Controls.TextBox)(this.FindName("RedTreshTbx")));
     this.YellowTrechTbx = ((System.Windows.Controls.TextBox)(this.FindName("YellowTrechTbx")));
     this.ShareSetBtn = ((System.Windows.Controls.Button)(this.FindName("ShareSetBtn")));
     this.LoadingAnm = ((BIT.Silver.Controls.Loading)(this.FindName("LoadingAnm")));
     this.MenuBtn = ((System.Windows.Controls.Button)(this.FindName("MenuBtn")));
     this.PolygonBtnContent = ((System.Windows.Controls.TextBlock)(this.FindName("PolygonBtnContent")));
     this.BottomLabel_Stack = ((System.Windows.Controls.StackPanel)(this.FindName("BottomLabel_Stack")));
     this.VolumRadio = ((System.Windows.Controls.RadioButton)(this.FindName("VolumRadio")));
     this.ValueRadio = ((System.Windows.Controls.RadioButton)(this.FindName("ValueRadio")));
     this.BottomLabel1_Top = ((System.Windows.Controls.TextBlock)(this.FindName("BottomLabel1_Top")));
     this.BottomLabel2_Bottom = ((System.Windows.Controls.TextBlock)(this.FindName("BottomLabel2_Bottom")));
     this.SliderGrd = ((System.Windows.Controls.Grid)(this.FindName("SliderGrd")));
     this.UnitTbl = ((System.Windows.Controls.TextBlock)(this.FindName("UnitTbl")));
     this.CategoryNameTbl = ((System.Windows.Controls.TextBlock)(this.FindName("CategoryNameTbl")));
     this.SalesOutGrd = ((System.Windows.Controls.Grid)(this.FindName("SalesOutGrd")));
     this.PageSlider = ((System.Windows.Controls.Slider)(this.FindName("PageSlider")));
     this.LabelsGrd = ((System.Windows.Controls.Grid)(this.FindName("LabelsGrd")));
     this.YouAreLogedInTbl = ((System.Windows.Controls.TextBlock)(this.FindName("YouAreLogedInTbl")));
     this.VersionTbl = ((System.Windows.Controls.TextBlock)(this.FindName("VersionTbl")));
 }
Exemplo n.º 3
0
        private void Events_MapMouseMove(Map map, MouseEventArgs args)
        {
            var _MousePoint = map.CoordHelper.PixelToGeo(args.GetPosition(map));


            // To move the line string points
            for (int i = 0; i < LinesPointsLayer.Children.Count; i++)
            {
                try
                { // for cast exceptions
                    if ((LinesPointsLayer.Children[i] as DrawPoint).IsSelected)
                    {
                        (LinesPointsLayer.Children[i] as DrawPoint).Point = _MousePoint;

                        (LinesPointsLayer.Children[i] as DrawPoint).LineString.Points.Remove((LinesPointsLayer.Children[i] as DrawPoint).LineString.Points[(LinesPointsLayer.Children[i] as DrawPoint).Index]);
                        (LinesPointsLayer.Children[i] as DrawPoint).LineString.Points.Insert((LinesPointsLayer.Children[i] as DrawPoint).Index, _MousePoint);

                    }
                }
                catch (Exception exc)
                {
                    // for cast exceptions
                }
            }

            // To move the polygon points
            for (int i = 0; i < PolygonsPointsLayer.Children.Count; i++)
            {
                try
                { // for cast exceptions
                    if ((PolygonsPointsLayer.Children[i] as DrawPoint).IsSelected)
                    {
                        (PolygonsPointsLayer.Children[i] as DrawPoint).Point = _MousePoint;

                        (PolygonsPointsLayer.Children[i] as DrawPoint).Polygon.Points.Remove((PolygonsPointsLayer.Children[i] as DrawPoint).Polygon.Points[(PolygonsPointsLayer.Children[i] as DrawPoint).Index]);
                        (PolygonsPointsLayer.Children[i] as DrawPoint).Polygon.Points.Insert((PolygonsPointsLayer.Children[i] as DrawPoint).Index, _MousePoint);

                    }
                }
                catch (Exception exc)
                {
                    // for cast exceptions
                }
            }


            if (map.DragMode == Map.DragBehavior.Draw)
            {
                switch (DrawMode)
                {
                    case GeometryMode.FreeDraw:
                        break;

                    case GeometryMode.StringLine:
                        //if (_IsDrawing && _LeaderLine == null)
                        //{
                        //    _LeaderLine = new DrawLineString { LineColor = DrawLineColor, LineThickness = DrawLineThickness, Opacity = DrawOpacity };
                        //    _LeaderLine.Points.Add(_CurrentMousePoint);
                        //    _LeaderLine.Points.Add(_MousePoint);

                        //    _LeaderPoint = new DrawPoint { Point = _MousePoint };

                        //    _DrawLayer.Add(_LeaderLine);
                        //    _DrawLayer.Add(_LeaderPoint);
                        //}
                        //else
                        //{
                        //    if (_LeaderLine != null)
                        //    {
                        //        _LeaderLine.Points[0] = _CurrentMousePoint;
                        //        _LeaderLine.Points[1] = _MousePoint;
                        //        _LeaderPoint.Point = _MousePoint;
                        //    }
                        //}

                        //if (_LeaderLine != null && _LeaderPoint != null)
                        //{
                        //    _DrawLayer.UpdateShape(_LeaderLine);
                        //    _DrawLayer.UpdateShape(_LeaderPoint);
                        //}
                        break;

                    case GeometryMode.Polygon:
                        //if (_IsDrawing && _LeaderPolygon == null)
                        //{
                        //    _LeaderPolygon = new DrawPolygon { LineColor = DrawLineColor, LineThickness = DrawLineThickness, Opacity = DrawOpacity };
                        //    _LeaderPolygon.Points.Add(_Polygon.Points[0]);
                        //    _LeaderPolygon.Points.Add(_Polygon.Points[_Polygon.Points.Count - 1]);
                        //    _LeaderPolygon.Points.Add(_MousePoint);

                        //    _LeaderPoint = new DrawPoint { Point = _MousePoint };

                        //    _DrawLayer.Add(_LeaderPolygon);
                        //    _DrawLayer.Add(_LeaderPoint);
                        //}
                        //else
                        //{
                        //    if (_LeaderPolygon != null)
                        //    {
                        //            _LeaderPolygon.Points[0] = _Polygon.Points[0];
                        //            _LeaderPolygon.Points[1] = _Polygon.Points[_Polygon.Points.Count - 1];
                        //            _LeaderPolygon.Points[2] = _MousePoint;

                        //        _LeaderPoint.Point = _MousePoint;
                        //    }
                        //}

                        //if (_LeaderPolygon != null && _LeaderPoint != null)
                        //{
                        //    _DrawLayer.UpdateShape(_LeaderPolygon);
                        //    _DrawLayer.UpdateShape(_LeaderPoint);
                        //}
                        break;

                    case GeometryMode.PointPin:
                        //_PinPoint = new DrawPinPoint(); // { Image = "PinPoints/public.png" };


                        //_DrawLayer.Add(new DrawPinPoint());
                        break;

                    case GeometryMode.Eraser:
                        break;
                }
                if (DrawMapMouseMove != null)
                    DrawMapMouseMove(map, args);
            }
        }
Exemplo n.º 4
0
        private void Events_MapDoubleClick(Map map, MouseButtonEventArgs args)
        {
            
            if (map.DragMode == Map.DragBehavior.Draw)
            {
                _CurrentMousePoint = map.CoordHelper.PixelToGeo(args.GetPosition(map));

                string arg = string.Empty;
                // Drawing Event Arguments to be pass out of silverlight application
                DrawingEventArgs drawing_args = new DrawingEventArgs();

                switch (DrawMode)
                {
                    case GeometryMode.FreeDraw:
                        break;

                    case GeometryMode.StringLine:
                        //_StringLine = null;

                        arg = string.Empty;
                        for (int i = 0; i < _StringLine.Points.Count; i++)
                        {

                            arg += _StringLine.Points[i].X.ToString() + " ";
                            arg += _StringLine.Points[i].Y.ToString() + ",";
                        }
                        arg = arg.Substring(0, arg.Length - 1);
                        // setting the properties of the drawing argument
                        drawing_args.Positions = arg;
                        drawing_args.Color = _StringLine.LineColor.ToString();
                        drawing_args.Opacity = _StringLine.Opacity.ToString();
                        drawing_args.Thickness = _StringLine.LineThickness.ToString();



                        //HtmlWindow hwe = HtmlPage.Window;
                       // ScriptObject soe = (ScriptObject)hwe.GetProperty("external");

                      //  soe.Invoke("SetP");

                        //HtmlPage.Document.Invoke("SetP");
                        _LeaderPolygon = null;

                        ClearDrawLeader();
                        break;

                    case GeometryMode.Polygon:
                        //_Polygon = null;

                        arg = string.Empty;
                         for (int i = 0; i < _Polygon.Points.Count; i++)
                        {

                            arg += _Polygon.Points[i].X.ToString() + " ";
                            arg += _Polygon.Points[i].Y.ToString() + ",";
                        }
                         arg += _Polygon.Points[0].X.ToString() + " ";
                         arg += _Polygon.Points[0].Y.ToString();
                         // setting the properties of the drawing argument
                         drawing_args.Positions = arg;
                         drawing_args.Color = _Polygon.LineColor.ToString();
                         drawing_args.Opacity = _Polygon.Opacity.ToString();
                         drawing_args.Thickness = _Polygon.LineThickness.ToString();

                        //HtmlPage.Window.Invoke("SetPosition", new object[] { arg });
                        _LeaderPolygon = null;
                        ClearDrawLeader();
                        break;

                    case GeometryMode.PointPin:
                        var submitedpin = new DrawPoint();
                        submitedpin.Point = _CurrentMousePoint;
                        submitedpin.Style = Application.Current.Resources["DrawPointStyle"] as Style;
                        submitedpin.TempID = "default";
                        //DrawPointLayer.Add(submitedpin);

                        // setting the properties of the drawing argument
                        drawing_args.Positions = _CurrentMousePoint.X + "," + _CurrentMousePoint.Y;
                        drawing_args.Color = "";
                        drawing_args.Opacity = "";
                        drawing_args.Thickness = "";
                        break;

                    case GeometryMode.Eraser:
                        break;
                }
                _IsDrawing = false;
                _IsDoubleClick = true;

                if (DrawMapDoubleClick != null)
                {
                    DrawMapDoubleClick(map, drawing_args);
                }
            }
        }
Exemplo n.º 5
0
        private void Events_MapMouseDrag(Map map, MouseEventArgs args)
        {
            //if (map.DragMode == Map.DragBehavior.Draw)
            //{
            //    _CurrentMousePoint = map.CoordHelper.PixelToGeo(args.GetPosition(map));

            //    switch (DrawMode)
            //    {
            //        case GeometryMode.FreeDraw:
            //            _FreeDrawLine.Points.Add(_CurrentMousePoint);
            //            break;

            //        case GeometryMode.StringLine:
            //            break;

            //        case GeometryMode.Polygon:
            //            break;

            //        case GeometryMode.PointPin:
            //            break;

            //        case GeometryMode.Eraser:
            //            break;
            //    }
            //}
            if (map.DragMode == Map.DragBehavior.Draw)
            {
                _CurrentMousePoint = map.CoordHelper.PixelToGeo(args.GetPosition(map));

                switch (DrawMode)
                {
                    case GeometryMode.FreeDraw:
                        _FreeDrawLine.Points.Add(_CurrentMousePoint);
                        break;

                    case GeometryMode.StringLine:
                        break;

                    case GeometryMode.Polygon:
                        break;

                    case GeometryMode.PointPin:
                        break;

                    case GeometryMode.Eraser:
                        break;
                }

                if (DrawMapMouseDrag != null)
                    DrawMapMouseDrag(map, args);
            }

        }
Exemplo n.º 6
0
        private void Events_MapMouseUp(Map map, MouseButtonEventArgs args)
        {

            //if (IsPinDrag && map.DragMode != Map.DragBehavior.Draw)
            //{
            //    _CurrentMousePoint = map.CoordHelper.PixelToGeo(args.GetPosition(map));

            //    EditableDevPinLayer.Clear();
            //    var pine = new DrawPoint()
            //    {
            //        Point = _CurrentMousePoint
            //        // ,
            //        //   Style = (Application.Current.Resources["DrawDevPinStyle2"] as Style)
            //    };
            //    pine.TempID = "0";
            //    EditableDevPinLayer.Add(pine);

            //    // Calling method in form
            //    string lone = pine.Point.X.ToString();
            //    string late = pine.Point.Y.ToString();
            //    HtmlWindow hwe = HtmlPage.Window;
            //    ScriptObject soe = (ScriptObject)hwe.GetProperty("external");

            //    try
            //    {
            //        // To invoke a method on javascript
            //        HtmlPage.Window.Invoke("SetPosition", lone + "," + late);

            //    }
            //    catch
            //    {
            //    } 
                
            //    try
            //    {
            //        soe.Invoke("SetLongAndLat", new object[] { lone, late });
            //    }
            //    catch
            //    {
            //    }
            //}

            //if (map.DragMode == Map.DragBehavior.Draw)
            //{
            //    switch (DrawMode)
            //    {
            //        case GeometryMode.FreeDraw:
            //            _FreeDrawLine = null;
            //            break;

            //        case GeometryMode.StringLine:
            //            break;

            //        case GeometryMode.Polygon:
            //            break;

            //        case GeometryMode.PointPin:
            //            break;

            //        case GeometryMode.Eraser:
            //            break;
            //    }
            //}

            if (IsPinDrag && map.DragMode != Map.DragBehavior.Draw)
            {
                _CurrentMousePoint = map.CoordHelper.PixelToGeo(args.GetPosition(map));

                EditableDevPinLayer.Clear();
                var pine = new DrawPoint()
                {
                    Point = _CurrentMousePoint
                    // ,
                    //   Style = (Application.Current.Resources["DrawDevPinStyle2"] as Style)
                };
                pine.TempID = "0";
                EditableDevPinLayer.Add(pine);

                // Calling method in form
                string lone = pine.Point.X.ToString();
                string late = pine.Point.Y.ToString();
                HtmlWindow hwe = HtmlPage.Window;
                ScriptObject soe = (ScriptObject)hwe.GetProperty("external");

                try
                {
                    // To invoke a method on javascript
                    //HtmlPage.Window.Invoke("SetPosition", lone + "," + late);

                }
                catch
                {
                }

                try
                {
                    //soe.Invoke("SetLongAndLat", new object[] { lone, late });
                }
                catch
                {
                }
            }

            if (map.DragMode == Map.DragBehavior.Draw)
            {
                switch (DrawMode)
                {
                    case GeometryMode.FreeDraw:
                        _FreeDrawLine = null;
                        break;

                    case GeometryMode.StringLine:
                        break;

                    case GeometryMode.Polygon:
                        break;

                    case GeometryMode.PointPin:
                        break;

                    case GeometryMode.Eraser:
                        break;
                }
            }

        }
Exemplo n.º 7
0
        private void Events_MapMouseDown(Map map, MouseButtonEventArgs args)
        {
            if (map.DragMode == Map.DragBehavior.Draw)
            {
                _CurrentMousePoint = map.CoordHelper.PixelToGeo(args.GetPosition(map));

                // Drawing Event Arguments to be pass out of silverlight application
                DrawingEventArgs drawing_args = new DrawingEventArgs();

                switch (DrawMode)
                {
                    case GeometryMode.FreeDraw:
                        _FreeDrawLine = new DrawLineString { LineColor = DrawLineColor, LineThickness = DrawLineThickness, Opacity = DrawOpacity };
                        _FreeDrawLine.Points.Add(_CurrentMousePoint);
                        DrawLayer.Add(_FreeDrawLine);
                        break;

                    case GeometryMode.StringLine:
                        if (!_IsDoubleClick)
                        {
                            if (!_IsDrawing)
                            {
                                _StringLine = new DrawLineString { LineColor = DrawLineColor, LineThickness = DrawLineThickness, Opacity = DrawOpacity };
                                _StringLine.Points.Add(_CurrentMousePoint);

                                DrawLayer.Add(_StringLine);

                                LinesPointsLayer.Add(new DrawPoint { Point = _CurrentMousePoint, LineString = _StringLine, Index = _StringLine.Points.Count - 1 });
                                _IsDrawing = true;
                            }
                            else
                            {
                                _StringLine.Points.Add(_CurrentMousePoint);
                                LinesPointsLayer.Add(new DrawPoint { Point = _CurrentMousePoint, LineString = _StringLine, Index = _StringLine.Points.Count - 1 });
                                // Orginal    _DrawLayer.Add(new DrawPoint { Point = _CurrentMousePoint });
                            }
                        }
                        else
                        {
                            //var linepin = new DrawDevPin
                            //{
                            //    Point = _CurrentMousePoint
                            //    ,
                            //    Style = (Application.Current.Resources["DrawDevPinStyle"] as Style)
                            //};
                            //_DrawLayer.Add(linepin);
                            _IsDoubleClick = false;
                        }
                        break;

                    case GeometryMode.Polygon:
                        if (!_IsDoubleClick)
                        {
                            if (!_IsDrawing)
                            {
                                _Polygon = new DrawPolygon { LineColor = DrawLineColor, LineThickness = DrawLineThickness, Opacity = DrawOpacity, FillColor = DrawFillColor };
                                _Polygon.Points.Add(_CurrentMousePoint);
                                DrawLayer.Add(_Polygon);
                                PolygonsPointsLayer.Add(new DrawPoint { Point = _CurrentMousePoint, Polygon = _Polygon, Index = _Polygon.Points.Count - 1 });
                                _IsDrawing = true;
                            }
                            else
                            {
                                _Polygon.Points.Add(_CurrentMousePoint);
                                PolygonsPointsLayer.Add(new DrawPoint { Point = _CurrentMousePoint, Polygon = _Polygon, Index = _Polygon.Points.Count - 1 });
                            }
                        }
                        else
                        {
                            _IsDoubleClick = false;
                        }
                        break;

                    case GeometryMode.PointPin:
                        if (!_IsDoubleClick)
                        {
                            if (!_IsDrawing)
                            {
                                _LeaderPoint = new DrawPoint();
                                _LeaderPoint.Point = _CurrentMousePoint;
                                _LeaderPoint.Style = Application.Current.Resources["DrawPointStyle"] as Style;
                                DrawLayer.Clear();
                                DrawLayer.Add(_LeaderPoint);
                            }
                        }
                        else
                        {
                            _IsDoubleClick = false;
                        }
                        break;

                    case GeometryMode.Eraser:
                        break;
                }



                //if (DrawMapMouseDown != null)
                //{
                //    DrawMapMouseDown(map, drawing_args);
                //}
            }
        }
Exemplo n.º 8
0
 private void Events_MapMouseLeave(Map map, MouseEventArgs args)
 {
     //ClearDrawLeader();
     
     if (DrawMapMouseLeave != null)
         DrawMapMouseLeave(map, args);
 }
Exemplo n.º 9
0
        public DrawControl(Map map)
        {
            _Map = map;

            DefaultStyleKey = typeof(DrawControl);

            DrawLayers = new ObservableCollection<GeometryLayer>();
            DrawLayers.CollectionChanged += DrawLayers_CollectionChanged;
        }
Exemplo n.º 10
0
 public CoordTransform(BIT.AVL.Silver.Map.Map map)
 {
     _Map = map;
 }
Exemplo n.º 11
0
        void Events_MapZoomChanged(Map map, double zoomLevel)
        {
            if (zoomLevel > 12)
                DrawControl.DrawLayer.Visibility = Visibility.Collapsed;
            else
                DrawControl.DrawLayer.Visibility = Visibility.Visible;

            DrawControl.PolygonsPointsLayer.Visibility = Visibility.Collapsed;
        }