Example #1
0
        protected override Collection <Style> GetStylesCore(FeatureSource featureSource)
        {
            double totalValue = 0;

            featureSource.Open();
            int featureCount = featureSource.GetCount();

            for (int i = 0; i < featureCount; i++)
            {
                Feature feature = featureSource.GetFeatureById((i + 1).ToString(CultureInfo.InvariantCulture), SelectedColumns);
                double  columnValue;
                double.TryParse(feature.ColumnValues[SelectedColumns[0]], out columnValue);
                totalValue += columnValue;
            }
            featureSource.Close();

            CustomDotDensityStyle dotDensityStyle = new CustomDotDensityStyle();

            dotDensityStyle.ColumnName        = SelectedColumns[0];
            dotDensityStyle.PointToValueRatio = DotDensityValue / (totalValue / featureCount);
            dotDensityStyle.CustomPointStyle  = PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(Opacity, Color), 4);

            return(new Collection <Style>()
            {
                dotDensityStyle
            });
        }
Example #2
0
        private void AddEarthquakeLayers(Map Map1)
        {
            LayerOverlay earthquakeOverlay = new LayerOverlay("EarthquakeOverlay");

            //earthquakeOverlay.TileType = TileType.SingleTile;
            earthquakeOverlay.IsVisibleInOverlaySwitcher = false;
            Map1.CustomOverlays.Add(earthquakeOverlay);

            Proj4Projection proj4 = new Proj4Projection();

            proj4.InternalProjectionParametersString = Proj4Projection.GetDecimalDegreesParametersString();
            proj4.ExternalProjectionParametersString = Proj4Projection.GetSphericalMercatorParametersString();

            string dataShapefileFilePath = Server.MapPath(ConfigurationManager.AppSettings["statesPathFileName"]);

            EarthquakeHeatFeatureLayer heatLayer = new EarthquakeHeatFeatureLayer(new ShapeFileFeatureSource(dataShapefileFilePath));

            heatLayer.HeatStyle = new HeatStyle(10, 180, "MAGNITUDE", 0, 12, 100, DistanceUnit.Kilometer);
            heatLayer.FeatureSource.Projection = proj4;
            earthquakeOverlay.Layers.Add("Heat Map", heatLayer);

            ShapeFileFeatureLayer pointLayer = new ShapeFileFeatureLayer(dataShapefileFilePath);

            pointLayer.FeatureSource.Projection = proj4;
            pointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.Red, 6, GeoColor.StandardColors.White, 1);
            pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            pointLayer.IsVisible = false;
            earthquakeOverlay.Layers.Add("Regular Point Map", pointLayer);

            EarthquakeIsoLineFeatureLayer isoLineLayer = new EarthquakeIsoLineFeatureLayer(new ShapeFileFeatureSource(dataShapefileFilePath));

            isoLineLayer.FeatureSource.Projection = proj4;
            isoLineLayer.IsVisible = false;
            earthquakeOverlay.Layers.Add("IsoLines Map", isoLineLayer);
        }
        protected override void DrawCore(WinformsMap winformsMap)
        {
            LayerOverlay layerOverlay = null;

            if (!LoadingFromShapeFile)
            {
                layerOverlay = new LayerOverlay();

                foreach (Layer layer in Layers)
                {
                    layerOverlay.Layers.Add(layer);
                }
            }
            else
            {
                ShapeFileFeatureLayer.BuildIndexFile(ShapePathFileName, BuildIndexMode.DoNotRebuild);
                ShapeFileFeatureLayer shapeFileFeatureLayer = new ShapeFileFeatureLayer(ShapePathFileName);
                shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(102, 0, 0, 255), GeoColor.FromArgb(255, 0, 0, 255), 2);
                shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(102, 0, 0, 255), 2, true);
                shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(102, 0, 0, 255), 12);
                shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

                layerOverlay = new LayerOverlay();
                layerOverlay.Layers.Add(shapeFileFeatureLayer);
                layerOverlay.Layers.Add(OutputFeatureLayer);
                winformsMap.CurrentExtent = GetBoundingBox();
            }

            winformsMap.Overlays.Clear();
            winformsMap.Overlays.Add(layerOverlay);
            winformsMap.Refresh();
        }
        private void GetDynamicDistanceBetweenTwoPoints_Load(object sender, EventArgs e)
        {
            LayerOverlay baseOverlay = new LayerOverlay();
            WorldMapKitWmsDesktopOverlay worldMapKitDesktopOverlay = new WorldMapKitWmsDesktopOverlay();

            winformsMap1.Overlays.Add(worldMapKitDesktopOverlay);

            LayerOverlay lineOverlay = new LayerOverlay();

            winformsMap1.Overlays.Add("LineOverlay", lineOverlay);

            InMemoryFeatureLayer shadowLayer = new InMemoryFeatureLayer();

            shadowLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(150, GeoColor.FromHtml("#F2ABB1")), 2, LineDashStyle.Dash, true);
            shadowLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            lineOverlay.Layers.Add("Shadow", shadowLayer);

            InMemoryFeatureLayer shapeLayer = new InMemoryFeatureLayer();

            shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.FromHtml("#ED775B"), 10, GeoColor.FromHtml("#CA5B48"));
            shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = LineStyles.CreateSimpleLineStyle(GeoColor.FromHtml("#CA5B48"), 3, true);
            shapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            lineOverlay.Layers.Add("Shape", shapeLayer);

            winformsMap1.CurrentExtent = new RectangleShape(-132, 55, -70, 20);
            winformsMap1.Refresh();
        }
        public T CreateLayer()
        {
            var layer = CreateLayerCore();

            layer.Name = TableName;
            layer.AddBlankZoomLevels();
            layer.DrawingMarginInPixel = 200;
            layer.Open();
            var simpleShapeType = GetSimpleShapeType(layer);

            Styles.Style shapeStyle = null;

            switch (simpleShapeType)
            {
            case SimpleShapeType.Point:
                shapeStyle = GetDefaultStyle <PointStyle>(StyleCategories.Point);
                if (shapeStyle == null)
                {
                    shapeStyle      = PointStyles.CreateSimpleCircleStyle(RandomColor(), 6);
                    shapeStyle.Name = "Simple Style 1";
                }
                break;

            case SimpleShapeType.Line:
                shapeStyle = GetDefaultStyle <LineStyle>(StyleCategories.Line);
                if (shapeStyle == null)
                {
                    shapeStyle      = new LineStyle(new GeoPen(RandomColor(RandomColorType.Bright)));
                    shapeStyle.Name = "Simple Style 1";
                }
                break;

            case SimpleShapeType.Area:
                shapeStyle = GetDefaultStyle <AreaStyle>(StyleCategories.Area);
                if (shapeStyle == null)
                {
                    shapeStyle      = AreaStyles.CreateSimpleAreaStyle(RandomColor(), GeoColor.SimpleColors.Black);
                    shapeStyle.Name = "Simple Style 1";
                }
                break;
            }

            if (shapeStyle != null)
            {
                ZoomLevelSet zoomLevelSet = GisEditor.ActiveMap.ZoomLevelSet;
                ZoomLevel    zoomLevel    = new ZoomLevel(zoomLevelSet.ZoomLevel01.Scale);
                zoomLevel.CustomStyles.Add(shapeStyle);
                zoomLevel.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

                layer.ZoomLevelSet.CustomZoomLevels[0] = zoomLevel;
                layer.DrawingQuality = DrawingQuality.CanvasSettings;
            }
            layer.Close();

            return(layer);
        }
        public RadiusMearsureTrackInteractiveOverlay(DistanceUnit distanceUnit, GeographyUnit mapUnit)
        {
            this.mapUnit      = mapUnit;
            this.distanceUnit = distanceUnit;

            TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.DarkBlue, 8);
            TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = LineStyles.CreateSimpleLineStyle(GeoColor.SimpleColors.White, 3, true);
            TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(80, GeoColor.SimpleColors.LightGreen), GeoColor.SimpleColors.White, 2);
            TrackShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
        }
        protected TopologyTestCase(string name)
        {
            this.name          = name;
            outputFeatureLayer = new InMemoryFeatureLayer();
            outputFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyles.CreateSimpleAreaStyle(new GeoColor(180, GeoColor.StandardColors.Red), GeoColor.StandardColors.Black);
            outputFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = LineStyles.CreateSimpleLineStyle(new GeoColor(180, GeoColor.StandardColors.Red), 2, true);
            outputFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(new GeoColor(180, GeoColor.StandardColors.Red), 12);
            outputFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            layers = new Collection <InMemoryFeatureLayer>();
            layers.Add(OutputFeatureLayer);
        }
        protected OneInputLayerTopologyTestCase(string name)
            : base(name)
        {
            inputFeatureLayer = new InMemoryFeatureLayer();
            inputFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(102, 0, 0, 255), GeoColor.FromArgb(255, 0, 0, 255), 2);
            inputFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(102, 0, 0, 255), 2, true);
            inputFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(102, 0, 0, 255), 12);
            inputFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            Layers = new Collection <InMemoryFeatureLayer>();
            Layers.Add(inputFeatureLayer);
            Layers.Add(OutputFeatureLayer);
        }
Example #9
0
        private void TestForm_Load(object sender, EventArgs e)
        {
            winformsMap1.MapUnit       = GeographyUnit.DecimalDegree;
            winformsMap1.CurrentExtent = new RectangleShape(-125, 47, -67, 25);
            winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 198, 255, 255));

            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"..\..\Data\Countries02.shp");

            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyles.Country1;
            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            ShapeFileFeatureLayer capitalLayer = new ShapeFileFeatureLayer(@"..\..\Data\WorldCapitals.shp");

            // We can customize our own Style. Here we passed in a color and a size.
            capitalLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.White, 7, GeoColor.StandardColors.Brown);
            // The Style we set here is available from ZoomLevel01 to ZoomLevel05. That means if we zoom in a bit more, the appearance we set here will not be visible anymore.
            capitalLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level05;

            capitalLayer.ZoomLevelSet.ZoomLevel06.DefaultPointStyle = PointStyles.Capital3;
            // The Style we set here is available from ZoomLevel06 to ZoomLevel20. That means if we zoom out a bit more, the appearance we set here will not be visible any more.
            capitalLayer.ZoomLevelSet.ZoomLevel06.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            ShapeFileFeatureLayer capitalLabelLayer = new ShapeFileFeatureLayer(@"..\..\Data\WorldCapitals.shp");

            // We can customize our own TextStyle. Here we passed in the font, the size, the style and the color.
            capitalLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("CITY_NAME", "Arial", 8, DrawingFontStyles.Italic, GeoColor.StandardColors.Black, 3, 3);
            // The TextStyle we set here is available from ZoomLevel01 to ZoomLevel05.
            capitalLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level05;

            capitalLabelLayer.ZoomLevelSet.ZoomLevel06.DefaultTextStyle = TextStyles.Capital3("CITY_NAME");
            // The TextStyle we set here is available from ZoomLevel06 to ZoomLevel20.
            capitalLabelLayer.ZoomLevelSet.ZoomLevel06.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            // As the map is drawn by tiles, it needs to draw on the margin to make sure the text is complete after the tiles are joined together.
            // Change the number to another one (for example 0) and you can see the difference expecially when panning.
            capitalLabelLayer.DrawingMarginPercentage = 50;

            LayerOverlay layerOverlay = new LayerOverlay();

            layerOverlay.Layers.Add(worldLayer);
            layerOverlay.Layers.Add(capitalLayer);
            layerOverlay.Layers.Add(capitalLabelLayer);

            //Sets the zoom snapping mode to snap up.
            winformsMap1.ZoomLevelSnapping = ZoomLevelSnappingMode.SnapUp;
            //Sets the tilecache when in Snap Up mode for zoom snapping.
            layerOverlay.TileCache = fileBitmapTileCache;

            winformsMap1.Overlays.Add(layerOverlay);

            winformsMap1.Refresh();
        }
        protected override Style GetDefaultStyleCore()
        {
            int        alpha = 255;
            PointStyle style = StyleCandidates.OfType <PointStyle>().FirstOrDefault();

            if (style != null)
            {
                alpha = style.SymbolSolidBrush.Color.AlphaComponent;
            }
            var fillColor    = new GeoColor(alpha, GeoColorHelper.GetRandomColor());
            var outlineColor = new GeoColor(alpha, GeoColor.StandardColors.Black);

            return(PointStyles.CreateSimpleCircleStyle(fillColor, 8, outlineColor));
        }
Example #11
0
        public LinesMustBeLargerThanClusterToleranceTopologyTestCase(string name)
            : base(name)
        {
            TestCaseInputType = TestCaseInputType.Line;
            InputFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle   = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(70, 0, 0, 255), 2, true);
            InputFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle   = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(20, 0, 0, 255), GeoColor.FromArgb(255, 0, 0, 255), 2);
            OutputFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle  = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(200, GeoColor.StandardColors.Green), 2, true);
            OutputFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle  = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(102, 0, 0, 255), GeoColor.FromArgb(255, 0, 0, 255), 2);
            OutputFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.Transparent, 10);

            assistantLayer = new InMemoryFeatureLayer();
            assistantLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(20, 255, 255, 255), GeoColor.FromArgb(70, 0, 0, 0));
            assistantLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimplePointStyle(PointSymbolType.Circle, GeoColor.SimpleColors.Red, 5);
            assistantLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            this.Layers.Add(assistantLayer);
        }
Example #12
0
    private void radioButtonStandardStyle_CheckedChanged(object sender, EventArgs e)
    {
        CadFeatureLayer layer = ((CadFeatureLayer)layerOverlay.Layers[0]);

        if (radioButtonStandardStyle.Checked)
        {
            layer.StylingType = CadStylingType.StandardStyling;
            layer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.Black, 1F, false);
            layer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.White, 3.2F, GeoColor.StandardColors.Black, 1F);
            layer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 233, 232, 214), GeoColor.FromArgb(255, 118, 138, 69));
            layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
        }
        else
        {
            layer.StylingType = CadStylingType.EmbeddedStyling;
        }
        winformsMap1.Refresh();
    }
        private void SetDefaultStyle()
        {
            var defaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(102, 0, 0, 255), 10, GeoColor.FromArgb(100, 0, 0, 255), 2);
            var defaultLineStyle  = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(100, 0, 0, 255), 2, true);
            var defaultAreaStyle  = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(102, GeoColor.FromHtml("#EFFBD6")), GeoColor.FromArgb(255, 0, 0, 255), 2);

            editShapesLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = defaultPointStyle;
            editShapesLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = defaultLineStyle;
            editShapesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = defaultAreaStyle;
            editShapesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            ValueStyle valueStyle = new ValueStyle();

            valueStyle.ColumnName = existingFeatureColumnName;
            valueStyle.ValueItems.Add(new ValueItem(string.Empty, PointStyles.CreateSimpleSquareStyle(GeoColor.StandardColors.White, 8, GeoColor.StandardColors.Black)));
            valueStyle.ValueItems.Add(new ValueItem(existingFeatureColumnValue, PointStyles.CreateSimpleSquareStyle(GeoColor.StandardColors.Orange, 8, GeoColor.StandardColors.Black)));

            reshapeControlPointsLayer.Open();
            reshapeControlPointsLayer.Columns.Add(new FeatureSourceColumn(existingFeatureColumnName));
            reshapeControlPointsLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(valueStyle);
            reshapeControlPointsLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            associateControlPointsLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = new PointStyle(GetGeoImageFromResource("/ThinkGeo.MapSuite.WpfDesktop.Extension;component/Resources/resize.png"));
            associateControlPointsLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            snappingPointsLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(new PeakStyle());
            snappingPointsLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            snappingToleranceLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            snappingToleranceLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = new AreaStyle(new GeoPen(GeoColor.SimpleColors.Black, 1));

            var unselectedPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.LightGray, 10, GeoColor.StandardColors.LightGray, 2);
            var unselectedLineStyle  = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.LightGray, 3, true);
            var unselectedAreaStyle  = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(0, GeoColor.FromHtml("#EFFBD6")), GeoColor.StandardColors.LightGray, 3);

            editCandidatesLayer.Open();
            editCandidatesLayer.Columns.Add(new FeatureSourceColumn(existingFeatureColumnName));
            editCandidatesLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(unselectedAreaStyle);
            editCandidatesLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(unselectedLineStyle);
            editCandidatesLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(unselectedPointStyle);
            editCandidatesLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(valueStyle);
            editCandidatesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
        }
        public RadiusMearsureTrackInteractiveOverlay(DistanceUnit distanceUnit, GeographyUnit mapUnit)
        {
            DistanceUnit = distanceUnit;
            MapUnit      = mapUnit;

            textBlock            = new TextBlock();
            textBlock.Visibility = Visibility.Collapsed;
            OverlayCanvas.Children.Add(textBlock);

            PolygonTrackMode = PolygonTrackMode.LineWithFill;
            RenderMode       = RenderMode.DrawingVisual;

            areaStyle  = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(80, GeoColor.SimpleColors.LightGreen), GeoColor.SimpleColors.White, 2);
            pointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.DarkBlue, 8);
            lineStyle  = LineStyles.CreateSimpleLineStyle(GeoColor.SimpleColors.White, 3, true);

            SetStylesForInMemoryFeatureLayer(TrackShapeLayer);
            SetStylesForInMemoryFeatureLayer(TrackShapesInProcessLayer);
        }
Example #15
0
        private void AddQueryResultLayers(Map Map1)
        {
            // define the track layer.
            LayerOverlay trackResultOverlay = new LayerOverlay("TrackShapeOverlay");

            trackResultOverlay.IsVisibleInOverlaySwitcher = false;
            trackResultOverlay.TileType = TileType.SingleTile;
            Map1.CustomOverlays.Add(trackResultOverlay);

            InMemoryFeatureLayer trackResultLayer = new InMemoryFeatureLayer();

            trackResultLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(80, GeoColor.SimpleColors.LightGreen), GeoColor.SimpleColors.White, 2);
            trackResultLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = LineStyles.CreateSimpleLineStyle(GeoColor.SimpleColors.Orange, 2, true);
            trackResultLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.Orange, 10);
            trackResultLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            trackResultOverlay.Layers.Add("TrackShapeLayer", trackResultLayer);

            // define the marker and highlight layer for markers.
            LayerOverlay queryResultMarkerOverlay = new LayerOverlay("QueryResultMarkerOverlay");

            queryResultMarkerOverlay.IsBaseOverlay = false;
            queryResultMarkerOverlay.IsVisibleInOverlaySwitcher = false;
            queryResultMarkerOverlay.TileType = TileType.SingleTile;
            Map1.CustomOverlays.Add(queryResultMarkerOverlay);

            InMemoryFeatureLayer markerMemoryLayer = new InMemoryFeatureLayer();

            markerMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.Gold, 8, GeoColor.SimpleColors.Orange, 1);
            markerMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            queryResultMarkerOverlay.Layers.Add("MarkerMemoryLayer", markerMemoryLayer);

            InMemoryFeatureLayer markerMemoryHighLightLayer = new InMemoryFeatureLayer();
            PointStyle           highLightStyle             = new PointStyle();

            highLightStyle.CustomPointStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(50, GeoColor.SimpleColors.Blue), 20, GeoColor.SimpleColors.LightBlue, 1));
            highLightStyle.CustomPointStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.LightBlue, 9, GeoColor.SimpleColors.Blue, 1));
            markerMemoryHighLightLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = highLightStyle;
            markerMemoryHighLightLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            queryResultMarkerOverlay.Layers.Add("MarkerMemoryHighLightLayer", markerMemoryHighLightLayer);
        }
