/// <summary>
        /// This method populates the given sink with the information about the geography instance
        /// extracted from the KML string
        /// </summary>
        /// <param name="sink">Sink to be filled</param>
        /// <param name="makeValid">If true and the extracted geography instance is invalid then the MakeValid
        /// function will be executed on the extracted geography instance</param>
        public void Populate(
            IGeographySink sink,
            bool makeValid)
        {
            sink.SetSrid(m_Srid);

            int numOfGeographies = m_Parser.Geographies.Count;

            if (numOfGeographies == 1)
            {
                m_Parser.Geographies[0].Populate(sink, makeValid);
            }
            else if (numOfGeographies > 1)
            {
                sink.BeginGeography(OpenGisGeographyType.GeometryCollection);

                foreach (Geography g in m_Parser.Geographies)
                {
                    g.Populate(sink, makeValid);
                }

                sink.EndGeography();
            }
            else
            {
                // Geography instance is not found. The empty geography collection will be generated.
                sink.BeginGeography(OpenGisGeographyType.GeometryCollection);
                sink.EndGeography();
            }
        }
 public void EndGeometry()
 {
     _count--;
     if (_count == 0)
     {
         _sink.EndGeography();
     }
 }
 public void EndGeography()
 {
     if (m_TargetSink != null)
     {
         m_TargetSink.EndGeography();
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// This method populates the given sink with the data from this geography instance
        /// </summary>
        /// <param name="sink">Sink to be populated</param>
        public override void Populate(IGeographySink sink)
        {
            if (this.OuterRing == null || this.OuterRing.Points == null || this.OuterRing.Points.Count == 0)
            {
                return;
            }

            sink.BeginGeography(OpenGisGeographyType.Polygon);

            // Populates the outer boundary
            sink.BeginFigure(
                this.OuterRing.Points[0].Latitude,
                this.OuterRing.Points[0].Longitude,
                this.OuterRing.Points[0].Altitude,
                this.OuterRing.Points[0].Measure);

            for (int i = 1; i < this.OuterRing.Points.Count; i++)
            {
                sink.AddLine(
                    this.OuterRing.Points[i].Latitude,
                    this.OuterRing.Points[i].Longitude,
                    this.OuterRing.Points[i].Altitude,
                    this.OuterRing.Points[i].Measure);
            }

            sink.EndFigure();

            if (this.InnerRing != null && this.InnerRing.Count > 0)
            {
                // Populates the inner boundaries

                for (int j = 0; j < this.InnerRing.Count; j++)
                {
                    if (this.InnerRing[j].Points == null || this.InnerRing[j].Points.Count == 0)
                    {
                        continue;
                    }

                    sink.BeginFigure(
                        this.InnerRing[j].Points[0].Latitude,
                        this.InnerRing[j].Points[0].Longitude,
                        this.InnerRing[j].Points[0].Altitude,
                        this.InnerRing[j].Points[0].Measure);

                    for (int i = 1; i < this.InnerRing[j].Points.Count; i++)
                    {
                        sink.AddLine(
                            this.InnerRing[j].Points[i].Latitude,
                            this.InnerRing[j].Points[i].Longitude,
                            this.InnerRing[j].Points[i].Altitude,
                            this.InnerRing[j].Points[i].Measure);
                    }

                    sink.EndFigure();
                }
            }

            sink.EndGeography();
        }
Ejemplo n.º 5
0
 public void EndGeography()
 {
     m_depth -= 1;
     if (m_depth > 0)
     {
         m_sink.EndGeography();
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// This method populates the given sink with the data about this geography instance
        /// </summary>
        /// <param name="sink">Sink to be populated</param>
        public override void Populate(IGeographySink sink)
        {
            sink.BeginGeography(OpenGisGeographyType.Point);
            sink.BeginFigure(Latitude, Longitude, Altitude, Measure);

            sink.EndFigure();
            sink.EndGeography();
        }
 public void BeginGeography(OpenGisGeographyType type)
 {
     if (type == OpenGisGeographyType.Point || type == OpenGisGeographyType.MultiPoint)
     {
         if (m_root)
         {
             m_root = false;
             m_sink.BeginGeography(OpenGisGeographyType.GeometryCollection);
             m_sink.EndGeography();
         }
         m_depth++;
     }
     else
     {
         m_root = false;
         m_sink.BeginGeography(type);
     }
 }
 public void EndGeography()
 {
     if (m_types.Count > 0)
     {
         m_types.Dequeue();
     }
     else
     {
         m_sink.EndGeography();
     }
 }
Ejemplo n.º 9
0
        /// <summary>
        /// This method populates the given sink with the data from this geography instance
        /// </summary>
        /// <param name="sink">Sink to be populated</param>
        public override void Populate(IGeographySink sink)
        {
            if (Points == null || Points.Count == 0)
            {
                return;
            }

            sink.BeginGeography(m_OpenGisGeographyType);
            sink.BeginFigure(Points[0].Latitude, Points[0].Longitude, Points[0].Altitude, Points[0].Measure);

            for (int i = 1; i < Points.Count; i++)
            {
                sink.AddLine(Points[i].Latitude, Points[i].Longitude, Points[i].Altitude, Points[i].Measure);
            }

            sink.EndFigure();
            sink.EndGeography();
        }
Ejemplo n.º 10
0
 public void EndGeography()
 {
     _target.EndGeography();
 }
Ejemplo n.º 11
0
 public void EndGeography()
 {
     m_sink.EndGeography();
 }
Ejemplo n.º 12
0
 public void EndGeometry()
 {
     _sink.EndGeography();
 }