本文整理汇总了C#中OsmSharp类的典型用法代码示例。如果您正苦于以下问题:C# OsmSharp类的具体用法?C# OsmSharp怎么用?C# OsmSharp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OsmSharp类属于命名空间,在下文中一共展示了OsmSharp类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Convert
/// <summary>
/// Converts the given OsmSharp feature collection into a list of NTS feature collection.
/// </summary>
/// <param name="featureCollection"></param>
/// <returns></returns>
public static List<Feature> Convert(OsmSharp.Geo.Features.FeatureCollection featureCollection)
{
var features = new List<Feature>(featureCollection.Count);
foreach (var feature in featureCollection)
{
features.Add(OsmSharpToNTSFeatureConvertor.Convert(feature));
}
return features;
}
开发者ID:APLANA-Alexey-Stolyarov,项目名称:OsmSharpDataProcessor,代码行数:14,代码来源:OsmSharpToNTSFeatureConvertor.cs
示例2: ConvertBoundary
/// <summary>
/// Converts boundary type into an osm object.
/// </summary>
/// <param name="boundary"></param>
/// <returns></returns>
private static IEnumerable<LineairRing> ConvertBoundary(OsmSharp.IO.Xml.Kml.v2_1.boundaryType[] boundary)
{
List<LineairRing> rings = new List<LineairRing>();
foreach (OsmSharp.IO.Xml.Kml.v2_1.boundaryType geo in boundary)
{
rings.Add(KmlFeatureStreamSource.ConvertLinearRing(geo.LinearRing).Geometry as LineairRing);
}
return rings;
}
开发者ID:nagyistoce,项目名称:OsmSharp-core,代码行数:14,代码来源:KmlFeatureStreamSource.cs
示例3: OsmStreamFilterPoly
/// <summary>
/// Creates a new polygon filter.
/// </summary>
public OsmStreamFilterPoly(OsmSharp.Geo.Geometries.LineairRing poly)
: base()
{
if (poly == null) { throw new ArgumentNullException("poly"); }
_poly = poly;
_box = new GeoCoordinateBox(poly.Coordinates);
this.Meta.Add("poly", OsmSharp.Geo.Streams.GeoJson.GeoJsonConverter.ToGeoJson(_poly));
}
开发者ID:brinktech,项目名称:core,代码行数:13,代码来源:OsmStreamFilterPoly.cs
示例4: GenerateImmidiateTurn
/// <summary>
/// Generates an immidiate turn.
/// </summary>
/// <param name="instruction"></param>
/// <param name="firstStreetCountTo"></param>
/// <param name="firstStreetTo"></param>
/// <param name="firstDirection"></param>
/// <param name="secondStreetTo"></param>
/// <param name="secondDirection"></param>
/// <returns></returns>
public Instruction GenerateImmidiateTurn(Instruction instruction,
int firstStreetCountTo,
List<KeyValuePair<string, string>> firstStreetTo,
OsmSharp.Tools.Math.Geo.Meta.RelativeDirection firstDirection,
List<KeyValuePair<string, string>> secondStreetTo,
RelativeDirection secondDirection)
{
instruction.Text = string.Format("GenerateImmidiateTurn:{0}_{1}_{2}_{3}",
firstStreetCountTo, firstDirection,
firstDirection.ToString(),
secondDirection.ToString());
return instruction;
}
开发者ID:jorik041,项目名称:osmsharp,代码行数:23,代码来源:LanguageTestGenerator.cs
示例5: ConvertPolygon
/// <summary>
/// Converts a polygon.
/// </summary>
/// <param name="polygon"></param>
/// <returns></returns>
private static Polygon ConvertPolygon(OsmSharp.Xml.Kml.v2_0_response.Polygon polygon)
{
LineairRing inner = KmlGeoStreamSource.ConvertLinearRing(polygon.innerBoundaryIs.LinearRing);
LineairRing outer = KmlGeoStreamSource.ConvertLinearRing(polygon.outerBoundaryIs.LinearRing);
return new Polygon(outer, new LineairRing[] { inner });
}
开发者ID:robert-hickey,项目名称:OsmSharp,代码行数:12,代码来源:KmlGeoStreamSource.cs
示例6: ConvertPoint
/// <summary>
/// Converts a point into an oms object.
/// </summary>
/// <param name="point"></param>
/// <returns></returns>
private static Point ConvertPoint(OsmSharp.Xml.Kml.v2_1.PointType point)
{
// convert the coordiantes.
IList<GeoCoordinate> coordinates = KmlGeoStreamSource.ConvertCoordinates(point.coordinates);
// create the point.
Point pointGeometry = new Point(coordinates[0]);
pointGeometry.Attributes = new SimpleGeometryAttributeCollection();
if (point.targetId != null) { pointGeometry.Attributes.Add("targetId", point.targetId); }
pointGeometry.Attributes.Add("altitude", point.altitudeMode);
if (point.extrude) { pointGeometry.Attributes.Add("extrude", point.extrude); }
if (point.id != null) { pointGeometry.Attributes.Add("id", point.id); }
return pointGeometry;
}
开发者ID:robert-hickey,项目名称:OsmSharp,代码行数:20,代码来源:KmlGeoStreamSource.cs
示例7: ConvertMultiPolygon
/// <summary>
/// Converts a multipolygon into osm objects.
/// </summary>
/// <param name="multiPolygon"></param>
/// <returns></returns>
private static MultiPolygon ConvertMultiPolygon(OsmSharp.Xml.Kml.v2_0_response.MultiPolygon multiPolygon)
{
return new MultiPolygon(new Polygon[] { KmlGeoStreamSource.ConvertPolygon(multiPolygon.Polygon) });
}
开发者ID:robert-hickey,项目名称:OsmSharp,代码行数:9,代码来源:KmlGeoStreamSource.cs
示例8: ConvertMultiPoint
/// <summary>
/// Converts a multipoint to osm objects.
/// </summary>
/// <param name="multiPoint"></param>
/// <returns></returns>
private static MultiPoint ConvertMultiPoint(OsmSharp.Xml.Kml.v2_0_response.MultiPoint multiPoint)
{
return new MultiPoint(new Point[] { KmlGeoStreamSource.ConvertPoint(multiPoint.Point) });
}
开发者ID:robert-hickey,项目名称:OsmSharp,代码行数:9,代码来源:KmlGeoStreamSource.cs
示例9: ConvertMultiLineString
/// <summary>
/// Converts a multilinestring to osm objects.
/// </summary>
/// <param name="multiLineString"></param>
/// <returns></returns>
private static MultiLineString ConvertMultiLineString(OsmSharp.Xml.Kml.v2_0_response.MultiLineString multiLineString)
{
return new MultiLineString(new LineString[] { KmlGeoStreamSource.ConvertLineString(multiLineString.LineString) });
}
开发者ID:robert-hickey,项目名称:OsmSharp,代码行数:9,代码来源:KmlGeoStreamSource.cs
示例10: ConvertLineString
/// <summary>
/// Converts a line string into an osm object.
/// </summary>
/// <param name="lineString"></param>
/// <returns></returns>
private static LineString ConvertLineString(OsmSharp.Xml.Kml.v2_1.LineStringType lineString)
{
// convert the coordinates.
IList<GeoCoordinate> coordinates = KmlGeoStreamSource.ConvertCoordinates(lineString.coordinates);
// create the ring.
LineString lineStringGeometry = new LineString(coordinates);
lineStringGeometry.Attributes = new SimpleGeometryAttributeCollection();
lineStringGeometry.Attributes.Add("id", lineString.id);
return lineStringGeometry;
}
开发者ID:robert-hickey,项目名称:OsmSharp,代码行数:17,代码来源:KmlGeoStreamSource.cs
示例11: ConvertLinearRing
/// <summary>
/// Converts a lineairring into an osm object.
/// </summary>
/// <param name="linearRing"></param>
/// <returns></returns>
private static LineairRing ConvertLinearRing(OsmSharp.Xml.Kml.v2_0_response.LinearRing linearRing)
{
// convert the coordinates.
IList<GeoCoordinate> coordinates = KmlGeoStreamSource.ConvertCoordinates(linearRing.coordinates);
// create the ring.
LineairRing ring = new LineairRing(coordinates);
ring.Attributes = new SimpleGeometryAttributeCollection();
ring.Attributes.Add("id", linearRing.id);
return ring;
}
开发者ID:robert-hickey,项目名称:OsmSharp,代码行数:17,代码来源:KmlGeoStreamSource.cs
示例12: ConvertWay
/// <summary>
/// Converts a PBF way into an OsmSharp-way.
/// </summary>
/// <param name="block"></param>
/// <param name="way"></param>
/// <returns></returns>
internal OsmSharp.Osm.Way ConvertWay(PrimitiveBlock block, OsmSharp.Osm.PBF.Way way)
{
var simpleWay = new OsmSharp.Osm.Way();
simpleWay.Id = way.id;
simpleWay.Nodes = new List<long>(way.refs.Count);
long node_id = 0;
for (int node_idx = 0; node_idx < way.refs.Count; node_idx++)
{
node_id = node_id + way.refs[node_idx];
simpleWay.Nodes.Add(node_id);
}
simpleWay.Tags = new TagsCollection(way.keys.Count);
if (way.keys.Count > 0)
{
for (int tag_idx = 0; tag_idx < way.keys.Count; tag_idx++)
{
string key = Encoding.UTF8.GetString(block.stringtable.s[(int)way.keys[tag_idx]]);
string value = Encoding.UTF8.GetString(block.stringtable.s[(int)way.vals[tag_idx]]);
simpleWay.Tags.Add(new Tag(key, value));
}
}
if (way.info != null)
{ // add the metadata if any.
simpleWay.ChangeSetId = way.info.changeset;
simpleWay.TimeStamp = Utilities.FromUnixTime((long)way.info.timestamp *
(long)block.date_granularity);
simpleWay.UserId = way.info.uid;
simpleWay.UserName = Encoding.UTF8.GetString(block.stringtable.s[way.info.user_sid]);
simpleWay.Version = (ulong)way.info.version;
}
simpleWay.Visible = true;
return simpleWay;
}
开发者ID:ryfx,项目名称:OsmSharp,代码行数:41,代码来源:PBFOsmStreamSource.cs
示例13: ConvertRelation
/// <summary>
/// Converts a PBF way into an OsmSharp-relation.
/// </summary>
/// <param name="block"></param>
/// <param name="relation"></param>
/// <returns></returns>
internal OsmSharp.Osm.Relation ConvertRelation(PrimitiveBlock block, OsmSharp.Osm.PBF.Relation relation)
{
var simpleRelation = new OsmSharp.Osm.Relation();
simpleRelation.Id = relation.id;
if (relation.types.Count > 0)
{
simpleRelation.Members = new List<OsmSharp.Osm.RelationMember>();
long member_id = 0;
for (int member_idx = 0; member_idx < relation.types.Count; member_idx++)
{
member_id = member_id + relation.memids[member_idx];
string role = Encoding.UTF8.GetString(
block.stringtable.s[relation.roles_sid[member_idx]]);
var member = new OsmSharp.Osm.RelationMember();
member.MemberId = member_id;
member.MemberRole = role;
switch (relation.types[member_idx])
{
case Relation.MemberType.NODE:
member.MemberType = OsmSharp.Osm.OsmGeoType.Node;
break;
case Relation.MemberType.WAY:
member.MemberType = OsmSharp.Osm.OsmGeoType.Way;
break;
case Relation.MemberType.RELATION:
member.MemberType = OsmSharp.Osm.OsmGeoType.Relation;
break;
}
simpleRelation.Members.Add(member);
}
}
simpleRelation.Tags = new TagsCollection(relation.keys.Count);
if (relation.keys.Count > 0)
{
for (int tag_idx = 0; tag_idx < relation.keys.Count; tag_idx++)
{
string key = Encoding.UTF8.GetString(block.stringtable.s[(int)relation.keys[tag_idx]]);
string value = Encoding.UTF8.GetString(block.stringtable.s[(int)relation.vals[tag_idx]]);
simpleRelation.Tags.Add(new Tag(key, value));
}
}
if (relation.info != null)
{ // read metadata if any.
simpleRelation.ChangeSetId = relation.info.changeset;
simpleRelation.TimeStamp = Utilities.FromUnixTime((long)relation.info.timestamp *
(long)block.date_granularity);
simpleRelation.UserId = relation.info.uid;
simpleRelation.UserName = Encoding.UTF8.GetString(block.stringtable.s[relation.info.user_sid]);
simpleRelation.Version = (ulong)relation.info.version;
}
simpleRelation.Visible = true;
return simpleRelation;
}
开发者ID:ryfx,项目名称:OsmSharp,代码行数:62,代码来源:PBFOsmStreamSource.cs
示例14: _mapView_MapInitialized
/// <summary>
/// Called when the map was first initialized.
/// </summary>
/// <param name="mapView">Map view.</param>
/// <param name="newZoom">New zoom.</param>
/// <param name="newTilt">New tilt.</param>
/// <param name="newCenter">New center.</param>
private void _mapView_MapInitialized(OsmSharp.UI.IMapView mapView, float newZoom, OsmSharp.Units.Angle.Degree newTilt, GeoCoordinate newCenter)
{
// make sure the center marker stays in place from now on.
_centerMarker.MoveWithMap = false;
}
开发者ID:UnifyKit,项目名称:OsmSharp,代码行数:12,代码来源:SampleViewController.cs
示例15: DoSolve
/// <summary>
/// Solves the problem using a GA.
/// </summary>
/// <param name="problem"></param>
/// <returns></returns>
protected override IRoute DoSolve(OsmSharp.Tools.Math.TSP.Problems.IProblem problem)
{
//int population_size = 10;
//if (problem.Size < 100)
//{
// population_size = System.Math.Max(problem.Size * 3, 10);
// if (problem.Size < 10)
// {
// population_size = 1;
// }
//}
//if (problem.Size < 1000)
//{
// population_size = problem.Size / 4;
//}
// create the settings.
SolverSettings settings = new SolverSettings(
_stagnation_count,
_population,
1000000000,
_eltism,
_cross,
_mutation);
//List<IMutationOperation<List<int>, GeneticProblem, Fitness>> mutators = new List<IMutationOperation<int,GeneticProblem,Fitness>>();
////mutators.Add(new DefaultMutationOperation());
////mutators.Add(new BestPlacementMutationOperation());
//mutators.Add(new BestDetailedPlacementMutationOperation());
//List<double> probabilities = new List<double>();
//probabilities.Add(1);
////probabilities.Add(0.5);
////probabilities.Add(0.3);
//CombinedMutation<List<int>, GeneticProblem, Fitness> mutation = new CombinedMutation<int,GeneticProblem,Fitness>(
// StaticRandomGenerator.Get(),
// mutators,
// probabilities);
////SequentialContructiveCrossoverOperator cross_over = new SequentialContructiveCrossoverOperator();
//BestDetailedPlacementCrossOverOperation cross_over = new BestDetailedPlacementCrossOverOperation();
////BestPlacementCrossOverOperation cross_over = new BestPlacementCrossOverOperation();
////EdgeRecombinationCrossOverOperation cross_over = new EdgeRecombinationCrossOverOperation();
//BestPlacementGenerationOperation generation = new BestPlacementGenerationOperation();
////RandomGenerationOperation generation = new RandomGenerationOperation();
ISelector<List<int>, GeneticProblem, Fitness> selector = new RandomSelector<List<int>, GeneticProblem, Fitness>();
//ISelector<List<int>, GeneticProblem, Fitness> selector = new TournamentBasedSelector<List<int>, GeneticProblem, Fitness>(75, 0.01);
solver =
new Solver<List<int>, GeneticProblem, Fitness>(
new GeneticProblem(problem),
settings,
selector,
_mutation_operation,
_cross_over_operation,
_generation_operation,
new FitnessCalculator(),
true, false);
solver.NewFittest += new Solver<List<int>, GeneticProblem, Fitness>.NewFittestDelegate(solver_NewFittest);
solver.NewGeneration += new Solver<List<int>, GeneticProblem, Fitness>.NewGenerationDelegate(solver_NewGeneration);
List<int> result = new List<int>(solver.Start(null).Genomes);
result.Insert(0, 0);
return new SimpleAsymmetricRoute(result, true);
}
开发者ID:jorik041,项目名称:osmsharp,代码行数:70,代码来源:GeneticSolver.cs
示例16: ConvertContainer
/// <summary>
/// Converts a container and it's contents to osm elements.
/// </summary>
/// <param name="container"></param>
private void ConvertContainer(OsmSharp.Xml.Kml.v2_1.ContainerType container)
{
// get the features.
if (container is OsmSharp.Xml.Kml.v2_1.FolderType)
{
OsmSharp.Xml.Kml.v2_1.FolderType folder = (container as OsmSharp.Xml.Kml.v2_1.FolderType);
// items1 are the features.
this.ConvertFeatures(folder.Items1);
}
else if (container is OsmSharp.Xml.Kml.v2_1.DocumentType)
{
OsmSharp.Xml.Kml.v2_1.DocumentType document = (container as OsmSharp.Xml.Kml.v2_1.DocumentType);
// items1 are the features.
this.ConvertFeatures(document.Items1);
}
}
开发者ID:robert-hickey,项目名称:OsmSharp,代码行数:22,代码来源:KmlGeoStreamSource.cs
示例17: ConvertResponse
/// <summary>
/// Converts a response into an osm object.
/// </summary>
/// <param name="response"></param>
/// <returns></returns>
private void ConvertResponse(OsmSharp.Xml.Kml.v2_0_response.Response response)
{
foreach (object item in response.Items)
{
if (item is OsmSharp.Xml.Kml.v2_0_response.Document)
{
this.ConvertDocument(item as OsmSharp.Xml.Kml.v2_0_response.Document);
}
else if (item is OsmSharp.Xml.Kml.v2_0_response.Folder)
{
this.ConvertFolder(item as OsmSharp.Xml.Kml.v2_0_response.Folder);
}
else if (item is OsmSharp.Xml.Kml.v2_0_response.Placemark)
{
this.ConvertPlacemark(item as OsmSharp.Xml.Kml.v2_0_response.Placemark);
}
else if (item is OsmSharp.Xml.Kml.v2_0_response.Response)
{
this.ConvertResponse(item as OsmSharp.Xml.Kml.v2_0_response.Response);
}
}
}
开发者ID:robert-hickey,项目名称:OsmSharp,代码行数:27,代码来源:KmlGeoStreamSource.cs
示例18: Get
/// <summary>
/// Returns all objects with the given bounding box and valid for the given filter;
/// </summary>
/// <param name="box"></param>
/// <param name="filter"></param>
/// <returns></returns>
public override IList<OsmGeo> Get(GeoCoordinateBox box, OsmSharp.Osm.Filters.Filter filter)
{
// initialize connection.
SQLiteConnection con = this.CreateConnection();
List<OsmGeo> res = new List<OsmGeo>();
// calculate bounding box parameters to query db.
long latitude_min = (long)(box.MinLat * 10000000.0);
long longitude_min = (long)(box.MinLon * 10000000.0);
long latitude_max = (long)(box.MaxLat * 10000000.0);
long longitude_max = (long)(box.MaxLon * 10000000.0);
// TODO: improve this to allow loading of bigger bb's.
uint x_min = lon2x(box.MinLon);
uint x_max = lon2x(box.MaxLon);
uint y_min = lat2y(box.MinLat);
uint y_max = lat2y(box.MaxLat);
IList<long> boxes = new List<long>();
for (uint x = x_min; x <= x_max; x++)
{
for (uint y = y_min; y <= y_max; y++)
{
boxes.Add(this.xy2tile(x, y));
}
}
// STEP 1: query nodes table.
//id latitude longitude changeset_id visible timestamp tile version
//string sql
// = "SELECT node.id, node.latitude, node.longitude, node.changeset_id, node.timestamp, node.version, " +
// "node.usr, node.usr_id, node.visible FROM node WHERE (tile IN ({4})) AND (visible = 1) AND (latitude BETWEEN {0} AND {1} AND longitude BETWEEN {2} AND {3})";
// remove this nasty BETWEEN operation because it depends on the database (!) what results are returned (including or excluding bounds!!!)
string sql
= "SELECT node.id, node.latitude, node.longitude, node.changeset_id, node.timestamp, node.version, " +
"node.usr, node.usr_id, node.visible FROM node WHERE (tile IN ({4})) AND (visible = 1) AND (latitude >= {0} AND latitude < {1} AND longitude >= {2} AND longitude < {3})";
sql = string.Format(sql,
latitude_min.ToString(System.Globalization.CultureInfo.InvariantCulture),
latitude_max.ToString(System.Globalization.CultureInfo.InvariantCulture),
longitude_min.ToString(System.Globalization.CultureInfo.InvariantCulture),
longitude_max.ToString(System.Globalization.CultureInfo.InvariantCulture),
this.ConstructIdList(boxes));
// TODO: parameters.
var com = new SQLiteCommand(sql);
com.Connection = con;
SQLiteDataReader reader = ExecuteReader(com);
Node node = null;
var nodes = new Dictionary<long, Node>();
var nodeIds = new List<long>();
while (reader.Read())
{
node = new Node();
node.Id = reader.GetInt64(0);
int latitude_int = reader.GetInt32(1);
int longitude_int = reader.GetInt32(2);
node.ChangeSetId = reader.IsDBNull(3) ? null : (long?)reader.GetInt64(3);
node.TimeStamp = reader.IsDBNull(4) ? null : (DateTime?)this.ConvertDateTime(reader.GetInt64(4));
node.Version = reader.IsDBNull(5) ? null : (ulong?)reader.GetInt64(5);
node.Latitude = latitude_int / 10000000.0;
node.Longitude = longitude_int / 10000000.0;
node.UserName = reader.IsDBNull(6) ? null : reader.GetString(6);
node.UserId = reader.IsDBNull(7) ? null : (long?)reader.GetInt64(7);
node.Visible = reader.IsDBNull(8) ? null : (bool?)reader.GetBoolean(8);
nodeIds.Add(node.Id.Value);
nodes.Add(node.Id.Value, node);
}
reader.Close();
// STEP2: Load all node tags.
this.LoadNodeTags(nodes);
res.AddRange(nodes.Values);
// load all ways that contain the nodes that have been found.
res.AddRange(this.GetWaysFor(nodeIds));
// get relations containing any of the nodes or ways in the current results-list.
List<Relation> relations = new List<Relation>();
HashSet<long> relationIds = new HashSet<long>();
foreach (OsmGeo osmGeo in res)
{
IList<Relation> relationsFor = this.GetRelationsFor(osmGeo);
foreach (Relation relation in relationsFor)
{
if (!relationIds.Contains(relation.Id.Value))
{
relations.Add(relation);
relationIds.Add(relation.Id.Value);
}
}
}
//.........这里部分代码省略.........
开发者ID:UnifyKit,项目名称:OsmSharp,代码行数:101,代码来源:SQLiteDataSource.cs
示例19: ConvertPlacemark
/// <summary>
/// Converts a placemark into an osm object.
/// </summary>
/// <param name="placemark"></param>
/// <returns></returns>
private void ConvertPlacemark(OsmSharp.Xml.Kml.v2_0_response.Placemark placemark)
{
for (int idx = 0; idx < placemark.Items.Length; idx++)
{
switch (placemark.ItemsElementName[idx])
{
case OsmSharp.Xml.Kml.v2_0_response.ItemsChoiceType1.LineString:
this.GeometryCollection.Add(
KmlGeoStreamSource.ConvertLineString(placemark.Items[idx] as OsmSharp.Xml.Kml.v2_0_response.LineString));
break;
case OsmSharp.Xml.Kml.v2_0_response.ItemsChoiceType1.MultiGeometry:
this.ConvertMultiGeometry(placemark.Items[idx] as OsmSharp.Xml.Kml.v2_0_response.MultiGeometry);
break;
case OsmSharp.Xml.Kml.v2_0_response.ItemsChoiceType1.MultiLineString:
this.GeometryCollection.Add(
KmlGeoStreamSource.ConvertMultiLineString(placemark.Items[idx] as OsmSharp.Xml.Kml.v2_0_response.MultiLineString));
break;
case OsmSharp.Xml.Kml.v2_0_response.ItemsChoiceType1.MultiPoint:
this.GeometryCollection.Add(
KmlGeoStreamSource.ConvertMultiPoint(placemark.Items[idx] as OsmSharp.Xml.Kml.v2_0_response.MultiPoint));
break;
case OsmSharp.Xml.Kml.v2_0_response.ItemsChoiceType1.MultiPolygon:
this.GeometryCollection.Add(
KmlGeoStreamSource.ConvertMultiPolygon(placemark.Items[idx] as OsmSharp.Xml.Kml.v2_0_response.MultiPolygon));
break;
case OsmSharp.Xml.Kml.v2_0_response.ItemsChoiceType1.Point:
this.GeometryCollection.Add(
KmlGeoStreamSource.ConvertPoint(placemark.Items[idx] as OsmSharp.Xml.Kml.v2_0_response.Point));
break;
case OsmSharp.Xml.Kml.v2_0_response.ItemsChoiceType1.Polygon:
this.GeometryCollection.Add(
KmlGeoStreamSource.ConvertPolygon(placemark.Items[idx] as OsmSharp.Xml.Kml.v2_0_response.Polygon));
break;
}
}
}
开发者ID:robert-hickey,项目名称:OsmSharp,代码行数:41,代码来源:KmlGeoStreamSource.cs
示例20: ConvertMultiGeometry
/// <summary>
/// Converts a multigeometry to osm objects.
/// </summary>
/// <param name="multiGeometry"></param>
/// <returns></returns>
private void ConvertMultiGeometry(OsmSharp.Xml.Kml.v2_0.MultiGeometry multiGeometry)
{
for (int idx = 0; idx < multiGeometry.Items.Length; idx++)
{
switch (multiGeometry.ItemsElementName[idx])
{
case OsmSharp.Xml.Kml.v2_0.ItemsChoiceType.LineString:
this.GeometryCollection.Add(
KmlGeoStreamSource.ConvertLineString(multiGeometry.Items[idx] as OsmSharp.Xml.Kml.v2_0.LineString));
break;
case OsmSharp.Xml.Kml.v2_0.ItemsChoiceType.MultiGeometry:
this.ConvertMultiGeometry(multiGeometry.Items[idx] as OsmSharp.Xml.Kml.v2_0.MultiGeometry);
break;
case OsmSharp.Xml.Kml.v2_0.ItemsChoiceType.MultiLineString:
this.GeometryCollection.Add(
KmlGeoStreamSource.ConvertMultiLineString(multiGeometry.Items[idx] as OsmSharp.Xml.Kml.v2_0.MultiLineString));
break;
case OsmSharp.Xml.Kml.v2_0.ItemsChoiceType.MultiPoint:
this.GeometryCollection.Add(
KmlGeoStreamSource.ConvertMultiPoint(multiGeometry.Items[idx] as OsmSharp.Xml.Kml.v2_0.MultiPoint));
break;
case OsmSharp.Xml.Kml.v2_0.ItemsChoiceType.MultiPolygon:
this.GeometryCollection.Add(
KmlGeoStreamSource.ConvertMultiPolygon(multiGeometry.Items[idx] as OsmSharp.Xml.Kml.v2_0.MultiPolygon));
break;
case OsmSharp.Xml.Kml.v2_0.ItemsChoiceType.Point:
this.GeometryCollection.Add(
KmlGeoStreamSource.ConvertPoint(multiGeometry.Items[idx] as OsmSharp.Xml.Kml.v2_0.Point));
break;
case OsmSharp.Xml.Kml.v2_0.ItemsChoiceType.Polygon:
this.GeometryCollection.Add(
KmlGeoStreamSource.ConvertPolygon(multiGeometry.Items[idx] as OsmSharp.Xml.Kml.v2_0.Polygon));
break;
}
}
}
开发者ID:robert-hickey,项目名称:OsmSharp,代码行数:41,代码来源:KmlGeoStreamSource.cs
注:本文中的OsmSharp类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论