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) {
++idGenerator;
persistentId_ = _object.persistentId_;
objectType_ = _object.objectType_;
target_ = _object.target_;
source_ = _object.source_;
flags_ = _object.flags_;
visible_ = _object.visible_;
parentItem_ = 0;
childItems_.clear();
......@@ -74,8 +73,7 @@ BaseObject::BaseObject(BaseObject* _parent) :
id_(-1),
persistentId_(-1),
objectType_(DATA_NONE),
target_(false),
source_(false),
flags_(),
visible_(true),
parentItem_(_parent),
name_("NONAME")
......@@ -116,8 +114,8 @@ void BaseObject::cleanup() {
persistentId_ = -1;
objectType_ = DATA_NONE;
target_ = false;
source_ = false;
flags_.clear();
visible_ = true;
name_ = "NONAME";
}
......@@ -175,23 +173,47 @@ void BaseObject::printObjectInfo() {
// ===============================================================================
// source/target Handling
// flag Handling
// ===============================================================================
bool BaseObject::target() {
return target_;
return flag("target");
}
void BaseObject::target(bool _target) {
target_= _target;
setFlag("target", _target);
}
bool BaseObject::source() {
return source_;
return flag("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 {
/** @} */
//===========================================================================
/** @name Source/target handling
/** @name Flag handling (source, target, ...)
* @{ */
//===========================================================================
public:
/** 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();
/** Set this item as a target
......@@ -184,26 +187,33 @@ class DLLEXPORTONLY BaseObject {
void target(bool _target);
/** Is this item selected as a source item?
*/
* Some algorithms use source meshes to define their input.
*/
bool source();
/** Set this item as a 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?
* 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
* if you changed this value.\n
*/
bool target_;
/** Set a custom flag on this item
*/
void setFlag(QString _flag, bool _set);
/** Is this item selected as a source item?
* Some algorithms use source meshes to define their input.
/** Get all flags of this item
*/
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