X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_AISObject.cpp;h=fc34c50ae49953337cbd8279ae2a070a8b2eb488;hb=7dc85ea3929c3543703b2d8e689f8a66c0384272;hp=8f053f7cf90a838a5741d17fb442dc9d6e85ee29;hpb=a24b7e6f4d112d5e7889fd76f030298fc428cd01;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_AISObject.cpp b/src/GeomAPI/GeomAPI_AISObject.cpp index 8f053f7cf..fc34c50ae 100644 --- a/src/GeomAPI/GeomAPI_AISObject.cpp +++ b/src/GeomAPI/GeomAPI_AISObject.cpp @@ -41,6 +41,17 @@ GeomAPI_AISObject::GeomAPI_AISObject() { } +GeomAPI_AISObject::~GeomAPI_AISObject() +{ + if (!empty()) { + // This is necessary for correct deletion of Handle entity. + // Without this Handle does not decremented counter to 0 + Handle(AIS_InteractiveObject) *anAIS = implPtr(); + anAIS->Nullify(); + } +} + + void GeomAPI_AISObject::createShape(std::shared_ptr theShape) { const TopoDS_Shape& aTDS = @@ -261,7 +272,6 @@ void GeomAPI_AISObject::setColor(const int& theColor) if (anAIS.IsNull()) return; Quantity_Color aColor((Quantity_NameOfColor) theColor); - anAIS->SetColor(aColor); Handle(AIS_Dimension) aDimAIS = Handle(AIS_Dimension)::DownCast(anAIS); if (!aDimAIS.IsNull()) { aDimAIS->DimensionAspect()->SetCommonColor(aColor); @@ -294,7 +304,6 @@ bool GeomAPI_AISObject::setColor(int theR, int theG, int theB) if (aColor.IsEqual(aCurrentColor)) return false; - anAIS->SetColor(aColor); Handle(AIS_Dimension) aDimAIS = Handle(AIS_Dimension)::DownCast(anAIS); if (!aDimAIS.IsNull()) { aDimAIS->DimensionAspect()->SetCommonColor(aColor); @@ -342,8 +351,8 @@ void GeomAPI_AISObject::setPointMarker(int theType, double theScale) { Handle(AIS_InteractiveObject) anAIS = impl(); if (!anAIS.IsNull()) { - Handle(AIS_Drawer) aDrawer = anAIS->Attributes(); - if (aDrawer->HasPointAspect()) { + Handle(Prs3d_Drawer) aDrawer = anAIS->Attributes(); + if (aDrawer->HasOwnPointAspect()) { Handle(Prs3d_PointAspect) aPA = aDrawer->PointAspect(); aPA->SetTypeOfMarker((Aspect_TypeOfMarker)theType); aPA->SetScale(theScale); @@ -359,14 +368,14 @@ bool GeomAPI_AISObject::setLineStyle(int theStyle) bool isChanged = false; Handle(AIS_InteractiveObject) anAIS = impl(); if (!anAIS.IsNull()) { - Handle(AIS_Drawer) aDrawer = anAIS->Attributes(); + Handle(Prs3d_Drawer) aDrawer = anAIS->Attributes(); Handle(Prs3d_LineAspect) aLineAspect; Aspect_TypeOfLine aType = (Aspect_TypeOfLine)theStyle; - if (aDrawer->HasLineAspect()) { + if (aDrawer->HasOwnLineAspect()) { aLineAspect = aDrawer->LineAspect(); } - if (aDrawer->HasWireAspect()) { + if (aDrawer->HasOwnWireAspect()) { aLineAspect = aDrawer->WireAspect(); } Quantity_Color aCurrentColor; @@ -381,7 +390,6 @@ bool GeomAPI_AISObject::setLineStyle(int theStyle) return isChanged; } - bool GeomAPI_AISObject::setTransparensy(double theVal) { bool isChanged = false;