/// <summary> /// Returns the GeoElement position in the map. /// The point is calculated based on the type of the geometry: /// - Point: Just the point's position /// - LineString: The first point's position /// - Geometry: The closest point to the geometry /// </summary> /// <param name="geoElementMB">Element to return positioning of</param> /// <returns>The position in latitude and longitude Vector2d format</returns> private Vector2d GetGeoElementPosition(GeoElementMB geoElementMB) { switch (geoElementMB.Element.Geometry.Type) { case GMLGeometry.GeometryType.LineString: return(geoElementMB.Element.Geometry.Points[0]); default: case GMLGeometry.GeometryType.Polygon: case GMLGeometry.GeometryType.Point: return(geoElementMB.Element.Geometry.Center); } }
/// <summary> /// Returns the GeoElement position in the map. /// The point is calculated based on the type of the geometry: /// - Point: Just the point's position /// - LineString: The first point's position /// - Geometry: The closest point to the geometry /// </summary> /// <param name="geoElementMB">Element to return positioning of</param> /// <returns>The position in latitude and longitude Vector2d format</returns> private Vector2d GetGeoElementPosition(GeoElementMB geoElementMB) { var geometry = geoElementMB.Geometry; if (geometry == null) { return(Vector2d.zero); } switch (geometry.Type) { case GMLGeometry.GeometryType.LineString: return(geometry.Points[0]); default: case GMLGeometry.GeometryType.Polygon: case GMLGeometry.GeometryType.Point: return(geometry.Center); } }
/// <summary> /// Returns the GeoElement position in the map. /// The point is calculated based on the type of the geometry: /// - Point: Just the point's position /// - LineString: The first point's position /// - Geometry: The closest point to the geometry /// </summary> /// <param name="geoElementMB">Element to return positioning of</param> /// <returns>The position in latitude and longitude Vector2d format</returns> private Vector2d GetGeoElementPosition(GeoElementMB geoElementMB) { var geometry = geoElementMB.Geometry; if (geometry == null) { return(Vector2d.zero); } switch (geometry.Type) { case GMLGeometry.GeometryType.LineString: int step; completedElementsForStep.TryGetValue(currentStep, out step); return(geometry.Points[step]); default: case GMLGeometry.GeometryType.Polygon: case GMLGeometry.GeometryType.Point: return(geometry.Center); } }