/// <summary> /// This function create a random ellipse /// </summary> public static Ellipse CreateEllipse() { IPosition position = Helper.CreateRandomPosition(); double x = position.Latitude; double y = position.Longitude; double a = 50000; //axes in meters double b = 22000; //axes in meters var rotation = 0; var k = Math.Ceiling(36 * (Math.Max(a / b, b / a))); List <IPosition> coords = new List <IPosition>(); for (var i = 0; i <= k; i++) { // get the current angle var angle = Math.PI * 2 / k * i + rotation; // get the radius at that angle double r = a * b / Math.Sqrt(a * a * Math.Sin(angle) * Math.Sin(angle) + b * b * Math.Cos(angle) * Math.Cos(angle)); coords.Add(GeometryHelper.GetLatLong(new Position(x, y), angle, r)); } ISymbolizer symbolizer = Helper.CreateRandomSymbolizer(); Ellipse ellipse = new Ellipse(new List <LineString> { new LineString(coords) }); ellipse.Symbolizer = symbolizer; return(ellipse); }
/// <summary> /// Creates an instance of this class /// </summary> /// <param name="layerName">The name of the layer</param> /// <param name="dataSource">The data source</param> /// <param name="symbolizer">The symbolizer</param> protected BaseVectorLayer(string layerName, IProvider dataSource, ISymbolizer <TGeometry> symbolizer) : base(new Style(), new VectorRendererAdapter()) { LayerName = layerName; _dataSource = dataSource; Symbolizer = symbolizer; }
internal static Image CreatePuntalSymbol(Size symbolSize, ISymbolizer sym) { using (var map = new Map(symbolSize)) { var l = new PuntalVectorLayer("0", new GeometryProvider( map.Factory.CreatePoint(new Coordinate(symbolSize.Width / 2d, symbolSize.Height / 2d)))); var s = (IPointSymbolizer)sym.Clone(); s.Offset = new PointF(0, 0); if (s.Size.Width > symbolSize.Width) { s.Scale = (float)symbolSize.Width / s.Size.Width; } if (s.Size.Height * s.Scale > symbolSize.Height) { s.Scale = (float)symbolSize.Height / s.Size.Height; } s.Scale *= 0.8f; l.Symbolizer = s; map.Layers.Add(l); map.ZoomToBox(new Envelope(0, symbolSize.Width, 0, symbolSize.Height)); return(map.GetMap()); } }
private static Map CreateMap(Size size, ISymbolizer symbolizer) { var map = new Map(size); map.ZoomToBox(new Envelope(0, size.Width, 0, size.Height)); return(map); }
public MainWindow() { InitializeComponent(); converter = new ToneBasedSymbolizer(); converter.DefaultPalette = new AsciiPalette(new []{' ', '.', '+', ':', '&'}, true); converter.DefaultBlockSize = new System.Drawing.Size(10, 10); }
private static bool IsLineSymbolizer(ISymbolizer symolizer) { if (symolizer is ISymbolizer<ILineal>) return true; if (symolizer is ISymbolizer<IGeometry>) return true; return false; }
private static bool IsPolygonSymbolizer(ISymbolizer symolizer) { if (symolizer is ISymbolizer<IPolygonal>) return true; if (symolizer is ISymbolizer<IGeometry>) return true; return false; }
public MainWindow() { InitializeComponent(); converter = new ToneBasedSymbolizer(); converter.DefaultPalette = new AsciiPalette(new [] { ' ', '.', '+', ':', '&' }, true); converter.DefaultBlockSize = new System.Drawing.Size(10, 10); }
/// <summary> /// This function create a random circle /// </summary> public static Circle CreateCircle() { IPosition position = Helper.CreateRandomPosition(); ISymbolizer symbolizer = Helper.CreateRandomSymbolizer(); Circle circle = new Circle(position); circle.Symbolizer = symbolizer; return(circle); }
private static Image CreateSymbolizerImage(ILegendFactory factory, ISymbolizer symbolizer) { var lif = factory[symbolizer]; if (lif != null) { var item = lif.Create(null, symbolizer); return(item.Symbol); } return(null); }
private static bool IsLineSymbolizer(ISymbolizer symolizer) { if (symolizer is ISymbolizer <ILineal> ) { return(true); } if (symolizer is ISymbolizer <IGeometry> ) { return(true); } return(false); }
private static bool IsPolygonSymbolizer(ISymbolizer symolizer) { if (symolizer is ISymbolizer <IPolygonal> ) { return(true); } if (symolizer is ISymbolizer <IGeometry> ) { return(true); } return(false); }
internal static Image CreateLinealSymbol(Size symbolSize, ISymbolizer sym) { using (var map = new Map(symbolSize)) { var l = new LinealVectorLayer("0", new GeometryProvider( map.Factory.CreateLineString(new[] { new Coordinate(2, 2), new Coordinate(8, 12), new Coordinate(12, 11), new Coordinate(22, 2) }))); l.Symbolizer = (ILineSymbolizer)sym.Clone(); map.Layers.Add(l); map.ZoomToBox(new Envelope(0, symbolSize.Width, 0, symbolSize.Height)); return(map.GetMap()); } }
public static Image CreatePolygonalSymbol(Size symbolSize, ISymbolizer sym) { using (var map = new Map(symbolSize)) { var l = new PolygonalVectorLayer("0", new GeometryProvider( map.Factory.ToGeometry(new Envelope(2, symbolSize.Width - 4, 2, symbolSize.Height - 4)))); l.Symbolizer = (IPolygonSymbolizer)sym.Clone(); map.Layers.Add(l); map.ZoomToBox(new Envelope(0, symbolSize.Width, 0, symbolSize.Height)); return(map.GetMap()); } }
public SymbolCollection(ISymbolizer parent) : base(parent) { }
private static Map CreateMap(Size size, ISymbolizer symbolizer) { var map = new Map(size); map.ZoomToBox(new Envelope(0, size.Width, 0, size.Height)); return map; }
public static Image CreatePolygonalSymbol(Size symbolSize, ISymbolizer sym) { using (var map = new Map(symbolSize)) { var l = new PolygonalVectorLayer("0", new GeometryProvider( map.Factory.ToGeometry(new Envelope(2, symbolSize.Width - 4, 2, symbolSize.Height - 4)))); l.Symbolizer = (IPolygonSymbolizer)sym.Clone(); map.Layers.Add(l); map.ZoomToBox(new Envelope(0, symbolSize.Width, 0, symbolSize.Height)); return map.GetMap(); } }
internal static Image CreateLinealSymbol(Size symbolSize, ISymbolizer sym) { using (var map = new Map(symbolSize)) { var l = new LinealVectorLayer("0", new GeometryProvider( map.Factory.CreateLineString(new[] { new Coordinate(2, 2), new Coordinate(8, 12), new Coordinate(12, 11), new Coordinate(22, 2) }))); l.Symbolizer = (ILineSymbolizer)sym.Clone(); map.Layers.Add(l); map.ZoomToBox(new Envelope(0, symbolSize.Width, 0, symbolSize.Height)); return map.GetMap(); } }
/// <summary> /// Creates an instance of this class /// </summary> /// <param name="layerName">The layer's name</param> /// <param name="dataSource">The layer's datasource</param> /// <param name="symbolizer">The layer's symbolizer</param> public PolygonalVectorLayer(string layerName, IProvider dataSource, ISymbolizer <IPolygonal> symbolizer) : base(layerName, dataSource, symbolizer) { }
/// <summary> /// Creates an instance of this class /// </summary> /// <param name="layerName">The name of the layer</param> /// <param name="dataSource">The data source</param> /// <param name="symbolizer">The symbolizer</param> protected BaseVectorLayer(string layerName, IProvider dataSource, ISymbolizer <TGeometry> symbolizer) { LayerName = layerName; _dataSource = dataSource; Symbolizer = symbolizer; }
internal static Image CreatePuntalSymbol(Size symbolSize, ISymbolizer sym) { using (var map = new Map(symbolSize)) { var l = new PuntalVectorLayer("0", new GeometryProvider( map.Factory.CreatePoint(new Coordinate(symbolSize.Width / 2d, symbolSize.Height / 2d)))); var s = (IPointSymbolizer)sym.Clone(); s.Offset = new PointF(0, 0); if (s.Size.Width > symbolSize.Width) s.Scale = (float)symbolSize.Width / s.Size.Width; if (s.Size.Height * s.Scale > symbolSize.Height) s.Scale = (float)symbolSize.Height / s.Size.Height; s.Scale *= 0.8f; l.Symbolizer = s; map.Layers.Add(l); map.ZoomToBox(new Envelope(0, symbolSize.Width, 0, symbolSize.Height)); return map.GetMap(); } }
public void SetUp() { symbolizer = new ToneBasedSymbolizer(); palette = new AsciiPalette(new char[] { ' ', '.', '+', 'N', '&' }, true); }