Limbo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
test_blibapi.cpp
Go to the documentation of this file.
1 
7 #include <iostream>
8 #include <string>
9 #include <vector>
10 #include <list>
11 #include <set>
12 #include "bLibPoint.h"
13 #include "bLibShape.h"
16 using std::cout;
17 using std::endl;
18 using std::string;
19 using std::vector;
20 using std::list;
21 using std::set;
22 
23 namespace lg = limbo::geometry;
24 
34 void 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 
46 void 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 
58 void 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 
73 int 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 }
Geometry traits for bLib, include this file when bLib is used if your point class setting is differen...
bool read(string const &filename)
read polygon from file try to be compatible to gnuplot format
a class implement conversion from manhattan polygon to rectangle
void test1(string const &filename)
test bLib API
void print(string const &filename) const
print polygon to file in gnuplot format
void test2(string const &filename)
test std::list
a generic implementation of polygon-to-rectangle conversion
int main(int argc, char **argv)
main function requires an input benchmark in gnuplot format
namespace for Limbo.Geometry
Definition: Geometry.h:20
horizontal/vertical slicing and choose rectangle with larger area every time
Definition: Geometry.h:43
void test3(string const &filename)
test std::set