Example #16
0
        private void MDIParent1_Load(object sender, EventArgs e)
        {
            winformsMap1.MapUnit       = GeographyUnit.DecimalDegree;
            winformsMap1.CurrentExtent = new RectangleShape(-125, 47, -67, 25);
            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);

            InMemoryFeatureLayer inMemoryFeatureLayer = new InMemoryFeatureLayer();

            inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.Red, 12, GeoColor.StandardColors.Black, 2);
            inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            LayerOverlay layerOverlay = new LayerOverlay();

            layerOverlay.Layers.Add("Point", inMemoryFeatureLayer);
            winformsMap1.Overlays.Add("PointOverlay", layerOverlay);

            winformsMap1.Refresh();
        }
        protected override void InitializeMap()
        {
            MapView.CurrentExtent = new RectangleShape(-14299615, 20037508, -7255178, -1015546);

            ShapeFileFeatureLayer usLayer      = new ShapeFileFeatureLayer(SampleHelper.GetDataPath("usStatesCensus2010.shp"));
            LayerOverlay          layerOverlay = new LayerOverlay();

            layerOverlay.Layers.Add(usLayer);
            MapView.Overlays.Add(layerOverlay);

            usLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Clear();
            usLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(new AreaStyle(new GeoPen(new GeoSolidBrush(GeoColor.SimpleColors.Black))));
            //TODO: check this
            double          pointToValueRatio = 0.0000094778167166538189;
            PointStyle      pointStyle        = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.Black, 7);
            DotDensityStyle dotDensityStyle   = new DotDensityStyle("Population", pointToValueRatio, pointStyle);

            dotDensityStyle.CustomPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.FromHtml("#a57431"), 5);

            usLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(dotDensityStyle);
            usLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
        }
Example #18
0
        /// <summary>
        /// Gets an overlay applied with DotDensity style.
        /// </summary>
        public static LayerOverlay GetOverlayWithDotDensityStyle()
        {
            // Get the file path name from its relative path.
            string shpFilePathName = GetFullPath("App_Data/usStatesCensus2010.shp");

            ShapeFileFeatureLayer shapeFileFeatureLayer = new ShapeFileFeatureLayer(shpFilePathName);

            shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(20, GeoColor.FromHtml("#00e6fe")), GeoColor.StandardColors.Gray));
            // Create the DotDensityStyle
            DotDensityStyle dotDensityStyle = new DotDensityStyle("Population", 0.0000094778167166538189, PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.Black, 7));

            dotDensityStyle.CustomPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.FromHtml("#a57431"), 5);
            shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(dotDensityStyle);
            shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Apply projection to the shape file which is used for display.
            shapeFileFeatureLayer.FeatureSource.Projection = GetProjection();

            LayerOverlay layerOverlay = new LayerOverlay();

            layerOverlay.Layers.Add(shapeFileFeatureLayer);
            return(layerOverlay);
        }
Example #19
0
        private InMemoryFeatureLayer GetWellDepthPointLayer()
        {
            //Create an in memory layer to hold the well data from the text file
            InMemoryFeatureLayer inMemoryFeatureLayer = new InMemoryFeatureLayer();

            inMemoryFeatureLayer.FeatureSource.Open();
            //Make sure to specify the depth column
            inMemoryFeatureLayer.Columns.Add(new FeatureSourceColumn("Depth", "String", 10));

            //Loop through all the point data and add it to the in memory layer
            foreach (KeyValuePair <PointShape, double> wellDepth in wellDepthPointData)
            {
                Feature feature = new Feature(wellDepth.Key);
                feature.ColumnValues.Add("Depth", wellDepth.Value.ToString());
                inMemoryFeatureLayer.InternalFeatures.Add(feature);
            }
            //Now that all of the data is added we can build an in memory index to make the lookups fast
            inMemoryFeatureLayer.BuildIndex();

            //Create the well point style
            PointStyle pointStyle1 = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.White, 4, GeoColor.SimpleColors.Black, 2);

            inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(pointStyle1);

            //Create the text style with a halo
            TextStyle textStyle = TextStyles.CreateSimpleTextStyle("Depth", "Arial", 10, DrawingFontStyles.Regular, GeoColor.SimpleColors.Black);

            textStyle.HaloPen        = new GeoPen(GeoColor.StandardColors.White, 3);
            textStyle.PointPlacement = PointPlacement.UpperCenter;
            textStyle.YOffsetInPixel = 5;

            //Apply these styles at all levels and add then to the custom styles for the layer
            inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(textStyle);

            return(inMemoryFeatureLayer);
        }
Example #20
0
        private static void SetStyle(InMemoryFeatureLayer layer)
        {
            PointStyle pointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(100, GeoColor.StandardColors.White), 12, GeoColor.FromArgb(200, GeoColor.StandardColors.Black), 1);

            LineStyle lineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(255, 0, 0, 255), 2, true);

            lineStyle.OuterPen.LineJoin  = DrawingLineJoin.Round;
            lineStyle.InnerPen.LineJoin  = DrawingLineJoin.Round;
            lineStyle.CenterPen.LineJoin = DrawingLineJoin.Round;

            AreaStyle areaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(102, 0, 0, 255), GeoColor.FromArgb(255, 0, 0, 255), 2);

            areaStyle.OutlinePen.LineJoin = DrawingLineJoin.Round;

            layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            layer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = null;
            layer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = null;
            layer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = null;
            layer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle    = null;

            layer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(pointStyle);
            layer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(lineStyle);
            layer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(areaStyle);
        }
