예제 #1
0
        private void ClearDrawLeader()
        {
            DrawLayer.Remove(_LeaderLine);
            DrawLayer.Remove(_LeaderPolygon);
            DrawLayer.Remove(_LeaderPoint);

            _LeaderLine = null;
            _LeaderPoint = null;
            _LeaderPolygon = null;
        }
예제 #2
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;
                }
            }

        }
예제 #3
0
        private void ClearShapes()
        {
            _IsDrawing = false;
            _IsDoubleClick = false;

            _FreeDrawLine = null;
            _StringLine = null;
            //_Polygon = null;
            //_PolygonalDevPin = null;

            _LeaderLine = null;
            _LeaderPolygon = null;
        }
예제 #4
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);
                //}
            }
        }