/// <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 BeginGeometry(OpenGisGeometryType type)
 {
     if (_count == 0)
     {
         _sink.BeginGeography(OpenGisGeographyType.MultiPoint);
     }
     _count++;
 }
 public void BeginGeography(OpenGisGeographyType type)
 {
     if (m_root)
     {
         m_root = false;
         m_sink.BeginGeography(type);
     }
     else
     {
         m_types.Enqueue(type);
     }
 }
 public void BeginGeography(OpenGisGeographyType type)
 {
     if (m_TargetSink != null)
     {
         m_TargetSink.BeginGeography(type);
     }
 }
Exemplo n.º 5
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();
        }
Exemplo 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);
     }
 }
Exemplo n.º 8
0
 public void BeginGeography(OpenGisGeographyType type)
 {
     if (m_depth > 0)
     {
         m_sink.BeginGeography(type);
     }
     else
     {
         Debug.Assert(OpenGisGeographyType.GeometryCollection == type);
     }
     m_depth += 1;
 }
Exemplo 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();
        }
Exemplo n.º 10
0
 public void BeginGeography(OpenGisGeographyType type)
 {
     _target.BeginGeography(type);
 }
Exemplo n.º 11
0
 public void BeginGeography(OpenGisGeographyType type)
 {
     m_sink.BeginGeography(type);
 }
Exemplo n.º 12
0
 public void BeginGeometry(OpenGisGeometryType type)
 {
     // Convert geography to geometry types...
     _target.BeginGeography((OpenGisGeographyType)type);
 }
Exemplo n.º 13
0
 public void BeginGeometry(OpenGisGeometryType type)
 {
     _sink.BeginGeography((OpenGisGeographyType)type);
 }
 public void BeginGeography(OpenGisGeographyType type)
 {
     m_sink.BeginGeography(type);
     m_insidePolygon = type == OpenGisGeographyType.Polygon;
 }
 public void BeginGeography(OpenGisGeographyType type)
 {
     m_sink.BeginGeography(type);
     m_insideLineString = type == OpenGisGeographyType.LineString;
 }