shapetools: area for faces of the current shape .
return aGProps.Mass();
}
+//==================================================================================================
+double GeomAlgoAPI_ShapeTools::area (const std::shared_ptr<GeomAPI_Shape> theShape)
+{
+ GProp_GProps aGProps;
+ if(!theShape.get()) {
+ return 0.0;
+ }
+ const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
+ if(aShape.IsNull()) {
+ return 0.0;
+ }
+ const Standard_Real anEps = 1.e-6;
+
+ BRepGProp::SurfaceProperties(aShape, aGProps, anEps);
+ return aGProps.Mass();
+}
+
//==================================================================================================
std::shared_ptr<GeomAPI_Pnt>
GeomAlgoAPI_ShapeTools::centreOfMass(const std::shared_ptr<GeomAPI_Shape> theShape)
/// \return the total volume of the solids of the current shape or 0.0 if it can be computed.
GEOMALGOAPI_EXPORT static double volume(const std::shared_ptr<GeomAPI_Shape> theShape);
+ /// \return the total area of the faces of the current shape or 0.0 if it can be computed.
+ GEOMALGOAPI_EXPORT static double area(const std::shared_ptr<GeomAPI_Shape> theShape);
+
/// \return the centre of mass of the current face.
/// The coordinates returned for the center of mass
/// are expressed in the absolute Cartesian coordinate system.
QToolButton* aButton = new QToolButton(myButtonsFrame);
aButton->setFocusPolicy(Qt::StrongFocus);
aButton->setCheckable(true);
- aButton->setIcon(theIcon);
- aButton->setIconSize(theIcon.size());
+ if (theIcon.isNull())
+ aButton->setText(theName);
+ else {
+ aButton->setIcon(theIcon);
+ aButton->setIconSize(theIcon.size());
+ }
aButton->setToolTip(theName);
aButton->setObjectName(theName);
myButtonsGroup->addButton(aButton, anOldCount);