Sketcher: remove unused cursor_createcoincident[] and DrawSketchHandlerCoincident. They are not used anymore.

This commit is contained in:
Paddle
2023-11-22 16:47:51 +01:00
parent a45bb8626f
commit 4c7ff0a6be

View File

@@ -3492,152 +3492,6 @@ void CmdSketcherConstrainBlock::applyConstraint(std::vector<SelIdPair>& selSeq,
// ======================================================================================
/* XPM */
static const char* cursor_createcoincident[] = {"32 32 3 1",
"+ c white",
"# c red",
". c None",
"......+.........................",
"......+.........................",
"......+.........................",
"......+.........................",
"......+.........................",
"................................",
"+++++...+++++...................",
"................................",
"......+.........................",
"......+.........................",
"......+.........................",
"......+.........................",
"......+.........................",
"................................",
"................................",
"................................",
".................####...........",
"................######..........",
"...............########.........",
"...............########.........",
"...............########.........",
"...............########.........",
"................######..........",
".................####...........",
"................................",
"................................",
"................................",
"................................",
"................................",
"................................",
"................................",
"................................"};
class DrawSketchHandlerCoincident: public DrawSketchHandler
{
public:
DrawSketchHandlerCoincident()
{
GeoId1 = GeoId2 = GeoEnum::GeoUndef;
PosId1 = PosId2 = Sketcher::PointPos::none;
}
~DrawSketchHandlerCoincident() override
{
Gui::Selection().rmvSelectionGate();
}
void mouseMove(Base::Vector2d onSketchPos) override
{
Q_UNUSED(onSketchPos);
}
bool pressButton(Base::Vector2d onSketchPos) override
{
Q_UNUSED(onSketchPos);
return true;
}
bool releaseButton(Base::Vector2d onSketchPos) override
{
int VtId = getPreselectPoint();
int CrsId = getPreselectCross();
std::stringstream ss;
int GeoId_temp;
Sketcher::PointPos PosId_temp;
if (VtId != -1) {
sketchgui->getSketchObject()->getGeoVertexIndex(VtId, GeoId_temp, PosId_temp);
ss << "Vertex" << VtId + 1;
}
else if (CrsId == 0) {
GeoId_temp = Sketcher::GeoEnum::RtPnt;
PosId_temp = Sketcher::PointPos::start;
ss << "RootPoint";
}
else {
GeoId1 = GeoId2 = GeoEnum::GeoUndef;
PosId1 = PosId2 = Sketcher::PointPos::none;
Gui::Selection().clearSelection();
return true;
}
if (GeoId1 == GeoEnum::GeoUndef) {
GeoId1 = GeoId_temp;
PosId1 = PosId_temp;
Gui::Selection().addSelection(sketchgui->getSketchObject()->getDocument()->getName(),
sketchgui->getSketchObject()->getNameInDocument(),
ss.str().c_str(),
onSketchPos.x,
onSketchPos.y,
0.f);
}
else {
GeoId2 = GeoId_temp;
PosId2 = PosId_temp;
// Apply the constraint
Sketcher::SketchObject* Obj =
static_cast<Sketcher::SketchObject*>(sketchgui->getObject());
// undo command open
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add coincident constraint"));
// check if this coincidence is already enforced (even indirectly)
bool constraintExists = Obj->arePointsCoincident(GeoId1, PosId1, GeoId2, PosId2);
if (!constraintExists && (GeoId1 != GeoId2)) {
Gui::cmdAppObjectArgs(
sketchgui->getObject(),
"addConstraint(Sketcher.Constraint('Coincident',%d,%d,%d,%d))",
GeoId1,
static_cast<int>(PosId1),
GeoId2,
static_cast<int>(PosId2));
Gui::Command::commitCommand();
}
else {
Gui::Command::abortCommand();
}
}
return true;
}
private:
void activated() override
{
Gui::Selection().rmvSelectionGate();
GenericConstraintSelection* selFilterGate =
new GenericConstraintSelection(sketchgui->getObject());
selFilterGate->setAllowedSelTypes(SelVertex | SelRoot);
Gui::Selection().addSelectionGate(selFilterGate);
int hotX = 8;
int hotY = 8;
setCursor(QPixmap(cursor_createcoincident), hotX, hotY);
}
protected:
int GeoId1, GeoId2;
Sketcher::PointPos PosId1, PosId2;
};
class CmdSketcherConstrainCoincident: public CmdSketcherConstraint
{
public: