Ejemplo n.º 1
0
        public static IDGrid Build( IDMap idmap )
        {
            IDGrid result = new IDGrid();
            for ( int y=0; y<result.height; ++y ) {
                for ( int x=0; x<result.width; ++x ) {
                    result.BuildRegion( x, y, idmap );
                }
            }

            return result;
        }
Ejemplo n.º 2
0
        public static bool CheckAreaForOverflow( IDMap idmap, Rectangle area, out Rectangle errorArea )
        {
            int l, r, t, b;

            l = (int)Math.Floor((double)(area.Left / RegionWidth));
            t = (int)Math.Floor((double)(area.Top / RegionWidth));
            r = (int)Math.Ceiling((double)(area.Right / RegionWidth));
            b = (int)Math.Ceiling((double)(area.Bottom / RegionWidth));
            IDGrid result = new IDGrid();
            try {
                for ( int y=t; y<b; ++y ) {
                    for ( int x=l; x<r; ++x ) {
                        result.BuildRegion( x, y, idmap );
                    }
                }
                errorArea = Rectangle.Empty;
                return true;
            }
            catch ( RegionSizeOverflowException e ) {
                errorArea = e.Region;
                return false;
            }
        }