/// <summary> /// Creates a new Custom Point 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 Point symbolizer</param> public CustomPointSymbolizer(string uniqueName, string name, string category, PointSymbolizer symbolizer) { UniqueName = uniqueName; Name = name; Category = category; base.Symbolizer = symbolizer; }
/// <summary> /// Creates a category from the single symbol specified. If the symbol is colorable, /// the color of the selection symbol will be duplicated, but set to cyan. /// </summary> /// <param name="symbol"></param> public PointCategory(ISymbol symbol) { Symbolizer = new PointSymbolizer(symbol); ISymbol copy = symbol.Copy(); IColorable c = copy as IColorable; if (c != null) { c.Color = Color.Cyan; } SelectionSymbolizer = new PointSymbolizer(copy); }
/// <summary> /// Creates a category where the picture is used for the symbol, and a selected /// symbol is created as the same symbol but with a cyan border. /// </summary> /// <param name="picture">The image to use</param> /// <param name="size">The size of the symbol</param> public PointCategory(Image picture, double size) { Symbolizer = new PointSymbolizer(picture, size); PictureSymbol ps = new PictureSymbol(picture, size) { OutlineColor = Color.Cyan, OutlineWidth = 2, OutlineOpacity = 1f }; SelectionSymbolizer = new PointSymbolizer(ps); }
private static List<CustomSymbolizer> getBasicPointSymbols() { List<CustomSymbolizer> lst = new List<CustomSymbolizer>(); PointSymbolizer s1 = new PointSymbolizer(); const char ch = '\u21e6'; s1.Symbols.Add(new CharacterSymbol(ch, "arial", Color.Blue, 10.0)); lst.Add(new CustomSymbolizer(s1, "symbol01", "arrow1", "arrows")); PointSymbolizer s2 = new PointSymbolizer(Color.Beige, PointShape.Ellipse, 7.0); lst.Add(new CustomSymbolizer(s2, "symbol02", "circle1", "default")); return lst; }
/// <summary> /// Creates a new Point Category from the list of symbols /// </summary> /// <param name="symbols"></param> public PointCategory(IEnumerable <ISymbol> symbols) { Symbolizer = new PointSymbolizer(symbols); List <ISymbol> copy = symbols.CloneList(); if (copy.Any()) { IColorable c = symbols.Last() as IColorable; if (c != null) { c.Color = Color.Cyan; } } SelectionSymbolizer = new PointSymbolizer(copy); }
private static List <CustomSymbolizer> GetBasicPointSymbols() { List <CustomSymbolizer> lst = new List <CustomSymbolizer>(); PointSymbolizer s1 = new PointSymbolizer(); const char Ch = '\u21e6'; s1.Symbols.Add(new CharacterSymbol(Ch, "arial", Color.Blue, 10.0)); lst.Add(new CustomSymbolizer(s1, "symbol01", "arrow1", "arrows")); PointSymbolizer s2 = new PointSymbolizer(Color.Beige, PointShape.Ellipse, 7.0); lst.Add(new CustomSymbolizer(s2, "symbol02", "circle1", "default")); return(lst); }
/// <summary> /// Initializes a new instance of the <see cref="PointCategory"/> class from the list of symbols. /// </summary> /// <param name="symbols">Symbols used for this category.</param> public PointCategory(IEnumerable <ISymbol> symbols) { var symb = symbols as IList <ISymbol> ?? symbols.ToList(); Symbolizer = new PointSymbolizer(symb); List <ISymbol> copy = symb.CloneList(); if (copy.Any()) { if (symb.Last() is IColorable c) { c.Color = Color.Cyan; } } SelectionSymbolizer = new PointSymbolizer(copy); }
/// <summary> /// Creates a simple point category where the symbolizer is based on the simple characteristics. /// The selection symbolizer has the same shape and size, but will be colored cyan. /// </summary> /// <param name="color">The color of the regular symbolizer</param> /// <param name="shape">The shape of the regular symbolizer</param> /// <param name="size">the size of the regular symbolizer</param> public PointCategory(Color color, PointShape shape, double size) { Symbolizer = new PointSymbolizer(color, shape, size); SelectionSymbolizer = new PointSymbolizer(Color.Cyan, shape, size); }
/// <summary> /// Creates a new Point Category based on the specified character /// </summary> /// <param name="character">The character to use for the symbol</param> /// <param name="fontFamilyName">The font family name to use as the font</param> /// <param name="color">The color of the character</param> /// <param name="size">The size of the symbol</param> public PointCategory(char character, string fontFamilyName, Color color, double size) { Symbolizer = new PointSymbolizer(character, fontFamilyName, color, size); SelectionSymbolizer = new PointSymbolizer(character, fontFamilyName, Color.Cyan, size); }
internal void CreateLayers() { Envelope env = new Envelope(); if (this.Model.SigLayer != null) { if (this.Model.SigLayer.SigCodeLayer.Code == "Geocodage") { FeatureSet featureSetPoint = new FeatureSet(FeatureType.Point); featureSetPoint.Projection = DotSpatial.Projections.KnownCoordinateSystems.Geographic.World.WGS1984; PointSymbolizer featureSetPointSymbolizer = new PointSymbolizer(System.Drawing.Color.Red, DotSpatial.Symbology.PointShape.Ellipse, 10); FeatureSet featureSetLine = new FeatureSet(FeatureType.Line); featureSetLine.Projection = DotSpatial.Projections.KnownCoordinateSystems.Geographic.World.WGS1984; IDataService dataService = ServiceLocator.Current.GetInstance<IDataService>(); ICartoService cartoService = ServiceLocator.Current.GetInstance<ICartoService>(); EntityTableInfo tableInfo = dataService.GetEntityTableInfo(this.Model.SigLayer.EntityName); IQueryable queryable = dataService.GetDbSet(tableInfo.EntityType).AsQueryable(); EntityColumnInfo columnGeom = (from c in tableInfo.ColumnInfos where c.IsLocalisationReferenceGeom select c).FirstOrDefault(); EntityColumnInfo columnRef = (from c in tableInfo.ColumnInfos where c.IsLocalisationReferenceId select c).FirstOrDefault(); EntityColumnInfo columnDeb = (from c in tableInfo.ColumnInfos where c.IsLocalisationDeb select c).FirstOrDefault(); EntityColumnInfo columnFin = (from c in tableInfo.ColumnInfos where c.IsLocalisationFin select c).FirstOrDefault(); foreach (Object item in queryable) { Geometry geometry = null; if (columnGeom != null) { Object dataGeom = columnGeom.Property.GetValue(item); if (dataGeom != null) {geometry = WktHelper.CreateGeometryFromWkt(dataGeom.ToString());} } if (geometry == null && columnRef != null && columnDeb != null) { Object objRef = columnRef.Property.GetValue(item); Object objDeb = columnDeb.Property.GetValue(item); if (columnFin == null) { if (objRef != null && objRef is Int64 && objDeb != null && objDeb is Int64) { geometry = cartoService.Geocode((Int64)objRef, (Int64)objDeb ); } } else { Object objFin = columnFin.Property.GetValue(item); if (objRef != null && objRef is Int64 && objDeb != null && objDeb is Int64) { if (objFin != null && objFin is Int64) { geometry = cartoService.Geocode((Int64)objRef, (Int64)objDeb, (Int64)objFin); } else { geometry = cartoService.Geocode((Int64)objRef, (Int64)objDeb); } } } } if (geometry != null) { if (geometry is Point) { featureSetPoint.AddFeature(geometry); env.ExpandToInclude((geometry as Point).Coordinate); } else if (geometry is LineString) { featureSetLine.AddFeature(geometry); env.ExpandToInclude(geometry.Envelope); } else if (geometry is MultiLineString ) { featureSetLine.AddFeature(geometry); env.ExpandToInclude(geometry.Envelope); } } } this.Layers.Add(new MapLineLayer(featureSetLine)); this.Layers.Add(new MapPointLayer(featureSetPoint)); } } this.Envelope = env; }
/// <summary> /// Creates a new instance of a default point scheme category where the geographic symbol size has been /// scaled to the specified extent. /// </summary> /// <param name="extent">The geographic extent that is 100 times wider than the geographic size of the points.</param> public PointCategory(IRectangle extent) { Symbolizer = new PointSymbolizer(false, extent); SelectionSymbolizer = new PointSymbolizer(true, extent); }
/// <summary> /// Deserializes the layer. /// </summary> /// <param name="layer">The layer.</param> /// <param name="pointLayer">The point layer.</param> internal static void DeserializeLayer(dynamic layer, MapPointLayer pointLayer) { if (UseAlternateParser(layer)) { // TODO: write alternate parser for this layer information. return; } LegacyPointType typeOfPoint = (LegacyPointType)Enum.ToObject(typeof(LegacyPointType), Convert.ToInt32(layer.ShapeFileProperties["PointType"])); PointSymbolizer pointSymbolizer; if (ConvertLegacyPointTypeToPointShape(typeOfPoint) == PointShape.Undefined) { pointSymbolizer = new PointSymbolizer(); } else { var color = LegacyDeserializer.GetColor(layer.ShapeFileProperties["Color"]); var width = Convert.ToDouble(layer.ShapeFileProperties["LineOrPointSize"]); pointSymbolizer = new PointSymbolizer(color, ConvertLegacyPointTypeToPointShape(typeOfPoint), width); } pointLayer.Symbolizer = pointSymbolizer; }
/// <summary> /// Creates a new instance of PointSchemeCategory /// </summary> public PointCategory() { Symbolizer = new PointSymbolizer(); SelectionSymbolizer = new PointSymbolizer(true); }
/// <summary> /// Creates a new CustomSymbolizer for symbolizing Points /// </summary> public CustomPointSymbolizer() { Symbolizer = new PointSymbolizer(); }
/// <summary> /// Creates a new Point Category from the list of symbols /// </summary> /// <param name="symbols"></param> public PointCategory(IEnumerable<ISymbol> symbols) { Symbolizer = new PointSymbolizer(symbols); List<ISymbol> copy = symbols.CloneList(); if (copy.Any()) { IColorable c = symbols.Last() as IColorable; if (c != null) { c.Color = Color.Cyan; } } SelectionSymbolizer = new PointSymbolizer(copy); }
/// <summary> /// Creates a new instanec of a default point scheme category where the geographic symbol size has been /// scaled to the specified extent. /// </summary> /// <param name="extent">The geographic extent that is 100 times wider than the geographic size of the points.</param> public PointCategory(IRectangle extent) { Symbolizer = new PointSymbolizer(false, extent); SelectionSymbolizer = new PointSymbolizer(true, extent); }
private Bitmap CreateDefaultSymbol(Color color, int symbolSize) { double scaleSize = 1; Size2D size = new Size2D(symbolSize, symbolSize); Bitmap normalSymbol = new Bitmap((int)(size.Width * scaleSize) + 1, (int)(size.Height * scaleSize) + 1); Graphics bg = Graphics.FromImage(normalSymbol); Random rnd = new Random(); Color randomColor = Color.FromArgb(rnd.Next(0, 255), rnd.Next(0, 255), rnd.Next(0, 255)); PointSymbolizer sym = new PointSymbolizer(randomColor, DotSpatial.Symbology.PointShape.Rectangle, 4); PointCategory category = new PointCategory(sym); bg.SmoothingMode = category.Symbolizer.Smoothing ? SmoothingMode.AntiAlias : SmoothingMode.None; Matrix trans = bg.Transform; trans.Translate(((float)(size.Width * scaleSize) / 2 - 1), (float)(size.Height * scaleSize) / 2 - 1); bg.Transform = trans; category.Symbolizer.Draw(bg, 1); return normalSymbol; }
public DotSpatial.Symbology.IPointSymbolizer ToPointSymbolizer() { SimpleSymbol s = new SimpleSymbol(this.Color.ToDrawingColor(), this.PointShape, this.PointSize); s.OutlineColor = this.PointBorderColor.ToDrawingColor(); s.OutlineWidth = this.PointBorderSize; s.PointShape = this.PointShape; s.OutlineOpacity = 1f; s.UseOutline = true; DotSpatial.Symbology.PointSymbolizer symbolizer = new DotSpatial.Symbology.PointSymbolizer(s); return symbolizer; }