Example #21
0
        private void TestForm_Load(object sender, EventArgs e)
        {
            winformsMap1.MapUnit       = GeographyUnit.DecimalDegree;
            winformsMap1.CurrentExtent = new RectangleShape(-95.2982, 38.9632, -95.2843, 38.955);
            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);

            //InMemoryFeatureLayer for the two reference points en red.
            InMemoryFeatureLayer pointLayer = new InMemoryFeatureLayer();

            pointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.Red, 12, GeoColor.StandardColors.Black);
            pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            Feature feature1 = new Feature(new PointShape(-95.2949, 38.957));
            Feature feature2 = new Feature(new PointShape(-95.2883, 38.957));

            pointLayer.InternalFeatures.Add(feature1);
            pointLayer.InternalFeatures.Add(feature2);

            LayerOverlay pointOverlay = new LayerOverlay();

            pointOverlay.Layers.Add("PointLayer", pointLayer);
            winformsMap1.Overlays.Add("PointOverlay", pointOverlay);

            //--------------------------------------------------
            //Collection of PointShapes for the GPS locations.
            GPSlocations.Add(new PointShape(-95.2946, 38.9602));
            GPSlocations.Add(new PointShape(-95.2928, 38.9602));
            GPSlocations.Add(new PointShape(-95.2903, 38.9602));
            GPSlocations.Add(new PointShape(-95.2883, 38.9602));
            GPSlocations.Add(new PointShape(-95.2883, 38.9587));
            GPSlocations.Add(new PointShape(-95.2883, 38.957));
            GPSlocations.Add(new PointShape(-95.2897, 38.957));
            GPSlocations.Add(new PointShape(-95.2918, 38.957));
            GPSlocations.Add(new PointShape(-95.2934, 38.957));
            GPSlocations.Add(new PointShape(-95.2947, 38.957));
            GPSlocations.Add(new PointShape(-95.2946, 38.9582));
            GPSlocations.Add(new PointShape(-95.2946, 38.9593));

            InMemoryFeatureLayer vehicleLayer = new InMemoryFeatureLayer();

            vehicleLayer.Open();
            vehicleLayer.Columns.Add(new FeatureSourceColumn("DETECT", "string", 3));
            vehicleLayer.Close();

            // Draw features based on values
            ValueStyle valueStyle = new ValueStyle();

            valueStyle.ColumnName = "DETECT";
            valueStyle.ValueItems.Add(new ValueItem("No", new PointStyle(new GeoImage(@"..\..\Data\Top.png"))));
            valueStyle.ValueItems.Add(new ValueItem("yes", new PointStyle(new GeoImage(@"..\..\Data\Top2.png"))));
            vehicleLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(valueStyle);
            vehicleLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            Feature GPSfeature = new Feature(GPSlocations[0]);

            GPSfeature.ColumnValues.Add("DETECT", "No");
            vehicleLayer.InternalFeatures.Add("GPSFeature1", GPSfeature);

            LayerOverlay vehicleOverlay = new LayerOverlay();

            vehicleOverlay.Layers.Add("VehicleLayer", vehicleLayer);
            winformsMap1.Overlays.Add("VehicleOverlay", vehicleOverlay);

            //Sets timer properties
            timer.Interval = 1500;
            timer.Tick    += new EventHandler(timer_Tick);

            winformsMap1.Refresh();

            timer.Start();
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            wpfMap1.MapUnit    = GeographyUnit.DecimalDegree;
            wpfMap1.Background = new SolidColorBrush(Color.FromRgb(148, 196, 243));

            // Add background map.
            WorldStreetsAndImageryOverlay worldMapKitWmsWpfOverlay = new WorldStreetsAndImageryOverlay();

            worldMapKitWmsWpfOverlay.MapType = WorldStreetsAndImageryMapType.AerialWithLabels;
            wpfMap1.Overlays.Add(worldMapKitWmsWpfOverlay);

            // Add gradeline layer.
            InMemoryFeatureLayer gradeLineLayer = new InMemoryFeatureLayer();

            gradeLineLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = LineStyles.CreateSimpleLineStyle(GeoColor.FromHtml("#b5e858"), 3, true);
            gradeLineLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            gradeLineLayer.DrawingQuality = DrawingQuality.HighQuality;

            // Add start and end point layer.
            InMemoryFeatureLayer pointFeatureLayer = new InMemoryFeatureLayer();

            pointFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColors.Black, 7, GeoColors.White);
            pointFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            pointFeatureLayer.DrawingQuality = DrawingQuality.HighQuality;

            // Add a broundary where the elevation data is only available inside.
            InMemoryFeatureLayer validBoundaryFeatureLayer = new InMemoryFeatureLayer();

            validBoundaryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyles.CreateSimpleAreaStyle(GeoColors.Transparent, GeoColors.Yellow, 2);
            validBoundaryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            validBoundaryFeatureLayer.DrawingQuality = DrawingQuality.HighQuality;
            validBoundaryFeatureLayer.InternalFeatures.Add(new Feature(new RectangleShape(new PointShape(-117.202814102173, 36.2726317596435), new PointShape(-117.003686904907, 36.1064635467529))));

            // waypoint hover marker
            SimpleMarkerOverlay markerOverlay = new SimpleMarkerOverlay();

            waypointMarker = new Marker()
            {
                ImageSource = new BitmapImage(new Uri("/Images/waypoint.png", UriKind.RelativeOrAbsolute)),
                YOffset     = -16
            };
            markerOverlay.Markers.Add(waypointMarker);
            wpfMap1.Overlays.Add("MarkerOverlay", markerOverlay);

            LayerOverlay elevationLayerOverlay = new LayerOverlay();

            elevationLayerOverlay.Layers.Add("elevationLayer", gradeLineLayer);
            elevationLayerOverlay.Layers.Add("pointFeatureLayer", pointFeatureLayer);
            wpfMap1.Overlays.Add("elevationLayerOverlay", elevationLayerOverlay);

            LayerOverlay rectangleLayerOverlay = new LayerOverlay();

            rectangleLayerOverlay.Layers.Add("rectangleLayer", validBoundaryFeatureLayer);
            wpfMap1.Overlays.Add("rectangleLayerOverlay", rectangleLayerOverlay);

            // Load first load data
            Initialization();

            wpfMap1.CurrentExtent = new RectangleShape(-117.178438186645, 36.2224208068847, -117.005403518676, 36.1278353881836);
            wpfMap1.Refresh();
        }
Example #23
0
        private void InitializeAndroidMap()
        {
            string          baseFolder        = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath;
            string          cachePathFilename = Path.Combine(baseFolder, "MapSuiteTileCaches/SampleCaches.db");
            Proj4Projection proj4             = Global.GetWgs84ToMercatorProjection();

            // WMK
            WorldMapKitOverlay wmkOverlay = new WorldMapKitOverlay();

            wmkOverlay.Projection = ThinkGeo.MapSuite.Android.WorldMapKitProjection.SphericalMercator;

            // OSM
            OpenStreetMapOverlay osmOverlay = new OpenStreetMapOverlay();

            osmOverlay.TileCache = new SqliteBitmapTileCache(cachePathFilename, "OSMSphericalMercator");
            osmOverlay.IsVisible = false;

            // Bing - Aerial
            BingMapsOverlay bingMapsAerialOverlay = new BingMapsOverlay();

            bingMapsAerialOverlay.IsVisible = false;
            bingMapsAerialOverlay.MapType   = ThinkGeo.MapSuite.Android.BingMapsMapType.AerialWithLabels;
            bingMapsAerialOverlay.TileCache = new SqliteBitmapTileCache(cachePathFilename, "BingAerialWithLabels");

            // Bing - Road
            BingMapsOverlay bingMapsRoadOverlay = new BingMapsOverlay();

            bingMapsRoadOverlay.IsVisible = false;
            bingMapsRoadOverlay.MapType   = ThinkGeo.MapSuite.Android.BingMapsMapType.Road;
            bingMapsRoadOverlay.TileCache = new SqliteBitmapTileCache(cachePathFilename, "BingRoad");

            // Earthquake points
            earthquakePointLayer = new ShapeFileFeatureLayer(SampleHelper.GetDataPath("usEarthquake.shp"));
            earthquakePointLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.Red, 5, GeoColor.SimpleColors.White, 1));
            earthquakePointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            earthquakePointLayer.FeatureSource.Projection = proj4;

            ShapeFileFeatureSource earthquakeHeatFeatureSource = new ShapeFileFeatureSource(SampleHelper.GetDataPath("usEarthquake_Simplify.shp"));

            earthquakeHeatFeatureSource.Projection = proj4;

            earthquakeHeatLayer                 = new HeatLayer(earthquakeHeatFeatureSource);
            earthquakeHeatLayer.HeatStyle       = new HeatStyle(10, 75, DistanceUnit.Kilometer);
            earthquakeHeatLayer.HeatStyle.Alpha = 180;
            earthquakeHeatLayer.IsVisible       = false;

            earthquakeOverlay = new LayerOverlay();
            earthquakeOverlay.Layers.Add(Global.EarthquakePointLayerKey, earthquakePointLayer);
            earthquakeOverlay.Layers.Add(Global.EarthquakeHeatLayerKey, earthquakeHeatLayer);

            // Highlighted points
            selectedMarkerLayer = new InMemoryFeatureLayer();
            selectedMarkerLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.Orange, 8, GeoColor.SimpleColors.White, 2);
            selectedMarkerLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            PointStyle highLightMarkerStyle = new PointStyle();

            highLightMarkerStyle.CustomPointStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(50, GeoColor.SimpleColors.Blue), 20, GeoColor.SimpleColors.LightBlue, 1));
            highLightMarkerStyle.CustomPointStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(255, 0, 122, 255), 10, GeoColor.SimpleColors.White, 2));

            highlightMarkerLayer = new InMemoryFeatureLayer();
            highlightMarkerLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = highLightMarkerStyle;
            highlightMarkerLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            highlightOverlay = new LayerOverlay();
            highlightOverlay.Layers.Add(Global.SelectMarkerLayerKey, selectedMarkerLayer);
            highlightOverlay.Layers.Add(Global.HighlightMarkerLayerKey, highlightMarkerLayer);

            // Maps
            Global.MapView         = FindViewById <MapView>(Resource.Id.androidMap);
            Global.MapView.MapUnit = GeographyUnit.Meter;
            Global.MapView.MapTools.ZoomMapTool.Visibility = ViewStates.Invisible;
            Global.MapView.ZoomLevelSet  = new ZoomLevelSet();
            Global.MapView.CurrentExtent = new RectangleShape(-19062735.6816748, 9273256.52450252, -5746827.16371793, 2673516.56066139);
            Global.MapView.SetBackgroundColor(new Android.Graphics.Color(255, 244, 242, 238));

            Global.MapView.Overlays.Add(Global.WorldMapKitOverlayKey, wmkOverlay);
            Global.MapView.Overlays.Add(Global.OpenStreetMapOverlayKey, osmOverlay);
            Global.MapView.Overlays.Add(Global.BingMapsAerialOverlayKey, bingMapsAerialOverlay);
            Global.MapView.Overlays.Add(Global.BingMapsRoadOverlayKey, bingMapsRoadOverlay);
            Global.MapView.Overlays.Add(Global.EarthquakeOverlayKey, earthquakeOverlay);
            Global.MapView.Overlays.Add(Global.HighlightOverlayKey, highlightOverlay);

            Global.MapView.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Clear();
            Global.MapView.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(80, GeoColor.SimpleColors.LightGreen), 8);
            Global.MapView.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle  = LineStyles.CreateSimpleLineStyle(GeoColor.SimpleColors.White, 3, true);
            Global.MapView.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle  = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(80, GeoColor.SimpleColors.LightGreen), GeoColor.SimpleColors.White, 2);
            Global.MapView.TrackOverlay.TrackEnded += TrackOverlay_TrackEnded;
        }
