Esempio n. 1
0
 public async void toggleOnMap(bool value)
 {
     await QueuedTask.Run(() =>
     {
         string rootGroup      = "Planet API";
         string dateGroup      = parent.mapLayerName;
         string[] stripParents = { dateGroup, rootGroup };
         GroupLayer group      = Asset.GetGroup(mapLayerName, stripParents);
         group.SetVisibility(value);
     });
 }
        // This method will be called when the AddToMap button is clicked, this button will be displayed only if more than one scene is selected in the Datagrid
        private async void AddToMap()
        {
            if (SelectedLayer is ImageServiceLayer)
            {
                await QueuedTask.Run(() =>
                {
                    ImageServiceLayer imageServiceLayer = (ImageServiceLayer)SelectedLayer;
                    // Store information of original service layer so that it can be displayed back again
                    CIMMosaicRule originalMosaicRule = imageServiceLayer.GetMosaicRule();
                    string originalLayerName         = imageServiceLayer.Name;
                    //Map _map = await GetMapFromProject(Project.Current, "Map");
                    Map _map = MapView.Active.Map;
                    // Create a Group Layer which will act as a cotainer where selected layers will be added
                    GroupLayer grplayer = (GroupLayer)LayerFactory.Instance.CreateGroupLayer(_map, 0, _groupLayerName);
                    int _sceneCount     = 0;
                    foreach (object obj in _selectedList.Reverse <object>())
                    {
                        Scene scene = obj as Scene;
                        CIMMosaicRule mosaicRule = new CIMMosaicRule();
                        mosaicRule.MosaicMethod  = RasterMosaicMethod.LockRaster;
                        mosaicRule.LockRasterID  = scene.ObjectID;
                        ((ImageServiceLayer)imageServiceLayer).SetMosaicRule(mosaicRule);
                        imageServiceLayer.SetName(scene.Name);
                        imageServiceLayer.SetVisibility(false);
                        int ListCount = _selectedList.Count - 1;
                        if (_sceneCount == ListCount)
                        {
                            imageServiceLayer.SetVisibility(true);
                        }
                        else
                        {
                            imageServiceLayer.SetVisibility(false);
                            _sceneCount = _sceneCount + 1;
                        }
                        LayerFactory.Instance.CopyLayer(imageServiceLayer, grplayer);
                    }
                    // Done to display original image service layer
                    imageServiceLayer.SetMosaicRule(originalMosaicRule);
                    imageServiceLayer.SetName(originalLayerName);
                    imageServiceLayer.SetVisibility(false);
                    SelectedLayer = imageServiceLayer;
                    // Set visibilty of Group Layer to be true by default
                    grplayer.SetVisibility(true);

                    // Once the user has entered Group Layer Name, reset the Stack Panel
                    GroupLayerName = "";
                    NotifyPropertyChanged(() => GroupLayerName);

                    GroupNameVisibility = false;
                    NotifyPropertyChanged(() => GroupNameVisibility);
                });
            }
        }
Esempio n. 3
0
 public async void toggleOnMap(bool value)
 {
     await QueuedTask.Run(() =>
     {
         string rootGroup      = Asset.RootGroup;
         string dateGroup      = parent.parent.mapLayerName;
         string itemGroup      = parent.mapLayerName;
         string[] stripParents = { itemGroup, dateGroup, rootGroup };
         GroupLayer group      = Asset.GetGroup(mapLayerName, stripParents);
         if (group != null)
         {
             group.SetVisibility(value);
         }
     });
 }
Esempio n. 4
0
 public async void toggleOnMap(bool value)
 {
     await QueuedTask.Run(() =>
     {
         try
         {
             string rootGroup      = Asset.RootGroup;
             string dateGroup      = parent.mapLayerName;
             string[] stripParents = { dateGroup, rootGroup };
             GroupLayer group      = Asset.GetGroup(mapLayerName, stripParents);
             group.SetVisibility(value);
         }
         catch (Exception)
         {
             Console.WriteLine("Groupm not found to toggle");
         }
     });
 }