fix line width in demos using GraphicsView

This commit is contained in:
Andreas Fabri 2015-07-28 15:46:11 +02:00
parent cb479491d5
commit f864b0a8e8
11 changed files with 126 additions and 130 deletions

View File

@ -14,7 +14,7 @@ include(${CGAL_USE_FILE})
set( QT_USE_QTMAIN TRUE ) set( QT_USE_QTMAIN TRUE )
find_package(Qt5 QUIET COMPONENTS Widgets Script) find_package(Qt5 QUIET COMPONENTS Widgets Script Svg)
include_directories (BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../include ) include_directories (BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../include )
include_directories (BEFORE ${CMAKE_CURRENT_BINARY_DIR}) include_directories (BEFORE ${CMAKE_CURRENT_BINARY_DIR})
@ -33,7 +33,7 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND CGAL_Core_FOUND )
# The executable itself. # The executable itself.
add_executable ( boolean_operations_2 ${CMAKE_CURRENT_SOURCE_DIR}/boolean_operations_2.cpp boolean_operations_2.moc ${CDT_UI_FILES} ${CDT_RESOURCE_FILES} ) add_executable ( boolean_operations_2 ${CMAKE_CURRENT_SOURCE_DIR}/boolean_operations_2.cpp boolean_operations_2.moc ${CDT_UI_FILES} ${CDT_RESOURCE_FILES} )
qt5_use_modules(boolean_operations_2 Widgets Script) qt5_use_modules(boolean_operations_2 Widgets Script Svg)
# Link with Qt libraries # Link with Qt libraries
target_link_libraries( boolean_operations_2 ${QT_LIBRARIES} ) target_link_libraries( boolean_operations_2 ${QT_LIBRARIES} )

View File

