Ejemplo n.º 1
0
 private RectangularTileIndex GetTileIndexAt(
     double locationX, double locationY,
     BorderPointTileAllocationPolicy borderPointTileAllocation)
 {
     return(RectangularTilingUtils.GetTileIndex(locationX, locationY,
                                                OriginX, OriginY,
                                                TileWidth, TileHeight,
                                                borderPointTileAllocation));
 }
Ejemplo n.º 2
0
        public static RectangularTileIndex GetTileIndex(
            double locationX, double locationY,
            double originX, double originY,
            double tileWidth, double tileHeight,
            BorderPointTileAllocationPolicy borderPointTileAllocation)
        {
            int indexEast;
            int indexNorth;

            double tilePositionX = (locationX - originX) / tileWidth;
            double tilePositionY = (locationY - originY) / tileHeight;

            switch (borderPointTileAllocation)
            {
            case BorderPointTileAllocationPolicy.BottomLeft:

                indexEast = GetIntegerIndex(tilePositionX,
                                            AllocationPolicy1D.ExcludeUpperBound);
                indexNorth = GetIntegerIndex(tilePositionY,
                                             AllocationPolicy1D.ExcludeUpperBound);
                break;

            case BorderPointTileAllocationPolicy.TopLeft:

                indexEast = GetIntegerIndex(tilePositionX,
                                            AllocationPolicy1D.ExcludeUpperBound);
                indexNorth = GetIntegerIndex(tilePositionY,
                                             AllocationPolicy1D.IncludeUpperBound);
                break;

            case BorderPointTileAllocationPolicy.TopRight:

                indexEast = GetIntegerIndex(tilePositionX,
                                            AllocationPolicy1D.IncludeUpperBound);
                indexNorth = GetIntegerIndex(tilePositionY,
                                             AllocationPolicy1D.IncludeUpperBound);
                break;

            case BorderPointTileAllocationPolicy.BottomRight:

                indexEast = GetIntegerIndex(tilePositionX,
                                            AllocationPolicy1D.IncludeUpperBound);
                indexNorth = GetIntegerIndex(tilePositionY,
                                             AllocationPolicy1D.ExcludeUpperBound);
                break;

            default:
                throw new ArgumentOutOfRangeException(
                          nameof(borderPointTileAllocation),
                          borderPointTileAllocation,
                          @"Unexpected value");
            }

            return(new RectangularTileIndex(indexEast, indexNorth));
        }
Ejemplo n.º 3
0
        public RectangularTilingStructure(
            double originX, double originY,
            double tileWidth, double tileHeight,
            BorderPointTileAllocationPolicy borderPointTileAllocation,
            [CanBeNull] ISpatialReference spatialReference)
        {
            OriginX    = originX;
            OriginY    = originY;
            TileWidth  = tileWidth;
            TileHeight = tileHeight;

            BorderPointTileAllocation = borderPointTileAllocation;
            SpatialReference          = spatialReference;
        }