public MainViewModel(WpfMap map)
        {
            this.map      = map;
            map.MapClick += WpfMap_MapClick;
            menuItems     = new Collection <object>(MenuItemHelper.GetMenus());

            LoadMessageHandlers();
            SetToolbarMenuItems();

            Messenger.Default.Register <ChartMessage>(this, (m) => ChartSelectedItem = new ChartSelectedItem(string.Empty, null));
            Messenger.Default.Register <MenuItemMessage>(this, "ShowOpacityPanel", (m) => ShowOpacityPanel = true);
            Messenger.Default.Register <MenuItemMessage>(this, HandleMenuItemMessage);
            Messenger.Default.Register <ToolBarMessage>(this, HandleToolBarMessage);
            Messenger.Default.Register <ChartMessage>(this, "LoadCharts", HandleLoadChartMessage);
            Messenger.Default.Register <ChartMessage>(this, "UnloadCharts", HandleUnloadChartMessage);
            Messenger.Default.Register <ChartSelectedItemMessage>(this, HandleChartSelectedItemMessage);
            Messenger.Default.Register <SafeWaterDepthSettingMessage>(this, HandleSafeWaterDepthMessage);

            map.MapUnit      = GeographyUnit.Meter;
            map.ZoomLevelSet = new ThinkGeoCloudMapsZoomLevelSet();

            // Please input your ThinkGeo Cloud Client ID / Client Secret to enable the background map.
            //ThinkGeoCloudRasterMapsOverlay baseOverlay = new ThinkGeoCloudRasterMapsOverlay("ThinkGeo Cloud Client ID", "ThinkGeo Cloud Client Secret");
            //map.Overlays.Add(ThinkGeoCloudMapsOverlayName, baseOverlay);

            InitBoundingBoxPreviewOverlay(map);
        }
        public MainViewModel(WpfMap map)
        {
            this.map      = map;
            map.MapClick += WpfMap_MapClick;
            menuItems     = new Collection <object>(MenuItemHelper.GetMenus());

            LoadMessageHandlers();
            SetToolbarMenuItems();

            Messenger.Default.Register <ChartMessage>(this, (m) => ChartSelectedItem = new ChartSelectedItem(string.Empty, null));
            Messenger.Default.Register <MenuItemMessage>(this, "ShowOpacityPanel", (m) => ShowOpacityPanel = true);
            Messenger.Default.Register <MenuItemMessage>(this, HandleMenuItemMessage);
            Messenger.Default.Register <ToolBarMessage>(this, HandleToolBarMessage);
            Messenger.Default.Register <ChartMessage>(this, "LoadCharts", HandleLoadChartMessage);
            Messenger.Default.Register <ChartMessage>(this, "UnloadCharts", HandleUnloadChartMessage);
            Messenger.Default.Register <ChartSelectedItemMessage>(this, HandleChartSelectedItemMessage);
            Messenger.Default.Register <SafeWaterDepthSettingMessage>(this, HandleSafeWaterDepthMessage);

            map.CurrentExtent = new RectangleShape(-130, 40, -30, 5);
            map.Overlays.Add(WorldMapOverlayName, new WorldMapKitWmsWpfOverlay());

            InitBoundingBoxPreviewOverlay(map);
        }