Example #1
0
        private void ShowTemporaryShapesOnTheMap_Load(object sender, EventArgs e)
        {
            winformsMap1.MapUnit = GeographyUnit.DecimalDegree;

            winformsMap1.CurrentExtent = new RectangleShape(0, 100, 100, 0);
            winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.StandardColors.White);

            InMemoryFeatureLayer inMemoryLayer = new InMemoryFeatureLayer();

            inMemoryLayer.InternalFeatures.Add("Polygon", new Feature(BaseShape.CreateShapeFromWellKnownData("POLYGON((10 60,40 70,30 85, 10 60))")));
            inMemoryLayer.InternalFeatures.Add("Multipoint", new Feature(BaseShape.CreateShapeFromWellKnownData("MULTIPOINT(10 20, 30 20,40 20, 10 30, 30 30, 40 30)")));
            inMemoryLayer.InternalFeatures.Add("Line", new Feature(BaseShape.CreateShapeFromWellKnownData("LINESTRING(60 60, 70 70,75 60, 80 70, 85 60,95 80)")));
            inMemoryLayer.InternalFeatures.Add("Rectangle", new Feature(new RectangleShape(65, 30, 95, 15)));

            inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.FromArgb(100, GeoColor.StandardColors.RoyalBlue);
            inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color     = GeoColor.StandardColors.Blue;
            inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle.OuterPen             = new GeoPen(GeoColor.FromArgb(200, GeoColor.StandardColors.Red), 5);
            inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.SymbolPen           = new GeoPen(GeoColor.FromArgb(255, GeoColor.StandardColors.Green), 8);
            inMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            LayerOverlay staticOverlay = new LayerOverlay();

            staticOverlay.Layers.Add("InMemoryFeatureLayer", inMemoryLayer);
            winformsMap1.Overlays.Add(staticOverlay);

            winformsMap1.Refresh();
        }
Example #2
0
        private void TestForm_Load(object sender, EventArgs e)
        {
            label1.Text = "Drag vertex of the polygon. Hold Shift key and release mouse button to have the vertex snapping to the line.";

            winformsMap1.MapUnit       = GeographyUnit.DecimalDegree;
            winformsMap1.CurrentExtent = new RectangleShape(-97.755, 30.319, -97.7266, 30.3018);
            winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 198, 255, 255));

            //Displays the World Map Kit as a background.
            ThinkGeo.MapSuite.DesktopEdition.WorldMapKitWmsDesktopOverlay worldMapKitDesktopOverlay = new ThinkGeo.MapSuite.DesktopEdition.WorldMapKitWmsDesktopOverlay();
            winformsMap1.Overlays.Add(worldMapKitDesktopOverlay);

            string       fileName1 = @"..\..\data\polygon.txt";
            StreamReader sr1       = new StreamReader(fileName1);

            string       fileName2 = @"..\..\data\line.txt";
            StreamReader sr2       = new StreamReader(fileName2);

            //DragtInteractiveOverlay for setting the PointStyles of the control points and dragged points.
            DragInteractiveOverlayAdvanced dragInteractiveOverlay = new DragInteractiveOverlayAdvanced();

            dragInteractiveOverlay.EditShapesLayer.InternalFeatures.Add("Polygon", new Feature(BaseShape.CreateShapeFromWellKnownData(sr1.ReadLine())));

            //Sets the PointStyle for the non dragged control points.
            dragInteractiveOverlay.ControlPointStyle = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.StandardColors.PaleGoldenrod), new GeoPen(GeoColor.StandardColors.Black), 8);
            //Sets the PointStyle for the dragged control points.
            dragInteractiveOverlay.DraggedControlPointStyle = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.StandardColors.Green), new GeoPen(GeoColor.StandardColors.DarkGreen, 2), 10);
            //Sets the PointStyle for the dragged control points when shit key pressed.
            dragInteractiveOverlay.DraggedControlPointStyleWithShiftKey = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.StandardColors.Red), new GeoPen(GeoColor.StandardColors.Orange, 2), 10);
            //LineShape snapping feature.
            LineShape snappingLineShape = (LineShape)BaseShape.CreateShapeFromWellKnownData(sr2.ReadLine());

            dragInteractiveOverlay.SnappingFeature = new Feature(snappingLineShape);

            dragInteractiveOverlay.CanAddVertex    = false;
            dragInteractiveOverlay.CanDrag         = false;
            dragInteractiveOverlay.CanRemoveVertex = false;
            dragInteractiveOverlay.CanResize       = false;
            dragInteractiveOverlay.CanRotate       = false;
            dragInteractiveOverlay.CalculateAllControlPoints();

            winformsMap1.EditOverlay = dragInteractiveOverlay;

            //Regular InMemoryFeatureLayer for displaying line snapping feature.
            InMemoryFeatureLayer inMemoryFeatureLayer = new InMemoryFeatureLayer();

            inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.Red, 4, true);
            inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            inMemoryFeatureLayer.InternalFeatures.Add(new Feature(snappingLineShape));

            LayerOverlay layerOverlay = new LayerOverlay();

            layerOverlay.Layers.Add(inMemoryFeatureLayer);
            winformsMap1.Overlays.Add(layerOverlay);

            winformsMap1.Refresh();
        }
Example #3
0
        private void TestForm_Load(object sender, EventArgs e)
        {
            winformsMap1.MapUnit       = GeographyUnit.DecimalDegree;
            winformsMap1.CurrentExtent = new RectangleShape(-97.7591, 30.3126, -97.7317, 30.2964);
            winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 198, 255, 255));

            //Displays the World Map Kit as a background.
            ThinkGeo.MapSuite.WinForms.WorldStreetsAndImageryOverlay worldMapKitDesktopOverlay = new ThinkGeo.MapSuite.WinForms.WorldStreetsAndImageryOverlay();
            winformsMap1.Overlays.Add(worldMapKitDesktopOverlay);

            string       fileName1 = @"..\..\data\polygon.txt";
            StreamReader sr1       = new StreamReader(fileName1);

            string       fileName2 = @"..\..\data\line.txt";
            StreamReader sr2       = new StreamReader(fileName2);

            //SnapToLayerEditInteractiveOverlay to snap dragged control point to nearest vertex of layer if within tolerance.
            SnapToLayerEditInteractiveOverlay snapToLayerEditInteractiveOverlay = new SnapToLayerEditInteractiveOverlay();

            //inMemoryFeatureLayer used to be snapped to.
            InMemoryFeatureLayer polygonInMemoryFeatureLayer = new InMemoryFeatureLayer();

            polygonInMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyles.Park1;
            polygonInMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            polygonInMemoryFeatureLayer.InternalFeatures.Add("Polygon", new Feature(BaseShape.CreateShapeFromWellKnownData(sr1.ReadLine())));

            LayerOverlay inMemoryOverlay = new LayerOverlay();

            inMemoryOverlay.Layers.Add("InMemoryFeatureLayer", polygonInMemoryFeatureLayer);
            winformsMap1.Overlays.Add("InMemoryOverlay", inMemoryOverlay);

            snapToLayerEditInteractiveOverlay.EditShapesLayer.InternalFeatures.Add("MultiLine", new Feature(BaseShape.CreateShapeFromWellKnownData(sr2.ReadLine())));

            //Sets the PointStyle for the non dragged control points.
            snapToLayerEditInteractiveOverlay.ControlPointStyle = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.StandardColors.PaleGoldenrod), new GeoPen(GeoColor.StandardColors.Black), 8);
            //Sets the PointStyle for the dragged control points.
            snapToLayerEditInteractiveOverlay.DraggedControlPointStyle = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.StandardColors.Red), new GeoPen(GeoColor.StandardColors.Orange, 2), 10);

            snapToLayerEditInteractiveOverlay.ToSnapInMemoryFeatureLayer = polygonInMemoryFeatureLayer;

            //Example using Screen (Pixel) coordinates for tolerance.
            snapToLayerEditInteractiveOverlay.ToleranceType = ToleranceCoordinates.Screen;
            snapToLayerEditInteractiveOverlay.Tolerance     = 25;

            //Example using World coordinates for tolerance.
            //snapToLayerEditInteractiveOverlay.ToleranceType = ToleranceCoordinates.World;
            //snapToLayerEditInteractiveOverlay.Tolerance = 150;
            //snapToLayerEditInteractiveOverlay.ToleranceUnit = DistanceUnit.Meter;

            snapToLayerEditInteractiveOverlay.CalculateAllControlPoints();

            winformsMap1.EditOverlay = snapToLayerEditInteractiveOverlay;

            winformsMap1.Refresh();
        }
 private void QueryResultItemsDataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 0 && e.RowIndex > -1)
     {
         DataGridViewCell cell = QueryResultItemsDataGridView.Rows[e.RowIndex].Cells["cluLocation"];
         if (cell.Value != null)
         {
             map.CurrentExtent = BaseShape.CreateShapeFromWellKnownData((string)cell.Value).GetBoundingBox();
             map.Refresh();
         }
     }
 }
        public static Collection <AreaBaseShape> GetSplitResult(this AreaBaseShape polygon, Collection <LineShape> lines)
        {
            SqlGeometry polygonGeom = SqlGeometry.STGeomFromWKB(new SqlBytes(polygon.GetWellKnownBinary()), 0);

            if (!polygonGeom.STIsValid())
            {
                polygonGeom = polygonGeom.MakeValid();
            }
            //GeometryLibrary library = BaseShape.GeometryLibrary;
            //BaseShape.GeometryLibrary = GeometryLibrary.Unmanaged;
            foreach (var item in lines)
            {
                //MultipolygonShape multipolygon = item.Buffer(0.2, 8, BufferCapType.Square, GeographyUnit.DecimalDegree, DistanceUnit.Meter);
                MultipolygonShape multipolygon     = SqlTypesGeometryHelper.Buffer(item, 0.2, 8, BufferCapType.Square, GeographyUnit.DecimalDegree, DistanceUnit.Meter);
                SqlGeometry       multipolygonGeom = SqlGeometry.STGeomFromWKB(new SqlBytes(multipolygon.GetWellKnownBinary()), 0);
                if (!multipolygonGeom.STIsValid())
                {
                    multipolygonGeom = multipolygonGeom.MakeValid();
                }

                polygonGeom = polygonGeom.STDifference(multipolygonGeom);
            }

            //BaseShape.GeometryLibrary = library;

            byte[]    bytes = polygonGeom.STAsBinary().Value;
            BaseShape shape = BaseShape.CreateShapeFromWellKnownData(bytes) as AreaBaseShape;

            MultipolygonShape splittedMultipolygonShape = shape as MultipolygonShape;
            PolygonShape      splittedPolygonShape      = shape as PolygonShape;

            if (splittedMultipolygonShape == null && splittedPolygonShape != null)
            {
                splittedMultipolygonShape = new MultipolygonShape();
                splittedMultipolygonShape.Polygons.Add(splittedPolygonShape);
                shape = splittedMultipolygonShape;
            }

            Collection <AreaBaseShape> shapes = new Collection <AreaBaseShape>();

            if (splittedMultipolygonShape != null)
            {
                CloseSplittedPolygons(polygon, splittedMultipolygonShape, lines[0], GeographyUnit.DecimalDegree, DistanceUnit.Meter, .3);
                FillShapes(shapes, shape);
            }
            return(shapes);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.DisplayASimpleMap);

            androidMap               = FindViewById <MapView>(Resource.Id.androidmap);
            androidMap.MapUnit       = GeographyUnit.DecimalDegree;
            androidMap.CurrentExtent = new RectangleShape(0, 100, 100, 0);

            LayerOverlay inMemoryOverlay = new LayerOverlay();

            androidMap.Overlays.Add("InMemoryOverlay", inMemoryOverlay);

            LayerOverlay shortestLineOverlay = new LayerOverlay();

            shortestLineOverlay.TileType = TileType.SingleTile;
            androidMap.Overlays.Add("ShortestLineOverlay", shortestLineOverlay);

            BaseShape areaShape1 = BaseShape.CreateShapeFromWellKnownData("POLYGON((10 20,30 60,40 10,10 20))");
            BaseShape areaShape2 = new EllipseShape(new PointShape(70, 70), 10, 20);

            InMemoryFeatureLayer inMemoryLayer = new InMemoryFeatureLayer();

            inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.FromArgb(125, GeoColor.StandardColors.Gray);
            inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color     = GeoColor.StandardColors.Black;
            inMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            inMemoryLayer.InternalFeatures.Add("AreaShape1", new Feature(areaShape1));
            inMemoryLayer.InternalFeatures.Add("AreaShape2", new Feature(areaShape2));
            inMemoryOverlay.Layers.Add("InMemoryFeatureLayer", inMemoryLayer);

            InMemoryFeatureLayer shortestLineLayer = new InMemoryFeatureLayer();

            shortestLineLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle.OuterPen.Color = GeoColor.StandardColors.Red;
            shortestLineLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel             = ApplyUntilZoomLevel.Level20;
            shortestLineOverlay.Layers.Add("ShortestLineLayer", shortestLineLayer);

            MultilineShape shortestLine = areaShape1.GetShortestLineTo(areaShape2, GeographyUnit.Meter);

            shortestLineLayer.InternalFeatures.Add("ShortestLine", new Feature(shortestLine));

            SampleViewHelper.InitializeInstruction(this, FindViewById <RelativeLayout>(Resource.Id.MainLayout), GetType());
        }
