#include <Quantity_NameOfColor.hxx>
#include <BRepBndLib.hxx>
+#include <AIS_ColoredShape.hxx>
#include <AIS_InteractiveObject.hxx>
#include <AIS_InteractiveContext.hxx>
#include <AIS_Shape.hxx>
return isChanged;
}
+bool GeomAPI_AISObject::setWidth(const std::shared_ptr<GeomAPI_Shape>& theSubShape, const double& theWidth)
+{
+ Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
+ if (anAIS.IsNull())
+ return false;
+
+ Handle(AIS_ColoredShape) aShape = Handle(AIS_ColoredShape)::DownCast(anAIS); // Why ColoredShape, instead of Shape ?
+ if (!aShape)
+ return false;
+
+ aShape->SetCustomWidth(theSubShape->impl<TopoDS_Shape>(), theWidth); // Why SetCustomWidth, instead of SetWidth ?
+ return true; // Why always true ? What if theWidth == width() ?
+}
+
bool GeomAPI_AISObject::setColor(int theR, int theG, int theB)
{
Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
GEOMAPI_EXPORT
bool setWidth(const double& theWidth);
+ GEOMAPI_EXPORT
+ /// @brief Assigns edge thickness to theSubShape.
+ bool GeomAPI_AISObject::setWidth(const std::shared_ptr<GeomAPI_Shape>& theSubShape, const double& theWidth);
+
/// \brief Checks if the object is empty
GEOMAPI_EXPORT
bool empty() const;
return L""; // not defined
}
+std::wstring Model_Data::name(std::shared_ptr<GeomAPI_Shape> theSubShape)
+{
+ std::wstring aShapeName = L"";
+ std::wstring aResultName = name();
+ if (aResultName == L"")
+ return aShapeName;
+
+ AttributeSelectionPtr aSelectionAttribute;
+ ResultBodyPtr aResBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(myObject);
+ if (aResBody.get())
+ aSelectionAttribute = aResBody->selection();
+ else
+ {
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(myObject);
+ aSelectionAttribute = aPart->selection();
+ }
+ aSelectionAttribute->setValue(myObject, theSubShape);
+ aShapeName = aSelectionAttribute->namingName();
+ aSelectionAttribute->reset();
+
+ return aShapeName;
+}
+
void Model_Data::setName(const std::wstring& theName)
{
bool isModified = false;
#include <map>
#include <list>
#include <string>
+#include <vector>
#include <set>
class ModelAPI_Attribute;
Model_Data();
/// Returns the name of the feature visible by the user in the object browser
MODEL_EXPORT virtual std::wstring name();
+ /// Returns the name of the shape
+ MODEL_EXPORT virtual std::wstring name(std::shared_ptr<GeomAPI_Shape> theSubShape);
/// Defines the name of the feature visible by the user in the object browser
MODEL_EXPORT virtual void setName(const std::wstring& theName);
/// Return \c true if the object has been renamed by the user
aResultLabel = resultLabel(theResult->data(), index(theResult));
TDF_Label anAttributeLabel = subShapeLabel(aResultLabel, index(theResult, theShape)).FindChild(TAG_FEATURE_ARGUMENTS);
- if (Standard_GUID::IsEqual(theAttribute->ID(), TDataStd_IntegerArray::GetID()))
+ if (theAttribute->ID() == TDataStd_IntegerArray::GetID())
{
Handle(TDataStd_IntegerArray) anColor;
Handle(TDataStd_IntegerArray) anAttr =
static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
ModelAPI_EventCreator::get()->sendUpdated(theResult, anEvent);
}
- else if (Standard_GUID::IsEqual(theAttribute->ID(), TDataStd_Integer::GetID())) {
+ else if (theAttribute->ID() == TDataStd_Integer::GetID()) {
Handle(TDataStd_Integer) aThicknessAttr;
Handle(TDataStd_Integer) anAttr = Handle(TDataStd_Integer)::DownCast(theAttribute);