Beispiel #1
0
        private void CheckIfPointsAreTouchingLines(object sender, EventArgs e)
        {
            // Create a sample set of point and line features to use for the validation
            Feature uncoveredPointFeature1 = new Feature("POINT(0 0)");
            Feature uncoveredPointFeature2 = new Feature("POINT(50 0)");
            Feature coveredPointFeature    = new Feature("POINT(150 0)");
            Feature lineFeature            = new Feature("LINESTRING(0 0,100 0)");

            // Use the TopologyValidator API to validate the sample data
            Collection <Feature> points = new Collection <Feature>()
            {
                uncoveredPointFeature1, uncoveredPointFeature2, coveredPointFeature
            };
            Collection <Feature> lines = new Collection <Feature>()
            {
                lineFeature
            };
            TopologyValidationResult result = TopologyValidator.PointsMustTouchLines(points, lines);

            // Get the invalid features returned from the API
            Collection <Feature> invalidResultFeatures = result.InvalidFeatures;

            // Clear the MapView and add the new valid/invalid features to the map
            ClearMapAndAddFeatures(new Collection <Feature>()
            {
                uncoveredPointFeature1, uncoveredPointFeature2, coveredPointFeature
            }, invalidResultFeatures, new Collection <Feature>()
            {
                lineFeature
            });

            // Update the help text
            txtValidationInfo.Text = "Features being validated against are shown in blue. \n\nPoints touching lines are shown in green. \n\nPoints not touching lines are shown in red.";
        }
Beispiel #2
0
        /// <summary>
        /// Validate lines based on whether they overlap other lines, and display the results on the map
        /// </summary>
        private void CheckLinesMustNotOverlap(object sender, EventArgs e)
        {
            // Create a sample set of line features to use for the validation
            Feature lineFeature1 = new Feature("LINESTRING(0 0,100 0,100 100)");
            Feature lineFeature2 = new Feature("LINESTRING(0 -50,30 0,60 0,100 50)");
            Feature lineFeature3 = new Feature("LINESTRING(20 50,20 -50)");

            // Use the TopologyValidator API to validate the sample data
            Collection <Feature> lines = new Collection <Feature>()
            {
                lineFeature1, lineFeature2, lineFeature3
            };
            TopologyValidationResult result = TopologyValidator.LinesMustNotOverlap(lines);

            // Get the invalid features returned from the API
            Collection <Feature> invalidResultFeatures = result.InvalidFeatures;

            // Clear the MapView and add the new valid/invalid features to the map
            ClearMapAndAddFeatures(new Collection <Feature>()
            {
                lineFeature1, lineFeature2, lineFeature3
            }, invalidResultFeatures);

            // Update the help text
            txtValidationInfo.Text = "Lines being validated are shown in green. \n\nOverlapping segments are shown in red.";
        }
Beispiel #3
0
        /// <summary>
        /// Validate points based on whether they are within polygons, and display the results on the map
        /// </summary>
        private void CheckIfPointsAreWithinPolygons(object sender, EventArgs e)
        {
            // Create a sample set of point and polygon features to use for the validation
            Feature pointFeature1             = new Feature("POINT(150 0)");
            Feature pointFeature2             = new Feature("POINT(0 0)");
            Feature pointFeatureInsidePolygon = new Feature("POINT(50 50)");
            Feature polygonFeature            = new Feature("POLYGON((0 0,100 0,100 100,0 100,0 0))");

            // Use the TopologyValidator API to validate the sample data
            Collection <Feature> points = new Collection <Feature>()
            {
                pointFeature1, pointFeature2, pointFeatureInsidePolygon
            };
            Collection <Feature> polygons = new Collection <Feature>()
            {
                polygonFeature
            };
            TopologyValidationResult result = TopologyValidator.PointsMustBeWithinPolygons(points, polygons);

            // Get the invalid features returned from the API
            Collection <Feature> invalidResultFeatures = result.InvalidFeatures;

            // Clear the MapView and add the new valid/invalid features to the map
            ClearMapAndAddFeatures(new Collection <Feature>()
            {
                pointFeature1, pointFeature2, pointFeatureInsidePolygon
            }, invalidResultFeatures, new Collection <Feature>()
            {
                polygonFeature
            });

            // Update the help text
            txtValidationInfo.Text = "Features being validated against are shown in blue. \n\nPoints within polygons are shown in green. \n\nPoints not within polygons are shown in red.";
        }