Example #7
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Proj4Projection proj4 = new Proj4Projection();

            proj4.ExternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(2178);
            proj4.InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(2178);
            //proj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString();
            proj4.Open();

            //WorldStreetsAndImageryProjection x = new WorldStreetsAndImageryProjection();

            //WpfMap.MapUnit = ThinkGeo.MapSuite.GeographyUnit.DecimalDegree;
            WpfMap.MapUnit       = ThinkGeo.MapSuite.GeographyUnit.Meter;
            WpfMap.CurrentExtent = new RectangleShape(6534300.78, 5593416.28, 6534296.12, 5593426.45);
            //var x = new WorldStreetsAndImageryOverlay()
            //WpfMap.Overlays.Add(x);
            WpfMap.Refresh();

            InMemoryFeatureLayer inMemoryFeatureLayer = CreateInMemoryFeatureLayerFromTextFile(@"..\..\data\FriscoHotels.txt");

            inMemoryFeatureLayer.FeatureSource.Projection = proj4;
            LayerOverlay layerOverlay = new LayerOverlay();

            layerOverlay.TileType = TileType.SingleTile;
            layerOverlay.Layers.Add(inMemoryFeatureLayer);
            WpfMap.Overlays.Add(layerOverlay);

            //LayerOverlay layerOverlay = new LayerOverlay();
            //layerOverlay.TileType = TileType.SingleTile;

            //var polygonLayer = new InMemoryFeatureLayer();
            //Feature feature2 = new Feature(new PolygonShape("POLYGON((20.030485999999996 50.00571917079107,20.030485999999996 49.998476,20.03997000000004 49.998476,20.03997000000004 49.998476,20.040292010620078 50.00568354029431,20.030485999999996 50.00571917079107))"));
            //polygonLayer.Open();
            //polygonLayer.EditTools.BeginTransaction();
            //polygonLayer.EditTools.Add(feature2);
            ////layerOverlay.Layers.Add(inMemoryFeatureLayer);
            //layerOverlay.Layers.Add(polygonLayer);
            //WpfMap.Overlays.Add(layerOverlay);
            //polygonLayer.EditTools.CommitTransaction();
            //polygonLayer.Close();

            InMemoryFeatureLayer inMemoryLayer = new InMemoryFeatureLayer();

            inMemoryLayer.FeatureSource.Projection = proj4;
            inMemoryLayer.InternalFeatures.Add("Polygon", new Feature(BaseShape.CreateShapeFromWellKnownData("POLYGON((6534300.78 5593416.28, 6534296.12 5593426.45, 6534280.56 5593419.19, 6534283.49 5593412.92, 6534285.3 5593409.04, 6534300.78 5593416.28))")));

            inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.FromArgb(100, GeoColor.StandardColors.RoyalBlue);
            inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color     = GeoColor.StandardColors.Blue;
            inMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            LayerOverlay layerOverlay2 = new LayerOverlay();

            layerOverlay2.TileType = TileType.SingleTile;
            layerOverlay2.Layers.Add(inMemoryLayer);
            //WpfMap.Overlays.Add(layerOverlay);


            inMemoryLayer.Open();
            WpfMap.CurrentExtent = inMemoryLayer.GetBoundingBox();
            inMemoryLayer.Close();

            WpfMap.Refresh();
        }
Example #8
0
        private void TestForm_Load(object sender, EventArgs e)
        {
            label1.Text = "Select vertices by clicking on them and then drag them as a group.";

            winformsMap1.MapUnit       = GeographyUnit.DecimalDegree;
            winformsMap1.CurrentExtent = new RectangleShape(-97.755, 30.319, -97.7266, 30.3018);
            winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 198, 255, 255));

            //Displays the World Map Kit as a background.
            ThinkGeo.MapSuite.DesktopEdition.WorldMapKitWmsDesktopOverlay worldMapKitDesktopOverlay = new ThinkGeo.MapSuite.DesktopEdition.WorldMapKitWmsDesktopOverlay();
            winformsMap1.Overlays.Add(worldMapKitDesktopOverlay);

            string       fileName1 = @"..\..\data\polygon.txt";
            StreamReader sr1       = new StreamReader(fileName1);

            //DragtInteractiveOverlay for setting the PointStyles of the control points and dragged points.
            SelectVerticesEditInteractiveOverlay selectVerticesEditInteractiveOverlay = new SelectVerticesEditInteractiveOverlay();

            selectVerticesEditInteractiveOverlay.EditShapesLayer.InternalFeatures.Add("Polygon", new Feature(BaseShape.CreateShapeFromWellKnownData(sr1.ReadLine())));

            //Sets the PointStyle for the non dragged control points.
            selectVerticesEditInteractiveOverlay.ControlPointStyle = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.StandardColors.PaleGoldenrod), new GeoPen(GeoColor.StandardColors.Black), 8);
            //Sets the PointStyle for the dragged control points.
            selectVerticesEditInteractiveOverlay.SelectedControlPointStyle = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.StandardColors.Green), new GeoPen(GeoColor.StandardColors.DarkGreen, 2), 10);

            selectVerticesEditInteractiveOverlay.CanAddVertex    = false;
            selectVerticesEditInteractiveOverlay.CanDrag         = false;
            selectVerticesEditInteractiveOverlay.CanRemoveVertex = false;
            selectVerticesEditInteractiveOverlay.CanResize       = false;
            selectVerticesEditInteractiveOverlay.CanRotate       = false;
            selectVerticesEditInteractiveOverlay.CalculateAllControlPoints();

            winformsMap1.EditOverlay = selectVerticesEditInteractiveOverlay;

            winformsMap1.Refresh();
        }
