1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModuleBase_Tools.cpp
4 // Created: 11 July 2014
5 // Author: Vitaly Smetannikov
7 #include "ModuleBase_Tools.h"
9 #include <ModuleBase_ParamIntSpinBox.h>
10 #include <ModuleBase_ParamSpinBox.h>
11 #include <ModuleBase_WidgetFactory.h>
12 #include <ModuleBase_IWorkshop.h>
13 #include <ModuleBase_IModule.h>
14 #include <ModuleBase_IconFactory.h>
15 #include <ModuleBase_ResultPrs.h>
17 #include <ModelAPI_Attribute.h>
18 #include <ModelAPI_AttributeRefAttr.h>
19 #include <ModelAPI_AttributeReference.h>
20 #include <ModelAPI_AttributeSelection.h>
21 #include <ModelAPI_AttributeSelectionList.h>
22 #include <ModelAPI_AttributeRefList.h>
23 #include <ModelAPI_AttributeRefAttrList.h>
24 #include <ModelAPI_ResultPart.h>
25 #include <ModelAPI_ResultConstruction.h>
26 #include <Events_Loop.h>
28 #include <ModelAPI_Data.h>
29 #include <ModelAPI_Result.h>
30 #include <ModelAPI_ResultCompSolid.h>
31 #include <ModelAPI_ResultParameter.h>
32 #include <ModelAPI_Tools.h>
33 #include <ModelAPI_Session.h>
34 #include <ModelAPI_Events.h>
36 #include <ModelGeomAlgo_Point2D.h>
38 #include <TopoDS_Iterator.hxx>
40 #include <GeomDataAPI_Point2D.h>
41 #include <Events_InfoMessage.h>
42 #include <GeomAPI_ShapeExplorer.h>
44 #include <Config_PropManager.h>
45 #include <Config_Translator.h>
47 #include <Prs3d_PointAspect.hxx>
48 #include <Graphic3d_AspectMarker3d.hxx>
50 #include <Image_AlienPixMap.hxx>
56 #include <QDoubleSpinBox>
57 #include <QGraphicsDropShadowEffect>
59 #include <QApplication>
60 #include <QMessageBox>
68 #pragma warning(disable : 4996) // for getenv
71 const double tolerance = 1e-7;
72 const double DEFAULT_DEVIATION_COEFFICIENT = 1.e-4;
74 //#define DEBUG_ACTIVATE_WINDOW
75 //#define DEBUG_SET_FOCUS
76 //#define DEBUG_SELECTION_INFO
78 #ifdef DEBUG_SELECTION_INFO
79 #include <ModuleBase_ISelection.h>
80 #include <ModuleBase_ViewerPrs.h>
82 #include <AIS_InteractiveContext.hxx>
83 #include <AIS_ListOfInteractive.hxx>
84 #include <AIS_ListIteratorOfListOfInteractive.hxx>
85 #include <AIS_Shape.hxx>
86 #include <TopoDS_Shape.hxx>
87 #include <AIS_LocalContext.hxx>
88 #include <NCollection_List.hxx>
89 #include <StdSelect_BRepOwner.hxx>
90 #include <TColStd_ListOfInteger.hxx>
91 #include <TColStd_ListIteratorOfListOfInteger.hxx>
100 namespace ModuleBase_Tools {
102 //******************************************************************
104 //******************************************************************
106 void adjustMargins(QWidget* theWidget)
110 adjustMargins(theWidget->layout());
113 void adjustMargins(QLayout* theLayout)
117 theLayout->setContentsMargins(2, 5, 2, 5);
118 theLayout->setSpacing(4);
121 void zeroMargins(QWidget* theWidget)
125 zeroMargins(theWidget->layout());
128 void zeroMargins(QLayout* theLayout)
132 theLayout->setContentsMargins(0, 0, 0, 0);
133 theLayout->setSpacing(5);
136 void activateWindow(QWidget* theWidget, const QString& theInfo)
138 theWidget->activateWindow();
140 #ifdef DEBUG_ACTIVATE_WINDOW
141 qDebug(QString("activateWindow: %1").arg(theInfo).toStdString().c_str());
145 void setFocus(QWidget* theWidget, const QString& theInfo)
147 theWidget->setFocus();
149 #ifdef DEBUG_SET_FOCUS
150 qDebug(QString("setFocus: %1").arg(theInfo).toStdString().c_str());
154 void setShadowEffect(QWidget* theWidget, const bool isSetEffect)
157 QGraphicsDropShadowEffect* aGlowEffect = new QGraphicsDropShadowEffect();
158 aGlowEffect->setOffset(.0);
159 aGlowEffect->setBlurRadius(10.0);
160 aGlowEffect->setColor(QColor(0, 170, 255)); // Light-blue color, #00AAFF
161 theWidget->setGraphicsEffect(aGlowEffect);
164 QGraphicsEffect* anEffect = theWidget->graphicsEffect();
166 anEffect->deleteLater();
167 theWidget->setGraphicsEffect(NULL);
171 QPixmap composite(const QString& theAdditionalIcon, const QString& theIcon)
173 QImage anIcon = ModuleBase_IconFactory::loadImage(theIcon);
174 QImage anAditional(theAdditionalIcon);
179 int anAddWidth = anAditional.width();
180 int anAddHeight = anAditional.height();
182 int aWidth = anIcon.width();
183 int aHeight = anIcon.height();
185 int aStartWidthPos = aWidth - anAddWidth - 1;
186 int aStartHeightPos = aHeight - anAddHeight - 1;
188 for (int i = 0; i < anAddWidth && i + aStartWidthPos < aWidth; i++)
190 for (int j = 0; j < anAddHeight && j + aStartHeightPos < aHeight; j++)
192 if (qAlpha(anAditional.pixel(i, j)) > 0)
193 anIcon.setPixel(i + aStartWidthPos, j + aStartHeightPos, anAditional.pixel(i, j));
196 return QPixmap::fromImage(anIcon);
199 QPixmap lighter(const QString& theIcon, const int theLighterValue)
201 QImage anIcon = ModuleBase_IconFactory::loadImage(theIcon);
205 QImage aResult = ModuleBase_IconFactory::loadImage(theIcon);
206 for (int i = 0; i < anIcon.width(); i++)
208 for (int j = 0; j < anIcon.height(); j++)
210 QRgb anRgb = anIcon.pixel(i, j);
211 QColor aPixelColor(qRed(anRgb), qGreen(anRgb), qBlue(anRgb),
212 qAlpha(aResult.pixel(i, j)));
214 QColor aLighterColor = aPixelColor.lighter(theLighterValue);
215 aResult.setPixel(i, j, qRgba(aLighterColor.red(), aLighterColor.green(),
216 aLighterColor.blue(), aLighterColor.alpha()));
219 return QPixmap::fromImage(aResult);
222 void setSpinText(ModuleBase_ParamSpinBox* theSpin, const QString& theText)
224 if (theSpin->text() == theText)
226 // In order to avoid extra text setting because it will
227 // reset cursor position in control
228 bool isBlocked = theSpin->blockSignals(true);
229 theSpin->setText(theText);
230 theSpin->blockSignals(isBlocked);
233 void setSpinValue(QDoubleSpinBox* theSpin, double theValue)
235 if (fabs(theSpin->value() - theValue) < tolerance)
237 bool isBlocked = theSpin->blockSignals(true);
238 theSpin->setValue(theValue);
239 theSpin->blockSignals(isBlocked);
242 void setSpinValue(ModuleBase_ParamSpinBox* theSpin, double theValue)
244 if (fabs(theSpin->value() - theValue) < tolerance)
246 bool isBlocked = theSpin->blockSignals(true);
247 theSpin->setValue(theValue);
248 theSpin->blockSignals(isBlocked);
251 void setSpinText(ModuleBase_ParamIntSpinBox* theSpin, const QString& theText)
253 // In order to avoid extra text setting because it will
254 // reset cursor position in control
255 if (theSpin->text() == theText)
257 bool isBlocked = theSpin->blockSignals(true);
258 theSpin->setText(theText);
259 theSpin->blockSignals(isBlocked);
262 void setSpinValue(ModuleBase_ParamIntSpinBox* theSpin, int theValue)
264 if (theSpin->value() == theValue)
266 bool isBlocked = theSpin->blockSignals(true);
267 theSpin->setValue(theValue);
268 theSpin->blockSignals(isBlocked);
271 QAction* createAction(const QIcon& theIcon, const QString& theText,
272 QObject* theParent, const QObject* theReceiver,
273 const char* theMember, const QString& theToolTip,
274 const QString& theStatusTip)
276 QAction* anAction = new QAction(theIcon, theText, theParent);
277 anAction->setToolTip(theToolTip.isEmpty() ? theText : theToolTip);
278 anAction->setStatusTip(!theStatusTip.isEmpty() ? theStatusTip :
279 (!theToolTip.isEmpty() ? theToolTip : theText));
281 QObject::connect(anAction, SIGNAL(triggered(bool)), theReceiver, theMember);
286 QString objectInfo(const ObjectPtr& theObj, const bool isUseAttributesInfo)
288 QString aFeatureStr = "feature";
292 std::ostringstream aPtrStr;
293 aPtrStr << "[" << theObj.get() << "]";
295 ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(theObj);
296 FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObj);
298 aFeatureStr.append(QString("(result%1)").arg(aPtrStr.str().c_str()).toStdString() .c_str());
299 if (aRes->isDisabled())
300 aFeatureStr.append("[disabled]");
301 if (aRes->isConcealed())
302 aFeatureStr.append("[concealed]");
303 if (ModelAPI_Tools::hasSubResults(aRes))
304 aFeatureStr.append("[hasSubResults]");
306 aFeature = ModelAPI_Feature::feature(aRes);
309 aFeatureStr.append(aPtrStr.str().c_str());
311 if (aFeature.get()) {
312 aFeatureStr.append(QString(": %1").arg(aFeature->getKind().c_str()).toStdString().c_str());
313 if (aFeature->data()->isValid()) {
314 aFeatureStr.append(QString(", name=%1").arg(theObj->data()->name().c_str()).toStdString()
317 if (isUseAttributesInfo) {
318 std::set<std::shared_ptr<ModelAPI_Attribute> > anAttributes;
319 std::string aPointsInfo = ModelGeomAlgo_Point2D::getPontAttributesInfo(aFeature,
320 anAttributes).c_str();
321 if (!aPointsInfo.empty())
322 aFeatureStr.append(QString(", attributes: %1")
323 .arg(aPointsInfo.c_str()).toStdString().c_str());
330 #ifdef DEBUG_SELECTION_INFO
331 QString getShapeTypeInfo(const int theType)
333 QString anInfo = "Undefined";
335 case TopAbs_COMPOUND: anInfo = "compound"; break;
336 case TopAbs_COMPSOLID: anInfo = "compsolid"; break;
337 case TopAbs_SOLID: anInfo = "solid"; break;
338 case TopAbs_SHELL: anInfo = "shell"; break;
339 case TopAbs_FACE: anInfo = "face"; break;
340 case TopAbs_WIRE: anInfo = "wire"; break;
341 case TopAbs_EDGE: anInfo = "edge"; break;
342 case TopAbs_VERTEX: anInfo = "vertex"; break;
343 case TopAbs_SHAPE: anInfo = "shape"; break;
344 case ModuleBase_ResultPrs::Sel_Result:
345 anInfo = "result_shape"; break;
351 QString getModeInfo(const int theMode)
353 QString anInfo = "Undefined";
355 case 0: anInfo = "SHAPE(0)"; break;
356 case 1: anInfo = "VERTEX(1)"; break;
357 case 2: anInfo = "EDGE(2)"; break;
358 case 3: anInfo = "WIRE(3)"; break;
359 case 4: anInfo = "FACE(4)"; break;
360 case 5: anInfo = "SHELL(5)"; break;
361 case 6: anInfo = "SOLID(6)"; break;
362 case 7: anInfo = "COMPSOLID(7)"; break;
363 case 8: anInfo = "COMPOUND(8)"; break;
364 case 100: anInfo = "Sel_Mode_First(100)"; break; //SketcherPrs_Tools
365 case 101: anInfo = "Sel_Constraint(101)"; break;
366 case 102: anInfo = "Sel_Dimension_All(102)"; break;
367 case 103: anInfo = "Sel_Dimension_Line(103)"; break;
368 case 104: anInfo = "Sel_Dimension_Text(104)"; break;
374 QString displayedInteractiveObjects(Handle(AIS_InteractiveContext)& theContext,
375 const bool theShapeInfoOnly = true)
377 if (theContext.IsNull())
379 AIS_ListOfInteractive aListOfIO;
380 theContext->DisplayedObjects(aListOfIO, false);
381 QStringList anObjects;
382 AIS_ListIteratorOfListOfInteractive aIt;
383 for (aIt.Initialize(aListOfIO); aIt.More(); aIt.Next()) {
384 Handle(AIS_InteractiveObject) anAISIO = aIt.Value();
385 Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(anAISIO);
386 if (theShapeInfoOnly && aShapePrs.IsNull())
389 QString anInfo = "IO";
390 std::ostringstream aPtrStr;
391 aPtrStr << "[" << anAISIO.Access() << "]";
392 anInfo += aPtrStr.str().c_str();
394 if (!aShapePrs.IsNull()) {
395 const TopoDS_Shape& aShape = aShapePrs->Shape();
396 if (aShape.IsNull()) {
397 //Events_Error::throwException("An empty AIS presentation");
400 anInfo += QString(", shape type: %1").arg(getShapeTypeInfo(aShape.ShapeType()));
402 TColStd_ListOfInteger aTColModes;
403 theContext->ActivatedModes(anAISIO, aTColModes);
404 TColStd_ListIteratorOfListOfInteger itr( aTColModes );
405 QIntList aModesActivatedForIO;
406 bool isDeactivated = false;
408 for (; itr.More(); itr.Next() ) {
409 Standard_Integer aMode = itr.Value();
410 aModes.append(getModeInfo(aMode));
411 //int aShapeMode = (aMode > 8)? aMode : AIS_Shape::SelectionType(aMode);
413 if (aModes.size() > 0)
414 anInfo += QString(", activated modes: %1").arg(aModes.join(", "));
418 QString aValue = QString("displayedIO[%1]").arg(anObjects.size());
419 if (anObjects.size() > 0)
420 aValue += QString(":\n %1").arg(anObjects.join("\n "));
424 QString activeOwners(Handle(AIS_InteractiveContext)& theContext, const bool theShapeInfoOnly = true)
426 if (theContext.IsNull())
428 Handle(AIS_LocalContext) aLContext = theContext->LocalContext();
429 TCollection_AsciiString aSelectionName = aLContext->SelectionName();
430 aLContext->UnhilightPicked(Standard_False);
432 NCollection_List<Handle(SelectBasics_EntityOwner)> anActiveOwners;
433 aLContext->MainSelector()->ActiveOwners(anActiveOwners);
434 NCollection_List<Handle(SelectBasics_EntityOwner)>::Iterator anOwnersIt (anActiveOwners);
435 Handle(SelectMgr_EntityOwner) anOwner;
436 QStringList anObjects;
437 for (; anOwnersIt.More(); anOwnersIt.Next()) {
438 anOwner = Handle(SelectMgr_EntityOwner)::DownCast (anOwnersIt.Value());
439 Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(anOwner);
440 if (theShapeInfoOnly && BROwnr.IsNull())
443 QString anInfo = "Owner";
444 std::ostringstream aPtrStr;
445 aPtrStr << "[" << anOwner.Access() << "]";
446 anInfo += aPtrStr.str().c_str();
448 Handle(AIS_InteractiveObject) aAISObj =
449 Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable());
450 if (!aAISObj.IsNull()) {
451 std::ostringstream aPtrStr;
452 aPtrStr << "[" << aAISObj.Access() << "]";
453 anInfo += QString(", selectable(IO): %1").arg(aPtrStr.str().c_str());
456 if (!BROwnr.IsNull() && BROwnr->HasShape()) {
457 const TopoDS_Shape& aShape = BROwnr->Shape();
458 if (aShape.IsNull()) {
459 //Events_Error::throwException("An empty AIS presentation");
462 anInfo += QString(", shape type: %1").arg(getShapeTypeInfo(aShape.ShapeType()));
466 QString aValue = QString("activeOwners[%1]").arg(anObjects.size());
467 if (anObjects.size() > 0)
468 aValue += QString(":\n %1").arg(anObjects.join("\n "));
472 QString selectedOwners(Handle(AIS_InteractiveContext)& theContext,
473 const bool theShapeInfoOnly = true)
475 QStringList anObjects;
476 if (theContext.IsNull())
479 QList<long> aSelectedIds; // Remember of selected address in order to avoid duplicates
480 for (theContext->InitSelected(); theContext->MoreSelected(); theContext->NextSelected()) {
481 Handle(SelectMgr_EntityOwner) anOwner = theContext->SelectedOwner();
482 Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(anOwner);
483 if (theShapeInfoOnly && BROwnr.IsNull())
486 if (aSelectedIds.contains((long)anOwner.Access()))
488 aSelectedIds.append((long)anOwner.Access());
490 QString anInfo = "Owner";
491 std::ostringstream aPtrStr;
492 aPtrStr << "[" << anOwner.Access() << "]";
493 anInfo += aPtrStr.str().c_str();
495 if (!BROwnr.IsNull() && BROwnr->HasShape()) {
496 const TopoDS_Shape& aShape = BROwnr->Shape();
497 anInfo += QString(", shape type = %1").arg(getShapeTypeInfo(aShape.ShapeType()));
501 QString aValue = QString("selectedOwners[%1]").arg(anObjects.size());
502 if (anObjects.size() > 0)
503 aValue += QString(":\n %1").arg(anObjects.join("\n "));
508 void selectionInfo(Handle(AIS_InteractiveContext)& theContext, const std::string& thePrefix)
510 #ifdef DEBUG_SELECTION_INFO
511 QString aValue = QString("\n\n\nDEBUG_SELECTION_INFO for '%1'\n%2\n%3\n%4")
512 .arg(thePrefix.c_str())
513 .arg(displayedInteractiveObjects(theContext))
514 .arg(activeOwners(theContext))
515 .arg(selectedOwners(theContext));
516 qDebug(aValue.toStdString().c_str());
520 typedef QMap<QString, int> ShapeTypes;
521 static ShapeTypes myShapeTypes;
523 int shapeType(const QString& theType)
525 if (myShapeTypes.count() == 0) {
526 myShapeTypes["compound"] = TopAbs_COMPOUND;
527 myShapeTypes["compounds"] = TopAbs_COMPOUND;
528 myShapeTypes["compsolid"] = TopAbs_COMPSOLID;
529 myShapeTypes["compsolids"] = TopAbs_COMPSOLID;
530 myShapeTypes["solid"] = TopAbs_SOLID;
531 myShapeTypes["solids"] = TopAbs_SOLID;
532 myShapeTypes["shell"] = TopAbs_SHELL;
533 myShapeTypes["shells"] = TopAbs_SHELL;
534 myShapeTypes["face"] = TopAbs_FACE;
535 myShapeTypes["faces"] = TopAbs_FACE;
536 myShapeTypes["wire"] = TopAbs_WIRE;
537 myShapeTypes["wires"] = TopAbs_WIRE;
538 myShapeTypes["edge"] = TopAbs_EDGE;
539 myShapeTypes["edges"] = TopAbs_EDGE;
540 myShapeTypes["vertex"] = TopAbs_VERTEX;
541 myShapeTypes["vertices"] = TopAbs_VERTEX;
542 myShapeTypes["object"] = ModuleBase_ResultPrs::Sel_Result;
543 myShapeTypes["objects"] = ModuleBase_ResultPrs::Sel_Result;
545 QString aType = theType.toLower();
546 if(myShapeTypes.contains(aType))
547 return myShapeTypes[aType];
548 Events_InfoMessage("ModuleBase_Tools", "Shape type defined in XML is not implemented!").send();
552 void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFeature,
553 bool& hasParameter, bool& hasCompositeOwner)
557 hasParameter = false;
558 hasCompositeOwner = false;
559 foreach(ObjectPtr aObj, theObjects) {
560 FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
561 ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
562 ResultParameterPtr aConstruction = std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aResult);
564 hasResult |= (aResult.get() != NULL);
565 hasFeature |= (aFeature.get() != NULL);
566 hasParameter |= (aConstruction.get() != NULL);
568 hasCompositeOwner |= (ModelAPI_Tools::compositeOwner(aFeature) != NULL);
569 if (hasFeature && hasResult && hasParameter && hasCompositeOwner)
574 /*bool setDefaultDeviationCoefficient(std::shared_ptr<GeomAPI_Shape> theGeomShape)
576 if (!theGeomShape.get())
578 // if the shape could not be exploded on faces, it contains only wires, edges, and vertices
579 // correction of deviation for them should not influence to the application performance
580 GeomAPI_ShapeExplorer anExp(theGeomShape, GeomAPI_Shape::FACE);
581 bool anEmpty = anExp.empty();
582 return !anExp.more();
585 /*void setDefaultDeviationCoefficient(const std::shared_ptr<ModelAPI_Result>& theResult,
586 const Handle(Prs3d_Drawer)& theDrawer)
588 if (!theResult.get())
590 bool aUseDeviation = false;
592 std::string aResultGroup = theResult->groupName();
593 if (aResultGroup == ModelAPI_ResultConstruction::group())
594 aUseDeviation = true;
595 else if (aResultGroup == ModelAPI_ResultBody::group()) {
596 GeomShapePtr aGeomShape = theResult->shape();
597 if (aGeomShape.get())
598 aUseDeviation = setDefaultDeviationCoefficient(aGeomShape);
601 theDrawer->SetDeviationCoefficient(DEFAULT_DEVIATION_COEFFICIENT);
604 void setDefaultDeviationCoefficient(const TopoDS_Shape& theShape,
605 const Handle(Prs3d_Drawer)& theDrawer)
607 if (theShape.IsNull())
610 std::shared_ptr<GeomAPI_Shape> aGeomShape(new GeomAPI_Shape());
611 aGeomShape->setImpl(new TopoDS_Shape(theShape));
613 // if the shape could not be exploded on faces, it contains only wires, edges, and vertices
614 // correction of deviation for them should not influence to the application performance
615 GeomAPI_ShapeExplorer anExp(aGeomShape, GeomAPI_Shape::FACE);
616 bool isConstruction = !anExp.more();
620 aDeflection = Config_PropManager::real("Visualization", "construction_deflection",
621 ModelAPI_ResultConstruction::DEFAULT_DEFLECTION());
623 aDeflection = Config_PropManager::real("Visualization", "body_deflection",
624 ModelAPI_ResultBody::DEFAULT_DEFLECTION());
626 theDrawer->SetDeviationCoefficient(aDeflection);
629 Quantity_Color color(const std::string& theSection,
630 const std::string& theName,
631 const std::string& theDefault)
633 std::vector<int> aColor = Config_PropManager::color(theSection, theName, theDefault);
634 return Quantity_Color(aColor[0] / 255., aColor[1] / 255., aColor[2] / 255., Quantity_TOC_RGB);
637 ObjectPtr getObject(const AttributePtr& theAttribute)
640 std::string anAttrType = theAttribute->attributeType();
641 if (anAttrType == ModelAPI_AttributeRefAttr::typeId()) {
642 AttributeRefAttrPtr anAttr =
643 std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
644 if (anAttr != NULL && anAttr->isObject())
645 anObject = anAttr->object();
647 if (anAttrType == ModelAPI_AttributeSelection::typeId()) {
648 AttributeSelectionPtr anAttr =
649 std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
651 anObject = anAttr->context();
653 if (anAttrType == ModelAPI_AttributeReference::typeId()) {
654 AttributeReferencePtr anAttr =
655 std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
656 if (anAttr.get() != NULL)
657 anObject = anAttr->value();
662 TopAbs_ShapeEnum getCompoundSubType(const TopoDS_Shape& theShape)
664 TopAbs_ShapeEnum aShapeType = theShape.ShapeType();
666 // for compounds check sub-shapes: it may be compound of needed type:
667 // Booleans may produce compounds of Solids
668 if (aShapeType == TopAbs_COMPOUND) {
669 for(TopoDS_Iterator aSubs(theShape); aSubs.More(); aSubs.Next()) {
670 if (!aSubs.Value().IsNull()) {
671 TopAbs_ShapeEnum aSubType = aSubs.Value().ShapeType();
672 if (aSubType == TopAbs_COMPOUND) { // compound of compound(s)
673 aShapeType = TopAbs_COMPOUND;
676 if (aShapeType == TopAbs_COMPOUND) {
677 aShapeType = aSubType;
678 } else if (aShapeType != aSubType) { // compound of shapes of different types
679 aShapeType = TopAbs_COMPOUND;
688 void getParameters(QStringList& theParameters)
690 theParameters.clear();
692 SessionPtr aSession = ModelAPI_Session::get();
693 std::list<DocumentPtr> aDocList;
694 DocumentPtr anActiveDocument = aSession->activeDocument();
695 DocumentPtr aRootDocument = aSession->moduleDocument();
696 aDocList.push_back(anActiveDocument);
697 if (anActiveDocument != aRootDocument) {
698 aDocList.push_back(aRootDocument);
700 std::string aGroupId = ModelAPI_ResultParameter::group();
701 for(std::list<DocumentPtr>::const_iterator it = aDocList.begin(); it != aDocList.end(); ++it) {
702 DocumentPtr aDocument = *it;
703 int aSize = aDocument->size(aGroupId);
704 for (int i = 0; i < aSize; i++) {
705 ObjectPtr anObject = aDocument->object(aGroupId, i);
706 std::string aParameterName = anObject->data()->name();
707 theParameters.append(aParameterName.c_str());
712 std::string findGreedAttribute(ModuleBase_IWorkshop* theWorkshop,
713 const FeaturePtr& theFeature)
715 std::string anAttributeId;
717 std::string aXmlCfg, aDescription;
718 theWorkshop->module()->getXMLRepresentation(theFeature->getKind(), aXmlCfg, aDescription);
720 ModuleBase_WidgetFactory aFactory(aXmlCfg, theWorkshop);
721 std::string anAttributeTitle;
722 aFactory.getGreedAttribute(anAttributeId);
724 return anAttributeId;
727 bool hasObject(const AttributePtr& theAttribute, const ObjectPtr& theObject,
728 const std::shared_ptr<GeomAPI_Shape>& theShape,
729 ModuleBase_IWorkshop* theWorkshop,
730 const bool theTemporarily)
732 bool aHasObject = false;
733 if (!theAttribute.get())
736 std::string aType = theAttribute->attributeType();
737 if (aType == ModelAPI_AttributeReference::typeId()) {
738 AttributeReferencePtr aRef =
739 std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
740 ObjectPtr aObject = aRef->value();
741 aHasObject = aObject && aObject->isSame(theObject);
742 //if (!(aObject && aObject->isSame(theObject))) {
743 // aRef->setValue(theObject);
745 } else if (aType == ModelAPI_AttributeRefAttr::typeId()) {
746 AttributeRefAttrPtr aRefAttr =
747 std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
749 AttributePtr anAttribute = theWorkshop->module()->findAttribute(theObject, theShape);
750 if (anAttribute.get()) {
751 //aRefAttr->setAttr(anAttribute);
754 ObjectPtr aObject = aRefAttr->object();
755 aHasObject = aObject && aObject->isSame(theObject);
756 //if (!(aObject && aObject->isSame(theObject))) {
757 // aRefAttr->setObject(theObject);
760 } else if (aType == ModelAPI_AttributeSelection::typeId()) {
761 /*AttributeSelectionPtr aSelectAttr =
762 std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
763 ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
764 if (aSelectAttr.get() != NULL) {
765 aSelectAttr->setValue(aResult, theShape, theTemporarily);
768 if (aType == ModelAPI_AttributeSelectionList::typeId()) {
769 AttributeSelectionListPtr aSelectionListAttr =
770 std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
771 ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
772 aHasObject = aSelectionListAttr->isInList(aResult, theShape, theTemporarily);
774 else if (aType == ModelAPI_AttributeRefList::typeId()) {
775 AttributeRefListPtr aRefListAttr =
776 std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttribute);
777 aHasObject = aRefListAttr->isInList(theObject);
778 //if (!theCheckIfAttributeHasObject || !aRefListAttr->isInList(theObject))
779 // aRefListAttr->append(theObject);
781 else if (aType == ModelAPI_AttributeRefAttrList::typeId()) {
782 AttributeRefAttrListPtr aRefAttrListAttr =
783 std::dynamic_pointer_cast<ModelAPI_AttributeRefAttrList>(theAttribute);
784 AttributePtr anAttribute = theWorkshop->module()->findAttribute(theObject, theShape);
786 if (anAttribute.get()) {
787 aHasObject = aRefAttrListAttr->isInList(anAttribute);
788 //if (!theCheckIfAttributeHasObject || !aRefAttrListAttr->isInList(anAttribute))
789 // aRefAttrListAttr->append(anAttribute);
792 aHasObject = aRefAttrListAttr->isInList(theObject);
793 //if (!theCheckIfAttributeHasObject || !aRefAttrListAttr->isInList(theObject))
794 // aRefAttrListAttr->append(theObject);
800 bool setObject(const AttributePtr& theAttribute, const ObjectPtr& theObject,
801 const GeomShapePtr& theShape, ModuleBase_IWorkshop* theWorkshop,
802 const bool theTemporarily, const bool theCheckIfAttributeHasObject)
804 if (!theAttribute.get())
808 std::string aType = theAttribute->attributeType();
809 if (aType == ModelAPI_AttributeReference::typeId()) {
810 AttributeReferencePtr aRef =
811 std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
812 ObjectPtr aObject = aRef->value();
813 if (!(aObject && aObject->isSame(theObject))) {
814 aRef->setValue(theObject);
816 } else if (aType == ModelAPI_AttributeRefAttr::typeId()) {
817 AttributeRefAttrPtr aRefAttr =
818 std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
820 AttributePtr anAttribute = theWorkshop->module()->findAttribute(theObject, theShape);
821 if (anAttribute.get())
822 aRefAttr->setAttr(anAttribute);
824 ObjectPtr aObject = aRefAttr->object();
825 if (!(aObject && aObject->isSame(theObject))) {
826 aRefAttr->setObject(theObject);
829 } else if (aType == ModelAPI_AttributeSelection::typeId()) {
830 AttributeSelectionPtr aSelectAttr =
831 std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
832 ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
833 if (aSelectAttr.get() != NULL) {
834 aSelectAttr->setValue(aResult, theShape, theTemporarily);
837 if (aType == ModelAPI_AttributeSelectionList::typeId()) {
838 AttributeSelectionListPtr aSelectionListAttr =
839 std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
840 ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
841 if (!theCheckIfAttributeHasObject ||
842 !aSelectionListAttr->isInList(aResult, theShape, theTemporarily))
843 aSelectionListAttr->append(aResult, theShape, theTemporarily);
845 else if (aType == ModelAPI_AttributeRefList::typeId()) {
846 AttributeRefListPtr aRefListAttr =
847 std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttribute);
848 if (!theCheckIfAttributeHasObject || !aRefListAttr->isInList(theObject)) {
850 aRefListAttr->append(theObject);
855 else if (aType == ModelAPI_AttributeRefAttrList::typeId()) {
856 AttributeRefAttrListPtr aRefAttrListAttr =
857 std::dynamic_pointer_cast<ModelAPI_AttributeRefAttrList>(theAttribute);
858 AttributePtr anAttribute = theWorkshop->module()->findAttribute(theObject, theShape);
860 if (anAttribute.get()) {
861 if (!theCheckIfAttributeHasObject || !aRefAttrListAttr->isInList(anAttribute))
862 aRefAttrListAttr->append(anAttribute);
865 if (!theCheckIfAttributeHasObject || !aRefAttrListAttr->isInList(theObject)) {
867 aRefAttrListAttr->append(theObject);
876 GeomShapePtr getShape(const AttributePtr& theAttribute, ModuleBase_IWorkshop* theWorkshop)
879 if (!theAttribute.get())
882 std::string aType = theAttribute->attributeType();
883 if (aType == ModelAPI_AttributeReference::typeId()) {
884 } else if (aType == ModelAPI_AttributeRefAttr::typeId()) {
885 AttributeRefAttrPtr aRefAttr =
886 std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
887 if (aRefAttr.get() && !aRefAttr->isObject()) {
888 AttributePtr anAttribute = aRefAttr->attr();
889 aShape = theWorkshop->module()->findShape(anAttribute);
891 } else if (aType == ModelAPI_AttributeSelection::typeId()) {
892 AttributeSelectionPtr aSelectAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
894 aShape = aSelectAttr->value();
896 else // Geom2D point processing
897 aShape = theWorkshop->module()->findShape(theAttribute);
901 void flushUpdated(ObjectPtr theObject)
903 blockUpdateViewer(true);
905 Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
907 blockUpdateViewer(false);
910 void blockUpdateViewer(const bool theValue)
912 // the viewer update should be blocked in order to avoid the temporary feature content
913 // when the solver processes the feature, the redisplay message can be flushed
914 // what caused the display in the viewer preliminary states of object
915 // e.g. fillet feature, angle value change
916 std::shared_ptr<Events_Message> aMsg;
918 aMsg = std::shared_ptr<Events_Message>(
919 new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED)));
922 // the viewer update should be unblocked
923 aMsg = std::shared_ptr<Events_Message>(
924 new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED)));
926 Events_Loop::loop()->send(aMsg);
929 QString wrapTextByWords(const QString& theValue, QWidget* theWidget,
930 int theMaxLineInPixels)
932 static QFontMetrics tfm(theWidget ? theWidget->font() : QApplication::font());
933 static qreal phi = 2.618;
935 QRect aBounds = tfm.boundingRect(theValue);
936 if(aBounds.width() <= theMaxLineInPixels)
939 qreal s = aBounds.width() * aBounds.height();
940 qreal aGoldWidth = sqrt(s*phi);
942 QStringList aWords = theValue.split(" ", QString::SkipEmptyParts);
944 int n = aWords.count();
946 for (int i = 0; i < n; i++) {
947 QString aLineExt = aLine + " " + aWords[i];
948 qreal anWidthNonExt = tfm.boundingRect(aLine).width();
949 qreal anWidthExt = tfm.boundingRect(aLineExt).width();
950 qreal aDeltaNonExt = fabs(anWidthNonExt-aGoldWidth);
951 qreal aDeltaExt = fabs(anWidthExt-aGoldWidth);
952 if(aDeltaNonExt < aDeltaExt) {
954 aLines.append(aLine);
962 aLines.append(aLine);
964 QString aResult = aLines.join("\n");
968 //**************************************************************
969 void refsToFeatureInFeatureDocument(const ObjectPtr& theObject,
970 std::set<FeaturePtr>& theRefFeatures)
972 FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
973 if (aFeature.get()) {
974 DocumentPtr aFeatureDoc = aFeature->document();
975 // 1. find references in the current document
976 aFeatureDoc->refsToFeature(aFeature, theRefFeatures, false);
981 //**************************************************************
982 /*bool isSubOfComposite(const ObjectPtr& theObject)
985 std::set<FeaturePtr> aRefFeatures;
986 refsToFeatureInFeatureDocument(theObject, aRefFeatures);
987 std::set<FeaturePtr>::const_iterator anIt = aRefFeatures.begin(),
988 aLast = aRefFeatures.end();
989 for (; anIt != aLast && !isSub; anIt++) {
990 isSub = isSubOfComposite(theObject, *anIt);
995 //**************************************************************
996 /*bool isSubOfComposite(const ObjectPtr& theObject, const FeaturePtr& theFeature)
999 CompositeFeaturePtr aComposite = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(theFeature);
1000 if (aComposite.get()) {
1001 isSub = aComposite->isSub(theObject);
1002 // the recursive is possible, the parameters are sketch circle and extrusion cut. They are
1003 // separated by composite sketch feature
1005 int aNbSubs = aComposite->numberOfSubs();
1006 for (int aSub = 0; aSub < aNbSubs && !isSub; aSub++) {
1007 isSub = isSubOfComposite(theObject, aComposite->subFeature(aSub));
1014 //**************************************************************
1015 ResultPtr firstResult(const ObjectPtr& theObject)
1017 ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
1018 if (!aResult.get()) {
1019 FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
1021 aResult = aFeature->firstResult();
1026 //**************************************************************
1027 bool isFeatureOfResult(const FeaturePtr& theFeature, const std::string& theGroupOfResult)
1029 bool isResult = false;
1031 if (!theFeature->data()->isValid())
1034 ResultPtr aFirstResult = theFeature->firstResult();
1035 if (!aFirstResult.get())
1038 return aFirstResult->groupName() == theGroupOfResult;
1041 //**************************************************************
1042 bool hasModuleDocumentFeature(const std::set<FeaturePtr>& theFeatures)
1044 bool aFoundModuleDocumentObject = false;
1045 DocumentPtr aModuleDoc = ModelAPI_Session::get()->moduleDocument();
1047 std::set<FeaturePtr>::const_iterator anIt = theFeatures.begin(), aLast = theFeatures.end();
1048 for (; anIt != aLast && !aFoundModuleDocumentObject; anIt++) {
1049 FeaturePtr aFeature = *anIt;
1050 ResultPtr aResult = ModuleBase_Tools::firstResult(aFeature);
1051 if (aResult.get() && aResult->groupName() == ModelAPI_ResultPart::group())
1053 aFoundModuleDocumentObject = aFeature->document() == aModuleDoc;
1056 return aFoundModuleDocumentObject;
1059 //**************************************************************
1060 bool askToDelete(const std::set<FeaturePtr> theFeatures,
1061 const std::map<FeaturePtr, std::set<FeaturePtr> >& theReferences,
1063 std::set<FeaturePtr>& theReferencesToDelete,
1064 const std::string& thePrefixInfo)
1066 QString aNotActivatedDocWrn;
1067 std::string aNotActivatedNames;
1068 if (!ModelAPI_Tools::allDocumentsActivated(aNotActivatedNames)) {
1069 if (ModuleBase_Tools::hasModuleDocumentFeature(theFeatures))
1070 aNotActivatedDocWrn =
1071 QObject::tr("Selected objects can be used in Part documents which are not loaded:%1.\n")
1072 .arg(aNotActivatedNames.c_str());
1075 std::set<FeaturePtr> aFeaturesRefsTo;
1076 std::set<FeaturePtr> aFeaturesRefsToParameter;
1077 std::set<FeaturePtr> aParameterFeatures;
1078 QStringList aPartFeatureNames;
1079 std::set<FeaturePtr>::const_iterator anIt = theFeatures.begin(),
1080 aLast = theFeatures.end();
1081 // separate features to references to parameter features and references to others
1082 for (; anIt != aLast; anIt++) {
1083 FeaturePtr aFeature = *anIt;
1084 if (theReferences.find(aFeature) == theReferences.end())
1087 if (isFeatureOfResult(aFeature, ModelAPI_ResultPart::group()))
1088 aPartFeatureNames.append(aFeature->name().c_str());
1090 std::set<FeaturePtr> aRefFeatures;
1091 std::set<FeaturePtr> aRefList = theReferences.at(aFeature);
1092 std::set<FeaturePtr>::const_iterator aRefIt = aRefList.begin(), aRefLast = aRefList.end();
1093 for (; aRefIt != aRefLast; aRefIt++) {
1094 FeaturePtr aRefFeature = *aRefIt;
1095 if (theFeatures.find(aRefFeature) == theFeatures.end() && // it is not selected
1096 aRefFeatures.find(aRefFeature) == aRefFeatures.end()) // it is not added
1097 aRefFeatures.insert(aRefFeature);
1100 if (isFeatureOfResult(aFeature, ModelAPI_ResultParameter::group())) {
1101 aFeaturesRefsToParameter.insert(aRefFeatures.begin(), aRefFeatures.end());
1102 aParameterFeatures.insert(aFeature);
1105 theReferencesToDelete.insert(aRefFeatures.begin(), aRefFeatures.end());
1109 std::set<FeaturePtr> aFeaturesRefsToParameterOnly;
1110 anIt = aFeaturesRefsToParameter.begin();
1111 aLast = aFeaturesRefsToParameter.end();
1112 // separate features to references to parameter features and references to others
1113 QStringList aParamFeatureNames;
1114 for (; anIt != aLast; anIt++) {
1115 FeaturePtr aFeature = *anIt;
1116 if (theReferencesToDelete.find(aFeature) == theReferencesToDelete.end()) {
1117 aFeaturesRefsToParameterOnly.insert(aFeature);
1118 aParamFeatureNames.append(aFeature->name().c_str());
1121 aParamFeatureNames.sort();
1122 QStringList anOtherFeatureNames;
1123 anIt = theReferencesToDelete.begin();
1124 aLast = theReferencesToDelete.end();
1125 for (; anIt != aLast; anIt++) {
1126 FeaturePtr aFeature = *anIt;
1127 if (isFeatureOfResult(aFeature, ModelAPI_ResultPart::group()))
1128 aPartFeatureNames.append(aFeature->name().c_str());
1130 anOtherFeatureNames.append(aFeature->name().c_str());
1132 aPartFeatureNames.sort();
1133 anOtherFeatureNames.sort();
1135 bool aCanReplaceParameters = !aFeaturesRefsToParameterOnly.empty();
1137 QMessageBox aMessageBox(theParent);
1138 aMessageBox.setWindowTitle(QObject::tr("Delete features"));
1139 aMessageBox.setIcon(QMessageBox::Warning);
1140 aMessageBox.setStandardButtons(QMessageBox::No | QMessageBox::Yes);
1141 aMessageBox.setDefaultButton(QMessageBox::No);
1144 if (!thePrefixInfo.empty())
1145 aText = thePrefixInfo.c_str();
1146 QString aSep = ", ";
1147 if (!aPartFeatureNames.empty()) {
1148 aText += QString(QObject::tr("The following parts will be deleted: %1.\n"))
1149 .arg(aPartFeatureNames.join(aSep));
1151 if (!aNotActivatedDocWrn.isEmpty())
1152 aText += aNotActivatedDocWrn;
1153 if (!anOtherFeatureNames.empty()) {
1154 const char* aMsg = "Features are used in the following features: %1.\nThese "
1155 "features will be deleted.\n";
1156 aText += QString(QObject::tr(aMsg))
1157 .arg(anOtherFeatureNames.join(aSep));
1159 if (!aParamFeatureNames.empty()) {
1160 const char* aMsg = "Parameters are used in the following features: %1.\nThese features will "
1161 "be deleted.\nOr parameters could be replaced by their values.\n";
1162 aText += QString(QObject::tr(aMsg))
1163 .arg(aParamFeatureNames.join(aSep));
1164 QPushButton *aReplaceButton =
1165 aMessageBox.addButton(QObject::tr("Replace"), QMessageBox::ActionRole);
1168 if (!aText.isEmpty()) {
1169 aText += "Would you like to continue?";
1170 aMessageBox.setText(aText);
1172 QMessageBox::ButtonRole aButtonRole = aMessageBox.buttonRole(aMessageBox.clickedButton());
1174 if (aButtonRole == QMessageBox::NoRole)
1177 if (aButtonRole == QMessageBox::ActionRole) {
1178 foreach (FeaturePtr aObj, aParameterFeatures)
1179 ModelAPI_ReplaceParameterMessage::send(aObj, 0);
1182 theReferencesToDelete.insert(aFeaturesRefsToParameterOnly.begin(),
1183 aFeaturesRefsToParameterOnly.end());
1188 //**************************************************************
1189 void convertToFeatures(const QObjectPtrList& theObjects, std::set<FeaturePtr>& theFeatures)
1191 QObjectPtrList::const_iterator anIt = theObjects.begin(), aLast = theObjects.end();
1192 for(; anIt != aLast; anIt++) {
1193 ObjectPtr anObject = *anIt;
1194 FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(anObject);
1195 // for parameter result, use the corresponded reature to be removed
1196 if (!aFeature.get() && anObject->groupName() == ModelAPI_ResultParameter::group()) {
1197 aFeature = ModelAPI_Feature::feature(anObject);
1199 theFeatures.insert(aFeature);
1203 void translate(const std::string& theContext, std::string& theMessage)
1205 if (!theMessage.empty()) {
1206 std::string aStr = Config_Translator::translate(theContext, theMessage);
1207 if (!aStr.empty()) {
1208 std::string aCodec = Config_Translator::codec(theContext);
1209 theMessage = QTextCodec::codecForName(aCodec.c_str())->toUnicode(aStr.c_str()).toStdString();
1214 void setPointBallHighlighting(AIS_Shape* theAIS)
1216 static Handle(Image_AlienPixMap) aPixMap;
1217 if(aPixMap.IsNull()) {
1218 // Load icon for the presentation
1220 char* anEnv = getenv("SHAPER_ROOT_DIR");
1222 aFile = std::string(anEnv) +
1223 FSEP + "share" + FSEP + "salome" + FSEP + "resources" + FSEP + "shaper";
1225 anEnv = getenv("OPENPARTS_ROOT_DIR");
1227 aFile = std::string(anEnv) + FSEP + "resources";
1231 static const std::string aMarkerName = "marker_dot.png";
1232 aFile += aMarkerName;
1233 aPixMap = new Image_AlienPixMap();
1234 if(!aPixMap->Load(aFile.c_str())) {
1235 // The icon for constraint is not found
1236 static const std::string aMsg =
1237 "Error: Point market not found by path: \"" + aFile + "\". Falling back.";
1238 //Events_InfoMessage("ModuleBase_Tools::setPointBallHighlighting", aMsg).send();
1242 Handle(Graphic3d_AspectMarker3d) anAspect;
1243 Handle(Prs3d_Drawer) aDrawer = theAIS->HilightAttributes();
1244 if(aDrawer->HasOwnPointAspect()) {
1245 Handle(Prs3d_PointAspect) aPntAspect = aDrawer->PointAspect();
1246 if(aPixMap->IsEmpty()) {
1247 anAspect = aPntAspect->Aspect();
1248 anAspect->SetType(Aspect_TOM_BALL);
1250 if(aPixMap->Format() == Image_PixMap::ImgGray) {
1251 aPixMap->SetFormat (Image_PixMap::ImgAlpha);
1252 } else if(aPixMap->Format() == Image_PixMap::ImgGrayF) {
1253 aPixMap->SetFormat (Image_PixMap::ImgAlphaF);
1255 anAspect = new Graphic3d_AspectMarker3d(aPixMap);
1256 aPntAspect->SetAspect(anAspect);
1258 aDrawer->SetPointAspect(aPntAspect);
1259 theAIS->SetHilightAttributes(aDrawer);
1263 } // namespace ModuleBase_Tools