Beispiel #4
0
        /// <summary>
        /// Validate lines based on whether they overlap other lines from a separate set of features, and display the results on the map
        /// </summary>
        private void CheckLinesMustNotOverlapLines(object sender, EventArgs e)
        {
            // Create a sample set of line features to use for the validation
            Feature overlappingLineFeature = new Feature("LINESTRING(0 0,100 0,100 100,0 100)");
            Feature overlappedLineFeature  = new Feature("LINESTRING(150 0,100 30,100 60,150 100)");

            // Use the TopologyValidator API to validate the sample data
            Collection <Feature> coveringLines = new Collection <Feature>()
            {
                overlappingLineFeature
            };
            Collection <Feature> coveredLines = new Collection <Feature>()
            {
                overlappedLineFeature
            };
            TopologyValidationResult result = TopologyValidator.LinesMustNotOverlapLines(coveringLines, coveredLines);

            // Get the invalid features returned from the API
            Collection <Feature> invalidResultFeatures = result.InvalidFeatures;

            // Clear the MapView and add the new valid/invalid features to the map
            ClearMapAndAddFeatures(new Collection <Feature>()
            {
                overlappedLineFeature
            }, invalidResultFeatures, new Collection <Feature>()
            {
                overlappingLineFeature
            });

            // Update the help text
            txtValidationInfo.Text = "Features being validated against are shown in blue. \n\nLines being validated are shown in green. \n\nOverlapping line segments are shown in red.";
        }
Beispiel #5
0
        /// <summary>
        /// Validate lines based on whether they are overlapping polygon boundaries, and display the results on the map
        /// </summary>
        private void CheckLinesMustOverlapPolygonBoundaries(object sender, EventArgs e)
        {
            // Create a sample set of line and polygon features to use for the validation
            Feature lineFeature           = new Feature("LINESTRING(-50 0,150 0)");
            Feature lineOnBoundaryFeature = new Feature("LINESTRING(-50 0,150 0)");
            Feature polygonFeature        = new Feature("POLYGON((0 0,100 0,100 100,0 100,0 0))");

            // Use the TopologyValidator API to validate the sample data
            Collection <Feature> lines = new Collection <Feature>()
            {
                lineFeature, lineOnBoundaryFeature
            };
            Collection <Feature> polygons = new Collection <Feature>()
            {
                polygonFeature
            };
            TopologyValidationResult result = TopologyValidator.LinesMustOverlapPolygonBoundaries(lines, polygons);

            // Get the invalid features returned from the API
            Collection <Feature> invalidResultFeatures = result.InvalidFeatures;

            // Clear the MapView and add the new valid/invalid features to the map
            ClearMapAndAddFeatures(new Collection <Feature>()
            {
                lineFeature, lineOnBoundaryFeature
            }, invalidResultFeatures, new Collection <Feature>()
            {
                polygonFeature
            });

            // Update the help text
            txtValidationInfo.Text = "Features being validated against are shown in blue. \n\nLine segments overlapping polygon boundaries are shown in green. \n\nInvalid line segments are shown in red.";
        }
Beispiel #6
0
        /// <summary>
        /// Validate lines based on whether they form pseudonodes, and display the results on the map
        /// </summary>
        private void CheckLinesMustNotHavePseudonodes(object sender, EventArgs e)
        {
            // Create a sample set of line features to use for the validation
            Feature lineSegmentFeature1 = new Feature("LINESTRING(0 0,50 0,50 50,0 0)");
            Feature lineSegmentFeature2 = new Feature("LINESTRING(-50 0,-50 50)");
            Feature lineSegmentFeature3 = new Feature("LINESTRING(-100 0,-50 50)");
            Feature lineSegmentFeature4 = new Feature("LINESTRING(-50 -50,-50 -100)");
            Feature lineSegmentFeature5 = new Feature("LINESTRING(-100 -50,-50 -100)");
            Feature lineSegmentFeature6 = new Feature("LINESTRING(-50 -100,0 -100)");

            // Use the TopologyValidator API to validate the sample data
            Collection <Feature> lines = new Collection <Feature>()
            {
                lineSegmentFeature1, lineSegmentFeature2, lineSegmentFeature3, lineSegmentFeature4, lineSegmentFeature5, lineSegmentFeature6
            };
            TopologyValidationResult result = TopologyValidator.LinesMustNotHavePseudonodes(lines);

            // Get the invalid features returned from the API
            Collection <Feature> invalidResultFeatures = result.InvalidFeatures;

            // Clear the MapView and add the new valid/invalid features to the map
            ClearMapAndAddFeatures(lines, invalidResultFeatures);

            // Update the help text
            txtValidationInfo.Text = "Lines being validated are shown in green. \n\nPseudonodes are shown in red.";
        }
