icon=":icons/sketch.png"
tooltip="Select a face for extrusion"
activate="true"
- shape_types="face"
+ shape_types="face wire"
+ use_subshapes="true"
/>
<doublevalue id="extrusion_size" label="Size" min="0" step="1.0" default="0" icon=":icons/dimension_v.png" tooltip="Set size of extrusion">
<validator id="GeomValidators_Positive"/>
GeomAPI_Wire::GeomAPI_Wire() : GeomAPI_Shape()
{
- TopoDS_Wire aBigWireImpl;
+ TopoDS_Compound aBigWireImpl;
BRep_Builder aBuilder;
- aBuilder.MakeWire(aBigWireImpl);
+ aBuilder.MakeCompound(aBigWireImpl);
this->setImpl(new TopoDS_Shape(aBigWireImpl));
}
typedef QList<double> QDoubleList; //!< list of double values
typedef QList<FeaturePtr> QFeatureList; //!< List of features
typedef QList<ResultPtr> QResultList; //!< List of results
-
#endif
#define ModuleBase_IWorkshop_H
#include "ModuleBase.h"
+#include "ModuleBase_Definitions.h"
#include <ModelAPI_Object.h>
virtual ModuleBase_ISelection* selection() const = 0;
+ /// Activate sub-shapes selection (opens local context)
+ /// Types has to be dined according to TopAbs_ShapeEnum
+ virtual void activateSubShapesSelection(const QIntList& theTypes) = 0;
+
+ /// Deactivate sub-shapes selection (closes local context)
+ virtual void deactivateSubShapesSelection() = 0;
+
//! Returns instance of loaded module
virtual ModuleBase_IModule* module() const = 0;
disconnect(myPropertyPanel, 0, this, 0);
stopOperation();
-
ModelAPI_Session::get()->finishOperation();
+
emit stopped();
afterCommitOperation();
const Config_WidgetAPI* theData,
const std::string& theParentId)
: ModuleBase_ModelWidget(theParent, theData, theParentId),
- myWorkshop(theWorkshop), myIsActive(false)
+ myWorkshop(theWorkshop), myIsActive(false), myUseSubShapes(false)
{
myContainer = new QWidget(theParent);
QHBoxLayout* aLayout = new QHBoxLayout(myContainer);
std::string aTypes = theData->getProperty("shape_types");
myShapeTypes = QString(aTypes.c_str()).split(' ');
+
+ std::string aUseSubShapes = theData->getProperty("use_subshapes");
+ if (aUseSubShapes.length() > 0) {
+ QString aVal(aUseSubShapes.c_str());
+ myUseSubShapes = (aVal.toUpper() == "TRUE");
+ }
}
//********************************************************************
myTextLine->setPalette(myInactivePalet);
updateSelectionName();
- if (myIsActive)
+ if (myIsActive) {
connect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
- else
+ if (myUseSubShapes) {
+ QIntList aList;
+ foreach (QString aType, myShapeTypes)
+ aList.append(shapeType(aType));
+ myWorkshop->activateSubShapesSelection(aList);
+ }
+ } else {
disconnect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
+ if (myUseSubShapes)
+ myWorkshop->deactivateSubShapesSelection();
+ }
}
//********************************************************************
ObjectPtr mySelectedObject;
QStringList myShapeTypes;
+ /// If true then local selector has to be activated in context
+ bool myUseSubShapes;
+
QPalette myBasePalet;
QPalette myInactivePalet;
aDisplayer->deactivateObjectsOutOfContext();
} else {
Handle(AIS_InteractiveContext) aAIS = xWorkshop()->viewer()->AISContext();
+ //TODO (VSV): We have to open Local context because at neutral point filters don't work (bug 25340)
aAIS->AddFilter(myDocumentShapeFilter);
}
}
PartSet_OperationSketchBase::stopOperation();
emit featureConstructed(feature(), FM_Hide);
emit closeLocalContext();
+}
+void PartSet_OperationSketch::afterCommitOperation()
+{
FeaturePtr aFeature = feature();
std::list<ResultPtr> aResults = aFeature->results();
std::list<ResultPtr>::const_iterator aIt;
/// Default impl calls corresponding slot and commits immediately.
virtual void startOperation();
+ /// Virtual method called after operation committed (see commit() method for more description)
+ virtual void afterCommitOperation();
+
private:
std::list<ModuleBase_ViewerPrs> myFeatures; ///< the features to apply the edit operation
};
{
return myWorkshop->operationMgr()->currentOperation();
}
+
+
+void XGUI_ModuleConnector::activateSubShapesSelection(const QIntList& theTypes)
+{
+ Handle(AIS_InteractiveContext) aAIS = myWorkshop->viewer()->AISContext();
+ if (!aAIS->HasOpenedContext())
+ aAIS->OpenLocalContext();
+ foreach(int aType, theTypes)
+ aAIS->ActivateStandardMode((TopAbs_ShapeEnum)aType);
+}
+
+void XGUI_ModuleConnector::deactivateSubShapesSelection()
+{
+ Handle(AIS_InteractiveContext) aAIS = myWorkshop->viewer()->AISContext();
+ aAIS->CloseAllContexts();
+}
//! Returns list of currently selected data objects
virtual ModuleBase_ISelection* selection() const;
+ /// Activate sub-shapes selection (opens local context if it was not opened)
+ /// Types has to be dined according to TopAbs_ShapeEnum
+ virtual void activateSubShapesSelection(const QIntList& theTypes);
+
+ /// Deactivate sub-shapes selection (closes local context)
+ virtual void deactivateSubShapesSelection();
+
//! Returns instance of loaded module
virtual ModuleBase_IModule* module() const;
IMPLEMENT_STANDARD_RTTIEXT(XGUI_ShapeDocumentFilter, SelectMgr_Filter);
-//TODO (VSV): Check bug in OCCT: Filter result is ignored
+//TODO (VSV): Check bug in OCCT: Filter result is ignored (bug25340)
Standard_Boolean XGUI_ShapeDocumentFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
{
if (theOwner->HasSelectable()) {