Salome HOME
Update GUI documentation for bugs 16559
[modules/geom.git] / src / OBJECT / GEOM_AISShape.cxx
index c442b4c6c128a6cc6849e02609e744994b76ad5f..4a3f6e0e9ab23d9af89a4499838e6d189a33bf2d 100644 (file)
@@ -17,7 +17,7 @@
 //  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
@@ -26,7 +26,6 @@
 //  Module : GEOM
 //  $Header$
 
-using namespace std;
 /*!
   \class GEOM_AISShape GEOM_AISShape.hxx
   \brief ....
@@ -47,6 +46,7 @@ using namespace std;
 #include <Prs3d_ShadingAspect.hxx>
 #include <SelectBasics_SensitiveEntity.hxx>
 #include <SelectMgr_EntityOwner.hxx>
+#include <StdSelect_BRepOwner.hxx>
 #include <SelectMgr_IndexedMapOfOwner.hxx>
 #include <SelectMgr_Selection.hxx>
 #include <StdSelect_DisplayMode.hxx>
@@ -59,6 +59,8 @@ using namespace std;
 #include <TopoDS_Shape.hxx>
 #include <TopTools_IndexedMapOfShape.hxx>
 
+using namespace std;
+
 static void getEntityOwners( const Handle(AIS_InteractiveObject)& theObj,
                             const Handle(AIS_InteractiveContext)& theIC,
                             SelectMgr_IndexedMapOfOwner& theMap )
@@ -99,7 +101,7 @@ static void indicesToOwners( const TColStd_IndexedMapOfInteger& aIndexMap,
   TopExp::MapShapes(aMainShape, aMapOfShapes);
 
   for  ( Standard_Integer i = 1, n = anAllMap.Extent(); i <= n; i++ ) {
-    Handle(SelectMgr_EntityOwner) anOwner = anAllMap( i );
+    Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast(anAllMap( i ));
     if ( anOwner.IsNull() || !anOwner->HasShape() )
       continue;
 
@@ -114,11 +116,9 @@ static void indicesToOwners( const TColStd_IndexedMapOfInteger& aIndexMap,
 }
 
 GEOM_AISShape::GEOM_AISShape(const TopoDS_Shape& shape,
-                            const Standard_CString aName): SALOME_AISShape(shape)
+                            const Standard_CString aName)
+  : SALOME_AISShape(shape), myName(aName)
 {
-  myName = new char [strlen(aName)+1];
-  strcpy( myName, aName);
-
   myShadingColor = Quantity_Color( Quantity_NOC_GOLDENROD );
 }
 
@@ -139,8 +139,7 @@ Standard_Boolean GEOM_AISShape::hasIO(){
 
 void GEOM_AISShape::setName(const Standard_CString aName)
 {
-  myName = new char [strlen(aName)+1];
-  strcpy( myName, aName);
+  myName = aName;
 
   Handle(SALOME_InteractiveObject) IO = getIO();
   if ( !IO.IsNull() )
@@ -148,7 +147,7 @@ void GEOM_AISShape::setName(const Standard_CString aName)
 }
 
 Standard_CString GEOM_AISShape::getName(){
-  return myName;
+  return myName.ToCString();
 }
 
 void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
@@ -191,7 +190,9 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent
       //a4bis->SetInteriorColor(myShadingColor);
       myDrawer->ShadingAspect()->SetColor(myShadingColor);
 
-      StdPrs_ShadedShape::Add(aPrs,myshape,myDrawer);
+      // PAL12113: AIS_Shape::Compute() works correctly with shapes containing no faces
+      //StdPrs_ShadedShape::Add(aPrs,myshape,myDrawer);
+      AIS_Shape::Compute(aPresentationManager, aPrs, aMode);
       break;
     }
   }