Example #1
0
        private void UpdateSelectionRenderingOptions()
        {
            var value = this.SelectionColor;
            if (_selectionRenderOpts != null)
            {
                var color = _selectionRenderOpts.Color;
                if (!color.Equals(value))
                {
                    _selectionRenderOpts = null;

                    _selectionRenderOpts = CreateSelectionRenderingOptions(value.R, value.G, value.B);
                    Trace.TraceInformation("Selection color updated to ({0}, {1}, {2})", value.R, value.G, value.B);
                }
            }
        }
Example #2
0
        private void InitViewerFromMap(double? initialScale)
        {
            this.BackColor = _map.BackgroundColor;
            _map.DisplayWidth = this.Width;
            _map.DisplayHeight = this.Height;
            _selection = _map.Selection;
            _overlayRenderOpts = CreateMapRenderingOptions(0, 0, 255);
            _selectionRenderOpts = CreateSelectionRenderingOptions(0, 0, 255);

            var env = _map.MapExtent;

            _extX1 = _orgX1 = env.MinX;
            _extY2 = _orgY2 = env.MinY;
            _extX2 = _orgX2 = env.MaxX;
            _extY1 = _orgY1 = env.MaxY;

            if ((_orgX1 - _orgX2) == 0 || (_orgY1 - _orgY2) == 0)
            {
                _extX1 = _orgX1 = -.1;
                _extY2 = _orgX2 = .1;
                _extX2 = _orgY1 = -.1;
                _extY1 = _orgY2 = .1;
            }

            if (this.ConvertTiledGroupsToNonTiled)
            {
                var groups = _map.Groups;
                for (int i = 0; i < groups.Count; i++)
                {
                    var group = groups[i];
                    group.Type = RuntimeMapGroup.kNormal;

                    var layers = _map.GetLayersOfGroup(group.Name);
                    for (int j = 0; j < layers.Length; j++)
                    {
                        layers[j].Type = RuntimeMapLayer.kDynamic;
                    }
                }
            }

            #if VIEWER_DEBUG
            CreateDebugFeatureSource();
            #endif
            this.Focus();

            //Reset history stack
            _viewHistory.Clear();
            OnPropertyChanged("ViewHistory");
            _viewHistoryIndex = -1;
            OnPropertyChanged("ViewHistoryIndex");

            var handler = this.MapLoaded;
            if (handler != null)
                handler(this, EventArgs.Empty);

            if (initialScale.HasValue)
                ZoomToScale(initialScale.Value);
            else
                InitialMapView();
        }