Limbo 3.5.4
Loading...
Searching...
No Matches
test_blibapi.cpp
Go to the documentation of this file.
1
6
7#include <iostream>
8#include <string>
9#include <vector>
10#include <list>
11#include <set>
12#include "bLibPoint.h"
13#include "bLibShape.h"
16using std::cout;
17using std::endl;
18using std::string;
19using std::vector;
20using std::list;
21using std::set;
22
23namespace lg = limbo::geometry;
24
30
34void test1(string const& filename)
35{
36 std::vector<bLib::bBox> vRect;
37 lg::Polygon2Rectangle<vector<bLib::bPoint>, vector<bLib::bBox> > p2r (vRect, lg::HOR_VER_SLICING);
38 assert(p2r.read(filename));
39 assert(p2r());
40 p2r.print("p2r1.gp");
41}
42
46void test2(string const& filename)
47{
48 std::vector<bLib::bBox> vRect;
49 lg::Polygon2Rectangle<list<bLib::bPoint>, vector<bLib::bBox> > p2r (vRect, lg::HOR_VER_SLICING);
50 assert(p2r.read(filename));
51 assert(p2r());
52 p2r.print("p2r2.gp");
53}
54
58void test3(string const& filename)
59{
60 std::vector<bLib::bBox> vRect;
62 assert(p2r.read(filename));
63 assert(p2r());
64 p2r.print("p2r3.gp");
65}
66
73int main(int argc, char** argv)
74{
75 if (argc > 1)
76 {
77 test1(argv[1]);
78 test2(argv[1]);
79 test3(argv[1]);
80 }
81 else cout << "at least 1 argument is required" << endl;
82
83 return 0;
84}
a generic implementation of polygon-to-rectangle conversion
Geometry traits for bLib, include this file when bLib is used if your point class setting is differen...
a class implement conversion from manhattan polygon to rectangle
bool read(string const &filename)
read polygon from file try to be compatible to gnuplot format
void print(string const &filename) const
print polygon to file in gnuplot format
namespace for Limbo.Geometry
Definition Geometry.h:21
@ HOR_VER_SLICING
horizontal/vertical slicing and choose rectangle with larger area every time
Definition Geometry.h:43
int main()
void test2(string const &filename)
test std::list
void test3(string const &filename)
test std::set
void test1()
test function API