mirror of https://github.com/CGAL/cgal
Fix the CMakeLists.txt files so that:
- nothing about Qt3 is in demo/Mesh_2/, - only Qt3 stuff is in demo/Mesh_2/Qt3/, - the demo/Mesh_2/Qt3/ sub-directory is known as a sub-directory of demo/Mesh_2/ by CMake.
This commit is contained in:
parent
e54d65ec06
commit
7b9db61455
|
|
@ -1,41 +1,26 @@
|
|||
# Created by the script cgal_create_cmake_script (and then adapted manually).
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
|
||||
project( mesh_2_demo )
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5)
|
||||
|
||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
||||
|
||||
add_subdirectory(Qt3)
|
||||
|
||||
if ( COMMAND cmake_policy )
|
||||
cmake_policy( SET CMP0003 NEW )
|
||||
endif()
|
||||
|
||||
find_package(CGAL COMPONENTS Core Qt3 )
|
||||
find_package(CGAL COMPONENTS Core )
|
||||
include( ${CGAL_USE_FILE} )
|
||||
|
||||
find_package(Qt3-patched )
|
||||
# FindQt3-patched.cmake is FindQt3.cmake patched by CGAL developers, so
|
||||
# that it can be used together with FindQt4: all its variables are prefixed
|
||||
# by "QT3_" instead of "QT_".
|
||||
include_directories(BEFORE ../../include)
|
||||
include_directories(BEFORE ../../../Triangulation_2/include)
|
||||
|
||||
if ( CGAL_FOUND AND QT3_FOUND AND CGAL_Qt3_FOUND)
|
||||
|
||||
include( Qt3Macros-patched )
|
||||
QT3_AUTOMOC( conform.cpp icons.cpp mesh.cpp mesh_2_demo.cpp Qt_widget_styled_layer.cpp Qt_widget_style_editor.cpp Show_points.cpp Show_segments_base.cpp )
|
||||
|
||||
# Make sure the compiler can find generated .moc files
|
||||
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
include_directories( ${QT3_INCLUDE_DIR} )
|
||||
|
||||
add_executable (mesh_2_demo icons.cpp mesh_2_demo.cpp Qt_widget_styled_layer.cpp Qt_widget_style_editor.cpp Show_points.cpp Show_segments_base.cpp)
|
||||
|
||||
add_to_cached_list( CGAL_EXECUTABLE_TARGETS mesh_2_demo )
|
||||
|
||||
# Link the main executable to CGAL and third-party libraries
|
||||
target_link_libraries(mesh_2_demo ${QT3_LIBRARIES} ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
|
||||
if ( CGAL_FOUND )
|
||||
|
||||
# conform target
|
||||
add_executable (conform conform.cpp)
|
||||
|
|
@ -49,6 +34,6 @@ if ( CGAL_FOUND AND QT3_FOUND AND CGAL_Qt3_FOUND)
|
|||
|
||||
else()
|
||||
|
||||
message(STATUS "NOTICE: This demo requires CGAL and Qt3, and will not be compiled.")
|
||||
message(STATUS "NOTICE: This demo requires CGAL and will not be compiled.")
|
||||
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,46 +0,0 @@
|
|||
// Copyright (c) 2005 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you may redistribute it under
|
||||
// the terms of the Q Public License version 1.0.
|
||||
// See the file LICENSE.QPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Laurent RINEAU
|
||||
|
||||
#ifndef CGAL_DEBUG_LAYER_H
|
||||
#define CGAL_DEBUG_LAYER_H
|
||||
|
||||
#include <CGAL/IO/Qt_widget_layer.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
class Debug_layer : public Qt_widget_layer
|
||||
{
|
||||
std::ostream& stream;
|
||||
|
||||
public:
|
||||
|
||||
Debug_layer(std::ostream& s = std::cerr) : stream(s)
|
||||
{
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
stream << "redraw()" << std::endl;
|
||||
}
|
||||
}; // end class Debug_layer
|
||||
|
||||
} // end namespace CGAL
|
||||
|
||||
#endif // CGAL_DEBUG_LAYER_H
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
|
||||
project( mesh_2_demo )
|
||||
project( mesh_2_qt3_demo )
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5)
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ find_package(Qt3-patched )
|
|||
if ( CGAL_FOUND AND QT3_FOUND AND CGAL_Qt3_FOUND)
|
||||
|
||||
include( Qt3Macros-patched )
|
||||
QT3_AUTOMOC( conform.cpp icons.cpp mesh.cpp mesh_2_demo.cpp Qt_widget_styled_layer.cpp Qt_widget_style_editor.cpp Show_points.cpp Show_segments_base.cpp )
|
||||
QT3_AUTOMOC( icons.cpp mesh_2_demo.cpp Qt_widget_styled_layer.cpp Qt_widget_style_editor.cpp Show_points.cpp Show_segments_base.cpp )
|
||||
|
||||
# Make sure the compiler can find generated .moc files
|
||||
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
|
|
|||
|
|
@ -1,159 +0,0 @@
|
|||
// Copyright (c) 2003-2004 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Laurent Rineau
|
||||
|
||||
#ifndef CGAL_QT_LAYER_SHOW_CIRCLES_H
|
||||
#define CGAL_QT_LAYER_SHOW_CIRCLES_H
|
||||
|
||||
#include <CGAL/Circle_2.h>
|
||||
#include <CGAL/IO/Qt_widget_layer.h>
|
||||
#include <CGAL/Triangulation_2.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <qobject.h>
|
||||
#include <qcolor.h>
|
||||
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
// T::Geom_traits has to be a CGAL kernel!
|
||||
template <class T>
|
||||
class Qt_layer_show_circles : public Qt_widget_layer {
|
||||
public:
|
||||
typedef typename T::Point Point;
|
||||
typedef typename T::Segment Segment;
|
||||
typedef typename T::Finite_faces_iterator Finite_faces_iterator;
|
||||
typedef typename T::Locate_type Locate_type;
|
||||
typedef typename T::Face_handle Face_handle;
|
||||
typedef typename T::Geom_traits GT;
|
||||
typedef typename GT::Circle_2 Circle;
|
||||
typedef typename GT::FT FT;
|
||||
|
||||
Qt_layer_show_circles(T* t,
|
||||
CGAL::Color c = CGAL::GRAY,
|
||||
int linewidth = 1,
|
||||
CGAL::Color fill_color = CGAL::WHITE,
|
||||
bool filled = false,
|
||||
QObject* parent = 0, const char* name = 0) :
|
||||
Qt_widget_layer(parent, name),
|
||||
tr(t), do_erase(false), color(c), width(linewidth),
|
||||
fillcolor(fill_color), fill(filled) {};
|
||||
|
||||
void draw()
|
||||
{
|
||||
Qt_widget_layer::draw();
|
||||
do_erase = false;
|
||||
};
|
||||
|
||||
void mousePressEvent(QMouseEvent* e)
|
||||
{
|
||||
if (tr->dimension()<1) return;
|
||||
FT
|
||||
x=static_cast<FT>(widget->x_real(e->x())),
|
||||
y=static_cast<FT>(widget->y_real(e->y()));
|
||||
|
||||
Point p(x,y);
|
||||
|
||||
int li;
|
||||
Locate_type lt;
|
||||
Face_handle fh = tr->locate(p,lt,li);
|
||||
if(lt == T::FACE)
|
||||
draw_circle(fh);
|
||||
};
|
||||
|
||||
void mouseMoveEvent(QMouseEvent *e)
|
||||
{
|
||||
if (tr->dimension()<1) return;
|
||||
FT
|
||||
x=static_cast<FT>(widget->x_real(e->x())),
|
||||
y=static_cast<FT>(widget->y_real(e->y()));
|
||||
|
||||
Point p(x,y);
|
||||
|
||||
int li;
|
||||
Locate_type lt;
|
||||
Face_handle fh = tr->locate(p,lt,li);
|
||||
if(lt == T::FACE)
|
||||
{
|
||||
if(fh!=old_face)
|
||||
{
|
||||
widget->lock();
|
||||
|
||||
if(do_erase) draw_circle(old_face);
|
||||
draw_circle(fh);
|
||||
old_face=fh;
|
||||
|
||||
widget->unlock();
|
||||
do_erase=true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(do_erase)
|
||||
draw_circle(old_face);
|
||||
do_erase=false;
|
||||
}
|
||||
};
|
||||
|
||||
void leaveEvent(QEvent* e)
|
||||
{
|
||||
Qt_widget_layer::leaveEvent(e);
|
||||
if (tr->dimension()<1) return;
|
||||
if(do_erase)
|
||||
draw_circle(old_face);
|
||||
};
|
||||
|
||||
private:
|
||||
void draw_circle(const Face_handle& fh) const
|
||||
{
|
||||
RasterOp oldRaster = widget->rasterOp();
|
||||
QColor oldcolor = widget->color();
|
||||
QColor oldFillColor = widget->fillColor();
|
||||
int oldwidth = widget->lineWidth();
|
||||
bool oldFilled = widget->isFilled();
|
||||
|
||||
*widget << color;
|
||||
*widget << LineWidth(width) << FillColor(fillcolor);
|
||||
widget->setFilled(fill);
|
||||
widget->get_painter().setRasterOp(NotROP);
|
||||
|
||||
Point v=((*fh).vertex(0))->point();
|
||||
Point c=tr->circumcenter(fh);
|
||||
|
||||
*widget << Circle(c,squared_distance(v,c));
|
||||
widget->setColor(oldcolor);
|
||||
widget->setLineWidth(oldwidth);
|
||||
widget->setFillColor(oldFillColor);
|
||||
widget->setFilled(oldFilled);
|
||||
widget->setRasterOp(oldRaster);
|
||||
widget->do_paint();
|
||||
}
|
||||
|
||||
T* tr;
|
||||
Face_handle old_face;
|
||||
bool do_erase;
|
||||
|
||||
CGAL::Color color;
|
||||
int width;
|
||||
CGAL::Color fillcolor;
|
||||
bool fill;
|
||||
};//end class
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_QT_LAYER_SHOW_CIRCLES_H
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
// Copyright (c) 2003-2004 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Laurent Rineau
|
||||
|
||||
#ifndef CGAL_QT_LAYER_SHOW_TRIANGULATION_H
|
||||
#define CGAL_QT_LAYER_SHOW_TRIANGULATION_H
|
||||
|
||||
#include "Qt_widget_styled_layer.h"
|
||||
#include <CGAL/IO/Qt_widget_Triangulation_2.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class T>
|
||||
class Qt_layer_show_triangulation : public Qt_widget_styled_layer
|
||||
{
|
||||
public:
|
||||
|
||||
Qt_layer_show_triangulation(T *t,
|
||||
CGAL::Color lc = CGAL::BLUE,
|
||||
int linewidth = 1,
|
||||
QObject* parent = 0, const char* name = 0)
|
||||
: Qt_widget_styled_layer(0, parent, name),
|
||||
tr(t)
|
||||
{
|
||||
color="Color";
|
||||
width="Line width";
|
||||
|
||||
setColor(QColor(lc.red(), lc.green(), lc.blue()));
|
||||
setLineWidth(linewidth);
|
||||
};
|
||||
|
||||
void setColor(QColor c)
|
||||
{ style()->setColor(color, c); }
|
||||
|
||||
void setLineWidth(int line_width)
|
||||
{ style()->setInt(width, line_width); }
|
||||
|
||||
void draw()
|
||||
{
|
||||
QColor old_color = widget->color();
|
||||
int old_width = widget->lineWidth();
|
||||
|
||||
widget->setColor(style()->getColor(color));
|
||||
widget->setLineWidth(style()->getInt(width));
|
||||
|
||||
*widget << *tr;
|
||||
|
||||
widget->setLineWidth(old_width);
|
||||
widget->setColor(old_color);
|
||||
};
|
||||
|
||||
private:
|
||||
T *tr;
|
||||
QString color;
|
||||
QString width;
|
||||
};//end class
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_QT_LAYER_SHOW_TRIANGULATION_H
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
// Copyright (c) 2003-2004 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Laurent Rineau
|
||||
|
||||
#ifndef CGAL_QT_LAYER_SHOW_TRIANGULATION_CONSTRAINTS_H
|
||||
#define CGAL_QT_LAYER_SHOW_TRIANGULATION_CONSTRAINTS_H
|
||||
|
||||
#include "Qt_widget_styled_layer.h"
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class T>
|
||||
class Qt_layer_show_triangulation_constraints
|
||||
: public Qt_widget_styled_layer
|
||||
{
|
||||
public:
|
||||
|
||||
Qt_layer_show_triangulation_constraints(T *t,
|
||||
CGAL::Color lc = CGAL::RED,
|
||||
int linewidth = 1,
|
||||
QObject* parent = 0,
|
||||
const char* name = 0)
|
||||
: Qt_widget_styled_layer(0, parent, name), tr(t)
|
||||
{
|
||||
color="Color";
|
||||
width="Line width";
|
||||
|
||||
setColor(QColor(lc.red(), lc.green(), lc.blue()));
|
||||
setLineWidth(linewidth);
|
||||
};
|
||||
|
||||
void setColor(QColor c)
|
||||
{ style()->setColor(color, c); }
|
||||
|
||||
void setLineWidth(int line_width)
|
||||
{ style()->setInt(width, line_width); }
|
||||
|
||||
void draw()
|
||||
{
|
||||
widget->lock();
|
||||
|
||||
QColor old_color = widget->color();
|
||||
int old_width = widget->lineWidth();
|
||||
|
||||
widget->setColor(style()->getColor(color));
|
||||
widget->setLineWidth(style()->getInt(width));
|
||||
|
||||
for(typename T::Edge_iterator it=tr->edges_begin();
|
||||
it!=tr->edges_end();
|
||||
it++)
|
||||
if(tr->is_constrained(*it))
|
||||
*widget << tr->segment(*it);
|
||||
|
||||
widget->setLineWidth(old_width);
|
||||
widget->setColor(old_color);
|
||||
widget->unlock();
|
||||
};
|
||||
|
||||
private:
|
||||
T *tr;
|
||||
QString color;
|
||||
QString width;
|
||||
};//end class
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_QT_LAYER_SHOW_TRIANGULATION_CONSTRAINTS_H
|
||||
|
|
@ -1,144 +0,0 @@
|
|||
// Copyright (c) 2003-2004 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Laurent Rineau
|
||||
|
||||
#ifndef CGAL_QT_WIDGET_STYLE_EDITOR_AUX_H
|
||||
#define CGAL_QT_WIDGET_STYLE_EDITOR_AUX_H
|
||||
|
||||
#include <qcolor.h>
|
||||
#include <qcolordialog.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qspinbox.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qscrollview.h>
|
||||
#include <qpixmap.h>
|
||||
|
||||
class Color_selector : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Color_selector(QColor c = Qt::black,
|
||||
QWidget* parent = 0, const char* name = 0)
|
||||
: QPushButton(parent, name)
|
||||
{
|
||||
setColor(c);
|
||||
connect(this, SIGNAL(clicked()),
|
||||
this, SLOT(color_dialog()) );
|
||||
}
|
||||
|
||||
virtual ~Color_selector() {};
|
||||
|
||||
QColor value() const
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
public slots:
|
||||
void setColor(QColor c)
|
||||
{
|
||||
color = c;
|
||||
|
||||
QPixmap pix(24,20);
|
||||
pix.fill(c);
|
||||
setPixmap(pix);
|
||||
|
||||
emit newColor(c);
|
||||
}
|
||||
|
||||
signals:
|
||||
void newColor(QColor);
|
||||
|
||||
private slots:
|
||||
void color_dialog()
|
||||
{
|
||||
QColor c = QColorDialog::getColor(value());
|
||||
if( c.isValid() )
|
||||
setColor(c);
|
||||
}
|
||||
|
||||
private:
|
||||
QColor color;
|
||||
};
|
||||
|
||||
class Int_selector : public QSpinBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Int_selector(int i, QWidget *parent = 0, const char *name = 0)
|
||||
: QSpinBox(-INT_MAX, INT_MAX, 1, parent, name)
|
||||
{
|
||||
setValue(i);
|
||||
}
|
||||
|
||||
virtual ~Int_selector() {};
|
||||
};
|
||||
|
||||
class Bool_selector : public QComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Bool_selector(bool b_, QWidget *parent = 0, const char *name = 0)
|
||||
: QComboBox(false, parent, name)
|
||||
{
|
||||
insertItem("False");
|
||||
insertItem("True");
|
||||
|
||||
if(b_)
|
||||
setCurrentItem(1);
|
||||
else
|
||||
setCurrentItem(0);
|
||||
}
|
||||
|
||||
virtual ~Bool_selector() {};
|
||||
|
||||
bool value() const
|
||||
{
|
||||
return currentItem() == 1;
|
||||
}
|
||||
};
|
||||
|
||||
class Point_style_selector : public QComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef ::CGAL::PointStyle PointStyle;
|
||||
Point_style_selector(PointStyle s,
|
||||
QWidget *parent = 0, const char *name = 0)
|
||||
: QComboBox(false, parent, name)
|
||||
{
|
||||
insertItem("Pixel");
|
||||
insertItem("Cross");
|
||||
insertItem("Plus");
|
||||
insertItem("Circle");
|
||||
insertItem("Disc");
|
||||
insertItem("Rect");
|
||||
insertItem("Box");
|
||||
|
||||
setCurrentItem(static_cast<int>(s));
|
||||
}
|
||||
|
||||
virtual ~Point_style_selector() {};
|
||||
|
||||
PointStyle value() const
|
||||
{
|
||||
return PointStyle(currentItem());
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CGAL_QT_WIDGET_STYLE_EDITOR_AUX_H
|
||||
|
|
@ -1,127 +0,0 @@
|
|||
// Copyright (c) 2003-2004 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Laurent Rineau
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
|
||||
|
||||
#include "Qt_widget_style_editor.h"
|
||||
#include "Qt_widget_style_editor-aux.h"
|
||||
|
||||
#include <qcolor.h>
|
||||
#include <qlabel.h>
|
||||
#include <qvbox.h>
|
||||
#include <qhbox.h>
|
||||
#include <qlayout.h>
|
||||
#include <qgrid.h>
|
||||
#include <qvariant.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
Qt_widget_style_editor::Qt_widget_style_editor(Style* style,
|
||||
QWidget *parent,
|
||||
const char *name)
|
||||
: QFrame(parent, name), style(style)
|
||||
{
|
||||
typedef Style::const_iterator iterator;
|
||||
|
||||
QGridLayout* layout = new QGridLayout(this);
|
||||
layout->addColSpacing(1,5);
|
||||
|
||||
const int labels_col = 0; // column number of labels
|
||||
const int selectors_col = 2; // column number of selectors
|
||||
|
||||
int row = 0;
|
||||
for(iterator it=style->begin();
|
||||
it != style->end();
|
||||
++it)
|
||||
{
|
||||
QLabel* label = new QLabel( it.key(), this);
|
||||
layout->addWidget(label, row, labels_col);
|
||||
|
||||
QWidget* selector = 0;
|
||||
switch( it.data().type() ) {
|
||||
case QVariant::Color:
|
||||
selector = new Color_selector(it.data().toColor(), this);
|
||||
connect(selector, SIGNAL(newColor(QColor)),
|
||||
this, SLOT(map(QColor)));
|
||||
break;
|
||||
case QVariant::Int:
|
||||
selector = new Int_selector(it.data().toInt(), this);
|
||||
connect(selector, SIGNAL(valueChanged(int)),
|
||||
this, SLOT(map(int)));
|
||||
break;
|
||||
case QVariant::Bool:
|
||||
selector = new Bool_selector(it.data().toBool(),
|
||||
this);
|
||||
connect(selector, SIGNAL(toggled(bool)),
|
||||
this, SLOT(map(bool)));
|
||||
break;
|
||||
case QVariant::UInt:
|
||||
selector =
|
||||
new Point_style_selector(PointStyle(it.data().toUInt()),
|
||||
this);
|
||||
connect(selector, SIGNAL(activated(int)),
|
||||
this, SLOT(pointstyle(int)));
|
||||
break;
|
||||
default:
|
||||
CGAL_error();
|
||||
break;
|
||||
}
|
||||
|
||||
mapper[selector]=it.key();
|
||||
|
||||
layout->addWidget(selector, row, selectors_col);
|
||||
|
||||
++row;
|
||||
}
|
||||
}
|
||||
|
||||
void Qt_widget_style_editor::map(QColor c)
|
||||
{
|
||||
const QObject* s = sender();
|
||||
if( mapper.contains(s) )
|
||||
style->setColor(mapper[s], c);
|
||||
emit styleChanged();
|
||||
}
|
||||
|
||||
void Qt_widget_style_editor::map(int i)
|
||||
{
|
||||
const QObject* s = sender();
|
||||
if( mapper.contains(s) )
|
||||
style->setInt(mapper[s], i);
|
||||
emit styleChanged();
|
||||
}
|
||||
|
||||
void Qt_widget_style_editor::map(bool b)
|
||||
{
|
||||
const QObject* s = sender();
|
||||
if( mapper.contains(s) )
|
||||
style->setBool(mapper[s], b);
|
||||
emit styleChanged();
|
||||
}
|
||||
|
||||
} // end namespace CGAL
|
||||
|
||||
// moc_source_file: Qt_widget_style_editor.h
|
||||
#include "Qt_widget_style_editor.moc"
|
||||
|
||||
// moc_source_file: Qt_widget_style_editor-aux.h
|
||||
#include "Qt_widget_style_editor-aux.moc"
|
||||
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
// Copyright (c) 2003-2004 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Laurent Rineau
|
||||
|
||||
#ifndef QT_WIDGET_STYLE_EDITOR_H
|
||||
#define QT_WIDGET_STYLE_EDITOR_H
|
||||
|
||||
#include <qframe.h>
|
||||
#include "Qt_widget_styled_layer.h"
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
class Qt_widget_style_editor : public QFrame {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
typedef Qt_widget_styled_layer::Style Style;
|
||||
|
||||
Qt_widget_style_editor(Style* style,
|
||||
QWidget *parent = 0 , const char *name = 0);
|
||||
|
||||
virtual ~Qt_widget_style_editor() {}
|
||||
|
||||
signals:
|
||||
void styleChanged();
|
||||
|
||||
private slots:
|
||||
void map(QColor);
|
||||
void map(int);
|
||||
void map(bool);
|
||||
|
||||
private:
|
||||
Style* style;
|
||||
QMap<const QObject*, QString> mapper;
|
||||
}; // end of class Qt_widget_style_editor
|
||||
|
||||
} // end namespace CGAL
|
||||
|
||||
#endif // QT_WIDGET_STYLE_EDITOR_H
|
||||
|
|
@ -1,125 +0,0 @@
|
|||
// Copyright (c) 2003-2004 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Laurent Rineau
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
|
||||
|
||||
#include "Qt_widget_styled_layer.h"
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
Qt_widget_styled_layer::Qt_widget_styled_layer(
|
||||
Qt_widget_styled_layer::Style* style,
|
||||
QObject * parent,
|
||||
const char * name)
|
||||
: Qt_widget_layer(parent, name),
|
||||
style_(style), private_style(false)
|
||||
{
|
||||
if( style == 0 )
|
||||
{
|
||||
this->style_ = new Style();
|
||||
private_style = true;
|
||||
}
|
||||
}
|
||||
|
||||
Qt_widget_styled_layer::~Qt_widget_styled_layer()
|
||||
{
|
||||
if( private_style )
|
||||
delete style_;
|
||||
}
|
||||
|
||||
void Qt_widget_styled_layer::setStyle(Qt_widget_styled_layer::Style* s)
|
||||
{
|
||||
if( private_style )
|
||||
delete style_;
|
||||
private_style = false;
|
||||
style_ = s;
|
||||
}
|
||||
|
||||
void Qt_widget_style::setBool(QString name, bool b)
|
||||
{
|
||||
map[name] = b;
|
||||
}
|
||||
|
||||
void Qt_widget_style::setInt(QString name, int i)
|
||||
{
|
||||
map[name] = i;
|
||||
}
|
||||
|
||||
void Qt_widget_style::setColor(QString name, QColor c)
|
||||
{
|
||||
map[name] = c;
|
||||
}
|
||||
|
||||
void Qt_widget_style::setPointStyle(QString name, PointStyle s)
|
||||
{
|
||||
map[name] = static_cast<uint>(s);
|
||||
map[name].cast(QVariant::UInt);
|
||||
}
|
||||
|
||||
bool Qt_widget_style::getBool(QString name)
|
||||
{
|
||||
if( ! map.contains(name) )
|
||||
return false;
|
||||
else
|
||||
{
|
||||
CGAL_assertion( map[name].type() == QVariant::Bool );
|
||||
return map[name].asBool();
|
||||
}
|
||||
}
|
||||
|
||||
int Qt_widget_style::getInt(QString name)
|
||||
{
|
||||
if( ! map.contains(name) )
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
CGAL_assertion( map[name].type() == QVariant::Int );
|
||||
return map[name].asInt();
|
||||
}
|
||||
}
|
||||
|
||||
QColor Qt_widget_style::getColor(QString name)
|
||||
{
|
||||
if( ! map.contains(name) )
|
||||
return QColor();
|
||||
else
|
||||
{
|
||||
CGAL_assertion( map[name].type() == QVariant::Color );
|
||||
return map[name].asColor();
|
||||
}
|
||||
}
|
||||
|
||||
::CGAL::PointStyle Qt_widget_style::getPointStyle(QString name)
|
||||
{
|
||||
if( ! map.contains(name) )
|
||||
return PointStyle();
|
||||
else
|
||||
{
|
||||
CGAL_assertion( map[name].type() == QVariant::UInt );
|
||||
return PointStyle(map[name].asUInt());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
// moc_source_file: Qt_widget_styled_layer.h
|
||||
#include "Qt_widget_styled_layer.moc"
|
||||
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
// Copyright (c) 2003-2004 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Laurent Rineau
|
||||
|
||||
#ifndef QT_WIDGET_STYLED_LAYER_H
|
||||
#define QT_WIDGET_STYLED_LAYER_H
|
||||
|
||||
#include <qvariant.h>
|
||||
#include <qstring.h>
|
||||
#include <qmap.h>
|
||||
|
||||
#include <CGAL/IO/Qt_widget_layer.h>
|
||||
#include <CGAL/function_objects.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
class Qt_widget_style : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
typedef QMap<QString,QVariant> Map;
|
||||
public:
|
||||
|
||||
typedef Map::const_iterator const_iterator;
|
||||
typedef Map::size_type size_type;
|
||||
|
||||
Qt_widget_style()
|
||||
: map() {};
|
||||
|
||||
public slots:
|
||||
void setBool(QString name, bool b);
|
||||
void setInt(QString name, int i);
|
||||
void setColor(QString name, QColor c);
|
||||
void setPointStyle(QString name, PointStyle s);
|
||||
|
||||
public:
|
||||
bool getBool(QString name);
|
||||
int getInt(QString name);
|
||||
QColor getColor(QString name);
|
||||
PointStyle getPointStyle(QString name);
|
||||
|
||||
const_iterator begin() const
|
||||
{
|
||||
return map.begin();
|
||||
}
|
||||
|
||||
const_iterator end() const
|
||||
{
|
||||
return map.end();
|
||||
}
|
||||
|
||||
size_type size() const
|
||||
{
|
||||
return map.size();
|
||||
}
|
||||
|
||||
private:
|
||||
Map map;
|
||||
};
|
||||
|
||||
class Qt_widget_styled_layer : public Qt_widget_layer {
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef Qt_widget_style Style;
|
||||
|
||||
Qt_widget_styled_layer(Style* style = 0,
|
||||
QObject * parent=0, const char * name=0);
|
||||
|
||||
~Qt_widget_styled_layer();
|
||||
|
||||
void setStyle(Style* style);
|
||||
Style * style() { return style_; }
|
||||
private:
|
||||
Style* style_;
|
||||
bool private_style;
|
||||
};
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // QT_WIDGET_STYLED_LAYER_H
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
This directory contains non-graphical demos of the 2D Mesh Generator
|
||||
package. An old Qt3-based demos lies in the qt3/ sub-directory. The
|
||||
Constrained Delaunay triangulation Qt4 demos has a 2D meshing feature that
|
||||
demonstrates the 2D Mesh Generator package. See in the directory
|
||||
demo/Triangulation_2/ of the CGAL tarball.
|
||||
|
|
@ -1,213 +0,0 @@
|
|||
// Copyright (c) 2003-2004 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Laurent Rineau
|
||||
|
||||
#ifndef MESH_2_SHOW_CLUSTERS_H
|
||||
#define MESH_2_SHOW_CLUSTERS_H
|
||||
|
||||
#include <CGAL/IO/Qt_widget.h>
|
||||
#include <CGAL/IO/Qt_widget_layer.h>
|
||||
|
||||
#include <CGAL/Delaunay_triangulation_2.h>
|
||||
|
||||
#include <qpixmap.h>
|
||||
|
||||
class Show_clusters_aux : public CGAL::Qt_widget_layer
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
virtual void reinit_clusters() {}
|
||||
|
||||
public slots:
|
||||
void reinitClusters()
|
||||
{
|
||||
reinit_clusters();
|
||||
}
|
||||
public:
|
||||
Show_clusters_aux(QObject* parent, const char* name)
|
||||
: Qt_widget_layer(parent, name)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template <class Mesher>
|
||||
class Show_clusters : public Show_clusters_aux
|
||||
{
|
||||
public:
|
||||
typedef typename Mesher::Triangulation Tr;
|
||||
typedef typename Tr::Point Point;
|
||||
typedef typename Tr::Geom_traits Geom_traits;
|
||||
typedef CGAL::Delaunay_triangulation_2<Geom_traits> DT;
|
||||
typedef typename DT::Finite_vertices_iterator Vertices_iterator;
|
||||
typedef typename DT::Vertex_handle DT_vertex_handle;
|
||||
typedef typename Tr::Segment Segment;
|
||||
typedef typename Tr::Face_handle Face_handle;
|
||||
typedef typename Tr::Vertex_handle Vertex_handle;
|
||||
typedef typename Tr::Geom_traits::FT FT;
|
||||
typedef typename Mesher::Clusters Clusters;
|
||||
typedef typename Clusters::Cluster Cluster;
|
||||
typedef typename Clusters::Cluster_vertices_iterator CVIt;
|
||||
typedef typename Clusters::Vertices_in_cluster_iterator ViCIt;
|
||||
typedef typename Clusters::const_iterator Clusters_const_iterator;
|
||||
typedef std::list<Point> List_of_points;
|
||||
typedef typename List_of_points::const_iterator Point_iterator;
|
||||
|
||||
Show_clusters(Mesher* m,
|
||||
CGAL::Color color_ = CGAL::GREEN,
|
||||
int pointsize = 3,
|
||||
CGAL::PointStyle pointstyle = CGAL::DISC,
|
||||
CGAL::Color lc = CGAL::RED,
|
||||
CGAL::Color reduced_line_color_ = CGAL::BLUE,
|
||||
int linewidth = 2,
|
||||
QObject* parent = 0, const char* name = 0)
|
||||
: Show_clusters_aux(parent, name),
|
||||
mesher(m), dt(), color(color_),
|
||||
size(pointsize), style(pointstyle), line_color(lc),
|
||||
reduced_line_color(reduced_line_color_),
|
||||
width(linewidth)
|
||||
{
|
||||
reinit_clusters();
|
||||
}
|
||||
|
||||
void activating()
|
||||
{
|
||||
reinit_clusters();
|
||||
}
|
||||
|
||||
void change_mesher(Mesher* m)
|
||||
{
|
||||
mesher = m;
|
||||
reinit_clusters();
|
||||
}
|
||||
|
||||
void reinit_clusters()
|
||||
{
|
||||
if(!is_active()) return;
|
||||
|
||||
dt.clear();
|
||||
|
||||
if( mesher != 0 )
|
||||
for(CVIt it = mesher->clusters().clusters_vertices_begin();
|
||||
it != mesher->clusters().clusters_vertices_end();
|
||||
++it)
|
||||
dt.push_back( (*it)->point() );
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
widget->lock();
|
||||
|
||||
QColor oldColor = widget->color();
|
||||
int oldPointSize = widget->pointSize();
|
||||
CGAL::PointStyle oldStyle = widget->pointStyle();
|
||||
|
||||
*widget << color << CGAL::PointStyle(style)
|
||||
<< CGAL::PointSize(size);
|
||||
|
||||
for(Vertices_iterator it = dt.finite_vertices_begin();
|
||||
it != dt.finite_vertices_end();
|
||||
++it)
|
||||
*widget << it->point();
|
||||
|
||||
widget->setPointStyle(oldStyle);
|
||||
widget->setPointSize(oldPointSize);
|
||||
widget->setColor(oldColor);
|
||||
|
||||
widget->unlock();
|
||||
oldPixmap = widget->get_pixmap();
|
||||
}
|
||||
|
||||
void mouseMoveEvent(QMouseEvent *e)
|
||||
{
|
||||
if( mesher == 0 ) return;
|
||||
|
||||
FT x, y;
|
||||
widget->x_real(e->x(), x);
|
||||
widget->y_real(e->y(), y);
|
||||
Point p(x, y);
|
||||
|
||||
DT_vertex_handle v = dt.nearest_vertex(p);
|
||||
|
||||
if(v == NULL) return;
|
||||
if(v == oldVertex) return;
|
||||
|
||||
oldVertex = v;
|
||||
|
||||
QColor oldColor = widget->color();
|
||||
int oldWidth = widget->lineWidth();
|
||||
|
||||
widget->lock();
|
||||
|
||||
widget->get_painter().drawPixmap(0, 0, oldPixmap);
|
||||
|
||||
*widget << CGAL::LineWidth(width);
|
||||
|
||||
typename Tr::Locate_type lt;
|
||||
int i;
|
||||
Face_handle fh = mesher->triangulation().locate(v->point(), lt, i);
|
||||
CGAL_assertion( lt == Tr::VERTEX );
|
||||
|
||||
Vertex_handle v2 = fh->vertex(i);
|
||||
|
||||
int n = mesher->clusters().number_of_clusters_at_vertex(v2);
|
||||
|
||||
for(int j = 0; j < n; ++j)
|
||||
{
|
||||
std::pair<ViCIt,ViCIt> seq =
|
||||
mesher->clusters().vertices_in_cluster_sequence(v2, j);
|
||||
Cluster c;
|
||||
Clusters_const_iterator dummy_c_it;
|
||||
mesher->clusters().get_cluster(v2, *(seq.first), c, dummy_c_it);
|
||||
if( c.is_reduced() )
|
||||
*widget << reduced_line_color;
|
||||
else
|
||||
*widget << line_color;
|
||||
for(ViCIt it = seq.first;
|
||||
it != seq.second;
|
||||
++it)
|
||||
*widget << Segment(v2->point(), (*it)->point());
|
||||
}
|
||||
|
||||
widget->setLineWidth(oldWidth);
|
||||
widget->setColor(oldColor);
|
||||
|
||||
widget->unlock();
|
||||
}
|
||||
|
||||
void leaveEvent(QEvent *)
|
||||
{
|
||||
widget->get_painter().drawPixmap(0, 0, oldPixmap);
|
||||
widget->update();
|
||||
}
|
||||
|
||||
private:
|
||||
Mesher* mesher;
|
||||
DT dt;
|
||||
DT_vertex_handle oldVertex;
|
||||
QPixmap oldPixmap;
|
||||
bool should_restore_pixmap;
|
||||
CGAL::Color color;
|
||||
int size;
|
||||
CGAL::PointStyle style;
|
||||
CGAL::Color line_color;
|
||||
CGAL::Color reduced_line_color;
|
||||
int width;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
// Copyright (c) 2003-2004 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Laurent Rineau
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
|
||||
|
||||
#include "Show_points.h"
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
Show_points_base::Show_points_base(Color c,
|
||||
int pointsize,
|
||||
PointStyle pointstyle,
|
||||
QObject * parent,
|
||||
const char * name)
|
||||
: Qt_widget_styled_layer(0, parent, name)
|
||||
{
|
||||
color=tr("Color");
|
||||
size=tr("Point size");
|
||||
style_name=tr("Point style");
|
||||
|
||||
setColor(QColor(c.red(), c.green(), c.blue()));
|
||||
setPointSize(pointsize);
|
||||
setPointStyle(pointstyle);
|
||||
}
|
||||
|
||||
Show_points_base::Show_points_base(Style* style,
|
||||
QString points_color_name,
|
||||
QString points_size_name,
|
||||
QString points_style_name,
|
||||
QObject * parent,
|
||||
const char * name)
|
||||
: Qt_widget_styled_layer(style, parent, name),
|
||||
color(points_color_name),
|
||||
size(points_size_name),
|
||||
style_name(points_style_name)
|
||||
{}
|
||||
|
||||
void Show_points_base::setColor(QColor c)
|
||||
{ style()->setColor(color, c); }
|
||||
|
||||
void Show_points_base::setPointSize(int pointsize)
|
||||
{ style()->setInt(size, pointsize); }
|
||||
|
||||
void Show_points_base::setPointStyle(PointStyle pointstyle)
|
||||
{ style()->setInt(style_name, static_cast<int>(pointstyle)); }
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
// moc_source_file: Show_points.h
|
||||
#include "Show_points.moc"
|
||||
|
||||
|
|
@ -1,129 +0,0 @@
|
|||
// Copyright (c) 2003-2004 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Laurent Rineau
|
||||
|
||||
#ifndef SHOW_POINTS_H
|
||||
#define SHOW_POINTS_H
|
||||
|
||||
#include <qmap.h>
|
||||
#include <qstring.h>
|
||||
#include <qvariant.h>
|
||||
#include <qcolor.h>
|
||||
|
||||
#include "Qt_widget_styled_layer.h"
|
||||
#include <CGAL/function_objects.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
class Show_points_base: public Qt_widget_styled_layer {
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef Qt_widget_styled_layer::Style Style;
|
||||
|
||||
Show_points_base(Color c,
|
||||
int pointsize,
|
||||
PointStyle pointstyle,
|
||||
QObject * parent=0, const char * name=0);
|
||||
|
||||
Show_points_base(Style* style,
|
||||
QString points_color_name,
|
||||
QString points_size_name,
|
||||
QString points_style_name,
|
||||
QObject * parent=0, const char * name=0);
|
||||
|
||||
public slots:
|
||||
void setColor(QColor);
|
||||
void setPointSize(int);
|
||||
void setPointStyle(PointStyle);
|
||||
|
||||
protected:
|
||||
QString color;
|
||||
QString size;
|
||||
QString style_name;
|
||||
}; // end Show_points_base
|
||||
|
||||
template <class C, class It,
|
||||
class Transform = Identity<typename It::value_type> >
|
||||
class Show_points : public Show_points_base {
|
||||
public:
|
||||
typedef Qt_widget_styled_layer::Style Style;
|
||||
|
||||
typedef It iterator;
|
||||
typedef iterator (C::* iterator_function)() const;
|
||||
|
||||
Show_points(C *container,
|
||||
iterator_function begin,
|
||||
iterator_function end,
|
||||
Color c = CGAL::GREEN,
|
||||
int pointsize = 3,
|
||||
PointStyle pointstyle = CGAL::DISC,
|
||||
QObject * parent=0, const char * name=0)
|
||||
: Show_points_base(c, pointsize, pointstyle,
|
||||
parent, name),
|
||||
cont(container), _begin(begin), _end(end) {};
|
||||
|
||||
Show_points(C *container,
|
||||
iterator_function begin,
|
||||
iterator_function end,
|
||||
Style* style,
|
||||
QString points_color_name,
|
||||
QString points_size_name,
|
||||
QString points_style_name,
|
||||
QObject * parent=0, const char * name=0)
|
||||
: Show_points_base(style,
|
||||
points_color_name,
|
||||
points_size_name,
|
||||
points_style_name,
|
||||
parent, name),
|
||||
cont(container), _begin(begin), _end(end) {};
|
||||
|
||||
void draw()
|
||||
{
|
||||
widget->lock();
|
||||
{
|
||||
QColor old_color = widget->color();
|
||||
int old_size = widget->pointSize();
|
||||
PointStyle old_point_style = widget->pointStyle();
|
||||
|
||||
widget->setColor(style()->getColor(color));
|
||||
widget->setPointSize(style()->getInt(size));
|
||||
widget->setPointStyle(static_cast<CGAL::PointStyle>(style()->
|
||||
getInt(style_name)));
|
||||
|
||||
for(iterator it = (cont->*_begin)();
|
||||
it!=(cont->*_end)();
|
||||
++it)
|
||||
*widget << Transform()(*it);
|
||||
|
||||
widget->setColor(old_color);
|
||||
widget->setPointSize(old_size);
|
||||
widget->setPointStyle(old_point_style);
|
||||
}
|
||||
widget->unlock();
|
||||
};
|
||||
|
||||
private:
|
||||
C *cont;
|
||||
iterator_function _begin;
|
||||
iterator_function _end;
|
||||
};//end class
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // SHOW_POINTS_H
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
// Copyright (c) 2003-2004 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Laurent Rineau
|
||||
|
||||
#ifndef SHOW_SEGMENTS_H
|
||||
#define SHOW_SEGMENTS_H
|
||||
|
||||
#include "Show_segments_base.h"
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class C, class It,
|
||||
class Transform = Identity<typename It::value_type> >
|
||||
class Show_segments : public Show_segments_base {
|
||||
public:
|
||||
typedef Qt_widget_styled_layer::Style Style;
|
||||
|
||||
typedef It iterator;
|
||||
typedef iterator (C::* iterator_function)() const;
|
||||
|
||||
Show_segments(C *container,
|
||||
iterator_function begin,
|
||||
iterator_function end,
|
||||
Color c=CGAL::GREEN,
|
||||
int linewidth=3,
|
||||
QObject* parent = 0, const char* name = 0)
|
||||
: Show_segments_base(c, linewidth,
|
||||
parent, name),
|
||||
cont(container), _begin(begin), _end(end) {};
|
||||
|
||||
Show_segments(C *container,
|
||||
iterator_function begin,
|
||||
iterator_function end,
|
||||
Style* style,
|
||||
QString line_color_name,
|
||||
QString line_width_name,
|
||||
QObject* parent = 0, const char* name = 0)
|
||||
: Show_segments_base(style, line_color_name, line_width_name,
|
||||
parent, name),
|
||||
cont(container), _begin(begin), _end(end) {};
|
||||
|
||||
void set_container(C* container)
|
||||
{
|
||||
cont = container;
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
if( cont != 0 )
|
||||
{
|
||||
widget->lock();
|
||||
{
|
||||
QColor old_color = widget->color();
|
||||
int old_width = widget->lineWidth();
|
||||
|
||||
widget->setColor(style()->getColor(color));
|
||||
widget->setLineWidth(style()->getInt(width));
|
||||
|
||||
for(iterator it = (cont->*_begin)();
|
||||
it!=(cont->*_end)();
|
||||
++it)
|
||||
{
|
||||
*widget << Transform()(*it);
|
||||
}
|
||||
|
||||
widget->setColor(old_color);
|
||||
widget->setLineWidth(old_width);
|
||||
}
|
||||
widget->unlock();
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
C *cont;
|
||||
iterator_function _begin;
|
||||
iterator_function _end;
|
||||
};//end class
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // SHOW_SEGMENTS_H
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
// Copyright (c) 2003-2004 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Laurent Rineau
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
|
||||
|
||||
#include "Show_segments_base.h"
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
Show_segments_base::Show_segments_base(Color c,
|
||||
int linewidth,
|
||||
QObject* parent,
|
||||
const char* name)
|
||||
: Qt_widget_styled_layer(0, parent, name)
|
||||
{
|
||||
color=tr("Color");
|
||||
width=tr("Line width");
|
||||
|
||||
setColor(QColor(c.red(), c.green(), c.blue()));
|
||||
setLineWidth(linewidth);
|
||||
}
|
||||
|
||||
Show_segments_base::Show_segments_base(Style* style,
|
||||
QString line_color_name,
|
||||
QString line_width_name,
|
||||
QObject* parent,
|
||||
const char* name)
|
||||
: Qt_widget_styled_layer(style, parent, name),
|
||||
color(line_color_name),
|
||||
width(line_width_name)
|
||||
{}
|
||||
|
||||
void Show_segments_base::setColor(QColor c)
|
||||
{ style()->setColor(color, c); }
|
||||
|
||||
void Show_segments_base::setLineWidth(int line_width)
|
||||
{ style()->setInt(width, line_width); }
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
// moc_source_file: Show_segments_base.h
|
||||
#include "Show_segments_base.moc"
|
||||
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
// Copyright (c) 2003-2004 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Laurent Rineau
|
||||
|
||||
#ifndef SHOW_SEGMENTS_BASE_H
|
||||
#define SHOW_SEGMENTS_BASE_H
|
||||
|
||||
#include "Qt_widget_styled_layer.h"
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
class Show_segments_base: public Qt_widget_styled_layer {
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef Qt_widget_styled_layer::Style Style;
|
||||
|
||||
Show_segments_base(Color c,
|
||||
int linewidth,
|
||||
QObject* parent = 0, const char* name = 0);
|
||||
|
||||
Show_segments_base(Style* style,
|
||||
QString line_color_name,
|
||||
QString line_width_name,
|
||||
QObject* parent = 0, const char* name = 0);
|
||||
|
||||
public slots:
|
||||
void setColor(QColor);
|
||||
void setLineWidth(int);
|
||||
|
||||
protected:
|
||||
QString color;
|
||||
QString width;
|
||||
}; //end Show_segments_base
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // SHOW_SEGMENTS_BASE_H
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
/* XPM */
|
||||
const char * contraints_xpm[] = {
|
||||
"32 32 2 1",
|
||||
" c None",
|
||||
". c #FF0000",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ............. ",
|
||||
" .. .. ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . ... . ",
|
||||
" . ... .... . ",
|
||||
" . . . . . ",
|
||||
" . . . . . ",
|
||||
" . . . . . ",
|
||||
" . . . . . ",
|
||||
" .. . . . . ",
|
||||
" .. . . . . ",
|
||||
" . .. .. . ",
|
||||
" . ..... .. ... ",
|
||||
" . .... . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" ..... . ",
|
||||
" ........ .. ",
|
||||
" .... ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
// Copyright (c) 2003-2004 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Laurent Rineau
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
|
||||
|
||||
#include <CGAL/IO/pixmaps/polygon.xpm>
|
||||
#include <CGAL/IO/pixmaps/point.xpm>
|
||||
#include <CGAL/IO/pixmaps/points.xpm>
|
||||
#include "contraints.xpm"
|
||||
#include "marked.xpm"
|
||||
#include "seeds.xpm"
|
||||
#include <CGAL/IO/pixmaps/circle.xpm>
|
||||
#include <CGAL/IO/pixmaps/triangulation.xpm>
|
||||
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
// Copyright (c) 2003-2004 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Laurent Rineau
|
||||
|
||||
extern const char *polygon_xpm[],
|
||||
*point_xpm[],
|
||||
*points_xpm[],
|
||||
*contraints_xpm[],
|
||||
*marked_xpm[],
|
||||
*seeds_xpm[],
|
||||
*circle_xpm[],
|
||||
*triangulation_xpm[];
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
/* XPM */
|
||||
const char * marked_xpm[] = {
|
||||
"32 32 4 1",
|
||||
" c None",
|
||||
". c #000080",
|
||||
"+ c #0CFF00",
|
||||
"@ c #FFFFFF",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ............. ",
|
||||
" ..++++++++++... ",
|
||||
" .+.++++++++.@.+. ",
|
||||
" .++.+++++++.+.++. ",
|
||||
" .+++.+++++.++.+++. ",
|
||||
" .+++.++++.+++.++++. ",
|
||||
" .+++++.++.++++.+++++. ",
|
||||
" .++++++..++++.++++... ",
|
||||
" .+++++++...+++.++..@.. ",
|
||||
" .+++++....@......++.+. ",
|
||||
" .++++.+.@.@@@@.++++.+. ",
|
||||
" .+++..++.@@.@@@.+++.++. ",
|
||||
" .++.++++.@@.@@@.+++.+++. ",
|
||||
" ...+++++.@@@.@@.++.++++. ",
|
||||
" ..++++++.@@@@@.@.++.++++. ",
|
||||
" ...+++++.@@@@@.@.+.+++++. ",
|
||||
" .++......@@@@@@..+.+++++. ",
|
||||
" .+++++++.....@@.......... ",
|
||||
" .+++++..+.+++.....++++. ",
|
||||
" .++++.++++.++++++.+++. ",
|
||||
" .+++.++++++.+++++.++. ",
|
||||
" .+..++++++++.+++.++. ",
|
||||
" ..+++++++++++.++.++. ",
|
||||
" .....+++++++++.+.+. ",
|
||||
" ........++... ",
|
||||
" .... ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,39 +0,0 @@
|
|||
/* XPM */
|
||||
const char * seeds_xpm[] = {
|
||||
"32 32 4 1",
|
||||
" c None",
|
||||
". c #FF0000",
|
||||
"+ c #00FF00",
|
||||
"@ c #000000",
|
||||
" ..++++++++++++++",
|
||||
" ..+++++++++++++++",
|
||||
" ..++++++++++++++++",
|
||||
" ..++++++++++++++++++",
|
||||
" ..+++++++++++++++++++",
|
||||
" ..++++++++++++++++++++",
|
||||
" ..++++++++++++@++++++++",
|
||||
" @ ..++++++++++++@+++++++++",
|
||||
" ..++++++++++++@@++++++++++",
|
||||
" ..@@++++++++++@@+++++++++++",
|
||||
" ..+++@+++++++++@++++++++++++",
|
||||
" ..+++++@@+++++@@+++++++++++++",
|
||||
" ..++++++++@@+++@@++++++++++++++",
|
||||
"..++++++++++@@+@@+++++++++++++++",
|
||||
".++++++++++++@@@++++++++++++++++",
|
||||
"+++++++++++++@@@++++++++++++++++",
|
||||
"++++++++++++@@+@@+++++++++++++++",
|
||||
"+++++++++++@@+++@@@+++++++++++++",
|
||||
"++++++++++@@++++++@@++++++++++++",
|
||||
"+++++++++@@++++++++@@+++++++++++",
|
||||
"++++++++@@++++++++++@@++++++++++",
|
||||
"+++++++@@++++++++++++@@+++++++++",
|
||||
"++++++@@++++++++++++++@@++++++++",
|
||||
"..+++++++++++++++++++++@@+++++++",
|
||||
" .....++++++++++++++++++++++++++",
|
||||
" ....+++++++++++++++++++++++",
|
||||
" ....++++++++++++++++++++",
|
||||
" ...+++++++++++++++++",
|
||||
" ....+++++++++++++",
|
||||
" ....++++++++++",
|
||||
" ....+++++++",
|
||||
" ....+++"};
|
||||
Loading…
Reference in New Issue