Example #1
0
        private void AddLayerNode(layerObj layer, TreeNode layersnode,int index)
        {
            if ((layer == null) || (layersnode == null)) return;

            TreeNode layerNode = new TreeNode();
            layerNode.Text = layer.name;

            if (layer.status == 0)
            {
                layerNode.ImageIndex = IMAGEINDEX_LAYER_OFF;
                layerNode.SelectedImageIndex = IMAGEINDEX_LAYER_OFF;
            }
            else
            {
                if (layer.isVisible() != 0)
                {
                    layerNode.ImageIndex = IMAGEINDEX_LAYER_ON;
                    layerNode.SelectedImageIndex = IMAGEINDEX_LAYER_ON;
                }
                else
                {
                    layerNode.ImageIndex = IMAGEINDEX_LAYER_LOCK;
                    layerNode.SelectedImageIndex = IMAGEINDEX_LAYER_LOCK;
                }
            }

            if ((index > 0) && (index < layersnode.Nodes.Count - 1))
                layersnode.Nodes.Insert(index, layerNode);
            else
                layersnode.Nodes.Add(layerNode);

            AddLayerClassNode(layer, layerNode);
        }