Beispiel #7
0
        /// <summary>
        /// Validate lines based on whether they are composed of a single part, and display the results on the map
        /// </summary>
        private void CheckLinesMustBeSinglePart(object sender, EventArgs e)
        {
            // Create a sample set of line features to use for the validation
            Feature singleLineFeature = new Feature("MULTILINESTRING((0 -50,100 -50,100 -100,0 -100))");
            Feature multiLineFeature  = new Feature("MULTILINESTRING((0 0,100 0),(100 100,0 100))");

            // Use the TopologyValidator API to validate the sample data
            Collection <Feature> lines = new Collection <Feature>()
            {
                singleLineFeature, multiLineFeature
            };
            TopologyValidationResult result = TopologyValidator.LinesMustBeSinglePart(lines);

            // Get the invalid features returned from the API
            Collection <Feature> invalidResultFeatures = result.InvalidFeatures;

            // Clear the MapView and add the new valid/invalid features to the map
            ClearMapAndAddFeatures(new Collection <Feature>()
            {
                singleLineFeature, multiLineFeature
            }, invalidResultFeatures);

            // Update the help text
            txtValidationInfo.Text = "Lines made of single segments are shown in green. \n\nLines with disjoint segments are shown in red.";
        }
Beispiel #8
0
        /// <summary>
        /// Validate polygons based on whether their boundaries overlap with the boundaries of a second set of polygons, and display the results on the map
        /// </summary>
        private void CheckIfPolygonBoundariesOverlapPolygonBoundaries(object sender, EventArgs e)
        {
            // Create a sample set of polygon features to use for the validation
            Feature coveringPolygonFeature = new Feature("POLYGON((0 0,100 0,100 100,0 100,0 0))");
            Feature coveredPolygonFeature  = new Feature("POLYGON((0 0,50 0,50 50,0 50,0 0))");

            // Use the TopologyValidator API to validate the sample data
            Collection <Feature> coveringPolygons = new Collection <Feature>()
            {
                coveringPolygonFeature
            };
            Collection <Feature> coveredPolygons = new Collection <Feature>()
            {
                coveredPolygonFeature
            };
            TopologyValidationResult result = TopologyValidator.PolygonBoundariesMustOverlapPolygonBoundaries(coveringPolygons, coveredPolygons);

            // Get the invalid features returned from the API
            Collection <Feature> invalidResultFeatures = result.InvalidFeatures;

            // Clear the MapView and add the new valid/invalid features to the map
            ClearMapAndAddFeatures(new Collection <Feature>()
            {
                coveredPolygonFeature
            }, invalidResultFeatures, new Collection <Feature>()
            {
                coveringPolygonFeature
            });

            // Update the help text
            txtValidationInfo.Text = "Features being validated against are shown in blue. \n\nPolygons being validated are shown in green. \n\nNon-overlapping polygon boundaries are shown in red.";
        }
Beispiel #9
0
        /// <summary>
        /// Validate polygons based on whether polygons within the same set overlap, and display the results on the map
        /// </summary>
        private void CheckPolygonsMustNotOverlap(object sender, EventArgs e)
        {
            // Create a sample set of polygon features to use for the validation
            Feature polygonFeature1 = new Feature("POLYGON((25 25,50 25,50 50,25 50,25 25))");
            Feature polygonFeature2 = new Feature("POLYGON((75 25,125 25,125 75,75 75,75 25))");
            Feature polygonFeature3 = new Feature("POLYGON((150 25,200 25,200 75,150 75,150 25))");
            Feature polygonFeature4 = new Feature("POLYGON((0 0,100 0,100 100,0 100,0 0))");

            // Use the TopologyValidator API to validate the sample data
            Collection <Feature> polygons = new Collection <Feature>()
            {
                polygonFeature1, polygonFeature2, polygonFeature3, polygonFeature4
            };
            TopologyValidationResult result = TopologyValidator.PolygonsMustNotOverlap(polygons);

            // Get the invalid features returned from the API
            Collection <Feature> invalidResultFeatures = result.InvalidFeatures;

            // Clear the MapView and add the new valid/invalid features to the map
            ClearMapAndAddFeatures(new Collection <Feature>()
            {
                polygonFeature1, polygonFeature2, polygonFeature3, polygonFeature4
            }, invalidResultFeatures);

            // Update the help text
            txtValidationInfo.Text = "Features being validated are shown in green. \n\nOverlapping polygon regions are shown in red.";
        }
Beispiel #10
0
        /// <summary>
        /// Validate polygons based on whether the union of the polygons has any interior gaps, and display the results on the map
        /// </summary>
        private void CheckIfPolygonsHaveGaps(object sender, EventArgs e)
        {
            // Create a sample set of polygon features to use for the validation
            Feature polygonFeature1 = new Feature("POLYGON((0 0,40 0,40 40,0 40,0 0))");
            Feature polygonFeature2 = new Feature("POLYGON((30 30,70 30,70 70,30 70,30 30))");
            Feature polygonFeature3 = new Feature("POLYGON((60 0,100 0,100 40,60 40,60 0))");
            Feature polygonFeature4 = new Feature("POLYGON((30 10,70 10,70 -30,30 -30,30 10))");

            // Use the TopologyValidator API to validate the sample data
            Collection <Feature> polygons = new Collection <Feature>()
            {
                polygonFeature1, polygonFeature2, polygonFeature3, polygonFeature4
            };
            TopologyValidationResult result = TopologyValidator.PolygonsMustNotHaveGaps(polygons);

            // Get the invalid features returned from the API
            Collection <Feature> invalidResultFeatures = result.InvalidFeatures;

            // Clear the MapView and add the new valid/invalid features to the map
            ClearMapAndAddFeatures(new Collection <Feature>()
            {
                polygonFeature1, polygonFeature2, polygonFeature3, polygonFeature4
            }, invalidResultFeatures);

            // Update the help text
            txtValidationInfo.Text = "Features being validated are shown in green. \n\nGaps (Inner rings) within the union of the polygons are shown in red.";
        }
Beispiel #11
0
        /// <summary>
        /// Validate polygons based on whether they overlap each other, and display the results on the map. Unlike other validations, this function validates and returns invalid polygons from both input sets
        /// </summary>
        private void CheckIfPolygonsCoverEachOther(object sender, EventArgs e)
        {
            // Create a sample set of polygon features to use for the validation
            Feature polygonFeature1 = new Feature("POLYGON((0 0,100 0,100 100,0 100,0 0))");
            Feature polygonFeature2 = new Feature("POLYGON((-50 -50,50 -50,50 50,-50 50,-50 -50))");

            // Use the TopologyValidator API to validate the sample data
            Collection <Feature> firstPolygonsSet = new Collection <Feature>()
            {
                polygonFeature1
            };
            Collection <Feature> secondPolygonsSet = new Collection <Feature>()
            {
                polygonFeature2
            };
            TopologyValidationResult result = TopologyValidator.PolygonsMustOverlapEachOther(firstPolygonsSet, secondPolygonsSet);

            // Get the invalid features returned from the API
            Collection <Feature> invalidResultFeatures = result.InvalidFeatures;

            // Clear the MapView and add the new valid/invalid features to the map
            ClearMapAndAddFeatures(new Collection <Feature>()
            {
                polygonFeature1, polygonFeature2
            }, invalidResultFeatures);

            // Update the help text
            txtValidationInfo.Text = "All non-overlapping regions from two different sets of polygons are shown in red. \n\nOverlapping regions are shown in green";
        }
Beispiel #12
0
        /// <summary>
        /// Validate polygons based on whether they lie within other polygons, and display the results on the map
        /// </summary>
        private void CheckIfPolygonsAreWithinPolygons(object sender, EventArgs e)
        {
            // Create a sample set of polygon features to use for the validation
            Feature polygonFeature1        = new Feature("POLYGON((25 25,50 25,50 50,25 50,25 25))");
            Feature polygonFeature2        = new Feature("POLYGON((75 25,125 25,125 75,75 75,75 25))");
            Feature polygonFeature3        = new Feature("POLYGON((150 25,200 25,200 75,150 75,150 25))");
            Feature coveringPolygonFeature = new Feature("POLYGON((0 0,100 0,100 100,0 100,0 0))");

            // Use the TopologyValidator API to validate the sample data
            Collection <Feature> coveringPolygons = new Collection <Feature>()
            {
                coveringPolygonFeature
            };
            Collection <Feature> coveredPolygons = new Collection <Feature>()
            {
                polygonFeature1, polygonFeature2, polygonFeature3
            };
            TopologyValidationResult result = TopologyValidator.PolygonsMustBeWithinPolygons(coveringPolygons, coveredPolygons);

            // Get the invalid features returned from the API
            Collection <Feature> invalidResultFeatures = result.InvalidFeatures;

            // Clear the MapView and add the new valid/invalid features to the map
            ClearMapAndAddFeatures(new Collection <Feature>()
            {
                polygonFeature1, polygonFeature2, polygonFeature3
            }, invalidResultFeatures, new Collection <Feature>()
            {
                coveringPolygonFeature
            });

            // Update the help text
            txtValidationInfo.Text = "Features being validated against are shown in blue. \n\nPolygons fully within polygons are shown in green. \n\nPolygons not within polygons are shown in red.";
        }
Beispiel #13
0
        /// <summary>
        /// Validate lines based on whether they form a closed polygon, and display the results on the map
        /// </summary>
        private void CheckLinesMustFormClosedPolygon(object sender, EventArgs e)
        {
            // Create a sample set of line features to use for the validation
            Feature lineFeature1 = new Feature("LINESTRING(0 0,100 0,100 100,20 100)");
            Feature lineFeature2 = new Feature("LINESTRING(0 0,-50 0,-50 100,0 100)");

            // Use the TopologyValidator API to validate the sample data
            Collection <Feature> lines = new Collection <Feature>()
            {
                lineFeature1, lineFeature2
            };
            TopologyValidationResult result = TopologyValidator.LinesMustFormClosedPolygon(lines);

            // Get the invalid features returned from the API
            Collection <Feature> invalidResultFeatures = result.InvalidFeatures;

            // Clear the MapView and add the new valid/invalid features to the map
            ClearMapAndAddFeatures(lines, invalidResultFeatures);

            // Update the help text
            txtValidationInfo.Text = "Lines being validated are shown in green. \n\nLine endpoints that do not form a closed polygon are shown in red.";
        }
Beispiel #14
0
        /// <summary>
        /// Validate lines based on whether they self-intersect, and display the results on the map
        /// </summary>
        private void CheckLinesMustNotSelfIntersect(object sender, EventArgs e)
        {
            // Create a sample set of line features to use for the validation
            Feature selfIntersectingLine = new Feature("LINESTRING(0 0,100 0,100 100,50 100,50 -50)");

            // Use the TopologyValidator API to validate the sample data
            Collection <Feature> lines = new Collection <Feature>()
            {
                selfIntersectingLine
            };
            TopologyValidationResult result = TopologyValidator.LinesMustNotSelfIntersect(lines);

            // Get the invalid features returned from the API
            Collection <Feature> invalidResultFeatures = result.InvalidFeatures;

            // Clear the MapView and add the new valid/invalid features to the map
            ClearMapAndAddFeatures(new Collection <Feature>()
            {
                selfIntersectingLine
            }, invalidResultFeatures);

            // Update the help text
            txtValidationInfo.Text = "Lines being validated are shown in green. \n\nSelf-intersections are shown in red.";
        }