Salome HOME
Updated copyright comment
[modules/shaper.git] / src / GeomAPI / GeomAPI_AISObject.cpp
index 22863757e8a855bdd25058438d88c99c827d74f4..fba0ed2ff85ca17e1c3844a3e949605b9cd8956a 100644 (file)
@@ -1,6 +1,21 @@
-// File:        GeomAPI_AISObject.cpp
-// Created:     25 Jun 2014
-// Author:      Artem ZHIDKOV
+// Copyright (C) 2014-2024  CEA, EDF
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
 
 #include <GeomAPI_AISObject.h>
 
 #include <Geom_Plane.hxx>
 #include <TopoDS_Shape.hxx>
 #include <Quantity_NameOfColor.hxx>
+#include <BRepBndLib.hxx>
 
 #include <AIS_InteractiveObject.hxx>
-#include <AIS_LengthDimension.hxx>
-#include <AIS_ParallelRelation.hxx>
-#include <AIS_PerpendicularRelation.hxx>
-#include <AIS_RadiusDimension.hxx>
+#include <AIS_InteractiveContext.hxx>
 #include <AIS_Shape.hxx>
+#include <Prs3d_PointAspect.hxx>
+#include <PrsDim_Dimension.hxx>
+#include <PrsDim_LengthDimension.hxx>
+#include <PrsDim_ParallelRelation.hxx>
+#include <PrsDim_PerpendicularRelation.hxx>
+#include <PrsDim_RadiusDimension.hxx>
+#include <PrsDim_FixRelation.hxx>
+
+#include <Graphic3d_AspectLine3d.hxx>
 
 const double tolerance = 1e-7;
 
 const int CONSTRAINT_TEXT_HEIGHT = 28;  /// the text height of the constraint
 const int CONSTRAINT_TEXT_SELECTION_TOLERANCE = 20;  /// the text selection tolerance
 
-// Initialization of color constants
-int Colors::COLOR_BROWN = Quantity_NOC_BROWN;
-int Colors::COLOR_RED = Quantity_NOC_RED;
-int Colors::COLOR_GREEN = Quantity_NOC_GREEN;
-int Colors::COLOR_BLUE = Quantity_NOC_BLUE1;
-
 GeomAPI_AISObject::GeomAPI_AISObject()
     : GeomAPI_Interface(new Handle(AIS_InteractiveObject)())
 {
 }
 
-void GeomAPI_AISObject::createShape(boost::shared_ptr<GeomAPI_Shape> theShape)
+GeomAPI_AISObject::~GeomAPI_AISObject()
+{
+  if (!empty()) {
+    // This is necessary for correct deletion of Handle entity.
+    // Without this Handle does not decremented counter to 0
+    Handle(AIS_InteractiveObject) *anAIS = implPtr<Handle(AIS_InteractiveObject)>();
+    anAIS->Nullify();
+  }
+}
+
+
+void GeomAPI_AISObject::createShape(std::shared_ptr<GeomAPI_Shape> theShape)
 {
   const TopoDS_Shape& aTDS =
       (theShape && theShape->implPtr<TopoDS_Shape>()) ?
@@ -58,14 +85,38 @@ void GeomAPI_AISObject::createShape(boost::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.));
+    aDrawer->SetIsoOnPlane(false);
+    setImpl(new Handle(AIS_InteractiveObject)(aShape));
+  }
+}
+
+std::shared_ptr<GeomAPI_Shape> GeomAPI_AISObject::getShape() const
+{
+  std::shared_ptr<GeomAPI_Shape> aResult;
+
+  Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
+  if (!anAIS.IsNull()) {
+    Handle(AIS_Shape) aShapeAIS = Handle(AIS_Shape)::DownCast(anAIS);
+    if (aShapeAIS) {
+      aResult.reset(new GeomAPI_Shape);
+      aResult->setImpl(new TopoDS_Shape(aShapeAIS->Shape()));
+    }
+  }
+  return aResult;
 }
 
