예제 #1
0
        public override void redo()
        {
            // if the layer is an area layer, rescale the colormap
            LayerArea layerArea = mLayer as LayerArea;

            if (layerArea != null)
            {
                LayerArea newlayerArea = mNewLayerData as LayerArea;
                if (newlayerArea != null)
                {
                    layerArea.rescaleColorMap(newlayerArea.AreaCellSizeInStud);
                }
            }

            // copy the options
            mLayer.CopyOptionsFrom(mNewLayerData);

            // notify the main form if the visibility changed
            if (mLayerVisibilityChanged)
            {
                MainForm.Instance.NotifyForLayerVisibilityChangedOrLayerDeletion();
            }

            // notify the part list if the name changed
            if (mLayerNameChanged)
            {
                MainForm.Instance.NotifyPartListForLayerRenamed(mLayer);
            }
        }
예제 #2
0
        public override void undo()
        {
            // if the layer is an area layer, restore the colormap
            LayerArea layerArea = mLayer as LayerArea;

            if ((layerArea != null) && (mOldColorMap != null))
            {
                layerArea.ColorMap = mOldColorMap;
            }

            // copy the options
            mLayer.CopyOptionsFrom(mOldLayerData);

            // notify the main form if the visibility changed
            if (mLayerVisibilityChanged)
            {
                MainForm.Instance.NotifyForLayerVisibilityChangedOrLayerDeletion();
            }

            // notify the part list if the name changed
            if (mLayerNameChanged)
            {
                MainForm.Instance.NotifyPartListForLayerRenamed(mLayer);
            }
        }
예제 #3
0
 public LayerAreaOptionForm(Layer layer)
 {
     InitializeComponent();
     // save the reference on the layer that we are editing
     mEditedLayer = layer as LayerArea;
     // update the controls with the data of the areaLayer
     // name and visibility
     this.nameTextBox.Text          = layer.Name;
     this.isVisibleCheckBox.Checked = layer.Visible;
     // transparency and cell size
     this.alphaNumericUpDown.Value    = mEditedLayer.Transparency;
     this.alphaTrackBar.Value         = mEditedLayer.Transparency;
     this.cellSizeNumericUpDown.Value = mEditedLayer.AreaCellSizeInStud;
 }
예제 #4
0
        public override void undo()
        {
            // change the background
            Map.Instance.BackgroundColor = mOldBackGroundColor;
            // change the layers
            foreach (LayerChange layerChange in mLayerChanges)
            {
                // if the layer is an area layer, restore the colormap
                LayerArea areaLayer = layerChange.mReference as LayerArea;
                if ((areaLayer != null) && (layerChange.mOldColorMap != null))
                {
                    areaLayer.ColorMap = layerChange.mOldColorMap;
                }

                // copy the options
                layerChange.mReference.CopyOptionsFrom(layerChange.mOldData);
            }
            // notify the main form
            MainForm.Instance.NotifyForMapBackgroundColorChanged();
        }
예제 #5
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            // create a copy of the edited layer to hold the old data
            LayerArea oldLayerData = new LayerArea();

            oldLayerData.CopyOptionsFrom(mEditedLayer);

            // create a new layer to store the new data
            LayerArea newLayerData = new LayerArea();

            // name and visibility
            newLayerData.Name    = this.nameTextBox.Text;
            newLayerData.Visible = this.isVisibleCheckBox.Checked;
            //transparency and cell size
            newLayerData.Transparency       = (int)(this.alphaNumericUpDown.Value);
            newLayerData.AreaCellSizeInStud = (int)(this.cellSizeNumericUpDown.Value);

            // do a change option action
            ActionManager.Instance.doAction(new ChangeLayerOption(mEditedLayer, oldLayerData, newLayerData));
        }
예제 #6
0
        public ChangeLayerOption(Layer layer, Layer oldLayerTemplate, Layer newLayerTemplate)
        {
            mUpdateLayerView = UpdateViewType.LIGHT;
            mUpdateMapView   = UpdateViewType.FULL;
            // save the reference of the layer
            mLayer = layer;
            // and create two new layers to save the data in it
            mOldLayerData = oldLayerTemplate;
            mNewLayerData = newLayerTemplate;
            // check if the name changed
            mLayerNameChanged = !oldLayerTemplate.Name.Equals(mNewLayerData.Name);
            // check if visibility changed
            mLayerVisibilityChanged = (oldLayerTemplate.Visible != newLayerTemplate.Visible);
            // if the layer is an area layer, save the current color map
            LayerArea layerArea = layer as LayerArea;

            if (layerArea != null)
            {
                mOldColorMap = layerArea.ColorMap;
            }
        }
