Пример #1
0
 private void SerializationManagerNewProject(object sender, SerializingEventArgs e)
 {
     //deactivate the web map
     if (_baseMapLayer != null)
     {
         DisableBasemapLayer();
         _provider = _emptyProvider;
         _serviceDropDown.SelectedItem = _provider;
     }
 }
Пример #2
0
 private void ServiceSelected(object sender, SelectedValueChangedEventArgs e)
 {
     _provider = e.SelectedItem as ServiceProvider;
     if (_provider == null || _provider.Name == Properties.Resources.None)
         DisableBasemapLayer();
     else
         EnableBasemapFetching(_provider.Name, _provider.Url);
 }
Пример #3
0
        private void SerializationManagerDeserializing(object sender, SerializingEventArgs e)
        {
            try
            {
                var opacity = App.SerializationManager.GetCustomSetting(PluginName + "_Opacity", "100");
                var basemapName = App.SerializationManager.GetCustomSetting(PluginName + "_BasemapName", Properties.Resources.None);
                //Set opacity
                _opacityDropDown.SelectedItem = opacity;
                _opacity = Convert.ToInt16(opacity);

                _baseMapLayer = (MapImageLayer)App.Map.MapFrame.GetAllLayers().FirstOrDefault(layer => layer.LegendText == Properties.Resources.Legend_Title);

                if (basemapName.Equals("None"))
                {
                    if (_baseMapLayer != null)
                    {
                        DisableBasemapLayer();
                        _provider = _emptyProvider;
                        _serviceDropDown.SelectedItem = _provider;
                    }
                }
                else
                {
                    //hack: need to set provider to original object, not a new one.
                    _provider = ServiceProvider.GetDefaultServiceProviders().FirstOrDefault(p => p.Name.Equals(basemapName, StringComparison.InvariantCultureIgnoreCase));
                    _serviceDropDown.SelectedItem = _provider;
                    EnableBasemapFetching(_provider.Name, _provider.Url);
                }
            }
            catch (Exception ex)
            {
                Debug.Print(ex.StackTrace);
            }
        }
Пример #4
0
        private void AddServiceDropDown(IHeaderControl header)
        {
            _serviceDropDown = new DropDownActionItem();
            _serviceDropDown.Key = STR_KeyServiceDropDown;

            //Create "None" Option
            _emptyProvider = new ServiceProvider(Properties.Resources.None, null);
            _serviceDropDown.Items.Add(_emptyProvider);

            // no option presently for group image.
            // Image = resources.AddOnlineBasemap.GetThumbnailImage(32, 32, null, IntPtr.Zero),

            _serviceDropDown.Width = 145;
            _serviceDropDown.AllowEditingText = false;
            _serviceDropDown.ToolTipText = Properties.Resources.Service_Box_ToolTip;
            _serviceDropDown.SelectedValueChanged += ServiceSelected;
            _serviceDropDown.GroupCaption = Properties.Resources.Panel_Name;
            _serviceDropDown.Items.AddRange(ServiceProvider.GetDefaultServiceProviders());
            _serviceDropDown.RootKey = HeaderControl.HomeRootItemKey;

            //Create "Other" Option
            var otherProvider = new ServiceProvider(Other, null);
            _serviceDropDown.Items.Add(otherProvider);

            //Add it to the Header
            header.Add(_serviceDropDown);

            _serviceDropDown.SelectedItem = _emptyProvider;
        }
Пример #5
0
        private void EnableBasemapFetching(ServiceProvider provider)
        {
            // Zoom out as much as possible if there are no other layers.
            // reproject any existing layer in non-webMercator projection.
            if (App.Map.Layers.Count == 0)
            {
                ForceMaxExtentZoom();
            }
            else if (!App.Map.Projection.Equals(WebMercProj))
            {
                //get original view extents
                App.ProgressHandler.Progress(String.Empty, 0, "Reprojecting Map Layers...");
                double[] viewExtentXY = { App.Map.ViewExtents.MinX, App.Map.ViewExtents.MinY, App.Map.ViewExtents.MaxX, App.Map.ViewExtents.MaxY };
                double[] viewExtentZ = { 0.0, 0.0 };

                //reproject view extents
                Reproject.ReprojectPoints(viewExtentXY, viewExtentZ, App.Map.Projection, WebMercProj, 0, 2);

                //set the new map extents
                App.Map.ViewExtents = new Extent(viewExtentXY);

                //if projection is not WebMercator - reproject all layers:
                App.Map.MapFrame.ReprojectMapFrame(WebMercProj);

                App.ProgressHandler.Progress(String.Empty, 0, "Loading Basemap...");
            }


            EnableBasemapLayer();
            _tileManager = new TileManager(provider);
            RunOrCancelBW();
        }
Пример #6
0
        private void AddServiceDropDown(IHeaderControl header)
        {
            _serviceDropDown = new DropDownActionItem
            {
                Key = STR_KeyServiceDropDown,
                RootKey = HeaderControl.HomeRootItemKey,
                Width = 145,
                AllowEditingText = false,
                ToolTipText = Properties.Resources.Service_Box_ToolTip,
                GroupCaption = Properties.Resources.Panel_Name
            };

            // "None" provider
            _emptyProvider = new ServiceProvider(Properties.Resources.None);
            _serviceDropDown.Items.Add(_emptyProvider);

            // Default providers
            _serviceDropDown.Items.AddRange(ServiceProviderFactory.GetDefaultServiceProviders());

            // "Other" provider
            _serviceDropDown.Items.Add(ServiceProviderFactory.Create(Other));

            //Add it to the Header
            header.Add(_serviceDropDown);
        }
Пример #7
0
        private void SerializationManagerDeserializing(object sender, SerializingEventArgs e)
        {
            var opacity = App.SerializationManager.GetCustomSetting(PluginName + "_Opacity", "100");
            var basemapName = App.SerializationManager.GetCustomSetting(PluginName + "_BasemapName", resources.None);
            //Set opacity
            _opacityDropDown.SelectedItem = opacity;
            _opacity = Convert.ToInt16(opacity);

            _baseMapLayer = (MapImageLayer)App.Map.MapFrame.GetAllLayers().FirstOrDefault(layer => layer.LegendText == resources.Legend_Title);

            if (basemapName == "None")
            {
                if (_baseMapLayer != null)
                {
                    DisableBasemapLayer();
                    _provider = _emptyProvider;
                    _serviceDropDown.SelectedItem = _provider;
                }
            }
            else
            {
                //hack: need to set provider to original object, not a new one.
                _provider = ServiceProvider.GetDefaultServiceProviders().FirstOrDefault(p => p.Name == basemapName);
                _serviceDropDown.SelectedItem = _provider;
                EnableBasemapFetching(_provider.Name, _provider.Url);
            }
        }