Developer Documentation
BaseObject.cc
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41 
42 
43 //=============================================================================
44 //
45 // MyTypes
46 //
47 //=============================================================================
48 
49 
50 //== INCLUDES =================================================================
51 
52 #include "BaseObjectCore.hh"
53 #include "Types.hh"
54 #include <OpenFlipper/BasePlugin/PluginFunctionsCore.hh>
56 
57 #include <QJsonDocument>
58 #include <QJsonObject>
59 
60 
61 //== TYPEDEFS =================================================================
62 
63 //== Variables =================================================================
64 
65 //== CLASS DEFINITION =========================================================
66 
70 static int idGenerator = 1;
71 
75 int BaseObject::NOOBJECT = -1;
76 
78  QObject(),
79  id_(idGenerator),
80  persistentId_(_object.persistentId_),
81  objectType_(_object.objectType_),
82  flags_(_object.flags_),
83  visible_(_object.visible_),
84  parentItem_(0),
85  path_("."),
86  filename_(""),
87  commentsByKey_(_object.commentsByKey_)
88 
89 {
90  // Increase id generator as we created a new object
91  ++idGenerator;
92 
93  // Generate a usable name based on the copied object
94  name_ = "Copy of " + _object.name_;
95 
96  childItems_.clear();
97  dataMap_.clear();
98 
99  // Iterate over all per Object datas and try to copy them
100  QMap< QString, PerObjectData* >::const_iterator mapIter = _object.dataMap_.begin();
101  while ( mapIter != _object.dataMap_.end() ) {
102  // Try to get a copy of the object.
103  PerObjectData* copiedData = mapIter.value()->copyPerObjectData();
104 
105  if ( copiedData ) {
106  dataMap_.insert(mapIter.key(),copiedData);
107  } else {
108  std::cerr << "Failed to copy per Object Data: " << mapIter.key().toStdString() << std::endl;
109  }
110 
111  ++mapIter;
112  }
113 
114  // If the pointer is 0 then we are creating the object root
115  // and we do not have anything to attach this object to
116  // otherwise, we attach the new object to the object root
117  if ( PluginFunctions::objectRoot() ) {
118 
121 
122  // New object
124 
125  // If the new one is target, we also have to track this
126  if ( target() )
128  }
129 
130  // Add object to object container
131  PluginFunctions::addObjectToMap( id(), this );
132 
133  getObjectManager()->objectCreated(id());
134 }
135 
137  QObject() ,
138  id_(-1),
139  persistentId_(-1),
141  flags_(),
142  visible_(true),
143  parentItem_(_parent),
144  name_("NONAME")
145 {
146  id_ = idGenerator;
147  ++ idGenerator;
148 
149  // If the pointer is 0 then something went wrong or we are the root node
150  if ( _parent ) {
151 
152  _parent->appendChild(this);
154 
155  } else {
156 
157  if ( PluginFunctions::objectRoot() ) {
161  }
162 
163  }
164 
165  // Add object to object container
166  PluginFunctions::addObjectToMap( id(), this );
167 
168  getObjectManager()->objectCreated(id());
169 }
170 
171 
172 BaseObject::~BaseObject() {
173 
174  deleteData();
175 
177 
178  if ( target() )
180 
181  getObjectManager()->objectDeleted(id());
182 
183 }
184 
185 
186 // ===============================================================================
187 // Object Identification
188 // ===============================================================================
189 
190 int BaseObject::id() const {
191  return id_;
192 }
193 
195  return persistentId_;
196 }
197 
198 void BaseObject::persistentId( int _id ) {
199  persistentId_ = _id;
200 }
201 
202 
203 // ===============================================================================
204 // Data
205 // ===============================================================================
206 
208  persistentId_ = -1;
209  path_ = ".";
210  flags_.clear();
211 
212  visible_ = true;
213  name_ = "NONAME";
214  filename_ = "";
215 }
216 
217 // ===============================================================================
218 // Data Type Handling
219 // ===============================================================================
220 
221 bool BaseObject::dataType(DataType _type) const {
222  if ( _type == DATA_ALL ) {
223  return true;
224  }
225 
226  return ( objectType_ & _type);
227 }
228 
231 }
232 
234  if ( objectType_ != DATA_UNKNOWN )
235  std::cerr << "BaseObect : overwriting data type" << std::endl;
236  objectType_ = _type;
237 }
238 
239 // ===============================================================================
240 // Object Information
241 // ===============================================================================
242 
243 
245  QString output;
246 
247  output += "Info for Object with id " + QString::number(id()) +"\n";
248  output += "Object is : ";
249  if ( target() )
250  output += "target ";
251  if ( source() )
252  output += " source";
253 
254  if ( visible() )
255  output += " visible";
256  else
257  output += " invisible";
258 
259  output +="\n";
260 
261  return output;
262 }
263 
265  std::cout << getObjectinfo().toStdString();
266 }
267 
268 
269 // ===============================================================================
270 // flag Handling
271 // ===============================================================================
272 
274  return flag("target");
275 }
276 
277 void BaseObject::target(bool _target) {
278 
279  if ( target() != _target ) {
280 
281  if ( _target )
283  else
285  }
286 
287  setFlag("target", _target);
288 
289 }
290 
292  return flag("source");
293 }
294 
295 void BaseObject::source(bool _source) {
296  setFlag("source", _source);
297 }
298 
299 bool BaseObject::flag(QString _flag)
300 {
301  return flags_.contains(_flag);
302 }
303 
304 void BaseObject::setFlag(QString _flag, bool _set)
305 {
306  bool emitted = false;
307 
308  if (flags_.contains(_flag))
309  {
310  if (!_set) {
311  flags_.removeAll(_flag);
312  emit objectSelectionChanged(id());
313  emitted = true;
314  }
315  }
316  else
317  {
318  if (_set) {
319  flags_ << _flag;
320  emit objectSelectionChanged(id());
321  emitted = true;
322  }
323  }
324 
325  //always emit if its a group
326  if ( !emitted && isGroup() )
327  emit objectSelectionChanged(id());
328 }
329 
330 QStringList BaseObject::flags()
331 {
332  return flags_;
333 }
334 
335 // ===============================================================================
336 // Object visualization
337 // ===============================================================================
338 
340  return visible_;
341 }
342 
343 void BaseObject::visible(bool _visible) {
344  // Only do something if this is really a change
345  if ( visible_ != _visible ) {
346  visible_ = _visible;
347 
348  emit visibilityChanged( id() );
349 
350  } else {
351 
352  //always emit if its a group
353  if ( isGroup() )
354  emit visibilityChanged( id() );
355  }
356 }
357 
358 // ===============================================================================
359 // ===============================================================================
360 // Tree Structure :
361 // ===============================================================================
362 // ===============================================================================
363 
365  //indexOf
366 
367 // // Visit child item of this node
368 // if ( childItems_.size() > 0 ) {
369 // return childItems_[0];
370 // }
371 //
372 // // No Child Item so visit the next child of the parentItem_
373 // if ( parentItem_ ) {
374 //
375 // BaseObject* parentPointer = parentItem_;
376 // BaseObject* thisPointer = this;
377 //
378 // // while we are not at the root node
379 // while ( parentPointer ) {
380 //
381 // // If there is an unvisited child of the parent, return this one
382 // if ( parentPointer->childCount() > ( thisPointer->row() + 1) ) {
383 // return parentPointer->childItems_[ thisPointer->row() + 1 ];
384 // }
385 //
386 // // Go to the next level
387 // thisPointer = parentPointer;
388 // parentPointer = parentPointer->parentItem_;
389 //
390 // }
391 //
392 // return thisPointer;
393 // }
394 //
395 // return this;
396  std::cerr << "Last not implemented yet! " << std::endl;
397  return 0;
398 
399 }
400 
401 // ===============================================================================
402 // ===============================================================================
403 
405  // Visit child item of this node
406  if ( childItems_.size() > 0 ) {
407  return childItems_[0];
408  }
409 
410  // No Child Item so visit the next child of the parentItem_
411  if ( parentItem_ ) {
412 
413  BaseObject* parentPointer = parentItem_;
414  BaseObject* thisPointer = this;
415 
416  // while we are not at the root node
417  while ( parentPointer ) {
418 
419  // If there is an unvisited child of the parent, return this one
420  int nextIndex = ( thisPointer->row() + 1);
421  if ( parentPointer->childCount() > nextIndex ) {
422  return parentPointer->childItems_[ nextIndex ];
423  }
424 
425  // Go to the next level
426  thisPointer = parentPointer;
427  parentPointer = parentPointer->parentItem_;
428 
429  }
430 
431  return thisPointer;
432  }
433 
434  return this;
435 
436 }
437 
438 // ===============================================================================
439 // ===============================================================================
440 
442  int level = 0;
443  BaseObject* current = this;
444 
445  // Go up and count the levels to the root node
446  while ( current->parent() != 0 ) {
447  level++;
448  current = current->parent();
449  }
450 
451  return level;
452 }
453 
454 // ===============================================================================
455 // Parent
456 // ===============================================================================
457 
458 int BaseObject::row() const
459 {
460  if (parentItem_)
461  return parentItem_->childItems_.indexOf(const_cast<BaseObject*>(this));
462 
463  return 0;
464 }
465 
467 {
468  return parentItem_;
469 }
470 
472 {
473  return parentItem_;
474 }
475 
478  // remove this child from the old parents list
479  if ( parentItem_ != 0 ) {
480  parentItem_->removeChild(this);
481 
482  if ( !_parent->childItems_.contains(this) )
483  _parent->appendChild(this);
484  }
485 
486  // Store new parent
487  parentItem_ = _parent;
488 
489  // Tell other plugins about this change
490  emit objectPropertiesChanged(id());
491 }
492 
493 
494 // ===============================================================================
495 // Children
496 // ===============================================================================
497 
499 {
500  if ( !childItems_.contains(item) )
501  childItems_.append(item);
502  else
503  std::cerr << "Warning! Trying to append a child twice! Remove the append calls from your File plugin!" << std::endl;
504 }
505 
507 {
508  return childItems_.value(row);
509 }
510 
512 {
513  return childItems_.count();
514 }
515 
517 
518  // Check if this object has the requested id
519  if ( id_ == _objectId )
520  return this;
521 
522  // search in children
523  for ( int i = 0 ; i < childItems_.size(); ++i ) {
524  BaseObject* tmp = childItems_[i]->childExists(_objectId);
525  if ( tmp != 0)
526  return tmp;
527  }
528 
529  return 0;
530 }
531 
533 
534  // Check if this object has the requested id
535  if ( name() == _name )
536  return this;
537 
538  // search in children
539  for ( int i = 0 ; i < childItems_.size(); ++i ) {
540  BaseObject* tmp = childItems_[i]->childExists(_name);
541  if ( tmp != 0)
542  return tmp;
543  }
544 
545  return 0;
546 }
547 
549 
550  bool found = false;
551  QList<BaseObject*>::iterator i;
552  for (i = childItems_.begin(); i != childItems_.end(); ++i) {
553  if ( *i == _item ) {
554  found = true;
555  break;
556  }
557  }
558 
559  if ( !found ) {
560  std::cerr << "Illegal remove request" << std::endl;
561  return;
562  }
563 
564  childItems_.erase(i);
565 }
566 
567 QList< BaseObject* > BaseObject::getLeafs() {
568 
569  QList< BaseObject* > items;
570 
571  for ( int i = 0 ; i < childItems_.size(); ++i ) {
572  items = items + childItems_[i]->getLeafs();
573  }
574 
575  // If we are a leave...
576  if ( childCount() == 0 )
577  items.push_back(this);
578 
579  return items;
580 }
581 
583 
584  // call function for all children of this node
585  for ( int i = 0 ; i < childItems_.size(); ++i) {
586 
587  // remove the subtree recursively
588  childItems_[i]->deleteSubtree();
589 
590  // delete child
591  delete childItems_[i];
592  }
593 
594  // clear the array
595  childItems_.clear();
596 }
597 
598 // ===============================================================================
599 // Grouping
600 // ===============================================================================
601 int BaseObject::group() const {
602  // Skip root node
603  if ( parent() == 0 )
604  return -1;
605 
606  // Dont count root node as a group
607  if ( parent()->parent() == 0 )
608  return -1;
609 
610  // Only consider groups
611  if ( !parent()->dataType(DATA_GROUP) )
612  return -1;
613 
614  // Get the group id
615  return ( parent()->id() );
616 
617 }
618 
619 bool BaseObject::isGroup() const {
620 // return ( (childItems_.size() > 0) || dataType(DATA_GROUP) ) ;
621  return ( dataType(DATA_GROUP) ) ;
622 };
623 
624 
625 bool BaseObject::isInGroup( int _id ) const {
626  const BaseObject* current = this;
627 
628  // Go up and check for the group id
629  do {
630 
631  // Check if we found the id
632  if ( current->id() == _id )
633  return true;
634 
635  // Move on to parent object
636  current = current->parent();
637  } while ( current != 0 );
638 
639  return false;
640 }
641 
642 bool BaseObject::isInGroup( QString _name ) const {
643  const BaseObject* current = this;
644 
645  // Go up and check for the group name
646  do {
647 
648  // Check if this object is a group and if it has the serach name
649  if ( current->dataType( DATA_GROUP ) && (current->name() == _name) )
650  return true;
651 
652  // Move on to parent object
653  current = current->parent();
654 
655  } while ( current != 0 );
656 
657  return false;
658 }
659 
660 std::vector< int > BaseObject::getGroupIds() {
661  std::vector< int > groups;
662 
663  BaseObject* current = this;
664 
665  // Go up and collect all groups in the given order
666  do {
667 
668  // collect only groups
669  if ( current->dataType( DATA_GROUP ) )
670  // Skip the root Object
671  if ( current->parent() != 0 )
672  groups.push_back( current->id() );
673 
674  // Move on to parent object
675  current = current->parent();
676  } while ( current != 0 );
677 
678  return groups;
679 }
680 
682  QStringList groups;
683 
684  BaseObject* current = this;
685 
686  // Go up and collect all groups in the given order
687  do {
688 
689  // collect only groups
690  if ( current->dataType( DATA_GROUP ) )
691  // Skip the root Object
692  if ( current->parent() != 0 )
693  groups.push_back( current->name() );
694 
695  // Move on to parent object
696  current = current->parent();
697  } while ( current != 0 );
698 
699  return groups;
700 }
701 
702 // ===============================================================================
703 // Name and path Handling
704 // ===============================================================================
705 
706 QString BaseObject::filename() const
707 {
708  return filename_;
709 }
710 
711 void BaseObject::setFileName(const QString &_filename)
712 {
713  filename_ = _filename;
714 }
715 
716 void BaseObject::setFromFileName(const QString &_filename ) {
717  QFileInfo file_info(_filename);
718  setPath(file_info.path());
719  QString filename = file_info.fileName();
720  setFileName(filename);
721 }
722 
723 void BaseObject::setName(QString _name ) {
724  name_ = _name;
725 
726  // Tell plugins about the name change
727  emit objectPropertiesChanged(id());
728 }
729 
730 QString BaseObject::name() const {
731  return name_;
732 }
733 
734 QString BaseObject::path() const {
735  return path_;
736 }
737 
738 void BaseObject::setPath(const QString &_path ) {
739  path_ = _path;
740 }
741 
742 // ===============================================================================
743 // Content
744 // ===============================================================================
746 }
747 
749 
750  // Add spaces to visualize level
751  for ( int i = 0 ; i < level() ; ++i )
752  std::cerr << " ";
753 
754  std::cerr << "Node ";
755  std::cerr << std::string(name().toLatin1());
756 
757  std::cerr << " with id : ";
758  std::cerr << id();
759 
760  // Write the type of this Object
761  std::cerr << " and type " << typeName(dataType()).toStdString() << std::endl;
762 
763  // call function for all children of this node
764  for ( int i = 0 ; i < childItems_.size(); ++i)
765  childItems_[i]->dumpTree();
766 
767 }
768 
770  std::cerr << "Copy not supported by this Object" << std::endl;
771  return 0;
772 }
773 
774 
775 // ===============================================================================
776 // per Object data functions
777 // ===============================================================================
778 
779 void
781 setObjectData( QString _dataName , PerObjectData* _data ) {
782  dataMap_.insert( _dataName, _data );
783 }
784 
785 void
787 clearObjectData( QString _dataName ) {
788  if (dataMap_.contains(_dataName))
789  dataMap_.remove(_dataName);
790 }
791 
792 
793 bool
795 hasObjectData( QString _dataName )
796 {
797  return dataMap_.contains(_dataName);
798 }
799 
800 
803 objectData( QString _dataName ) {
804  if (dataMap_.contains(_dataName))
805  return dataMap_.value(_dataName);
806  else
807  return 0;
808 }
809 
810 void
813 
814  QMapIterator<QString, PerObjectData* > i(dataMap_);
815  while (i.hasNext()) {
816  i.next();
817  delete i.value();
818  }
819 
820  dataMap_.clear();
821 
822 }
823 
824 QString& BaseObject::getCommentByKey(const QString &key) {
825  return commentsByKey_[key];
826  }
827 
828 
829  const QString BaseObject::getCommentByKey(const QString &key) const {
830  return commentsByKey_.value(key);
831  }
832 
833 
834  bool BaseObject::hasCommentForKey(const QString &key) const {
835  return commentsByKey_.contains(key);
836  }
837 
838 
839  bool BaseObject::hasComments() const {
840  return !commentsByKey_.empty();
841  }
842 
843  void BaseObject::clearComment(const QString &key) {
844  commentsByKey_.remove(key);
845  }
846 
848  commentsByKey_.clear();
849  }
850 
851 
852  const QMap<QString, QString>& BaseObject::getAllComments() const {
853  return commentsByKey_;
854  }
855 
856 const QString BaseObject::getAllCommentsFlat() const {
857  QStringList result;
858 
859  result.append(QString("BEGIN Comments for object \"%1\"").arg(name()));
860 
861  /*
862  * Compose JSON parsable object.
863  */
864  QJsonObject comment_obj;
865  for (QMap<QString, QString>::const_iterator it = commentsByKey_.begin(), it_end = commentsByKey_.end();
866  it != it_end; ++it) {
867 
868  QJsonParseError json_error;
869  QString test_json_str = QString::fromUtf8("{\"test\": %1}").arg(it.value());
870  QByteArray test_json_ba = test_json_str.toUtf8();
871  QJsonDocument test_json = QJsonDocument::fromJson(test_json_ba, &json_error);
872  if (json_error.error != QJsonParseError::NoError) {
873  comment_obj[it.key()] = it.value();
874  } else {
875  comment_obj[it.key()] = test_json.object().value("test");
876  }
877  }
878  result.append(QString::fromUtf8(QJsonDocument(comment_obj).toJson(QJsonDocument::Indented)));
879 
880  result.append(QString("END Comments for object \"%1\"\n").arg(name()));
881 
882  return result.join("\n");
883 }
884 
885 
886 QMap<QString, PerObjectData*>& BaseObject::getPerObjectDataMap() {
887  return dataMap_;
888 }
889 
890 
891 //=============================================================================
std::vector< int > getGroupIds()
Definition: BaseObject.cc:660
Update type class.
Definition: UpdateType.hh:60
int persistentId_
Persistent ID for this Object.
Definition: BaseObject.hh:141
virtual QString getObjectinfo()
Get all Info for the Object as a string.
Definition: BaseObject.cc:244
bool isGroup() const
Check if object is a group.
Definition: BaseObject.cc:619
BaseObject * childExists(int _objectId)
Check if the element exists in the subtree of this element.
Definition: BaseObject.cc:516
DLLEXPORT QString typeName(DataType _id)
Get the name of a type with given id.
Definition: Types.cc:154
QList< BaseObject * > childItems_
Children of this node.
Definition: BaseObject.hh:335
bool flag(QString _flag)
Definition: BaseObject.cc:299
void visibilityChanged(int _objectId)
QString & getCommentByKey(const QString &key)
Get comment for the specified key.
Definition: BaseObject.cc:824
const QString getAllCommentsFlat() const
Definition: BaseObject.cc:856
bool visible_
Definition: BaseObject.hh:274
void addObjectToMap(int _objectId, BaseObject *_object)
Add object to internal object map.
int id() const
Definition: BaseObject.cc:190
void setDataType(DataType _type)
Definition: BaseObject.cc:233
bool hasComments() const
Definition: BaseObject.cc:839
void deleteData()
Delete all data attached to this object ( calls delete on each object )
Definition: BaseObject.cc:812
bool source()
Definition: BaseObject.cc:291
virtual void printObjectInfo()
Print all information about the object.
Definition: BaseObject.cc:264
void setFromFileName(const QString &_filename)
Definition: BaseObject.cc:716
virtual void update(UpdateType _type=UPDATE_ALL)
This function is called to update the object.
Definition: BaseObject.cc:745
int childCount() const
get the number of children
Definition: BaseObject.cc:511
bool dataType(DataType _type) const
Definition: BaseObject.cc:221
int level()
Definition: BaseObject.cc:441
int id_
Unique ID for this Object.
Definition: BaseObject.hh:134
QString path_
path to the file from which the object is loaded ( defaults to "." )
Definition: BaseObject.hh:466
QStringList getGroupNames()
Definition: BaseObject.cc:681
QStringList flags()
Definition: BaseObject.cc:330
bool target()
Definition: BaseObject.cc:273
void clearComment(const QString &key)
Get comment for the specified key.
Definition: BaseObject.cc:843
void appendChild(BaseObject *child)
add a child to this node
Definition: BaseObject.cc:498
BaseObject * last()
Definition: BaseObject.cc:364
const DataType DATA_UNKNOWN(0)
None of the other Objects.
void removeChild(BaseObject *_item)
Remove a child from this object.
Definition: BaseObject.cc:548
void clearObjectData(QString _dataName)
Clear the object data pointer ( this will not delete the object!! )
Definition: BaseObject.cc:787
void setFileName(const QString &_filename)
set the filename for this object
Definition: BaseObject.cc:711
QString name() const
return the name of the object. The name defaults to NONAME if unset.
Definition: BaseObject.cc:730
BaseObject *& objectRoot()
Get the root of the object structure.
void deleteSubtree()
delete the whole subtree below this item ( The item itself is not touched )
Definition: BaseObject.cc:582
bool isInGroup(int _id) const
Definition: BaseObject.cc:625
Object Payload.
void increaseTargetCount()
Decrease the number of current Object.
void setFlag(QString _flag, bool _set)
Definition: BaseObject.cc:304
QString filename() const
return the filename of the object
Definition: BaseObject.cc:706
void clearAllComments()
Get comment for the specified key.
Definition: BaseObject.cc:847
virtual bool visible()
return if object is visible
Definition: BaseObject.cc:339
QMap< QString, QString > commentsByKey_
Get comment for the specified key.
Definition: BaseObject.hh:570
void increaseObjectCount()
Decrease the number of current Object.
QString path() const
return the path to the object ( defaults to "." if unset )
Definition: BaseObject.cc:734
const QMap< QString, QString > & getAllComments() const
Definition: BaseObject.cc:852
virtual void cleanup()
Definition: BaseObject.cc:207
void objectSelectionChanged(int _objectId)
void objectPropertiesChanged(int _objectId)
int persistentId() const
Definition: BaseObject.cc:194
void setObjectData(QString _dataName, PerObjectData *_data)
Definition: BaseObject.cc:781
int row() const
get the row of this item from the parent
Definition: BaseObject.cc:458
QString name_
Object/FileName ( defaults to NONAME )
Definition: BaseObject.hh:478
QStringList flags_
Definition: BaseObject.hh:243
const DataType DATA_GROUP(1)
Items used for Grouping.
static int NOOBJECT
Definition: BaseObject.hh:106
bool hasCommentForKey(const QString &key) const
Definition: BaseObject.cc:834
void dumpTree()
Debugging function, writing the subtree to output.
Definition: BaseObject.cc:748
int group() const
Definition: BaseObject.cc:601
void setParent(BaseObject *_parent)
Set the parent pointer.
Definition: BaseObject.cc:477
Predefined datatypes.
Definition: DataTypes.hh:83
QMap< QString, PerObjectData *> dataMap_
get reference to map of all perObject Datas
Definition: BaseObject.hh:529
void decreaseObjectCount()
Increase the number of current Object.
BaseObject * next()
Definition: BaseObject.cc:404
bool hasObjectData(QString _dataName)
Checks if object data with given name is available.
Definition: BaseObject.cc:795
QList< BaseObject *> getLeafs()
get all leafes of the tree below this object ( These will be all visible objects ) ...
Definition: BaseObject.cc:567
virtual PerObjectData * copyPerObjectData()
Copy Function.
void decreaseTargetCount()
Increase the number of current Object.
DataType objectType_
Definition: BaseObject.hh:167
void setPath(const QString &_path)
set the path to the object.
Definition: BaseObject.cc:738
virtual BaseObject * copy()
Returns a full copy of the object.
Definition: BaseObject.cc:769
BaseObject * parent()
Get the parent item ( 0 if rootitem )
Definition: BaseObject.cc:466
PerObjectData * objectData(QString _dataName)
Returns the object data pointer.
Definition: BaseObject.cc:803
virtual void setName(QString _name)
path to the file from which the object is loaded ( defaults to "." )
Definition: BaseObject.cc:723
BaseObject * child(int row)
return a child
Definition: BaseObject.cc:506
const DataType DATA_ALL(UINT_MAX)
Identifier for all available objects.
QMap< QString, PerObjectData * > & getPerObjectDataMap()
get reference to map of all perObject Datas
Definition: BaseObject.cc:886
DataType dataType() const
Definition: BaseObject.cc:229
BaseObject(const BaseObject &_object)
Definition: BaseObject.cc:77
BaseObject * parentItem_
Parent item or 0 if rootnode.
Definition: BaseObject.hh:332
QString filename_
path to the file from which the object is loaded ( defaults to "." )
Definition: BaseObject.hh:467