Merge pull request #1177 from maxGimeno/Enhance_shortest_path_plugin-GF

Polyhedron_Demo: Enhance Shortest Path Plugin
This commit is contained in:
Sebastien Loriot 2016-06-16 16:18:10 +02:00 committed by GitHub
commit d6688765f0
3 changed files with 78 additions and 50 deletions

View File

@ -135,7 +135,7 @@ void Scene_polyhedron_shortest_path_item_priv::initialize_buffers(CGAL::Three::V
{ {
//vao containing the data for the selected lines //vao containing the data for the selected lines
{ {
program = item->getShaderProgram(Scene_polyhedron_shortest_path_item::PROGRAM_WITHOUT_LIGHT, viewer); program = item->getShaderProgram(Scene_polyhedron_shortest_path_item::PROGRAM_NO_SELECTION, viewer);
item->vaos[Selected_Edges]->bind(); item->vaos[Selected_Edges]->bind();
program->bind(); program->bind();
item->buffers[Vertices].bind(); item->buffers[Vertices].bind();
@ -184,8 +184,8 @@ void Scene_polyhedron_shortest_path_item::drawPoints(CGAL::Three::Viewer_interfa
d->initialize_buffers(viewer); d->initialize_buffers(viewer);
} }
glPointSize(4.0f); glPointSize(4.0f);
d->program = getShaderProgram(PROGRAM_WITHOUT_LIGHT); d->program = getShaderProgram(PROGRAM_NO_SELECTION);
attribBuffers(viewer, PROGRAM_WITHOUT_LIGHT); attribBuffers(viewer, PROGRAM_NO_SELECTION);
vaos[Scene_polyhedron_shortest_path_item_priv::Selected_Edges]->bind(); vaos[Scene_polyhedron_shortest_path_item_priv::Selected_Edges]->bind();
d->program->bind(); d->program->bind();
d->program->setAttributeValue("colors", QColor(Qt::green)); d->program->setAttributeValue("colors", QColor(Qt::green));
@ -459,6 +459,7 @@ bool Scene_polyhedron_shortest_path_item_priv::run_point_select(const Ray_3& ray
polylines->setColor(Qt::red); polylines->setColor(Qt::red);
this->m_sceneInterface->setSelectedItem(-1); this->m_sceneInterface->setSelectedItem(-1);
this->m_sceneInterface->addItem(polylines); this->m_sceneInterface->addItem(polylines);
this->m_sceneInterface->changeGroup(polylines, item->parentGroup());
} }
else else
{ {

View File

@ -1,5 +1,6 @@
#include <CGAL/Three/Polyhedron_demo_plugin_helper.h> #include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
#include <CGAL/Three/Polyhedron_demo_plugin_interface.h> #include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
#include <CGAL/Three/Scene_group_item.h>
#include "Messages_interface.h" #include "Messages_interface.h"
#include "Scene_polyhedron_item.h" #include "Scene_polyhedron_item.h"
@ -230,7 +231,12 @@ void Polyhedron_demo_shortest_path_plugin::on_actionMakeShortestPaths_triggered(
dock_widget->show(); dock_widget->show();
dock_widget->raise(); dock_widget->raise();
// The other parts of initialization will be handled by the 'new_item' callback // The other parts of initialization will be handled by the 'new_item' callback
scene->addItem(new Scene_polyhedron_shortest_path_item(polyhedronItem, this->scene, this->m_messages, this->mw)); Scene_group_item* group = new Scene_group_item(QString("%1 Shortest Path").arg(polyhedronItem->name()));
Scene_polyhedron_shortest_path_item* sp_item =new Scene_polyhedron_shortest_path_item(polyhedronItem, this->scene, this->m_messages, this->mw);
sp_item->setName(tr("Source Points for %1").arg(polyhedronItem->name()));
scene->addItem(sp_item);
scene->addItem(group);
scene->changeGroup(sp_item, group);
} }
else else
{ {

View File

@ -6,44 +6,49 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>334</width> <width>441</width>
<height>402</height> <height>257</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Shortest_path</string> <string>Shortest Path</string>
</property> </property>
<widget class="QWidget" name="dockWidgetContents"> <widget class="QWidget" name="dockWidgetContents">
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QGridLayout" name="gridLayout">
<item> <item row="1" column="0">
<widget class="QLabel" name="label_2"> <widget class="QGroupBox" name="groupBox">
<property name="text"> <property name="title">
<string>Shortest_path &amp;Type:</string> <string>Operation</string>
</property> </property>
<property name="buddy"> <layout class="QVBoxLayout" name="verticalLayout">
<cstring>Selection_type_combo_box</cstring>
</property>
</widget>
</item>
<item> <item>
<widget class="QComboBox" name="Selection_type_combo_box"> <widget class="QComboBox" name="Selection_type_combo_box">
<item> <item>
<property name="text"> <property name="text">
<string>Insertion</string> <string>Insert Source Point</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Removal</string> <string>Remove Source Point</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Compute Path</string> <string>Insert Target and Compute Path</string>
</property> </property>
</item> </item>
</widget> </widget>
</item> </item>
</layout>
</widget>
</item>
<item row="1" column="1">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Source/Target on:</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QComboBox" name="Primitives_type_combo_box"> <widget class="QComboBox" name="Primitives_type_combo_box">
<item> <item>
@ -65,6 +70,22 @@
</item> </item>
</layout> </layout>
</widget> </widget>
</item>
<item row="0" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>