Sketcher: Extension of constraints to store virtual space affiliation

=====================================================================

The constraint class has been extended so that every constraint knows and serializes whether it is in virtual space or in normal real space.
This commit is contained in:
Abdullah Tahiri
2017-12-16 15:51:57 +01:00
committed by wmayer
parent 906e548912
commit 2ec9645a6b
2 changed files with 11 additions and 3 deletions

View File

@@ -58,7 +58,8 @@ Constraint::Constraint()
LabelDistance(10.f),
LabelPosition(0.f),
isDriving(true),
InternalAlignmentIndex(-1)
InternalAlignmentIndex(-1),
isInVirtualSpace(false)
{
// Initialize a random number generator, to avoid Valgrind false positives.
static boost::mt19937 ran;
@@ -88,6 +89,7 @@ Constraint::Constraint(const Constraint& from)
LabelPosition(from.LabelPosition),
isDriving(from.isDriving),
InternalAlignmentIndex(from.InternalAlignmentIndex),
isInVirtualSpace(from.isInVirtualSpace),
tag(from.tag)
{
}
@@ -118,6 +120,7 @@ Constraint *Constraint::copy(void) const
temp->LabelPosition = this->LabelPosition;
temp->isDriving = this->isDriving;
temp->InternalAlignmentIndex = this->InternalAlignmentIndex;
temp->isInVirtualSpace = this->isInVirtualSpace;
// Do not copy tag, otherwise it is considered a clone, and a "rename" by the expression engine.
return temp;
}
@@ -183,8 +186,9 @@ void Constraint::Save (Writer &writer) const
<< "ThirdPos=\"" << (int) ThirdPos << "\" "
<< "LabelDistance=\"" << LabelDistance << "\" "
<< "LabelPosition=\"" << LabelPosition << "\" "
<< "IsDriving=\"" << (int)isDriving << "\" />"
<< "IsDriving=\"" << (int)isDriving << "\" "
<< "IsInVirtualSpace=\"" << (int)isInVirtualSpace << "\" />"
<< std::endl;
}
@@ -224,4 +228,7 @@ void Constraint::Restore(XMLReader &reader)
if (reader.hasAttribute("IsDriving"))
isDriving = reader.getAttributeAsInteger("IsDriving") ? true : false;
if (reader.hasAttribute("IsInVirtualSpace"))
isInVirtualSpace = reader.getAttributeAsInteger("IsInVirtualSpace") ? true : false;
}

View File

@@ -122,6 +122,7 @@ public:
float LabelPosition;
bool isDriving;
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;
protected:
boost::uuids::uuid tag;