本文整理汇总了C#中BuildTarget.addLayer方法的典型用法代码示例。如果您正苦于以下问题:C# BuildTarget.addLayer方法的具体用法?C# BuildTarget.addLayer怎么用?C# BuildTarget.addLayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BuildTarget
的用法示例。
在下文中一共展示了BuildTarget.addLayer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: decodeProject
//.........这里部分代码省略.........
// graphs
XmlNodeList graphs = e.GetElementsByTagName("graph");
foreach (XmlNode j in graphs)
{
FilterGraph graph = decodeFilterGraph((XmlElement)j, project);
if (graph != null)
project.getFilterGraphs().Add(graph);
}
#if TODO_DANI //terrains
// terrains (depends on resources)
XmlNodeList terrains = e.GetElementsByTagName("terrain");
foreach (XmlNode j in terrains)
{
Terrain terrain = decodeTerrain((XmlElement)j, project);
if (terrain != null)
project.getTerrains().Add(terrain);
}
#endif
// sources - 2 passes, since a source can reference another source
XmlNodeList sources = e.GetElementsByTagName("source");
foreach (XmlNode j in sources)
{
// TODO Dani, meter esto en un try catch
Source source = decodeSource((XmlElement)j, project, 0);
if (source != null)
{
project.getSources().Add(source);
#if TODO_DANI
// also add each source as a feature layer resource
Resource resource = MogreGis.Registry.instance().createResourceByType("FeatureLayerResource");
resource.setBaseURI(project.getBaseURI());
resource.setURI(source.getURI());
resource.setName(source.getName());
project.getResources().Add(resource);
#endif
}
}
foreach (XmlNode j in sources)
{
decodeSource((XmlElement)j, project, 1);
}
//#if TODO_DANI //layers
// layers
XmlNodeList layers = e.GetElementsByTagName("layer");
foreach (XmlNode j in layers)
{
BuildLayer layer = decodeLayer((XmlElement)j, project);
if (layer != null)
{
project.getLayers().Add(layer);
// automatically add a target for this layer alone:
BuildTarget layer_target = new BuildTarget();
layer_target.setName(layer.getName());
layer_target.addLayer(layer);
project.getTargets().Add(layer_target);
}
}
//#endif
#if TODO_DANI //targets
// targets
XmlNodeList targets = e.GetElementsByTagName("target");
foreach (XmlNode j in targets)
{
BuildTarget target = decodeTarget((XmlElement)j, project);
if (target != null)
project.getTargets().Add(target);
}
#endif
#if TODO_DANI //maps
// maps
XmlNodeList maps = e.GetElementsByTagName("map");
foreach (XmlNode j in maps)
{
RuntimeMap map = decodeRuntimeMap((XmlElement)j, project);
if (map != null)
project.getMaps().Add(map);
}
#endif
}
return project;
}
示例2: decodeTarget
static BuildTarget decodeTarget(XmlElement e, Project proj)
{
BuildTarget target = null;
if (e != null)
{
target = new BuildTarget();
target.setName(e.GetAttribute("name"));
Terrain terrain = proj.getTerrain(e.GetAttribute("terrain"));
target.setTerrain(terrain);
XmlNodeList layers = e.GetElementsByTagName("layer");
foreach (XmlNode i in layers)
{
XmlElement elem = (XmlElement)i;
string layer_name = elem.InnerText;
if (!string.IsNullOrEmpty(layer_name))
{
BuildLayer layer = proj.getLayer(layer_name);
if (layer != null)
target.addLayer(layer);
}
}
}
return target;
}
示例3: decodeProject
static Project decodeProject(XmlElement e, string source_uri)
{
if (e == null || !e.Name.Equals("project"))
throw new ApplicationException("First XML element must be <project/> tag");
Project project = null;
if (e != null)
{
project = new Project();
project.setSourceURI(source_uri);
project.setName(e.GetAttribute("name"));
project.setWorkingDirectory(e.GetAttribute("workdir"));
// resources
XmlNodeList resources = e.GetElementsByTagName("resource");
foreach (XmlNode j in resources)
{
MogreGis.Resource resource = decodeResource((XmlElement)j, project);
if (resource != null)
project.getResources().Add(resource);
}
#region TODO_PH_FILTERGRAPHS
#if TODO_PH
// graphs
XmlNodeList graphs = e.GetElementsByTagName("graph");
foreach (XmlNode j in graphs)
{
FilterGraph graph = decodeFilterGraph((XmlElement)j, project);
if (graph != null)
project.getFilterGraphs().Add(graph);
}
#endif
#endregion
// sources - 2 passes, since a source can reference another source
XmlNodeList sources = e.GetElementsByTagName("source");
foreach (XmlNode j in sources)
{
// TODO Dani, meter esto en un try catch
ShapeFile shapeFile = decodeShapeFile((XmlElement)j, project, 0);
if (shapeFile != null)
{
project.getShapeFiles().Add(shapeFile);
}
}
foreach (XmlNode j in sources)
{
decodeShapeFile((XmlElement)j, project, 1);
}
#region TODO_PH_LAYERS
#if TODO_PH_LAYERS
XmlNodeList layers = e.GetElementsByTagName("layer");
foreach (XmlNode j in layers)
{
SharpMap.Layers.VectorLayer l = new SharpMap.Layers.VectorLayer(
BuildLayer layer = decodeLayer((XmlElement)j, project);
if (layer != null)
{
project.getLayers().Add(layer);
// automatically add a target for this layer alone:
BuildTarget layer_target = new BuildTarget();
layer_target.setName(layer.getName());
layer_target.addLayer(layer);
project.getTargets().Add(layer_target);
}
}
#endif
#endregion
}
return project;
}