initial version
This commit is contained in:
45
tests/grid/TestGridFactory.cpp
Executable file
45
tests/grid/TestGridFactory.cpp
Executable file
@@ -0,0 +1,45 @@
|
||||
#ifdef WITH_TESTS
|
||||
|
||||
#include "../Tests.h"
|
||||
#include "../../grid/factory/GridFactory.h"
|
||||
#include "../../floorplan/FloorplanFactorySVG.h"
|
||||
|
||||
#include <KLib/misc/gnuplot/Gnuplot.h>
|
||||
#include <KLib/misc/gnuplot/GnuplotSplot.h>
|
||||
#include <KLib/misc/gnuplot/GnuplotSplotElementPoints.h>
|
||||
|
||||
class GP : public GridNode, public GridPoint {
|
||||
public:
|
||||
GP() : GridNode(), GridPoint() {;}
|
||||
GP(int x, int y, int z) : GridNode(), GridPoint(x,y,z) {;}
|
||||
|
||||
};
|
||||
|
||||
TEST(GridFactory, create) {
|
||||
|
||||
Grid<20, GP> g;
|
||||
GridFactory<20, GP> gf(g);
|
||||
FloorplanFactorySVG fpf(getDataFile("test.svg"), 2);
|
||||
Floor f1 = fpf.getFloor("1");
|
||||
|
||||
gf.addFloor(f1, 0);
|
||||
|
||||
K::Gnuplot gp;
|
||||
K::GnuplotSplot splot;
|
||||
K::GnuplotSplotElementPoints points;
|
||||
|
||||
for (int i = 0; i < g.getNumNodes(); ++i) {
|
||||
const GP& node = g[i];
|
||||
points.add(K::GnuplotPoint3(node.x_cm, node.y_cm, node.z_cm));
|
||||
}
|
||||
|
||||
splot.add(&points);
|
||||
gp.draw(splot);
|
||||
gp.flush();
|
||||
|
||||
sleep(10);
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user