Ejemplo n.º 1
0
        /// <summary>
        /// Create a new polygon geo shape.
        /// </summary>
        /// <param name="Id">The Id of the shape.</param>
        /// <param name="Latitude">The latitude of the shape center.</param>
        /// <param name="Longitude">The longitude of the shape center.</param>
        /// <param name="Altitude">The altitude of the shape center.</param>
        /// <param name="GeoWidth">The geographical width of the shape center.</param>
        /// <param name="GeoHeight">The geographical height of the shape center.</param>
        public GeoShape(SDL Geometries,
                        GeoBoundingBox GeoBoundingBox,
                        Brush Fill,
                        Brush Stroke,
                        Double StrokeThickness)

        {
            this.Id          = Id;
            this.GeoBounding = GeoBoundingBox;

            var DrawingGroup = new DrawingGroup();

            DrawingGroup.Children.Add(new GeometryDrawing(Fill,
                                                          new Pen(Stroke, StrokeThickness),
                                                          PathGeometry.Parse(Geometries.Value)));

            this.Fill = new DrawingBrush()
            {
                Drawing  = DrawingGroup,
                TileMode = TileMode.None,
                Stretch  = Stretch.UniformToFill
            };

            Bounds = DrawingGroup.Bounds;
        }
Ejemplo n.º 2
0
        CreateRaster(GeoBoundingBox BoundingBox,
                     Double LatitudeSize,
                     Double LongitudeSize,
                     IList <Point> Shape)

        {
            // Longitude west<->east

            var CurrentLatitude  = BoundingBox.Latitude2;
            var CurrentLongitude = BoundingBox.Longitude;
            var Boxes            = new List <GeoBoundingBox>();

            while (CurrentLatitude >= BoundingBox.Latitude)
            {
                CurrentLongitude = BoundingBox.Longitude;

                while (CurrentLongitude <= BoundingBox.Longitude2)
                {
                    if (PolyContainsPoint(Shape, new Point(CurrentLongitude.Value, CurrentLatitude.Value)) ||
                        PolyContainsPoint(Shape, new Point(CurrentLongitude.Value, CurrentLatitude.Value - LatitudeSize)) ||
                        PolyContainsPoint(Shape, new Point(CurrentLongitude.Value + LongitudeSize, CurrentLatitude.Value)) ||
                        PolyContainsPoint(Shape, new Point(CurrentLongitude.Value + LongitudeSize, CurrentLatitude.Value - LatitudeSize)))
                    {
                        Boxes.Add(new GeoBoundingBox(CurrentLatitude,
                                                     CurrentLongitude,
                                                     new Latitude(CurrentLatitude.Value - LatitudeSize),
                                                     new Longitude(CurrentLongitude.Value + LongitudeSize)));
                    }

                    CurrentLongitude = new Longitude(CurrentLongitude.Value + LongitudeSize);
                }

                CurrentLatitude = new Latitude(CurrentLatitude.Value - LatitudeSize);
            }

            return(Boxes);
        }