Example #24
0
        private void Map1_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit = GeographyUnit.DecimalDegree;

            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"../../Data/Countries02.shp");
            AreaStyle             areaStyle  = new AreaStyle();

            areaStyle.FillSolidBrush       = new GeoSolidBrush(GeoColor.FromArgb(255, 233, 232, 214));
            areaStyle.OutlinePen           = new GeoPen(GeoColor.FromArgb(255, 118, 138, 69), 1);
            areaStyle.OutlinePen.DashStyle = LineDashStyle.Solid;

            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = areaStyle;
            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            PointStyle pointStyle = new PointStyle();

            pointStyle.SymbolType       = PointSymbolType.Square;
            pointStyle.SymbolSolidBrush = new GeoSolidBrush(GeoColor.StandardColors.White);
            pointStyle.SymbolPen        = new GeoPen(GeoColor.StandardColors.Black, 1);
            pointStyle.SymbolSize       = 6;

            PointStyle stackStyle = new PointStyle();

            stackStyle.SymbolType       = PointSymbolType.Square;
            stackStyle.SymbolSolidBrush = new GeoSolidBrush(GeoColor.StandardColors.Maroon);
            stackStyle.SymbolPen        = new GeoPen(GeoColor.StandardColors.Transparent, 0);
            stackStyle.SymbolSize       = 2;

            pointStyle.CustomPointStyles.Add(stackStyle);
            ShapeFileFeatureLayer capitalLayer = new ShapeFileFeatureLayer(@"../../Data/WorldCapitals.shp");

            // We can customize our own Style. Here we passed in a color and a size.
            capitalLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.White, 7, GeoColor.StandardColors.Brown);
            // The Style we set here is available from ZoomLevel01 to ZoomLevel05. That means if we zoom in a bit more, the appearance we set here will not be visible anymore.
            capitalLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;


            capitalLayer.ZoomLevelSet.ZoomLevel06.DefaultPointStyle = pointStyle;
            // The Style we set here is available from ZoomLevel06 to ZoomLevel20. That means if we zoom out a bit more, the appearance we set here will not be visible any more.
            capitalLayer.ZoomLevelSet.ZoomLevel06.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            ShapeFileFeatureLayer capitalLabelLayer = new ShapeFileFeatureLayer(@"../../Data/WorldCapitals.shp");
            // We can customize our own TextStyle. Here we passed in the font, the size, the style and the color.
            GeoFont       font      = new GeoFont("Arial", 9, DrawingFontStyles.Bold);
            GeoSolidBrush txtBrush  = new GeoSolidBrush(GeoColor.StandardColors.Maroon);
            TextStyle     textStyle = new TextStyle("CITY_NAME", font, txtBrush);

            textStyle.XOffsetInPixel = 0;
            textStyle.YOffsetInPixel = -6;
            capitalLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("CITY_NAME", "Arial", 8, DrawingFontStyles.Italic, GeoColor.StandardColors.Black, 3, 3);
            // The TextStyle we set here is available from ZoomLevel01 to ZoomLevel05.
            capitalLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level05;

            capitalLabelLayer.ZoomLevelSet.ZoomLevel06.DefaultTextStyle = textStyle;
            // The TextStyle we set here is available from ZoomLevel06 to ZoomLevel20.
            capitalLabelLayer.ZoomLevelSet.ZoomLevel06.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            LayerOverlay layerOverlay = new LayerOverlay();

            layerOverlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean)));
            layerOverlay.Layers.Add(worldLayer);
            layerOverlay.Layers.Add(capitalLayer);
            layerOverlay.Layers.Add(capitalLabelLayer);

            Map1.Overlays.Add(layerOverlay);
            Map1.CurrentExtent = new RectangleShape(-136.60, 60.06, -53.81, 11.63);
            Map1.Refresh();
        }
        private void InitializeOverlays()
        {
            string cacheFolder = Path.Combine(Path.GetTempPath(), "TileCache");

            WorldMapKitWmsDesktopOverlay worldMapKitRoadOverlay = new WorldMapKitWmsDesktopOverlay();

            worldMapKitRoadOverlay.Name       = Resources.WorldMapKitRoadOverlay;
            worldMapKitRoadOverlay.Projection = WorldMapKitProjection.SphericalMercator;
            worldMapKitRoadOverlay.IsVisible  = true;
            worldMapKitRoadOverlay.TileCache  = new FileBitmapTileCache(cacheFolder, Resources.WorldMapKitRoadOverlay);
            worldMapKitRoadOverlay.MapType    = WorldMapKitMapType.Road;
            map.Overlays.Add(Resources.WorldMapKitRoadOverlay, worldMapKitRoadOverlay);

            WorldMapKitWmsDesktopOverlay worldMapKitAerialOverlay = new WorldMapKitWmsDesktopOverlay();

            worldMapKitAerialOverlay.Name       = Resources.WorldMapKitAerialOverlay;
            worldMapKitAerialOverlay.Projection = WorldMapKitProjection.SphericalMercator;
            worldMapKitAerialOverlay.IsVisible  = false;
            worldMapKitAerialOverlay.TileCache  = new FileBitmapTileCache(cacheFolder, Resources.WorldMapKitAerialOverlay);
            worldMapKitAerialOverlay.MapType    = WorldMapKitMapType.Aerial;
            map.Overlays.Add(Resources.WorldMapKitAerialOverlay, worldMapKitAerialOverlay);

            WorldMapKitWmsDesktopOverlay worldMapKitAerialWithLabelsOverlay = new WorldMapKitWmsDesktopOverlay();

            worldMapKitAerialWithLabelsOverlay.Name       = Resources.WorldMapKitAerialWithLabelsOverlay;
            worldMapKitAerialWithLabelsOverlay.Projection = WorldMapKitProjection.SphericalMercator;
            worldMapKitAerialWithLabelsOverlay.IsVisible  = false;
            worldMapKitAerialWithLabelsOverlay.TileCache  = new FileBitmapTileCache(cacheFolder, Resources.WorldMapKitAerialWithLabelsOverlay);
            worldMapKitAerialWithLabelsOverlay.MapType    = WorldMapKitMapType.AerialWithLabels;
            map.Overlays.Add(Resources.WorldMapKitAerialWithLabelsOverlay, worldMapKitAerialWithLabelsOverlay);

            OpenStreetMapOverlay openStreetMapOverlay = new OpenStreetMapOverlay();

            openStreetMapOverlay.Name      = Resources.OSMOverlayName;
            openStreetMapOverlay.IsVisible = false;
            openStreetMapOverlay.TileCache = new FileBitmapTileCache(cacheFolder, Resources.OpenStreetMapKey);
            map.Overlays.Add(Resources.OpenStreetMapKey, openStreetMapOverlay);

            BingMapsOverlay bingMapsAerialOverlay = new BingMapsOverlay();

            bingMapsAerialOverlay.Name      = Resources.BingMapsAerialOverlayName;
            bingMapsAerialOverlay.MapType   = WinForms.BingMapsMapType.Aerial;
            bingMapsAerialOverlay.IsVisible = false;
            bingMapsAerialOverlay.TileCache = new FileBitmapTileCache(cacheFolder, Resources.BingMapsAerial);
            map.Overlays.Add(Resources.BingMapsAerial, bingMapsAerialOverlay);

            BingMapsOverlay bingMapsRoadOverlay = new BingMapsOverlay();

            bingMapsRoadOverlay.Name      = Resources.BingMapsRoadOverlayName;
            bingMapsRoadOverlay.MapType   = WinForms.BingMapsMapType.Road;
            bingMapsRoadOverlay.IsVisible = false;
            bingMapsRoadOverlay.TileCache = new FileBitmapTileCache(cacheFolder, Resources.BingMapsRoad);
            map.Overlays.Add(Resources.BingMapsRoad, bingMapsRoadOverlay);

            LayerOverlay styleLayersOverLay = new LayerOverlay();

            map.Overlays.Add(Resources.StyleLayerOverLayKey, styleLayersOverLay);

            Proj4Projection wgs84ToMercatorProjection = new Proj4Projection();

            wgs84ToMercatorProjection.InternalProjectionParametersString = Proj4Projection.GetDecimalDegreesParametersString();
            wgs84ToMercatorProjection.ExternalProjectionParametersString = Proj4Projection.GetSphericalMercatorParametersString();

            EarthquakeHeatFeatureLayer heatLayer = new EarthquakeHeatFeatureLayer(new ShapeFileFeatureSource(ConfigurationManager.AppSettings["DataShapefileFileName"]));

            heatLayer.IsVisible = false;
            heatLayer.HeatStyle = new HeatStyle(10, 100, Resources.MagnitudeColumnName, 0, 12, 100, DistanceUnit.Kilometer);
            heatLayer.FeatureSource.Projection = wgs84ToMercatorProjection;
            heatLayer.Name = Resources.HeatStyleLayerName;
            styleLayersOverLay.Layers.Add(heatLayer);

            ShapeFileFeatureLayer pointLayer = new ShapeFileFeatureLayer(ConfigurationManager.AppSettings["DataShapefileFileName"]);

            pointLayer.IsVisible = false;
            pointLayer.FeatureSource.Projection = wgs84ToMercatorProjection;
            pointLayer.Name = Resources.PointStyleLayerName;
            pointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.Red, 6, GeoColor.StandardColors.White, 1);
            pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            styleLayersOverLay.Layers.Add(pointLayer);

            FeatureSource isoLineFeatureSource         = new ShapeFileFeatureSource(ConfigurationManager.AppSettings["DataShapefileFileName"]);
            EarthquakeIsoLineFeatureLayer isoLineLayer = new EarthquakeIsoLineFeatureLayer(isoLineFeatureSource);

            isoLineLayer.IsVisible = false;
            isoLineLayer.FeatureSource.Projection = wgs84ToMercatorProjection;
            isoLineLayer.Name = Resources.IsolineStyleLayerName;
            styleLayersOverLay.Layers.Add(isoLineLayer);

            LayerOverlay queryResultMarkerOverlay = new LayerOverlay();

            map.Overlays.Add("QueryResultMarkerOverlay", queryResultMarkerOverlay);

            PointStyle highlightStyle = new PointStyle();

            highlightStyle.CustomPointStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(50, GeoColor.SimpleColors.Blue), 20, GeoColor.SimpleColors.LightBlue, 1));
            highlightStyle.CustomPointStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.LightBlue, 9, GeoColor.SimpleColors.Blue, 1));

            markerMemoryLayer = new InMemoryFeatureLayer();
            markerMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.Orange, 8, GeoColor.SimpleColors.White, 1);
            markerMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            queryResultMarkerOverlay.Layers.Add(markerMemoryLayer);

            markerMemoryHighlightLayer = new InMemoryFeatureLayer();
            markerMemoryHighlightLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = highlightStyle;
            markerMemoryHighlightLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            queryResultMarkerOverlay.Layers.Add(markerMemoryHighlightLayer);
        }
