if (!myFeature.get())
return isModified;
+ QMap<ObjectPtr, QList<GeomShapePtr> > aFeatureShapes;
switch (theFlag) {
case ModuleBase_IModule::CustomizeArguments:
- PartSet_OperationPrs::getFeatureShapes(myFeature, myWorkshop, anOperationPrs->featureShapes());
+ PartSet_OperationPrs::getFeatureShapes(myFeature, myWorkshop, aFeatureShapes);
break;
case ModuleBase_IModule::CustomizeResults:
- PartSet_OperationPrs::getResultShapes(myFeature, myWorkshop, anOperationPrs->featureShapes());
+ PartSet_OperationPrs::getResultShapes(myFeature, myWorkshop, aFeatureShapes);
break;
case ModuleBase_IModule::CustomizeHighlightedObjects:
- PartSet_OperationPrs::getHighlightedShapes(myWorkshop, anOperationPrs->featureShapes());
+ PartSet_OperationPrs::getHighlightedShapes(myWorkshop, aFeatureShapes);
break;
default:
return isModified;
}
+ NCollection_DataMap<TopoDS_Shape, Handle_AIS_InteractiveObject>& aShapeMap =
+ anOperationPrs->shapesMap();
+ PartSet_OperationPrs::fillShapeList(aFeatureShapes, myWorkshop, aShapeMap);
myPresentationIsEmpty = false;
// redisplay AIS objects
Handle(AIS_InteractiveObject) anAISIO = aPresentation->impl<Handle(AIS_InteractiveObject)>();
Handle(PartSet_OperationPrs) anOperationPrs = Handle(PartSet_OperationPrs)::DownCast(anAISIO);
- anOperationPrs->featureShapes().clear();
+ anOperationPrs->shapesMap().Clear();
if (!anOperationPrs.IsNull())
anOperationPrs.Nullify();
myPresentations.remove(theFlag);
bool PartSet_OperationPrs::hasShapes()
{
- return !myFeatureShapes.empty();
+ return !myShapeToPrsMap.IsEmpty();
}
void PartSet_OperationPrs::setShapeColor(const Quantity_Color& theColor)
{
SetColor(myShapeColor);
thePresentation->Clear();
-
- NCollection_DataMap<TopoDS_Shape, Handle(AIS_InteractiveObject)> aShapeToPrsMap;
- fillShapeList(myFeatureShapes, aShapeToPrsMap);
-
- bool aReadyToDisplay = !aShapeToPrsMap.IsEmpty();
- if (aReadyToDisplay) {
- myShapeToPrsMap.Clear();
- myShapeToPrsMap.Assign(aShapeToPrsMap);
- }
+ bool aReadyToDisplay = !myShapeToPrsMap.IsEmpty();
XGUI_Displayer* aDisplayer = XGUI_Tools::workshop(myWorkshop)->displayer();
Handle(Prs3d_Drawer) aDrawer = Attributes();
// the presentation is not used in the selection
}
+NCollection_DataMap<TopoDS_Shape, Handle(AIS_InteractiveObject)>& PartSet_OperationPrs::shapesMap()
+{
+ return myShapeToPrsMap;
+}
+
bool isSubObject(const ObjectPtr& theObject, const FeaturePtr& theFeature)
{
bool isSub = false;
}
void PartSet_OperationPrs::fillShapeList(const QMap<ObjectPtr, QList<GeomShapePtr> >& theFeatureShapes,
+ ModuleBase_IWorkshop* theWorkshop,
NCollection_DataMap<TopoDS_Shape, Handle(AIS_InteractiveObject)>& theShapeToPrsMap)
{
theShapeToPrsMap.Clear();
- XGUI_Displayer* aDisplayer = XGUI_Tools::workshop(myWorkshop)->displayer();
- Handle(Prs3d_Drawer) aDrawer = Attributes();
+ XGUI_Displayer* aDisplayer = XGUI_Tools::workshop(theWorkshop)->displayer();
// create presentations on the base of the shapes
- QMap<ObjectPtr, QList<GeomShapePtr> >::const_iterator anIt = myFeatureShapes.begin(),
- aLast = myFeatureShapes.end();
+ QMap<ObjectPtr, QList<GeomShapePtr> >::const_iterator anIt = theFeatureShapes.begin(),
+ aLast = theFeatureShapes.end();
for (; anIt != aLast; anIt++) {
ObjectPtr anObject = anIt.key();
QList<GeomShapePtr> aShapes = anIt.value();
for (; aShIt != aShLast; aShIt++) {
GeomShapePtr aGeomShape = *aShIt;
// the shape should not be checked here on empty value because it should be checked in
- // appendShapeIfVisible() on the step of filling myFeatureShapes list
+ // appendShapeIfVisible() on the step of filling theFeatureShapes list
// the reason is to avoid empty AIS object visualized in the viewer
//if (!aGeomShape.get()) continue;
TopoDS_Shape aShape = aGeomShape.get() ? aGeomShape->impl<TopoDS_Shape>() : TopoDS_Shape();
+ if (aShape.IsNull())
+ continue;
+
// change deviation coefficient to provide more precise circle
Handle(AIS_InteractiveObject) anIO;
- if (myUseAISWidth) {
- AISObjectPtr anAISPtr = aDisplayer->getAISObject(anObject);
- if (anAISPtr.get())
- anIO = anAISPtr->impl<Handle(AIS_InteractiveObject)>();
- }
+ AISObjectPtr anAISPtr = aDisplayer->getAISObject(anObject);
+ if (anAISPtr.get())
+ anIO = anAISPtr->impl<Handle(AIS_InteractiveObject)>();
theShapeToPrsMap.Bind(aShape, anIO);
}
}
DEFINE_STANDARD_HANDLE(PartSet_OperationPrs, ViewerData_AISShape)
class XGUI_Displayer;
+class Handle_AIS_InteractiveObject;
/**
* \ingroup GUI
const Standard_Integer aMode) ;
protected:
- /// Returns map of feature shapes to be able to fill it outside this class, e.g. in friend
- /// \return a map of object to shape
- QMap<ObjectPtr, QList<GeomShapePtr> >& featureShapes() { return myFeatureShapes; }
+ /// list of visualized shapes
+ /// \return a map of shapes
+ NCollection_DataMap<TopoDS_Shape, Handle_AIS_InteractiveObject>& shapesMap();
private:
/// Fills the map by the feature object and shapes, which should be visuaziled
/// Fills the list of shapes by map of model objects
/// \param theFeatureShape a container to find shapes
/// \param theShapesMap an out container
- void fillShapeList(const QMap<ObjectPtr, QList<GeomShapePtr> >& theFeatureShapes,
- NCollection_DataMap<TopoDS_Shape, Handle(AIS_InteractiveObject)>& theShapeToPrsMap);
+ static void fillShapeList(const QMap<ObjectPtr, QList<GeomShapePtr> >& theFeatureShapes,
+ ModuleBase_IWorkshop* theWorkshop,
+ NCollection_DataMap<TopoDS_Shape, Handle(AIS_InteractiveObject)>& theShapeToPrsMap);
private:
NCollection_DataMap<TopoDS_Shape, Handle(AIS_InteractiveObject)> myShapeToPrsMap; /// list of visualized shapes
- QMap<ObjectPtr, QList<GeomShapePtr> > myFeatureShapes; /// visualized shapes
-
ModuleBase_IWorkshop* myWorkshop; /// current workshop
Quantity_Color myShapeColor; /// color of feature depended shapes
bool myUseAISWidth; /// flag if the width of a shape object should be used for the shape visualization