Esempio n. 1
0
        public ShapeStorageInfo <TPoint> Difference(ShapeStorageInfo <TPoint> other)
        {
            Func <TPoint, bool> newIsInside = x => contains(x) && !other.contains(x);
            var newStorageRect = storageRect.Difference(other.storageRect);

            return(new ShapeStorageInfo <TPoint>(newStorageRect, newIsInside));
        }
Esempio n. 2
0
        public ShapeStorageInfo <TPoint> Union(ShapeStorageInfo <TPoint> other)
        {
            Func <TPoint, bool> newIsInside = x => contains(x) || other.contains(x);
            var newStorageRect = storageRect.Union(other.storageRect);

            return(new ShapeStorageInfo <TPoint>(newStorageRect, newIsInside));
        }
Esempio n. 3
0
 protected override PointyTriOp <TCell> MakeOp(
     ShapeStorageInfo <PointyTriPoint> shapeInfo,
     Func <
         ShapeStorageInfo <PointyTriPoint>,
         ShapeStorageInfo <PointyTriPoint>,
         ShapeStorageInfo <PointyTriPoint> > combineInfo)
 {
     return(new PointyTriOp <TCell>(shapeInfo, combineInfo));
 }
Esempio n. 4
0
        /**
         *      This creates a shape described by a shape of the base point shape op.
         *      Typicaly usage:
         *      \code
         *      [ShapeMethod]
         *      public CairoShapeInfo<TCell> SomeShape(...)
         *      {
         *              return ShapeFromBase(PointyHexGrid<TCell>.BeginShape().SomeShape(...));
         *      }
         *      \endcode
         */
        public CairoShapeInfo <TCell> ShapeFromBase(PointyHexShapeInfo <TCell> baseShapeInfo)
        {
            ShapeStorageInfo <PointyHexPoint> storageInfo = baseShapeInfo.ShapeStorageStorageInfo;
            var storageRect = storageInfo.storageRect;
            Func <CairoPoint, bool> isInside = x => storageInfo.contains(x.BasePoint);
            var shapeInfo = MakeShapeStorageInfo <CairoPoint>(storageRect, isInside);

            return(new CairoShapeInfo <TCell>(shapeInfo));
        }
Esempio n. 5
0
 protected override RectOp <TCell> MakeOp(
     ShapeStorageInfo <RectPoint> shapeInfo,
     Func <
         ShapeStorageInfo <RectPoint>,
         ShapeStorageInfo <RectPoint>,
         ShapeStorageInfo <RectPoint> > combineInfo)
 {
     return(new RectOp <TCell>(shapeInfo, combineInfo));
 }
Esempio n. 6
0
 protected override FlatRhombOp <TCell> MakeOp(
     ShapeStorageInfo <FlatRhombPoint> shapeInfo,
     Func <
         ShapeStorageInfo <FlatRhombPoint>,
         ShapeStorageInfo <FlatRhombPoint>,
         ShapeStorageInfo <FlatRhombPoint> > combineInfo)
 {
     return(new FlatRhombOp <TCell>(shapeInfo, combineInfo));
 }
Esempio n. 7
0
 protected override DiamondOp <TCell> MakeOp(
     ShapeStorageInfo <DiamondPoint> shapeInfo,
     Func <
         ShapeStorageInfo <DiamondPoint>,
         ShapeStorageInfo <DiamondPoint>,
         ShapeStorageInfo <DiamondPoint> > combineInfo)
 {
     return(new DiamondOp <TCell>(shapeInfo, combineInfo));
 }
Esempio n. 8
0
 protected override CairoOp <TCell> MakeOp(
     ShapeStorageInfo <CairoPoint> shapeInfo,
     Func <
         ShapeStorageInfo <CairoPoint>,
         ShapeStorageInfo <CairoPoint>,
         ShapeStorageInfo <CairoPoint> > combineInfo)
 {
     return(new CairoOp <TCell>(shapeInfo, combineInfo));
 }
Esempio n. 9
0
        /**
         *      This creates a shape described by a shape of the base point shape op.
         *      Typicaly usage:
         *      \code
         *      [ShapeMethod]
         *      public FlatRhombShapeInfo<TCell> SomeShape(...)
         *      {
         *              return ShapeFromBase(FlatHexGrid<TCell>.BeginShape().SomeShape(...));
         *      }
         *      \endcode
         */
        public FlatRhombShapeInfo <TCell> ShapeFromBase(FlatHexShapeInfo <TCell> baseShapeInfo)
        {
            ShapeStorageInfo <FlatHexPoint> storageInfo = baseShapeInfo.ShapeStorageStorageInfo;
            var storageRect = storageInfo.storageRect;
            Func <FlatRhombPoint, bool> isInside = x => storageInfo.contains(x.BasePoint);
            var shapeInfo = MakeShapeStorageInfo <FlatRhombPoint>(storageRect, isInside);

            return(new FlatRhombShapeInfo <TCell>(shapeInfo));
        }
Esempio n. 10
0
        public static bool __CompilerHint2__Diamond__UVCell()
        {
            //Ensures abstract super classes for base grids gets created
            var grid = new DiamondGrid <UVCell>(1, 1, p => p == DiamondPoint.Zero, x => x, x => x, new List <DiamondPoint>());

            //Ensures shape infpo classes get created
            var shapeStorageInfo = new ShapeStorageInfo <DiamondPoint>(new IntRect(), p => true);
            var shapeInfo        = new DiamondShapeInfo <UVCell>(shapeStorageInfo);

            return(grid[grid.First()] == null || shapeInfo.Translate(DiamondPoint.Zero) != null);
        }
Esempio n. 11
0
        public static bool __CompilerHint2__FlatHex__MeshTileCell()
        {
            //Ensures abstract super classes for base grids gets created
            var grid = new FlatHexGrid <MeshTileCell>(1, 1, p => p == FlatHexPoint.Zero, x => x, x => x, new List <FlatHexPoint>());

            //Ensures shape infpo classes get created
            var shapeStorageInfo = new ShapeStorageInfo <FlatHexPoint>(new IntRect(), p => true);
            var shapeInfo        = new FlatHexShapeInfo <MeshTileCell>(shapeStorageInfo);

            return(grid[grid.First()] == null || shapeInfo.Translate(FlatHexPoint.Zero) != null);
        }
Esempio n. 12
0
        public static bool __CompilerHint__Rect__UVCell()
        {
            var grid = new RectGrid <UVCell[]>(1, 1);

            foreach (var point in grid)
            {
                grid[point] = new UVCell[1];
            }

            var shapeStorageInfo = new ShapeStorageInfo <RectPoint>(new IntRect(), p => true);
            var shapeInfo        = new RectShapeInfo <UVCell>(shapeStorageInfo);

            return(grid[grid.First()][0] == null || shapeInfo.Translate(RectPoint.Zero) != null);
        }
Esempio n. 13
0
        public static bool __CompilerHint__Diamond__TextureCell()
        {
            var grid = new DiamondGrid <TextureCell[]>(1, 1);

            foreach (var point in grid)
            {
                grid[point] = new TextureCell[1];
            }

            var shapeStorageInfo = new ShapeStorageInfo <DiamondPoint>(new IntRect(), p => true);
            var shapeInfo        = new DiamondShapeInfo <TextureCell>(shapeStorageInfo);

            return(grid[grid.First()][0] == null || shapeInfo.Translate(DiamondPoint.Zero) != null);
        }
Esempio n. 14
0
        public static bool __CompilerHint__FlatHex__TileCell()
        {
            var grid = new FlatHexGrid <TileCell[]>(1, 1);

            foreach (var point in grid)
            {
                grid[point] = new TileCell[1];
            }

            var shapeStorageInfo = new ShapeStorageInfo <FlatHexPoint>(new IntRect(), p => true);
            var shapeInfo        = new FlatHexShapeInfo <TileCell>(shapeStorageInfo);

            return(grid[grid.First()][0] == null || shapeInfo.Translate(FlatHexPoint.Zero) != null);
        }
Esempio n. 15
0
        public static bool __CompilerHint__Line__MeshTileCell()
        {
            var grid = new LineGrid <MeshTileCell[]>(1, 1);

            foreach (var point in grid)
            {
                grid[point] = new MeshTileCell[1];
            }

            var shapeStorageInfo = new ShapeStorageInfo <LinePoint>(new IntRect(), p => true);
            var shapeInfo        = new LineShapeInfo <MeshTileCell>(shapeStorageInfo);

            return(grid[grid.First()][0] == null || shapeInfo.Translate(LinePoint.Zero) != null);
        }
Esempio n. 16
0
        /**
         *      Call this method if you use a DiamondGrid.
         *      Replace	the type __CellType to whatever type you have in your grid.
         *
         *      You can call the method anywhere in your code.
         *
         *              if(!__CompilerHint__Diamond()) return;
         *
         *      This methods always returns true.
         *
         *      @since 1.6
         */
        public static bool __CompilerHint__Diamond()
        {
            //Ensures abstract super classes for base grids gets created
            var grid = new DiamondGrid <__CellType[]>(1, 1);

            foreach (var point in grid)
            {
                grid[point] = new __CellType[1];
            }

            //Ensures shape infpo classes get created
            var shapeStorageInfo = new ShapeStorageInfo <DiamondPoint>(new IntRect(), p => true);
            var shapeInfo        = new DiamondShapeInfo <__CellType>(shapeStorageInfo);

            return(grid[grid.First()][0] == null || shapeInfo.Translate(DiamondPoint.Zero) != null);
        }
Esempio n. 17
0
        /**
         *      Call this method if you use a CairoGrid.
         *      Replace	the type __CellType to whatever type you have in your grid.
         *
         *      You can call the method anywhere in your code.
         *
         *              if(!__CompilerHint__Cairo()) return;
         *
         *      This methods always returns true.
         *
         *      @since 1.6
         */
        public static bool __CompilerHint__Cairo()
        {
            //Ensures abstract super classes for base grids gets created
            var grid = new PointyHexGrid <__CellType[]>(1, 1);

            foreach (var point in grid)
            {
                grid[point] = new __CellType[1];
            }

            //Ensures shape infpo classes get created
            var shapeStorageInfo = new ShapeStorageInfo <CairoPoint>(new IntRect(), p => true);
            var shapeInfo        = new CairoShapeInfo <__CellType>(shapeStorageInfo);

            return(grid[grid.First()][0] == null || shapeInfo.IncIndex(0) != null);
        }
Esempio n. 18
0
        public static bool __CompilerHint__PointyRhomb__SpriteCell()
        {
            var grid1 = new PointyHexGrid <SpriteCell[]>(1, 1);

            foreach (var point in grid1)
            {
                grid1[point] = new SpriteCell[1];
            }

            var grid2 = new PointyRhombGrid <SpriteCell>(1, 1);

            foreach (var point in grid2)
            {
                grid2[point] = null;
            }

            var shapeStorageInfo = new ShapeStorageInfo <PointyRhombPoint>(new IntRect(), p => true);
            var shapeInfo        = new PointyRhombShapeInfo <SpriteCell>(shapeStorageInfo);

            return(grid1[grid1.First()][0] == null || grid2[grid2.First()] == null || shapeInfo.IncIndex(0) != null);
        }
Esempio n. 19
0
        public static bool __CompilerHint__FlatTri__TileCell()
        {
            var grid1 = new PointyHexGrid <TileCell[]>(1, 1);

            foreach (var point in grid1)
            {
                grid1[point] = new TileCell[1];
            }

            var grid2 = new FlatTriGrid <TileCell>(1, 1);

            foreach (var point in grid2)
            {
                grid2[point] = null;
            }

            var shapeStorageInfo = new ShapeStorageInfo <FlatTriPoint>(new IntRect(), p => true);
            var shapeInfo        = new FlatTriShapeInfo <TileCell>(shapeStorageInfo);

            return(grid1[grid1.First()][0] == null || grid2[grid2.First()] == null || shapeInfo.IncIndex(0) != null);
        }
Esempio n. 20
0
 protected override CairoShapeInfo <TCell> MakeShapeInfo(
     ShapeStorageInfo <CairoPoint> shapeStorageInfo)
 {
     return(new CairoShapeInfo <TCell>(shapeStorageInfo));
 }
Esempio n. 21
0
 protected override RectShapeInfo <TCell> MakeShapeInfo(
     ShapeStorageInfo <RectPoint> shapeStorageInfo)
 {
     return(new RectShapeInfo <TCell>(shapeStorageInfo));
 }
Esempio n. 22
0
 public CairoShapeInfo(ShapeStorageInfo <CairoPoint> info) :
     base(info)
 {
 }
Esempio n. 23
0
 protected override FlatRhombShapeInfo <TCell> MakeShapeInfo(
     ShapeStorageInfo <FlatRhombPoint> shapeStorageInfo)
 {
     return(new FlatRhombShapeInfo <TCell>(shapeStorageInfo));
 }
Esempio n. 24
0
 public FlatRhombShapeInfo(ShapeStorageInfo <FlatRhombPoint> info) :
     base(info)
 {
 }
Esempio n. 25
0
 abstract protected TShapeInfo MakeShapeInfo(
     ShapeStorageInfo <TPoint> shapeStorageInfo);
Esempio n. 26
0
 public DiamondShapeInfo(ShapeStorageInfo <DiamondPoint> info) :
     base(info)
 {
 }
Esempio n. 27
0
 abstract protected TShapeOp MakeOp(
     ShapeStorageInfo <TPoint> shapeInfo,
     Func <
         ShapeStorageInfo <TPoint>,
         ShapeStorageInfo <TPoint>,
         ShapeStorageInfo <TPoint> > combineInfo);
Esempio n. 28
0
 public FlatTriShapeInfo(ShapeStorageInfo <FlatTriPoint> info) :
     base(info)
 {
 }
Esempio n. 29
0
 protected AbstractShapeInfo(ShapeStorageInfo <TPoint> info)
 {
     shapeStorageStorageInfo = info;
 }
Esempio n. 30
0
 public PointyRhombShapeInfo(ShapeStorageInfo <PointyRhombPoint> info) :
     base(info)
 {
 }