Example #26
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            // WorldMapKitOverlay worldOverlay = new WorldMapKitOverlay();
            androidMap = FindViewById <MapView>(Resource.Id.androidmap);
            androidMap.TrackOverlay.VertexAdded += (sender, e) => { endVertex = e.AddedVertex; };
            androidMap.MapUnit = GeographyUnit.Meter;

            ShapeFileFeatureLayer shapeFileFeatureLayer = new ShapeFileFeatureLayer(System.IO.Path.Combine(Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryDownloads).ToString(), "cadastral.shp"));

            shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(
                GeoColor.FromArgb(100, GeoColor.StandardColors.White), GeoColor.StandardColors.Green);
            shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle    = new TextStyle("Plotno_1", new GeoFont("Arail", 9, DrawingFontStyles.Bold), new GeoSolidBrush(GeoColor.SimpleColors.Black));
            shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            ShapeFileFeatureLayer buildingLayer = new ShapeFileFeatureLayer(System.IO.Path.Combine(Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryDownloads).ToString(), "building.shp"));

            buildingLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(
                GeoColor.FromArgb(100, GeoColor.StandardColors.Gray), GeoColor.StandardColors.Blue);
            buildingLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle    = new TextStyle("BLD_NO", new GeoFont("Arail", 9, DrawingFontStyles.Bold), new GeoSolidBrush(GeoColor.SimpleColors.Black));
            buildingLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            ShapeFileFeatureLayer hLayer = new ShapeFileFeatureLayer(System.IO.Path.Combine(Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryDownloads).ToString(), "BLOCKs.shp"), ShapeFileReadWriteMode.ReadWrite);

            hLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = new TextStyle("BLOCKSch", new GeoFont("Arail", 9, DrawingFontStyles.Bold), new GeoSolidBrush(GeoColor.SimpleColors.Black));
            hLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.FromArgb(100, GeoColor.StandardColors.Blue);
            hLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color     = GeoColor.StandardColors.Blue;
            hLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle.OuterPen             = new GeoPen(GeoColor.FromArgb(200, GeoColor.StandardColors.Red), 5);
            hLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.SymbolPen           = new GeoPen(GeoColor.FromArgb(255, GeoColor.StandardColors.Green), 8);
            hLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            pointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.Red, 12, GeoColor.StandardColors.Black);
            pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            //  Feature gmp = new Feature(new PointShape(256721.2508062, 9855780.04717357));
            //  pointLayer.InternalFeatures.Add(gmp);
            LayerOverlay pointOverlay = new LayerOverlay( );

            pointOverlay.Layers.Add("PointLayer", pointLayer);

            //  LayerOverlay layerOverlay = new LayerOverlay();  moved to public
            layerOverlay.Layers.Add("Cadastral", shapeFileFeatureLayer);

            LayerOverlay hOverlay = new LayerOverlay();

            hOverlay.Layers.Add("Blocks", hLayer);

            LayerOverlay bOverlay = new LayerOverlay();

            bOverlay.Layers.Add("Building", buildingLayer);

            androidMap.Overlays.Add("building", bOverlay);
            androidMap.Overlays.Add("cadastral", layerOverlay);
            androidMap.Overlays.Add("blocks", hOverlay);
            androidMap.Overlays.Add("gmpoint", pointOverlay);

            //  var v = Android.OS.Environment.GetExternalStoragePublicDirectory ();
            //Internal projection string from the PRJ file. Note that the false easting value (x_0) has to be expressed in meter for proj4 string.
            string internalProjectionString = "+proj=utm +zone=37 +south +ellps=clrk80 +units=m +no_defs";

            proj4.InternalProjectionParametersString = internalProjectionString;
            //External projection string as Geodetic (21037).
            proj4.ExternalProjectionParametersString = ManagedProj4Projection.GetEpsgParametersString(21037);
            proj4.Open();

            shapeFileFeatureLayer.FeatureSource.Projection = proj4;
            buildingLayer.FeatureSource.Projection         = proj4;
            pointLayer.FeatureSource.Projection            = proj4;

            hLayer.RequireIndex                = false;
            buildingLayer.RequireIndex         = false;
            shapeFileFeatureLayer.RequireIndex = false;
            shapeFileFeatureLayer.Open();
            androidMap.MapDoubleTap += AndroidMap_MapDoubleTap;

            androidMap.CurrentExtent = shapeFileFeatureLayer.GetBoundingBox();
            shapeFileFeatureLayer.Close();
            proj4.Close();
            androidMap.Refresh();

            gpsButton       = GetButton(Resource.Drawable.Gps, TrackButtonClick);
            addButton       = GetButton(Resource.Drawable.Add, TrackButtonClick);
            searchButton    = GetButton(Resource.Drawable.Search, TrackButtonClick);
            cursorButton    = GetButton(Resource.Drawable.Cursor, TrackButtonClick);
            drawButton      = GetButton(Resource.Drawable.Draw, TrackButtonClick);
            pointButton     = GetButton(Resource.Drawable.Point, TrackButtonClick);
            lineButton      = GetButton(Resource.Drawable.Line, TrackButtonClick);
            rectangleButton = GetButton(Resource.Drawable.Rectangle, TrackButtonClick);
            circleButton    = GetButton(Resource.Drawable.Circle, TrackButtonClick);
            polygonButton   = GetButton(Resource.Drawable.Polygon, TrackButtonClick);
            ellipseButton   = GetButton(Resource.Drawable.Ellipse, TrackButtonClick);
            editButton      = GetButton(Resource.Drawable.Edit, TrackButtonClick);
            clearButton     = GetButton(Resource.Drawable.Clear, TrackButtonClick);

            trackLinearLayout             = new LinearLayout(this);
            trackLinearLayout.Orientation = Orientation.Horizontal;
            trackLinearLayout.Visibility  = ViewStates.Gone;
            trackLinearLayout.AddView(pointButton);
            trackLinearLayout.AddView(lineButton);
            trackLinearLayout.AddView(rectangleButton);
            trackLinearLayout.AddView(polygonButton);
            trackLinearLayout.AddView(ellipseButton);

            LinearLayout toolsLinearLayout = new LinearLayout(this);

            toolsLinearLayout.AddView(searchButton);
            toolsLinearLayout.AddView(addButton);
            toolsLinearLayout.AddView(gpsButton);
            toolsLinearLayout.AddView(cursorButton);
            toolsLinearLayout.AddView(drawButton);
            toolsLinearLayout.AddView(trackLinearLayout);
            toolsLinearLayout.AddView(editButton);
            toolsLinearLayout.AddView(clearButton);
            InitializeInstruction(toolsLinearLayout);
        }
