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
{
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();
program->bind();
item->buffers[Vertices].bind();
@ -184,8 +184,8 @@ void Scene_polyhedron_shortest_path_item::drawPoints(CGAL::Three::Viewer_interfa
d->initialize_buffers(viewer);
}
glPointSize(4.0f);
d->program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
attribBuffers(viewer, PROGRAM_WITHOUT_LIGHT);
d->program = getShaderProgram(PROGRAM_NO_SELECTION);
attribBuffers(viewer, PROGRAM_NO_SELECTION);
vaos[Scene_polyhedron_shortest_path_item_priv::Selected_Edges]->bind();
d->program->bind();
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);
this->m_sceneInterface->setSelectedItem(-1);
this->m_sceneInterface->addItem(polylines);
this->m_sceneInterface->changeGroup(polylines, item->parentGroup());
}
else
{

View File

@ -1,5 +1,6 @@
#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
#include <CGAL/Three/Scene_group_item.h>
#include "Messages_interface.h"
#include "Scene_polyhedron_item.h"
@ -230,7 +231,12 @@ void Polyhedron_demo_shortest_path_plugin::on_actionMakeShortestPaths_triggered(
dock_widget->show();
dock_widget->raise();
// 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
{

View File

@ -6,44 +6,49 @@
<rect>
<x>0</x>
<y>0</y>
<width>334</width>
<height>402</height>
<width>441</width>
<height>257</height>
</rect>
</property>
<property name="windowTitle">
<string>Shortest_path</string>
<string>Shortest Path</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Shortest_path &amp;Type:</string>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Operation</string>
</property>
<property name="buddy">
<cstring>Selection_type_combo_box</cstring>
</property>
</widget>
</item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QComboBox" name="Selection_type_combo_box">
<item>
<property name="text">
<string>Insertion</string>
<string>Insert Source Point</string>
</property>
</item>
<item>
<property name="text">
<string>Removal</string>
<string>Remove Source Point</string>
</property>
</item>
<item>
<property name="text">
<string>Compute Path</string>
<string>Insert Target and Compute Path</string>
</property>
</item>
</widget>
</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>
<widget class="QComboBox" name="Primitives_type_combo_box">
<item>
@ -65,6 +70,22 @@
</item>
</layout>
</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>
<resources/>
<connections/>