@ -127,7 +127,6 @@ MainWindow::MainWindow()
QObject::connect(this, SIGNAL(changed()), QObject::connect(this, SIGNAL(changed()),
pgi, SLOT(modelChanged())); pgi, SLOT(modelChanged()));
pgi->setVerticesPen(QPen(Qt::red, 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
scene.addItem(pgi); scene.addItem(pgi);
kgongi = new CGAL::Qt::PolygonGraphicsItem<Polygon2>(&kgon); kgongi = new CGAL::Qt::PolygonGraphicsItem<Polygon2>(&kgon);

View File

@ -123,8 +123,8 @@ MainWindow::MainWindow()
QColor segmentColor(::Qt::blue); QColor segmentColor(::Qt::blue);
QColor voronoiColor(::Qt::black); QColor voronoiColor(::Qt::black);
segmentColor.setAlpha(150); segmentColor.setAlpha(150);
sdggi->setSegmentPen(segmentColor); sdggi->setSegmentPen(QPen(segmentColor,0));
sdggi->setVoronoiPen(voronoiColor); sdggi->setVoronoiPen(QPen(voronoiColor,0));
QObject::connect(this, SIGNAL(changed()), QObject::connect(this, SIGNAL(changed()),
sdggi, SLOT(modelChanged())); sdggi, SLOT(modelChanged()));

View File

@ -1,8 +1,9 @@
<ui version="4.0" > <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author>GeometryFactory</author> <author>GeometryFactory</author>
<class>Segment_voronoi_2</class> <class>Segment_voronoi_2</class>
<widget class="QMainWindow" name="Segment_voronoi_2" > <widget class="QMainWindow" name="Segment_voronoi_2">
<property name="geometry" > <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
@ -10,240 +11,233 @@
<height>600</height> <height>600</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="windowTitle">
<string>CGAL Segment Voronoi Diagram</string> <string>CGAL Segment Voronoi Diagram</string>
</property> </property>
<property name="windowIcon" > <property name="windowIcon">
<iconset resource="../resources/CGAL.qrc" > <iconset resource="../resources/CGAL.qrc">
<normaloff>:/cgal/logos/cgal_icon</normaloff>:/cgal/logos/cgal_icon</iconset> <normaloff>:/cgal/logos/cgal_icon</normaloff>:/cgal/logos/cgal_icon</iconset>
</property> </property>
<widget class="QWidget" name="centralwidget" > <widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" > <layout class="QGridLayout">
<item row="0" column="0" > <item row="0" column="0">
<widget class="QGraphicsView" name="graphicsView" > <widget class="QGraphicsView" name="graphicsView">
<property name="focusPolicy" > <property name="focusPolicy">
<enum>Qt::StrongFocus</enum> <enum>Qt::StrongFocus</enum>
</property> </property>
<property name="verticalScrollBarPolicy" > <property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum> <enum>Qt::ScrollBarAlwaysOn</enum>
</property> </property>
<property name="horizontalScrollBarPolicy" > <property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum> <enum>Qt::ScrollBarAlwaysOn</enum>
</property> </property>
<property name="transformationAnchor" > <property name="transformationAnchor">
<enum>QGraphicsView::NoAnchor</enum> <enum>QGraphicsView::NoAnchor</enum>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QStatusBar" name="statusbar" /> <widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="fileToolBar" > <widget class="QToolBar" name="fileToolBar">
<property name="windowTitle" > <property name="windowTitle">
<string>File Tools</string> <string>File Tools</string>
</property> </property>
<attribute name="toolBarArea" > <attribute name="toolBarArea">
<enum>TopToolBarArea</enum> <enum>TopToolBarArea</enum>
</attribute> </attribute>
<attribute name="toolBarBreak" > <attribute name="toolBarBreak">
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
<addaction name="actionClear" /> <addaction name="actionClear"/>
<addaction name="actionLoadSegments" /> <addaction name="actionLoadSegments"/>
<addaction name="actionSaveSegments" /> <addaction name="actionSaveSegments"/>
</widget> </widget>
<widget class="QToolBar" name="toolBar" > <widget class="QToolBar" name="toolBar">
<property name="windowTitle" > <property name="windowTitle">
<string>Visualization Tools</string> <string>Visualization Tools</string>
</property> </property>
<attribute name="toolBarArea" > <attribute name="toolBarArea">
<enum>TopToolBarArea</enum> <enum>TopToolBarArea</enum>
</attribute> </attribute>
<attribute name="toolBarBreak" > <attribute name="toolBarBreak">
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
<addaction name="actionInsertPolyline" /> <addaction name="actionInsertPolyline"/>
<addaction name="separator" /> <addaction name="separator"/>
<addaction name="actionShowConstraints" /> <addaction name="actionShowVoronoi"/>
<addaction name="actionShowVoronoi" /> <addaction name="separator"/>
<addaction name="separator" /> <addaction name="actionRecenter"/>
<addaction name="actionRecenter" />
</widget> </widget>
<widget class="QMenuBar" name="menubar" > <widget class="QMenuBar" name="menubar">
<property name="geometry" > <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>800</width>
<height>19</height> <height>26</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile" > <widget class="QMenu" name="menuFile">
<property name="title" > <property name="title">
<string>&amp;File</string> <string>&amp;File</string>
</property> </property>
<addaction name="separator" /> <addaction name="separator"/>
<addaction name="actionClear" /> <addaction name="actionClear"/>
<addaction name="actionLoadSegments" /> <addaction name="actionLoadSegments"/>
<addaction name="actionSaveSegments" /> <addaction name="actionSaveSegments"/>
<addaction name="separator" /> <addaction name="separator"/>
<addaction name="actionQuit" /> <addaction name="actionQuit"/>
</widget> </widget>
<widget class="QMenu" name="menuEdit" > <widget class="QMenu" name="menuEdit">
<property name="title" > <property name="title">
<string>&amp;Edit</string> <string>&amp;Edit</string>
</property> </property>
</widget> </widget>
<widget class="QMenu" name="menuTools" > <widget class="QMenu" name="menuTools">
<property name="title" > <property name="title">
<string>&amp;Tools</string> <string>&amp;Tools</string>
</property> </property>
<addaction name="actionInsertPolyline" /> <addaction name="actionInsertPolyline"/>
<addaction name="separator" /> <addaction name="separator"/>
<addaction name="actionShowVoronoi" /> <addaction name="actionShowVoronoi"/>
<addaction name="actionShowConstraints" /> <addaction name="separator"/>
<addaction name="separator" /> <addaction name="actionRecenter"/>
<addaction name="actionRecenter" />
</widget> </widget>
<addaction name="menuFile" /> <addaction name="menuFile"/>
<addaction name="menuEdit" /> <addaction name="menuEdit"/>
<addaction name="menuTools" /> <addaction name="menuTools"/>
</widget> </widget>
<action name="actionAbout" > <action name="actionAbout">
<property name="text" > <property name="text">
<string>&amp;About</string> <string>&amp;About</string>
</property> </property>
</action> </action>
<action name="actionAboutCGAL" > <action name="actionAboutCGAL">
<property name="text" > <property name="text">
<string>About &amp;CGAL</string> <string>About &amp;CGAL</string>
</property> </property>
</action> </action>
<action name="actionQuit" > <action name="actionQuit">
<property name="text" > <property name="text">
<string>&amp;Quit</string> <string>&amp;Quit</string>
</property> </property>
<property name="shortcut" > <property name="shortcut">
<string>Ctrl+Q</string> <string>Ctrl+Q</string>
</property> </property>
</action> </action>
<action name="actionInsertPolyline">
<action name="actionInsertPolyline" > <property name="checkable">
<property name="checkable" >
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="checked" > <property name="checked">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="icon" > <property name="icon">
<iconset resource="../icons/Input.qrc" > <iconset resource="../icons/Input.qrc">
<normaloff>:/cgal/Input/inputPolyline.png</normaloff>:/cgal/Input/inputPolyline.png</iconset> <normaloff>:/cgal/Input/inputPolyline.png</normaloff>:/cgal/Input/inputPolyline.png</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>&amp;Insert Polyline</string> <string>&amp;Insert Polyline</string>
</property> </property>
<property name="toolTip" > <property name="toolTip">
<string>Insert Point or Polyline</string> <string>Insert Point or Polyline</string>
</property> </property>
<property name="statusTip" > <property name="statusTip">
<string>Left: Insert vtx | Right: Final vtx | Del: Delete vtx</string> <string>Left: Insert vtx | Right: Final vtx | Del: Delete vtx</string>
</property> </property>
</action> </action>
<action name="actionClear" > <action name="actionClear">
<property name="icon" > <property name="icon">
<iconset resource="../icons/File.qrc" > <iconset resource="../icons/File.qrc">
<normaloff>:/cgal/fileToolbar/fileNew.png</normaloff>:/cgal/fileToolbar/fileNew.png</iconset> <normaloff>:/cgal/fileToolbar/fileNew.png</normaloff>:/cgal/fileToolbar/fileNew.png</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>&amp;Clear</string> <string>&amp;Clear</string>
</property> </property>
<property name="shortcut" > <property name="shortcut">
<string>Ctrl+C</string> <string>Ctrl+C</string>
</property> </property>
</action> </action>
<action name="actionShowVoronoi" > <action name="actionShowVoronoi">
<property name="checkable" > <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="checked" > <property name="checked">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="icon" > <property name="icon">
<iconset resource="../icons/Triangulation_2.qrc" > <iconset resource="../icons/Triangulation_2.qrc">
<normaloff>:/cgal/Triangulation_2/Voronoi_diagram_2.png</normaloff>:/cgal/Triangulation_2/Voronoi_diagram_2.png</iconset> <normaloff>:/cgal/Triangulation_2/Voronoi_diagram_2.png</normaloff>:/cgal/Triangulation_2/Voronoi_diagram_2.png</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>Show &amp;Voronoi Diagram</string> <string>Show &amp;Voronoi Diagram</string>
</property> </property>
<property name="shortcut" > <property name="shortcut">
<string>Ctrl+V</string> <string>Ctrl+V</string>
</property> </property>
<property name="visible" > <property name="visible">
<bool>false</bool> <bool>false</bool>
</property> </property>
</action> </action>
<action name="actionLoadSegments">
<action name="actionLoadSegments" > <property name="icon">
<property name="icon" > <iconset resource="../icons/File.qrc">
<iconset resource="../icons/File.qrc" >
<normaloff>:/cgal/fileToolbar/fileOpen.png</normaloff>:/cgal/fileToolbar/fileOpen.png</iconset> <normaloff>:/cgal/fileToolbar/fileOpen.png</normaloff>:/cgal/fileToolbar/fileOpen.png</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>&amp;Load...</string> <string>&amp;Load...</string>
</property> </property>
<property name="shortcut" > <property name="shortcut">
<string>Ctrl+L</string> <string>Ctrl+L</string>
</property> </property>
</action> </action>
<action name="actionSaveSegments" > <action name="actionSaveSegments">
<property name="icon" > <property name="icon">
<iconset resource="../icons/File.qrc" > <iconset resource="../icons/File.qrc">
<normaloff>:/cgal/fileToolbar/fileSave.png</normaloff>:/cgal/fileToolbar/fileSave.png</iconset> <normaloff>:/cgal/fileToolbar/fileSave.png</normaloff>:/cgal/fileToolbar/fileSave.png</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>&amp;Save...</string> <string>&amp;Save...</string>
</property> </property>
<property name="shortcut" > <property name="shortcut">
<string>Ctrl+S</string> <string>Ctrl+S</string>
</property> </property>
</action> </action>
<action name="actionRecenter">
<action name="actionRecenter" > <property name="icon">
<property name="icon" > <iconset resource="../icons/Input.qrc">
<iconset resource="../icons/Input.qrc" >
<normaloff>:/cgal/Input/zoom-best-fit</normaloff>:/cgal/Input/zoom-best-fit</iconset> <normaloff>:/cgal/Input/zoom-best-fit</normaloff>:/cgal/Input/zoom-best-fit</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>Re&amp;center the viewport</string> <string>Re&amp;center the viewport</string>
</property> </property>
<property name="shortcut" > <property name="shortcut">
<string>Ctrl+R</string> <string>Ctrl+R</string>
</property> </property>
</action> </action>
<action name="actionShowConstraints">
<action name="actionShowConstraints" > <property name="checkable">
<property name="checkable" >
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="icon" > <property name="icon">
<iconset resource="Segment_voronoi_2.qrc" > <iconset resource="Segment_voronoi_2.qrc">
<normaloff>:/cgal/Actions/icons/constrained_triangulation_show_constraints.png</normaloff>:/cgal/Actions/icons/constrained_triangulation_show_constraints.png</iconset> <normaloff>:/cgal/Actions/icons/constrained_triangulation_show_constraints.png</normaloff>:/cgal/Actions/icons/constrained_triangulation_show_constraints.png</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>Show &amp;constraints</string> <string>Show &amp;constraints</string>
</property> </property>
<property name="shortcut" > <property name="shortcut">
<string>Ctrl+C</string> <string>Ctrl+C</string>
</property> </property>
</action> </action>
</widget> </widget>
<resources> <resources>
<include location="Segment_voronoi_2.qrc" /> <include location="Segment_voronoi_2.qrc"/>
<include location="../icons/File.qrc" /> <include location="../icons/File.qrc"/>
<include location="../resources/CGAL.qrc" /> <include location="../resources/CGAL.qrc"/>
<include location="../icons/Triangulation_2.qrc" /> <include location="../icons/Triangulation_2.qrc"/>
<include location="../icons/Input.qrc" /> <include location="../icons/Input.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View File

@ -1,10 +1,10 @@
<html> <html>
<body> <body>
<h2>Constrained Delaunay Triangulation</h2> <h2>2D Segment Voronoi Diagram</h2>
<p>Copyright &copy; 2008 GeometryFactory</p> <p>Copyright &copy; 2008 GeometryFactory</p>
<p>This application illustrates the 2D Constrained Delaunay <p>This application illustrates the 2D segment Voronoi diagram
of <a href="http://www.cgal.org/">CGAL</a>.</p> of <a href="http://www.cgal.org/">CGAL</a>.</p>
<p>See also <a href="http://www.cgal.org/Pkg/Triangulation2">the online <p>See also <a href="http://www.cgal.org/Pkg/SegmentDelaunayGraph2">the online
manual</a>.</p> manual</a>.</p>
</body> </body>
</html> </html>

View File

@ -131,8 +131,8 @@ MainWindow::MainWindow()
QColor segmentColor(::Qt::blue); QColor segmentColor(::Qt::blue);
QColor voronoiColor(::Qt::black); QColor voronoiColor(::Qt::black);
segmentColor.setAlpha(150); segmentColor.setAlpha(150);
sdggi->setSegmentPen(segmentColor); sdggi->setSegmentPen(QPen(segmentColor,0));
sdggi->setVoronoiPen(voronoiColor); sdggi->setVoronoiPen(QPen(voronoiColor,0));
QObject::connect(this, SIGNAL(changed()), QObject::connect(this, SIGNAL(changed()),
sdggi, SLOT(modelChanged())); sdggi, SLOT(modelChanged()));

View File

@ -271,9 +271,9 @@ qDebug()<<"setting des Pens";
dgi->setVerticesPen( dgi->setVerticesPen(
QPen(Qt::red, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); QPen(Qt::red, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
dgi->setVoronoiPen( dgi->setVoronoiPen(
QPen(Qt::darkGreen, 2, Qt::DashLine, Qt::RoundCap, Qt::RoundJoin)); QPen(Qt::darkGreen, 0, Qt::DashLine, Qt::RoundCap, Qt::RoundJoin));
dgi->setSeedsPen( dgi->setSeedsPen(
QPen(Qt::darkBlue, 5, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); QPen(Qt::darkBlue, 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
dgi->setZValue(-1); dgi->setZValue(-1);
scene.addItem(dgi); scene.addItem(dgi);

View File

@ -61,7 +61,7 @@ TriangulationPointInputAndConflictZone<T>::mousePressEvent(QGraphicsSceneMouseEv
return; return;
} }
QPen blackPen(::Qt::black, 0, ::Qt::SolidLine, ::Qt::RoundCap, ::Qt::RoundJoin);
dt->find_conflicts(p, faces); dt->find_conflicts(p, faces);
for(typename std::list<Face_handle>::iterator it = faces.begin(); for(typename std::list<Face_handle>::iterator it = faces.begin();
it != faces.end(); it != faces.end();
@ -71,6 +71,7 @@ TriangulationPointInputAndConflictZone<T>::mousePressEvent(QGraphicsSceneMouseEv
QColor color(::Qt::blue); QColor color(::Qt::blue);
color.setAlpha(150); color.setAlpha(150);
item->setBrush(color); item->setBrush(color);
item->setPen(blackPen);
scene_->addItem(item); scene_->addItem(item);
qfaces.push_back(item); qfaces.push_back(item);
} }

View File

@ -115,6 +115,7 @@ PolygonGraphicsItem<P>::PolygonGraphicsItem(P * p_)
draw_edges(true), draw_vertices(true) draw_edges(true), draw_vertices(true)
{ {
setVerticesPen(QPen(::Qt::red, 3.)); setVerticesPen(QPen(::Qt::red, 3.));
setEdgesPen(QPen(::Qt::black, 0));
updateBoundingBox(); updateBoundingBox();
setZValue(3); setZValue(3);
} }

View File

@ -55,8 +55,8 @@ class SegmentDelaunayGraphGraphicsItem : public GraphicsItem
public: public:
SegmentDelaunayGraphGraphicsItem(T * t_) SegmentDelaunayGraphGraphicsItem(T * t_)
: t(t_), painterostream(0), : t(t_), painterostream(0),
segment_pen(::Qt::blue), segment_pen(::Qt::blue, 0),
voronoi_pen(::Qt::blue) voronoi_pen(::Qt::blue, 0)
{ {
} }

View File

@ -134,6 +134,7 @@ TriangulationGraphicsItem<T>::TriangulationGraphicsItem(T * t_)
visible_edges(true), visible_vertices(true) visible_edges(true), visible_vertices(true)
{ {
setVerticesPen(QPen(::Qt::red, 4.)); setVerticesPen(QPen(::Qt::red, 4.));
setEdgesPen(QPen(::Qt::black, 0, ::Qt::SolidLine, ::Qt::RoundCap, ::Qt::RoundJoin));
if(t->number_of_vertices() == 0){ if(t->number_of_vertices() == 0){
this->hide(); this->hide();
} }