Sketcher: Extend Constraints to have an activated boolean state

This commit is contained in:
Abdullah Tahiri
2019-06-22 06:41:31 +02:00
committed by abdullahtahiriyo
parent 4a0be9d3ba
commit 7cd3dd7dc4
2 changed files with 10 additions and 2 deletions

View File

@@ -60,7 +60,8 @@ Constraint::Constraint()
LabelPosition(0.f),
isDriving(true),
InternalAlignmentIndex(-1),
isInVirtualSpace(false)
isInVirtualSpace(false),
isActive(true)
{
// Initialize a random number generator, to avoid Valgrind false positives.
static boost::mt19937 ran;
@@ -98,6 +99,7 @@ Constraint *Constraint::copy(void) const
temp->isDriving = this->isDriving;
temp->InternalAlignmentIndex = this->InternalAlignmentIndex;
temp->isInVirtualSpace = this->isInVirtualSpace;
temp->isActive = this->isActive;
// Do not copy tag, otherwise it is considered a clone, and a "rename" by the expression engine.
return temp;
}
@@ -165,7 +167,8 @@ void Constraint::Save (Writer &writer) const
<< "LabelDistance=\"" << LabelDistance << "\" "
<< "LabelPosition=\"" << LabelPosition << "\" "
<< "IsDriving=\"" << (int)isDriving << "\" "
<< "IsInVirtualSpace=\"" << (int)isInVirtualSpace << "\" />"
<< "IsInVirtualSpace=\"" << (int)isInVirtualSpace << "\" "
<< "IsActive=\"" << (int)isActive << "\" />"
<< std::endl;
}
@@ -209,4 +212,7 @@ void Constraint::Restore(XMLReader &reader)
if (reader.hasAttribute("IsInVirtualSpace"))
isInVirtualSpace = reader.getAttributeAsInteger("IsInVirtualSpace") ? true : false;
if (reader.hasAttribute("IsActive"))
isActive = reader.getAttributeAsInteger("IsActive") ? true : false;
}

View File

@@ -143,6 +143,8 @@ public:
int InternalAlignmentIndex; // Note: for InternalAlignment Type this index indexes equal internal geometry elements (e.g. index of pole in a bspline). It is not a GeoId!!
bool isInVirtualSpace;
bool isActive;
protected:
boost::uuids::uuid tag;
};