Back to index

salome-geom  6.5.0
GEOM_AISShape.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  GEOM OBJECT : interactive object for Geometry entities visualization
00024 //  File   : GEOM_AISShape.hxx
00025 //  Module : GEOM
00026 //
00027 #ifndef _GEOM_AISShape_HeaderFile
00028 #define _GEOM_AISShape_HeaderFile
00029 
00030 #include "GEOM_OBJECT_defs.hxx"
00031 
00032 #ifndef _Standard_HeaderFile
00033 #include <Standard.hxx>
00034 #endif
00035 #ifndef _Handle_GEOM_AISShape_HeaderFile
00036 #include "Handle_GEOM_AISShape.hxx"
00037 #endif
00038 
00039 #ifndef _Handle_SALOME_InteractiveObject_HeaderFile
00040 #include "Handle_SALOME_InteractiveObject.hxx"
00041 #endif
00042 #ifndef _Standard_CString_HeaderFile
00043 #include <Standard_CString.hxx>
00044 #endif
00045 #ifndef _SALOME_AISShape_HeaderFile
00046 #include "SALOME_AISShape.hxx"
00047 #endif
00048 #ifndef _Standard_Boolean_HeaderFile
00049 #include <Standard_Boolean.hxx>
00050 #endif
00051 #ifndef _Handle_PrsMgr_PresentationManager3d_HeaderFile
00052 #include <Handle_PrsMgr_PresentationManager3d.hxx>
00053 #endif
00054 #ifndef _Handle_Prs3d_Presentation_HeaderFile
00055 #include <Handle_Prs3d_Presentation.hxx>
00056 #endif
00057 
00058 #include <TCollection_AsciiString.hxx>
00059 
00060 #include <AIS_DisplayMode.hxx>
00061 #include <Graphic3d_MaterialAspect.hxx>
00062 
00063 class PrsMgr_PresentationManager3d;
00064 class Prs3d_Presentation;
00065 class SALOME_InteractiveObject;
00066 class TopoDS_Shape;
00067 
00068 class GEOM_OBJECT_EXPORT GEOM_AISShape : public SALOME_AISShape {
00069 
00070 public:
00071 
00073     typedef enum {
00074       //WireFrame,       //!< the same as AIS_WireFrame
00075       //Shading,         //!< the same as AIS_Shaded
00076       ShadingWithEdges = AIS_Shaded+1, 
00077       TexturedShape = ShadingWithEdges+1 
00078     } DispMode;
00079 
00080     inline void* operator new(size_t,void* anAddress) 
00081       {
00082         return anAddress;
00083       }
00084     inline void* operator new(size_t size) 
00085       { 
00086         return Standard::Allocate(size); 
00087       }
00088     inline void  operator delete(void *anAddress) 
00089       { 
00090         if (anAddress) Standard::Free((Standard_Address&)anAddress); 
00091       }
00092 //    inline void  operator delete(void *anAddress, size_t size) 
00093 //      { 
00094 //        if (anAddress) Standard::Free((Standard_Address&)anAddress,size); 
00095 //      }
00096  // Methods PUBLIC
00097  // 
00098         GEOM_AISShape(const TopoDS_Shape& shape, const Standard_CString aName);
00099         Standard_Boolean hasIO() ;
00100         void setIO(const Handle(SALOME_InteractiveObject)& name) ;
00101         void setName(const Standard_CString aName) ;
00102         Standard_CString getName() ;
00103         Standard_Boolean isTopLevel();
00104         void setTopLevel(Standard_Boolean);
00105         Handle_SALOME_InteractiveObject getIO() ;
00106         void highlightSubShapes(const TColStd_IndexedMapOfInteger& aIndexMap, const Standard_Boolean aHighlight );
00107         ~GEOM_AISShape();
00108 
00109         void SetTransparency(const Standard_Real aValue);
00110         void SetShadingColor(const Quantity_Color &aCol);
00111         void SetEdgesInShadingColor(const Quantity_Color &aCol);
00112         void SetDisplayVectors(bool isShow);
00113 
00114         virtual  void Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
00115                                       const Handle(Prs3d_Presentation)& aPresentation,
00116                                       const Standard_Integer aMode = 0) ;
00117 
00118         virtual  bool isShowVectors () { return myDisplayVectors; }
00119         
00120  // Type management
00121  //
00122         friend Handle_Standard_Type& GEOM_AISShape_Type_();
00123         const Handle(Standard_Type)& DynamicType() const;
00124         Standard_Boolean             IsKind(const Handle(Standard_Type)&) const;
00125 
00126         void storeIsoNumbers();
00127         void restoreIsoNumbers();
00128         void resetIsoNumbers();
00129 
00130         void storeBoundaryColors();
00131 
00132        static Quantity_Color topLevelColor();
00133 
00134 protected: 
00135   void shadingMode(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
00136                  const Handle(Prs3d_Presentation)& aPrs,
00137                  const Standard_Integer aMode);
00138 
00139   void restoreBoundaryColors();
00140 
00141   Quantity_Color myShadingColor;
00142 
00143   Quantity_Color myFreeBoundaryColor;
00144   Quantity_Color myUnFreeBoundaryColor;
00145 
00146   Quantity_Color myEdgesInShadingColor;
00147 
00148   int            myUIsoNumber;
00149   int            myVIsoNumber;
00150 
00151 private: 
00152   TCollection_AsciiString myName;
00153   bool                     myDisplayVectors;
00154   Standard_Boolean         myTopLevel;
00155   Graphic3d_MaterialAspect myCurrentMaterial;
00156 
00157 };
00158 
00159 
00160 // other inline functions and methods (like "C++: function call" methods)
00161 //
00162 
00163 
00164 #endif