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-2017 BY FEI S.A.S, *** 00017 *** MERIGNAC, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : VSG (MMM YYYY) 00022 **=======================================================================*/ 00023 00024 00025 #ifndef SO_MULTI_DATA_SEPARATOR_H 00026 #define SO_MULTI_DATA_SEPARATOR_H 00027 00028 #ifdef _MSC_VER 00029 #pragma warning( push ) 00030 #pragma warning(disable:4251) 00031 #endif 00032 00033 #include <LDM/SoLDMMediator.h> 00034 #include <LDM/elements/SoDataSetElement.h> 00035 00036 #include <Inventor/nodes/SoSeparator.h> 00037 #include <Inventor/STL/set> 00038 00225 class SoMultiDataSeparator : public SoSeparator { 00226 SO_NODE_HEADER(SoMultiDataSeparator); 00227 00228 public: 00229 00233 SoMultiDataSeparator(); 00234 00235 private: 00239 SoLDMMediator *getMediator() { return &m_mediator; } 00240 00241 virtual void GLRender(SoGLRenderAction *action); 00242 virtual void GLRenderBelowPath(SoGLRenderAction *action); 00243 virtual void GLRenderInPath(SoGLRenderAction *action); 00244 virtual void GLRenderOffPath(SoGLRenderAction *action); 00245 virtual void doAction(SoAction *action); 00246 virtual void getBoundingBox(SoGetBoundingBoxAction *action); 00247 virtual void write(SoWriteAction *action); 00248 00249 private: 00250 virtual ~SoMultiDataSeparator(); 00251 00252 private: 00253 static void initClass(); 00254 static void exitClass(); 00255 00257 void remove(SoDataSet* ds); 00258 00260 void removeFromLdm(); 00261 00263 void reset(); 00264 00265 private: 00266 typedef std::set<SoLDM::DataSetIdPair> DsSet; 00267 00268 void updateDatasets(); 00269 void updateDatasetList(const SoLDM::DataSetIdPairList &newDsList); 00270 //Search for all dataset in the subgraph 00271 void getDatasets(SoLDM::DataSetIdPairList &dsList, SoNode *subGraph) const; 00272 bool hasListChanged(const SoLDM::DataSetIdPairList &newDsList) const; 00273 00274 //Return datasets whose id has already been assigned 00275 void findDuplicatedId(DsSet &dsDup, const SoLDM::DataSetIdPairList &dsList) const; 00276 bool isInSet(const DsSet &dsSet, const SoLDM::DataSetIdPair& p) const; 00277 00278 //Result contains a-b. 00279 template<typename Container1, typename Container2> 00280 void getDsListDifference(SoLDM::DataSetIdPairList &result, const Container1 &a, const Container2 &b) const; 00281 00282 //If ds from dsList has already a MultiDataSeparator, remove it 00283 //and add it to the m_mutipleRefDsList of the other group. 00284 void removeFromAssignedGroup(const SoLDM::DataSetIdPairList &dsList); 00285 00286 //Ignore this DS next time the ds list change 00287 void addToMutipleRefDsList(const SoLDM::DataSetIdPair& p); 00288 //Print an error message if a ds is in more than one SoMultiDataSeparator 00289 void checkForDSInOtherGroups(); 00290 00291 //Unregister from mediator given ds list 00292 void unregisterDs(const SoLDM::DataSetIdPairList &dsToRemove); 00293 00294 //Register from mediator given ds list 00295 void registerDs(const SoLDM::DataSetIdPairList &dsToRegister); 00296 00297 SoLDMMediator m_mediator; 00298 SoLDM::DataSetIdPairList m_dsList; 00299 SoLDM::DataSetIdPairList m_mutipleRefDsList; 00300 }; 00301 00302 #ifdef _MSC_VER 00303 #pragma warning( pop ) 00304 #endif 00305 00306 #endif 00307 00308 00309