Esempio n. 1
0
        public void RenderLayers()                // mod 20130226
        {
            var transform = new TransformGroup(); // mod 20130301

            transform.Children.Add(new ScaleTransform {
                CenterX = 0, CenterY = 0, ScaleX = 1 / Scale, ScaleY = -1 / Scale
            });
            transform.Children.Add(new TranslateTransform {
                X = Origin.X, Y = Origin.Y
            });
            //MapTransform.Freeze();

            foreach (MapLayer layer in Layers) // mod 20130302 精简,通过MapLayer.SetMagFactor()
            {
                layer.RenderTransform = transform;
            }

            TempLayers.ForEach(x => x.RenderTransform  = transform);
            LabelLayers.ForEach(x => x.RenderTransform = transform);
            base.Clip = new RectangleGeometry {
                Rect = new Rect(0, 0, ActualWidth, ActualHeight)
            };

            OnViewChanged();
            ViewerToolManager.Tools.ForEach(t => t.Render());
        }
Esempio n. 2
0
        public void RenderLayers(bool modScale = false) // mod 20130226
        {
            TranslateTransform translate = new TranslateTransform {
                X = Origin.X, Y = Origin.Y
            };
            ScaleTransform scale = new ScaleTransform {
                CenterX = 0, CenterY = 0, ScaleX = 1 / Scale, ScaleY = -1 / Scale
            };
            TransformGroup MapTransform = new TransformGroup(); // mod 20130301

            MapTransform.Children.Add(scale);
            MapTransform.Children.Add(translate);
            //MapTransform.Freeze();

            double magFactor = GetMagFactor(Scale);

            foreach (MapLayer layer in Layers) // mod 20130302 精简,通过MapLayer.SetMagFactor()
            {
                layer.RenderTransform = MapTransform;
                if (modScale)
                {
                    layer.SetMagFactor(magFactor);
                }
            }

            TempLayers.ForEach(x => x.RenderTransform  = MapTransform);
            LabelLayers.ForEach(x => x.RenderTransform = MapTransform);
            base.Clip = new RectangleGeometry {
                Rect = new Rect(0, 0, ActualWidth, ActualHeight)
            };

            OnViewChanged();
            ViewerToolManager.Tools.ForEach(t => t.Render());
        }
Esempio n. 3
0
        public void UpdateMap() // newly 20140624
        {
            Layers.Clear();
            Children.Clear();
            TempLayers.ForEach(x => x.Children.Clear());
            LabelLayers.ForEach(x => x.Children.Clear());

            foreach (VectorLayer layer in Map.Layers)
            {
                var mLayer = new DrawingMapLayer(); // mod 20130302
                //MapLayer mLayer = new MapLayer();
                mLayer.SetData(layer);
                mLayer.AppendProperties(); // newly 20120319
                Layers.Add(mLayer);
                Children.Add(mLayer);
            }

            TempLayers.ForEach(x => this.Children.Add(x));
            LabelLayers.ForEach(x => this.Children.Add(x));
            RenderLayers();
        }
Esempio n. 4
0
        public void InitializeMap(Map map)
        {
            Map = map;
            Layers.Clear();
            Children.Clear();
            TempLayers.ForEach(x => x.Children.Clear());
            LabelLayers.ForEach(x => x.Children.Clear());

            foreach (VectorLayer layer in map.Layers)
            {
                var mLayer = new DrawingMapLayer(); // mod 20130302
                //MapLayer mLayer = new MapLayer();
                mLayer.SetData(layer);
                mLayer.AppendProperties(); // newly 20120319
                Layers.Add(mLayer);
                Children.Add(mLayer);
            }

            TempLayers.ForEach(x => this.Children.Add(x));
            LabelLayers.ForEach(x => this.Children.Add(x));
            this.ZoomExtents();
            InitialScale = Scale;
            OnLayersChanged();
        }