Salome HOME
FIx for issue #360 : make switching on/off checking of transactions in Session -...
[modules/shaper.git] / src / GeomAPI / GeomAPI_AISObject.cpp
index 24e07eb08d732dc33fc6394067aacc08d967c31a..aea1179d62076fc4aaddd0a1c44f53950acf8787 100644 (file)
@@ -20,6 +20,7 @@
 #include <BRepBndLib.hxx>
 
 #include <AIS_InteractiveObject.hxx>
+#include <AIS_InteractiveContext.hxx>
 #include <AIS_LengthDimension.hxx>
 #include <AIS_ParallelRelation.hxx>
 #include <AIS_PerpendicularRelation.hxx>
@@ -252,6 +253,14 @@ void GeomAPI_AISObject::createFixed(std::shared_ptr<GeomAPI_Shape> theShape,
   }
 }
 
+void GeomAPI_AISObject::redisplay()
+{
+  Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
+  if (!anAIS.IsNull()) {
+    Handle(AIS_InteractiveContext) aContext = anAIS->GetContext();
+    aContext->Redisplay(anAIS, false);
+  }
+}
 
 
 void GeomAPI_AISObject::setColor(const int& theColor)
@@ -273,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)
@@ -336,9 +346,16 @@ void GeomAPI_AISObject::setLineStyle(int theStyle)
       aDrawer->LineAspect()->SetTypeOfLine((Aspect_TypeOfLine)theStyle);
     if (aDrawer->HasWireAspect())
       aDrawer->WireAspect()->SetTypeOfLine((Aspect_TypeOfLine)theStyle);
-    //else {
-    //  Quantity_NameOfColor aCol = Quantity_NOC_RED;
-    //  aDrawer->SetLineAspect(new Prs3d_LineAspect(aCol, (Aspect_TypeOfLine)theStyle, 1));
-    //}
+  }
+}
+
+
+void GeomAPI_AISObject::setTransparensy(double theVal)
+{
+  Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
+  if (!anAIS.IsNull()) {
+    Handle(AIS_InteractiveContext) aContext = anAIS->GetContext();
+    if (!aContext.IsNull())
+      aContext->SetTransparency(anAIS, theVal, false);
   }
 }