Commit cf15c5e4 authored by Pierre Kraemer's avatar Pierre Kraemer

SCHNApps: add missing files

parent d4217e84
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ComputeCurvatureDialog</class>
<widget class="QDialog" name="ComputeCurvatureDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>570</width>
<height>452</height>
</rect>
</property>
<property name="windowTitle">
<string>Compute Curvature</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QListWidget" name="mapList"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Position attribute :</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="combo_positionAttribute">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_14">
<property name="text">
<string>Normal attribute :</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="combo_normalAttribute">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Computed attributes</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Kmax :</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Existing attribute :</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="combo_KmaxAttribute">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>New attribute :</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="KmaxAttributeName"/>
</item>
</layout>
</item>
<item row="0" column="3">
<widget class="QCheckBox" name="check_KmaxCreateVBO">
<property name="text">
<string>create VBO</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_10">
<property name="font">
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>kmax :</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>Existing attribute :</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="combo_kmaxAttribute">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>New attribute :</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="kmaxAttributeName"/>
</item>
</layout>
</item>
<item row="1" column="3">
<widget class="QCheckBox" name="check_kmaxCreateVBO">
<property name="text">
<string>create VBO</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_7">
<property name="font">
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Kmin :</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Existing attribute :</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="combo_KminAttribute">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>New attribute :</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="KminAttributeName"/>
</item>
</layout>
</item>
<item row="2" column="3">
<widget class="QCheckBox" name="check_KminCreateVBO">
<property name="text">
<string>create VBO</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_13">
<property name="font">
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>kmin :</string>
</property>
</widget>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<widget class="QLabel" name="label_12">
<property name="text">
<string>Existing attribute :</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="combo_kminAttribute">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QLabel" name="label_11">
<property name="text">
<string>New attribute :</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="kminAttributeName"/>
</item>
</layout>
</item>
<item row="3" column="3">
<widget class="QCheckBox" name="check_kminCreateVBO">
<property name="text">
<string>create VBO</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_15">
<property name="font">
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Knormal :</string>
</property>
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QLabel" name="label_17">
<property name="text">
<string>Existing attribute :</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="combo_KnormalAttribute">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="QLabel" name="label_16">
<property name="text">
<string>New attribute :</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="KnormalAttributeName"/>
</item>
</layout>
</item>
<item row="4" column="3">
<widget class="QCheckBox" name="check_KnormalCreateVBO">
<property name="text">
<string>create VBO</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="button_cancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button_apply">
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button_ok">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>button_ok</sender>
<signal>clicked()</signal>
<receiver>ComputeCurvatureDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>232</x>
<y>283</y>
</hint>
<hint type="destinationlabel">
<x>140</x>
<y>156</y>
</hint>
</hints>
</connection>
<connection>
<sender>button_cancel</sender>
<signal>clicked()</signal>
<receiver>ComputeCurvatureDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>52</x>
<y>283</y>
</hint>
<hint type="destinationlabel">
<x>140</x>
<y>156</y>
</hint>
</hints>
</connection>
</connections>
</ui>
#ifndef _COMPUTECURVATURE_DIALOG_H_
#define _COMPUTECURVATURE_DIALOG_H_
#include "ui_computeCurvatureDialog.h"
namespace CGoGN
{
namespace SCHNApps
{
class Window;
class ComputeCurvatureDialog : public QDialog, public Ui::ComputeCurvatureDialog
{
Q_OBJECT
public:
ComputeCurvatureDialog(Window* w);
void init();
public slots:
void cb_selectedMapChanged();
private:
Window* m_window;
};
} // namespace SCHNApps
} // namespace CGoGN
#endif
#include "computeCurvatureDialog.h"
#include "differentialProperties.h"
#include "window.h"
#include "mapHandler.h"
namespace CGoGN
{
namespace SCHNApps
{
ComputeCurvatureDialog::ComputeCurvatureDialog(Window* w) : m_window(w)
{
setupUi(this);
connect(mapList, SIGNAL(itemSelectionChanged()), this, SLOT(cb_selectedMapChanged()));
}
void ComputeCurvatureDialog::init()
{
mapList->clear();
combo_positionAttribute->clear();
combo_normalAttribute->clear();
combo_KmaxAttribute->clear();
combo_kmaxAttribute->clear();
combo_KminAttribute->clear();
combo_kminAttribute->clear();
combo_KnormalAttribute->clear();
KmaxAttributeName->setText("Kmax");
kmaxAttributeName->setText("kmax");
KminAttributeName->setText("Kmin");
kminAttributeName->setText("kmin");
KnormalAttributeName->setText("Knormal");
const QList<MapHandlerGen*>& maps = m_window->getMapsList();
foreach(MapHandlerGen* map, maps)
mapList->addItem(map->getName());
}
void ComputeCurvatureDialog::cb_selectedMapChanged()
{
QList<QListWidgetItem*> currentItems = mapList->selectedItems();
if(!currentItems.empty())
{
combo_positionAttribute->clear();
combo_normalAttribute->clear();
const QString& mapname = currentItems[0]->text();
MapHandlerGen* mh = m_window->getMap(mapname);
GenericMap* map = mh->getGenericMap();
AttributeContainer& cont = map->getAttributeContainer<VERTEX>();
std::vector<std::string> names;
std::vector<std::string> types;
cont.getAttributesNames(names);
cont.getAttributesTypes(types);
std::string vec3TypeName = nameOfType(VEC3());
std::string realTypeName = nameOfType(REAL());
unsigned int j = 0;
unsigned int k = 0;
for(unsigned int i = 0; i < names.size(); ++i)
{
if(types[i] == vec3TypeName)
{
combo_positionAttribute->addItem(QString::fromStdString(names[i]));
if(names[i] == "position") // try to select a position attribute named "position"
combo_positionAttribute->setCurrentIndex(j);
combo_normalAttribute->addItem(QString::fromStdString(names[i]));
if(names[i] == "normal") // try to select a normal attribute named "normal"
combo_normalAttribute->setCurrentIndex(j);
combo_KmaxAttribute->addItem(QString::fromStdString(names[i]));
if(names[i] == "Kmax") // try to select a normal attribute named "Kmax"
combo_KmaxAttribute->setCurrentIndex(j);
combo_KminAttribute->addItem(QString::fromStdString(names[i]));
if(names[i] == "Kmin") // try to select a normal attribute named "Kmin"
combo_KminAttribute->setCurrentIndex(j);
combo_KnormalAttribute->addItem(QString::fromStdString(names[i]));
if(names[i] == "Knormal") // try to select a normal attribute named "Knormal"
combo_KnormalAttribute->setCurrentIndex(j);
++j;
}
else if(types[i] == realTypeName)
{
combo_kmaxAttribute->addItem(QString::fromStdString(names[i]));
if(names[i] == "kmax") // try to select a normal attribute named "kmax"
combo_kmaxAttribute->setCurrentIndex(k);
combo_kminAttribute->addItem(QString::fromStdString(names[i]));
if(names[i] == "kmin") // try to select a normal attribute named "kmin"
combo_kminAttribute->setCurrentIndex(k);
++k;
}
}
}
}
} // namespace SCHNApps
} // namespace CGoGN
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment