Skip to content

Commit

Permalink
Sketcher: avoid using std::string
Browse files Browse the repository at this point in the history
  • Loading branch information
realthunder committed Apr 20, 2024
1 parent a16df1d commit b63d1a5
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/Mod/Sketcher/Gui/ViewProviderSketch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2080,37 +2080,37 @@ void ViewProviderSketch::onSelectionChanged(const Gui::SelectionChanges& msg)
// is it this object??
if (selObj == getObject()) {
if (msg.pSubName) {
std::string shapetype(msg.pSubName);
if (shapetype.size() > 4 && shapetype.substr(0,4) == "Edge") {
const char *shapetype = msg.pSubName;
if (boost::starts_with(shapetype, "Edge")) {
int GeoId = std::atoi(&shapetype[4]) - 1;
++edit->SelCurveMap[GeoId];
this->updateColor();
}
else if (shapetype.size() > 12 && shapetype.substr(0,12) == "ExternalEdge") {
else if (boost::starts_with(shapetype, "ExternalEdge")) {
int GeoId = std::atoi(&shapetype[12]) - 1;
GeoId = -GeoId - 3;
++edit->SelCurveMap[GeoId];
this->updateColor();
}
else if (shapetype.size() > 6 && shapetype.substr(0,6) == "Vertex") {
else if (boost::starts_with(shapetype, "Vertex")) {
int VtId = std::atoi(&shapetype[6]) - 1;
addSelectPoint(VtId);
this->updateColor();
}
else if (shapetype == "RootPoint") {
else if (boost::equals(shapetype, "RootPoint")) {
addSelectPoint(Sketcher::GeoEnum::RtPnt);
this->updateColor();
}
else if (shapetype == "H_Axis") {
else if (boost::equals(shapetype, "H_Axis")) {
++edit->SelCurveMap[Sketcher::GeoEnum::HAxis];
this->updateColor();
}
else if (shapetype == "V_Axis") {
else if (boost::equals(shapetype, "V_Axis")) {
++edit->SelCurveMap[Sketcher::GeoEnum::VAxis];
this->updateColor();
}
else if (shapetype.size() > 10 && shapetype.substr(0,10) == "Constraint") {
int ConstrId = Sketcher::PropertyConstraintList::getIndexFromConstraintName(shapetype);
else if (boost::starts_with(shapetype, "Constraint")) {
int ConstrId = std::atoi(&shapetype[10]) - 1;
edit->SelConstraintSet.insert(ConstrId);
this->drawConstraintIcons();
this->updateColor();
Expand All @@ -2124,37 +2124,37 @@ void ViewProviderSketch::onSelectionChanged(const Gui::SelectionChanges& msg)
// is it this object??
if (selObj == getObject()) {
if (msg.pSubName) {
std::string shapetype(msg.pSubName);
if (shapetype.size() > 4 && shapetype.substr(0,4) == "Edge") {
const char *shapetype = msg.pSubName;
if (boost::starts_with(shapetype, "Edge")) {
int GeoId = std::atoi(&shapetype[4]) - 1;
edit->removeSelectEdge(GeoId);
this->updateColor();
}
else if (shapetype.size() > 12 && shapetype.substr(0,12) == "ExternalEdge") {
else if (boost::starts_with(shapetype, "ExternalEdge")) {
int GeoId = std::atoi(&shapetype[12]) - 1;
GeoId = -GeoId - 3;
edit->removeSelectEdge(GeoId);
this->updateColor();
}
else if (shapetype.size() > 6 && shapetype.substr(0,6) == "Vertex") {
else if (boost::starts_with(shapetype, "Vertex")) {
int VtId = std::atoi(&shapetype[6]) - 1;
removeSelectPoint(VtId);
this->updateColor();
}
else if (shapetype == "RootPoint") {
else if (boost::equals(shapetype, "RootPoint")) {
removeSelectPoint(Sketcher::GeoEnum::RtPnt);
this->updateColor();
}
else if (shapetype == "H_Axis") {
else if (boost::equals(shapetype, "H_Axis")) {
edit->removeSelectEdge(Sketcher::GeoEnum::HAxis);
this->updateColor();
}
else if (shapetype == "V_Axis") {
else if (boost::equals(shapetype, "V_Axis")) {
edit->removeSelectEdge(Sketcher::GeoEnum::VAxis);
this->updateColor();
}
else if (shapetype.size() > 10 && shapetype.substr(0,10) == "Constraint") {
int ConstrId = Sketcher::PropertyConstraintList::getIndexFromConstraintName(shapetype);
else if (boost::starts_with(shapetype, "Constraint")) {
int ConstrId = std::atoi(&shapetype[10]) - 1;
edit->SelConstraintSet.erase(ConstrId);
this->drawConstraintIcons();
this->updateColor();
Expand Down

0 comments on commit b63d1a5

Please sign in to comment.