#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; class Dxf_converter { //typedef std::pair Point_2; /* typedef CGAL::Quotient NT1; typedef CGAL::Cartesian Linear_k1; typedef CGAL::Algebraic_kernel_2_2 Algebraic_k1; typedef CGAL::Curved_kernel CircularKernel;*/ // typedef double type; // typedef CGAL::Cartesian NT1; //typedef CGAL::Quotient NT1; typedef CGAL::Gmpq NT1; // typedef CGAL::Quotient NT1; typedef CGAL::Cartesian Linear_k1; typedef CGAL::Algebraic_kernel_for_circles_2_2 Algebraic_k1; typedef CGAL::Circular_kernel_2 CK; typedef CK::Circular_arc_point_2 Circular_arc_point_2; typedef CK::Line_2 Line_2; typedef CK::Point_2 Point_2; typedef CK::Circle_2 Circle_2; typedef std::list > Polygon; typedef std::list Polygons; typedef CK::Intersect_2 Intersect_2; typedef CK::FT FT; private: void header(std::istream& is) { int n; double xmin, ymin; double xmax, ymax; is >> n; assert(n == 9); char c; is >> c; assert(c == '$'); std::string str; is >> str; if(str == std::string("EXTMIN")){ is >> n; assert(n == 10); is >> xmin; is >> n; assert(n == 20); is >> ymin; } is >> n; assert(n == 9); is >> c; assert(c == '$'); is >> str; if(str == "EXTMAX"){ is >> n; assert(n == 10); is >> xmax; is >> n; assert(n == 20); is >> ymax; } } void skip_header(std::istream& is) { int n; is >> n; assert(n == 0); std::string str; is >> str; assert(str == "SECTION"); is >> n; assert(n == 2); is >> str; if(str == "HEADER"){ header(is); } is >> n; assert(n == 0); is >> str; assert(str == "ENDSEC"); } void read_circle(std::istream& is,std::ostream& os) { int n; double cx, cy, r; std::string str; is >> n; assert(n == 8); is >> n; assert(n == 0); is >> n; assert(n == 10); is >> cx; is >> n; assert(n == 20); is >> cy; is >> n; assert(n == 40); is >> r; NT1 x(cx), y(cy), gr(r*r); os<<"Circle_2 ("<<"Point_2("<<"Rational(" <begin(); first_point = pit->first; while(true){ ps = pit->first; bulge = pit->second; pit++; if(pit ==it->end()){ break; } pt = pit->first; if(bulge == FT(0)){ if(ps != pt){ os<<"Line_arc_2("<<"Point_2("<<"Rational(" <> n; if(n != 0){ int m; is >> m; } } while(n != 0); do { is >> str; if(str == "VERTEX"){ is >> n; assert(n == 8); is >> n; assert(n == 0); is >> n; assert(n == 10); is >> x; is >> n; assert(n == 20); is >> y; is >> n; len = 0; if(n == 42){ is >> len; } else { assert(n == 0); } //std::cout<<"Polygon"<> n; assert(n == 8); is >> n; assert(n == 0); std::cout<> n; assert(n == 0); is >> str; assert(str == "SECTION"); is >> n; is >> str; assert(str == "ENTITIES"); do { is >> n; assert(n == 0); is >> str; if(str == "POLYLINE"){ Polygon p; poly.push_back(p); std::cout<< "it's polyline" <> n; assert(n == 0); is >> str; assert(str == "EOF"); std::cout << "read_entities - finished"<