示例#1
0
 private void drawLayer(ILayer layer, RedrawType redrawType)
 {
     if ((redrawType & layer.HandledRedrawTypes) != RedrawType.None)
     {
         drawLayer(layer, _childrenDictionary[layer], redrawType, _map);
     }
 }
示例#2
0
 public DrawContext(UIElement container, RedrawType redrawType, Transform transform, MatrixTransform cumulativeTransform, LatLonBoundaries boundaries, IProjection projection, DisplayType displayType, long animationStep)
 {
     this.Container           = container;
     this.RedrawType          = redrawType;
     this.Transform           = transform;
     this.CumulativeTransform = cumulativeTransform;
     this.Boundaries          = boundaries;
     this.Projection          = projection;
     this.DisplayType         = displayType;
     this.AnimationStep       = animationStep;
 }
示例#3
0
        private void draw(RedrawType redrawType)
        {
            if ((redrawType & ~(RedrawType.Redraw | RedrawType.Scale | RedrawType.Translate)) != RedrawType.None)
            {
                _currentTransform = Transform.Identity;
                _currentTransform.Freeze();
                _cumulativeTransform.Matrix.SetIdentity();
            }

            foreach (var item in _childrenDictionary)
            {
                drawLayer(item.Key, item.Value, redrawType, _map);
            }
        }
示例#4
0
 public DrawContext(UIElement container, RedrawType redrawType, Transform transform, MatrixTransform cumulativeTransform, IMap map)
     : this(container, redrawType, transform, cumulativeTransform, map.Boundaries, map.Projection, Current.DisplayType, Current.AnimationStep)
 {
 }
示例#5
0
 public void Redraw(RedrawType redrawType)
 {
     draw(redrawType);
 }
示例#6
0
 private void drawLayer(ILayer layer, UIElement container, RedrawType redrawType, IMap map)
 {
     layer.DrawAsync(new DrawContext(container, redrawType, _currentTransform, _cumulativeTransform, map));
 }
示例#7
0
 public void Redraw(RedrawType redrawType, bool reloadTiles)
 {
     _map.Redraw3((tkRedrawType)redrawType, reloadTiles);
 }
示例#8
0
        public void RedrawAll(RedrawType setting)
        {
            CheckInitialized();

            _penumbra !.ObjectReloader.RedrawAll(setting);
        }
示例#9
0
 public void Redraw(RedrawType redrawType = RedrawType.All)
 {
     _map.Redraw2((tkRedrawType)redrawType);
 }
示例#10
0
        public void RedrawObject(GameObject?gameObject, RedrawType setting)
        {
            CheckInitialized();

            _penumbra !.ObjectReloader.RedrawObject(gameObject, setting);
        }
示例#11
0
        public void RedrawObject(string name, RedrawType setting)
        {
            CheckInitialized();

            _penumbra !.ObjectReloader.RedrawObject(name, setting);
        }
示例#12
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);
            }
        }
示例#13
0
        public override void Draw(IDrawContext context, CancellationToken cancellation)
        {
            resetMapData(context, cancellation);

            if (cancellation.IsCancellationRequested)
            {
                return;
            }

            if (context.RedrawType != RedrawType.Redraw)
            {
                lock (_drawLocker)
                {
                    const RedrawType noNewPointTypes = RedrawType.Scale | RedrawType.ZoomIn | RedrawType.AnimationStepChanged | RedrawType.DisplayTypeChanged | RedrawType.Redraw;
                    if ((_polygonObjects?.Any() ?? false) && ((context.RedrawType & ~noNewPointTypes) == RedrawType.None))
                    {
                        foreach (var polygonObject in _polygonObjects.Values)
                        {
                            if (cancellation.IsCancellationRequested)
                            {
                                return;
                            }

                            updatePoints(polygonObject, context.RedrawType, context.Transform);
                        }
                    }
                    else
                    {
                        var toRemove = new List <int>();
                        if (_polygonObjects != null)
                        {
                            toRemove.AddRange(_polygonObjects.Keys);
                        }

                        if (context.RedrawType == RedrawType.Reset)
                        {
                            removeChildren(toRemove);
                            toRemove.Clear();
                        }

                        if (_polygons != null)
                        {
                            foreach (var item in _polygons)
                            {
                                if (cancellation.IsCancellationRequested)
                                {
                                    return;
                                }

                                var id            = item.Key;
                                var polygonObject = _polygonObjects.ContainsKey(id) ? _polygonObjects[id] : null;
                                // TODO: lazy read the files and add a function: LoadIfIntersects(context.Boundaries, context.Projection)
                                if (context.Projection.IsInMap(item.Value.Header.Boundaries))
                                {
                                    if (polygonObject != null)
                                    {
                                        toRemove.Remove(id);
                                    }
                                    else
                                    {
                                        polygonObject = getNewPolygonObject(id, item.Value);
                                        updateVisual(polygonObject);
                                        _polygonObjects.Add(id, polygonObject);
                                    }
                                    updatePoints(polygonObject, context.RedrawType, context.Transform);
                                }
                            }
                        }

                        removeChildren(toRemove);

                        _container.Polygons = new Dictionary <int, PolygonObject>(_polygonObjects);
                    }
                }
            }

            if (cancellation.IsCancellationRequested)
            {
                return;
            }

            switch (context.RedrawType)
            {
            case RedrawType.Reset:
            case RedrawType.Redraw:
            case RedrawType.ZoomIn:
            case RedrawType.ZoomOut:
            case RedrawType.Scale:
                _container.IsDirty = true;
                _container.Update(context);
                break;
            }
        }
示例#14
0
 public void RedrawObject(int tableIndex, RedrawType setting)
 {
     CheckInitialized();
     _penumbra !.ObjectReloader.RedrawObject(tableIndex, setting);
 }