46 lines
908 B
C++
Executable File
46 lines
908 B
C++
Executable File
#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
|