43 std::string err_msg(
"Asked to clone class ");
44 err_msg.append(className);
45 err_msg.append(
" which isn't registered in OPrototype.");
106 : _pParent(nullptr), _bPutInInstanceList(true), _copyCount(0), _inCurrentCalcul(true),
107 _isAcousticModified(true), _isGeometryModified(true), _pGraphicObject(nullptr), _allUses(nullptr)
117 : _pParent(pParent), _bPutInInstanceList(PutInInstanceList), _copyCount(0), _inCurrentCalcul(true),
118 _isAcousticModified(true), _isGeometryModified(true), _pGraphicObject(nullptr), _allUses(nullptr)
129 : _bPutInInstanceList(PutInInstanceList)
160 TYElementContainer::const_iterator elt_it =
getInstances().find(uuid);
163 return elt_it->second;
189 bool was_registered =
false;
197 was_registered =
true;
332 copyTag = QString(
"Copie (%1) de :").arg(
_copyCount);
336 copyTag = QString(
"");
351 QStringList strLst =
_name.split(
':');
352 if (strLst.size() > 1)
370 QDomDocument domDoc = domElement.ownerDocument();
371 QDomElement domNewElem = domDoc.createElement(
getMetierName().data());
374 domNewElem.setAttribute(
"name",
_name);
376 domElement.appendChild(domNewElem);
384 if (tmpString.size() == 0)
430 if (recursparent && state)
446 if (childs.size() > 0)
449 bool onechildpresent =
false;
450 for (
int i = 0; i < childs.size(); i++)
452 onechildpresent = onechildpresent || (childs[i]->isInCurrentCalcul());
462 bool present =
false;
463 TYListID::iterator ite;
466 for (ite = listID.begin(); ite != listID.end(); ++ite)
468 if ((*ite) ==
getID())
483 for (
unsigned int i = 0; i < childs.size(); i++)
485 childs[i]->updateCurrentCalcul(listID, recursif);
491 void TYElement::drawGraphic(
bool draw)
495 if (getGraphicObject())
497 getGraphicObject()->setVisible(
true);
505 if (getGraphicObject())
507 getGraphicObject()->setVisible(
false);
512 void TYElement::updateGraphic()
514 if (getGraphicObject())
516 getGraphicObject()->update();
520 void TYElement::updateGraphicTree()
522 if (getGraphicObject())
524 getGraphicObject()->updateTree();
553 if (domElement.nodeName().compare(QString(
getMetierName().data())) == 0)
579 QDomNodeList childs = parentElem.childNodes();
582 for (
unsigned int i = 0; i < childs.length(); i++)
584 elemCur = childs.item(i).toElement();
587 QString nodeName = elemCur.nodeName();
603 if ((pElt !=
nullptr) && (strcmp(pElt->
getClassName(), type) == 0))
609 eltCollection.push_back(pElt);
612 return eltCollection;
631 return uuid.toString();
void TYEditWidget
Declarations de types pour l'API IHM et l'Impression.
std::list< TYUUID > TYListID
Collection d'identifiants.
std::vector< LPTYElement > LPTYElementArray
std::map< TYUUID, TYElement * > TYElementContainer
virtual void error(const char *message,...)
static OMessageManager * get()
std::unique_ptr< IOProtoFactory > ptr_type
static std::unordered_map< std::string, IOProtoFactory::ptr_type > _factory_map
static void add_factory(const char *, IOProtoFactory::ptr_type factory)
static int findPrototype(const char *className)
virtual const char * getClassName() const
static OPrototype * safeDownCast(OPrototype *pObject)
static OPrototype * findAndClone(const char *className)
bool isA(const char *className) const
void setModified(bool modified=true)
void setElement(TYElement *pElt)
static uint64 ty_regen_id_counter
static TYElementContainer & getInstances()
TYElement * getParent() const
static bool _logInstances
Indique si on souhaite registrer toutes les instances de type TYElement et derivees.
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
TYUUID _uuid
Identifiant unique de l'element.
virtual DOM_Element toXML(DOM_Element &domElement)
void setCopyCount(const unsigned int copyCount)
Modifie la vaeur du compteur.
std::string getMetierName()
bool _isGeometryModified
Indicateur de modification de la geometrie.
QString _name
Nom courant de l'element.
bool operator==(const TYElement &other) const
static void purgeInstances()
TYElement & operator=(const TYElement &other)
static TYUUID fromString(QString id)
void OnChildInCalculStatusChange()
static uint64 getConstructorCount()
bool callFromXMLIfEqual(DOM_Element &domElement, int *pRetVal=NULL)
static bool testId(const TYUUID &id, const TYElement *pElem)
static uint64 getIdGenerationCount()
bool _isAcousticModified
Indicateur de modification acoustique.
static uint64 getDestructorCount()
const TYUUID & getID() const
bool operator!=(const TYElement &other) const
void * _allUses
Multi purpose void pointer (use for compatibility actually)
virtual std::string toString() const
TYElement * _pParent
Reference sur l'element parent.
virtual void updateCurrentCalcul(TYListID &listID, bool recursif=true)
LPTYElementGraphic _pGraphicObject
L'object graphique metier associe a cet element.
virtual void setInCurrentCalcul(bool state, bool recurschild=true, bool recursparent=true)
virtual void getChilds(LPTYElementArray &childs, bool recursif=true)
static TYElementContainer * _instances
Collection de toutes les instances de type TYElement et derivees.
bool _inCurrentCalcul
Indique si cet element est actif dans le Calcul courant.
static LPTYElementArray findTypeCollectionAndCallFromXML(DOM_Element parentElem, const char *type)
virtual int fromXML(DOM_Element domElement)
virtual void setIsAcousticModified(bool isModified)
static uint64 ty_destroyed_counter
static uint64 ty_created_counter
static TYElement * getInstance(TYUUID uuid)
static bool _bRegenerateID
Indicateur de regeneration d'ID true si regeneration d'ID a la lecture d'un fichier XML.
virtual void setIsGeometryModified(bool isModified)
Utilities to handle exceptions and to pretty-print value.
#define tympan_source_loc
This macro build a source_loc object to be attached to a tympan::Exception.
unsigned long long uint64
boost::error_info< struct tag_classname, std::string > oproto_classname_errinfo
The base exception class for errors due to invalid data.