Пример #1
0
        /// <summary>Returns the geometry defined by the specified WKB representation, in the specified coordinate system.</summary>
        /// <param name="data">The WKB representation of the geometry.</param>
        /// <param name="system">The coordinate system of the WKB representation.</param>
        public void Parse(byte[] data, ICoordinateSystem system)
        {
            Debug.Assert(system != null);
            if (system == null)
            {
                throw new ArgumentNullException("system");
            }

            var g = Factory.CreateGeometryFromWkb(data);

            if ((TargetSystem != null) && !system.IsEquivalentTo(TargetSystem))
            {
                if (_Geometry != null)
                {
                    _Geometry.Dispose();
                    _Geometry = null;
                }
                using (var orig = new FdoGeometry(g, system))
                    orig.Populate(this);
            }
            else
            {
                _Geometry = new FdoGeometry(g, system);
            }
        }
Пример #2
0
        /// <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;
                }
            }
        }
Пример #3
0
 /// <summary>Converts the specified <paramref name="geometry" /> into a <see cref="FGeometry.IGeometry" />.</summary>
 /// <param name="geometry">The geometry to convert.</param>
 /// <returns>The converted geometry.</returns>
 public static FGeometry.IGeometry ToGeometry(FdoGeometry geometry)
 {
     return geometry._Geometry;
 }
Пример #4
0
        /// <summary>Returns the geometry defined by the specified WKB representation, in the specified coordinate system.</summary>
        /// <param name="data">The WKB representation of the geometry.</param>
        /// <param name="system">The coordinate system of the WKB representation.</param>
        public void Parse(byte[] data, ICoordinateSystem system)
        {
            Debug.Assert(system!=null);
            if (system==null)
                throw new ArgumentNullException("system");

            var g=Factory.CreateGeometryFromWkb(data);

            if ((TargetSystem!=null) && !system.IsEquivalentTo(TargetSystem))
            {
                if (_Geometry!=null)
                {
                    _Geometry.Dispose();
                    _Geometry=null;
                }
                using (var orig=new FdoGeometry(g, system))
                    orig.Populate(this);
            } else
                _Geometry=new FdoGeometry(g, system);
        }
Пример #5
0
 /// <summary>Converts the specified <paramref name="geometry" /> into a <see cref="FGeometry.IGeometry" />.</summary>
 /// <param name="geometry">The geometry to convert.</param>
 /// <returns>The converted geometry.</returns>
 public static FGeometry.IGeometry ToGeometry(FdoGeometry geometry)
 {
     return(geometry._Geometry);
 }
Пример #6
0
 /// <summary>Indicates whether the current geometry contains the specified <paramref name="geometry" /> or not.</summary>
 /// <param name="geometry">The geometry to test against.</param>
 /// <returns><c>true</c> if the current geometry contains the specified <paramref name="geometry" />, or else <c>false</c>.</returns>
 public bool Contains(ISimpleGeometry geometry)
 {
     using (FdoGeometry other = Convert(geometry))
         return(FSpatial.SpatialUtility.Evaluate(_Geometry, FFilter.SpatialOperations.SpatialOperations_Contains, other._Geometry));
 }