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()
|
||||
{
|
||||
typename Facegraph_item::Face_graph tetrahedron;
|
||||
|
||||
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)
|
||||
if (dock_widget->tabWidget->currentIndex() == 0)
|
||||
{
|
||||
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)
|
||||
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)
|
||||
{
|
||||
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->setText("ERROR : Coordinates are invalid.");
|
||||
msgBox->setText("ERROR : Input should consists of 3 doubles.");
|
||||
msgBox->exec();
|
||||
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);
|
||||
tet_item->setName(dock_widget->name_lineEdit->text());
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
<item>
|
||||
<widget class="QTabWidget" name="selector_tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="prismTab">
|
||||
<attribute name="title">
|
||||
|
|
@ -755,24 +755,27 @@ QGroupBox::title {
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_12" stretch="1,0,1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_12" stretch="0">
|
||||
<item>
|
||||
<spacer name="verticalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QGroupBox {
|
||||
<widget class="QWidget" name="tetraTab">
|
||||
<attribute name="title">
|
||||
<string>Tetrahedron</string>
|
||||
</attribute>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>30</y>
|
||||
<width>477</width>
|
||||
<height>144</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QGroupBox {
|
||||
border: 1px solid gray;
|
||||
border-radius: 9px;
|
||||
margin-top: 0.5em;
|
||||
|
|
@ -783,87 +786,110 @@ QGroupBox::title {
|
|||
left: 10px;
|
||||
padding: 0 3px 0 3px;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_3" columnstretch="0,1">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="text">
|
||||
<string>P1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="tetP1">
|
||||
<property name="text">
|
||||
<string>1.0 0.0 0.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="tetP2">
|
||||
<property name="text">
|
||||
<string>0.0 1.0 0.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="tetP0">
|
||||
<property name="text">
|
||||
<string>0.0 0.0 0.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>P0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string>P2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_24">
|
||||
<property name="text">
|
||||
<string>P3</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="tetP3">
|
||||
<property name="text">
|
||||
<string>0.0 0.0 1.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_3" columnstretch="0,0">
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="tetP3">
|
||||
<property name="text">
|
||||
<string>0.0 0.0 1.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="text">
|
||||
<string>P1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>P0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string>P2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="tetP0">
|
||||
<property name="text">
|
||||
<string>0.0 0.0 0.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="tetP1">
|
||||
<property name="text">
|
||||
<string>1.0 0.0 0.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_24">
|
||||
<property name="text">
|
||||
<string>P3</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="tetP2">
|
||||
<property name="text">
|
||||
<string>0.0 1.0 0.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</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>
|
||||
</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>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
@ -1046,11 +1072,14 @@ QGroupBox::title {
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "https://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
<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" /><meta charset="utf-8" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; 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-size:10pt;"><br /></p></body></html></string>
|
||||
hr { height: 1px; border-width: 0; }
|
||||
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 name="overwriteMode">
|
||||
<bool>false</bool>
|
||||
|
|
@ -1094,11 +1123,14 @@ p, li { white-space: pre-wrap; }
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "https://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
<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" /><meta charset="utf-8" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; 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-size:10pt;"><br /></p></body></html></string>
|
||||
hr { height: 1px; border-width: 0; }
|
||||
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 name="overwriteMode">
|
||||
<bool>false</bool>
|
||||
|
|
|
|||
Loading…
Reference in New Issue