public static void Serialize(XmlWriter writer, AbstractGeometryType gmlObject) { XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces(); namespaces.Add(string.Empty, string.Empty); namespaces.Add("gml", "http://www.opengis.net/gml/3.2"); if (gmlObject is MultiCurveType) { MultiCurveSerializer.Serialize(writer, gmlObject, namespaces); return; } if (gmlObject is MultiSurfaceType) { MultiSurfaceSerializer.Serialize(writer, gmlObject, namespaces); return; } if (gmlObject is MultiPointType) { MultiPointSerializer.Serialize(writer, gmlObject, namespaces); return; } if (gmlObject is LineStringType) { LineStringSerializer.Serialize(writer, gmlObject, namespaces); return; } if (gmlObject is PolygonType) { PolygonSerializer.Serialize(writer, gmlObject, namespaces); return; } if (gmlObject is PointType) { PointSerializer.Serialize(writer, gmlObject, namespaces); return; } throw new NotImplementedException(gmlObject.GetType().ToString()); }
public static GeometryObject ToGeometry(this AbstractGeometryType gmlObject) { if (gmlObject == null) { throw new ArgumentNullException("gmlObject"); } if (gmlObject is MultiCurveType) { return(((MultiCurveType)gmlObject).ToGeometry()); } if (gmlObject is MultiSurfaceType) { return(((MultiSurfaceType)gmlObject).ToGeometry()); } if (gmlObject is MultiPointType) { return(((MultiPointType)gmlObject).ToGeometry()); } throw new NotImplementedException(gmlObject.GetType().ToString()); }