/// enumeration to know which objects should be customized\r
enum ModuleBase_CustomizeFlag {\r
CustomizeDependedAndResults = 0x00000000,\r
- CustomizeHighlightedObjects = 0x00000001,\r
- CustomizeAllObjects = CustomizeDependedAndResults | CustomizeHighlightedObjects\r
+ CustomizeHighlightedObjects = 0x00000001\r
};\r
\r
/// Constructor\r
restoreValue();
myWorkshop->setSelected(getAttributeSelection());
- myWorkshop->module()->customizeObject(myFeature, ModuleBase_IModule::CustomizeAllObjects, true);
}
return aDone;
}
#include <ModuleBase_IWorkshop.h>
#include <ModuleBase_IViewer.h>
+#include <ModuleBase_Tools.h>
#include <Config_PropManager.h>
//#define DO_NOT_VISUALIZE_CUSTOM_PRESENTATION
-#define OPERATION_PARAMETER_COLOR "255, 255, 0"
-
PartSet_CustomPrs::PartSet_CustomPrs(ModuleBase_IWorkshop* theWorkshop)
: myWorkshop(theWorkshop), myIsActive(false)
{
- initPrs();
+ initPresentation(ModuleBase_IModule::CustomizeDependedAndResults);
+ initPresentation(ModuleBase_IModule::CustomizeHighlightedObjects);
}
bool PartSet_CustomPrs::isActive()
{
return myIsActive;
- /*Handle(PartSet_OperationPrs) anOperationPrs = getPresentation();
- Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
-
- return !aContext.IsNull() && aContext->IsDisplayed(anOperationPrs);*/
}
bool PartSet_CustomPrs::activate(const FeaturePtr& theFeature, const bool theUpdateViewer)
return false;
#endif
- bool isModified = false;
- Handle(PartSet_OperationPrs) anOperationPrs = getPresentation();
-
myIsActive = true;
- anOperationPrs->setFeature(theFeature);
+
+
+ bool isModified = false;
+ getPresentation(ModuleBase_IModule::CustomizeDependedAndResults)->setFeature(theFeature);
+ getPresentation(ModuleBase_IModule::CustomizeHighlightedObjects)->setFeature(theFeature);
if (theFeature.get()) {
- displayPresentation(theUpdateViewer);
+ displayPresentation(ModuleBase_IModule::CustomizeDependedAndResults, theUpdateViewer);
+ displayPresentation(ModuleBase_IModule::CustomizeHighlightedObjects, theUpdateViewer);
isModified = true;
}
return isModified;
myIsActive = false;
bool isModified = false;
- Handle(PartSet_OperationPrs) anOperationPrs = getPresentation();
- anOperationPrs->setFeature(FeaturePtr());
+ getPresentation(ModuleBase_IModule::CustomizeDependedAndResults)->setFeature(FeaturePtr());
+ getPresentation(ModuleBase_IModule::CustomizeHighlightedObjects)->setFeature(FeaturePtr());
- Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
- if (!aContext.IsNull() && aContext->IsDisplayed(anOperationPrs)) {
- erasePresentation(theUpdateViewer);
- isModified = true;
- }
+ erasePresentation(ModuleBase_IModule::CustomizeDependedAndResults, theUpdateViewer);
+ erasePresentation(ModuleBase_IModule::CustomizeHighlightedObjects, theUpdateViewer);
+ isModified = true;
return isModified;
}
-bool PartSet_CustomPrs::displayPresentation(const bool theUpdateViewer)
+bool PartSet_CustomPrs::displayPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag,
+ const bool theUpdateViewer)
{
bool isModified = false;
- Handle(PartSet_OperationPrs) anOperationPrs = getPresentation();
- anOperationPrs->updateShapes();
+ Handle(PartSet_OperationPrs) anOperationPrs = getPresentation(theFlag);
+ if (theFlag == ModuleBase_IModule::CustomizeDependedAndResults) {
+ PartSet_OperationPrs::getFeatureShapes(anOperationPrs->getFeature(), myWorkshop,
+ anOperationPrs->featureShapes());
+ anOperationPrs->updateShapes();
+ }
+ else if (theFlag == ModuleBase_IModule::CustomizeHighlightedObjects) {
+ PartSet_OperationPrs::getHighlightedShapes(myWorkshop, anOperationPrs->featureShapes());
+ }
Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
if (!aContext.IsNull() && !aContext->IsDisplayed(anOperationPrs)) {
if (anOperationPrs->hasShapes()) {
PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
XGUI_Workshop* aWorkshop = workshop();
- aWorkshop->displayer()->displayAIS(myOperationPrs, false/*load object in selection*/, theUpdateViewer);
+ aWorkshop->displayer()->displayAIS(myPresentations[theFlag], false/*load object in selection*/,
+ theUpdateViewer);
aContext->SetZLayer(anOperationPrs, aModule->getVisualLayerId());
isModified = true;
}
}
else {
if (!anOperationPrs->hasShapes()) {
- erasePresentation(theUpdateViewer);
+ erasePresentation(theFlag, theUpdateViewer);
isModified = true;
}
else {
return isModified;
}
-void PartSet_CustomPrs::erasePresentation(const bool theUpdateViewer)
+void PartSet_CustomPrs::erasePresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag,
+ const bool theUpdateViewer)
{
XGUI_Workshop* aWorkshop = workshop();
- aWorkshop->displayer()->eraseAIS(myOperationPrs, theUpdateViewer);
+ aWorkshop->displayer()->eraseAIS(myPresentations[theFlag], theUpdateViewer);
}
-Handle(PartSet_OperationPrs) PartSet_CustomPrs::getPresentation()
+void PartSet_CustomPrs::clearPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag)
{
- if (!myOperationPrs.get())
- initPrs();
- Handle(AIS_InteractiveObject) anAISIO = myOperationPrs->impl<Handle(AIS_InteractiveObject)>();
- return Handle(PartSet_OperationPrs)::DownCast(anAISIO);
+ Handle(PartSet_OperationPrs) anOperationPrs = getPresentation(theFlag);
+ if (!anOperationPrs.IsNull())
+ anOperationPrs.Nullify();
+}
+
+Handle(PartSet_OperationPrs) PartSet_CustomPrs::getPresentation(
+ const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag)
+{
+ Handle(PartSet_OperationPrs) aPresentation;
+
+ if (myPresentations.contains(theFlag)) {
+ AISObjectPtr anOperationPrs = myPresentations[theFlag];
+ if (!anOperationPrs.get())
+ initPresentation(theFlag);
+ Handle(AIS_InteractiveObject) anAISIO = anOperationPrs->impl<Handle(AIS_InteractiveObject)>();
+ aPresentation = Handle(PartSet_OperationPrs)::DownCast(anAISIO);
+ }
+ return aPresentation;
}
bool PartSet_CustomPrs::redisplay(const ObjectPtr& theObject,
#ifdef DO_NOT_VISUALIZE_CUSTOM_PRESENTATION
return false;
#endif
- return displayPresentation(theUpdateViewer);
+ return displayPresentation(theFlag, theUpdateViewer);
}
void PartSet_CustomPrs::clearPrs()
{
- Handle(PartSet_OperationPrs) anOperationPrs = getPresentation();
- if (!anOperationPrs.IsNull())
- anOperationPrs.Nullify();
-
- myOperationPrs.reset();
+ clearPresentation(ModuleBase_IModule::CustomizeDependedAndResults);
+ clearPresentation(ModuleBase_IModule::CustomizeHighlightedObjects);
}
-void PartSet_CustomPrs::initPrs()
+void PartSet_CustomPrs::initPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag)
{
- myOperationPrs = AISObjectPtr(new GeomAPI_AISObject());
- myOperationPrs->setImpl(new Handle(AIS_InteractiveObject)(new PartSet_OperationPrs(myWorkshop)));
-
- std::vector<int> aColor = Config_PropManager::color("Visualization", "operation_parameter_color",
- OPERATION_PARAMETER_COLOR);
- myOperationPrs->setColor(aColor[0], aColor[1], aColor[2]);
+ AISObjectPtr anOperationPrs = AISObjectPtr(new GeomAPI_AISObject());
+ Handle(PartSet_OperationPrs) anAISPrs = new PartSet_OperationPrs(myWorkshop);
+ anOperationPrs->setImpl(new Handle(AIS_InteractiveObject)(anAISPrs));
+ if (theFlag == ModuleBase_IModule::CustomizeDependedAndResults) {
+ Quantity_Color aShapeColor = ModuleBase_Tools::color("Visualization", "operation_parameter_color",
+ OPERATION_PARAMETER_COLOR());
+ Quantity_Color aResultColor = ModuleBase_Tools::color("Visualization", "operation_result_color",
+ OPERATION_RESULT_COLOR());
+ anAISPrs->setColors(aShapeColor, aResultColor);
+
+ anOperationPrs->setPointMarker(5, 2.);
+ anOperationPrs->setWidth(1);
+ }
+ else if (theFlag == ModuleBase_IModule::CustomizeHighlightedObjects) {
+ Quantity_Color aShapeColor = ModuleBase_Tools::color("Visualization", "operation_highlight_color",
+ OPERATION_HIGHLIGHT_COLOR());
+ Quantity_Color aResultColor = ModuleBase_Tools::color("Visualization", "operation_result_color",
+ OPERATION_RESULT_COLOR());
+ anAISPrs->setColors(aShapeColor, aResultColor);
+ //in this presentation we show the shapes wireframe similar to their highlight by OCCT
+ //so, we need to use the source AIS object width for the presentation width
+ anAISPrs->useAISWidth();
+ }
- myOperationPrs->setPointMarker(5, 2.);
- myOperationPrs->setWidth(1);
+ if (anOperationPrs.get())
+ myPresentations[theFlag] = anOperationPrs;
}
XGUI_Workshop* PartSet_CustomPrs::workshop() const
*/
class PartSet_CustomPrs
{
+public:
+ /// Returns yellow color
+ static const std::string OPERATION_PARAMETER_COLOR() { return "255, 255, 0"; }
+ /// Returns green color
+ static const std::string OPERATION_RESULT_COLOR() { return "0,225, 0"; }
+ /// Returns color between white and color of highlight
+ /// highlight color is equal Quantity_Color(0.5,1,1) or QColor(122, 255,255) // 188
+ static const std::string OPERATION_HIGHLIGHT_COLOR() { return "188, 255, 255"; }
+
public:
/// Constructor
/// \param theWorkshop a reference to workshop
/// If the presentation is active[displayed], the shapes of the presentation is recomputed
/// and the presentation is redisplayed.
/// \param theObject an object to redisplay
+ /// \param theFlag an object AIS presentation type
/// \param theUpdateViewer the parameter whether the viewer should be update immediatelly
/// \returns true if the presentation is redisplayed
bool redisplay(const ObjectPtr& theObject,
- const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, const bool theUpdateViewer);
+ const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag,
+ const bool theUpdateViewer);
- /// Nullify the operation presentation. For example, it can be useful when the viewer/context
+ /// Nullify all internal presentations. For example, it can be useful when the viewer/context
/// is closed. If this is not performed and the presentation is assigned in another context,
/// it caused erroneus case because the presentation has linkage to the previous context.
void clearPrs();
private:
/// Creates the AIS operation presentation
- void initPrs();
+ /// \param theFlag an object AIS presentation type
+ void initPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag);
- /// Returns the AIS presentation
- Handle(PartSet_OperationPrs) getPresentation();
+ /// Gets an AIS presentation by the flag
+ /// \param theFlag an object AIS presentation type
+ /// \return the AIS prsentation
+ Handle(PartSet_OperationPrs) getPresentation(
+ const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag);
//! Returns workshop
XGUI_Workshop* workshop() const;
/// Displays the internal presentation in the viewer of workshop
+ /// \param theFlag an object AIS presentation type
/// \param theUpdateViewer the parameter whether the viewer should be update immediatelly
- bool displayPresentation(const bool theUpdateViewer);
+ /// \param returns whether the presentation is displayed/redisplayed
+ bool displayPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag,
+ const bool theUpdateViewer);
/// Erases the internal presentation from the viewer of workshop
+ /// \param theFlag an object AIS presentation type
/// \param theUpdateViewer the parameter whether the viewer should be update immediatelly
- void erasePresentation(const bool theUpdateViewer);
+ void erasePresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag,
+ const bool theUpdateViewer);
+
+ /// Nullify the operation presentation. For example, it can be useful when the viewer/context
+ /// is closed. If this is not performed and the presentation is assigned in another context,
+ /// it caused erroneus case because the presentation has linkage to the previous context.
+ void clearPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag);
private:
bool myIsActive;
ModuleBase_IWorkshop* myWorkshop; /// current workshop
- AISObjectPtr myOperationPrs; /// the AIS presentation, which is displayed/erased in the viewer
+ /// map of presentation type to AIS object
+ QMap<ModuleBase_IModule::ModuleBase_CustomizeFlag, AISObjectPtr> myPresentations;
};
#endif
myHasConstraintShown[PartSet_Tools::Geometrical] = true;
myHasConstraintShown[PartSet_Tools::Dimensional] = true;
+
+ Config_PropManager::registerProp("Visualization", "operation_parameter_color",
+ "Reference shape wireframe color in operation", Config_Prop::Color,
+ PartSet_CustomPrs::OPERATION_PARAMETER_COLOR());
+ Config_PropManager::registerProp("Visualization", "operation_result_color",
+ "Result shape wireframe color in operation", Config_Prop::Color,
+ PartSet_CustomPrs::OPERATION_RESULT_COLOR());
+ Config_PropManager::registerProp("Visualization", "operation_highlight_color",
+ "Multi selector item color in operation", Config_Prop::Color,
+ PartSet_CustomPrs::OPERATION_HIGHLIGHT_COLOR());
}
PartSet_Module::~PartSet_Module()
IMPLEMENT_STANDARD_RTTIEXT(PartSet_OperationPrs, ViewerData_AISShape);
PartSet_OperationPrs::PartSet_OperationPrs(ModuleBase_IWorkshop* theWorkshop)
- : ViewerData_AISShape(TopoDS_Shape()), myFeature(FeaturePtr()), myWorkshop(theWorkshop)
+: ViewerData_AISShape(TopoDS_Shape()), myFeature(FeaturePtr()), myWorkshop(theWorkshop),
+ myUseAISWidth(false)
{
myShapeColor = ModuleBase_Tools::color("Visualization", "construction_plane_color", "1,1,0");
myResultColor = ModuleBase_Tools::color("Visualization", "construction_plane_color", "0,1,0");
void PartSet_OperationPrs::updateShapes()
{
- myFeatureShapes.clear();
- getFeatureShapes(myFeatureShapes);
-
myFeatureResults.clear();
if (myFeature)
myFeatureResults = myFeature->results();
return aHasShapes;
}
+void PartSet_OperationPrs::setColors(const Quantity_Color& theShapeColor, const Quantity_Color& theResultColor)
+{
+ myShapeColor = theShapeColor;
+ myResultColor = theResultColor;
+}
+
+void PartSet_OperationPrs::useAISWidth()
+{
+ myUseAISWidth = true;
+}
+
void PartSet_OperationPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode)
if (!myWorkshop->module()->canDisplayObject(myFeature))
return;
- Quantity_Color aColor(1., 1., 0., Quantity_TOC_RGB); // yellow
- SetColor(aColor);
-
+ SetColor(myShapeColor);
thePresentation->Clear();
XGUI_Displayer* aDisplayer = workshop()->displayer();
- // create presentations on the base of the shapes
Handle(Prs3d_Drawer) aDrawer = Attributes();
+ // create presentations on the base of the shapes
QMap<ObjectPtr, QList<GeomShapePtr> >::const_iterator anIt = myFeatureShapes.begin(),
aLast = myFeatureShapes.end();
for (; anIt != aLast; anIt++) {
TopoDS_Shape aShape = aGeomShape->impl<TopoDS_Shape>();
// change deviation coefficient to provide more precise circle
ModuleBase_Tools::setDefaultDeviationCoefficient(aShape, aDrawer);
+
+ if (myUseAISWidth) {
+ AISObjectPtr anAISPtr = aDisplayer->getAISObject(anObject);
+ if (anAISPtr.get()) {
+ Handle(AIS_InteractiveObject) anIO = anAISPtr->impl<Handle(AIS_InteractiveObject)>();
+ if (!anIO.IsNull())
+ setWidth(aDrawer, anIO->Width());
+ }
+ }
StdPrs_WFDeflectionShape::Add(thePresentation, aShape, aDrawer);
}
}
- aColor = Quantity_Color(0., 1., 0., Quantity_TOC_RGB); // green
- SetColor(aColor);
-
+ // create presentations on the base of the results
+ SetColor(myResultColor);
std::list<ResultPtr>::const_iterator aRIt = myFeatureResults.begin(),
aRLast = myFeatureResults.end();
for (; aRIt != aRLast; aRIt++) {
aWidget->getHighlighted(aValues);
}
}
-
- Standard_Real aPreviousWidth = Width();
- setWidth(aDrawer, aPreviousWidth+3);
- Handle(AIS_InteractiveContext) aContext = GetContext();
- Quantity_NameOfColor anHColor = aContext->HilightColor();
-
- aColor = Quantity_Color(anHColor);
- aColor = Quantity_Color((1. + aColor.Red())/2., (1. + aColor.Green())/2.,
- (1. + aColor.Blue())/2., Quantity_TOC_RGB);
- SetColor(aColor);
-
- QList<ModuleBase_ViewerPrs>::const_iterator anIIt = aValues.begin(),
- aILast = aValues.end();
- for (; anIIt != aILast; anIIt++) {
- ModuleBase_ViewerPrs aPrs = *anIIt;
- ObjectPtr anObject = aPrs.object();
- TopoDS_Shape aShape = aPrs.shape();
- if (aShape.IsNull()) {
- ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
- if (aResult.get()) {
- GeomShapePtr aGeomShape = aResult->shape();
- if (aGeomShape.get())
- aShape = aGeomShape->impl<TopoDS_Shape>();
- }
- }
- if (!aShape.IsNull()) {
- ModuleBase_Tools::setDefaultDeviationCoefficient(aShape, aDrawer);
- StdPrs_WFDeflectionShape::Add(thePresentation, aShape, aDrawer);
- }
- }
- setWidth(aDrawer, aPreviousWidth);
}
void PartSet_OperationPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
}
}
-void PartSet_OperationPrs::getFeatureShapes(QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes)
+void PartSet_OperationPrs::getFeatureShapes(const FeaturePtr& theFeature,
+ ModuleBase_IWorkshop* theWorkshop,
+ QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes)
{
- if (!myFeature.get())
+ theObjectShapes.clear();
+ if (!theFeature.get())
return;
ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators();
QList<GeomShapePtr> aShapes;
- std::list<AttributePtr> anAttributes = myFeature->data()->attributes("");
+ std::list<AttributePtr> anAttributes = theFeature->data()->attributes("");
std::list<AttributePtr>::const_iterator anIt = anAttributes.begin(), aLast = anAttributes.end();
for (; anIt != aLast; anIt++) {
AttributePtr anAttribute = *anIt;
if (!isSelectionAttribute(anAttribute))
continue;
- if (!aValidators->isCase(myFeature, anAttribute->id()))
+ if (!aValidators->isCase(theFeature, anAttribute->id()))
continue; // this attribute is not participated in the current case
std::string anAttrType = anAttribute->attributeType();
std::shared_ptr<ModelAPI_AttributeSelection> aSelAttribute = aCurSelList->value(i);
ResultPtr aResult = aSelAttribute->context();
GeomShapePtr aShape = aSelAttribute->value();
- addValue(aResult, aShape, myFeature, theObjectShapes);
+ addValue(aResult, aShape, theFeature, theObjectShapes);
}
}
if (anAttrType == ModelAPI_AttributeRefList::typeId()) {
std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(anAttribute);
for (int i = 0; i < aCurSelList->size(); i++) {
GeomShapePtr aShape;
- addValue(aCurSelList->object(i), aShape, myFeature, theObjectShapes);
+ addValue(aCurSelList->object(i), aShape, theFeature, theObjectShapes);
}
}
else {
anObject = anAttr->object();
}
else {
- aShape = PartSet_Tools::findShapeBy2DPoint(anAttr, myWorkshop);
+ aShape = PartSet_Tools::findShapeBy2DPoint(anAttr, theWorkshop);
// the distance point is not found if the point is selected in the 2nd time
// TODO: after debug, this check can be removed
if (!aShape.get())
AttributeReferencePtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeReference>(anAttribute);
anObject = anAttr->value();
}
- addValue(anObject, aShape, myFeature, theObjectShapes);
+ addValue(anObject, aShape, theFeature, theObjectShapes);
}
}
}
+void PartSet_OperationPrs::getHighlightedShapes(ModuleBase_IWorkshop* theWorkshop,
+ QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes)
+{
+ theObjectShapes.clear();
+
+ QList<ModuleBase_ViewerPrs> aValues;
+ ModuleBase_IPropertyPanel* aPanel = theWorkshop->propertyPanel();
+ if (aPanel) {
+ ModuleBase_ModelWidget* aWidget = aPanel->activeWidget();
+ if (aWidget) {
+ aWidget->getHighlighted(aValues);
+ }
+ }
+
+ QList<GeomShapePtr> aShapes;
+ QList<ModuleBase_ViewerPrs>::const_iterator anIIt = aValues.begin(),
+ aILast = aValues.end();
+ for (; anIIt != aILast; anIIt++) {
+ ModuleBase_ViewerPrs aPrs = *anIIt;
+ ObjectPtr anObject = aPrs.object();
+
+ GeomShapePtr aGeomShape;
+
+ TopoDS_Shape aShape = aPrs.shape();
+ if (!aShape.IsNull()) {
+ aGeomShape = GeomShapePtr(new GeomAPI_Shape());
+ aGeomShape->setImpl(new TopoDS_Shape(aShape));
+ }
+ else {
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
+ if (aResult.get()) {
+ aGeomShape = aResult->shape();
+ }
+ }
+
+ if (theObjectShapes.contains(anObject))
+ theObjectShapes[anObject].append(aGeomShape);
+ else {
+ QList<GeomShapePtr> aShapes;
+ aShapes.append(aGeomShape);
+ theObjectShapes[anObject] = aShapes;
+ }
+ }
+}
+
+
bool PartSet_OperationPrs::isSelectionAttribute(const AttributePtr& theAttribute)
{
std::string anAttrType = theAttribute->attributeType();
/// Returns true if the feature contains shapes or results
bool hasShapes();
+ /// Sets the colors for the presentation compute
+ /// \param theShapeColor an argument shapes color
+ /// \param theResultColor a color for operation result
+ void setColors(const Quantity_Color& theShapeColor, const Quantity_Color& theResultColor);
+
+ /// Switch on using of the AIS presentation with of the shape object increased on the delta
+ void useAISWidth();
+
DEFINE_STANDARD_RTTI(PartSet_OperationPrs)
protected:
/// Redefinition of virtual function
Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer aMode) ;
+
+protected:
+ /// Reference to a feature object
+ FeaturePtr getFeature() { return myFeature; }
+
+ /// 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; }
+
private:
/// Return true if the object is visible. If the object is feature, it returns true
/// if all results of the feature are shown
bool isVisible(XGUI_Displayer* theDislayer, const ObjectPtr& theObject);
/// Fills the map by the feature object and shapes, which should be visuaziled
- /// Gets the feature attribute, collect objects to whom the attribute refers
+ /// Gets feature attributes, collect objects to whom the attributes refer
+ /// \param theFeature a current feature
+ /// \param theWorkshop a current workshop
+ /// \param theObjectShapes an output map
/// \param theObjectShape an output map of objects
- void getFeatureShapes(QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes);
+ static void getFeatureShapes(const FeaturePtr& theFeature,
+ ModuleBase_IWorkshop* theWorkshop,
+ QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes);
+
+ /// Fills the map by the feature object and shapes, which should be visuaziled
+ /// Gets the active widget, obtain the highlighted presentations if it has such and
+ /// fill map by object and shapes
+ /// \param theWorkshop a current workshop
+ /// \param theObjectShapes an output map of objects
+ static void getHighlightedShapes(ModuleBase_IWorkshop* theWorkshop,
+ QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes);
/// Returns true if the attribute type belong to reference attribute
/// \param theAttribute an attribute
Quantity_Color myShapeColor; /// color of feature depended shapes
Quantity_Color myResultColor; /// color of feature result
+
+ bool myUseAISWidth; /// flag if the width of a shape object should be used for the shape visualization
+
+ friend class PartSet_CustomPrs;
};
// if a list of message objects contains the operation feature for case when
// the feature is hidden, but arguments of the feature are modified
// e.g. extrusion is hidden(h=0) but sketch is chosen
- if (theForceRedisplay || theObjects.find(aCurrentFeature) != theObjects.end())
+ if (theForceRedisplay || theObjects.find(aCurrentFeature) != theObjects.end()) {
aCustomized = myWorkshop->module()->customizeObject(aCurrentFeature,
- ModuleBase_IModule::CustomizeAllObjects, false);
+ ModuleBase_IModule::CustomizeDependedAndResults, false);
+ aCustomized = myWorkshop->module()->customizeObject(aCurrentFeature,
+ ModuleBase_IModule::CustomizeHighlightedObjects, false);
+ }
}
return aCustomized;
}