20#ifndef ModuleBase_Tools_H
21#define ModuleBase_Tools_H
23#include "ModuleBase.h"
24#include "ModuleBase_Definitions.h"
26#include <ModelAPI_Attribute.h>
27#include <ModelAPI_Feature.h>
28#include <ModelAPI_Folder.h>
30#include <TopAbs_ShapeEnum.hxx>
31#include <TopoDS_Shape.hxx>
32#include <Prs3d_Drawer.hxx>
33#include <AIS_Shape.hxx>
35#include <Quantity_Color.hxx>
56namespace ModuleBase_Tools {
59MODULEBASE_EXPORT
void adjustMargins(
QWidget* theWidget);
60MODULEBASE_EXPORT
void adjustMargins(QLayout* theLayout);
62MODULEBASE_EXPORT
void zeroMargins(
QWidget* theWidget);
63MODULEBASE_EXPORT
void zeroMargins(QLayout* theLayout);
70MODULEBASE_EXPORT
void activateWindow(
QWidget* theWidget,
const QString& theInfo = QString());
77MODULEBASE_EXPORT
void setFocus(
QWidget* theWidget,
const QString& theInfo = QString());
84MODULEBASE_EXPORT
void setShadowEffect(
QWidget* theWidget,
const bool isSetEffect);
96MODULEBASE_EXPORT QPixmap
composite(
const QString& theAdditionalIcon,
const QString& theIcon);
105MODULEBASE_EXPORT QPixmap
composite(
const QImage& theAdditionalIcon, QImage& theIcon);
117MODULEBASE_EXPORT QPixmap lighter(
const QString& theIcon,
const int theLighterValue = 200);
122MODULEBASE_EXPORT
void setSpinValue(
QDoubleSpinBox* theSpin,
double theValue);
152MODULEBASE_EXPORT QAction* createAction(
const QIcon& theIcon,
const QString& theText,
154 const char* theMember =
"",
155 const QString& theToolTip = QString(),
156 const QString& theStatusTip = QString());
162MODULEBASE_EXPORT QString objectName(
const ObjectPtr& theObj);
168MODULEBASE_EXPORT QString objectInfo(
const ObjectPtr& theObj,
169 const bool isUseAttributesInfo =
false);
175MODULEBASE_EXPORT
int shapeType(
const QString& theType);
180MODULEBASE_EXPORT
bool isSubResult(ObjectPtr theObject);
190MODULEBASE_EXPORT
void checkObjects(
const QObjectPtrList& theObjects,
bool& hasResult,
191 bool& hasFeature,
bool& hasParameter,
bool& hasCompositeOwner,
192 bool& hasResultInHistory,
bool& hasFolder,
bool &hasGroupsOnly);
206MODULEBASE_EXPORT
void setDefaultDeviationCoefficient(
const TopoDS_Shape& theShape,
207 const Handle(Prs3d_Drawer)& theDrawer);
213MODULEBASE_EXPORT Quantity_Color color(
const std::string& theSection,
214 const std::string& theName);
218MODULEBASE_EXPORT ObjectPtr getObject(
const AttributePtr& theAttribute);
222MODULEBASE_EXPORT TopAbs_ShapeEnum getCompoundSubType(
const TopoDS_Shape& theShape);
227MODULEBASE_EXPORT TopoDS_Shape getSelectedShape(
228 const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
232MODULEBASE_EXPORT
void getParameters(QStringList& theParameters);
237 const FeaturePtr& theFeature);
247MODULEBASE_EXPORT
bool hasObject(
const AttributePtr& theAttribute,
const ObjectPtr& theObject,
248 const std::shared_ptr<GeomAPI_Shape>& theShape,
250 const bool theTemporarily);
262MODULEBASE_EXPORT
bool setObject(
const AttributePtr& theAttribute,
const ObjectPtr& theObject,
263 const std::shared_ptr<GeomAPI_Shape>& theShape,
265 const bool theTemporarily,
266 const bool theCheckIfAttributeHasObject);
272MODULEBASE_EXPORT std::shared_ptr<GeomAPI_Shape> getShape(
const AttributePtr& theAttribute,
277MODULEBASE_EXPORT
void flushUpdated(ObjectPtr theObject);
281MODULEBASE_EXPORT
void blockUpdateViewer(
const bool theValue);
287MODULEBASE_EXPORT QString wrapTextByWords(
const QString& theValue,
QWidget* theWidget,
288 int theMaxLineInPixels = 150);
293MODULEBASE_EXPORT QLocale doubleLocale();
298void MODULEBASE_EXPORT refsToFeatureInFeatureDocument(
const ObjectPtr& theObject,
299 std::set<FeaturePtr>& theRefFeatures);
321std::shared_ptr<ModelAPI_Result> MODULEBASE_EXPORT firstResult(
const ObjectPtr& theObject);
327bool MODULEBASE_EXPORT hasModuleDocumentFeature(
const std::set<FeaturePtr>& theFeatures);
335bool MODULEBASE_EXPORT askToDelete(
const std::set<FeaturePtr> aFeatures,
336 const std::map<FeaturePtr,
337 std::set<FeaturePtr> >& theReferences,
339 std::set<FeaturePtr>& theReferencesToDelete,
340 const std::string& thePrefixInfo =
"");
345bool MODULEBASE_EXPORT warningAboutConflict(
QWidget* theParent,
const std::string& theWarningText);
352void MODULEBASE_EXPORT convertToFeatures(
const QObjectPtrList& theObjects,
353 std::set<FeaturePtr>& theFeatures);
359void MODULEBASE_EXPORT convertToFolders(
const QObjectPtrList& theObjects,
360 std::set<FolderPtr>& theFolders);
374QString MODULEBASE_EXPORT translate(
const std::string& theContext,
const std::string& theMessage);
382FeaturePtr MODULEBASE_EXPORT createParameter(
const QString& theText);
387void MODULEBASE_EXPORT editParameter(FeaturePtr theParam,
const QString& theText);
391bool MODULEBASE_EXPORT isNameExist(
const QString& theName, FeaturePtr theIgnoreParameter);
395FeaturePtr MODULEBASE_EXPORT findParameter(
const QString& theName);
402bool MODULEBASE_EXPORT isSameShape(
const TopoDS_Shape& theShape1,
const TopoDS_Shape& theShape2);
409std::wstring MODULEBASE_EXPORT generateName(
const AttributePtr& theAttribute,
413qreal MODULEBASE_EXPORT currentPixelRatio();
417void MODULEBASE_EXPORT setDisplaying(std::shared_ptr<ModelAPI_ResultPart> thePart,
418 bool theDisplayFromScript =
false);
An event message for sending a string message which has to be translated.
Definition: Events_InfoMessage.h:35
Interface to the topological shape object.
Definition: GeomAPI_Shape.h:43
Class which provides access to Workshop object services.
Definition: ModuleBase_IWorkshop.h:48
An extension of a double spin box which let to use parameters and expressions for value definition.
Definition: ModuleBase_ParamIntSpinBox.h:34
An extension of a double spin box which let to use parameters and expressions for value definition.
Definition: ModuleBase_ParamSpinBox.h:37
Presentation.
Definition: ModuleBase_ViewerPrs.h:37
QPixmap composite(const QString &theAdditionalIcon, const QString &theIcon)
Methods to modify a resource pixmap.
Definition: ModuleBase_Tools.cpp:244