Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5252 in orxonox.OLD for trunk


Ignore:
Timestamp:
Sep 25, 2005, 1:16:41 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: reverted changes to the Element2D-class, they are not needed

Location:
trunk/src/lib/graphics/render2D
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/render2D/element_2d.cc

    r5251 r5252  
    3636/**
    3737 * standard constructor
    38  * @param parent the Parent of this node (default NULL)
    39  */
     38 * @todo this constructor is not jet implemented - do it
     39*/
    4040Element2D::Element2D (Element2D* parent)
    4141{
     
    4848/**
    4949 * standard deconstructor
    50  */
     50*/
    5151Element2D::~Element2D ()
    5252{
     
    5454  Render2D::getInstance()->unregisterElement2D(this);
    5555
    56   this->remove2D();
    57 //   else
    58 //   {
    59 //     tIterator<Element2D>* iterator = this->children->getIterator();
    60 //     Element2D* pn = iterator->firstElement();
    61 //     while( pn != NULL)
    62 //     {
    63 //       delete pn;
    64 //       pn = iterator->nextElement();
    65 //     }
    66 //     delete iterator;
    67 //     /* this deletes all children in the list */
    68 //   }
     56  if (this->parent)
     57    this->parent->removeChild2D(this);
     58  else
     59  {
     60    tIterator<Element2D>* iterator = this->children->getIterator();
     61    Element2D* pn = iterator->firstElement();
     62    while( pn != NULL)
     63    {
     64      delete pn;
     65      pn = iterator->nextElement();
     66    }
     67    delete iterator;
     68    /* this deletes all children in the list */
     69  }
    6970  delete this->children;
    7071
     
    8990  this->bindNode = NULL;
    9091
    91   // PNODE-stuff
     92  this->setParentMode2D(E2D_PARENT_ALL);
     93  this->parent = NULL;
    9294  this->children = new tList<Element2D>;
    93   this->setParentMode2D(E2D_PARENT_ALL);
    94   if (NullElement2D::isInstanciated())
    95   {
    96     this->parent = NullElement2D::getInstance();
    97     NullElement2D::getInstance()->children->add(this);
    98     NullElement2D::getInstance()->debug(0);
    99   }
    100   else
    101     this->parent = NULL;
    10295  this->absDirection = 0.0;
    10396  this->relDirection = 0.0;
     
    449442  if( likely(child->parent != NULL))
    450443  {
     444    PRINTF(4)("Element2D::addChild() - reparenting node: removing it and adding it again\n");
    451445    child->parent->children->remove(child);
    452446  }
     
    511505void Element2D::setParent2D (Element2D* parent)
    512506{
    513   if (parent != NULL)
    514     parent->addChild2D(this);
     507  parent->addChild2D(this);
    515508}
    516509
     
    524517  if (parentNode != NULL)
    525518    parentNode->addChild2D(this);
     519
    526520}
    527521
  • trunk/src/lib/graphics/render2D/element_2d.h

    r5251 r5252  
    218218  public:
    219219    /** @returns a Pointer to the only object of this Class */
    220     inline static NullElement2D* getInstance() { if (!NullElement2D::singletonRef) NullElement2D::singletonRef = new NullElement2D();  return NullElement2D::singletonRef; };
    221     inline static bool isInstanciated() { return (likely(NullElement2D::singletonRef != NULL))?true:false; };
     220    inline static NullElement2D* getInstance() { if (!singletonRef) singletonRef = new NullElement2D();  return singletonRef; };
    222221    virtual ~NullElement2D ();
    223222
Note: See TracChangeset for help on using the changeset viewer.