25 #include <qmessagebox.h>
29 #include <qpushbutton.h>
30 #include <qbuttongroup.h>
32 #include <QHBoxLayout>
33 #include <QGridLayout>
54 #define TR(id) OLocalizator::getString("TYBoundaryNoiseMapEditor", (id))
70 bool forceOpened =
false;
87 size_t nbPts = tabPts.size();
97 for (
size_t i = 0; i < nbPts; i++)
99 TYSegment seg1(tabPts[i], tabPts[(i + 1) % nbPts]);
100 for (
size_t j = 0; j < nbPts; j++)
102 TYSegment seg2(tabPts[j], tabPts[(j + 1) % nbPts]);
111 if ((i == nbPts - 1) || (j == nbPts - 1))
119 TR(
"id_msg_boundarynoisemap_invalid"));
132 pDlg->setWindowTitle(
TR(
"id_caption"));
134 QGridLayout* pLayout =
new QGridLayout();
135 pDlg->setLayout(pLayout);
137 QGridLayout* pEditLayout =
new QGridLayout();
138 pEditLayout->setContentsMargins(10, 10, 10, 10);
139 pLayout->addLayout(pEditLayout, 0, 0);
143 pHeightSpinBox->setRange(-std::numeric_limits<double>::max(), std::numeric_limits<double>::max());
144 pHeightSpinBox->setCorrectionMode(QAbstractSpinBox::CorrectToNearestValue);
145 pHeightSpinBox->setFixedWidth(60);
146 pHeightSpinBox->setValue(2.0);
147 pEditLayout->addWidget(
new QLabel(
TR(
"id_height_label")), 0, 0);
148 pEditLayout->addWidget(pHeightSpinBox, 0, 1);
155 pEditLayout->addWidget(
new QLabel(
TR(
"id_thickness_label")), 1, 0);
159 QCheckBox* pClosedCheckBox =
new QCheckBox();
160 pClosedCheckBox->setChecked(
false);
163 pClosedCheckBox->setDisabled(
true);
165 pEditLayout->addWidget(
new QLabel(
TR(
"id_closed_label")), 2, 0);
166 pEditLayout->addWidget(pClosedCheckBox, 2, 1);
173 pEditLayout->addWidget(
new QLabel(
TR(
"id_distance_label")), 3, 0);
177 QBoxLayout* pGeomLayout =
new QVBoxLayout();
181 pLayout->addLayout(pGeomLayout, 1, 0);
183 QBoxLayout* pBtnLayout =
new QHBoxLayout();
184 pLayout->addLayout(pBtnLayout, 2, 0);
186 pBtnLayout->addStretch(1);
189 QPushButton* pButtonOK =
new QPushButton(
TR(
"id_ok_btn"), pDlg);
190 pButtonOK->setDefault(
true);
191 pBtnLayout->addWidget(pButtonOK);
194 QPushButton* pButtonCancel =
new QPushButton(
TR(
"id_cancel_btn"), pDlg);
195 pButtonCancel->setShortcut(Qt::Key_Escape);
196 pBtnLayout->addWidget(pButtonCancel);
199 void (QDoubleSpinBox::*_qDoubleSpinBox_valueChanged)(double) = &QDoubleSpinBox::valueChanged;
204 QObject::connect(pButtonOK, &QPushButton::clicked, pDlg, &QDialog::accept);
205 QObject::connect(pButtonCancel, &QPushButton::clicked, pDlg, &QDialog::reject);
212 int ret = pDlg->exec();
213 TYApplication::setOverrideCursor(Qt::WaitCursor);
215 if (ret == QDialog::Accepted)
228 TYApplication::restoreOverrideCursor();
247 pBoundaryNoiseMap->setCanBeClosed(!forceOpened);
256 pBoundaryNoiseMap->setHauteur(height);
257 pBoundaryNoiseMap->make(this->
getSavedPoints(), thickness, closed, 1.0f / distance);
273 pBoundaryNoiseMap->updateGraphicTree();
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()
TYBoundaryNoiseMapEditor(TYSiteModelerFrame *pModeler)
TYDoubleSpinBox * _pDistanceSpinBox
Density spin box.
void createPropertiesDlg(bool forceOpened)
Create the properties dialog that will pop up once the user finishes the polyline creation.
TYDoubleSpinBox * _pThicknessSpinBox
Thickness spin box.
TabPointsWidget * _tabPtsW
Geometry description.
void endBoundaryNoiseMap()
Build a BoundaryNoiseMap from an array of points.
bool checkValidity(bool &forceOpened)
Return true if the polyline is valid and can be built. It also tells if the polyline should be opened...
void dialogConfirmed(double height, double thickness, bool closed, double distance, bool forceOpened)
When the user confirms the boundary noise map creation after the properties dialog pop up.
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 invalidateScene(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