Exemple #1
0
        protected override void OnMouseDoubleClick(MouseEventArgs e)
        {
            base.OnMouseDoubleClick(e);

            if (_activeTool == Tools.DrawPolygon)
            {
                if (GeometryDefined != null)
                {
                    var cl = new NetTopologySuite.Geometries.CoordinateList(_pointArray, false);
                    cl.CloseRing();
                    GeometryDefined(Map.Factory.CreatePolygon(Map.Factory.CreateLinearRing(NetTopologySuite.Geometries.CoordinateArrays.AtLeastNCoordinatesOrNothing(4, cl.ToCoordinateArray())), null));
                }
                ActiveTool = Tools.None;
            }

            else if (_activeTool == Tools.DrawLine)
            {
                if (GeometryDefined != null)
                {
                    var cl = new NetTopologySuite.Geometries.CoordinateList(_pointArray, false);
                    GeometryDefined(Map.Factory.CreateLineString(NetTopologySuite.Geometries.CoordinateArrays.AtLeastNCoordinatesOrNothing(2, cl.ToCoordinateArray())));
                }
                ActiveTool = Tools.None;
            }
        }
Exemple #2
0
        protected override void OnMouseDoubleClick(MouseEventArgs e)
        {
            // call base function
            base.OnMouseDoubleClick(e);

            if (_map == null)
                return;

            // Do we have an active tool?
            if (_activeTool == Tools.None)
                return;

            // Do we have a custom tool
            if (UseCurrentTool)
            {
                if (_currentTool.DoMouseDoubleClick(_map.ImageToWorld(e.Location), e))
                    return;
            }


            if (_activeTool == Tools.DrawPolygon)
            {
                if (GeometryDefined != null)
                {
                    var cl = new NetTopologySuite.Geometries.CoordinateList(_pointArray, false);
                    cl.CloseRing();
                    GeometryDefined(Map.Factory.CreatePolygon(Map.Factory.CreateLinearRing(NetTopologySuite.Geometries.CoordinateArrays.AtLeastNCoordinatesOrNothing(4, cl.ToCoordinateArray())), null));
                }
                ActiveTool = Tools.None;
            }

            else if (_activeTool == Tools.DrawLine)
            {
                if (GeometryDefined != null)
                {
                    var cl = new NetTopologySuite.Geometries.CoordinateList(_pointArray, false);
                    GeometryDefined(Map.Factory.CreateLineString(NetTopologySuite.Geometries.CoordinateArrays.AtLeastNCoordinatesOrNothing(2, cl.ToCoordinateArray())));
                }
                ActiveTool = Tools.None;
            }
        }