예제 #7
0
        public override void redo()
        {
            // change the background
            Map.Instance.BackgroundColor = mNewBackGroundColor;
            // change the layers
            foreach (LayerChange layerChange in mLayerChanges)
            {
                // if the layer is an area layer, rescale the colormap
                LayerArea areaLayer = layerChange.mReference as LayerArea;
                if (areaLayer != null)
                {
                    LayerArea newlayerArea = layerChange.mNewData as LayerArea;
                    if (newlayerArea != null)
                    {
                        areaLayer.rescaleColorMap(newlayerArea.AreaCellSizeInStud);
                    }
                }

                // copy the options
                layerChange.mReference.CopyOptionsFrom(layerChange.mNewData);
            }
            // notify the main form
            MainForm.Instance.NotifyForMapBackgroundColorChanged();
        }
예제 #8
0
 public MoveArea(LayerArea layer, int moveX, int moveY)
 {
     mAreaLayer = layer;
     mMoveX     = moveX;
     mMoveY     = moveY;
 }
예제 #9
0
 public AddArea(LayerArea layer, Color color, Rectangle area)
 {
     mAreaLayer       = layer;
     mNewColor        = color;
     mAreaInCellIndex = area;
 }
예제 #10
0
        public ChangeMapAppearance(bool isColorModified, bool isFontModified, bool isSizeModified, bool doesAreaChanged)
        {
            // background color of the map
            mOldBackGroundColor = Map.Instance.BackgroundColor;
            mNewBackGroundColor = BlueBrick.Properties.Settings.Default.DefaultBackgroundColor;

            // and the other modification to the layer
            bool doesGridChanged = isColorModified || isFontModified || isSizeModified;

            foreach (Layer layer in Map.Instance.LayerList)
            {
                if (doesGridChanged)
                {
                    LayerGrid gridLayer = layer as LayerGrid;
                    if (gridLayer != null)
                    {
                        // create a copy of the edited layer to hold the old data
                        LayerGrid oldLayerData = new LayerGrid();
                        oldLayerData.CopyOptionsFrom(gridLayer);
                        // create a new layer to store the new data
                        LayerGrid newLayerData = new LayerGrid();
                        newLayerData.CopyOptionsFrom(gridLayer);
                        // and change only the grid colors
                        if (isColorModified)
                        {
                            newLayerData.GridColor    = BlueBrick.Properties.Settings.Default.DefaultGridColor;
                            newLayerData.SubGridColor = BlueBrick.Properties.Settings.Default.DefaultSubGridColor;
                        }
                        if (isFontModified)
                        {
                            newLayerData.CellIndexColor = BlueBrick.Properties.Settings.Default.DefaultTextColor;
                            newLayerData.CellIndexFont  = BlueBrick.Properties.Settings.Default.DefaultTextFont;
                        }
                        if (isSizeModified)
                        {
                            newLayerData.GridSizeInStud    = BlueBrick.Properties.Settings.Default.DefaultGridSize;
                            newLayerData.SubDivisionNumber = BlueBrick.Properties.Settings.Default.DefaultSubDivisionNumber;
                            newLayerData.DisplayGrid       = BlueBrick.Properties.Settings.Default.DefaultGridEnabled;
                            newLayerData.DisplaySubGrid    = BlueBrick.Properties.Settings.Default.DefaultSubGridEnabled;
                        }

                        // create a new entry for the list and store it in the list
                        LayerChange layerChange = new LayerChange();
                        layerChange.mReference = gridLayer;
                        layerChange.mOldData   = oldLayerData;
                        layerChange.mNewData   = newLayerData;
                        mLayerChanges.Add(layerChange);
                    }
                }
                if (doesAreaChanged)
                {
                    LayerArea areaLayer = layer as LayerArea;
                    if (areaLayer != null)
                    {
                        // create a copy of the edited layer to hold the old data
                        LayerArea oldLayerData = new LayerArea();
                        oldLayerData.CopyOptionsFrom(areaLayer);
                        // create a new layer to store the new data
                        LayerArea newLayerData = new LayerArea();
                        newLayerData.CopyOptionsFrom(areaLayer);
                        // and change the area parameters
                        newLayerData.Transparency       = BlueBrick.Properties.Settings.Default.DefaultAreaTransparency;
                        newLayerData.AreaCellSizeInStud = BlueBrick.Properties.Settings.Default.DefaultAreaSize;

                        // create a new entry for the list and store it in the list
                        LayerChange layerChange = new LayerChange();
                        layerChange.mReference   = areaLayer;
                        layerChange.mOldData     = oldLayerData;
                        layerChange.mNewData     = newLayerData;
                        layerChange.mOldColorMap = areaLayer.ColorMap;
                        mLayerChanges.Add(layerChange);
                    }
                }
            }
        }
예제 #11
0
 public DeleteArea(LayerArea layer, Rectangle area)
 {
     mAreaLayer       = layer;
     mAreaInCellIndex = area;
 }