#include <gridtype.h>
Public Types | |
enum | gridType { GT_BRICKS, GT_TRIANGULAR_PRISM, GT_SPHERES, GT_RHOMBIC, GT_TETRA_OCTA, GT_NUM_GRIDS } |
the available grid types More... | |
enum | capabilities { CAP_ASSEMBLE = 1, CAP_DISASSEMBLE = 2, CAP_STLEXPORT = 4 } |
capabilities of a given grid space More... | |
Public Member Functions | |
gridType_c (xmlParser_c &pars) | |
load from xml node | |
gridType_c (const gridType_c &) | |
copy constructor | |
void | save (xmlWriter_c &xml) const |
used to save to XML | |
gridType_c (void) | |
create a cube grid | |
gridType_c (gridType gt) | |
create a grid of the given type with its standard parameters | |
~gridType_c (void) | |
gridType | getType (void) const |
get the grid type | |
unsigned int | getCapabilities (void) const |
movementCache_c * | getMovementCache (const problem_c *puz) const |
return a movement cache instance for this grid type | |
voxel_c * | getVoxel (unsigned int x, unsigned int y, unsigned int z, voxel_type init) const |
create a new voxel space of this grid type with the given dimensions | |
voxel_c * | getVoxel (xmlParser_c &pars) const |
create a new voxel space of this grid type, which is loaded from the XML node | |
voxel_c * | getVoxel (const voxel_c &orig) const |
create a new voxel space of this grid type, which is a copy of the given space | |
voxel_c * | getVoxel (const voxel_c *orig) const |
create a new voxel space of this grid type, which is a copy of the given space | |
const symmetries_c * | getSymmetries (void) const |
Return a pointer to the symmetry class for this grid. | |
stlExporter_c * | getStlExporter (void) const |
return an STL exporter for this grid | |
Static Public Member Functions | |
static assembler_c * | findAssembler (const problem_c *p) |
Find a suitable assembler for the given problem. | |
Protected Attributes | |
gridType | type |
the grid type of this instance | |
symmetries_c * | sym |
The symmetry object for this grid type. | |
Private Member Functions | |
void | operator= (const gridType_c &) |
That means this class knows about the capabilities of the different grids. It know how to create assembler disassembler, STL-exporter, or voxelspaces for the different grid, ...
This is a factory (see http://en.wikipedia.org/wiki/Factory_method_pattern)
enum gridType_c::gridType |
the available grid types
gridType_c::gridType_c | ( | xmlParser_c & | pars | ) |
load from xml node
References xmlParser_c::exception(), xmlParser_c::getAttributeValue(), GT_BRICKS, GT_RHOMBIC, GT_SPHERES, GT_TETRA_OCTA, GT_TRIANGULAR_PRISM, xmlParser_c::require(), xmlParser_c::skipSubTree(), xmlParser_c::START_TAG, sym, and type.
gridType_c::gridType_c | ( | const gridType_c & | orig | ) |
copy constructor
gridType_c::gridType_c | ( | gridType | gt | ) |
create a grid of the given type with its standard parameters
References bt_assert, GT_BRICKS, GT_RHOMBIC, GT_SPHERES, GT_TETRA_OCTA, GT_TRIANGULAR_PRISM, sym, and type.
gridType_c::~gridType_c | ( | void | ) |
References sym.
assembler_c * gridType_c::findAssembler | ( | const problem_c * | p | ) | [static] |
Find a suitable assembler for the given problem.
This function is different from the above, it is not dependend on the gridtype of the puzzle but on some of the parameters of the puzzle, e.g has the puzzle multipieces, has the puzzle piece count ranges, ... the function tries to find the fastest assembler that can handle the puzzle. because we are not dependend on the gridtype this function is static but it needs to know the puzzle
References assembler_1_c::canHandle(), and assembler_0_c::canHandle().
Referenced by solveThread_c::run().
unsigned int gridType_c::getCapabilities | ( | void | ) | const |
References CAP_ASSEMBLE, CAP_DISASSEMBLE, CAP_STLEXPORT, GT_BRICKS, GT_RHOMBIC, GT_SPHERES, GT_TETRA_OCTA, GT_TRIANGULAR_PRISM, and type.
movementCache_c * gridType_c::getMovementCache | ( | const problem_c * | puz | ) | const |
return a movement cache instance for this grid type
References GT_BRICKS, GT_TRIANGULAR_PRISM, and type.
Referenced by movementAnalysator_c::movementAnalysator_c().
stlExporter_c * gridType_c::getStlExporter | ( | void | ) | const |
return an STL exporter for this grid
References GT_BRICKS, GT_RHOMBIC, GT_SPHERES, GT_TETRA_OCTA, GT_TRIANGULAR_PRISM, and type.
const symmetries_c * gridType_c::getSymmetries | ( | void | ) | const |
Return a pointer to the symmetry class for this grid.
Don't free this instance the ownership stays with the gridType_c class You just use the class and forget about it
References GT_BRICKS, GT_RHOMBIC, GT_SPHERES, GT_TETRA_OCTA, GT_TRIANGULAR_PRISM, sym, and type.
Referenced by voxelTable_c::addSpace(), voxel_c::getMirrorTransform(), voxelTable_c::getSpace(), voxel_c::identicalWithRots(), movementCache_c::movementCache_c(), voxel_c::normalizeTransformation(), assembler_1_c::prepare(), assembler_0_c::prepare(), voxel_c::recalcBoundingBox(), voxel_c::selfSymmetries(), voxel_c::setHotspot(), and voxel_c::voxel_c().
gridType gridType_c::getType | ( | void | ) | const [inline] |
create a new voxel space of this grid type, which is a copy of the given space
References GT_BRICKS, GT_RHOMBIC, GT_SPHERES, GT_TETRA_OCTA, GT_TRIANGULAR_PRISM, and type.
create a new voxel space of this grid type, which is a copy of the given space
References GT_BRICKS, GT_RHOMBIC, GT_SPHERES, GT_TETRA_OCTA, GT_TRIANGULAR_PRISM, and type.
voxel_c * gridType_c::getVoxel | ( | xmlParser_c & | pars | ) | const |
create a new voxel space of this grid type, which is loaded from the XML node
References GT_BRICKS, GT_RHOMBIC, GT_SPHERES, GT_TETRA_OCTA, GT_TRIANGULAR_PRISM, and type.
voxel_c * gridType_c::getVoxel | ( | unsigned int | x, | |
unsigned int | y, | |||
unsigned int | z, | |||
voxel_type | init | |||
) | const |
create a new voxel space of this grid type with the given dimensions
References GT_BRICKS, GT_RHOMBIC, GT_SPHERES, GT_TETRA_OCTA, GT_TRIANGULAR_PRISM, and type.
Referenced by puzzle_c::addShape(), voxelTable_c::addSpace(), assembly_c::createSpace(), doConvert(), voxel_c::getBoundingBox(), voxel_c::getHotspot(), voxel_c::getMirrorTransform(), voxelTable_c::getSpace(), movementCache_c::getTransformedShape(), voxel_c::identicalWithRots(), assembler_1_c::prepare(), assembler_0_c::prepare(), print(), puzzle_c::puzzle_c(), and symmetries_0_c::symmetryKnown().
void gridType_c::operator= | ( | const gridType_c & | ) | [private] |
void gridType_c::save | ( | xmlWriter_c & | xml | ) | const |
used to save to XML
References xmlWriter_c::endTag(), xmlWriter_c::newAttrib(), xmlWriter_c::newTag(), and type.
Referenced by puzzle_c::save().
symmetries_c* gridType_c::sym [mutable, protected] |
The symmetry object for this grid type.
As we only need one symmetry object for a grid type we create a local instance here and just return a pointer to it for the application to use
Referenced by getSymmetries(), gridType_c(), and ~gridType_c().
gridType gridType_c::type [protected] |
the grid type of this instance
Referenced by getCapabilities(), getMovementCache(), getStlExporter(), getSymmetries(), getType(), getVoxel(), gridType_c(), and save().