/// <summary> /// Creates a new Custom Polygon symbolizer with the specified properties /// </summary> /// <param name="uniqueName">the unique name</param> /// <param name="name">the name of the custom symbolizer</param> /// <param name="category">the map category of the custom symbolizer</param> /// <param name="symbolizer">the associated Polygon symbolizer</param> public CustomPolygonSymbolizer(string uniqueName, string name, string category, PolygonSymbolizer symbolizer) { UniqueName = uniqueName; Name = name; Category = category; base.Symbolizer = symbolizer; }
public FrmConsulta() { InitializeComponent(); this.dateTimeFecha.Format = DateTimePickerFormat.Custom; this.dateTimeFecha.CustomFormat = " "; map1.Projection = KnownCoordinateSystems.Geographic.World.WGS1984; map1.AddLayer(AssemblyDirectory + "/Shapes/Departamentos.shp"); map1.AddLayer(AssemblyDirectory + "/Shapes/Planchas_100K.shp"); map1.AddLayer(AssemblyDirectory + "/Shapes/Municipios.shp"); map1.Layers[0].UseDynamicVisibility = true; map1.Layers[0].DynamicVisibilityWidth = 25; map1.Layers[0].DynamicVisibilityMode = DynamicVisibilityMode.ZoomedIn; map1.Layers[1].UseDynamicVisibility = true; map1.Layers[1].DynamicVisibilityWidth = 8; map1.Layers[1].DynamicVisibilityMode = DynamicVisibilityMode.ZoomedIn; map1.Layers[2].UseDynamicVisibility = true; map1.Layers[2].DynamicVisibilityWidth = 8; map1.Layers[2].DynamicVisibilityMode = DynamicVisibilityMode.ZoomedIn; MapPolygonLayer stateLayer1 = default(MapPolygonLayer); MapPolygonLayer stateLayer2 = default(MapPolygonLayer); MapPolygonLayer stateLayer3 = default(MapPolygonLayer); stateLayer1 = (MapPolygonLayer)map1.Layers[0]; stateLayer2 = (MapPolygonLayer)map1.Layers[1]; stateLayer3 = (MapPolygonLayer)map1.Layers[2]; stateLayer2.AddLabels("[PLANCHA]", new Font("Tahoma", (float)8.0), Color.Black); stateLayer2.LabelLayer.UseDynamicVisibility = true; stateLayer2.LabelLayer.DynamicVisibilityWidth = 8; stateLayer2.LabelLayer.DynamicVisibilityMode = DynamicVisibilityMode.ZoomedIn; stateLayer3.AddLabels("[MUNICIPIO]", new Font("Tahoma", (float)6.0), Color.Red); stateLayer3.LabelLayer.UseDynamicVisibility = true; stateLayer3.LabelLayer.DynamicVisibilityWidth = 8; stateLayer3.LabelLayer.DynamicVisibilityMode = DynamicVisibilityMode.ZoomedIn; PolygonSymbolizer poligonoblanco1 = new PolygonSymbolizer(Color.Empty); poligonoblanco1.OutlineSymbolizer = new LineSymbolizer(Color.Black, 1); stateLayer1.Symbolizer = poligonoblanco1; PolygonSymbolizer poligonoblanco2 = new PolygonSymbolizer(Color.Empty); poligonoblanco2.OutlineSymbolizer = new LineSymbolizer(Color.Blue, 1); stateLayer2.Symbolizer = poligonoblanco2; PolygonSymbolizer poligonoblanco3 = new PolygonSymbolizer(Color.Empty); poligonoblanco3.OutlineSymbolizer = new LineSymbolizer(Color.Green, 1); stateLayer3.Symbolizer = poligonoblanco3; llenarComboBox(); map1.Refresh(); }
private void CreateMap() { String BasePath = Server.MapPath(@"~\Shape"); WebMap1.Projection = KnownCoordinateSystems.Projected.World.WebMercator; WebMap1.MapViewExtents = new Extent(-20037508.342789, -20037508.342789, 20037508.342789, 20037508.342789); WebMapClient client = new WebMapClient(); WMTClient WMT1 = new WMTClient(); WMT1.Create(WebServiceType.BingHybrid); string WMSServerWMS0 = "http://maps.ngdc.noaa.gov/soap/web_mercator/nos_hydro/MapServer/WMSServer"; WMSClient WMS0 = new WMSClient(); WMS0.ReadCapabilities(WMSServerWMS0); WMS0.CRS = "EPSG:3857"; WMS0.Projection = KnownCoordinateSystems.Projected.World.WebMercator; string WMSServerWMS1 = "http://maps.ngdc.noaa.gov/soap/web_mercator/graticule/MapServer/WMSServer"; WMSClient WMS1 = new WMSClient(); WMS1.ReadCapabilities(WMSServerWMS1); WMS1.CRS = "EPSG:3857"; WMS1.Projection = KnownCoordinateSystems.Projected.World.WebMercator; client.AddService(WMT1); client.AddService(WMS0); client.AddService(WMS1); WebMap1.Back = client; IMapFeatureLayer CountriesLayer = (IMapFeatureLayer)WebMap1.AddLayer(BasePath + @"\10m_admin_0_countries.shp"); PolygonSymbolizer SymbCountries = new PolygonSymbolizer(Color.FromArgb(0, 191, 0)); SymbCountries.SetFillColor(Color.Transparent); SymbCountries.OutlineSymbolizer = new LineSymbolizer(Color.Magenta, 1); CountriesLayer.Symbolizer = SymbCountries; IMapFeatureLayer Graticules30Layer = (IMapFeatureLayer)WebMap1.AddLayer(BasePath + @"\10m_graticules_30.shp"); LineSymbolizer SymbGratitules30 = new LineSymbolizer(Color.Red, 1); Graticules30Layer.Symbolizer = SymbGratitules30; Graticules30Layer.IsVisible = false; }
private static List <CustomSymbolizer> GetBasicPolygonSymbols() { List <CustomSymbolizer> lst = new List <CustomSymbolizer>(); PolygonSymbolizer s1 = new PolygonSymbolizer(); s1.SetFillColor(Color.Beige); lst.Add(new CustomSymbolizer(s1, "poly01", "polygon 1", "default")); PolygonSymbolizer s2 = new PolygonSymbolizer(); s2.SetFillColor(Color.LightGreen); s2.SetOutlineWidth(2.0); s2.OutlineSymbolizer.SetFillColor(Color.Red); lst.Add(new CustomSymbolizer(s2, "poly02", "polygon 2", "category2")); return(lst); }
private static void DeserializeLayerAlternateVersion(dynamic shapefileProperties, MapPolygonLayer polyLayer) { var polySymbolizer = new PolygonSymbolizer(); var outlineColor = LegacyDeserializer.GetColor(shapefileProperties.DefaultDrawingOptions["LineColor"]); var outlineWidth = Convert.ToDouble(shapefileProperties.DefaultDrawingOptions["LineWidth"]); polySymbolizer.SetOutline(outlineColor, outlineWidth); if (Convert.ToBoolean(shapefileProperties.DefaultDrawingOptions["FillVisible"])) { Color color = LegacyDeserializer.GetColor(shapefileProperties.DefaultDrawingOptions["FillBgColor"]); float transparency = Convert.ToInt32(shapefileProperties.DefaultDrawingOptions["FillTransparency"]) / 255f; color = color.ToTransparent(transparency); polySymbolizer.SetFillColor(color); } else { polySymbolizer.SetFillColor(Color.Transparent); } polyLayer.Symbolizer = polySymbolizer; }
/// <summary> /// Creates a new CustomSymbolizer for symbolizing Polygons /// </summary> public CustomPolygonSymbolizer() { Symbolizer = new PolygonSymbolizer(); }
/// <summary> /// Creates a new PolygonCategory with the specified image being tiled within the category. /// The simple outline characteristics are also defined. /// </summary> /// <param name="picture">The picture to draw</param> /// <param name="wrap">The way to wrap the picture</param> /// <param name="angle">The angle to rotate the image</param> /// <param name="outlineColor">The color to use</param> /// <param name="outlineWidth">The outline width</param> public PolygonCategory(Image picture, WrapMode wrap, double angle, Color outlineColor, double outlineWidth) { Symbolizer = new PolygonSymbolizer(picture, wrap, angle, outlineColor, outlineWidth); SelectionSymbolizer = new PolygonSymbolizer(Color.Cyan, Color.DarkCyan); }
/// <summary> /// Specifies a category that is made up from a simple color. /// </summary> /// <param name="fillColor">The color to fill the polygons with</param> /// <param name="outlineColor">The border color for the polygons</param> /// <param name="outlineWidth">The width of the line drawn on the border</param> public PolygonCategory(Color fillColor, Color outlineColor, double outlineWidth) { Symbolizer = new PolygonSymbolizer(fillColor, outlineColor, outlineWidth); SelectionSymbolizer = new PolygonSymbolizer(Color.Cyan, Color.DarkCyan, outlineWidth); }
private static List<CustomSymbolizer> getBasicPolygonSymbols() { List<CustomSymbolizer> lst = new List<CustomSymbolizer>(); PolygonSymbolizer s1 = new PolygonSymbolizer(); s1.SetFillColor(Color.Beige); lst.Add(new CustomSymbolizer(s1, "poly01", "polygon 1", "default")); PolygonSymbolizer s2 = new PolygonSymbolizer(); s2.SetFillColor(Color.LightGreen); s2.SetOutlineWidth(2.0); s2.OutlineSymbolizer.SetFillColor(Color.Red); lst.Add(new CustomSymbolizer(s2, "poly02", "polygon 2", "category2")); return lst; }
/// <summary> /// Creates a new instance of a Gradient Pattern using the specified colors and angle /// </summary> /// <param name="startColor">The start color</param> /// <param name="endColor">The end color</param> /// <param name="angle">The direction of the gradient</param> /// <param name="style">The type of gradient to use</param> /// <param name="outlineColor">The color to use for the border symbolizer</param> /// <param name="outlineWidth">The width of the line to use for the border symbolizer</param> public PolygonCategory(Color startColor, Color endColor, double angle, GradientType style, Color outlineColor, double outlineWidth) { Symbolizer = new PolygonSymbolizer(startColor, endColor, angle, style, outlineColor, outlineWidth); SelectionSymbolizer = new PolygonSymbolizer(Color.LightCyan, Color.DarkCyan, angle, style, Color.DarkCyan, outlineWidth); }
/// <summary> /// Creates a new PolygonCategory with the specified image being tiled within the category. /// The s /// </summary> /// <param name="picture">The picture to draw</param> /// <param name="wrap">The way to wrap the picture</param> /// <param name="angle">The angle to rotate the image</param> public PolygonCategory(Image picture, WrapMode wrap, double angle) { Symbolizer = new PolygonSymbolizer(picture, wrap, angle); SelectionSymbolizer = new PolygonSymbolizer(Color.Cyan); }
/// <summary> /// Creates a new instance of PointSchemeCategory /// </summary> public PolygonCategory() { Symbolizer = new PolygonSymbolizer(); SelectionSymbolizer = new PolygonSymbolizer(true); }
/// <summary> /// Deserializes the layer. /// </summary> /// <param name="layer">The layer.</param> /// <param name="polyLayer">The poly layer.</param> internal static void DeserializeLayer(dynamic layer, MapPolygonLayer polyLayer) { if (UseAlternateParser(layer)) { DeserializeLayerAlternateVersion(layer.ShapefileProperties, polyLayer); return; } var polySymbolizer = new PolygonSymbolizer(); var outlineColor = LegacyDeserializer.GetColor(layer.ShapeFileProperties["OutLineColor"]); var outlineWidth = Convert.ToDouble(layer.ShapeFileProperties["LineOrPointSize"]); polySymbolizer.SetOutline(outlineColor, outlineWidth); if (Convert.ToBoolean(layer.ShapeFileProperties["DrawFill"])) { Color color = LegacyDeserializer.GetColor(layer.ShapeFileProperties["Color"]); float transparency = Convert.ToSingle(layer.ShapeFileProperties["TransparencyPercent"]); color = color.ToTransparent(transparency); polySymbolizer.SetFillColor(color); } else { polySymbolizer.SetFillColor(Color.Transparent); } polyLayer.Symbolizer = polySymbolizer; try { int fieldIndex = Convert.ToInt32(layer.ShapeFileProperties.Legend["FieldIndex"]); // we have to clear the categories or the collection ends up with a default item polyLayer.Symbology.Categories.Clear(); foreach (var colorBreak in layer.ShapeFileProperties.Legend.ColorBreaks.Elements()) { PolygonCategory category; string startValue = colorBreak["StartValue"]; string endValue = colorBreak["EndValue"]; if (startValue == endValue) { category = new PolygonCategory(LegacyDeserializer.GetColor(colorBreak["StartColor"]), LegacyDeserializer.GetColor(colorBreak["StartColor"]), 0); category.FilterExpression = String.Format("[{0}] = '{1}'", polyLayer.DataSet.DataTable.Columns[fieldIndex].ColumnName, startValue); category.LegendText = startValue; } else { category = new PolygonCategory(LegacyDeserializer.GetColor(colorBreak["StartColor"]), LegacyDeserializer.GetColor(colorBreak["EndColor"]), 0, GradientType.Linear, outlineColor, outlineWidth); category.FilterExpression = String.Format("'{2}' >= [{0}] >= '{1}'", polyLayer.DataSet.DataTable.Columns[fieldIndex].ColumnName, startValue, endValue); category.LegendText = String.Format("{0} - {1}", startValue, endValue); } category.LegendText = startValue; category.LegendItemVisible = Convert.ToBoolean(colorBreak["Visible"]); polyLayer.Symbology.AddCategory(category); } // it took too a lot of work to figure out that we would need to do this... polyLayer.ApplyScheme(polyLayer.Symbology); } catch (RuntimeBinderException) { // ignore and continue. // this means the legend is not available. } }
/// <summary> /// Constructor /// </summary> public LayoutRectangle() { Name = "Rectangle"; Background = new PolygonSymbolizer(Color.Transparent, Color.Black, 2.0); ResizeStyle = ResizeStyle.HandledInternally; }
public IPolygonSymbolizer ToPolygonSymbolizer() { PolygonSymbolizer ps = new PolygonSymbolizer(); ps.SetFillColor(this.Color.ToDrawingColor()); ps.SetOutline(this.PolygonBorderColor.ToDrawingColor(), this.PolygonBorderSize); return ps; }