19 #include <boost/math/special_functions/fpclassify.hpp>
37 return !boost::math::isnan(decli);
45 float r = 80.0f, g = 80.0f, b = 80.0f;
127 if (TYAcousticLine::operator!=(other))
170 const TYRoute* pOtherRoute =
dynamic_cast<const TYRoute*
>(pOther);
171 assert(pOtherRoute &&
"Invalid cast to TYRoute*");
194 domNewElem.setAttribute(
"surfaceType",
road_traffic.surfaceType);
196 domNewElem.setAttribute(
"surfaceAge",
road_traffic.surfaceAge);
216 s = domElement.attribute(
"surfaceType", QString());
223 unsigned surfType =
s.toUInt(&ok);
230 road_traffic.surfaceType =
static_cast<RoadSurfaceType
>(surfType);
233 s = domElement.attribute(
"ramp", QString());
240 double tmp_d =
s.toDouble(&ok);
244 "Floating point number expected for attribute `ramp` on element %s, not %s",
251 s = domElement.attribute(
"surfaceAge", QString());
258 tmp_d =
s.toUInt(&ok);
268 QDomNodeList children = domElement.elementsByTagName(
"Trafic");
272 "%u TYTrafic child elements were found but %u were expected",
279 QDomElement elem = children.item(i).toElement();
307 double* tab =
nullptr;
324 return s_one_way.
sumdB(s_other_way);
337 double* XTemp =
new double[nbPoint];
345 double sommeXZ = 0.0;
349 for (i = 1; i < nbPoint; i++)
352 moy_x = moy_x + XTemp[i];
356 moy_x = moy_x / nbPoint;
357 moy_z = moy_z / nbPoint;
360 for (i = 0; i < nbPoint; i++)
362 X = (XTemp[i] - moy_x) * (XTemp[i] - moy_x);
366 sommeXZ = sommeXZ + sqrt(X * Z);
372 return sommeXZ / sommeX;
422 assert(pGeoNode->getElement() ==
static_cast<TYElement*
>(
this) &&
423 "Inconsistent arguments : the geoNode passed must point on `this` !");
426 const OMatrix& matrix = globalMatrix * pGeoNode->getMatrix();
430 double hauteur = pGeoNode->getHauteur();
434 for (
size_t i = 0; i < this->
getTabPoint().size(); i++)
463 assert(pGeoNode->getElement() ==
static_cast<TYElement*
>(
this) &&
464 "Inconsistent arguments : the geoNode passed must point on `this` !");
469 const OMatrix& matrix = globalMatrix * pGeoNode->getMatrix();
472 double hauteur = pGeoNode->getHauteur();
486 *pSrc->
getPos() = matrixinv * pt;
496 const RoadTrafficComponent&
577 static bool inline is_in(
double val,
double min,
double max)
579 return min <= val && val <= max;
587 double min = NAN, max = NAN;
593 const double aadt_total = aadt_lv + aadt_hgv;
595 const double hgv_percent = aadt_hgv / aadt_total * 100;
599 bool ok_total = is_in(aadt_total,
min, max);
600 if (out_msg && !ok_total)
601 out_msg->append(QString::fromUtf8(
"TMJA total (%1 v/j) invalide : "
602 "doit être entre %2 et %3 v/j.\n")
609 bool ok_hgv = is_in(aadt_hgv,
min, max);
610 if (out_msg && !ok_hgv)
611 out_msg->append(QString::fromUtf8(
"TMJA poids-lourds (%1 v/j) invalide : "
612 "doit être entre %2 et %3 v/j.\n")
619 bool ok_percent = is_in(hgv_percent,
min, max);
620 if (out_msg && !ok_percent)
621 out_msg->append(QString::fromUtf8(
"Proportion de poids-lourds (%1%) invalide : "
622 "doit être entre %2% et %3%.\n")
627 return ok_total && ok_hgv && ok_percent;
642 traffic_lv.trafficFlow =
645 traffic_hgv.trafficFlow =
673 road.accessRoadTrafficComponent(regime, vehicle_type).trafficFlow *= 2.0;
676 road.road_traffic.ramp = std::fabs(road.road_traffic.ramp);
701 double flow,
double speed, RoadFlowType type)
704 rtc.trafficFlow = flow;
705 rtc.trafficSpeed = speed;
const char * str_qt2c(const QString &qstr)
#define TYDIRPREFERENCEMANAGER
Representation graphique d'une route (fichier header)
TY_EXT_GRAPHIC_INST(TYRoute)
TY_EXTENSION_INST(TYRoute)
double _z
z coordinate of OCoord3D
OMatrix getInvert(int *ok=0) const
Return the inverse matrix of this matrix.
virtual void error(const char *message,...)
static OMessageManager * get()
virtual const char * getClassName() const
void setType(TYSpectreType type)
Set the spectrum type.
OSpectreAbstract & sumdB(const OSpectreAbstract &spectre) const
Energetic sum of two spectrums.
TYTabPoint & getTabPoint()
virtual int addRegime(TYRegime regime)
TYTabRegimes _tabRegimes
Tableau des regimes.
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
virtual void computeSpectre()
virtual int fromXML(DOM_Element domElement)
LPTYSourceLineic _pSrcLineic
Source Lineique.
virtual TYRegime buildRegime()
bool _regimeChangeAble
Indique si on peut ajouter un regime a un element (cas des routes)
TYAcousticLine & operator=(const TYAcousticLine &other)
Operateur =.
int _typeDistribution
Indique le type de distribution a utiliser. pour l'etat courant.
virtual void distriSrcs()
virtual DOM_Element toXML(DOM_Element &domElement)
TYTabPoint _tabPoint
Tableau des points.
Assigne une altitude a chaque point de l'espace.
bool updateAltitude(OPoint3D &pt) const
Modifie l'altitude d'un point donn�. Si le point est hors de la zone dans laquelle l'altim�trie e...
virtual void setColor(const OColor &color)
QString _name
Nom courant de l'element.
void setParent(TYElement *pParent)
QString getStringID() const
virtual void setIsGeometryModified(bool isModified)
QString generateName(const char *classname)
Retourne le nom de la classe associe a un nombre.
static TYNameManager * get()
Retourne l'instance singleton.
This helper class halves and restore the traffic flow of the road.
TrafficHalfer(TYRoute &road)
virtual std::string toString() const
bool computed_declivity
If true, the mean declivity of the read is computed from the altimetry.
bool operator==(const TYRoute &other) const
Operateur ==.
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
RoadTrafficComponent & accessRoadTrafficComponent(enum TrafficRegimes regime, enum TYTrafic::VehicleTypes vehic_type)
virtual void distriSrcs()
static const note77_tables note77_hourly_HGV_coeff
static const note77_tables note77_upper_bounds
void updateComputedDeclivity()
update the mean declivity from the current source distribution.
double note77_tables[2][2][3]
static bool is_valid_declivity(double decli)
Check that the declivity is valid, i.e. is not undefined_declivity.
double ramp() const
Getter for the ramp in percent ( > 0 if rise, < 0 if down)
void setSurfaceAge(double age)
Setter for the surface age.
static const double undefined_declivity
virtual bool updateAltitudes(const TYAltimetrie &alti, LPTYRouteGeoNode pGeoNode, OMatrix globalMatrix)
Required the road to update its altitude after altimetry changed.
bool setFromAADT(double aadt_hgv, double aadt_lv, RoadType road_type, RoadFunction road_function, QString *out_msg=NULL)
Apply Note77 from Setra to estimate trafic from AADT and road kind.
TYRoute & operator=(const TYRoute &other)
Operateur =.
const RoadTrafficComponent & getNMPB08RoadTrafficComponent(enum TrafficRegimes regime, enum TYTrafic::VehicleTypes vehic_type) const
void setSurfaceType(RoadSurfaceType type)
Setter for the road surface type.
void setRoadTrafficComponent(enum TrafficRegimes regime, enum TYTrafic::VehicleTypes vehic_type, double flow, double speed, RoadFlowType type=FlowType_CONST)
Set the traffic parameter for a given regime and type of vehicles.
void setRamp(double ramp)
Setter for the ramp in percent ( > 0 if rise, < 0 if down)
static bool note77_check_validity(double aadt_hgv, double aadt_lv, RoadType road_type, RoadFunction road_function, QString *out_msg=NULL)
Check the validity domain of AADT for Note 77.
TYTrafic traffic_regimes[NB_TRAFFIC_REGIMES]
virtual DOM_Element toXML(DOM_Element &domElement)
static const note77_tables note77_hourly_LV_coeff
static const note77_tables note77_lower_bounds
virtual bool updateAcoustic(const bool &force=false)
void setRoadTrafficArrayForRegime(enum TrafficRegimes regime)
internally set the RoadTraffic's array of RoadTrafficComponents according to the given regime.
bool operator!=(const TYRoute &other) const
Operateur !=.
double calculPenteMoyenne()
Calcul de la pente moyenne de la route.
virtual int fromXML(DOM_Element domElement)
const RoadTraffic & getNMBP08RoadTraffic(enum TrafficRegimes regime)
LPTYSourcePonctuelle getSrc(int index)
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
RoadTrafficComponent arr[NB_VEHICLE_TYPES]
virtual DOM_Element toXML(DOM_Element &domElement)
virtual int fromXML(DOM_Element domElement)