コード例 #1
0
        private static ClassBreakStyle GetClassBreakStyleFromColors(Color[] colors)
        {
            //seems the old app handled color scales differently. We need to invert the order in the colors array.
            colors = colors.Reverse().ToArray();

            ClassBreakStyle cbs = new ClassBreakStyle();

            AreaStyle defaultAreaStyle = new AreaStyle(new GeoSolidBrush(GeoColor.SimpleColors.Transparent));

            GeoBrush gb = new GeoSolidBrush(GeoColor.StandardColors.LightGray);
            GeoPen   gp = new GeoPen(gb)
            {
                DashStyle = LineDashStyle.Solid
            };

            defaultAreaStyle.OutlinePen = gp;
            cbs.ClassBreaks.Add(new ClassBreak(0, defaultAreaStyle));



            int i = 1;

            foreach (Color color in colors)
            {
                GeoSolidBrush gsb = new GeoSolidBrush(new GeoColor(color.A, color.R, color.G, color.B));
                AreaStyle     ss  = new AreaStyle(gsb)
                {
                    OutlinePen = gp
                };
                cbs.ClassBreaks.Add(new ClassBreak(i, ss));
                i++;
            }

            return(cbs);
        }
 public StandardDotDensityLegendItem(int dotCount)
     : base()
 {
     DotCount   = dotCount;
     LabelFont  = new GeoFont("Arial", 20, DrawingFontStyles.Bold);
     LabelBrush = new GeoSolidBrush(GeoColor.FromArgb(180, GeoColor.FromHtml("#d3d3d3")));
 }
コード例 #3
0
 private void CustomColorList_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (customColorList.SelectedItem != null)
     {
         Color color = ((SolidColorBrush)customColorList.SelectedItem).Color;
         SelectedBrush = new GeoSolidBrush(GeoColor.FromArgb(color.A, color.R, color.G, color.B));
     }
 }
コード例 #4
0
        private Collection <GeoSolidBrush> GetBreakdownBrushes(int breakCount, GeoSolidBrush baseBrush, GeoSolidBrush endBrush, ClassBreakBy breakColorMode)
        {
            Collection <GeoSolidBrush> brushes = new Collection <GeoSolidBrush>();
            HSL baseHsl = GetHslFromRgb(baseBrush.Color.RedComponent, baseBrush.Color.GreenComponent, baseBrush.Color.BlueComponent);
            HSL endHsl  = null;

            if (breakColorMode == ClassBreakBy.Hue)
            {
                endHsl = GetHslFromRgb(endBrush.Color.RedComponent, endBrush.Color.GreenComponent, endBrush.Color.BlueComponent);
                var averageH     = (endHsl.Hue - baseHsl.Hue) / (breakCount - 1);
                var averageS     = (endHsl.Saturation - baseHsl.Saturation) / (breakCount - 1);
                var averageL     = (endHsl.Luminance - baseHsl.Luminance) / (breakCount - 1);
                var averageAlpha = (endBrush.Color.AlphaComponent - baseBrush.Color.AlphaComponent) / (breakCount - 1);
                brushes.Add(baseBrush);
                for (int i = 1; i <= breakCount - 2; i++)
                {
                    HSL generatedHsl = new HSL(baseHsl.Hue, baseHsl.Saturation, baseHsl.Luminance);
                    generatedHsl.Hue        += averageH * i;
                    generatedHsl.Saturation += averageS * i;
                    generatedHsl.Luminance  += averageL * i;

                    brushes.Add(GetSolidBrushFromHsl((byte)((int)baseBrush.Color.AlphaComponent + averageAlpha * i), generatedHsl));
                }
                brushes.Add(endBrush);
            }
            else
            {
                endHsl = new HSL(baseHsl.Hue, baseHsl.Saturation, baseHsl.Luminance);
                if (breakColorMode == ClassBreakBy.Saturation)
                {
                    endHsl.Saturation = this.currentValue;
                    var averageS = (baseHsl.Saturation - currentValue) / (breakCount - 1);
                    brushes.Add(GetSolidBrushFromHsl(baseBrush.Color.AlphaComponent, endHsl));
                    for (int i = 1; i <= breakCount - 2; i++)
                    {
                        HSL generatedHsl = new HSL(endHsl.Hue, endHsl.Saturation, endHsl.Luminance);
                        generatedHsl.Saturation += averageS * i;
                        brushes.Add(GetSolidBrushFromHsl(baseBrush.Color.AlphaComponent, generatedHsl));
                    }
                    brushes.Add(baseBrush);
                }
                else
                {
                    endHsl.Luminance = this.currentValue;
                    var averageL = (baseHsl.Luminance - currentValue) / (breakCount - 1);
                    brushes.Add(GetSolidBrushFromHsl(baseBrush.Color.AlphaComponent, endHsl));
                    for (int i = 1; i <= breakCount - 2; i++)
                    {
                        HSL generatedHsl = new HSL(endHsl.Hue, endHsl.Saturation, endHsl.Luminance);
                        generatedHsl.Luminance += averageL * i;

                        brushes.Add(GetSolidBrushFromHsl(baseBrush.Color.AlphaComponent, generatedHsl));
                    }
                    brushes.Add(baseBrush);
                }
            }
            return(brushes);
        }
コード例 #5
0
        protected override void DrawAreaCore(IEnumerable <ScreenPointF[]> screenPoints, GeoPen outlinePen, GeoBrush fillBrush, DrawingLevel drawingLevel, float xOffset, float yOffset, PenBrushDrawingOrder penBrushDrawingOrder)
        {
            //if (fillBrush == null)
            //{
            //    fillBrush = new GeoSolidBrush(GeoColor.SimpleColors.Transparent);
            //}
            int id = 0;

            if (fillBrush != null)
            {
                id = fillBrush.GetHashCode();
            }
            else
            {
                id        = outlinePen.GetHashCode();
                fillBrush = new GeoSolidBrush(GeoColor.SimpleColors.Transparent);
            }

            if (!_styleUrlDictionary.ContainsKey(id))
            {
                string kmlStyle = GetPolygonStyleKml(id, outlinePen, ((GeoSolidBrush)fillBrush).Color);
                _kmlBuilder.Append(kmlStyle);
                _styleUrlDictionary.Add(id, string.Format("<styleUrl>#{0}</styleUrl>", id));
            }

            StringBuilder contentStringBuilder = GetStringBuilder(drawingLevel);

            contentStringBuilder.AppendLine();
            contentStringBuilder.AppendLine(@"<Placemark>");
            contentStringBuilder.AppendLine(_styleUrlDictionary[id]);
            contentStringBuilder.AppendLine(@"<Polygon>");

            contentStringBuilder.AppendLine(_extrudeString);
            contentStringBuilder.AppendLine(_tessellateString);
            contentStringBuilder.AppendLine(_altitudeModeString);

            bool firstCoordinates = true;

            foreach (ScreenPointF[] screenPoint in screenPoints)
            {
                if (firstCoordinates)
                {
                    contentStringBuilder.AppendLine(@"<outerBoundaryIs>");
                    AppendLinearRing(screenPoint, xOffset, yOffset, contentStringBuilder);
                    contentStringBuilder.AppendLine(@"</outerBoundaryIs>");
                    firstCoordinates = false;
                }
                else
                {
                    contentStringBuilder.AppendLine(@"<innerBoundaryIs>");
                    AppendLinearRing(screenPoint, xOffset, yOffset, contentStringBuilder);
                    contentStringBuilder.AppendLine(@"</innerBoundaryIs>");
                }
            }
            contentStringBuilder.AppendLine(@"</Polygon>");
            contentStringBuilder.AppendLine(@"</Placemark>");
        }
コード例 #6
0
        private void ChangeColorFromColorPicker(Control colorPicker, EventArgs e)
        {
            if (colorPicker is SolidColorPicker)
            {
                SolidColorPicker solidColorPicker = (SolidColorPicker)colorPicker;
                Color            newColor         = solidColorPicker.SelectedColor;
                GeoColor         newGeoColor      = GeoColor2MediaColorConverter.ConvertBack(newColor);

                hatchColorPicker.SyncBaseColor(DrawingColorToMediaColorConverter.ConvertBack(newColor));
                gradientPicker.SyncBaseColor(DrawingColorToMediaColorConverter.ConvertBack(newColor));

                SelectedBrush = new GeoSolidBrush(newGeoColor);
            }
            else if (colorPicker is HatchPicker)
            {
                HatchPicker hatchPicker = (HatchPicker)colorPicker;
                System.Drawing.Drawing2D.HatchStyle drawingHatchStyle = hatchPicker.SelectedHatchStyle;
                GeoHatchStyle geoHatchStyle = GeoHatchStyle2DrawingHatchStyle.ConvertBack(drawingHatchStyle);

                //solidColorPicker.SyncBaseColor(hatchPicker.ForegroundColor);
                gradientPicker.SyncBaseColor(hatchPicker.ForegroundColor);

                SelectedBrush = new GeoHatchBrush(geoHatchStyle, GeoColor2DrawingColorConverter.ConvertBack(hatchPicker.ForegroundColor)
                                                  , GeoColor2DrawingColorConverter.ConvertBack(hatchColorPicker.BackgroundColor));
            }
            else if (colorPicker is TexturePicker)
            {
                PropertyChangedEventArgs args          = (PropertyChangedEventArgs)e;
                TexturePicker            texturePicker = (TexturePicker)colorPicker;
                if (args.PropertyName == "SelectedBrush")
                {
                    ImageBrush mediaBrush = texturePicker.SelectedBrush as ImageBrush;
                    if (mediaBrush != null)
                    {
                        BitmapImage imageSource = (BitmapImage)mediaBrush.ImageSource;
                        if (imageSource != null)
                        {
                            SelectedBrush = new GeoTextureBrush(new GeoImage(imageSource.UriSource.LocalPath));
                        }
                    }
                }
            }
            else if (colorPicker is DrawingLinearGradientBrushPicker)
            {
                DrawingLinearGradientBrushPicker linearPicker = (DrawingLinearGradientBrushPicker)colorPicker;
                LinearGradientBrushEntity        brushEntity  = linearPicker.SelectedBrush;

                solidColorPicker.SyncBaseColor(brushEntity.StartColor);
                hatchColorPicker.SyncBaseColor(brushEntity.StartColor);

                SelectedBrush = new GeoLinearGradientBrush(GeoColor2DrawingColorConverter.ConvertBack(brushEntity.StartColor),
                                                           GeoColor2DrawingColorConverter.ConvertBack(brushEntity.EndColor),
                                                           brushEntity.Angle);
            }
        }
コード例 #7
0
 public ScaleLineOrBarAdornmentLayerViewModel()
 {
     ForeColor    = new GeoSolidBrush(GeoColor.SimpleColors.Black);
     AlteColor    = new GeoSolidBrush(GeoColor.StandardColors.White);
     BackMask     = new AreaStyle(new GeoSolidBrush(GeoColor.StandardColors.Transparent));
     Width        = 392;
     height       = 32;
     MaximumWidth = 392;
     Thickness    = 8;
     selectedScaleLineUnitSystem = ScaleLineUnitSystem.ImperialAndMetric;
     InitializeDelayProcess();
 }
コード例 #8
0
        private void LoadFromCss(LayerOverlay overlay, string css)
        {
            CssDocument doc = CssDocument.Parse(css);

            overlay.LoadStyledLayers("AppData", doc);

            GeoSolidBrush background = doc.Styles.First().FillBrush as GeoSolidBrush;

            if (background != null)
            {
                Map1.Background = new SolidColorBrush(Color.FromArgb(background.Color.Alpha, background.Color.Red, background.Color.Green, background.Color.Blue));
            }
        }
