#include <PartSet_OperationSketch.h>
#include <PartSet_OperationSketchLine.h>
#include <PartSet_OperationEditLine.h>
+#include <PartSet_OperationConstraint.h>
#include <ModuleBase_Operation.h>
#include <ModuleBase_OperationDescription.h>
#include <PartSet_Listener.h>
#include <PartSet_TestOCC.h>
+#include <PartSet_Presentation.h>
#include <ModuleBase_Operation.h>
#include <ModelAPI_Object.h>
#include <GeomAPI_Shape.h>
#include <AIS_ListOfInteractive.hxx>
+#include <AIS_DimensionSelectionMode.hxx>
#include <QObject>
#include <QMouseEvent>
std::string aDescription = aWdgReader.featureDescription(aStdCmdId);
// create the operation
- ModuleBase_Operation* anOperation;
+ ModuleBase_Operation* anOperation = 0;
if (theCmdId == PartSet_OperationSketch::Type()) {
anOperation = new PartSet_OperationSketch(theCmdId.c_str(), this);
}
- else if(theCmdId == PartSet_OperationSketchLine::Type() ||
- theCmdId == PartSet_OperationEditLine::Type()) {
+ else {
ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation();
boost::shared_ptr<ModelAPI_Feature> aSketch;
PartSet_OperationSketchBase* aPrevOp = dynamic_cast<PartSet_OperationSketchBase*>(aCurOperation);
aSketch = aPrevOp->sketch();
if (theCmdId == PartSet_OperationSketchLine::Type())
anOperation = new PartSet_OperationSketchLine(theCmdId.c_str(), this, aSketch);
- else
+ else if (theCmdId == PartSet_OperationEditLine::Type())
anOperation = new PartSet_OperationEditLine(theCmdId.c_str(), this, aSketch);
+ else if (theCmdId == PartSet_OperationConstraint::Type())
+ anOperation = new PartSet_OperationConstraint(theCmdId.c_str(), this, aSketch);
}
- else {
+
+ if (!anOperation) {
anOperation = new ModuleBase_Operation(theCmdId.c_str(), this);
}
anOperation->getDescription()->setXmlRepresentation(QString::fromStdString(aXmlCfg));
XGUI_Displayer* aDisplayer = myWorkshop->displayer();
if (isDisplay) {
boost::shared_ptr<GeomAPI_Shape> aPreview = aPreviewOp->preview(theFeature);
- aDisplayer->Redisplay(theFeature,
- aPreview ? aPreview->impl<TopoDS_Shape>() : TopoDS_Shape(), false);
+ Handle(AIS_InteractiveObject) anAIS = PartSet_Presentation::createPresentation(
+ theFeature, aPreviewOp->sketch(),
+ aPreview ? aPreview->impl<TopoDS_Shape>() : TopoDS_Shape(),
+ aDisplayer->GetAISObject(theFeature));
+
+ int aSelectionMode = -1;
+ if (theFeature->getKind() == "SketchConstraintLength") {
+ aSelectionMode = AIS_DSM_Text;
+ }
+ aDisplayer->Redisplay(theFeature, anAIS, aSelectionMode, false);
}
else
aDisplayer->Erase(theFeature, false);
for (; anIt != aLast; anIt++) {
boost::shared_ptr<ModelAPI_Feature> aFeature = (*anIt).first;
boost::shared_ptr<GeomAPI_Shape> aPreview = (*anIt).second;
- aDisplayer->Redisplay(aFeature,
- aPreview ? aPreview->impl<TopoDS_Shape>() : TopoDS_Shape(), false);
+ Handle(AIS_InteractiveObject) anAIS = PartSet_Presentation::createPresentation(
+ aFeature, aPreviewOp->sketch(),
+ aPreview ? aPreview->impl<TopoDS_Shape>() : TopoDS_Shape(),
+ aDisplayer->GetAISObject(aFeature));
+ if (!anAIS.IsNull())
+ aDisplayer->Redisplay(aFeature, anAIS, -1, false);
aDisplayer->ActivateInLocalContext(aFeature, aModes, false);
}
aDisplayer->UpdateViewer();