[Sketcher] Add some utility functions to Sketcher::Constraint

`involvesGeoId`, `invovesGeoIdAndPosId`, `substituteIndexAndPos`
This commit is contained in:
Ajinkya Dahale
2024-08-29 09:48:46 +05:30
parent 680b4bdb2e
commit ed59a23778
2 changed files with 34 additions and 0 deletions

View File

@@ -239,6 +239,25 @@ void Constraint::substituteIndex(int fromGeoId, int toGeoId)
}
}
void Constraint::substituteIndexAndPos(int fromGeoId,
PointPos fromPosId,
int toGeoId,
PointPos toPosId)
{
if (this->First == fromGeoId && this->FirstPos == fromPosId) {
this->First = toGeoId;
this->FirstPos = toPosId;
}
if (this->Second == fromGeoId && this->SecondPos == fromPosId) {
this->Second = toGeoId;
this->SecondPos = toPosId;
}
if (this->Third == fromGeoId && this->ThirdPos == fromPosId) {
this->Third = toGeoId;
this->ThirdPos = toPosId;
}
}
std::string Constraint::typeToString(ConstraintType type)
{
return type2str[type];