Ejemplo n.º 1
0
 /// <see cref="CellDataChangeSetBase.CollectTargetSet"/>
 protected override RCSet <RCIntVector> CollectTargetSet(ICellDataChangeSetTarget target)
 {
     return(target.GetCell(this.targetCell) != null ? new RCSet <RCIntVector>()
     {
         this.targetCell
     }
                                                       : new RCSet <RCIntVector>());
 }
Ejemplo n.º 2
0
        /// <see cref="CellDataChangeSetBase.CollectTargetSet"/>
        protected override RCSet <RCIntVector> CollectTargetSet(ICellDataChangeSetTarget target)
        {
            RCSet <RCIntVector> targetset = new RCSet <RCIntVector>();

            for (int x = 0; x < target.CellSize.X; x++)
            {
                RCIntVector index = new RCIntVector(x, this.targetRow);
                if (target.GetCell(index) != null)
                {
                    targetset.Add(index);
                }
            }
            return(targetset);
        }
Ejemplo n.º 3
0
        /// <see cref="ICellDataChangeSet.Undo"/>
        public void Undo(ICellDataChangeSetTarget target)
        {
            RCSet <RCIntVector> targetset = this.CollectTargetSet(target);

            foreach (RCIntVector targetCell in targetset)
            {
                ICell cell = target.GetCell(targetCell);
                if (cell == null)
                {
                    throw new MapException(string.Format("Cell at index {0} not found in the changeset target!", targetCell));
                }
                this.modifier.UndoModification(cell);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Collects the coordinates of the cells of the target-set.
        /// </summary>
        /// <param name="target">The target of the changeset.</param>
        /// <returns>The collected coordinates.</returns>
        protected virtual RCSet <RCIntVector> CollectTargetSet(ICellDataChangeSetTarget target)
        {
            RCSet <RCIntVector> targetset = new RCSet <RCIntVector>();

            for (int x = 0; x < target.CellSize.X; x++)
            {
                for (int y = 0; y < target.CellSize.Y; y++)
                {
                    RCIntVector index = new RCIntVector(x, y);
                    if (target.GetCell(index) != null)
                    {
                        targetset.Add(index);
                    }
                }
            }
            return(targetset);
        }
Ejemplo n.º 5
0
        /// <see cref="CellDataChangeSetBase.CollectTargetSet"/>
        protected override RCSet <RCIntVector> CollectTargetSet(ICellDataChangeSetTarget target)
        {
            RCSet <RCIntVector> targetset = new RCSet <RCIntVector>();

            for (int x = this.targetRect.X; x < this.targetRect.Right; x++)
            {
                for (int y = this.targetRect.Y; y < this.targetRect.Bottom; y++)
                {
                    RCIntVector index = new RCIntVector(x, y);
                    if (target.GetCell(index) != null)
                    {
                        targetset.Add(index);
                    }
                }
            }
            return(targetset);
        }
Ejemplo n.º 6
0
        /// <see cref="CellDataChangeSetBase.CollectTargetSet"/>
        protected override RCSet<RCIntVector> CollectTargetSet(ICellDataChangeSetTarget target)
        {
            RCSet<RCIntVector> targetset = new RCSet<RCIntVector>();
            for (int x = 0; x < target.CellSize.X; x++)
            {
                for (int y = 0; y < target.CellSize.Y; y++)
                {
                    RCNumVector cellIsoCoordsDbl = MapStructure.NavCellIsoTransform.TransformAB(new RCNumVector(x, y)) * 2;
                    bool isCellInQuarter = false;
                    if (this.targetQuarter == MapDirection.North)
                    {
                        isCellInQuarter = cellIsoCoordsDbl.X >= -1 && cellIsoCoordsDbl.X < 0 && cellIsoCoordsDbl.Y >= -1 && cellIsoCoordsDbl.Y < 0;
                    }
                    else if (this.targetQuarter == MapDirection.East)
                    {
                        isCellInQuarter = cellIsoCoordsDbl.X >= 0 && cellIsoCoordsDbl.X < 1 && cellIsoCoordsDbl.Y >= -1 && cellIsoCoordsDbl.Y < 0;
                    }
                    else if (this.targetQuarter == MapDirection.South)
                    {
                        isCellInQuarter = cellIsoCoordsDbl.X >= 0 && cellIsoCoordsDbl.X < 1 && cellIsoCoordsDbl.Y >= 0 && cellIsoCoordsDbl.Y < 1;
                    }
                    else if (this.targetQuarter == MapDirection.West)
                    {
                        isCellInQuarter = cellIsoCoordsDbl.X >= -1 && cellIsoCoordsDbl.X < 0 && cellIsoCoordsDbl.Y >= 0 && cellIsoCoordsDbl.Y < 1;
                    }
                    else
                    {
                        throw new MapException("Unexpected quarter!");
                    }

                    if (isCellInQuarter)
                    {
                        RCIntVector index = new RCIntVector(x, y);
                        if (target.GetCell(index) != null)
                        {
                            targetset.Add(index);
                        }
                    }
                }
            }
            return targetset;
        }