-void GeomAPI_AISObject::createDistance(boost::shared_ptr<GeomAPI_Pnt> theStartPoint,
-                                       boost::shared_ptr<GeomAPI_Pnt> theEndPoint,
-                                       boost::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
-                                       boost::shared_ptr<GeomAPI_Pln> thePlane, double theDistance)
+void GeomAPI_AISObject::createDistance(std::shared_ptr<GeomAPI_Pnt> theStartPoint,
+                                       std::shared_ptr<GeomAPI_Pnt> theEndPoint,
+                                       std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
+                                       std::shared_ptr<GeomAPI_Pln> thePlane, double theDistance)
 {
   double aFlyout = 0;
   if (theFlyoutPoint) {
@@ -73,15 +124,15 @@ void GeomAPI_AISObject::createDistance(boost::shared_ptr<GeomAPI_Pnt> theStartPo
     if (theStartPoint->distance(theEndPoint) < tolerance)
       aDist = theStartPoint->distance(theFlyoutPoint);
     else {
-      boost::shared_ptr<GeomAPI_Lin> aLine = boost::shared_ptr<GeomAPI_Lin>(
+      std::shared_ptr<GeomAPI_Lin> aLine = std::shared_ptr<GeomAPI_Lin>(
           new GeomAPI_Lin(theStartPoint, theEndPoint));
       aDist = aLine->distance(theFlyoutPoint);
     }
 
-    boost::shared_ptr<GeomAPI_XYZ> aLineDir = theEndPoint->xyz()->decreased(theStartPoint->xyz());
-    boost::shared_ptr<GeomAPI_XYZ> aFOutDir = theFlyoutPoint->xyz()->decreased(
+    std::shared_ptr<GeomAPI_XYZ> aLineDir = theEndPoint->xyz()->decreased(theStartPoint->xyz());
+    std::shared_ptr<GeomAPI_XYZ> aFOutDir = theFlyoutPoint->xyz()->decreased(
         theStartPoint->xyz());
-    boost::shared_ptr<GeomAPI_XYZ> aNorm = thePlane->direction()->xyz();
+    std::shared_ptr<GeomAPI_XYZ> aNorm = thePlane->direction()->xyz();
     if (aLineDir->cross(aFOutDir)->dot(aNorm) < 0)
       aDist = -aDist;
     aFlyout = aDist;
@@ -89,16 +140,17 @@ void GeomAPI_AISObject::createDistance(boost::shared_ptr<GeomAPI_Pnt> theStartPo
 
   Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
   if (anAIS.IsNull()) {
-    Handle(AIS_LengthDimension) aDimAIS = new AIS_LengthDimension(theStartPoint->impl<gp_Pnt>(),
-                                                                  theEndPoint->impl<gp_Pnt>(),
-                                                                  thePlane->impl<gp_Pln>());
+    Handle(PrsDim_LengthDimension) aDimAIS =
+        new PrsDim_LengthDimension(theStartPoint->impl<gp_Pnt>(),
+                                   theEndPoint->impl<gp_Pnt>(),
+                                   thePlane->impl<gp_Pln>());
     aDimAIS->SetCustomValue(theDistance);
 
     Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect();
     anAspect->MakeArrows3d(Standard_False);
-    anAspect->MakeText3d(false);
+    anAspect->MakeText3d(Standard_False);
     anAspect->TextAspect()->SetHeight(CONSTRAINT_TEXT_HEIGHT);
-    anAspect->MakeTextShaded(false);
+    anAspect->MakeTextShaded(Standard_True);
     anAspect->ArrowAspect()->SetLength(theDistance / 10.);
     aDimAIS->DimensionAspect()->MakeUnitsDisplayed(false);
     aDimAIS->SetDimensionAspect(anAspect);
@@ -108,7 +160,7 @@ void GeomAPI_AISObject::createDistance(boost::shared_ptr<GeomAPI_Pnt> theStartPo
     setImpl(new Handle(AIS_InteractiveObject)(aDimAIS));
   } else {
     // update presentation
-    Handle(AIS_LengthDimension) aDimAIS = Handle(AIS_LengthDimension)::DownCast(anAIS);
+    Handle(PrsDim_LengthDimension) aDimAIS = Handle(PrsDim_LengthDimension)::DownCast(anAIS);
     if (!aDimAIS.IsNull()) {
       aDimAIS->SetMeasuredGeometry(theStartPoint->impl<gp_Pnt>(), theEndPoint->impl<gp_Pnt>(),
                                    thePlane->impl<gp_Pln>());
@@ -120,22 +172,37 @@ void GeomAPI_AISObject::createDistance(boost::shared_ptr<GeomAPI_Pnt> theStartPo
   }
 }
 
-void GeomAPI_AISObject::createRadius(boost::shared_ptr<GeomAPI_Circ> theCircle,
-                                     boost::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
+bool GeomAPI_AISObject::isEmptyDistanceGeometry()
+{
+  bool anEmpty = false;
+
+  Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
+  if (!anAIS.IsNull()) {
+    Handle(PrsDim_LengthDimension) aDimAIS = Handle(PrsDim_LengthDimension)::DownCast(anAIS);
+    if (!aDimAIS.IsNull()) {
+      anEmpty = !aDimAIS->IsValid();
+    }
+  }
+
+  return anEmpty;
+}
+
+void GeomAPI_AISObject::createRadius(std::shared_ptr<GeomAPI_Circ> theCircle,
+                                     std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
                                      double theRadius)
 {
-  boost::shared_ptr<GeomAPI_Pnt> aCenter = theCircle->center();
+  std::shared_ptr<GeomAPI_Pnt> aCenter = theCircle->center();
 
   // TODO: a bug in AIS_RadiusDimension:
   // The anchor point can't be myCirc.Location() - an exception is raised.
   // But we need exactly this case...
-  // We want to show a radius dimension starting from the circle centre and 
+  // We want to show a radius dimension starting from the circle centre and
   // ending at the user-defined point.
   // Also, if anchor point coincides with myP2, the radius dimension is not displayed at all.
-  boost::shared_ptr<GeomAPI_Pnt> anAnchor = theCircle->project(theFlyoutPoint);
-  boost::shared_ptr<GeomAPI_XYZ> anAnchorXYZ = anAnchor->xyz();
+  std::shared_ptr<GeomAPI_Pnt> anAnchor = theCircle->project(theFlyoutPoint);
+  std::shared_ptr<GeomAPI_XYZ> anAnchorXYZ = anAnchor->xyz();
   anAnchorXYZ = anAnchorXYZ->decreased(aCenter->xyz());
-  boost::shared_ptr<GeomAPI_Dir> aDeltaDir(new GeomAPI_Dir(anAnchorXYZ));
+  std::shared_ptr<GeomAPI_Dir> aDeltaDir(new GeomAPI_Dir(anAnchorXYZ));
   const double aDelta = 1e-3;
   anAnchor->setX(anAnchor->x() + aDelta * aDeltaDir->x());
   anAnchor->setY(anAnchor->y() + aDelta * aDeltaDir->y());
@@ -143,8 +210,8 @@ void GeomAPI_AISObject::createRadius(boost::shared_ptr<GeomAPI_Circ> theCircle,
 
   Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
   if (anAIS.IsNull()) {
-    Handle(AIS_RadiusDimension) aDimAIS = new AIS_RadiusDimension(theCircle->impl<gp_Circ>(),
-                                                                  anAnchor->impl<gp_Pnt>());
+    Handle(PrsDim_RadiusDimension) aDimAIS = new PrsDim_RadiusDimension(theCircle->impl<gp_Circ>(),
+                                                                        anAnchor->impl<gp_Pnt>());
     aDimAIS->SetCustomValue(theRadius);
 
     Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect();
@@ -160,7 +227,7 @@ void GeomAPI_AISObject::createRadius(boost::shared_ptr<GeomAPI_Circ> theCircle,
     setImpl(new Handle(AIS_InteractiveObject)(aDimAIS));
   } else {
     // update presentation
-    Handle(AIS_RadiusDimension) aDimAIS = Handle(AIS_RadiusDimension)::DownCast(anAIS);
+    Handle(PrsDim_RadiusDimension) aDimAIS = Handle(PrsDim_RadiusDimension)::DownCast(anAIS);
     if (!aDimAIS.IsNull()) {
       aDimAIS->SetMeasuredGeometry(theCircle->impl<gp_Circ>(), anAnchor->impl<gp_Pnt>());
       aDimAIS->SetCustomValue(theRadius);
@@ -169,22 +236,22 @@ void GeomAPI_AISObject::createRadius(boost::shared_ptr<GeomAPI_Circ> theCircle,
   }
 }
 
-void GeomAPI_AISObject::createParallel(boost::shared_ptr<GeomAPI_Shape> theLine1,
-                                       boost::shared_ptr<GeomAPI_Shape> theLine2,
-                                       boost::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
-                                       boost::shared_ptr<GeomAPI_Pln> thePlane)
+void GeomAPI_AISObject::createParallel(std::shared_ptr<GeomAPI_Shape> theLine1,
+                                       std::shared_ptr<GeomAPI_Shape> theLine2,
+                                       std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
+                                       std::shared_ptr<GeomAPI_Pln> thePlane)
 {
   Handle(Geom_Plane) aPlane = new Geom_Plane(thePlane->impl<gp_Pln>());
   Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
   if (anAIS.IsNull()) {
-    Handle(AIS_ParallelRelation) aParallel = new AIS_ParallelRelation(
+    Handle(PrsDim_ParallelRelation) aParallel = new PrsDim_ParallelRelation(
         theLine1->impl<TopoDS_Shape>(), theLine2->impl<TopoDS_Shape>(), aPlane);
     if (theFlyoutPoint)
       aParallel->SetPosition(theFlyoutPoint->impl<gp_Pnt>());
 
     setImpl(new Handle(AIS_InteractiveObject)(aParallel));
   } else {
-    Handle(AIS_ParallelRelation) aParallel = Handle(AIS_ParallelRelation)::DownCast(anAIS);
+    Handle(PrsDim_ParallelRelation) aParallel = Handle(PrsDim_ParallelRelation)::DownCast(anAIS);
     if (!aParallel.IsNull()) {
       aParallel->SetFirstShape(theLine1->impl<TopoDS_Shape>());
       aParallel->SetSecondShape(theLine2->impl<TopoDS_Shape>());
@@ -196,20 +263,20 @@ void GeomAPI_AISObject::createParallel(boost::shared_ptr<GeomAPI_Shape> theLine1
   }
 }
 
-void GeomAPI_AISObject::createPerpendicular(boost::shared_ptr<GeomAPI_Shape> theLine1,
-                                            boost::shared_ptr<GeomAPI_Shape> theLine2,
-                                            boost::shared_ptr<GeomAPI_Pln> thePlane)
+void GeomAPI_AISObject::createPerpendicular(std::shared_ptr<GeomAPI_Shape> theLine1,
+                                            std::shared_ptr<GeomAPI_Shape> theLine2,
+                                            std::shared_ptr<GeomAPI_Pln> thePlane)
 {
   Handle(Geom_Plane) aPlane = new Geom_Plane(thePlane->impl<gp_Pln>());
   Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
   if (anAIS.IsNull()) {
-    Handle(AIS_PerpendicularRelation) aPerpendicular = new AIS_PerpendicularRelation(
+    Handle(PrsDim_PerpendicularRelation) aPerpendicular = new PrsDim_PerpendicularRelation(
         theLine1->impl<TopoDS_Shape>(), theLine2->impl<TopoDS_Shape>(), aPlane);
 
     setImpl(new Handle(AIS_InteractiveObject)(aPerpendicular));
   } else {
-    Handle(AIS_PerpendicularRelation) aPerpendicular = Handle(AIS_PerpendicularRelation)::DownCast(
-        anAIS);
+    Handle(PrsDim_PerpendicularRelation) aPerpendicular =
+        Handle(PrsDim_PerpendicularRelation)::DownCast(anAIS);
     if (!aPerpendicular.IsNull()) {
       aPerpendicular->SetFirstShape(theLine1->impl<TopoDS_Shape>());
       aPerpendicular->SetSecondShape(theLine2->impl<TopoDS_Shape>());
@@ -219,40 +286,192 @@ void GeomAPI_AISObject::createPerpendicular(boost::shared_ptr<GeomAPI_Shape> the
   }
 }
 
+
+void GeomAPI_AISObject::createFixed(std::shared_ptr<GeomAPI_Shape> theShape,
+                                    std::shared_ptr<GeomAPI_Pln> thePlane)
+{
+  Handle(Geom_Plane) aPlane = new Geom_Plane(thePlane->impl<gp_Pln>());
+  Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
+  TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
+  Handle(PrsDim_FixRelation) aFixPrs;
+  if (anAIS.IsNull()) {
+    aFixPrs = new PrsDim_FixRelation(aShape, aPlane);
+
+    setImpl(new Handle(AIS_InteractiveObject)(aFixPrs));
+  } else {
+    aFixPrs = Handle(PrsDim_FixRelation)::DownCast(anAIS);
+    if (!aFixPrs.IsNull()) {
+      aFixPrs->SetFirstShape(aShape);
+      aFixPrs->SetPlane(aPlane);
+      aFixPrs->Redisplay(Standard_True);
+    }
+  }
+  if (!aFixPrs.IsNull()) {
+    Bnd_Box aBox;
+    BRepBndLib::Add(aShape, aBox);
+    double aXmin, aXmax, aYmin, aYmax, aZmin, aZmax;
+    aBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+    gp_Pnt aXYZ1(aXmin, aXmax, aYmin);
+    gp_Pnt aXYZ2(aXmax, aYmax, aZmax);
+    double aDist = aXYZ1.Distance(aXYZ2);
+    if (aDist > Precision::Confusion()) {
+      aFixPrs->SetArrowSize(aDist/8.);
+    }
+  }
+}
+
 void GeomAPI_AISObject::setColor(const int& theColor)
 {
   Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
   if (anAIS.IsNull())
     return;
   Quantity_Color aColor((Quantity_NameOfColor) theColor);
-  anAIS->SetColor(aColor);
-  Handle(AIS_Dimension) aDimAIS = Handle(AIS_Dimension)::DownCast(anAIS);
+  Handle(PrsDim_Dimension) aDimAIS = Handle(PrsDim_Dimension)::DownCast(anAIS);
   if (!aDimAIS.IsNull()) {
     aDimAIS->DimensionAspect()->SetCommonColor(aColor);
   }
+  Handle(AIS_InteractiveContext) aContext = anAIS->GetContext();
+  if (!aContext.IsNull())
+    aContext->SetColor(anAIS, aColor, false);
+  else
+    anAIS->SetColor(aColor);
 }
 
-void GeomAPI_AISObject::setWidth(const double& theWidth)
+double GeomAPI_AISObject::width()
 {
+  double aWidth = 0.0;
   Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
-  if (anAIS.IsNull())
-    return;
-  anAIS->SetWidth(theWidth);
+  if (!anAIS.IsNull()) {
+    aWidth = anAIS->Width();
+  }
+  return aWidth;
+}
+
+bool GeomAPI_AISObject::setWidth(const double& theWidth)
+{
+  bool isChanged = false;
+  Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
+  if (!anAIS.IsNull()) {
+    isChanged = anAIS->Width() != theWidth;
+    if (isChanged)
+      anAIS->SetWidth(theWidth);
+  }
+  return isChanged;
 }
 
-void GeomAPI_AISObject::setColor(int theR, int theG, int theB)
+bool GeomAPI_AISObject::setColor(int theR, int theG, int theB)
 {
   Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
   if (anAIS.IsNull())
-    return;
+    return false;
   Quantity_Color aColor(theR / 255., theG / 255., theB / 255., Quantity_TOC_RGB);
-  anAIS->SetColor(aColor);
-  Handle(AIS_Dimension) aDimAIS = Handle(AIS_Dimension)::DownCast(anAIS);
+  Quantity_Color aCurrentColor;
+  anAIS->Color(aCurrentColor);
+  // do not set the same color to the presentation
+  if (aColor.IsEqual(aCurrentColor))
+    return false;
+
+  Handle(AIS_InteractiveContext) aContext = anAIS->GetContext();
+  Handle(PrsDim_Dimension) aDimAIS = Handle(PrsDim_Dimension)::DownCast(anAIS);
   if (!aDimAIS.IsNull()) {
     aDimAIS->DimensionAspect()->SetCommonColor(aColor);
+    if (!aContext.IsNull())
+      aContext->Redisplay(aDimAIS, false);
+  }
+  else {
+    if (!aContext.IsNull())
+      aContext->SetColor(anAIS, aColor, false);
+    else
+      anAIS->SetColor(aColor);
   }
+  return true;
 }
 
+void GeomAPI_AISObject::getColor(int& theR, int& theG, int& theB)
+{
+  Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
+  if (anAIS.IsNull())
+    return;
+
+  Quantity_Color aColor;
+  anAIS->Color(aColor);
+  theR = (int)(aColor.Red()*255.);
+  theG = (int)(aColor.Green()*255.);
+  theB = (int)(aColor.Blue()*255.);
+}
+
+bool GeomAPI_AISObject::setDeflection(const double theDeflection)
+{
+  bool isModified = false;
+  Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
+  if (!anAIS.IsNull()) {
+    Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast(anAIS);
+    if (!anAISShape.IsNull()) {
+      Standard_Real aCoefficient, aPreviousCoefficient;
+      anAISShape->OwnDeviationCoefficient(aCoefficient, aPreviousCoefficient);
+      if (fabs(aCoefficient-theDeflection) > Precision::Confusion()) {
+        isModified = true;
+        anAISShape->SetOwnDeviationCoefficient(theDeflection);
+        Handle(Prs3d_Drawer) aDrawer = anAISShape->DynamicHilightAttributes();
+        if (!aDrawer.IsNull()) {
+          aDrawer->SetDeviationCoefficient(theDeflection);
+        }
+        // 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::getDeflection() const
+{
+  double aDeflection = -1;
+
+  Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
+  if (!anAIS.IsNull()) {
+    Handle(Prs3d_Drawer) aDrawer = anAIS->Attributes();
+    aDeflection = aDrawer->DeviationCoefficient();
+  }
+  return aDeflection;
+}
+
+bool GeomAPI_AISObject::setTransparency(const double theTransparency)
+{
+  bool isModified = false;
+  Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
+  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<Handle(AIS_InteractiveObject)>();
+  if (!anAIS.IsNull()) {
+    aTransparency = anAIS->Transparency();
+  }
+  return aTransparency;
+}
+
+
 bool GeomAPI_AISObject::empty() const
 {
   Handle(AIS_InteractiveObject) anAIS = const_cast<GeomAPI_AISObject*>(this)
@@ -262,3 +481,78 @@ bool GeomAPI_AISObject::empty() const
   return false;
 }
 
+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;
+}