Example #1
0
        public BasemapLayers([Import] IMapWindow mapWindow, [Import] WebMap.IBasemapWindow basemapWin, [Import] Core.Window.IInteractiveWindowContainer mainWindow)
        {
            this.mapWindow  = mapWindow;
            this.mainWindow = mainWindow;

            this.comboItems = new List <string>();

            IsChecked = false;

            this.basemapWin = basemapWin;

            MapWindow mw = mapWindow as MapWindow;

            if (mw != null)
            {
                this.mainMap = mw.GetMap();
                this.mainMap.MapFrame.ViewExtentsChanged += MapFrame_ViewExtentsChanged;

                mw.MapMouseMove += mainMapWin_MapMouseMove;

                this.webMap = new WebMap.Util(this.basemapWin.GetMap());
                this.webMap.AddBasemapWindow(this.basemapWin);
                this.webMap.AddServiceProvidersToComboItem(this);
            }
            else
            {
                this.webMap  = null;
                this.mainMap = null;
            }
        }
Example #2
0
        /// <summary>
        /// Constructs a Minimap instance.
        /// </summary>
        /// <param name="targetScenario">Reference to the target scenario.</param>
        /// <param name="fullWindow">Reference to the full window.</param>
        /// <param name="attachedWindow">Reference to the currently attached window.</param>
        /// <param name="minimapControlPixelSize">The size of the minimap control in pixels.</param>
        public Minimap(Scenario targetScenario, IMapWindow fullWindow, IMapWindow attachedWindow, RCIntVector minimapControlPixelSize)
        {
            if (fullWindow == null)
            {
                throw new ArgumentNullException("fullWindow");
            }
            if (attachedWindow == null)
            {
                throw new ArgumentNullException("attachedWindow");
            }
            if (minimapControlPixelSize == RCIntVector.Undefined)
            {
                throw new ArgumentNullException("minimapControlPixelSize");
            }

            this.isDisposed     = false;
            this.fullWindow     = fullWindow;
            this.attachedWindow = attachedWindow;

            this.windowIndicatorCache     = new CachedValue <RCIntRectangle>(this.CalculateWindowIndicator);
            this.windowIndicatorSizeCache = new CachedValue <RCIntVector>(this.CalculateWindowIndicatorSize);

            if (!Minimap.TryAlignMinimapHorizontally(minimapControlPixelSize, this.fullWindow.CellWindow.Size, out this.minimapPosition, out this.mapToMinimapTransformation) &&
                !Minimap.TryAlignMinimapVertically(minimapControlPixelSize, this.fullWindow.CellWindow.Size, out this.minimapPosition, out this.mapToMinimapTransformation))
            {
                throw new InvalidOperationException("Unable to align the minimap inside the minimap control!");
            }

            this.pixelMatrix    = new MinimapPixel[this.minimapPosition.Width, this.minimapPosition.Height];
            this.quadTileMatrix = new MinimapPixel[targetScenario.Map.Size.X, targetScenario.Map.Size.Y];
            for (int row = 0; row < this.minimapPosition.Width; row++)
            {
                for (int col = 0; col < this.minimapPosition.Height; col++)
                {
                    this.pixelMatrix[col, row] = new MinimapPixel(targetScenario, new RCIntVector(col, row), this.mapToMinimapTransformation);
                    this.AddPixelToQuadTileMatrix(this.pixelMatrix[col, row]);
                }
            }
        }