public void TestEnsureVisible() { //Create a map SharpMap.Map map = new SharpMap.Map(new System.Drawing.Size(720, 360)); //Create some random sample data SharpMap.Data.FeatureDataTable fdt = cd.CreatePointFeatureDataTableFromArrays(cd.GetRandomOrdinates(80, -180, 180), cd.GetRandomOrdinates(80, -90, 90), null); //Create layer and datasource SharpMap.Layers.VectorLayer vl = new SharpMap.Layers.VectorLayer("Points", new SharpMap.Data.Providers.GeometryFeatureProvider(fdt)); //Create default style SharpMap.Styles.VectorStyle defaultStyle = new SharpMap.Styles.VectorStyle(); defaultStyle.Symbol = new System.Drawing.Bitmap(@"..\..\..\DemoWinForm\Resources\flag.png"); defaultStyle.SymbolScale = 0.5f; //Create theming class and apply to layer SymbolRotationTheming srt = new SymbolRotationTheming("Rotation", defaultStyle); vl.Theme = new SharpMap.Rendering.Thematics.CustomTheme(srt.GetRotatedSymol); map.Layers.Add(vl); map.ZoomToExtents(); map.Zoom = 60; //2*30 map.Center = new SharpMap.Geometries.Point(0, 0); System.Console.WriteLine(map.Center); EnsureVisible(map, new SharpMap.Geometries.Point(-30, 0)); System.Console.WriteLine(map.Center); System.Console.WriteLine(); EnsureVisible(map, new SharpMap.Geometries.Point(15, 20)); System.Console.WriteLine(map.Center); System.Console.WriteLine(); EnsureVisible(map, new SharpMap.Geometries.Point(15, -20)); System.Console.WriteLine(map.Center); }
public void TestEnsureVisible() { //Create a map SharpMap.Map map = new SharpMap.Map(new System.Drawing.Size(720,360)); //Create some random sample data SharpMap.Data.FeatureDataTable fdt = cd.CreatePointFeatureDataTableFromArrays(cd.GetRandomOrdinates(80, -180, 180), cd.GetRandomOrdinates(80, -90, 90), null); //Create layer and datasource SharpMap.Layers.VectorLayer vl = new SharpMap.Layers.VectorLayer("Points", new SharpMap.Data.Providers.FeatureProvider(fdt)); //Create default style SharpMap.Styles.VectorStyle defaultStyle = new SharpMap.Styles.VectorStyle(); defaultStyle.Symbol = new System.Drawing.Bitmap(@"..\..\..\DemoWinForm\Resources\flag.png"); defaultStyle.SymbolScale = 0.5f; //Create theming class and apply to layer var srt = new SymbolRotationTheming("Rotation", defaultStyle); vl.Theme = new SharpMap.Rendering.Thematics.CustomTheme(srt.GetRotatedSymol); map.Layers.Add(vl); map.ZoomToExtents(); map.Zoom = 60; //2*30 map.Center = new GeoAPI.Geometries.Coordinate(0,0); System.Console.WriteLine(map.Center); EnsureVisible(map, new GeoAPI.Geometries.Coordinate(-30, 0)); System.Console.WriteLine(map.Center); System.Console.WriteLine(); EnsureVisible(map, new GeoAPI.Geometries.Coordinate(15, 20)); System.Console.WriteLine(map.Center); System.Console.WriteLine(); EnsureVisible(map, new GeoAPI.Geometries.Coordinate(15, -20)); System.Console.WriteLine(map.Center); }
public void TestSymbolRotationTheming() { //Create a map SharpMap.Map map = new SharpMap.Map(new System.Drawing.Size(720, 360)); //Create some random sample data SharpMap.Data.FeatureDataTable fdt = cd.CreatePointFeatureDataTableFromArrays(cd.GetRandomOrdinates(80, -180, 180), cd.GetRandomOrdinates(80, -90, 90), null); //Add rotation column and fill with random rotation values fdt.Columns.Add("Rotation", typeof(System.Double)); foreach (SharpMap.Data.FeatureDataRow row in fdt.Rows) { row["Rotation"] = _randomNumberGenerator.NextDouble() * 360d; } //Create layer and datasource SharpMap.Layers.VectorLayer vl = new SharpMap.Layers.VectorLayer("Points", new SharpMap.Data.Providers.FeatureProvider(fdt)); //Create default style SharpMap.Styles.VectorStyle defaultStyle = new SharpMap.Styles.VectorStyle(); defaultStyle.Symbol = new System.Drawing.Bitmap(@"..\..\..\DemoWinForm\Resources\flag.png"); defaultStyle.SymbolScale = 0.5f; //Create theming class and apply to layer SymbolRotationTheming srt = new SymbolRotationTheming("Rotation", defaultStyle); vl.Theme = new SharpMap.Rendering.Thematics.CustomTheme(srt.GetRotatedSymol); map.Layers.Add(vl); map.ZoomToExtents(); System.Drawing.Image mapImage = map.GetMap(); mapImage.Save("SymbolRotation.bmp"); }
public void TestSymbolRotationTheming() { //Create a map SharpMap.Map map = new SharpMap.Map(new System.Drawing.Size(720,360)); //Create some random sample data SharpMap.Data.FeatureDataTable fdt = cd.CreatePointFeatureDataTableFromArrays(cd.GetRandomOrdinates(80, -180, 180), cd.GetRandomOrdinates(80, -90, 90), null); //Add rotation column and fill with random rotation values fdt.Columns.Add("Rotation", typeof (System.Double)); foreach (SharpMap.Data.FeatureDataRow row in fdt.Rows) row["Rotation"] = _randomNumberGenerator.NextDouble()*360d; //Create layer and datasource SharpMap.Layers.VectorLayer vl = new SharpMap.Layers.VectorLayer("Points", new SharpMap.Data.Providers.FeatureProvider(fdt)); //Create default style SharpMap.Styles.VectorStyle defaultStyle = new SharpMap.Styles.VectorStyle(); defaultStyle.Symbol = new System.Drawing.Bitmap(@"..\..\..\DemoWinForm\Resources\flag.png"); defaultStyle.SymbolScale = 0.5f; //Create theming class and apply to layer SymbolRotationTheming srt = new SymbolRotationTheming("Rotation", defaultStyle); vl.Theme = new SharpMap.Rendering.Thematics.CustomTheme(srt.GetRotatedSymol); map.Layers.Add(vl); map.ZoomToExtents(); System.Drawing.Image mapImage = map.GetMap(); mapImage.Save("SymbolRotation.bmp"); }