Example #1
0
 public DragInteractiveOverlayAdvanced()
     : base()
 {
     ExistingControlPointsLayer.Open();
     ExistingControlPointsLayer.Columns.Add(new FeatureSourceColumn("nodetype"));
     ExistingControlPointsLayer.Close();
 }
Example #2
0
        //Overrides the DrawCore function.
        protected override void DrawCore(GeoCanvas canvas)
        {
            //Draws the Edit Shapes as default.
            Collection <SimpleCandidate> labelsInAllLayers = new Collection <SimpleCandidate>();

            EditShapesLayer.Open();
            EditShapesLayer.Draw(canvas, labelsInAllLayers);
            canvas.Flush();

            //Draws the control points.
            ExistingControlPointsLayer.Open();
            Collection <Feature> controlPoints = ExistingControlPointsLayer.FeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns);

            //Loops thru the control points.
            foreach (Feature feature in controlPoints)
            {
                //Looks at the value of "state" to draw the control point as dragged or not.
                if (feature.ColumnValues["state"] != "selected")
                {
                    Feature[] features = new Feature[1] {
                        feature
                    };
                    controlPointStyle.Draw(features, canvas, labelsInAllLayers, labelsInAllLayers);
                }
                else
                {
                    Feature[] features = new Feature[1] {
                        feature
                    };
                    draggedControlPointStyle.Draw(features, canvas, labelsInAllLayers, labelsInAllLayers);
                }
            }
        }
Example #3
0
        public SelectVerticesEditInteractiveOverlay()
            : base()
        {
            this.CanAddVertex    = false;
            this.CanDrag         = true;
            this.CanRemoveVertex = false;
            this.CanResize       = false;
            this.CanRotate       = false;

            ExistingControlPointsLayer.Open();
            ExistingControlPointsLayer.Columns.Add(new FeatureSourceColumn("IsSelected"));
            ExistingControlPointsLayer.Close();

            existingFeatures = new Collection <Feature>();
        }
Example #4
0
        //Overrides the DrawCore function.
        protected override void DrawCore(GeoCanvas canvas)
        {
            //Draws the Edit Shapes as default.
            Collection <SimpleCandidate> labelsInAllLayers = new Collection <SimpleCandidate>();

            EditShapesLayer.Open();
            EditShapesLayer.Draw(canvas, labelsInAllLayers);
            canvas.Flush();

            //Draws the control points.
            ExistingControlPointsLayer.Open();
            Collection <Feature> controlPoints = ExistingControlPointsLayer.FeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns);

            //Loops thru the control points.
            foreach (Feature feature in controlPoints)
            {
                //Looks at the value of "state" to draw the control point as dragged or not.
                if (feature.ColumnValues["state"] != "selected")
                {
                    Feature[] features = new Feature[1] {
                        feature
                    };
                    controlPointStyle.Draw(features, canvas, labelsInAllLayers, labelsInAllLayers);
                }
                else
                {
                    Feature[] features = new Feature[1] {
                        feature
                    };
                    draggedControlPointStyle.Draw(features, canvas, labelsInAllLayers, labelsInAllLayers);

                    PointShape pointShape        = feature.GetShape() as PointShape;
                    PointShape closestPointShape = referenceShape.GetClosestPointTo(pointShape, GeographyUnit.DecimalDegree);
                    //Draws the closest point on the reference shape and the distance to it from the dragged control point.
                    if (closestPointShape != null)
                    {
                        double       Dist         = System.Math.Round(closestPointShape.GetDistanceTo(pointShape, GeographyUnit.DecimalDegree, DistanceUnit.Meter));
                        ScreenPointF ScreenPointF = ExtentHelper.ToScreenCoordinate(canvas.CurrentWorldExtent, pointShape, canvas.Width, canvas.Height);
                        canvas.DrawTextWithScreenCoordinate(System.Convert.ToString(Dist) + " m", new GeoFont("Arial", 12, DrawingFontStyles.Bold), new GeoSolidBrush(GeoColor.StandardColors.Black),
                                                            ScreenPointF.X + 35, ScreenPointF.Y, DrawingLevel.LabelLevel);
                        canvas.DrawEllipse(closestPointShape, 12, 12, new GeoSolidBrush(GeoColor.StandardColors.Purple), DrawingLevel.LevelFour);
                    }
                }
            }
        }
Example #5
0
        //Overrides the DrawCore function.
        protected override void DrawCore(GeoCanvas canvas)
        {
            if (EditShapesLayer.InternalFeatures.Count > 1)
            {
                throw new NotImplementedException("Only allow one shape to be editing.");
            }

            //Draws the Edit Shapes as default.
            Collection <SimpleCandidate> labelsInAllLayers = new Collection <SimpleCandidate>();

            EditShapesLayer.Open();
            EditShapesLayer.Draw(canvas, labelsInAllLayers);
            canvas.Flush();

            ExistingControlPointsLayer.Open();
            Collection <Feature> ExistingControlPoints = ExistingControlPointsLayer.QueryTools.GetAllFeatures(new string[1] {
                "IsSelected"
            });

            ExistingControlPointsLayer.Close();

            //Loops thru the control points.
            for (int i = ExistingControlPoints.Count - 1; i >= 0; i--)
            {
                Feature feature = ExistingControlPoints[i];
                if (feature.ColumnValues.ContainsKey("IsSelected") && feature.ColumnValues["IsSelected"] == "true")
                {
                    Feature[] features = new Feature[1] {
                        feature
                    };
                    selectedControlPointStyle.Draw(features, canvas, labelsInAllLayers, labelsInAllLayers);
                }
                else
                {
                    Feature[] features = new Feature[1] {
                        feature
                    };
                    controlPointStyle.Draw(features, canvas, labelsInAllLayers, labelsInAllLayers);
                }
            }
        }
