Ejemplo n.º 1
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.º 2
0
        public void AddLine(double latitude, double longitude, double?z, double?m)
        {
            // Transforming from geodetic coordinates to a unit vector.
            Vector3 endPoint = Util.SphericalDegToCartesian(latitude, longitude);

            double angle = endPoint.Angle(_startPoint);

            if (angle > MinAngle)
            {
                // _startPoint and endPoint are the unit vectors that correspond to the input
                // start and end points.  In their 3D space we operate in a local coordinate system
                // where _startPoint is the x axis and the xy plane contains endPoint. Every
                // point is now generated from the previous one by a fixed rotation in the local
                // xy plane, and converted back to geodetic coordinates.

                // Construct the local z and y axes.
                Vector3 zAxis = (_startPoint + endPoint).CrossProduct(_startPoint - endPoint).Unitize();
                Vector3 yAxis = (_startPoint).CrossProduct(zAxis);

                // Calculating how many points we need.
                int count = Convert.ToInt32(Math.Ceiling(angle / Util.ToRadians(_angle)));

                // Scaling the angle so that points are equaly placed.
                double exactAngle = angle / count;

                double cosine = Math.Cos(exactAngle);
                double sine   = Math.Sin(exactAngle);

                // Setting the first x and y points in our local coordinate system.
                double x = cosine;
                double y = sine;

                for (int i = 0; i < count - 1; i++)
                {
                    Vector3 newPoint = (_startPoint * x + yAxis * y).Unitize();

                    // Adding the point.
                    _sink.AddLine(Util.LatitudeDeg(newPoint), Util.LongitudeDeg(newPoint), null, null);

                    // Rotating to get next point.
                    double r = x * cosine - y * sine;
                    y = x * sine + y * cosine;
                    x = r;
                }
            }
            _sink.AddLine(latitude, longitude, z, m);

            // Remembering last point we added.
            _startPoint = endPoint;
        }
 public void AddLine(double latitude, double longitude, double?z, double?m)
 {
     if (m_TargetSink != null)
     {
         m_TargetSink.AddLine(latitude, longitude, z, m);
     }
 }
        public void AddLine(double x, double y, double?z, double?m)
        {
            double latitude, longitude;

            _projection.UnprojectPoint(x, y, out latitude, out longitude);
            _sink.AddLine(latitude, longitude, z, m);
        }
 public void AddLine(double latitude, double longitude, double?z, double?m)
 {
     if (m_depth == 0)
     {
         m_sink.AddLine(latitude, longitude, z, m);
     }
 }
Ejemplo n.º 6
0
        public void AddLine(double latitude, double longitude, Nullable <double> z, Nullable <double> m)
        {
            double[] fromPoint = { longitude, latitude };
            double[] toPoint   = _trans.MathTransform.Transform(fromPoint);
            double   tolong    = toPoint[0];
            double   tolat     = toPoint[1];

            _sink.AddLine(tolat, tolong, z, m);
        }
Ejemplo n.º 7
0
        public void AddLine(double x, double y, double?z, double?m)
        {
            double[] fromPoint = { x, y };
            double[] toPoint   = _trans.MathTransform.Transform(fromPoint);
            double   longitude = toPoint[0];
            double   latitude  = toPoint[1];

            _sink.AddLine(latitude, longitude, z, m);
        }
 public void AddLine(double latitude, double longitude, double?z, double?m)
 {
     if (m_insidePolygon)
     {
         m_figure.Add(new Vertex(latitude, longitude, z, m));
     }
     else
     {
         m_sink.AddLine(latitude, longitude, z, m);
     }
 }
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
 // Each AddLine call rounds subsequent points to the required precision.
 public void AddLine(double x, double y, double?z, double?m)
 {
     _target.AddLine(Math.Round(x, _precision), Math.Round(y, _precision), z, m);
 }
Ejemplo n.º 11
0
 public void AddLine(double latitude, double longitude, double?z, double?m)
 {
     m_sink.AddLine(latitude, longitude, z, m);
 }
Ejemplo n.º 12
0
 public void AddLine(double x, double y, double?z, double?m)
 {
     _target.AddLine(y, x, z, m);
 }
Ejemplo n.º 13
0
 public void AddLine(IGeographySink sink)
 {
     sink.AddLine(x, y, z, m);
 }