00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : VSG (MMM YYYY) 00022 ** Modified by : M. Bonaventure (Avr 2010) 00023 **=======================================================================*/ 00024 #ifndef _MO_MESHREPRESENTATION_ 00025 #define _MO_MESHREPRESENTATION_ 00026 00027 #include <MeshVizXLM/mapping/nodes/MoMeshBaseRepresentation.h> 00028 #include <Inventor/fields/SoSFNode.h> 00029 #include <Inventor/sensors/SoFieldSensor.h> 00030 #include <MeshVizXLM/mesh/data/MiDataSetI.h> 00031 #include <MeshVizXLM/mesh/data/MiDataSetIj.h> 00032 #include <MeshVizXLM/mesh/data/MiDataSetIjk.h> 00033 00034 class MiMesh; 00035 class MiExtractorCallback; 00036 class MiTessellator; 00037 00038 class MoMeshDetail; 00039 00040 class SoRayPickAction; 00041 00042 class MdMeshRepresentation; 00043 class MdMeshCache; 00044 class MxAttributesManager; 00045 class MdProfilingTool; 00046 00085 class MESHVIZXLM_DMAP_API MoMeshRepresentation : public MoMeshBaseRepresentation { 00086 00087 SO_NODE_HEADER(MoMeshRepresentation) ; 00088 00089 public: 00090 00098 SoSFInt32 colorScalarSetId; 00099 00105 SoSFBool parallel; 00106 00112 virtual void setExtractorCallback(MiExtractorCallback* extractorCallback); 00113 SoDEPRECATED 00115 virtual void setExtractorCallback(MiExtractorCallback& extractorCallback); 00116 00117 /*----------------------------------------------------------------------------*/ 00118 private: 00119 00120 static void initClass() ; 00121 static void exitClass() ; 00122 00123 size_t getTimeStamp() const; 00124 00125 // computes the extract of the given data set. 00126 virtual const MiScalardSet* extractScalarSet(const MiScalardSet* SO_UNUSED_PARAM(scalarSet)); 00127 00131 bool isUsingTessellator() const; 00132 00133 private: 00134 virtual void rayPick(SoRayPickAction *action); 00135 virtual void doExtract(SoAction *action) = 0; 00136 virtual void doAction(SoAction *action); 00137 00138 // Method used to return the extracted mesh computed by the representation used by MoMesh::connectFrom() 00139 const MiMesh* getExtractedMesh(MeshType& meshType); 00140 00141 // computes the extract of the data set corresponding to the given index in the state list from the current representation's extractor. 00142 virtual const MiScalardSetI* extractScalarSetI(SoState * SO_UNUSED_PARAM(state),size_t SO_UNUSED_PARAM(scalarSetId)); 00143 virtual const MiScalardSetIj* extractScalarSetIj(SoState * SO_UNUSED_PARAM(state),size_t SO_UNUSED_PARAM(scalarSetId)); 00144 00145 // computes the extract of the data set corresponding to the given index in the state list from the current representation's extractor. 00146 virtual const MiVec3dSetI* extractVec3SetI(SoState * SO_UNUSED_PARAM(state),size_t SO_UNUSED_PARAM(vec3SetId)); 00147 virtual const MiVec3dSetIj* extractVec3SetIj(SoState * SO_UNUSED_PARAM(state),size_t SO_UNUSED_PARAM(vec3SetId)); 00148 00149 private: 00150 MoMeshRepresentation() ; 00151 virtual ~MoMeshRepresentation() ; 00152 00153 friend class MdUndefinedMeshRepresentation; 00154 template<typename _ExtractorT> friend class MdMeshRepresentationFor; 00155 template <typename _MdExtractorT> friend class MdMeshMultiLinesRepresentation; 00156 template<typename _MdExtractorT> friend class MdExtractionThread; 00157 00158 const MiMesh* getMeshFromState(SoState* state, MeshType& meshType); 00159 MiTessellator* getTessellatorFromState(SoState* state, bool ignoreCache = false); 00160 template <typename _MeshInterface> 00161 std::vector<const MiScalardSet*> getColorSetFromState(SoState* state); 00162 00163 virtual void clear(); 00164 00165 MdMeshRepresentation* m_nodeImpl; 00166 MiExtractorCallback* m_extractorCallback; 00167 00168 private: 00169 // Parallel field sensor 00170 SoFieldSensor m_parallelFieldSensor; 00171 static void parallelFieldSensorCB(void* data, SoSensor* sensor); 00172 // detail storing the current mesh and the color scalarset 00173 MoMeshDetail* m_meshDetail; 00174 // Internal mechanism to retrieve the attributes for the extractions 00175 MxAttributesManager* m_attributesManager; 00176 // time stamp is updated when creating a new the representation meshcache 00177 size_t m_timeStamp; 00178 // set to true if the extractor is currentlty using a Tessellator 00179 bool m_usingTessellator; 00180 // Mesh cache 00181 MdMeshCache* m_meshCache; 00182 00183 MdProfilingTool* m_profiling; 00184 00185 }; 00186 00187 #endif /* _MO_MESHREPRESENTATION_ */ 00188 00189 00190 00191