51 std::string err_msg (
"Asked to clone class ");
52 err_msg.append (className);
53 err_msg.append (
" which isn't registered in OPrototype.");
65 if (className == 0) {
return -1; }
106 if (_instances == NULL)
115 _bPutInInstanceList(true),
117 _inCurrentCalcul(true),
118 _isAcousticModified(true),
119 _isGeometryModified(true),
120 _pGraphicObject(nullptr),
180 TYElementContainer::const_iterator elt_it =
getInstances().find(uuid);
183 return elt_it->second;
187 uuid.toString().toUtf8().data());
210 bool was_registered =
false;
218 was_registered =
true;
241 if (pEl != pElem) {
return true; }
307 if (
getID() != other.
getID()) {
return false; }
322 if (!pOther) {
return false; }
338 copyTag = QString(
"Copie (%1) de :").arg(
_copyCount);
342 copyTag = QString(
"");
357 QStringList strLst =
_name.split(
':');
358 if (strLst.size() > 1)
376 QDomDocument domDoc = domElement.ownerDocument();
377 QDomElement domNewElem = domDoc.createElement(
getMetierName().data());
380 domNewElem.setAttribute(
"name",
_name);
382 domElement.appendChild(domNewElem);
390 if (tmpString.size() == 0)
434 if (recursparent && state)
447 if (childs.size() > 0)
450 bool onechildpresent =
false;
451 for (
int i = 0; i < childs.size(); i++)
453 onechildpresent = onechildpresent || (childs[i]->isInCurrentCalcul());
463 bool present =
false;
464 TYListID::iterator ite;
467 for (ite = listID.begin(); ite != listID.end(); ++ite)
469 if ((*ite) ==
getID())
484 for (
unsigned int i = 0; i < childs.size(); i++)
486 childs[i]->updateCurrentCalcul(listID, recursif);
492 void TYElement::drawGraphic(
bool draw)
496 if (getGraphicObject())
498 getGraphicObject()->setVisible(
true);
506 if (getGraphicObject())
508 getGraphicObject()->setVisible(
false);
513 void TYElement::updateGraphic()
515 if (getGraphicObject())
517 getGraphicObject()->update();
521 void TYElement::updateGraphicTree()
523 if (getGraphicObject())
525 getGraphicObject()->updateTree();
549 if (pRetVal) { retVal = *pRetVal; }
551 if (domElement.nodeName().compare(QString(
getMetierName().data())) == 0)
557 if (pRetVal) { *pRetVal = retVal; }
574 QDomNodeList childs = parentElem.childNodes();
577 for (
unsigned int i = 0; i < childs.length(); i++)
579 elemCur = childs.item(i).toElement();
582 QString nodeName = elemCur.nodeName();
595 if ((pElt !=
nullptr) && (strcmp(pElt->
getClassName(), type) == 0))
601 eltCollection.push_back(pElt);
604 return eltCollection;
624 return uuid.toString();
static uint64 ty_regen_id_counter
LPTYElementGraphic _pGraphicObject
L'object graphique metier associe a cet element.
std::map< TYUUID, TYElement * > TYElementContainer
The base exception class for errors due to invalid data.
static uint64 getConstructorCount()
static bool _toSave
Indicateur de modification. Passe a true si un TYElement a ete modifie, Indique la necessite de sauve...
static OPrototype * safeDownCast(OPrototype *pObject)
TYElement * _pParent
Reference sur l'element parent.
bool operator!=(const TYElement &other) const
virtual int fromXML(DOM_Element domElement)
virtual void setIsGeometryModified(bool isModified)
virtual void getChilds(LPTYElementArray &childs, bool recursif=true)
static TYElementContainer & getInstances()
std::vector< LPTYElement > LPTYElementArray
static TYElementContainer * _instances
Collection de toutes les instances de type TYElement et derivees.
static uint64 getDestructorCount()
static void add_factory(const char *, IOProtoFactory::ptr_type factory)
static void purgeInstances()
static bool _logInstances
Indique si on souhaite registrer toutes les instances de type TYElement et derivees.
TYElement & operator=(const TYElement &other)
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
void TYEditWidget
Declarations de types pour l'API IHM et l'Impression.
virtual std::string toString() const
bool operator==(const TYElement &other) const
bool _isGeometryModified
Indicateur de modification de la geometrie.
void setCopyCount(const unsigned int copyCount)
Modifie la vaeur du compteur.
const TYUUID & getID() const
void * _allUses
Multi purpose void pointer (use for compatibility actually)
bool isA(const char *className) const
static bool _bRegenerateID
Indicateur de regeneration d'ID true si regeneration d'ID a la lecture d'un fichier XML...
unsigned long long uint64
static OPrototype * findAndClone(const char *className)
TYElement * getParent() const
virtual DOM_Element toXML(DOM_Element &domElement)
static OMessageManager * get()
virtual void updateCurrentCalcul(TYListID &listID, bool recursif=true)
virtual void setIsAcousticModified(bool isModified)
QString _name
Nom courant de l'element.
static TYElement * getInstance(TYUUID uuid)
boost::error_info< struct tag_classname, std::string > oproto_classname_errinfo
static std::unordered_map< std::string, IOProtoFactory::ptr_type > _factory_map
bool callFromXMLIfEqual(DOM_Element &domElement, int *pRetVal=NULL)
virtual const char * getClassName() const
TYUUID _uuid
Identifiant unique de l'element.
static bool testId(const TYUUID &id, const TYElement *pElem)
static int findPrototype(const char *className)
void OnChildInCalculStatusChange()
virtual void error(const char *message,...)
static LPTYElementArray findTypeCollectionAndCallFromXML(DOM_Element parentElem, const char *type)
std::list< TYUUID > TYListID
Collection d'identifiants.
bool _isAcousticModified
Indicateur de modification acoustique.
void setElement(TYElement *pElt)
void setModified(bool modified=true)
#define tympan_source_loc
This macro build a source_loc object to be attached to a tympan::Exception.
virtual void setInCurrentCalcul(bool state, bool recurschild=true, bool recursparent=true)
static uint64 ty_created_counter
std::unique_ptr< IOProtoFactory > ptr_type
static uint64 getIdGenerationCount()
bool _inCurrentCalcul
Indique si cet element est actif dans le Calcul courant.
static TYUUID fromString(QString id)
std::string getMetierName()
static uint64 ty_destroyed_counter