X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_AISObject.cpp;h=aea1179d62076fc4aaddd0a1c44f53950acf8787;hb=60e95a5502a6940c6c27ce5d561b3c684b0b0a4f;hp=f1534e2afae88490f226be39e09c5b313f98cc5e;hpb=38afbd899a8645c83e17f2c24a17a2b7414911b4;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_AISObject.cpp b/src/GeomAPI/GeomAPI_AISObject.cpp index f1534e2af..aea1179d6 100644 --- a/src/GeomAPI/GeomAPI_AISObject.cpp +++ b/src/GeomAPI/GeomAPI_AISObject.cpp @@ -20,12 +20,14 @@ #include #include +#include #include #include #include #include #include #include +#include const double tolerance = 1e-7; @@ -251,6 +253,14 @@ void GeomAPI_AISObject::createFixed(std::shared_ptr theShape, } } +void GeomAPI_AISObject::redisplay() +{ + Handle(AIS_InteractiveObject) anAIS = impl(); + if (!anAIS.IsNull()) { + Handle(AIS_InteractiveContext) aContext = anAIS->GetContext(); + aContext->Redisplay(anAIS, false); + } +} void GeomAPI_AISObject::setColor(const int& theColor) @@ -272,6 +282,7 @@ void GeomAPI_AISObject::setWidth(const double& theWidth) if (anAIS.IsNull()) return; anAIS->SetWidth(theWidth); + anAIS->Redisplay(); } void GeomAPI_AISObject::setColor(int theR, int theG, int theB) @@ -296,3 +307,55 @@ bool GeomAPI_AISObject::empty() const return false; } +int GeomAPI_AISObject::getShapeType() const +{ + Handle(AIS_InteractiveObject) anAIS = const_cast(this) + ->impl(); + if (!anAIS.IsNull()) { + Handle(AIS_Shape) aAISShape = Handle(AIS_Shape)::DownCast(anAIS); + if (!aAISShape.IsNull()) { + return aAISShape->Shape().ShapeType(); + } + } + return -1; +} + +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_PointAspect) aPA = aDrawer->PointAspect(); + aPA->SetTypeOfMarker((Aspect_TypeOfMarker)theType); + aPA->SetScale(theScale); + } else { + Quantity_NameOfColor aCol = Quantity_NOC_YELLOW; + aDrawer->SetPointAspect(new Prs3d_PointAspect((Aspect_TypeOfMarker)theType, aCol, theScale)); + } + } +} + + +void GeomAPI_AISObject::setLineStyle(int theStyle) +{ + Handle(AIS_InteractiveObject) anAIS = impl(); + if (!anAIS.IsNull()) { + Handle(AIS_Drawer) aDrawer = anAIS->Attributes(); + if (aDrawer->HasLineAspect()) + aDrawer->LineAspect()->SetTypeOfLine((Aspect_TypeOfLine)theStyle); + if (aDrawer->HasWireAspect()) + aDrawer->WireAspect()->SetTypeOfLine((Aspect_TypeOfLine)theStyle); + } +} + + +void GeomAPI_AISObject::setTransparensy(double theVal) +{ + Handle(AIS_InteractiveObject) anAIS = impl(); + if (!anAIS.IsNull()) { + Handle(AIS_InteractiveContext) aContext = anAIS->GetContext(); + if (!aContext.IsNull()) + aContext->SetTransparency(anAIS, theVal, false); + } +}