Example #1
0
        protected override void updateVisual(PolygonObject item)
        {
            switch (item.Polygon.Header.ShorelinesFlags)
            {
            case GSHHGFlag.AntarticaGround:
                item.Fill = this.AntarcticaFill;
                break;

            case GSHHGFlag.AntarticaIce:
                item.Fill = this.AntarcticaIceFrontFill;
                break;

            default:
                item.Fill = item.Polygon.Header.IsLand ? this.LandFill : this.WaterFill;
                break;
            }
        }
Example #2
0
        private IEnumerable <IEnumerable <PixelCoordinates> > getPoints(PolygonObject polygonObject, bool crossesLeftToRight, bool crossesRightToLeft)
        {
            var points = polygonObject.Polygon.Points;

            if (points == null)
            {
                return(new IEnumerable <PixelCoordinates> [0]);
            }
            else if (!crossesLeftToRight && !crossesRightToLeft)
            {
                return(new IEnumerable <PixelCoordinates>[]
                {
                    points.Select(point => this.Map.Projection.LatLonToPixel(new LatLonCoordinates()
                    {
                        Latitude = point.Latitude, Longitude = point.Longitude.FixCoordinate(false)
                    })).ToList()
                });
            }
            else
            {
                var left  = new PixelCoordinates[points.Length];
                var right = new PixelCoordinates[points.Length];
                for (int i = 0; i < points.Length; i++)
                {
                    var point      = points[i];
                    var rightPoint = crossesLeftToRight ? point : new LatLonCoordinates()
                    {
                        Latitude = point.Latitude, Longitude = point.Longitude + 360
                    };
                    var leftPoint = crossesRightToLeft ? point : new LatLonCoordinates()
                    {
                        Latitude = point.Latitude, Longitude = point.Longitude - 360
                    };
                    right[i] = this.Map.Projection.LatLonToPixel(rightPoint);
                    left[i]  = this.Map.Projection.LatLonToPixel(leftPoint);
                }
                return(new IEnumerable <PixelCoordinates>[] { right, left });
            }
        }
Example #3
0
 protected virtual void updateVisual(PolygonObject item)
 {
 }
Example #4
0
        private void updatePoints(PolygonObject polygonObject, RedrawType redrawType, Transform transform)
        {
            var duplicate      = false;
            var boundaries     = polygonObject.Polygon.Header.Boundaries;
            var boundaryCenter = boundaries.Center;

            if (this.Map.RotateReference)
            {
                boundaryCenter = this.Map.Boundaries.Center.GetNewCoordinates(boundaryCenter);
            }
            var crossesLeftToRight = boundaryCenter.Longitude <180 && boundaryCenter.Longitude + boundaries.LongitudeHalfSpan> this.Map.Boundaries.RightLongitude && boundaryCenter.Longitude + boundaries.LongitudeHalfSpan - 360 > -180;
            var crossesRightToLeft = boundaryCenter.Longitude > -180 && boundaryCenter.Longitude - boundaries.LongitudeHalfSpan < this.Map.Boundaries.LeftLongitude && boundaryCenter.Longitude - boundaries.LongitudeHalfSpan + 360 < 180;

            if (crossesLeftToRight || crossesRightToLeft)
            {
                duplicate = true;
            }

            var useTransform = true;

            if (duplicate)
            {
                useTransform = false;
            }
            else if (polygonObject.PixelPoints?.Any() ?? false)
            {
                useTransform = false;
            }
            else
            {
                const RedrawType transformRedrawTypes = RedrawType.Translate | RedrawType.Scale | RedrawType.AnimationStepChanged | RedrawType.DisplayTypeChanged | RedrawType.Redraw;
                switch (redrawType & ~transformRedrawTypes)
                {
                case RedrawType.None:
                    break;

                case RedrawType.Translate:
                    useTransform = this.Map.Projection.CanUseTransformForTranslate;
                    break;

                default:
                    useTransform = false;
                    break;
                }
            }
            if (useTransform)
            {
                foreach (var pixelPoints in polygonObject.PixelPoints)
                {
                    foreach (var point in pixelPoints)
                    {
                        var newPoint = transform.Transform(point);
                        point.X = newPoint.X;
                        point.Y = newPoint.Y;
                    }
                }
            }
            else
            {
                polygonObject.PixelPoints = getPoints(polygonObject, crossesLeftToRight, crossesRightToLeft);
            }
        }
Example #5
0
 protected virtual void removeChild(PolygonObject item)
 {
 }