Exemplo n.º 1
0
        public void updateView(Actions.Action.UpdateViewType layerUpdateType)
        {
            // check if we must recreate the whole list
            if (layerUpdateType == Actions.Action.UpdateViewType.FULL)
            {
                // first suspend the layout because we will recreate the full layout
                this.SuspendLayout();
                this.Visible = false;
                // clear the layer stack and refill it with the map layer list
                this.Controls.Clear();
                // recreate all the layer from the map
                // we create a new panel to handle this layer
                foreach (Layer layer in Map.Instance.LayerList)
                {
                    // instanciate a new layer panel according to the layer type
                    LayerPanel newLayerPanel = null;
                    if (layer is LayerGrid)
                        newLayerPanel = new LayerGridPanel(layer);
                    else if (layer is LayerText)
                        newLayerPanel = new LayerTextPanel(layer);
                    else if (layer is LayerArea)
                        newLayerPanel = new LayerAreaPanel(layer);
                    else if (layer is LayerBrick)
                        newLayerPanel = new LayerBrickPanel(layer);
                    else if (layer is LayerRuler)
                        newLayerPanel = new LayerRulerPanel(layer);

                    // add the new layer in the control list
                    this.Controls.Add(newLayerPanel);

                    // if the selected layer of the map is the current one,
                    // use the last added layerPanel as the selected layer panel
                    if (Map.Instance.SelectedLayer == layer)
                        newLayerPanel.changeBackColor(true);
                }

                // now we can resume the layout
                this.ResumeLayout(true);
                this.Visible = true;
            }
            else
            {
                // not a full update, just check the property of the layers,
                // but the layout is unchanged
                foreach (Control control in this.Controls)
                {
                    LayerPanel layerPanel = control as LayerPanel;
                    layerPanel.updateView();
                }
            }

            // invalidate the PanelView because we recreated the whole layer panel list
            this.Invalidate();
        }
Exemplo n.º 2
0
        public void updateView(Actions.Action.UpdateViewType layerUpdateType)
        {
            // check if we must recreate the whole list
            if (layerUpdateType == Actions.Action.UpdateViewType.FULL)
            {
                // first suspend the layout because we will recreate the full layout
                this.SuspendLayout();
                this.Visible = false;
                // clear the layer stack and refill it with the map layer list
                this.Controls.Clear();
                // recreate all the layer from the map
                // we create a new panel to handle this layer
                foreach (Layer layer in Map.Instance.LayerList)
                {
                    // instanciate a new layer panel according to the layer type
                    LayerPanel newLayerPanel = null;
                    if (layer is LayerGrid)
                    {
                        newLayerPanel = new LayerGridPanel(layer);
                    }
                    else if (layer is LayerText)
                    {
                        newLayerPanel = new LayerTextPanel(layer);
                    }
                    else if (layer is LayerArea)
                    {
                        newLayerPanel = new LayerAreaPanel(layer);
                    }
                    else if (layer is LayerBrick)
                    {
                        newLayerPanel = new LayerBrickPanel(layer);
                    }
                    else if (layer is LayerRuler)
                    {
                        newLayerPanel = new LayerRulerPanel(layer);
                    }

                    // add the new layer in the control list
                    this.Controls.Add(newLayerPanel);

                    // if the selected layer of the map is the current one,
                    // use the last added layerPanel as the selected layer panel
                    if (Map.Instance.SelectedLayer == layer)
                    {
                        newLayerPanel.changeBackColor(true);
                    }
                }

                // now we can resume the layout
                this.ResumeLayout(true);
                this.Visible = true;
            }
            else
            {
                // not a full update, just check the property of the layers,
                // but the layout is unchanged
                foreach (Control control in this.Controls)
                {
                    LayerPanel layerPanel = control as LayerPanel;
                    layerPanel.updateView();
                }
            }

            // invalidate the PanelView because we recreated the whole layer panel list
            this.Invalidate();
        }