コード例 #9
0
 public WindPointStyle(string textColumn, string levelColumn, string angleColumn, GeoColor fillColor)
 {
     this.directionLineLength1 = 40;
     this.directionLineLength2 = 10;
     this.blackBrush           = new GeoSolidBrush(GeoColor.SimpleColors.Black);
     this.font            = new GeoFont("Verdana", 10);
     this.textBrush       = new GeoSolidBrush(GeoColor.StandardColors.Black);
     this.fillBrush       = new GeoSolidBrush(fillColor);
     this.outlinePen      = new GeoPen(GeoColor.StandardColors.Black, 4);
     this.innerlinePen    = new GeoPen(fillBrush, 2);
     this.textColumn      = textColumn;
     this.windLevelColumn = levelColumn;
     this.angleColumn     = angleColumn;
 }
コード例 #10
0
        public GridlinesSettingsViewModel(PrinterLayer printerLayer)
        {
            units = new Collection <PrintingUnit>();
            units.Add(PrintingUnit.Inch);
            units.Add(PrintingUnit.Centimeter);
            dashStyles = new Collection <LineDashStyle>();
            foreach (LineDashStyle item in Enum.GetValues(typeof(LineDashStyle)))
            {
                dashStyles.Add(item);
            }
            showGridlines = true;
            useCellSize   = true;
            GridlinesPrinterLayer gridlinesPrinterLayer = printerLayer as GridlinesPrinterLayer;

            if (gridlinesPrinterLayer == null)
            {
                selectedBrush     = new GeoSolidBrush(GeoColor.StandardColors.Gray);
                selectedDashStyle = LineDashStyle.Dot;
                rows         = 10;
                columns      = 10;
                penWidth     = 1;
                selectedUnit = PrintingUnit.Inch;
                left         = 1;
                top          = 1;
                right        = 1;
                bottom       = 1;

                cellHeight       = 1;
                cellWidth        = 1;
                selectedCellUnit = PrintingUnit.Inch;
            }
            else
            {
                selectedBrush     = gridlinesPrinterLayer.DrawingPen.Brush as GeoSolidBrush;
                selectedDashStyle = gridlinesPrinterLayer.DrawingPen.DashStyle;
                rows         = gridlinesPrinterLayer.Rows;
                columns      = gridlinesPrinterLayer.Columns;
                penWidth     = gridlinesPrinterLayer.DrawingPen.Width;
                selectedUnit = gridlinesPrinterLayer.MarginUnit;
                left         = gridlinesPrinterLayer.Left;
                top          = gridlinesPrinterLayer.Top;
                right        = gridlinesPrinterLayer.Right;
                bottom       = gridlinesPrinterLayer.Bottom;

                cellHeight       = gridlinesPrinterLayer.CellHeight;
                cellWidth        = gridlinesPrinterLayer.CellWidth;
                selectedCellUnit = gridlinesPrinterLayer.CellUnit;
                useCellSize      = gridlinesPrinterLayer.UseCellSize;
            }
        }
コード例 #11
0
        private void InitializeStandOutHighlightFeatureLayer()
        {
            standOutHighlightFeatureLayer = new InMemoryFeatureLayer();
            GeoSolidBrush outerColor = new GeoSolidBrush(GeoColor.FromHtml("#FF0000"));
            ZoomLevel     zoomLevel  = this.standOutHighlightFeatureLayer.ZoomLevelSet.ZoomLevel01;

            zoomLevel.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            zoomLevel.DefaultAreaStyle.OutlinePen.Brush      = outerColor;
            zoomLevel.DefaultAreaStyle.OutlinePen.Width      = 4.0f;
            zoomLevel.DefaultLineStyle.OuterPen.Brush        = outerColor;
            zoomLevel.DefaultLineStyle.OuterPen.Width        = 4.0f;
            zoomLevel.DefaultPointStyle.Advanced.CustomBrush = outerColor;
            zoomLevel.DefaultPointStyle.SymbolPen.Brush      = outerColor;
            zoomLevel.DefaultPointStyle.SymbolPen.Width      = 4.0f;
        }
コード例 #12
0
        public void UpdateOverlay(Map map, GeoCollection <object> args)
        {
            var          layerName = args["layer"].ToString();
            LayerOverlay overlay   = map.CustomOverlays["ShapeOverlay"] as LayerOverlay;

            overlay.Layers.Clear();
            if (layerName.ToLowerInvariant() == "us")
            {
                // States layer
                ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(Server.MapPath("~/App_Data/USStates.SHP"));
                AreaStyle             areaStyle  = new AreaStyle();
                areaStyle.FillSolidBrush       = new GeoSolidBrush(GeoColor.FromArgb(255, 233, 232, 214));
                areaStyle.OutlinePen           = new GeoPen(GeoColor.FromArgb(255, 156, 155, 154), 2);
                areaStyle.OutlinePen.DashStyle = LineDashStyle.Solid;
                worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = areaStyle;
                worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
                overlay.Layers.Add(worldLayer);
            }
            else
            {
                // Cities layer
                ShapeFileFeatureLayer countyLayer = new ShapeFileFeatureLayer(Server.MapPath("~/App_Data/cities_e.shp"));
                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);
                GeoFont       font      = new GeoFont("Arial", 9, DrawingFontStyles.Bold);
                GeoSolidBrush txtBrush  = new GeoSolidBrush(GeoColor.StandardColors.Maroon);
                TextStyle     textStyle = new TextStyle("NAME", font, txtBrush);
                textStyle.XOffsetInPixel = 0;
                textStyle.YOffsetInPixel = -6;
                countyLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = pointStyle;
                countyLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle    = textStyle;
                countyLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

                overlay.Layers.Add(countyLayer);
            }
        }
コード例 #13
0
 public override object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
 {
     if (value is Color)
     {
         Color mediaColor = (Color)value;
         return(new GeoSolidBrush(GeoColor.FromArgb(mediaColor.A, mediaColor.R, mediaColor.G, mediaColor.B)));
     }
     else if (value is GeoSolidBrush)
     {
         GeoSolidBrush brush = (GeoSolidBrush)value;
         return(Color.FromArgb(brush.Color.AlphaComponent, brush.Color.RedComponent, brush.Color.GreenComponent, brush.Color.BlueComponent));
     }
     else
     {
         return(Binding.DoNothing);
     }
 }
コード例 #14
0
        private static ValueStyle GetIconStyle(string imagePath)
        {
            ValueStyle valueStyle = new ValueStyle();

            valueStyle.ColumnName = "TYPE";

            GeoFont       font  = new GeoFont("Arial", 9);
            GeoSolidBrush brush = new GeoSolidBrush(GeoColor.StandardColors.Black);

            valueStyle.ValueItems.Add(new ValueItem("1", new IconStyle(imagePath + "vehicle1.png", "Type", font, brush)));
            valueStyle.ValueItems.Add(new ValueItem("2", new IconStyle(imagePath + "vehicle2.png", "Type", font, brush)));
            valueStyle.ValueItems.Add(new ValueItem("3", new IconStyle(imagePath + "vehicle3.png", "Type", font, brush)));
            valueStyle.ValueItems.Add(new ValueItem("4", new IconStyle(imagePath + "vehicle4.png", "Type", font, brush)));
            valueStyle.ValueItems.Add(new ValueItem("5", new IconStyle(imagePath + "vehicle5.png", "Type", font, brush)));
            valueStyle.ValueItems.Add(new ValueItem("6", new IconStyle(imagePath + "vehicle6.png", "Type", font, brush)));
            valueStyle.ValueItems.Add(new ValueItem("7", new IconStyle(imagePath + "vehicle7.png", "Type", font, brush)));

            return(valueStyle);
        }
コード例 #15
0
        private void InitializeHightlightFeatureLayer()
        {
            this.highlightFeatureLayer = new InMemoryFeatureLayer(); // { MaxRecordsToDraw = 5000 };

            GeoSolidBrush fillColor   = new GeoSolidBrush(GeoColor.StandardColors.Transparent);
            GeoSolidBrush outerColor  = new GeoSolidBrush(new GeoColor(255, GeoColor.SimpleColors.Yellow));
            GeoSolidBrush innerColor  = new GeoSolidBrush(new GeoColor(255, GeoColor.FromHtml("#B0EBFF")));
            GeoSolidBrush centerColor = new GeoSolidBrush(new GeoColor(0, GeoColor.FromHtml("#FFFFFF")));

            ZoomLevel zoomLevel = this.HighlightFeatureLayer.ZoomLevelSet.ZoomLevel01;

            zoomLevel.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            zoomLevel.DefaultAreaStyle.Advanced.FillCustomBrush = fillColor;
            zoomLevel.DefaultAreaStyle.OutlinePen.Brush         = outerColor;
            zoomLevel.DefaultAreaStyle.OutlinePen.Width         = 2.0f;

            zoomLevel.DefaultLineStyle.OuterPen.Brush  = outerColor;
            zoomLevel.DefaultLineStyle.OuterPen.Width  = 5.0f;
            zoomLevel.DefaultLineStyle.InnerPen.Brush  = innerColor;
            zoomLevel.DefaultLineStyle.InnerPen.Width  = 1.0f;
            zoomLevel.DefaultLineStyle.CenterPen.Brush = centerColor;
            zoomLevel.DefaultLineStyle.CenterPen.Width = 1.0f;

            zoomLevel.DefaultPointStyle.Advanced.CustomBrush = fillColor;
            zoomLevel.DefaultPointStyle.SymbolPen.Brush      = outerColor;
            zoomLevel.DefaultPointStyle.SymbolPen.Width      = 2.0f;

            zoomLevel.DefaultTextStyle.TextSolidBrush = new GeoSolidBrush(GeoColor.StandardColors.Yellow);
            zoomLevel.DefaultTextStyle.TextColumnName = FeatureIdColumnName;
            zoomLevel.DefaultTextStyle.Font           = new GeoFont("Arial", 7, DrawingFontStyles.Bold);

            highlightFeatureLayer.Open();
            var featureIdColumn = new FeatureSourceColumn(FeatureIdColumnName);

            if (!this.highlightFeatureLayer.Columns.Contains(featureIdColumn))
            {
                this.highlightFeatureLayer.Columns.Add(featureIdColumn);
                //this.highlightFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle(FeatureIdColumnName, "Arial", 7, DrawingFontStyles.Bold, GeoColor.FromArgb(255, 91, 91, 91));
            }
            highlightFeatureLayer.Close();
        }
コード例 #16
0
        public static String GetAsKML(List <ShapeFileFeatureLayer> shapeFileFeatureLayers)
        {
            KmlGeoCanvas kmlGeo = new KmlGeoCanvas();
            GeoBrush     gb     = new GeoSolidBrush(GeoColor.StandardColors.LightGray);
            GeoPen       gp     = new GeoPen(gb)
            {
                DashStyle = LineDashStyle.Solid
            };

            foreach (ShapeFileFeatureLayer shapeFileFeatureLayer in shapeFileFeatureLayers)
            {
                foreach (Feature feature in shapeFileFeatureLayer.FeatureSource.GetAllFeatures(ReturningColumnsType.NoColumns))
                {
                    kmlGeo.DrawArea(feature, gp, DrawingLevel.LevelOne);
                }
            }
            //kmlGeo.

            return(string.Empty);
        }
コード例 #17
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();
        }
コード例 #18
0
 public IconTextStyle(GeoImage iconImage, string textColumnName, GeoFont textFont, GeoSolidBrush textSolidBrush)
     : base(iconImage, textColumnName, textFont, textSolidBrush)
 {
     Initialize();
 }
コード例 #19
0
 public IconTextStyle(string iconPathFilename, string textColumnName, GeoFont textFont, GeoSolidBrush textSolidBrush)
     : base(iconPathFilename, textColumnName, textFont, textSolidBrush)
 {
     Initialize();
 }
