+int GeomAPI_AISObject::getShapeType() const
+{
+ Handle(AIS_InteractiveObject) anAIS = const_cast<GeomAPI_AISObject*>(this)
+ ->impl<Handle(AIS_InteractiveObject)>();
+ if (!anAIS.IsNull()) {
+ Handle(AIS_Shape) aAISShape = Handle(AIS_Shape)::DownCast(anAIS);
+ if (!aAISShape.IsNull()) {
+ const TopoDS_Shape aShape = aAISShape->Shape();
+ if (!aShape.IsNull())
+ return aShape.ShapeType();
+ }
+ }
+ return -1;
+}
+
+void GeomAPI_AISObject::setPointMarker(int theType, double theScale)
+{
+ Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
+ if (!anAIS.IsNull()) {
+ Handle(Prs3d_Drawer) aDrawer = anAIS->Attributes();
+ if (aDrawer->HasOwnPointAspect()) {
+ 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));
+ }
+ }
+}
+
+bool GeomAPI_AISObject::setLineStyle(int theStyle)
+{
+ bool isChanged = false;
+ Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
+ if (!anAIS.IsNull()) {
+ Handle(Prs3d_Drawer) aDrawer = anAIS->Attributes();
+ Handle(Prs3d_LineAspect) aLineAspect;
+
+ Aspect_TypeOfLine aType = (Aspect_TypeOfLine)theStyle;
+ if (aDrawer->HasOwnLineAspect()) {
+ aLineAspect = aDrawer->LineAspect();
+ }
+ if (aDrawer->HasOwnWireAspect()) {
+ aLineAspect = aDrawer->WireAspect();
+ }
+ if (!aLineAspect.IsNull()) {
+ Handle(Graphic3d_AspectLine3d) aGraphicAspect = aLineAspect->Aspect();
+ Aspect_TypeOfLine aCurrentType = aGraphicAspect->Type();
+ isChanged = aType != aCurrentType;
+ if (isChanged) {
+ aLineAspect->SetTypeOfLine(aType);
+ }
+ }
+ }
+ return isChanged;
+}
+
+bool GeomAPI_AISObject::setTransparensy(double theVal)
+{
+ bool isChanged = false;
+ Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
+ if (!anAIS.IsNull()) {
+ Handle(AIS_InteractiveContext) aContext = anAIS->GetContext();
+ if (!aContext.IsNull()) {
+ double aCurrentValue = anAIS->Transparency();
+ isChanged = aCurrentValue != theVal;
+ if (isChanged)
+ aContext->SetTransparency(anAIS, theVal, false);
+ } else {
+ anAIS->SetTransparency(theVal);
+ }
+ }
+ return isChanged;
+}