示例#1
0
     public override bool Apply(ROI roi)
     {
         foreach (var p in roi.GetBorder().ToArray())
         {
             Map.Cells[p.X, p.Y] = new Cell()
             {
                 Type = CellType.Free, SpriteName = SpriteName
             }
         }
         ;
         return(true);
     }
 }
示例#2
0
        public override bool Apply(ROI roi)
        {
            foreach (var p in roi.GetBorder().ToArray())
            {
                var c = new Cell()
                {
                    Type = CellType.NotFlat
                };
                var code = p.GetFilledNeighborsCode(topologyType: TopType.N4);
                switch (code)
                {
                case 1101: c.SpriteName = SpriteName; c.Rotate = RotateFlipType.RotateNoneFlipNone; break;

                case 0111: c.SpriteName = SpriteName; c.Rotate = RotateFlipType.Rotate180FlipNone; break;

                case 1011: c.SpriteName = SpriteName; c.Rotate = RotateFlipType.Rotate90FlipX; break;

                case 1110: c.SpriteName = SpriteName; c.Rotate = RotateFlipType.Rotate90FlipNone; break;

                case 1100: c.SpriteName = SpriteNameCorner; c.Rotate = RotateFlipType.RotateNoneFlipNone; break;

                case 0110: c.SpriteName = SpriteNameCorner; c.Rotate = RotateFlipType.Rotate90FlipNone; break;

                case 0011: c.SpriteName = SpriteNameCorner; c.Rotate = RotateFlipType.Rotate180FlipNone; break;

                case 1001: c.SpriteName = SpriteNameCorner; c.Rotate = RotateFlipType.Rotate270FlipNone; break;

                case 1111:
                    switch (p.GetFilledNeighborsCode(topologyType: TopType.N8))
                    {
                    case 01111111: c.SpriteName = SpriteNameCorner2; c.Rotate = RotateFlipType.Rotate90FlipNone; break;

                    case 11011111: c.SpriteName = SpriteNameCorner2; c.Rotate = RotateFlipType.Rotate180FlipNone; break;

                    case 11110111: c.SpriteName = SpriteNameCorner2; c.Rotate = RotateFlipType.Rotate270FlipNone; break;

                    case 11111101: c.SpriteName = SpriteNameCorner2; c.Rotate = RotateFlipType.RotateNoneFlipNone; break;
                    }
                    break;
                }

                Map.Cells[p.X, p.Y] = c;
            }
            return(true);
        }