Example #27
0
        protected override void DrawCore(WinformsMap winformsMap)
        {
            LayerOverlay layerOverlay = new LayerOverlay();

            if (!LoadingFromShapeFile)
            {
                foreach (var item in Layers)
                {
                    layerOverlay.Layers.Add(item);
                }
            }
            else
            {
                if (!String.IsNullOrEmpty(firstShapeFilePathName))
                {
                    ShapeFileFeatureLayer.BuildIndexFile(firstShapeFilePathName, BuildIndexMode.DoNotRebuild);
                    ShapeFileFeatureLayer firstInputShapeFileFeatureLayer = new ShapeFileFeatureLayer(firstShapeFilePathName);
                    firstInputShapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(102, 0, 255, 0), GeoColor.FromArgb(255, 0, 255, 0), 2);
                    firstInputShapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(102, 0, 255, 0), 2, true);
                    firstInputShapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(102, 0, 255, 0), 12);
                    firstInputShapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
                    layerOverlay.Layers.Add(firstInputShapeFileFeatureLayer);
                }

                if (!String.IsNullOrEmpty(secondShapeFilePathName))
                {
                    ShapeFileFeatureLayer.BuildIndexFile(secondShapeFilePathName, BuildIndexMode.DoNotRebuild);
                    ShapeFileFeatureLayer secondInputShapeFileFeatureLayer = new ShapeFileFeatureLayer(secondShapeFilePathName);
                    secondInputShapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(102, 0, 0, 255), GeoColor.FromArgb(255, 0, 0, 255), 2);
                    secondInputShapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(102, 0, 0, 255), 2, true);
                    secondInputShapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(102, 0, 0, 255), 12);
                    secondInputShapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
                    layerOverlay.Layers.Add(secondInputShapeFileFeatureLayer);
                }
                layerOverlay.Layers.Add(OutputFeatureLayer);
            }
            winformsMap.Overlays.Clear();
            winformsMap.Overlays.Add(layerOverlay);
            winformsMap.Refresh();
        }
        private void InitializeOverlays()
        {
            string cacheFolder = Path.Combine(Path.GetTempPath(), "TileCache");

            WorldMapKitWmsWpfOverlay worldMapKitRoadOverlay = new WorldMapKitWmsWpfOverlay();

            worldMapKitRoadOverlay.Name       = Resources.WorldMapKitOverlayRoadName;
            worldMapKitRoadOverlay.TileHeight = 512;
            worldMapKitRoadOverlay.TileWidth  = 512;
            worldMapKitRoadOverlay.Projection = WorldMapKitProjection.SphericalMercator;
            worldMapKitRoadOverlay.MapType    = WorldMapKitMapType.Road;
            worldMapKitRoadOverlay.IsVisible  = true;
            worldMapKitRoadOverlay.TileCache  = new FileBitmapTileCache(cacheFolder, Resources.WorldMapKitOverlayRoadName);
            mapControl.Overlays.Add(worldMapKitRoadOverlay);

            WorldMapKitWmsWpfOverlay worldMapKitAerialOverlay = new WorldMapKitWmsWpfOverlay();

            worldMapKitAerialOverlay.Name       = Resources.WorldMapKitOverlayAerialName;
            worldMapKitAerialOverlay.TileHeight = 512;
            worldMapKitAerialOverlay.TileWidth  = 512;
            worldMapKitAerialOverlay.Projection = WorldMapKitProjection.SphericalMercator;
            worldMapKitAerialOverlay.MapType    = WorldMapKitMapType.Aerial;
            worldMapKitAerialOverlay.IsVisible  = false;
            worldMapKitAerialOverlay.TileCache  = new FileBitmapTileCache(cacheFolder, Resources.WorldMapKitOverlayAerialName);
            mapControl.Overlays.Add(worldMapKitAerialOverlay);

            WorldMapKitWmsWpfOverlay worldMapKitAerialWithLabelsOverlay = new WorldMapKitWmsWpfOverlay();

            worldMapKitAerialWithLabelsOverlay.Name       = Resources.WorldMapKitOverlayAerialWithLabelsName;
            worldMapKitAerialWithLabelsOverlay.TileHeight = 512;
            worldMapKitAerialWithLabelsOverlay.TileWidth  = 512;
            worldMapKitAerialWithLabelsOverlay.Projection = WorldMapKitProjection.SphericalMercator;
            worldMapKitAerialWithLabelsOverlay.MapType    = WorldMapKitMapType.AerialWithLabels;
            worldMapKitAerialWithLabelsOverlay.IsVisible  = false;
            worldMapKitAerialWithLabelsOverlay.TileCache  = new FileBitmapTileCache(cacheFolder, Resources.WorldMapKitOverlayAerialWithLabelsName);
            mapControl.Overlays.Add(worldMapKitAerialWithLabelsOverlay);

            OpenStreetMapOverlay openStreetMapOverlay = new OpenStreetMapOverlay();

            openStreetMapOverlay.Name       = Resources.OSMOverlayName;
            openStreetMapOverlay.TileHeight = 512;
            openStreetMapOverlay.TileWidth  = 512;
            openStreetMapOverlay.IsVisible  = false;
            openStreetMapOverlay.TileCache  = new FileBitmapTileCache(cacheFolder, Resources.OSMOverlayName);
            mapControl.Overlays.Add(openStreetMapOverlay);

            BingMapsOverlay bingMapsAerialOverlay = new BingMapsOverlay();

            bingMapsAerialOverlay.Name       = Resources.BingMapsAerialOverlayName;
            bingMapsAerialOverlay.TileHeight = 512;
            bingMapsAerialOverlay.TileWidth  = 512;
            bingMapsAerialOverlay.MapType    = Wpf.BingMapsMapType.Aerial;
            bingMapsAerialOverlay.IsVisible  = false;
            bingMapsAerialOverlay.TileCache  = new FileBitmapTileCache(cacheFolder, Resources.BingMapsAerialOverlayName);
            mapControl.Overlays.Add(bingMapsAerialOverlay);

            BingMapsOverlay bingMapsRoadOverlay = new BingMapsOverlay();

            bingMapsRoadOverlay.Name       = Resources.BingMapsRoadOverlayName;
            bingMapsRoadOverlay.TileHeight = 512;
            bingMapsRoadOverlay.TileWidth  = 512;
            bingMapsRoadOverlay.MapType    = Wpf.BingMapsMapType.Road;
            bingMapsRoadOverlay.IsVisible  = false;
            bingMapsRoadOverlay.TileCache  = new FileBitmapTileCache(cacheFolder, Resources.BingMapsRoadOverlayName);
            mapControl.Overlays.Add(bingMapsRoadOverlay);

            LayerOverlay styleLayersOverLay = new LayerOverlay();

            styleLayersOverLay.TileType = TileType.SingleTile;
            mapControl.Overlays.Add(Resources.StyleLayerOverLayKey, styleLayersOverLay);

            Proj4Projection wgs84ToMercatorProjection = new Proj4Projection();

            wgs84ToMercatorProjection.InternalProjectionParametersString = Proj4Projection.GetDecimalDegreesParametersString();
            wgs84ToMercatorProjection.ExternalProjectionParametersString = Proj4Projection.GetSphericalMercatorParametersString();

            EarthquakeHeatFeatureLayer heatLayer = new EarthquakeHeatFeatureLayer(new ShapeFileFeatureSource(ConfigurationManager.AppSettings["DataShapefileFileName"]));

            heatLayer.HeatStyle = new HeatStyle(10, 100, Resources.MagnitudeColumnName, 0, 12, 100, DistanceUnit.Kilometer);
            heatLayer.FeatureSource.Projection = wgs84ToMercatorProjection;
            heatLayer.Name = Resources.HeatStyleLayerName;
            styleLayersOverLay.Layers.Add(heatLayer);

            ShapeFileFeatureLayer pointLayer = new ShapeFileFeatureLayer(ConfigurationManager.AppSettings["DataShapefileFileName"]);

            pointLayer.FeatureSource.Projection = wgs84ToMercatorProjection;
            pointLayer.Name = Resources.PointStyleLayerName;
            pointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.Red, 6, GeoColor.StandardColors.White, 1);
            pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            styleLayersOverLay.Layers.Add(pointLayer);

            EarthquakeIsoLineFeatureLayer isoLineLayer = new EarthquakeIsoLineFeatureLayer(new ShapeFileFeatureSource(ConfigurationManager.AppSettings["DataShapefileFileName"]));

            isoLineLayer.FeatureSource.Projection = wgs84ToMercatorProjection;
            isoLineLayer.Name = Resources.IsolineStyleLayerName;
            styleLayersOverLay.Layers.Add(isoLineLayer);

            //Setup TarckOverlay.
            mapControl.TrackOverlay             = new RadiusMearsureTrackInteractiveOverlay(DistanceUnit.Mile, mapControl.MapUnit);
            mapControl.TrackOverlay.TrackEnded += TrackOverlay_TrackEnded;

            LayerOverlay markerOverlay = new LayerOverlay();

            mapControl.Overlays.Add(Resources.MarkerOverlayKey, markerOverlay);

            PointStyle highLightStyle = new PointStyle();

            highLightStyle.CustomPointStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(50, GeoColor.SimpleColors.Blue), 20, GeoColor.SimpleColors.LightBlue, 1));
            highLightStyle.CustomPointStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.LightBlue, 9, GeoColor.SimpleColors.Blue, 1));

            markerMemoryLayer = new InMemoryFeatureLayer();
            markerMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.Orange, 8, GeoColor.SimpleColors.White, 1);
            markerMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            markerOverlay.Layers.Add(markerMemoryLayer);

            markerMemoryHighlightLayer = new InMemoryFeatureLayer();
            markerMemoryHighlightLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = highLightStyle;
            markerMemoryHighlightLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            markerOverlay.Layers.Add(markerMemoryHighlightLayer);

            ScaleBarAdornmentLayer scaleBarAdornmentLayer = new ScaleBarAdornmentLayer();

            scaleBarAdornmentLayer.UnitFamily = UnitSystem.Imperial;
            mapControl.AdornmentOverlay.Layers.Add(scaleBarAdornmentLayer);
        }