Example #6
0
        //Overrides the DrawCore function.
        protected override void DrawCore(GeoCanvas canvas)
        {
            //Draws the Edit Shapes as default.
            Collection <SimpleCandidate> labelsInAllLayers = new Collection <SimpleCandidate>();

            EditShapesLayer.Open();
            EditShapesLayer.Draw(canvas, labelsInAllLayers);
            canvas.Flush();

            //Gets the control points and draw its features according to the value of "IsSelected" column.
            this.ExistingControlPointsLayer.Open();
            Collection <Feature> ExistingControlPoints = this.ExistingControlPointsLayer.QueryTools.GetAllFeatures(new string[1] {
                "IsSelected"
            });

            ExistingControlPointsLayer.Close();

            //Loops thru the control points features and check for the value of "IsSelected" collumn.
            foreach (Feature feature in ExistingControlPoints)
            {
                if (feature.ColumnValues.ContainsKey("IsSelected") && feature.ColumnValues["IsSelected"] == "true")
                {
                    Feature[] features = new Feature[1] {
                        feature
                    };
                    selectedControlPointStyle.Draw(features, canvas, labelsInAllLayers, labelsInAllLayers);
                }
                else
                {
                    Feature[] features = new Feature[1] {
                        feature
                    };
                    controlPointStyle.Draw(features, canvas, labelsInAllLayers, labelsInAllLayers);
                }
            }
        }
Example #7
0
        //Overrides the DrawCore function to draw the Edit Layers, the vertices and tolerance ellipses of layer to snap to,
        //and the control points.
        protected override void DrawCore(GeoCanvas canvas)
        {
            //Sets the geography Unit used in FindNearestSnappingPoint function
            geographyUnit      = canvas.MapUnit;
            currentWorldExtent = canvas.CurrentWorldExtent;
            mapWidth           = canvas.Width;
            mapHeight          = canvas.Height;

            //Draws the Edit Shapes as default.
            Collection <SimpleCandidate> labelsInAllLayers = new Collection <SimpleCandidate>();

            EditShapesLayer.Open();
            EditShapesLayer.Draw(canvas, labelsInAllLayers);
            canvas.Flush();

            //Draw the vertices and tolerance ellipses of layer to snap to.
            toSnapInMemoryFeatureLayer.Open();
            Collection <Feature> toSnapPoints = toSnapInMemoryFeatureLayer.FeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns);

            toSnapInMemoryFeatureLayer.Close();
            foreach (Feature feature in toSnapPoints)
            {
                PolygonShape polygonShape = (PolygonShape)feature.GetShape();

                foreach (Vertex vertex in polygonShape.OuterRing.Vertices)
                {
                    //Draws the vertex.
                    PointShape pointShape = new PointShape(vertex);
                    canvas.DrawEllipse(pointShape, 5, 5, new GeoSolidBrush(GeoColor.StandardColors.Black), DrawingLevel.LevelOne);

                    //Draws the tolerance ellipse.
                    if (toleranceType == ToleranceCoordinates.Screen)
                    {
                        ScreenPointF screenPointF = ExtentHelper.ToScreenCoordinate(canvas.CurrentWorldExtent, pointShape, canvas.Width, canvas.Height);
                        canvas.DrawEllipse(screenPointF, tolerance * 2, tolerance * 2, new GeoPen(GeoColor.StandardColors.Black), new GeoSolidBrush(), DrawingLevel.LevelFour, 0, 0, PenBrushDrawingOrder.PenFirst);
                    }
                    else
                    {
                        EllipseShape ellipseShape = new EllipseShape(pointShape, tolerance, canvas.MapUnit, toleranceUnit);
                        canvas.DrawArea(ellipseShape, new GeoPen(GeoColor.StandardColors.Black), DrawingLevel.LevelOne);
                    }
                }
            }

            //Draws the control points.
            ExistingControlPointsLayer.Open();
            Collection <Feature> controlPoints = ExistingControlPointsLayer.FeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns);

            ////Loops thru the control points.
            foreach (Feature feature in controlPoints)
            {
                //Looks at the value of "state" to draw the control point as dragged or not.
                Feature[] features = new Feature[1] {
                    feature
                };
                controlPointStyle.Draw(features, canvas, labelsInAllLayers, labelsInAllLayers);
            }

            foreach (Feature feature in SelectedControlPointLayer.InternalFeatures)
            {
                Feature[] features = new Feature[1] {
                    feature
                };
                draggedControlPointStyle.Draw(features, canvas, labelsInAllLayers, labelsInAllLayers);
            }
        }