本文整理汇总了C#中SharpMap.Map.GetMap方法的典型用法代码示例。如果您正苦于以下问题:C# SharpMap.Map.GetMap方法的具体用法?C# SharpMap.Map.GetMap怎么用?C# SharpMap.Map.GetMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharpMap.Map
的用法示例。
在下文中一共展示了SharpMap.Map.GetMap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestCharacterPointSymbolizer
public void TestCharacterPointSymbolizer()
{
var fdt = TestData.CreatingData.CreatePointFeatureDataTableFromArrays(
TestData.CreatingData.GetRandomOrdinates(50, -180, 180), TestData.CreatingData.GetRandomOrdinates(50, -90, 90), null);
var geometryFeatureProvider = new SharpMap.Data.Providers.GeometryFeatureProvider(fdt);
var layer = new SharpMap.Layers.VectorLayer("randompoints", geometryFeatureProvider);
var cps = new SharpMap.Rendering.Symbolizer.CharacterPointSymbolizer
{
Halo = 1,
HaloBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Wheat),
//Font = new System.Drawing.Font("Arial", 12),
CharacterIndex = 0xcc,
};
layer.Style.PointSymbolizer = cps;
var map = new SharpMap.Map(new System.Drawing.Size(720, 360));
map.Layers.Add(layer);
map.ZoomToExtents();
map.GetMap().Save("CharacterPointSymbolizer1.bmp");
cps.Rotation = -30;
cps.Offset = new System.Drawing.PointF(4, 4);
map.GetMap().Save("CharacterPointSymbolizer2.bmp");
cps.Font = new System.Drawing.Font("Arial", 12);
cps.Text = "ABC";
cps.Offset = System.Drawing.PointF.Empty;
cps.Rotation = -90;
map.GetMap().Save("CharacterPointSymbolizer3.bmp");
}
示例2: TestPathPointSymbolizer
public void TestPathPointSymbolizer()
{
var fdt = CreatingData.CreatePointFeatureDataTableFromArrays(
CreatingData.GetRandomOrdinates(50, -180, 180), CreatingData.GetRandomOrdinates(50, -90, 90), null);
var geometryFeatureProvider = new SharpMap.Data.Providers.FeatureProvider(fdt);
var layer = new SharpMap.Layers.VectorLayer("randompoints", geometryFeatureProvider);
var pps =
SharpMap.Rendering.Symbolizer.PathPointSymbolizer.CreateSquare(new System.Drawing.Pen(System.Drawing.Color.Red, 2),
new System.Drawing.SolidBrush(
System.Drawing.Color.DodgerBlue), 20);
layer.Style.PointSymbolizer = pps;
var map = new SharpMap.Map(new System.Drawing.Size(720, 360));
map.Layers.Add(layer);
map.ZoomToExtents();
map.GetMap().Save("PathPointSymbolizer1.bmp");
pps.Rotation = -30;
map.GetMap().Save("PathPointSymbolizer2.bmp");
pps.Rotation = 0f;
pps.Offset = new System.Drawing.PointF(4, 4);
map.GetMap().Save("PathPointSymbolizer3.bmp");
var gpTriangle1 = new System.Drawing.Drawing2D.GraphicsPath();
gpTriangle1.AddPolygon(new [] { new System.Drawing.Point(0, 0), new System.Drawing.Point(5, 10), new System.Drawing.Point(10, 0), new System.Drawing.Point(0, 0), });
var gpTriangle2 = new System.Drawing.Drawing2D.GraphicsPath();
gpTriangle2.AddPolygon(new[] { new System.Drawing.Point(0, 0), new System.Drawing.Point(-5, -10), new System.Drawing.Point(-10, 0), new System.Drawing.Point(0, 0), });
pps = new
SharpMap.Rendering.Symbolizer.PathPointSymbolizer(new[]
{
new SharpMap.Rendering.Symbolizer.PathPointSymbolizer.PathDefinition
{
Path = gpTriangle1,
Line =
new System.Drawing.Pen(
System.Drawing.Color.Red, 2),
Fill =
new System.Drawing.SolidBrush(
System.Drawing.Color.DodgerBlue)
},
new SharpMap.Rendering.Symbolizer.PathPointSymbolizer.PathDefinition
{
Path = gpTriangle2,
Line =
new System.Drawing.Pen(
System.Drawing.Color.DodgerBlue, 2),
Fill =
new System.Drawing.SolidBrush(
System.Drawing.Color.Red)
}
}){ Rotation = 45 };
layer.Style.PointSymbolizer = pps;
map.GetMap().Save("PathPointSymbolizer4.bmp");
pps.Rotation = 180;
map.GetMap().Save("PathPointSymbolizer5.bmp");
}
示例3: TestWarpedLineSymbolizer
public void TestWarpedLineSymbolizer()
{
var p = new SharpMap.Data.Providers.ShapeFile(@"d:\\daten\GeoFabrik\\Aurich\\roads.shp", false);
var l = new SharpMap.Layers.VectorLayer("roads", p);
var cls = new SharpMap.Rendering.Symbolizer.CachedLineSymbolizer();
cls.LineSymbolizeHandlers.Add(new SharpMap.Rendering.Symbolizer.PlainLineSymbolizeHandler { Line = new System.Drawing.Pen(System.Drawing.Color.Gold, 2) });
cls.LineSymbolizeHandlers.Add(new SharpMap.Rendering.Symbolizer.WarpedLineSymbolizeHander { Pattern = SharpMap.Rendering.Symbolizer.WarpedLineSymbolizer.GetGreaterSeries(3, 3), Line = new System.Drawing.Pen(System.Drawing.Color.Firebrick, 1) });
l.Style.LineSymbolizer = cls;
var m = new SharpMap.Map(new System.Drawing.Size(720, 540)) {BackColor = System.Drawing.Color.Cornsilk};
m.Layers.Add(l);
m.ZoomToExtents();
var sw = new System.Diagnostics.Stopwatch();
sw.Start();
var bmp = m.GetMap();
sw.Stop();
System.Console.WriteLine(string.Format("Rendering new method: {0}ms", sw.ElapsedMilliseconds));
bmp.Save("AurichRoads1.bmp");
cls.LineSymbolizeHandlers[1] = new SharpMap.Rendering.Symbolizer.WarpedLineSymbolizeHander
{
Pattern = SharpMap.Rendering.Symbolizer.WarpedLineSymbolizer.GetTriangleSeries(4, 7),
Line = new System.Drawing.Pen(System.Drawing.Color.Firebrick, 1),
Fill = new System.Drawing.SolidBrush(System.Drawing.Color.Firebrick)
};
sw.Start();
bmp = m.GetMap();
sw.Stop();
System.Console.WriteLine(string.Format("Rendering new method: {0}ms", sw.ElapsedMilliseconds));
bmp.Save("AurichRoads2.bmp");
//cls.LineSymbolizeHandlers[0] = cls.LineSymbolizeHandlers[1];
cls.LineSymbolizeHandlers[1] = new SharpMap.Rendering.Symbolizer.WarpedLineSymbolizeHander
{
Pattern = SharpMap.Rendering.Symbolizer.WarpedLineSymbolizer.GetZigZag(4, 4),
Line = new System.Drawing.Pen(System.Drawing.Color.Firebrick, 1),
//Fill = new System.Drawing.SolidBrush(System.Drawing.Color.Firebrick)
};
sw.Start();
bmp = m.GetMap();
sw.Stop();
System.Console.WriteLine(string.Format("Rendering new method: {0}ms", sw.ElapsedMilliseconds));
bmp.Save("AurichRoads3.bmp");
}
示例4: MainWindow
public MainWindow()
: base(Gtk.WindowType.Toplevel)
{
try
{
GeoAPI.GeometryServiceProvider.Instance = new NtsGeometryServices();
Build();
Size mapSize = new Size(800, 500);
myMap = new SharpMap.Map(mapSize);
SharpMap.Styles.VectorStyle style = new SharpMap.Styles.VectorStyle();
style.Outline = new Pen(Color.Green, 1);
style.EnableOutline = true;
SharpMap.Layers.VectorLayer layWorld = new SharpMap.Layers.VectorLayer("States");
layWorld.DataSource =
new SharpMap.Data.Providers.ShapeFile(
@"data" + System.IO.Path.DirectorySeparatorChar + @"states.shp", true);
layWorld.Style = style;
myMap.Layers.Add(layWorld);
myMap.MaximumZoom = 360;
myMap.BackColor = Color.LightBlue;
myMap.Center = new GeoAPI.Geometries.Coordinate(0, 0);
myMap.Zoom = 360;
Bitmap img = (Bitmap)myMap.GetMap();
image3.Pixbuf = ImageToPixbuf(img);
}
catch (Exception ex)
{
label1.Text = ex.Message;
}
}
示例5: TestListPointSymbolizer
public void TestListPointSymbolizer()
{
var fdt = TestData.CreatingData.CreatePointFeatureDataTableFromArrays(
TestData.CreatingData.GetRandomOrdinates(50, -180, 180), TestData.CreatingData.GetRandomOrdinates(50, -90, 90), null);
var geometryFeatureProvider = new SharpMap.Data.Providers.GeometryFeatureProvider(fdt);
var layer = new SharpMap.Layers.VectorLayer("randompoints", geometryFeatureProvider);
var pps =
SharpMap.Rendering.Symbolizer.PathPointSymbolizer.CreateSquare(new System.Drawing.Pen(System.Drawing.Color.Red, 2),
new System.Drawing.SolidBrush(
System.Drawing.Color.DodgerBlue), 20);
var cps = new SharpMap.Rendering.Symbolizer.CharacterPointSymbolizer
{
Halo = 1,
HaloBrush = new System.Drawing.SolidBrush(System.Drawing.Color.WhiteSmoke),
Foreground = new System.Drawing.SolidBrush(System.Drawing.Color.Black),
Font = new System.Drawing.Font("Arial", 12),
CharacterIndex = 65
};
var lps = new SharpMap.Rendering.Symbolizer.ListPointSymbolizer { pps, cps };
layer.Style.PointSymbolizer = lps;
var map = new SharpMap.Map(new System.Drawing.Size(720, 360));
map.Layers.Add(layer);
map.ZoomToExtents();
map.GetMap().Save("ListPointSymbolizer1.bmp");
}
示例6: Example2
public static void Example2()
{
var map = new SharpMap.Map(new Size(1280, 1084));
SharpMap.Data.Providers.IProvider provider =
new SharpMap.Data.Providers.ShapeFile(
@"C:\temp\Data\niedersachsen.shp\railways.shp");
var style = new SharpMap.Styles.VectorStyle();
style.Line.Brush = Brushes.White;
style.Line.DashPattern = new float[] { 4f, 4f };
style.Line.Width = 4;
style.EnableOutline = true;
style.Outline.Brush = Brushes.Black;
style.Outline.Width = 6;
var vl = new SharpMap.Layers.VectorLayer("Railways", provider)
{Style = style};
map.Layers.Add(vl);
var env = vl.Envelope;
env.ExpandBy(-0.45f *env.Width, -0.45 * env.Height);
map.ZoomToBox(env);
var mapImage = map.GetMap();
mapImage.Save("Example2.png",
System.Drawing.Imaging.ImageFormat.Png);
}
示例7: TestSymbolSelectionTheming
public void TestSymbolSelectionTheming()
{
//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("Symbol", typeof(System.Byte[]));
foreach (SharpMap.Data.FeatureDataRow row in fdt.Rows)
row["Symbol"] = RandomSymbol((int)System.Math.Floor(cd.RandomNumberGenerator.NextDouble() * 360d));
//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
SymbolFromFeatureDataRowTheming srt = new SymbolFromFeatureDataRowTheming("Symbol", defaultStyle);
vl.Theme = new SharpMap.Rendering.Thematics.CustomTheme(srt.GetRotatedSymol);
map.Layers.Add(vl);
map.ZoomToExtents();
System.Drawing.Image mapImage = map.GetMap();
mapImage.Save("SymbolFromFDR.bmp");
}
示例8: render2d
public void render2d(Project project, PictureBox picBox)
{
SharpMap.Map myMap = new SharpMap.Map();
foreach (BuildLayer layer in project.getLayers())
{
Source source = layer.getSource();
BoundingBox envelope = new BoundingBox(-1000.0, -1000.0, 1000.0, 1000.0);//TODO
FeatureDataSet ds = new FeatureDataSet();
source.DataSource.Open();
source.DataSource.ExecuteIntersectionQuery(envelope, ds);
source.DataSource.Close();
FeatureDataTable features = (FeatureDataTable)ds.Tables[0];
string label = "Trace test:\n";
foreach (FeatureDataRow row in features)
{
foreach (Object item in row.ItemArray)
label += " - " + item;
label += "\n";
}
setLabel(label);
//Show map
//Filters
FilterGraph graph = project.getFilterGraph(source.getName());
if (graph != null)
{
foreach (FeatureFilter filter in graph.getFilters())
{
//aplicar filtro segun el tipo
Mogre.DefaultSceneManagerFactory dsmf = new DefaultSceneManagerFactory();
Mogre.SceneManager sm = dsmf.CreateInstance("scenemanager");
FilterEnv env = new FilterEnv(sm, "env");
foreach (MogreGis.Resource resource in project.getResources())
{
env.getSession().Resources.addResource(resource);
}
FeatureList list = Feature.DataTableToList(features);
filter.process(list, env);
//falta devolver la lista y procesarla ***************************************
}
}
SharpMap.Layers.VectorLayer myLayer = new SharpMap.Layers.VectorLayer(layer.getName());
myLayer.DataSource = source.DataSource;
myMap.Layers.Add(myLayer);
}
myMap.Size = new Size(picBox.Width, picBox.Height);
myMap.ZoomToExtents();
picBox.Image = myMap.GetMap();
this.map = myMap;
}
示例9: TestPlainPolygonSymbolizer
public void TestPlainPolygonSymbolizer()
{
var provider = new SharpMap.Data.Providers.ShapeFile(
"..\\..\\..\\WinFormSamples\\GeoData\\World\\countries.shp", true);
var l = new SharpMap.Layers.Symbolizer.PolygonalVectorLayer("Countries", provider);
l.Symbolizer = new ModifiedBasicPolygonSymbolizer
{
Fill = new System.Drawing.Drawing2D.HatchBrush(
System.Drawing.Drawing2D.HatchStyle.WideDownwardDiagonal,
System.Drawing.Color.Red /*,
System.Drawing.Color.LightPink*/),
UseClipping = false,
//Outline = System.Drawing.Pens.AliceBlue
};
var m = new SharpMap.Map(new System.Drawing.Size(1440, 1080)) { BackColor = System.Drawing.Color.Cornsilk };
m.Layers.Add(l);
m.ZoomToExtents();
var sw = new System.Diagnostics.Stopwatch();
var img = m.GetMap();
sw.Start();
img = m.GetMap();
img.Save("PolygonSymbolizer-1.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
sw.Stop();
System.Console.WriteLine(string.Format("Rendering new method:{0}ms", sw.ElapsedMilliseconds));
l.Symbolizer = new SharpMap.Rendering.Symbolizer.BasicPolygonSymbolizer()
{
Fill = new System.Drawing.Drawing2D.HatchBrush(
System.Drawing.Drawing2D.HatchStyle.WideDownwardDiagonal,
System.Drawing.Color.Red/*,
System.Drawing.Color.LightPink*/),
UseClipping = false,
//Outline = System.Drawing.Pens.AliceBlue
};
sw.Reset(); sw.Start();
img = m.GetMap();
img.Save("PolygonSymbolizer-2.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
sw.Stop();
System.Console.WriteLine(string.Format("Rendering new method:{0}ms", sw.ElapsedMilliseconds));
}
示例10: TestBasicLineSymbolizer
public void TestBasicLineSymbolizer()
{
var p = new SharpMap.Data.Providers.ShapeFile(@"d:\\daten\GeoFabrik\\roads.shp", false);
var l = new SharpMap.Layers.VectorLayer("roads", p);
//l.Style.Outline = new System.Drawing.Pen(System.Drawing.Color.Firebrick, 5);
l.Style.Line = new System.Drawing.Pen(System.Drawing.Color.Gold, 1);
l.Style.EnableOutline = false;
var m = new SharpMap.Map(new System.Drawing.Size(1440,1080)) {BackColor = System.Drawing.Color.Cornsilk};
m.Layers.Add(l);
m.ZoomToExtents();
var sw = new System.Diagnostics.Stopwatch();
sw.Start();
m.GetMap();
sw.Stop();
System.Console.WriteLine(string.Format("Rendering old method: {0}ms", sw.ElapsedMilliseconds));
sw.Reset();
sw.Start();
var bmp = m.GetMap();
sw.Stop();
System.Console.WriteLine(string.Format("Rendering old method: {0}ms", sw.ElapsedMilliseconds));
bmp.Save("NDSRoads1.bmp");
var cls = new SharpMap.Rendering.Symbolizer.CachedLineSymbolizer();
//cls.LineSymbolizeHandlers.Add(new SharpMap.Rendering.Symbolizer.PlainLineSymbolizeHandler { Line = new System.Drawing.Pen(System.Drawing.Color.Firebrick, 5) });
cls.LineSymbolizeHandlers.Add(new SharpMap.Rendering.Symbolizer.PlainLineSymbolizeHandler { Line = new System.Drawing.Pen(System.Drawing.Color.Gold, 1) });
l.Style.LineSymbolizer = cls;
sw.Reset(); sw.Start();
bmp = m.GetMap();
sw.Stop();
System.Console.WriteLine(string.Format("Rendering new method: {0}ms", sw.ElapsedMilliseconds));
bmp.Save("NDSRoads2.bmp");
}
示例11: TestRealData
public void TestRealData()
{
var fdt = GetRealFeatureDataTable();
FillRealDataTable(fdt);
var p = new SharpMap.Data.Providers.FeatureProvider(fdt);
var m = new SharpMap.Map(new Size(640, 640));
m.Layers.Add(new TileLayer(
new OsmTileSource(new OsmRequest(KnownTileServers.Mapnik) /*,
new FileCache(@"d:\temp\OSM", "png")*/), "OSM"));
var l = new HeatLayer(p, "Data", 0.001f);
l.LayerName = "HEAT";
m.Layers.Add(l);
#if DotSpatialProjections
l.CoordinateTransformation = new DotSpatial.Projections.CoordinateTransformation
{
Source = ProjectionInfo.FromEpsgCode(4326),
Target = ProjectionInfo.FromEpsgCode(3857)
};
#else
var ctfac = new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory();
l.CoordinateTransformation =
ctfac.CreateFromCoordinateSystems(ProjNet.CoordinateSystems.GeographicCoordinateSystem.WGS84,
ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator);
#endif
l.ZoomMin = 0;// 0.01 * m.GetExtents().Width;
l.ZoomMax = /*0.9 * */m.GetExtents().Width;
l.OpacityMax = 1;
l.OpacityMin = 0.3f;
m.ZoomToBox(l.Envelope);
for (var i = 0; i < 5; i++)
{
using (var img = m.GetMap())
{
img.Save("RealDataHeat" + i + ".png");
}
m.Zoom /= 2;
}
m.ZoomToExtents();
using (var img = m.GetMap())
{
img.Save("RealDataHeat.png");
}
}
示例12: Example1
public static void Example1()
{
var map = new SharpMap.Map(new Size(1280, 1084));
SharpMap.Data.Providers.IProvider provider =
new SharpMap.Data.Providers.ShapeFile(
@"C:\temp\Data\niedersachsen.shp\railways.shp");
var vl = new SharpMap.Layers.VectorLayer("Railways", provider);
map.Layers.Add(vl);
map.ZoomToBox(vl.Envelope);
var mapImage = map.GetMap();
mapImage.Save("Example1.png",
System.Drawing.Imaging.ImageFormat.Png);
}
示例13: HeatLayerTest
public void HeatLayerTest()
{
var m = new SharpMap.Map(new Size(640, 480));
var data = CreatingData.CreatePointFeatureDataTableFromArrays(
CreatingData.GetRandomOrdinates(150, 5, 6),
CreatingData.GetRandomOrdinates(150, 52, 53), null,
CreatingData.GetRandomOrdinates(150, 0, 1));
var p = new SharpMap.Data.Providers.FeatureProvider(data);
var l = new HeatLayer(p, "Data");
m.Layers.Add(l);
m.ZoomToBox(new Envelope(5.4, 5.8, 52.4, 52.6));
//m.ZoomToExtents();
var img = m.GetMap();
img.Save("HeatMap.png", ImageFormat.Png);
img.Dispose();
}
示例14: MultiLineCenterAlignedTest
public void MultiLineCenterAlignedTest()
{
using (var m = new SharpMap.Map(new Size(600, 400)))
{
m.BackColor = Color.SeaShell;
//_featureDataTable.Clear();
var gfp = new GeometryFeatureProvider(_featureDataTable);
var vl = new VectorLayer("VL", gfp);
var ll = new LabelLayer("MultiLineCenterAligned") {DataSource = gfp};
ll.Theme = CreateTheme();
ll.LabelColumn = "LABEL";
m.Layers.Add(vl);
m.Layers.Add(ll);
m.ZoomToExtents();
using (var mapImage = m.GetMap())
mapImage.Save("MultiLineCenterAligned.png", ImageFormat.Png);
}
}
示例15: TestIncompleteImage
public void TestIncompleteImage()
{
using (var map = new SharpMap.Map(new Size(2500, 2500)))
{
map.BackColor = Color.Magenta;
var br = new BingRequest(BingRequest.UrlBing, "", BingMapType.Hybrid);
var bts = new BingTileSource(br);
var tl = new TileLayer(bts, "TileLayer - " + BingMapType.Hybrid.ToString(), Color.Transparent, true,
System.IO.Path.Combine(_fileCacheRoot, "BingStaging"));
map.Layers.Add(tl);
map.ZoomToBox(new Envelope(829384.331338522, 837200.785470394, 7068020.31417922, 7072526.73926545)
/*new Envelope(-239839.49199841652, 78451.759683380573, -37033.0152981899, 106723.52879865949)*/);
using (var image = map.GetMap())
{
image.Save("TestIncompleteImage.png", ImageFormat.Png);
}
}
}