mirror of https://github.com/CGAL/cgal
Polyhedron demo object generator tetrahedron -added UI and half logic part
This commit is contained in:
parent
04b5104b5b
commit
455f625e8a
|
|
@ -590,46 +590,77 @@ template<class Facegraph_item>
|
||||||
void Basic_generator_plugin::generateTetrahedron()
|
void Basic_generator_plugin::generateTetrahedron()
|
||||||
{
|
{
|
||||||
typename Facegraph_item::Face_graph tetrahedron;
|
typename Facegraph_item::Face_graph tetrahedron;
|
||||||
|
if (dock_widget->tabWidget->currentIndex() == 0)
|
||||||
QString point_texts[4];
|
|
||||||
Point points[4];
|
|
||||||
point_texts[0] = dock_widget->tetP0->text();
|
|
||||||
point_texts[1] = dock_widget->tetP1->text();
|
|
||||||
point_texts[2] = dock_widget->tetP2->text();
|
|
||||||
point_texts[3] = dock_widget->tetP3->text();
|
|
||||||
|
|
||||||
for(int i=0; i<4; ++i)
|
|
||||||
{
|
{
|
||||||
QStringList list = point_texts[i].split(QRegExp("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS);
|
QString point_texts[4];
|
||||||
if (list.isEmpty()) return;
|
Point points[4];
|
||||||
if (list.size()!=3){
|
point_texts[0] = dock_widget->tetP0->text();
|
||||||
QMessageBox *msgBox = new QMessageBox;
|
point_texts[1] = dock_widget->tetP1->text();
|
||||||
msgBox->setWindowTitle("Error");
|
point_texts[2] = dock_widget->tetP2->text();
|
||||||
msgBox->setText("ERROR : Input should consists of 3 doubles.");
|
point_texts[3] = dock_widget->tetP3->text();
|
||||||
msgBox->exec();
|
|
||||||
return;
|
for (int i = 0; i < 4; ++i)
|
||||||
}
|
|
||||||
double coords[3];
|
|
||||||
for(int j=0; j<3; ++j)
|
|
||||||
{
|
|
||||||
bool ok;
|
|
||||||
coords[j] = list.at(j).toDouble(&ok);
|
|
||||||
if(!ok)
|
|
||||||
{
|
{
|
||||||
QMessageBox *msgBox = new QMessageBox;
|
QStringList list = point_texts[i].split(QRegExp("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS);
|
||||||
|
if (list.isEmpty()) return;
|
||||||
|
if (list.size() != 3) {
|
||||||
|
QMessageBox* msgBox = new QMessageBox;
|
||||||
|
msgBox->setWindowTitle("Error");
|
||||||
|
msgBox->setText("ERROR : Input should consists of 3 doubles.");
|
||||||
|
msgBox->exec();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
double coords[3];
|
||||||
|
for (int j = 0; j < 3; ++j)
|
||||||
|
{
|
||||||
|
bool ok;
|
||||||
|
coords[j] = list.at(j).toDouble(&ok);
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
QMessageBox* msgBox = new QMessageBox;
|
||||||
|
msgBox->setWindowTitle("Error");
|
||||||
|
msgBox->setText("ERROR : Coordinates are invalid.");
|
||||||
|
msgBox->exec();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
points[i] = Point(coords[0], coords[1], coords[2]);
|
||||||
|
}
|
||||||
|
CGAL::make_tetrahedron(points[0],
|
||||||
|
points[1],
|
||||||
|
points[2],
|
||||||
|
points[3],
|
||||||
|
tetrahedron);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QString text = dock_widget->extremaEdit_2->text();
|
||||||
|
QStringList list = text.split(QRegExp("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS);
|
||||||
|
if (list.isEmpty()) return;
|
||||||
|
if (list.size() != 3) {
|
||||||
|
QMessageBox* msgBox = new QMessageBox;
|
||||||
msgBox->setWindowTitle("Error");
|
msgBox->setWindowTitle("Error");
|
||||||
msgBox->setText("ERROR : Coordinates are invalid.");
|
msgBox->setText("ERROR : Input should consists of 3 doubles.");
|
||||||
msgBox->exec();
|
msgBox->exec();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
points[i] = Point(coords[0], coords[1], coords[2]);
|
for (int i = 0; i < 3; ++i)
|
||||||
|
{
|
||||||
|
bool ok;
|
||||||
|
list.at(i).toDouble(&ok);
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
QMessageBox* msgBox = new QMessageBox;
|
||||||
|
msgBox->setWindowTitle("Error");
|
||||||
|
msgBox->setText("ERROR : Coordinates are invalid.");
|
||||||
|
msgBox->exec();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
CGAL::make_tetrahedron(points[0],
|
|
||||||
points[1],
|
|
||||||
points[2],
|
|
||||||
points[3],
|
|
||||||
tetrahedron);
|
|
||||||
|
|
||||||
Facegraph_item* tet_item = new Facegraph_item(tetrahedron);
|
Facegraph_item* tet_item = new Facegraph_item(tetrahedron);
|
||||||
tet_item->setName(dock_widget->name_lineEdit->text());
|
tet_item->setName(dock_widget->name_lineEdit->text());
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="selector_tabWidget">
|
<widget class="QTabWidget" name="selector_tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="prismTab">
|
<widget class="QWidget" name="prismTab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
|
@ -755,24 +755,27 @@ QGroupBox::title {
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_12" stretch="1,0,1">
|
<layout class="QVBoxLayout" name="verticalLayout_12" stretch="0">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_8">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="orientation">
|
<property name="currentIndex">
|
||||||
<enum>Qt::Vertical</enum>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<widget class="QWidget" name="tetraTab">
|
||||||
<size>
|
<attribute name="title">
|
||||||
<width>20</width>
|
<string>Tetrahedron</string>
|
||||||
<height>40</height>
|
</attribute>
|
||||||
</size>
|
<widget class="QGroupBox" name="groupBox_3">
|
||||||
</property>
|
<property name="geometry">
|
||||||
</spacer>
|
<rect>
|
||||||
</item>
|
<x>0</x>
|
||||||
<item>
|
<y>30</y>
|
||||||
<widget class="QGroupBox" name="groupBox_3">
|
<width>477</width>
|
||||||
<property name="styleSheet">
|
<height>144</height>
|
||||||
<string notr="true">QGroupBox {
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QGroupBox {
|
||||||
border: 1px solid gray;
|
border: 1px solid gray;
|
||||||
border-radius: 9px;
|
border-radius: 9px;
|
||||||
margin-top: 0.5em;
|
margin-top: 0.5em;
|
||||||
|
|
@ -783,87 +786,110 @@ QGroupBox::title {
|
||||||
left: 10px;
|
left: 10px;
|
||||||
padding: 0 3px 0 3px;
|
padding: 0 3px 0 3px;
|
||||||
}</string>
|
}</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout_3" columnstretch="0,1">
|
<layout class="QGridLayout" name="gridLayout_3" columnstretch="0,0">
|
||||||
<item row="1" column="0">
|
<item row="3" column="1">
|
||||||
<widget class="QLabel" name="label_22">
|
<widget class="QLineEdit" name="tetP3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>P1</string>
|
<string>0.0 0.0 1.0</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="0">
|
||||||
<widget class="QLineEdit" name="tetP1">
|
<widget class="QLabel" name="label_22">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>1.0 0.0 0.0</string>
|
<string>P1</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="0" column="0">
|
||||||
<widget class="QLineEdit" name="tetP2">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>0.0 1.0 0.0</string>
|
<string>P0</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="2" column="0">
|
||||||
<widget class="QLineEdit" name="tetP0">
|
<widget class="QLabel" name="label_23">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>0.0 0.0 0.0</string>
|
<string>P2</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="1">
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLineEdit" name="tetP0">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>P0</string>
|
<string>0.0 0.0 0.0</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="1" column="1">
|
||||||
<widget class="QLabel" name="label_23">
|
<widget class="QLineEdit" name="tetP1">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>P2</string>
|
<string>1.0 0.0 0.0</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="label_24">
|
<widget class="QLabel" name="label_24">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>P3</string>
|
<string>P3</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QLineEdit" name="tetP3">
|
<widget class="QLineEdit" name="tetP2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>0.0 0.0 1.0</string>
|
<string>0.0 1.0 0.0</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</widget>
|
||||||
</layout>
|
</widget>
|
||||||
|
<widget class="QWidget" name="tetraTab">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Bbox</string>
|
||||||
|
</attribute>
|
||||||
|
<widget class="QLabel" name="label_33">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>8</x>
|
||||||
|
<y>9</y>
|
||||||
|
<width>46</width>
|
||||||
|
<height>207</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Coordinates of the minimum and the maximum of the Bbox.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Extrema:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="extremaEdit_2">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>60</x>
|
||||||
|
<y>100</y>
|
||||||
|
<width>401</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>1.0 1.0 1.0</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer_4">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>110</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
@ -1046,11 +1072,14 @@ QGroupBox::title {
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="html">
|
<property name="html">
|
||||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "https://www.w3.org/TR/REC-html40/strict.dtd">
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
hr { height: 1px; border-width: 0; }
|
||||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p></body></html></string>
|
li.unchecked::marker { content: "\2610"; }
|
||||||
|
li.checked::marker { content: "\2612"; }
|
||||||
|
</style></head><body style=" font-family:'Segoe UI'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||||
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:10pt;"><br /></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="overwriteMode">
|
<property name="overwriteMode">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
|
@ -1094,11 +1123,14 @@ p, li { white-space: pre-wrap; }
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="html">
|
<property name="html">
|
||||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "https://www.w3.org/TR/REC-html40/strict.dtd">
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
hr { height: 1px; border-width: 0; }
|
||||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p></body></html></string>
|
li.unchecked::marker { content: "\2610"; }
|
||||||
|
li.checked::marker { content: "\2612"; }
|
||||||
|
</style></head><body style=" font-family:'Segoe UI'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||||
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:10pt;"><br /></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="overwriteMode">
|
<property name="overwriteMode">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue