/// <summary> /// Returs Kml representation of the point. Note: Z,M values are igonred /// </summary> /// <returns></returns> static IRI.Ket.KmlFormat.Primitives.PlacemarkType AsPlacemark(PolyLineZ polyline, Func <IRI.Ham.SpatialBase.Point, IRI.Ham.SpatialBase.Point> projectToGeodeticFunc = null, byte[] color = null) { IRI.Ket.KmlFormat.Primitives.PlacemarkType placemark = new KmlFormat.Primitives.PlacemarkType(); List <IRI.Ket.KmlFormat.Primitives.LineStringType> linestrings = new List <KmlFormat.Primitives.LineStringType>(); IRI.Ket.KmlFormat.Primitives.MultiGeometryType multiGeometry = new KmlFormat.Primitives.MultiGeometryType(); IEnumerable <string> coordinates; if (projectToGeodeticFunc != null) { coordinates = polyline.parts .Select(i => string.Join(" ", ShapeHelper.GetPoints(polyline, i) .Select(j => { var temp = projectToGeodeticFunc(new IRI.Ham.SpatialBase.Point(j.X, j.Y)); return(string.Format("{0},{1}", temp.X, temp.Y)); }).ToArray())); } else { coordinates = polyline.Parts .Select(i => string.Join(" ", ShapeHelper.GetPoints(polyline, i) .Select(j => string.Format("{0},{1}", j.X, j.Y)) .ToArray())); } foreach (string item in coordinates) { IRI.Ket.KmlFormat.Primitives.LineStringType linestring = new KmlFormat.Primitives.LineStringType(); linestring.coordinates = item; linestrings.Add(linestring); } multiGeometry.AbstractGeometryObjectExtensionGroup = linestrings.ToArray(); placemark.AbstractFeatureObjectExtensionGroup = new KmlFormat.Primitives.AbstractObjectType[] { multiGeometry }; return(placemark); }
/// <summary> /// Returs Kml representation of the point. Note: Point must be in Lat/Long System /// </summary> /// <returns></returns> static IRI.Ket.KmlFormat.Primitives.PlacemarkType AsPlacemark(EsriPolyline polyline, Func <IRI.Msh.Common.Primitives.Point, IRI.Msh.Common.Primitives.Point> projectToGeodeticFunc = null, byte[] color = null) { IRI.Ket.KmlFormat.Primitives.PlacemarkType placemark = new KmlFormat.Primitives.PlacemarkType(); List <IRI.Ket.KmlFormat.Primitives.LineStringType> linestrings = new List <KmlFormat.Primitives.LineStringType>(); IRI.Ket.KmlFormat.Primitives.MultiGeometryType multiGeometry = new KmlFormat.Primitives.MultiGeometryType(); IEnumerable <string> coordinates; if (projectToGeodeticFunc != null) { coordinates = polyline.parts .Select(i => string.Join(" ", ShapeHelper.GetEsriPoints(polyline, i) .Select(j => { var temp = projectToGeodeticFunc(new IRI.Msh.Common.Primitives.Point(j.X, j.Y)); return(string.Format("{0},{1}", temp.X, temp.Y)); }).ToArray())); } else { coordinates = polyline.parts .Select(i => string.Join(" ", ShapeHelper.GetEsriPoints(polyline, i) .Select(j => string.Format("{0},{1}", j.X, j.Y)) .ToArray())); } foreach (string item in coordinates) { IRI.Ket.KmlFormat.Primitives.LineStringType linestring = new KmlFormat.Primitives.LineStringType(); linestring.coordinates = item; linestrings.Add(linestring); } multiGeometry.AbstractGeometry = linestrings.ToArray(); //placemark.AbstractFeatureObjectExtensionGroup = new KmlFormat.Primitives.AbstractObjectType[] { multiGeometry }; placemark.AbstractGeometry = multiGeometry; //IRI.Ket.KmlFormat.Primitives.MultiGeometryType t = new KmlFormat.Primitives.MultiGeometryType(); if (color == null) { return(placemark); } IRI.Ket.KmlFormat.Primitives.StyleType style = new KmlFormat.Primitives.StyleType(); KmlFormat.Primitives.LineStyleType lineStyle = new KmlFormat.Primitives.LineStyleType(); lineStyle.color = color; style.LineStyle = lineStyle; placemark.Styles = new KmlFormat.Primitives.AbstractStyleSelectorType[] { style }; return(placemark); }