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 SoEXTENDER_Documented public: 00253 SoLDMMediator::LDMManagerAccess &getLdmManagerAccess() { return m_mediator.ldmManagerAccess; } 00254 00255 private: 00256 virtual ~SoMultiDataSeparator(); 00257 00258 private: 00259 static void initClass(); 00260 static void exitClass(); 00261 00263 void remove(SoDataSet* ds); 00264 00266 void removeFromLdm(); 00267 00269 void reset(); 00270 00271 private: 00272 typedef std::set<SoLDM::DataSetIdPair> DsSet; 00273 00274 void updateDatasets(); 00275 void updateDatasetList(const SoLDM::DataSetIdPairList &newDsList); 00276 //Search for all dataset in the subgraph 00277 void getDatasets(SoLDM::DataSetIdPairList &dsList, SoNode *subGraph) const; 00278 bool hasListChanged(const SoLDM::DataSetIdPairList &newDsList) const; 00279 00280 //Return datasets whose id has already been assigned 00281 void findDuplicatedId(DsSet &dsDup, const SoLDM::DataSetIdPairList &dsList) const; 00282 bool isInSet(const DsSet &dsSet, const SoLDM::DataSetIdPair& p) const; 00283 00284 //Result contains a-b. 00285 template<typename Container1, typename Container2> 00286 void getDsListDifference(SoLDM::DataSetIdPairList &result, const Container1 &a, const Container2 &b) const; 00287 00288 //If ds from dsList has already a MultiDataSeparator, remove it 00289 //and add it to the m_mutipleRefDsList of the other group. 00290 void removeFromAssignedGroup(const SoLDM::DataSetIdPairList &dsList); 00291 00292 //Ignore this DS next time the ds list change 00293 void addToMutipleRefDsList(const SoLDM::DataSetIdPair& p); 00294 //Print an error message if a ds is in more than one SoMultiDataSeparator 00295 void checkForDSInOtherGroups(); 00296 00297 //Unregister from mediator given ds list 00298 void unregisterDs(const SoLDM::DataSetIdPairList &dsToRemove); 00299 00300 //Register from mediator given ds list 00301 void registerDs(const SoLDM::DataSetIdPairList &dsToRegister); 00302 00303 SoLDMMediator m_mediator; 00304 SoLDM::DataSetIdPairList m_dsList; 00305 SoLDM::DataSetIdPairList m_mutipleRefDsList; 00306 }; 00307 00308 #ifdef _MSC_VER 00309 #pragma warning( pop ) 00310 #endif 00311 00312 #endif 00313 00314 00315