コード例 #20
0
 public CustomTextStyle(string textColumnName, GeoFont textFont, GeoSolidBrush textSolidBrush)
     : base(textColumnName, textFont, textSolidBrush)
 {
     this.minFontSize = 8;
     this.MaxFontSize = 25;
 }
コード例 #21
0
 public FontPointStyle()
     : base()
 {
     PointType           = PointType.Character;
     CharacterSolidBrush = new GeoSolidBrush(GeoColor.StandardColors.Black);
 }
コード例 #22
0
        protected override void DrawAreaCore(IEnumerable <ScreenPointF[]> screenPoints, GeoPen outlinePen, GeoBrush fillBrush, DrawingLevel drawingLevel, float xOffset, float yOffset, PenBrushDrawingOrder penBrushDrawingOrder)
        {
            if (fillBrush == null)
            {
                fillBrush = new GeoSolidBrush(GeoColor.SimpleColors.Transparent);
            }

            int id = 0;

            if (outlinePen != null)
            {
                id = outlinePen.GetHashCode();
            }
            else if (fillBrush != null)
            {
                id = id ^ fillBrush.GetHashCode();
            }

            if (!styleUrlDictionary.ContainsKey(id))
            {
                GeoSolidBrush          brush         = fillBrush as GeoSolidBrush;
                GeoLinearGradientBrush gradientBrush = fillBrush as GeoLinearGradientBrush;
                GeoHatchBrush          hatchBrush    = fillBrush as GeoHatchBrush;
                string kmlStyle = string.Empty;
                if (gradientBrush != null)
                {
                    kmlStyle = GetPolygonStyleKml(id, outlinePen, gradientBrush.StartColor);
                }
                else if (hatchBrush != null)
                {
                    kmlStyle = GetPolygonStyleKml(id, outlinePen, hatchBrush.BackgroundColor);
                }
                else
                {
                    kmlStyle = GetPolygonStyleKml(id, outlinePen, brush.Color);
                }
                kmlBuilder.Append(kmlStyle);
                styleUrlDictionary.Add(id, string.Format("<styleUrl>#{0}</styleUrl>", id));
            }

            StringBuilder contentStringBuilder = GetStringBuilder(drawingLevel);

            contentStringBuilder.AppendLine();
            contentStringBuilder.AppendLine(@"<Placemark>");
            contentStringBuilder.AppendLine(styleUrlDictionary[id]);
            contentStringBuilder.AppendLine(@"<Polygon>");

            contentStringBuilder.AppendLine(extrudeString);
            contentStringBuilder.AppendLine(tessellateString);
            contentStringBuilder.AppendLine(altitudeModeString);

            bool firstCoordinates = true;

            foreach (ScreenPointF[] screenPoint in screenPoints)
            {
                if (firstCoordinates)
                {
                    contentStringBuilder.AppendLine(@"<outerBoundaryIs>");
                    AppendLinearRing(screenPoint, xOffset, yOffset, contentStringBuilder);
                    contentStringBuilder.AppendLine(@"</outerBoundaryIs>");
                    firstCoordinates = false;
                }
                else
                {
                    contentStringBuilder.AppendLine(@"<innerBoundaryIs>");
                    AppendLinearRing(screenPoint, xOffset, yOffset, contentStringBuilder);
                    contentStringBuilder.AppendLine(@"</innerBoundaryIs>");
                }
            }
            contentStringBuilder.AppendLine(@"</Polygon>");
            contentStringBuilder.AppendLine(@"</Placemark>");

            foreach (ScreenPointF[] screenPoint in screenPoints)
            {
                switch (Mode)
                {
                case AltitudeMode.Absolute:
                case AltitudeMode.RelativeToGround:
                    contentStringBuilder.AppendLine(@"<Placemark>");
                    AppendLinearRing(screenPoint, xOffset, yOffset, ZHeight, contentStringBuilder);
                    contentStringBuilder.AppendLine(@"</Placemark>");
                    break;

                default:
                    break;
                }
            }
        }