Exemplo n.º 1
0
        /// <summary>Converts a geometry into its GML representation.</summary>
        /// <param name="writer">The stream to which the geometry is serialized. </param>
        public void WriteXml(XmlWriter writer)
        {
            var builder = new Gml.GmlGeometryBuilder();

            Populate(builder);
            IXmlSerializable xg = builder.ConstructedGeometry;

            xg.WriteXml(writer);
        }
Exemplo n.º 2
0
        /// <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");

            _Builder=new Gml.GmlGeometryBuilder(system);
            _Builder.Parse(text, system);
        }
Exemplo n.º 3
0
            protected override string GetCustomImplementationName(List <Type> paramTypes, List <object> paramValues, ExpressionBuilderParameters parameters)
            {
                paramTypes.Add(typeof(IGeometry));
                IGeometryBuilder builder = new Gml311.GmlGeometryBuilder();

                FilterElement.Envelope.Populate(builder);
                paramValues.Add(builder.ConstructedGeometry);

                return(OperationNames.Intersects);
            }
Exemplo n.º 4
0
 internal override void BeginGeometry(GeometryType type)
 {
     if (_Builder == null)
     {
         Debug.Assert(_CurrentType.Count == 0);
         _Builder = new GmlGeometryBuilder();
         _Builder.SetCoordinateSystem(CoordinateSystem);
     }
     _Builder.BeginGeometry(type);
     _CurrentType.Push(type);
 }
Exemplo n.º 5
0
 internal override void BeginGeometry(GeometryType type)
 {
     if (_Builder==null)
     {
         Debug.Assert(_CurrentType.Count==0);
         _Builder=new GmlGeometryBuilder();
         _Builder.SetCoordinateSystem(CoordinateSystem);
     }
     _Builder.BeginGeometry(type);
     _CurrentType.Push(type);
 }
Exemplo n.º 6
0
        /// <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");
            }

            _Builder = new Gml.GmlGeometryBuilder(system);
            _Builder.Parse(text, system);
        }
Exemplo n.º 7
0
        public void ShouldReverseGeometries(string input, string expected)
        {
            var obuilder=new Ogc.Gml.V311.GmlGeometryBuilder();
            obuilder.Parse(input, CommonServiceLocator.GetCoordinateSystemProvider().Wgs84);

            var builder=new Ogc.Gml.V311.GmlGeometryBuilder();
            var rsink=new ReversedGeometrySink(builder);
            obuilder.ConstructedGeometry.Populate(rsink);

            var g=builder.ConstructedGeometry;

            Assert.Equal<string>(expected, g.ToString());
        }
Exemplo n.º 8
0
        /// <summary>Parses 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>
        void IGeometryBuilder.Parse(byte[] data, ICoordinateSystem system)
        {
            Debug.Assert(system != null);
            if (system == null)
            {
                throw new ArgumentNullException("system");
            }

            var g = DbGeometry.FromBinary(data);

            _Builder = new Gml.GmlGeometryBuilder(system);
            _Builder.Parse(g.AsText(), system);
        }
Exemplo n.º 9
0
        public void ShouldReverseGeometries(string input, string expected)
        {
            var obuilder = new Ogc.Gml.V311.GmlGeometryBuilder();

            obuilder.Parse(input, CommonServiceLocator.GetCoordinateSystemProvider().Wgs84);

            var builder = new Ogc.Gml.V311.GmlGeometryBuilder();
            var rsink   = new ReversedGeometrySink(builder);

            obuilder.ConstructedGeometry.Populate(rsink);

            var g = builder.ConstructedGeometry;

            Assert.Equal <string>(expected, g.ToString());
        }
Exemplo n.º 10
0
        /// <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;
            }
        }
Exemplo n.º 11
0
        /// <summary>Converts a geometry into its GML representation.</summary>
        /// <param name="writer">The stream to which the geometry is serialized. </param>
        public void WriteXml(XmlWriter writer)
        {
            var builder=new Gml.GmlGeometryBuilder(_CoordinateSystem);
            Populate(builder);
            IXmlSerializable xg=builder.ConstructedGeometry;

            xg.WriteXml(writer);
        }
Exemplo n.º 12
0
        /// <summary>Parses 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>
        void IGeometryBuilder.Parse(byte[] data, ICoordinateSystem system)
        {
            Debug.Assert(system!=null);
            if (system==null)
                throw new ArgumentNullException("system");

            var g=DbGeometry.FromBinary(data);
            _Builder=new Gml.GmlGeometryBuilder(system);
            _Builder.Parse(g.AsText(), system);
        }
Exemplo n.º 13
0
        /// <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;
        }
Exemplo n.º 14
0
 /// <summary>Creates a new instance of the <see cref="SpatialGeometryBuilder" /> class.</summary>
 /// <param name="targetSystem">The target coordinate system. If different from the source, transformations will occur.</param>
 public SpatialGeometryBuilder(ICoordinateSystem targetSystem):
     base(targetSystem)
 {
     _Builder=new Gml.GmlGeometryBuilder();
     _CoordinateSystem=targetSystem;
 }
Exemplo n.º 15
0
 /// <summary>Creates a new instance of the <see cref="SpatialGeometryBuilder" /> class.</summary>
 public SpatialGeometryBuilder():
     base()
 {
     _Builder=new Gml.GmlGeometryBuilder();
 }
Exemplo n.º 16
0
 /// <summary>Creates a new instance of the <see cref="SpatialGeometryBuilder" /> class.</summary>
 public SpatialGeometryBuilder() :
     base()
 {
     _Builder = new Gml.GmlGeometryBuilder();
 }
Exemplo n.º 17
0
 /// <summary>Creates a new instance of the <see cref="SpatialGeometryBuilder" /> class.</summary>
 /// <param name="targetSystem">The target coordinate system. If different from the source, transformations will occur.</param>
 public SpatialGeometryBuilder(ICoordinateSystem targetSystem) :
     base(targetSystem)
 {
     _Builder          = new Gml.GmlGeometryBuilder();
     _CoordinateSystem = targetSystem;
 }