mirror of https://github.com/CGAL/cgal
Fix for Windows 'min/max' bug
This commit is contained in:
parent
c153408f14
commit
77f3648287
|
|
@ -33,14 +33,14 @@ typedef K::Point_2 Point_2;
|
||||||
typedef K::Segment_2 Segment_2;
|
typedef K::Segment_2 Segment_2;
|
||||||
typedef K::Line_2 Line_2;
|
typedef K::Line_2 Line_2;
|
||||||
|
|
||||||
typedef CGAL::Polygon_2<K,std::list< Point_2 > > Polygon; // it must be a list for the partition
|
typedef CGAL::Polygon_2<K,std::list< Point_2 > > Polygon2; // it must be a list for the partition
|
||||||
typedef CGAL::Polygon_with_holes_2<K,std::list< Point_2 > > Polygon_with_holes_2;
|
typedef CGAL::Polygon_with_holes_2<K,std::list< Point_2 > > Polygon_with_holes_2;
|
||||||
|
|
||||||
typedef CGAL::Straight_skeleton_2<K> Ss ;
|
typedef CGAL::Straight_skeleton_2<K> Ss ;
|
||||||
|
|
||||||
typedef boost::shared_ptr<Ss> SsPtr ;
|
typedef boost::shared_ptr<Ss> SsPtr ;
|
||||||
|
|
||||||
typedef boost::shared_ptr<Polygon> PolygonPtr ;
|
typedef boost::shared_ptr<Polygon2> PolygonPtr ;
|
||||||
|
|
||||||
typedef std::vector<PolygonPtr> PolygonPtr_vector ;
|
typedef std::vector<PolygonPtr> PolygonPtr_vector ;
|
||||||
|
|
||||||
|
|
@ -56,23 +56,23 @@ private:
|
||||||
|
|
||||||
|
|
||||||
CGAL::Qt::Converter<K> convert;
|
CGAL::Qt::Converter<K> convert;
|
||||||
Polygon poly, kgon;
|
Polygon2 poly, kgon;
|
||||||
Polygon_with_holes_2 selfmink;
|
Polygon_with_holes_2 selfmink;
|
||||||
QGraphicsScene scene;
|
QGraphicsScene scene;
|
||||||
|
|
||||||
CGAL::Qt::PolygonGraphicsItem<Polygon> * pgi;
|
CGAL::Qt::PolygonGraphicsItem<Polygon2> * pgi;
|
||||||
|
|
||||||
CGAL::Qt::GraphicsViewPolylineInput<K> * pi;
|
CGAL::Qt::GraphicsViewPolylineInput<K> * pi;
|
||||||
|
|
||||||
CGAL::Qt::PolygonWithHolesGraphicsItem<Polygon_with_holes_2> * minkgi;
|
CGAL::Qt::PolygonWithHolesGraphicsItem<Polygon_with_holes_2> * minkgi;
|
||||||
|
|
||||||
std::list<Polygon> partitionPolygons;
|
std::list<Polygon2> partitionPolygons;
|
||||||
std::list<CGAL::Qt::PolygonGraphicsItem<Polygon>* > partitionGraphicsItems;
|
std::list<CGAL::Qt::PolygonGraphicsItem<Polygon2>* > partitionGraphicsItems;
|
||||||
std::list<QGraphicsLineItem* > skeletonGraphicsItems;
|
std::list<QGraphicsLineItem* > skeletonGraphicsItems;
|
||||||
std::list<QGraphicsLineItem* > offsetGraphicsItems;
|
std::list<QGraphicsLineItem* > offsetGraphicsItems;
|
||||||
CGAL::Qt::LineGraphicsItem<K>* lgi;
|
CGAL::Qt::LineGraphicsItem<K>* lgi;
|
||||||
|
|
||||||
CGAL::Qt::PolygonGraphicsItem<Polygon> * kgongi;
|
CGAL::Qt::PolygonGraphicsItem<Polygon2> * kgongi;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow();
|
MainWindow();
|
||||||
|
|
@ -120,8 +120,8 @@ MainWindow::MainWindow()
|
||||||
this->graphicsView->setAcceptDrops(false);
|
this->graphicsView->setAcceptDrops(false);
|
||||||
|
|
||||||
minkgi = 0;
|
minkgi = 0;
|
||||||
// Add a GraphicItem for the Polygon_2
|
// Add a GraphicItem for the Polygon2
|
||||||
pgi = new CGAL::Qt::PolygonGraphicsItem<Polygon>(&poly);
|
pgi = new CGAL::Qt::PolygonGraphicsItem<Polygon2>(&poly);
|
||||||
|
|
||||||
QObject::connect(this, SIGNAL(changed()),
|
QObject::connect(this, SIGNAL(changed()),
|
||||||
pgi, SLOT(modelChanged()));
|
pgi, SLOT(modelChanged()));
|
||||||
|
|
@ -129,7 +129,7 @@ MainWindow::MainWindow()
|
||||||
pgi->setVerticesPen(QPen(Qt::red, 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
pgi->setVerticesPen(QPen(Qt::red, 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
scene.addItem(pgi);
|
scene.addItem(pgi);
|
||||||
|
|
||||||
kgongi = new CGAL::Qt::PolygonGraphicsItem<Polygon>(&kgon);
|
kgongi = new CGAL::Qt::PolygonGraphicsItem<Polygon2>(&kgon);
|
||||||
kgongi->setEdgesPen(QPen(Qt::blue, 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
kgongi->setEdgesPen(QPen(Qt::blue, 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
kgongi->hide();
|
kgongi->hide();
|
||||||
scene.addItem(kgongi);
|
scene.addItem(kgongi);
|
||||||
|
|
@ -384,9 +384,9 @@ MainWindow::on_actionOuterOffset_triggered()
|
||||||
{
|
{
|
||||||
if ( cit != frame )
|
if ( cit != frame )
|
||||||
{
|
{
|
||||||
Polygon const& lContour = **cit ;
|
Polygon2 const& lContour = **cit ;
|
||||||
lContour.area();
|
lContour.area();
|
||||||
for ( Polygon::Edge_const_iterator eit = lContour.edges_begin(); eit != lContour.edges_end(); ++ eit )
|
for ( Polygon2::Edge_const_iterator eit = lContour.edges_begin(); eit != lContour.edges_end(); ++ eit )
|
||||||
{
|
{
|
||||||
Segment_2 s(eit->source(), eit->target());
|
Segment_2 s(eit->source(), eit->target());
|
||||||
offsetGraphicsItems.push_back(new QGraphicsLineItem(convert(s)));
|
offsetGraphicsItems.push_back(new QGraphicsLineItem(convert(s)));
|
||||||
|
|
@ -495,10 +495,10 @@ MainWindow::partition(PartitionAlgorithm pa)
|
||||||
CGAL::optimal_convex_partition_2(poly.vertices_begin(), poly.vertices_end(), std::back_inserter(partitionPolygons));
|
CGAL::optimal_convex_partition_2(poly.vertices_begin(), poly.vertices_end(), std::back_inserter(partitionPolygons));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for(std::list<Polygon>::iterator it = partitionPolygons.begin();
|
for(std::list<Polygon2>::iterator it = partitionPolygons.begin();
|
||||||
it != partitionPolygons.end();
|
it != partitionPolygons.end();
|
||||||
++it){
|
++it){
|
||||||
partitionGraphicsItems.push_back(new CGAL::Qt::PolygonGraphicsItem<Polygon>(&(*it)));
|
partitionGraphicsItems.push_back(new CGAL::Qt::PolygonGraphicsItem<Polygon2>(&(*it)));
|
||||||
scene.addItem(partitionGraphicsItems.back());
|
scene.addItem(partitionGraphicsItems.back());
|
||||||
partitionGraphicsItems.back()->setEdgesPen(QPen(Qt::blue, 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
partitionGraphicsItems.back()->setEdgesPen(QPen(Qt::blue, 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
}
|
}
|
||||||
|
|
@ -509,7 +509,7 @@ void
|
||||||
MainWindow::clearPartition()
|
MainWindow::clearPartition()
|
||||||
{
|
{
|
||||||
partitionPolygons.clear();
|
partitionPolygons.clear();
|
||||||
for(std::list<CGAL::Qt::PolygonGraphicsItem<Polygon>* >::iterator it = partitionGraphicsItems.begin();
|
for(std::list<CGAL::Qt::PolygonGraphicsItem<Polygon2>* >::iterator it = partitionGraphicsItems.begin();
|
||||||
it != partitionGraphicsItems.end();
|
it != partitionGraphicsItems.end();
|
||||||
++it){
|
++it){
|
||||||
scene.removeItem(*it);
|
scene.removeItem(*it);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue