25 #include <qmessagebox.h>
29 #include <qpushbutton.h>
30 #include <qbuttongroup.h>
32 #include <QHBoxLayout>
33 #include <QGridLayout>
53 #define TR(id) OLocalizator::getString("TYBoundaryNoiseMapEditor", (id))
69 bool forceOpened =
false;
86 size_t nbPts = tabPts.size();
96 for (
size_t i = 0; i < nbPts; i++)
98 TYSegment seg1(tabPts[i], tabPts[(i + 1) % nbPts]);
99 for (
size_t j = 0; j < nbPts; j++)
101 TYSegment seg2(tabPts[j], tabPts[(j + 1) % nbPts]);
110 if ((i == nbPts - 1) || (j == nbPts - 1))
118 TR(
"id_msg_boundarynoisemap_invalid"));
131 pDlg->setWindowTitle(
TR(
"id_caption"));
133 QGridLayout* pLayout =
new QGridLayout();
134 pDlg->setLayout(pLayout);
136 QGridLayout* pEditLayout =
new QGridLayout();
137 pEditLayout->setContentsMargins(10, 10, 10, 10);
138 pLayout->addLayout(pEditLayout, 0, 0);
141 QDoubleSpinBox* pHeightSpinBox =
new QDoubleSpinBox();
142 pHeightSpinBox->setRange(-std::numeric_limits<double>::max(), std::numeric_limits<double>::max());
143 pHeightSpinBox->setCorrectionMode(QAbstractSpinBox::CorrectToNearestValue);
144 pHeightSpinBox->setFixedWidth(60);
145 pHeightSpinBox->setValue(2.0);
146 pEditLayout->addWidget(
new QLabel(
TR(
"id_height_label")), 0, 0);
147 pEditLayout->addWidget(pHeightSpinBox, 0, 1);
154 pEditLayout->addWidget(
new QLabel(
TR(
"id_thickness_label")), 1, 0);
158 QCheckBox* pClosedCheckBox =
new QCheckBox();
159 pClosedCheckBox->setChecked(
false);
162 pClosedCheckBox->setDisabled(
true);
164 pEditLayout->addWidget(
new QLabel(
TR(
"id_closed_label")), 2, 0);
165 pEditLayout->addWidget(pClosedCheckBox, 2, 1);
171 _pDensitySpinBox->setCorrectionMode(QAbstractSpinBox::CorrectToNearestValue);
172 pEditLayout->addWidget(
new QLabel(
TR(
"id_density_label")), 3, 0);
176 QBoxLayout* pGeomLayout =
new QVBoxLayout();
180 pLayout->addLayout(pGeomLayout, 1, 0);
182 QBoxLayout* pBtnLayout =
new QHBoxLayout();
183 pLayout->addLayout(pBtnLayout, 2, 0);
185 pBtnLayout->addStretch(1);
188 QPushButton* pButtonOK =
new QPushButton(
TR(
"id_ok_btn"), pDlg);
189 pButtonOK->setDefault(
true);
190 pBtnLayout->addWidget(pButtonOK);
193 QPushButton* pButtonCancel =
new QPushButton(
TR(
"id_cancel_btn"), pDlg);
194 pButtonCancel->setShortcut(Qt::Key_Escape);
195 pBtnLayout->addWidget(pButtonCancel);
198 void (QDoubleSpinBox::*_qDoubleSpinBox_valueChanged)(double) = &QDoubleSpinBox::valueChanged;
203 QObject::connect(pButtonOK, &QPushButton::clicked, pDlg, &QDialog::accept);
204 QObject::connect(pButtonCancel, &QPushButton::clicked, pDlg, &QDialog::reject);
211 int ret = pDlg->exec();
212 TYApplication::setOverrideCursor(Qt::WaitCursor);
214 if (ret == QDialog::Accepted)
227 TYApplication::restoreOverrideCursor();
246 pBoundaryNoiseMap->setCanBeClosed(!forceOpened);
255 pBoundaryNoiseMap->setHauteur(height);
256 pBoundaryNoiseMap->make(this->
getSavedPoints(), thickness, closed, density);
272 pBoundaryNoiseMap->updateGraphicTree();
282 std::numeric_limits<double>::max());
286 Qt::KeyboardModifiers state)
288 if ((button == Qt::LeftButton) &&
_active)
290 if (!
getTYApp()->getCurProjet() || !
getTYApp()->getCurProjet()->getCurrentCalcul())
295 QString msg(
TR(
"id_warning_no_curcalcul"));
297 QMessageBox::warning(
_pModeler,
"Tympan", msg, QMessageBox::Ok, QMessageBox::NoButton);
#define INTERS_NULLE
No intersection.
fichier contenant differents types d'actions (fichier header)
void writeOutputMsg(QString msg)
Affiche un message dans la fenetre de sortie.
TYApplication * getTYApp()
Retourne le pointeur sur l'application.
void writeDebugMsg(QString msg)
Affiche un message de debug dans la fenetre de sortie.
pour l'application Tympan (fichier header)
Creation of a TYBoundaryNoiseMap (header file)
TYGeometryNode TYBoundaryNoiseMapGeoNode
TYBoundaryNoiseMap geometry node.
std::vector< TYPoint > TYTabPoint
Collection de TYPoint.
Classe Modeler specialisee pour l'edition des sites (fichier header)
OPoint3D _ptA
Point A of the segment.
virtual int intersects(const OSegment3D &seg, OPoint3D &pt, double seuilConfondus) const
Return the intersection point with another segment.
OPoint3D _ptB
Point B of the segment.
void refreshProjectFrame()
Rafraichit l'arborescence du TYProjectFrame.
TYModelerFrame * _pModeler
Le modeler associe a cet editor.
void showText(bool show=true)
Affiche ou pas le texte informatif sur la vue 3D.
void addAction(TYAction *pAction)
Ajoute une nouvelle action a l'historique.
Definit une action, necessaire pour la gestion de l'undo.
void updateMinimumDensity(double thickness)
Update the minimum value of the density thanks to the new thickness value.
~TYBoundaryNoiseMapEditor()
QDoubleSpinBox * _pThicknessSpinBox
Thickness spin box.
TYBoundaryNoiseMapEditor(TYSiteModelerFrame *pModeler)
QDoubleSpinBox * _pDensitySpinBox
Density spin box.
void createPropertiesDlg(bool forceOpened)
Create the properties dialog that will pop up once the user finishes the polyline creation.
TabPointsWidget * _tabPtsW
Geometry description.
void endBoundaryNoiseMap()
Build a BoundaryNoiseMap from an array of points.
void dialogConfirmed(double height, double thickness, bool closed, double density, bool forceOpened)
When the user confirms the boundary noise map creation after the properties dialog pop up.
bool checkValidity(bool &forceOpened)
Return true if the polyline is valid and can be built. It also tells if the polyline should be opened...
virtual void slotMousePressed(int x, int y, Qt::MouseButton button, Qt::KeyboardModifiers state)
This class represents a polyline with a thickness. Acoustic receptors are sampled inside this region.
static double computeMinimumDensity(double thickness)
Return the minimum density to get a correct sampling.
static void setIsSavedOk(const bool &toSave)
TYRenderWindowInteractor * getView()
TYActionManager * getActionManager()
bool askForResetResultat()
virtual void updateView(bool clipping=true, bool axesAndGrid=true)
void updateDisplayList(void)
gestion de l'edition d'une polyligne
TYTabPoint & getSavedPoints()
bool _dispDist
Indique si l'information de distance doit etre affichee ou non.
bool _active
Indique si cet editor est actif.
classe de definition d'un projet.
bool addMaillage(LPTYMaillageGeoNode pMaillageGeoNode)
Ajout d'un maillage.
bool updateAltiMaillage(TYMaillageGeoNode *pMaillageGeoNode, const TYAltimetrie *pAlti)
Met a niveau l'altimetrie d'un maillage.
LPTYSiteNode getSite()
Get du site.
TYOpenGLRenderer * getRenderer()
Classe Modeler specialisee pour l'edition des sites.
LPTYAltimetrie getAltimetry() const