Example #9
0
        private void TestForm_Load(object sender, EventArgs e)
        {
            winformsMap1.MapUnit       = GeographyUnit.DecimalDegree;
            winformsMap1.CurrentExtent = new RectangleShape(-97.7591, 30.3126, -97.7317, 30.2964);
            winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 198, 255, 255));

            //Displays the World Map Kit as a background.
            ThinkGeo.MapSuite.DesktopEdition.WorldMapKitWmsDesktopOverlay worldMapKitDesktopOverlay = new ThinkGeo.MapSuite.DesktopEdition.WorldMapKitWmsDesktopOverlay();
            winformsMap1.Overlays.Add(worldMapKitDesktopOverlay);

            string       fileName1 = @"..\..\data\polygon.txt";
            StreamReader sr1       = new StreamReader(fileName1);

            string       fileName2 = @"..\..\data\line.txt";
            StreamReader sr2       = new StreamReader(fileName2);

            //DragtInteractiveOverlay for setting the PointStyles of the control points and dragged points.
            DragInteractiveOverlay dragInteractiveOverlay = new DragInteractiveOverlay();

            dragInteractiveOverlay.ReferenceShape = BaseShape.CreateShapeFromWellKnownData(sr1.ReadLine());
            dragInteractiveOverlay.EditShapesLayer.InternalFeatures.Add("MultiLine", new Feature(BaseShape.CreateShapeFromWellKnownData(sr2.ReadLine())));

            //Sets the PointStyle for the non dragged control points.
            dragInteractiveOverlay.ControlPointStyle = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.StandardColors.PaleGoldenrod), new GeoPen(GeoColor.StandardColors.Black), 8);
            //Sets the PointStyle for the dragged control points.
            dragInteractiveOverlay.DraggedControlPointStyle = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.StandardColors.Red), new GeoPen(GeoColor.StandardColors.Orange, 2), 10);

            // Add the point feature and specify text style.
            dragInteractiveOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = new TextStyle("LabelColumn", new GeoFont("Arial", 12), new GeoSolidBrush(GeoColor.SimpleColors.Black));

            dragInteractiveOverlay.CanAddVertex    = false;
            dragInteractiveOverlay.CanDrag         = false;
            dragInteractiveOverlay.CanRemoveVertex = false;
            dragInteractiveOverlay.CanResize       = false;
            dragInteractiveOverlay.CanRotate       = false;
            dragInteractiveOverlay.CalculateAllControlPoints();

            winformsMap1.EditOverlay = dragInteractiveOverlay;


            //InMemoryFeatureLayer for the geometry of the reference shape
            InMemoryFeatureLayer inMemoryFeatureLayer = new InMemoryFeatureLayer();

            inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyles.CreateSimpleAreaStyle(GeoColor.StandardColors.Red, GeoColor.StandardColors.Black);
            inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            Feature newFeature = new Feature(dragInteractiveOverlay.ReferenceShape);

            inMemoryFeatureLayer.Open();
            inMemoryFeatureLayer.EditTools.BeginTransaction();
            inMemoryFeatureLayer.EditTools.Add(newFeature);
            inMemoryFeatureLayer.EditTools.CommitTransaction();
            inMemoryFeatureLayer.Close();

            LayerOverlay referenceOverlay = new LayerOverlay();

            referenceOverlay.Layers.Add("Reference", inMemoryFeatureLayer);

            winformsMap1.Overlays.Add(referenceOverlay);

            winformsMap1.Refresh();
        }
Example #10
0
        private void TestForm_Load(object sender, EventArgs e)
        {
            winformsMap1.MapUnit       = GeographyUnit.DecimalDegree;
            winformsMap1.CurrentExtent = new RectangleShape(-97.7591, 30.3126, -97.7317, 30.2964);
            winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 198, 255, 255));

            //Displays the World Map Kit as a background.
            ThinkGeo.MapSuite.DesktopEdition.WorldMapKitWmsDesktopOverlay worldMapKitDesktopOverlay = new ThinkGeo.MapSuite.DesktopEdition.WorldMapKitWmsDesktopOverlay();
            winformsMap1.Overlays.Add(worldMapKitDesktopOverlay);

            string       fileName1 = @"..\..\data\polygon.txt";
            StreamReader sr1       = new StreamReader(fileName1);

            string       fileName2 = @"..\..\data\line.txt";
            StreamReader sr2       = new StreamReader(fileName2);

            //DragtInteractiveOverlay for setting the PointStyles of the control points and dragged points.
            DragInteractiveOverlay dragInteractiveOverlay = new DragInteractiveOverlay();

            dragInteractiveOverlay.EditShapesLayer.InternalFeatures.Add("Polygon", new Feature(BaseShape.CreateShapeFromWellKnownData(sr1.ReadLine())));
            dragInteractiveOverlay.EditShapesLayer.InternalFeatures.Add("MultiLine", new Feature(BaseShape.CreateShapeFromWellKnownData(sr2.ReadLine())));

            //Sets the PointStyle for the non dragged control points.
            dragInteractiveOverlay.ControlPointStyle = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.StandardColors.PaleGoldenrod), new GeoPen(GeoColor.StandardColors.Black), 8);
            //Sets the PointStyle for the dragged control points.
            dragInteractiveOverlay.DraggedControlPointStyle = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.StandardColors.Red), new GeoPen(GeoColor.StandardColors.Orange, 2), 10);

            dragInteractiveOverlay.CanAddVertex    = false;
            dragInteractiveOverlay.CanDrag         = false;
            dragInteractiveOverlay.CanRemoveVertex = false;
            dragInteractiveOverlay.CanResize       = false;
            dragInteractiveOverlay.CanRotate       = false;
            dragInteractiveOverlay.CalculateAllControlPoints();

            winformsMap1.EditOverlay = dragInteractiveOverlay;

            winformsMap1.Refresh();
        }