Esempio n. 1
0
        /// <summary>
        /// Update all layers.
        /// </summary>
        public void updateAllLayers()
        {
            try
            {
                if (_document is CadKit.Interfaces.ILayerList)
                {
                    CadKit.Interfaces.ILayerList layerList = (CadKit.Interfaces.ILayerList)_document;

                    object[] layers = layerList.Layers;
                    for (int i = 0; i < layers.Length; ++i)
                    {
                        CadKit.Interfaces.ILayer layer = layers[i] as CadKit.Interfaces.ILayer;

                        if (null != layer)
                        {
                            layerList.modifyLayer(layer, this);
                            //_listBox.Items[i].Text = layer.Name;
                        }
                    }
                }
            }
            catch (System.Exception exception)
            {
                System.Console.WriteLine("Error 394702580: Exception caught while trying to update layers.");
                System.Console.WriteLine("Message: {0}", exception.Message);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Clear the list view and re-add layers from the document.
        /// </summary>
        public void addLayers()
        {
            try
            {
                // Clear what we have.
                _treeView.Nodes.Clear();
                _nodes.Clear();
                _layers.Clear();

                // If the document is a layer list.
                if (_document is CadKit.Interfaces.ILayerList)
                {
                    CadKit.Interfaces.ILayerList layerList = (CadKit.Interfaces.ILayerList)_document;
                    CadKit.Interfaces.ILayer[]   layers    = layerList.Layers;

                    _treeView.AfterCheck -= this._treeView_AfterCheck;
                    foreach (CadKit.Interfaces.ILayer layer in layers)
                    {
                        this._addLayer(layer);
                    }
                    _treeView.AfterCheck += this._treeView_AfterCheck;
                }
            }
            catch (System.Exception e)
            {
                System.Console.WriteLine("Error 2179058038: {0}", e.Message);
            }
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        void _treeView_AfterCheck(object sender, System.Windows.Forms.TreeViewEventArgs e)
        {
            try
            {
                if (_document is CadKit.Interfaces.ILayerList)
                {
                    CadKit.Interfaces.ILayerList layerList = (CadKit.Interfaces.ILayerList)_document;
                    CadKit.Interfaces.ILayer     layer     = this._getLayer(e.Node);

                    if (null != layerList && null != layer)
                    {
                        if (e.Node.Checked)
                        {
                            e.Node.ForeColor = System.Drawing.Color.Black;
                            layerList.showLayer(layer, this);
                        }
                        else
                        {
                            e.Node.ForeColor = System.Drawing.Color.Gray;
                            layerList.hideLayer(layer, this);
                        }
                    }
                }
            }
            catch (System.Exception exception)
            {
                System.Console.WriteLine("Error 3400305770: Exception caught while trying to change visibility of a layer.");
                System.Console.WriteLine("Message: {0}", exception.Message);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Called when the apply (or ok) button is pressed.
        /// </summary>
        private void _apply(CadKit.Interfaces.IOptionsForm form, CadKit.Interfaces.IOptionsPage page)
        {
            CadKit.Interfaces.ILayerList layerList = CadKit.Documents.Manager.Instance.ActiveDocument as CadKit.Interfaces.ILayerList;

            if (null != layerList && _server.Text.Length > 0 && _cacheDirectory.Text.Length > 0)
            {
                CadKit.OSSIMPlanet.Glue.WmsLayer wmsLayer = new CadKit.OSSIMPlanet.Glue.WmsLayer();
                wmsLayer.Server         = _server.Text;
                wmsLayer.CacheDirectory = _cacheDirectory.Text;

                if (_jpeg.Checked)
                {
                    wmsLayer.ImageType = "image/jpeg";
                }
                else if (_png.Checked)
                {
                    wmsLayer.ImageType = "image/png";
                }

                layerList.addLayer(wmsLayer, this);

                WmsSettings settings = new WmsSettings();
                settings.Server         = wmsLayer.Server;
                settings.CacheDirectory = wmsLayer.CacheDirectory;
                settings.ImageType      = wmsLayer.ImageType;

                if (false == _recentServers.Contains(settings))
                {
                    _recentServers.Add(settings);
                    _recent.Items.Add(settings.Server);
                }
            }
        }
Esempio n. 5
0
 /// <summary>
 ///
 /// </summary>
 void _treeView_NodeMouseDoubleClick(object sender, System.Windows.Forms.TreeNodeMouseClickEventArgs e)
 {
     if (_document is CadKit.Interfaces.ILayerList)
     {
         CadKit.Interfaces.ILayerList layerList = (CadKit.Interfaces.ILayerList)_document;
         CadKit.Interfaces.ILayer     layer     = this._getLayer(_treeView.SelectedNode);
         layerList.viewLayerExtents(layer);
     }
 }
Esempio n. 6
0
        /// <summary>
        /// Called when the apply (or ok) button is pressed.
        /// </summary>
        private void _apply(CadKit.Interfaces.IOptionsForm form, CadKit.Interfaces.IOptionsPage page)
        {
            CadKit.Interfaces.ILayerList layerList = CadKit.Documents.Manager.Instance.ActiveDocument as CadKit.Interfaces.ILayerList;

            if (null != layerList)
            {
                foreach (CadKit.Interfaces.ILayer layer in _layers)
                {
                    layerList.addLayer(layer, this);
                }
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Save the selected layers.
        /// </summary>
        public void saveSelectedLayers()
        {
            if (_document is CadKit.Interfaces.ILayerList)
            {
                CadKit.Interfaces.ILayerList layerList = (CadKit.Interfaces.ILayerList)_document;

                CadKit.Interfaces.ILayer layer = this._getLayer(_treeView.SelectedNode);

                if (null != layer)
                {
                    layerList.addToFavorites(layer);
                }
            }
        }
Esempio n. 8
0
 /// <summary>
 /// Remove selected layers
 /// </summary>
 public void removeSeletecedLayers()
 {
     try
     {
         if (_document is CadKit.Interfaces.ILayerList)
         {
             CadKit.Interfaces.ILayerList layerList = (CadKit.Interfaces.ILayerList)_document;
             this._removeLayer(_treeView.SelectedNode, layerList);
         }
     }
     catch (System.Exception exception)
     {
         System.Console.WriteLine("Error 1974321048: Exception caught while trying to remove layer(s).");
         System.Console.WriteLine("Message: {0}", exception.Message);
     }
 }
Esempio n. 9
0
        /// <summary>
        /// Remove layer at given index.
        /// </summary>
        private void _removeLayer(System.Windows.Forms.TreeNode node, CadKit.Interfaces.ILayerList layerList)
        {
            CadKit.Interfaces.ILayer layer = this._getLayer(node);

            if (null != layer)
            {
                // Remove objects from maps.
                _nodes.Remove(node);
                _layers.Remove(layer.Guid);

                // Remove object from tree.
                _treeView.Nodes.Remove(node);

                // Remove object from document's list.
                layerList.removeLayer(layer, this);
            }
        }
Esempio n. 10
0
 /// <summary>
 ///
 /// </summary>
 public void removeSelectedLayers()
 {
     try
     {
         if (_document is CadKit.Interfaces.ILayerList)
         {
             CadKit.Interfaces.ILayerList layerList = _document as CadKit.Interfaces.ILayerList;
             if (null != layerList)
             {
                 this._removeLayer(_treeView.SelectedNode, layerList);
             }
         }
     }
     catch (System.Exception exception)
     {
         System.Console.WriteLine("Error 2183838408: Exception thrown while trying to remove layer." +
                                  System.Environment.NewLine + "Message: {0}", exception.Message);
     }
 }
Esempio n. 11
0
        /// <summary>
        /// Update only layers that are selected.
        /// </summary>
        public void updateSelectedLayers()
        {
            try
            {
                if (_document is CadKit.Interfaces.ILayerList)
                {
                    CadKit.Interfaces.ILayerList layerList = (CadKit.Interfaces.ILayerList)_document;

                    CadKit.Interfaces.ILayer layer = this._getLayer(_treeView.SelectedNode);
                    if (null != layer)
                    {
                        layerList.modifyLayer(layer, this);
                    }
                }
            }
            catch (System.Exception exception)
            {
                System.Console.WriteLine("Error 2700916252: Exception caught while trying to update layer(s).");
                System.Console.WriteLine("Message: {0}", exception.Message);
            }
        }