本文整理汇总了C#中Newtonsoft.Json.Linq.JObject.SetGeometry方法的典型用法代码示例。如果您正苦于以下问题:C# JObject.SetGeometry方法的具体用法?C# JObject.SetGeometry怎么用?C# JObject.SetGeometry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Newtonsoft.Json.Linq.JObject
的用法示例。
在下文中一共展示了JObject.SetGeometry方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadElementElement
public IEnumerable<JObject> ReadElementElement(IAixmConverter converter, JObject currentObject, XElement element)
{
var elementElement = element.Elements().ToArray();
if(elementElement.Length != 1)
{
throw new NotSupportedException("ReadElementElement do not support more than one nested element");
}
var id = currentObject["properties"]["id"];
currentObject.SetGeometry(new JObject());
var obj = new JObject(new JProperty("properties",new JObject(
new JProperty("elementSource",elementElement[0].Name.LocalName),
new JProperty("parent", id is JObject ? id["#text"].ToString() : id.ToString())
)));
//Need to yield the current feature when going to sub types.
//When no sub features are returned the current feature is automaticly returned for all other cases.
yield return currentObject;
foreach (var feature in converter.ReadElement(obj, elementElement[0].Elements()).ToList())
{
yield return feature;
}
}
示例2: ReadSurfaceElement
public IEnumerable<JObject> ReadSurfaceElement(IAixmConverter converter, JObject currentObject, XElement element)
{
//Convert ElevatedSurface to a GML Surface and convert to geojson.
var geometry = GeometryFactory.GmlToGeometry(DownCastToSurfaceElement(element));
//Set the geometry
currentObject.SetGeometry(geometry);
//Set the projection on the feature obj.
currentObject.SetSrs(element);
return Enumerable.Empty<JObject>();
}
示例3: ReadElement
public IEnumerable<JObject> ReadElement(IAixmConverter converter, JObject currentObject, XElement element)
{
XNamespace aximNs = "http://www.aixm.aero/schema/5.1";
//Convert ElevatedPoint to a GML Surface and convert to geojson.
var geometry = GeometryFactory.GmlToGeometry(DownCastToPointElement(element));
//Set the geometry
currentObject.SetGeometry(geometry);
//Set the projection on the feature obj.
currentObject.SetSrs(element);
//Read elevation property and return
return converter.ReadElement(currentObject, element.Elements(aximNs + "elevation"));
}