public ProjectedCellRegionEnumerator(ProjectedCellRegion region)
     : this()
 {
     r = region;
     Reset();
     current = new PPos(u, v);
 }
Example #2
0
        public void SetBounds(PPos tl, PPos br)
        {
            // The tl and br coordinates are inclusive, but the Rectangle
            // is exclusive.  Pad the right and bottom edges to match.
            Bounds = Rectangle.FromLTRB(tl.U, tl.V, br.U + 1, br.V + 1);

            // Directly calculate the projected map corners in world units avoiding unnecessary
            // conversions.  This abuses the definition that the width of the cell along the x world axis
            // is always 1024 or 1448 units, and that the height of two rows is 2048 for classic cells and 724
            // for isometric cells.
            if (Grid.Type == MapGridType.RectangularIsometric)
            {
                ProjectedTopLeft     = new WPos(tl.U * 1448, tl.V * 724, 0);
                ProjectedBottomRight = new WPos(br.U * 1448 - 1, (br.V + 1) * 724 - 1, 0);
            }
            else
            {
                ProjectedTopLeft     = new WPos(tl.U * 1024, tl.V * 1024, 0);
                ProjectedBottomRight = new WPos(br.U * 1024 - 1, (br.V + 1) * 1024 - 1, 0);
            }

            ProjectedCellBounds = new ProjectedCellRegion(this, tl, br);
        }
Example #3
0
        public void SetBounds(PPos tl, PPos br)
        {
            // The tl and br coordinates are inclusive, but the Rectangle
            // is exclusive.  Pad the right and bottom edges to match.
            Bounds = Rectangle.FromLTRB(tl.U, tl.V, br.U + 1, br.V + 1);

            // Directly calculate the projected map corners in world units avoiding unnecessary
            // conversions.  This abuses the definition that the width of the cell is always
            // 1024 units, and that the height of two rows is 2048 for classic cells and 1024
            // for diamond cells.
            var wtop    = tl.V * 1024;
            var wbottom = (br.V + 1) * 1024;

            if (TileShape == TileShape.Diamond)
            {
                wtop    /= 2;
                wbottom /= 2;
            }

            ProjectedTopLeft     = new WPos(tl.U * 1024, wtop, 0);
            ProjectedBottomRight = new WPos(br.U * 1024 - 1, wbottom - 1, 0);

            ProjectedCellBounds = new ProjectedCellRegion(this, tl, br);
        }
Example #4
0
 public ProjectedCellRegionEnumerator(ProjectedCellRegion region)
 {
     r = region;
     Reset();
 }