Sketcher: Contraint class extension
=================================== An additional index for internal geometry elements is introduced, to be stored only Internal Aligment constraint and backwards compatible.
This commit is contained in:
@@ -56,7 +56,8 @@ Constraint::Constraint()
|
||||
ThirdPos(none),
|
||||
LabelDistance(10.f),
|
||||
LabelPosition(0.f),
|
||||
isDriving(true)
|
||||
isDriving(true),
|
||||
InternalAlignmentIndex(-1)
|
||||
{
|
||||
// Initialize a random number generator, to avoid Valgrind false positives.
|
||||
static boost::mt19937 ran;
|
||||
@@ -85,7 +86,8 @@ Constraint::Constraint(const Constraint& from)
|
||||
LabelDistance(from.LabelDistance),
|
||||
LabelPosition(from.LabelPosition),
|
||||
isDriving(from.isDriving),
|
||||
tag(from.tag)
|
||||
tag(from.tag),
|
||||
InternalAlignmentIndex(from.InternalAlignmentIndex)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -114,6 +116,7 @@ Constraint *Constraint::copy(void) const
|
||||
temp->LabelDistance = this->LabelDistance;
|
||||
temp->LabelPosition = this->LabelPosition;
|
||||
temp->isDriving = this->isDriving;
|
||||
temp->InternalAlignmentIndex = this->InternalAlignmentIndex;
|
||||
// Do not copy tag, otherwise it is considered a clone, and a "rename" by the expression engine.
|
||||
return temp;
|
||||
}
|
||||
@@ -172,22 +175,24 @@ unsigned int Constraint::getMemSize (void) const
|
||||
void Constraint::Save (Writer &writer) const
|
||||
{
|
||||
writer.Stream() << writer.ind() << "<Constrain "
|
||||
<< "Name=\"" << Name << "\" "
|
||||
<< "Type=\"" << (int)Type << "\" ";
|
||||
<< "Name=\"" << Name << "\" "
|
||||
<< "Type=\"" << (int)Type << "\" ";
|
||||
if(this->Type==InternalAlignment)
|
||||
writer.Stream()
|
||||
<< "InternalAlignmentType=\"" << (int)AlignmentType << "\" ";
|
||||
<< "InternalAlignmentType=\"" << (int)AlignmentType << "\" "
|
||||
<< "InternalAlignmentIndex=\"" << InternalAlignmentIndex << "\" ";
|
||||
writer.Stream()
|
||||
<< "Value=\"" << Value << "\" "
|
||||
<< "First=\"" << First << "\" "
|
||||
<< "FirstPos=\"" << (int) FirstPos << "\" "
|
||||
<< "Second=\"" << Second << "\" "
|
||||
<< "SecondPos=\"" << (int) SecondPos << "\" "
|
||||
<< "Third=\"" << Third << "\" "
|
||||
<< "ThirdPos=\"" << (int) ThirdPos << "\" "
|
||||
<< "LabelDistance=\"" << LabelDistance << "\" "
|
||||
<< "LabelPosition=\"" << LabelPosition << "\" "
|
||||
<< "IsDriving=\"" << (int)isDriving << "\" />"
|
||||
<< "Value=\"" << Value << "\" "
|
||||
<< "First=\"" << First << "\" "
|
||||
<< "FirstPos=\"" << (int) FirstPos << "\" "
|
||||
<< "Second=\"" << Second << "\" "
|
||||
<< "SecondPos=\"" << (int) SecondPos << "\" "
|
||||
<< "Third=\"" << Third << "\" "
|
||||
<< "ThirdPos=\"" << (int) ThirdPos << "\" "
|
||||
<< "LabelDistance=\"" << LabelDistance << "\" "
|
||||
<< "LabelPosition=\"" << LabelPosition << "\" "
|
||||
<< "IsDriving=\"" << (int)isDriving << "\" />"
|
||||
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
@@ -202,10 +207,15 @@ void Constraint::Restore(XMLReader &reader)
|
||||
Second = reader.getAttributeAsInteger("Second");
|
||||
SecondPos = (PointPos) reader.getAttributeAsInteger("SecondPos");
|
||||
|
||||
if(this->Type==InternalAlignment)
|
||||
if(this->Type==InternalAlignment) {
|
||||
AlignmentType = (InternalAlignmentType) reader.getAttributeAsInteger("InternalAlignmentType");
|
||||
else
|
||||
|
||||
if (reader.hasAttribute("InternalAlignmentIndex"))
|
||||
InternalAlignmentIndex = reader.getAttributeAsInteger("InternalAlignmentIndex");
|
||||
}
|
||||
else {
|
||||
AlignmentType = Undef;
|
||||
}
|
||||
|
||||
// read the third geo group if present
|
||||
if (reader.hasAttribute("Third")) {
|
||||
|
||||
Reference in New Issue
Block a user