Example #29
0
        private void TestForm_Load(object sender, EventArgs e)
        {
            winformsMap1.MapUnit       = GeographyUnit.DecimalDegree;
            winformsMap1.CurrentExtent = new RectangleShape(-88.0309, 42.2772, -88.0036, 42.2609);
            winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 198, 255, 255));

            //Displays the World Map Kit as a background.
            WorldMapKitWmsDesktopOverlay worldMapKitDesktopOverlay = new WorldMapKitWmsDesktopOverlay();

            winformsMap1.Overlays.Add(worldMapKitDesktopOverlay);

            ManagedProj4Projection proj4 = new ManagedProj4Projection();

            proj4.InternalProjectionParametersString = ManagedProj4Projection.GetEpsgParametersString(26916);
            proj4.ExternalProjectionParametersString = ManagedProj4Projection.GetEpsgParametersString(4326);

            ShapeFileFeatureLayer layer1 = new ShapeFileFeatureLayer(@"..\..\data\lake_streets_utm16.shp");

            layer1.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.DarkGreen, 4, true);
            layer1.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            layer1.FeatureSource.Projection = proj4;

            ShapeFileFeatureLayer layer2 = new ShapeFileFeatureLayer(@"..\..\data\lake_poly.shp");

            layer2.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(150, GeoColor.StandardColors.Green), GeoColor.StandardColors.Black);
            layer2.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            LayerOverlay layerOverlay = new LayerOverlay();

            layerOverlay.Layers.Add(layer1);
            layerOverlay.Layers.Add(layer2);
            winformsMap1.Overlays.Add(layerOverlay);

            InMemoryFeatureLayer inMemoryFeatureLayer = new InMemoryFeatureLayer();

            inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.Red, 10);
            inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            PointShape pointShape = new PointShape(-88.0168, 42.2688);

            inMemoryFeatureLayer.InternalFeatures.Add(new Feature(pointShape));

            InMemoryFeatureLayer selectInMemoryFeatureLayer = new InMemoryFeatureLayer();

            selectInMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyles.CreateSimpleAreaStyle(GeoColor.StandardColors.Yellow);
            selectInMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.Yellow, 3, true);
            selectInMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            double meterDistance = 300;

            layer1.Open();
            // This method works fine with Map Suite Assemblies 4.5.54.0 or later.
            Collection <Feature> withinFeatures1 = layer1.QueryTools.GetFeaturesWithinDistanceOf(pointShape, winformsMap1.MapUnit, DistanceUnit.Meter, meterDistance, ReturningColumnsType.AllColumns);

            layer1.Close();
            foreach (Feature withinFeature1 in withinFeatures1)
            {
                selectInMemoryFeatureLayer.InternalFeatures.Add(withinFeature1);
            }

            layer2.Open();
            Collection <Feature> withinFeatures2 = layer2.QueryTools.GetFeaturesWithinDistanceOf(pointShape, winformsMap1.MapUnit, DistanceUnit.Meter, meterDistance, ReturningColumnsType.AllColumns);

            layer2.Close();
            foreach (Feature withinFeature2 in withinFeatures2)
            {
                selectInMemoryFeatureLayer.InternalFeatures.Add(withinFeature2);
            }

            LayerOverlay dynamicOverlay = new LayerOverlay();

            dynamicOverlay.Layers.Add(inMemoryFeatureLayer);
            dynamicOverlay.Layers.Add(selectInMemoryFeatureLayer);
            winformsMap1.Overlays.Add(dynamicOverlay);

            ScaleBarAdornmentLayer scaleBarAdornmentLayer = new ScaleBarAdornmentLayer();

            scaleBarAdornmentLayer.UnitFamily = UnitSystem.Metric;
            scaleBarAdornmentLayer.Location   = AdornmentLocation.LowerLeft;
            winformsMap1.AdornmentOverlay.Layers.Add(scaleBarAdornmentLayer);

            winformsMap1.Refresh();
        }
Example #30
0
        private void InitializeMap()
        {
            string targetDictionary = @"AppData/SampleData";

            Proj4Projection proj4    = Global.GetWgs84ToMercatorProjection();
            string          rootPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/CacheImages";

            // WMK
            WorldMapKitOverlay wmkOverlay = new WorldMapKitOverlay();

            wmkOverlay.Projection = ThinkGeo.MapSuite.iOS.WorldMapKitProjection.SphericalMercator;

            // OSM
            OpenStreetMapOverlay osmOverlay = new OpenStreetMapOverlay();

            osmOverlay.TileCache = new FileBitmapTileCache(rootPath + "/OpenStreetMaps", "SphericalMercator");
            osmOverlay.TileCache.TileMatrix.BoundingBoxUnit = GeographyUnit.Meter;
            osmOverlay.TileCache.TileMatrix.BoundingBox     = osmOverlay.GetBoundingBox();
            osmOverlay.TileCache.ImageFormat = TileImageFormat.Jpeg;
            osmOverlay.IsVisible             = false;

            // Bing - Aerial
            BingMapsOverlay bingMapsAerialOverlay = new BingMapsOverlay();

            bingMapsAerialOverlay.MapStyle  = ThinkGeo.MapSuite.iOS.BingMapsMapType.AerialWithLabels;
            bingMapsAerialOverlay.TileCache = new FileBitmapTileCache(rootPath + "/BingMaps", "AerialWithLabels");
            bingMapsAerialOverlay.TileCache.TileMatrix.BoundingBoxUnit = GeographyUnit.Meter;
            bingMapsAerialOverlay.TileCache.TileMatrix.BoundingBox     = bingMapsAerialOverlay.GetBoundingBox();
            bingMapsAerialOverlay.TileCache.ImageFormat = TileImageFormat.Jpeg;
            bingMapsAerialOverlay.IsVisible             = false;

            // Bing - Road
            BingMapsOverlay bingMapsRoadOverlay = new BingMapsOverlay();

            bingMapsRoadOverlay.MapStyle  = ThinkGeo.MapSuite.iOS.BingMapsMapType.Road;
            bingMapsRoadOverlay.TileCache = new FileBitmapTileCache(rootPath + "/BingMaps", "Road");
            bingMapsRoadOverlay.TileCache.TileMatrix.BoundingBoxUnit = GeographyUnit.Meter;
            bingMapsRoadOverlay.TileCache.TileMatrix.BoundingBox     = bingMapsRoadOverlay.GetBoundingBox();
            bingMapsRoadOverlay.TileCache.ImageFormat = TileImageFormat.Jpeg;
            bingMapsRoadOverlay.IsVisible             = false;

            // Earthquake points
            ShapeFileFeatureLayer earthquakePointLayer = new ShapeFileFeatureLayer(Path.Combine(targetDictionary, "usEarthquake.shp"));

            earthquakePointLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.Red, 5, GeoColor.SimpleColors.White, 1));
            earthquakePointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            earthquakePointLayer.FeatureSource.Projection = proj4;

            ShapeFileFeatureSource earthquakeHeatFeatureSource = new ShapeFileFeatureSource(Path.Combine(targetDictionary, "usEarthquake_Simplified.shp"));

            earthquakeHeatFeatureSource.Projection = proj4;

            HeatLayer earthquakeHeatLayer = new HeatLayer(earthquakeHeatFeatureSource);

            earthquakeHeatLayer.HeatStyle       = new HeatStyle(10, 75, DistanceUnit.Kilometer);
            earthquakeHeatLayer.HeatStyle.Alpha = 180;
            earthquakeHeatLayer.IsVisible       = false;

            LayerOverlay highlightOverlay = new LayerOverlay();

            highlightOverlay.Layers.Add("EarthquakePointLayer", earthquakePointLayer);
            highlightOverlay.Layers.Add("EarthquakeHeatLayer", earthquakeHeatLayer);

            // Highlighted points
            InMemoryFeatureLayer selectedMarkerLayer = new InMemoryFeatureLayer();

            selectedMarkerLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.Orange, 8, GeoColor.SimpleColors.White, 2);
            selectedMarkerLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            PointStyle highLightMarkerStyle = new PointStyle();

            highLightMarkerStyle.CustomPointStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(50, GeoColor.SimpleColors.Blue), 20, GeoColor.SimpleColors.LightBlue, 1));
            highLightMarkerStyle.CustomPointStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(255, 0, 122, 255), 10, GeoColor.SimpleColors.White, 2));

            InMemoryFeatureLayer highlightMarkerLayer = new InMemoryFeatureLayer();

            highlightMarkerLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = highLightMarkerStyle;
            highlightMarkerLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            highlightOverlay.Layers.Add("SelectMarkerLayer", selectedMarkerLayer);
            highlightOverlay.Layers.Add("HighlightMarkerLayer", highlightMarkerLayer);

            // Maps
            iOSMap                 = new MapView(View.Frame);
            iOSMap.MapUnit         = GeographyUnit.Meter;
            iOSMap.ZoomLevelSet    = new SphericalMercatorZoomLevelSet();
            iOSMap.CurrentExtent   = new RectangleShape(-19062735.6816748, 9273256.52450252, -5746827.16371793, 2673516.56066139);
            iOSMap.BackgroundColor = new UIColor(233, 229, 220, 200);

            iOSMap.Overlays.Add(Global.OpenStreetMapOverlayKey, osmOverlay);
            iOSMap.Overlays.Add(Global.WorldMapKitOverlayKey, wmkOverlay);
            iOSMap.Overlays.Add(Global.BingMapsAerialOverlayKey, bingMapsAerialOverlay);
            iOSMap.Overlays.Add(Global.BingMapsRoadOverlayKey, bingMapsRoadOverlay);
            iOSMap.Overlays.Add(Global.HighLightOverlayKey, highlightOverlay);

            iOSMap.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Clear();
            iOSMap.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(80, GeoColor.SimpleColors.LightGreen), 8);
            iOSMap.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle  = LineStyles.CreateSimpleLineStyle(GeoColor.SimpleColors.White, 3, true);
            iOSMap.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle  = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(80, GeoColor.SimpleColors.LightGreen), GeoColor.SimpleColors.White, 2);
            iOSMap.TrackOverlay.TrackEnded += TrackInteractiveOverlayOnTrackEnded;
            Global.MapView = iOSMap;

            View.Add(iOSMap);
            iOSMap.Refresh();
        }