本文整理汇总了C#中Map.ZoomAll方法的典型用法代码示例。如果您正苦于以下问题:C# Map.ZoomAll方法的具体用法?C# Map.ZoomAll怎么用?C# Map.ZoomAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map.ZoomAll方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Grid_Encode
public void Grid_Encode()
{
Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "shape.input"));
Map m = new Map(256, 256);
m.Load(@".\data\test.xml");
m.ZoomAll();
Grid g = new Grid(256, 256);
var options = new Dictionary<string, object>()
{
{"Fields", new List<string>() { "FIPS" } },
{"Layer", "world" }
};
m.Render(g, options);
Dictionary<string, object> UTFGridDict = g.Encode();
Assert.AreEqual(UTFGridDict.Keys.Count, 3);
//Test for keys
List<string> keyList = (List<string>)UTFGridDict["keys"];
Assert.AreNotEqual(keyList.Count, 0);
//Test for data
Dictionary<string, object> dataDict = (Dictionary<string, object>)UTFGridDict["data"];
Assert.AreNotEqual(dataDict.Count, 0);
//data count should equal keys + 1
Assert.AreEqual(keyList.Count, dataDict.Count + 1);
}
示例2: GridView_IsSolid
public void GridView_IsSolid()
{
Map m = new Map(256, 256);
m.AddLayer(new Layer("test"));
m.ZoomAll();
Grid g = new Grid(256, 256);
m.Render(g);
GridView v1 = g.View(0, 0, 256, 256);
Assert.IsTrue(v1.IsSolid());
m.Clear();
g.Clear();
Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "shape.input"));
m.Load(@".\data\test.xml");
m.ZoomAll();
m.Render(g);
GridView v2 = g.View(0, 0, 256, 256);
Assert.IsFalse(v2.IsSolid());
}
示例3: GridView_GetPixel
public void GridView_GetPixel()
{
Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "shape.input"));
Map m = new Map(256, 256);
m.Load(@".\data\test.xml");
m.ZoomAll();
Grid g = new Grid(256, 256);
m.Render(g);
GridView v = g.View(0, 0, 256, 256);
long pixel = v.GetPixel(25, 100);
Assert.AreEqual(207, pixel);
}
示例4: VectorTile_SimpleComposite
public void VectorTile_SimpleComposite()
{
Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "shape.input"));
Map m = new Map(256, 256);
m.Load(@".\data\layer.xml");
m.ZoomAll();
VectorTile v1 = new VectorTile(0, 0, 0, 256, 256);
m.Render(v1);
int v1before = v1.GetData().Length;
VectorTile v2 = new VectorTile(0, 0, 0, 256, 256);
m.Render(v2);
v1.Composite(new List<VectorTile>() { v2 });
int v1after = v1.GetData().Length;
Assert.AreEqual(v1before * 2, v1after);
}
示例5: Grid_Encode_Resolution
public void Grid_Encode_Resolution()
{
Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "shape.input"));
Map m = new Map(256, 256);
m.Load(@".\data\test.xml");
m.ZoomAll();
Grid g1 = new Grid(256, 256);
m.Render(g1);
List<string> data = (List<string>) g1.Encode()["grid"];
Assert.AreEqual(64, data.Count());
Assert.AreEqual(64, data[0].Length);
Grid g2 = new Grid(256, 256);
m.Render(g2);
var options = new Dictionary<string, object>()
{
{ "Resolution", 1 }
};
data = (List<string>)g1.Encode(options)["grid"];
Assert.AreEqual(256, data.Count());
Assert.AreEqual(256, data[0].Length);
}
示例6: Grid_Painted
public void Grid_Painted()
{
Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "shape.input"));
Grid g = new Grid(256, 256);
Assert.IsFalse(g.Painted());
Map m = new Map(256, 256);
Layer l = new Layer("test");
m.AddLayer(l);
m.Render(g);
Assert.IsFalse(g.Painted());
m.Clear();
m.Load(@".\data\test.xml");
m.ZoomAll();
var options = new Dictionary<string, object>()
{
{"Fields", new List<string>() { "FIPS" } },
{"Layer", "world" }
};
m.Render(g);
Assert.IsTrue(g.Painted());
}
示例7: Grid_Fields
public void Grid_Fields()
{
Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "shape.input"));
Map m = new Map(256, 256);
m.Load(@".\data\test.xml");
m.ZoomAll();
Grid g = new Grid(256, 256);
List<string> expected = new List<string>() { "FIPS" };
var options = new Dictionary<string, object>()
{
{"Fields", expected }
};
m.Render(g, options);
CollectionAssert.AreEquivalent(expected, g.Fields().ToList());
}
示例8: Image_Painted
public void Image_Painted()
{
Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "shape.input"));
Image i = new Image(256, 256);
Assert.IsFalse(i.Painted());
Map m = new Map(256,256);
m.ZoomAll();
m.Render(i);
Assert.IsFalse(i.Painted());
m.Load(@".\data\test.xml");
m.ZoomAll();
m.Render(i);
Assert.IsTrue(i.Painted());
}
示例9: Map_QueryMapPoint_MultipleLayers
public void Map_QueryMapPoint_MultipleLayers()
{
Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "shape.input"));
Map m = new Map(256, 256);
m.Load(@".\data\test.xml");
Layer l = new Layer("world2");
Datasource d = new Datasource(
new Dictionary<string, object>() {
{ "type","shape"},
{ "file", @".\data\world_merc.shp" }
}
);
l.Datasource = d;
m.AddLayer(l);
m.ZoomAll();
IEnumerable<MapQueryResult> r;
//query single layer
r = m.QueryMapPoint(55, 130, "world2");
Assert.AreEqual(r.Count(), 1);
MapQueryResult mqr = r.ToList()[0];
Assert.AreEqual(mqr.Layer, "world2");
//query all
r = m.QueryMapPoint(55, 130);
Assert.AreEqual(r.Count(), 2);
MapQueryResult mqr1 = r.ToList()[0];
Assert.AreEqual(mqr1.Layer, "world");
MapQueryResult mqr2 = r.ToList()[1];
Assert.AreEqual(mqr2.Layer, "world2");
}
示例10: Map_QueryMapPoint_SingleLayer
public void Map_QueryMapPoint_SingleLayer()
{
Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "shape.input"));
Map m = new Map(256, 256);
m.Load(@".\data\test.xml");
m.ZoomAll();
Dictionary<string, object> expected = new Dictionary<string, object>()
{
{"AREA", 915896L},
{"FIPS", "US"},
{"ISO2", "US"},
{"ISO3", "USA"},
{"LAT", 39.622},
{"LON", -98.606},
{"NAME", "United States"},
{"POP2005", 299846449L},
{"REGION", 19L},
{"SUBREGION", 21L},
{"UN", 840L }
};
IEnumerable<MapQueryResult> r;
MapQueryResult mqr;
Dictionary<string, object> actual;
//query by layer name
r = m.QueryMapPoint(55, 130, "world");
Assert.AreEqual(r.Count(), 1);
mqr = r.ToList()[0];
Assert.AreEqual(mqr.Layer, "world");
actual = new Dictionary<string, object>(mqr.Featureset.Next().Attributes());
CollectionAssert.AreEquivalent(expected, actual);
//query by layer index
r = m.QueryMapPoint(55, 130, 0);
Assert.AreEqual(r.Count(), 1);
mqr = r.ToList()[0];
Assert.AreEqual(mqr.Layer, "world");
actual = new Dictionary<string, object>(mqr.Featureset.Next().Attributes());
CollectionAssert.AreEquivalent(expected, actual);
//query all
//query by layer name
r = r = m.QueryMapPoint(55, 130);
Assert.AreEqual(r.Count(), 1);
mqr = r.ToList()[0];
Assert.AreEqual(mqr.Layer, "world");
actual = new Dictionary<string, object>(mqr.Featureset.Next().Attributes());
CollectionAssert.AreEquivalent(expected, actual);
}