예제 #1
0
파일: Point.cs 프로젝트: nakijun/geosik
        internal protected override void InternalPopulate(IGeometrySink sink)
        {
            int dim = 2;

            if (srsDimension.HasValue)
            {
                dim = Convert.ToInt32(srsDimension.Value);
            }

            sink.BeginGeometry(GeometryType.Point);

            //if (pos!=null)
            if (Untyped.Descendants("{http://www.opengis.net/gml}pos").Any <XElement>())
            {
                if (pos.srsDimension.HasValue)
                {
                    dim = Convert.ToInt32(pos.srsDimension.Value);
                }

                if ((pos.TypedValue != null) && (pos.TypedValue.Count >= dim))
                {
                    sink.BeginFigure(pos.TypedValue[0], pos.TypedValue[1], dim > 2 ? pos.TypedValue[2] : (double?)null);
                    sink.EndFigure();
                }
            }

            sink.EndGeometry();
        }
예제 #2
0
파일: Polygon.cs 프로젝트: nakijun/geosik
 protected override void PopulateEnvelope(Envelope envelope)
 {
     //if ((exterior!=null) && (exterior._Ring!=null))
     if (
         Untyped.Descendants("{http://www.opengis.net/gml}exterior").Any <XElement>() &&
         exterior.Untyped.Descendants("{http://www.opengis.net/gml}LinearRing").Any <XElement>()
         )
     {
         exterior._Ring.Populate(envelope);
     }
 }
예제 #3
0
        /// <summary>Fills the current bounding box with the specified geometry information.</summary>
        /// <param name="g">THe geometry to fill this bounding box with.</param>
        public void InitFromGeometry(ISimpleGeometry g)
        {
            if (g == null)
            {
                LowerCorner = null;
                UpperCorner = null;
                return;
            }

            CoordinateSystem = g.CoordinateSystem;

            var lc = new List <double>(2);
            var uc = new List <double>(2);

            ISimpleGeometry env = g.Envelope();

            var envelope = env as Gml.V311.Envelope;

            if (envelope == null)
            {
                envelope = new Gml.V311.Envelope();
                env.Populate(envelope);
            }
            Debug.Assert(envelope != null);

            lc.Add(envelope.lowerCorner.TypedValue[0]);
            lc.Add(envelope.lowerCorner.TypedValue[1]);
            uc.Add(envelope.upperCorner.TypedValue[0]);
            uc.Add(envelope.upperCorner.TypedValue[1]);

            // Bug in LinqToXsd : serialization is culture dependent...
            //LowerCorner=lc;
            //UpperCorner=uc;
            LowerCorner = new List <double>();
            foreach (XElement el in Untyped.Descendants("{http://www.opengis.net/ows}LowerCorner"))
            {
                el.Value = string.Join(
                    " ",
                    lc.Select <double, string>(d => d.ToString(CultureInfo.InvariantCulture))
                    );
            }
            UpperCorner = new List <double>();
            foreach (XElement el in Untyped.Descendants("{http://www.opengis.net/ows}UpperCorner"))
            {
                el.Value = string.Join(
                    " ",
                    uc.Select <double, string>(d => d.ToString(CultureInfo.InvariantCulture))
                    );
            }
        }
예제 #4
0
        protected internal override void InternalPopulate(IGeometrySink sink)
        {
            sink.BeginGeometry(GeometryType.MultiPolygon);

            //if ((polygonMember!=null)
            if (Untyped.Descendants("{http://www.opengis.net/gml}polygonMember").Any <XElement>())
            {
                foreach (polygonMember p in polygonMember)
                {
                    p.Polygon.Populate(sink);
                }
            }

            sink.EndGeometry();
        }
예제 #5
0
        protected internal override void InternalPopulate(IGeometrySink sink)
        {
            sink.BeginGeometry(GeometryType.MultiLineString);

            //if ((lineStringMember!=null)
            if (Untyped.Descendants("{http://www.opengis.net/gml}lineStringMember").Any <XElement>())
            {
                foreach (lineStringMember l in lineStringMember)
                {
                    l.LineString.Populate(sink);
                }
            }

            sink.EndGeometry();
        }
예제 #6
0
        protected internal override void InternalPopulate(IGeometrySink sink)
        {
            sink.BeginGeometry(GeometryType.GeometryCollection);

            //if ((geometryMember!=null)
            if (Untyped.Descendants("{http://www.opengis.net/gml}geometryMember").Any <XElement>())
            {
                foreach (geometryMember g in geometryMember)
                {
                    g._Geometry.Populate(sink);
                }
            }

            sink.EndGeometry();
        }
예제 #7
0
        internal protected override void InternalPopulate(IGeometrySink sink)
        {
            sink.BeginGeometry(GeometryType.LineString);

            //if (posList!=null)
            if (Untyped.Descendants("{http://www.opengis.net/gml}posList").Any <XElement>())
            {
                if ((posList.TypedValue != null) && (posList.TypedValue.Count >= 2))
                {
                    sink.BeginFigure(posList.TypedValue[0], posList.TypedValue[1], null);
                    for (int i = 2; i < posList.TypedValue.Count; i += 2)
                    {
                        sink.AddLine(posList.TypedValue[i], posList.TypedValue[i + 1], null);
                    }
                    sink.EndFigure();
                }
            }

            sink.EndGeometry();
        }