/// <summary>Generates a geometry from its GML representation.</summary> /// <param name="reader">The stream from which the geometry is deserialized. </param> void IXmlSerializable.ReadXml(XmlReader reader) { var xdoc = new XmlDocument(); xdoc.Load(reader); Gml._Geometry g = Gml._Geometry.Parse(xdoc.DocumentElement.OuterXml); var builder = new SharpGeometryBuilder(); g.Populate(builder); _Geometry = SharpGeometry.ToGeometry(builder.ConstructedGeometry); }
/// <summary>Parses the geometry defined by the specified WKT representation, in the specified coordinate system.</summary> /// <param name="text">The WKT representation of the geometry.</param> /// <param name="system">The coordinate system of the WKT representation.</param> public void Parse(string text, ICoordinateSystem system) { Debug.Assert(system != null); if (system == null) { throw new ArgumentNullException("system"); } IGeometryBuilder builder = new GmlGeometryBuilder(); SimpleFeature.GeometryWktGrammar.Populate(builder, text, system); _Geometry g = (_Geometry)builder.ConstructedGeometry; if ((TargetSystem != null) && !system.IsEquivalentTo(TargetSystem)) { g.Populate(this); } else { _Geometry = g; } }
/// <summary>Generates a geometry from its GML representation.</summary> /// <param name="reader">The stream from which the geometry is deserialized. </param> void IXmlSerializable.ReadXml(XmlReader reader) { var xdoc = new XmlDocument(); xdoc.Load(reader); Gml._Geometry g = Gml._Geometry.Parse(xdoc.DocumentElement.OuterXml); using (var builder = new FdoGeometryBuilder()) { g.Populate(builder); if (_Geometry != null) { _Geometry.Dispose(); _Geometry = null; _CoordinateSystem = null; } using (FdoGeometry ng = builder.ConstructedGeometry) { _Geometry = FdoGeometry.ToGeometry(ng); _CoordinateSystem = ng._CoordinateSystem; } } }
/// <summary>Applies a geometry type call sequence to the specified <paramref name="sink" />.</summary> /// <param name="sink">The sink to populate.</param> /// <remarks> /// <para>The call sequence is a set of figures, lines, and points for geometry types.</para> /// </remarks> public void Populate(IGeometrySink sink) { Gml._Geometry g = Gml._Geometry.Parse(_Geography.AsGml()); g.Populate(sink); }