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 )
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_BINARY_DIR})
@ -33,7 +33,7 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND CGAL_Core_FOUND )
# 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} )
qt5_use_modules(boolean_operations_2 Widgets Script)
qt5_use_modules(boolean_operations_2 Widgets Script Svg)
# Link with Qt libraries
target_link_libraries( boolean_operations_2 ${QT_LIBRARIES} )

View File

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

View File

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

View File

@ -1,10 +1,10 @@
<html>
<body>
<h2>Constrained Delaunay Triangulation</h2>
<h2>2D Segment Voronoi Diagram</h2>
<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>
<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>
</body>
</html>

View File

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

View File

@ -271,9 +271,9 @@ qDebug()<<"setting des Pens";
dgi->setVerticesPen(
QPen(Qt::red, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
dgi->setVoronoiPen(
QPen(Qt::darkGreen, 2, Qt::DashLine, Qt::RoundCap, Qt::RoundJoin));
QPen(Qt::darkGreen, 0, Qt::DashLine, Qt::RoundCap, Qt::RoundJoin));
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);
scene.addItem(dgi);

View File

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

View File

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

View File

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

View File

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