当前位置: 首页>>代码示例>>C#>>正文


C# Map.Load方法代码示例

本文整理汇总了C#中Map.Load方法的典型用法代码示例。如果您正苦于以下问题:C# Map.Load方法的具体用法?C# Map.Load怎么用?C# Map.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Map的用法示例。


在下文中一共展示了Map.Load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
        }
开发者ID:rouen-sk,项目名称:NET-Mapnik,代码行数:29,代码来源:GridTests.cs

示例2: Start

    void Start()
    {
        var map = new Map();
        map.Load("1", Difficulty.Easy);
        Debug.Log(map.MapFilePath);

        map.Save(null, null, null, "2", Difficulty.Hard);
        Debug.Log(map.MapFilePath);
    }
开发者ID:Fohte,项目名称:kcct_otoge,代码行数:9,代码来源:MapTest.cs

示例3: Map_GetParamaters

 public void Map_GetParamaters()
 {
     Map m = new Map(256,256);
     m.Load(@".\data\params.xml");
     Dictionary<string, object> prms = m.Parameters;
     Assert.AreEqual("wat up", (string)prms["words"]);
     Assert.AreEqual(1, (long)prms["num"]);
     Assert.AreEqual(.123, (double)prms["decimal"]);
 }
开发者ID:rouen-sk,项目名称:NET-Mapnik,代码行数:9,代码来源:MapTests.cs

示例4: 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);
 }
开发者ID:rouen-sk,项目名称:NET-Mapnik,代码行数:12,代码来源:GridViewTests.cs

示例5: 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());
        }
开发者ID:rouen-sk,项目名称:NET-Mapnik,代码行数:19,代码来源:GridViewTests.cs

示例6: 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);
        }
开发者ID:rouen-sk,项目名称:NET-Mapnik,代码行数:19,代码来源:VectorTileTests.cs

示例7: VectorTile_OverzoomComposite

        public void VectorTile_OverzoomComposite()
        {
            Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "shape.input"));
            Map m = new Map(256, 256);
            m.Load(@".\data\layer.xml");

            VectorTile v1 = new VectorTile(1, 0, 0, 256, 256);
            m.ZoomToBox(-20037508.34, 0, 0, 20037508.34);
            m.Render(v1);
            int v1before = v1.GetData().Length;

            VectorTile v2 = new VectorTile(0, 0, 0, 256, 256);
            m.ZoomToBox(-20037508.34, -20037508.34, 20037508.34, 20037508.34);
            m.Render(v2);

            v1.Composite(new List<VectorTile>() { v2 });
            int v1after = v1.GetData().Length;

            //composite bytes will actually be a little bit bigger than 2* original
            //Assert.AreEqual(v1before * 2, v1after);
        }
开发者ID:rouen-sk,项目名称:NET-Mapnik,代码行数:21,代码来源:VectorTileTests.cs

示例8: 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);
        }
开发者ID:rouen-sk,项目名称:NET-Mapnik,代码行数:22,代码来源:GridTests.cs

示例9: loadMap

	public void loadMap(string filePath)
	{
		map = new Map();
		if(map.Load(filePath))
		{
			printMapDebug(map);
			sun.transform.rotation = Quaternion.Euler(map.SunDirection);
			sun.color = new Color(map.SunColor.x, map.SunColor.y, map.SunColor.z,255);
			//This assumes SunAmbience means the color of the ambient light.. might not be the case.. change if it looks odd when textures are in.
			RenderSettings.ambientLight = new Color(map.SunAmbience.x, map.SunAmbience.y, map.SunAmbience.z,255);
			/*System.IO.FileStream file = new System.IO.FileStream("C:/Users/Vybe/Desktop/test.dds",System.IO.FileMode.Create);
			BinaryWriter writer = new BinaryWriter(file);
			TextureLoader.SaveTextureDDSTester(map.TexturemapTex,writer);
			writer.Close();*/
		}
		else
		{
			Debug.Log("File not found");
		}
	}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:20,代码来源:Terrain_Heightmap.cs

示例10: LoadScmapFile

	public IEnumerator LoadScmapFile(){

		map = new Map();

		string MapPath = EnvPaths.GetMapsPath();
		string path = MapLuaParser.Current.ScenarioData.Scmap.Replace("/maps/", MapPath);

		Debug.Log("Load SCMAP file: " + path);


		if(map.Load(path)){
			Vector3 SunDIr = new Vector3(-map.SunDirection.x, -map.SunDirection.y, map.SunDirection.z);
			Sun.transform.rotation = Quaternion.LookRotation( SunDIr);
			Sun.color = new Color(map.SunColor.x, map.SunColor.y , map.SunColor.z, 1) ;
			Sun.intensity = map.LightingMultiplier * 1.0f;
			RenderSettings.ambientLight = new Color(map.ShadowFillColor.x, map.ShadowFillColor.y, map.ShadowFillColor.z, 1);

			Kamera.GetComponent<Bloom>().bloomIntensity = map.Bloom * 4;

			RenderSettings.fogColor = new Color(map.FogColor.x, map.FogColor.y, map.FogColor.z, 1);
			RenderSettings.fogStartDistance = map.FogStart * 2;
			RenderSettings.fogEndDistance = map.FogEnd * 2;

			TerrainMaterial.SetFloat("_LightingMultiplier", map.LightingMultiplier);
			TerrainMaterial.SetColor("_SunColor",  new Color(map.SunColor.x * 0.5f, map.SunColor.y * 0.5f, map.SunColor.z * 0.5f, 1));
			TerrainMaterial.SetColor("_SunAmbience",  new Color(map.SunAmbience.x * 0.5f, map.SunAmbience.y * 0.5f, map.SunAmbience.z * 0.5f, 1));
			TerrainMaterial.SetColor("_ShadowColor",  new Color(map.ShadowFillColor.x * 0.5f, map.ShadowFillColor.y * 0.5f, map.ShadowFillColor.z * 0.5f, 1));
		}
		else{
			Debug.LogError("File not found");
			StopCoroutine( "LoadScmapFile" );
		}

		Shader = map.TerrainShader;

		MapLuaParser.Current.ScenarioData.MaxHeight = map.Water.Elevation;
		MapLuaParser.Water = map.Water.HasWater;
		WaterLevel.gameObject.SetActive(map.Water.HasWater);

		// Set Variables
		int xRes = (int)MapLuaParser.Current.ScenarioData.Size.x;
		int zRes = (int)MapLuaParser.Current.ScenarioData.Size.y;
		float HalfxRes = xRes / 10f;
		float HalfzRes = zRes / 10f;

		float yRes = (float)map.HeightScale;;
		float HeightResize = 512 * 40;

		WaterMaterial.SetTexture("_UtilitySamplerC", map.UncompressedWatermapTex);
		WaterMaterial.SetFloat("_WaterScale", HalfxRes);

		                     

//*****************************************
// ***** Set Terrain proportives
//*****************************************
		if(Teren) DestroyImmediate(Teren.gameObject);

		// Load Stratum Textures Paths
		for (int i = 0; i < Textures.Length; i++) {
			Textures[i].AlbedoPath = map.Layers[i].PathTexture;
			Textures[i].NormalPath = map.Layers[i].PathNormalmap;
			if(Textures[i].AlbedoPath.StartsWith("/")){
				Textures[i].AlbedoPath = Textures[i].AlbedoPath.Remove(0, 1);
			}
			if(Textures[i].NormalPath.StartsWith("/")){
				Textures[i].NormalPath = Textures[i].NormalPath.Remove(0, 1);
			}
			Textures[i].AlbedoScale = map.Layers[i].ScaleTexture;
			Textures[i].NormalScale = map.Layers[i].ScaleNormalmap;

			Gamedata.LoadTextureFromGamedata("env.scd", Textures[i].AlbedoPath, i, false);
			yield return null;
			Gamedata.LoadTextureFromGamedata("env.scd", Textures[i].NormalPath, i, true);
			yield return null;
		}

		Teren = Terrain.CreateTerrainGameObject( Data ).GetComponent<Terrain>();
		Teren.gameObject.name = "TERRAIN";
		Teren.materialType = Terrain.MaterialType.Custom;
		Teren.materialTemplate = TerrainMaterial;
		Teren.heightmapPixelError = 1;
		Teren.basemapDistance = 10000;
		Teren.castShadows = false;
		Teren.drawTreesAndFoliage = false;
		Teren.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off;


		Data.heightmapResolution = (int)(xRes + 1);
		Data.size = new Vector3(
			HalfxRes,
			yRes * MapHeightScale,
			HalfzRes
			);
		Data.SetDetailResolution((int)(xRes / 2), 8);
		Data.baseMapResolution = (int)(xRes / 2);
		Data.alphamapResolution = (int)(xRes / 2);

		Teren.transform.localPosition = new Vector3(0, 0, -HalfzRes);

//.........这里部分代码省略.........
开发者ID:ozonexo3,项目名称:FAForeverMapEditor,代码行数:101,代码来源:ScmapEditor.cs

示例11: 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());
        }
