Salome HOME
Define transparency value for object which is still not added to Context
[modules/shaper.git] / src / GeomAPI / GeomAPI_AISObject.cpp
index 10d720c835520e431bc0583e1e7e6215c5049639..30879add3d8743dd85afcbcfbe43b979a5ef439d 100644 (file)
@@ -71,8 +71,16 @@ void GeomAPI_AISObject::createShape(std::shared_ptr<GeomAPI_Shape> theShape)
       aShapeAIS->Set(aTDS);
       aShapeAIS->Redisplay(Standard_True);
     }
-  } else
-    setImpl(new Handle(AIS_InteractiveObject)(new AIS_Shape(aTDS)));
+  } else {
+    // Set default point as a '+' symbol
+    Handle(AIS_Shape) aShape = new AIS_Shape(aTDS);
+    Handle(Prs3d_Drawer) aDrawer = aShape->Attributes();
+    if (aDrawer->HasOwnPointAspect()) 
+      aDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_PLUS);
+    else
+      aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.));
+    setImpl(new Handle(AIS_InteractiveObject)(aShape));
+  }
 }
 
 void GeomAPI_AISObject::createDistance(std::shared_ptr<GeomAPI_Pnt> theStartPoint,
@@ -403,6 +411,8 @@ bool GeomAPI_AISObject::setTransparensy(double theVal)
       isChanged = aCurrentValue != theVal;
       if (isChanged)
         aContext->SetTransparency(anAIS, theVal, false);
+    } else {
+      anAIS->SetTransparency(theVal);
     }
   }
  return isChanged;