Commit be2442c1 authored by Jan Möbius's avatar Jan Möbius

Dennis:

Use flags to implement source/target selections ( and possibly other tags )

Implement-source-target-object-flags-in-a-generic-style

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6632 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b2afe2f7
...@@ -59,8 +59,7 @@ BaseObject::BaseObject(const BaseObject& _object) { ...@@ -59,8 +59,7 @@ BaseObject::BaseObject(const BaseObject& _object) {
++idGenerator; ++idGenerator;
persistentId_ = _object.persistentId_; persistentId_ = _object.persistentId_;
objectType_ = _object.objectType_; objectType_ = _object.objectType_;
target_ = _object.target_; flags_ = _object.flags_;
source_ = _object.source_;
visible_ = _object.visible_; visible_ = _object.visible_;
parentItem_ = 0; parentItem_ = 0;
childItems_.clear(); childItems_.clear();
...@@ -74,8 +73,7 @@ BaseObject::BaseObject(BaseObject* _parent) : ...@@ -74,8 +73,7 @@ BaseObject::BaseObject(BaseObject* _parent) :
id_(-1), id_(-1),
persistentId_(-1), persistentId_(-1),
objectType_(DATA_NONE), objectType_(DATA_NONE),
target_(false), flags_(),
source_(false),
visible_(true), visible_(true),
parentItem_(_parent), parentItem_(_parent),
name_("NONAME") name_("NONAME")
...@@ -116,8 +114,8 @@ void BaseObject::cleanup() { ...@@ -116,8 +114,8 @@ void BaseObject::cleanup() {
persistentId_ = -1; persistentId_ = -1;
objectType_ = DATA_NONE; objectType_ = DATA_NONE;
target_ = false; flags_.clear();
source_ = false;
visible_ = true; visible_ = true;
name_ = "NONAME"; name_ = "NONAME";
} }
...@@ -175,23 +173,47 @@ void BaseObject::printObjectInfo() { ...@@ -175,23 +173,47 @@ void BaseObject::printObjectInfo() {
// =============================================================================== // ===============================================================================
// source/target Handling // flag Handling
// =============================================================================== // ===============================================================================
bool BaseObject::target() { bool BaseObject::target() {
return target_; return flag("target");
} }
void BaseObject::target(bool _target) { void BaseObject::target(bool _target) {
target_= _target; setFlag("target", _target);
} }
bool BaseObject::source() { bool BaseObject::source() {
return source_; return flag("source");
} }
void BaseObject::source(bool _source) { void BaseObject::source(bool _source) {
source_ = _source; setFlag("source", _source);
}
bool BaseObject::flag(QString _flag)
{
return flags_.contains(_flag);
}
void BaseObject::setFlag(QString _flag, bool _set)
{
if (flags_.contains(_flag))
{
if (!_set)
flags_.removeAll(_flag);
}
else
{
if (_set)
flags_ << _flag;
}
}
QStringList BaseObject::flags()
{
return flags_;
} }
// =============================================================================== // ===============================================================================
......
...@@ -170,13 +170,16 @@ class DLLEXPORTONLY BaseObject { ...@@ -170,13 +170,16 @@ class DLLEXPORTONLY BaseObject {
/** @} */ /** @} */
//=========================================================================== //===========================================================================
/** @name Source/target handling /** @name Flag handling (source, target, ...)
* @{ */ * @{ */
//=========================================================================== //===========================================================================
public: public:
/** Is this item selected as a target item? /** Is this item selected as a target item?
*/ * Most algorithms operate on target meshes. These meshes are also considered as active.
* Blending for inactive meshes is handled by DataControlPlugin so emit objectSelectionChanged
* if you changed this value.\n
*/
bool target(); bool target();
/** Set this item as a target /** Set this item as a target
...@@ -184,26 +187,33 @@ class DLLEXPORTONLY BaseObject { ...@@ -184,26 +187,33 @@ class DLLEXPORTONLY BaseObject {
void target(bool _target); void target(bool _target);
/** Is this item selected as a source item? /** Is this item selected as a source item?
*/ * Some algorithms use source meshes to define their input.
*/
bool source(); bool source();
/** Set this item as a source /** Set this item as a source
*/ */
void source(bool _source); void source(bool _source);
private: /** Get a custom flag of this item
*/
bool flag(QString _flag);
/** Is this item selected as a target item? /** Set a custom flag on this item
* Most algorithms operate on target meshes. These meshes are also considered as active. */
* Blending for inactive meshes is handled by DataControlPlugin so emit updated_objects void setFlag(QString _flag, bool _set);
* if you changed this value.\n
*/
bool target_;
/** Is this item selected as a source item? /** Get all flags of this item
* Some algorithms use source meshes to define their input.
*/ */
bool source_; QStringList flags();
private:
/** Stores all item flags as strings. Source and target flags are represented
* as "source" and "target" strings.
*/
QStringList flags_;
/** @} */ /** @} */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment