Use global class templates CGAL::Type<K>, instead of K::Type.

This commit is contained in:
Laurent Rineau 2008-10-01 13:09:56 +00:00
parent 92a637b90d
commit 4f36fa9cad
1 changed files with 19 additions and 19 deletions

View File

@ -40,7 +40,7 @@ template <typename K>
class Converter { class Converter {
bool clippingRectIsInitialized; bool clippingRectIsInitialized;
typename K::Iso_rectangle_2 clippingRect; CGAL::Iso_rectangle_2<K> clippingRect;
public: public:
@ -59,41 +59,41 @@ public:
clippingRectIsInitialized = false; clippingRectIsInitialized = false;
} }
typename K::Point_2 operator()(const QPointF& qp) const CGAL::Point_2<K> operator()(const QPointF& qp) const
{ {
return typename K::Point_2(qp.x(), qp.y()); return CGAL::Point_2<K>(qp.x(), qp.y());
} }
QPointF operator()(const typename K::Point_2& p) const QPointF operator()(const CGAL::Point_2<K>& p) const
{ {
return QPointF(to_double(p.x()), to_double(p.y())); return QPointF(to_double(p.x()), to_double(p.y()));
} }
QPointF operator()(const typename CGAL::Circular_arc_point_2<K>& p) const QPointF operator()(const CGAL::Circular_arc_point_2<K>& p) const
{ {
return QPointF(to_double(p.x()), to_double(p.y())); return QPointF(to_double(p.x()), to_double(p.y()));
} }
typename K::Segment_2 operator()(const QLineF& qs) const CGAL::Segment_2<K> operator()(const QLineF& qs) const
{ {
return typename K::Segment_2(operator()(qs.p1()), operator()(qs.p2)); return CGAL::Segment_2<K>(operator()(qs.p1()), operator()(qs.p2));
} }
QLineF operator()(const typename K::Segment_2 &s) const QLineF operator()(const CGAL::Segment_2<K> &s) const
{ {
return QLineF(operator()(s.source()), operator()(s.target())); return QLineF(operator()(s.source()), operator()(s.target()));
} }
typename K::Iso_rectangle_2 operator()(const QRectF& qr) const CGAL::Iso_rectangle_2<K> operator()(const QRectF& qr) const
{ {
return typename K::Iso_rectangle_2(operator()(qr.bottomLeft()), operator()(qr.topRight())); return CGAL::Iso_rectangle_2<K>(operator()(qr.bottomLeft()), operator()(qr.topRight()));
} }
QRectF operator()(const typename K::Iso_rectangle_2& r) const QRectF operator()(const CGAL::Iso_rectangle_2<K>& r) const
{ {
return QRectF(operator()(r[3]), operator()(r[1])); // top left, bottom right return QRectF(operator()(r[3]), operator()(r[1])); // top left, bottom right
} }
@ -108,12 +108,12 @@ public:
} }
QLineF operator()(const typename K::Ray_2 &r) const QLineF operator()(const CGAL::Ray_2<K> &r) const
{ {
CGAL_assertion(clippingRectIsInitialized); CGAL_assertion(clippingRectIsInitialized);
Object o = CGAL::intersection(r, clippingRect); Object o = CGAL::intersection(r, clippingRect);
typedef typename K::Segment_2 Segment_2; typedef CGAL::Segment_2<K> Segment_2;
typedef typename K::Point_2 Point_2; typedef CGAL::Point_2<K> Point_2;
if(const Segment_2 *s = CGAL::object_cast<Segment_2>(&o)){ if(const Segment_2 *s = CGAL::object_cast<Segment_2>(&o)){
return this->operator()(*s); return this->operator()(*s);
} else if(const Point_2 *p = CGAL::object_cast<Point_2>(&o)){ } else if(const Point_2 *p = CGAL::object_cast<Point_2>(&o)){
@ -122,12 +122,12 @@ public:
return QLineF(); return QLineF();
} }
QLineF operator()(const typename K::Line_2 &l) const QLineF operator()(const CGAL::Line_2<K> &l) const
{ {
CGAL_assertion(clippingRectIsInitialized); CGAL_assertion(clippingRectIsInitialized);
Object o = CGAL::intersection(l, clippingRect); Object o = CGAL::intersection(l, clippingRect);
typedef typename K::Segment_2 Segment_2; typedef CGAL::Segment_2<K> Segment_2;
typedef typename K::Point_2 Point_2; typedef CGAL::Point_2<K> Point_2;
if(const Segment_2 *s = CGAL::object_cast<Segment_2>(&o)){ if(const Segment_2 *s = CGAL::object_cast<Segment_2>(&o)){
return this->operator()(*s); return this->operator()(*s);
} else if(const Point_2 *p = CGAL::object_cast<Point_2>(&o)){ } else if(const Point_2 *p = CGAL::object_cast<Point_2>(&o)){
@ -136,7 +136,7 @@ public:
return QLineF(); return QLineF();
} }
QPolygonF operator()(const typename K::Triangle_2 &t) QPolygonF operator()(const CGAL::Triangle_2<K> &t)
{ {
QPolygonF qp; QPolygonF qp;
qp << operator()(t.vertex(0)) << operator()(t.vertex(1)) << operator()(t.vertex(2)); qp << operator()(t.vertex(0)) << operator()(t.vertex(1)) << operator()(t.vertex(2));
@ -144,7 +144,7 @@ public:
} }
void operator()(std::list< typename K::Point_2 >& p, const QPolygonF& qp) const void operator()(std::list< CGAL::Point_2<K> >& p, const QPolygonF& qp) const
{ {
for(int i = 0; i < qp.size(); i++){ for(int i = 0; i < qp.size(); i++){
p.push_back(operator()(qp[i])); p.push_back(operator()(qp[i]));