开发者ID:rouen-sk,项目名称:NET-Mapnik,代码行数:16,代码来源:ImageTests.cs

示例12: VectorTile_IsSolid

 public void VectorTile_IsSolid()
 {
     Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "shape.input"));
     Map m = new Map(256, 256);
     m.Load(@".\data\layer.xml");
     m.Extent = new double[] { -11271098.442818949, 4696291.017841229, -11192826.925854929, 4774562.534805249 };
     VectorTile v = new VectorTile(9, 112, 195);
     m.Render(v);
     Assert.IsTrue(v.Painted());
     Assert.AreEqual("world", v.IsSolid());
 }
开发者ID:rouen-sk,项目名称:NET-Mapnik,代码行数:11,代码来源:VectorTileTests.cs

示例13: Load

 public static void Load(string Path, Map CurrentMap)
 {
     MapPath = Path;
     CurrentMap.Load(Path+"\\Map.ege");
 }
开发者ID:jakakordez,项目名称:Eternal,代码行数:5,代码来源:Contruction.cs

示例14: VectorTile_Overzoom_Render

        public void VectorTile_Overzoom_Render()
        {
            Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "shape.input"));
            Map m = new Map(256, 256);
            m.Load(@".\data\layer.xml");

            m.ZoomToBox(-20037508.34, -20037508.34, 20037508.34, 20037508.34);
            VectorTile v1 = new VectorTile(0, 0, 0, 256, 256);
            m.Render(v1);

            m.ZoomToBox(-20037508.34, 0, 0, 20037508.34);
            VectorTile v2 = new VectorTile(1, 0, 0, 256, 256);
            m.Render(v2);

            Map renderMap = new Map(256, 256);
            renderMap.Load(@".\data\style.xml");
            Image i1 = new Image(256, 256);
            Image i2 = new Image(256, 256);

            Dictionary<string, object> options = new Dictionary<string, object>();
            options["Z"] = 1;

            v1.Render(renderMap, i1, options);
            v2.Render(renderMap, i2);

            //Small diff showing up between images 
            Assert.IsTrue(i1.Compare(i2)-500 < 0);
   
        }
开发者ID:rouen-sk,项目名称:NET-Mapnik,代码行数:29,代码来源:VectorTileTests.cs

示例15: VectorTile_Render_Grid

        public void VectorTile_Render_Grid()
        {
            Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "shape.input"));
            Map m = new Map(256, 256);
            m.Load(@".\data\layer.xml");
            m.Extent = new double[] { -20037508.34, 0, 0, 20037508.34 };
            VectorTile v = new VectorTile(1, 0, 0);
            m.Render(v);

            VectorTile v2 = new VectorTile(1, 0, 0);
            v2.SetData(v.GetData());

            Map m2 = new Map(256, 256);
            m2.Load(@".\data\style.xml");
            Grid g = new Grid(256, 256);
            var options = new Dictionary<string, object>()
            {
                {"Fields", new List<string>() { "FIPS" } },
                {"Layer", "world" }
            };
            v2.Render(m2, g, options);
            Dictionary<string, object > grid = g.Encode();
            Assert.AreEqual(grid.Keys.Count, 3);

            //Test for keys
            List<string> keyList = (List<string>)grid["keys"];
            Assert.AreNotEqual(keyList.Count, 0);

            //Test for data
            Dictionary<string, object> dataDict = (Dictionary<string, object>)grid["data"];
            Assert.AreNotEqual(dataDict.Count, 0);

            //data count should equal keys + 1
            Assert.AreEqual(keyList.Count, dataDict.Count + 1);
        }
开发者ID:rouen-sk,项目名称:NET-Mapnik,代码行数:35,代码来源:VectorTileTests.cs


注:本文中的Map.Load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。