X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_AISObject.cpp;h=c323a7835704631979c04f3dd8fefb1755444a3a;hb=f60dc9dd94d5d4b0ea07e3e3cbfd5b3028f0942d;hp=f25ab2e7c22311da4825cbd08aebd9692c2d0cda;hpb=7074394f8f08413d885f63be01df6bd5007b868c;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_AISObject.cpp b/src/GeomAPI/GeomAPI_AISObject.cpp index f25ab2e7c..c323a7835 100644 --- a/src/GeomAPI/GeomAPI_AISObject.cpp +++ b/src/GeomAPI/GeomAPI_AISObject.cpp @@ -388,7 +388,8 @@ void GeomAPI_AISObject::getColor(int& theR, int& theG, int& theB) if (anAIS.IsNull()) return; - Quantity_Color aColor = anAIS->Color(); + Quantity_Color aColor; + anAIS->Color(aColor); theR = (int)(aColor.Red()*255.); theG = (int)(aColor.Green()*255.); theB = (int)(aColor.Blue()*255.); @@ -428,6 +429,39 @@ double GeomAPI_AISObject::getDeflection() const return aDeflection; } +bool GeomAPI_AISObject::setTransparency(const double theTransparency) +{ + bool isModified = false; + Handle(AIS_InteractiveObject) anAIS = impl(); + if (!anAIS.IsNull()) { + Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast(anAIS); + if (!anAISShape.IsNull()) { + Standard_Real aPreviousValue = anAISShape->Transparency(); + if (fabs(aPreviousValue - theTransparency) > Precision::Confusion()) { + anAISShape->SetTransparency(theTransparency); + //>SetOwnDeviationCoefficient(theTransparency); + isModified = true; + // redisplay is necessary here to update presentation in all modes + // Standard True flag. Displayer uses Standard False flag. If it will be changed in + // displayer, redisplay here will not be necessary. But performance should be checked. + anAISShape->Redisplay(Standard_True); + } + } + } + return isModified; +} + +double GeomAPI_AISObject::getTransparency() const +{ + double aTransparency = 0; + + Handle(AIS_InteractiveObject) anAIS = impl(); + if (!anAIS.IsNull()) { + aTransparency = anAIS->Transparency(); + } + return aTransparency; +} + bool GeomAPI_AISObject::empty() const {