[cgma-dev] r5053 - cgm/trunk/geom/OCC

jiangtao_ma at yahoo.com jiangtao_ma at yahoo.com
Tue Jul 12 12:32:07 CDT 2011


Author: janehu
Date: 2011-07-12 12:32:07 -0500 (Tue, 12 Jul 2011)
New Revision: 5053

Modified:
   cgm/trunk/geom/OCC/OCCAttribSet.cpp
   cgm/trunk/geom/OCC/OCCAttribSet.hpp
   cgm/trunk/geom/OCC/OCCBody.cpp
   cgm/trunk/geom/OCC/OCCCurve.cpp
   cgm/trunk/geom/OCC/OCCDrawTool.cpp
   cgm/trunk/geom/OCC/OCCLoop.cpp
   cgm/trunk/geom/OCC/OCCLump.cpp
   cgm/trunk/geom/OCC/OCCModifyEngine.cpp
   cgm/trunk/geom/OCC/OCCPoint.hpp
   cgm/trunk/geom/OCC/OCCQueryEngine.cpp
   cgm/trunk/geom/OCC/OCCQueryEngine.hpp
   cgm/trunk/geom/OCC/OCCShapeAttributeSet.cpp
   cgm/trunk/geom/OCC/OCCShapeAttributeSet.hpp
   cgm/trunk/geom/OCC/OCCShell.cpp
   cgm/trunk/geom/OCC/OCCSurface.cpp
Log:
Added a map of an OCC shape and its attribute label structure to improved read and write speed, and related suporting changes. passed all testcases under cgm make check.

Modified: cgm/trunk/geom/OCC/OCCAttribSet.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCAttribSet.cpp	2011-07-12 16:55:15 UTC (rev 5052)
+++ cgm/trunk/geom/OCC/OCCAttribSet.cpp	2011-07-12 17:32:07 UTC (rev 5053)
@@ -28,6 +28,8 @@
   #include "TDataXtd_Shape.hxx"
 #endif
 
+#include "TDF_Label.hxx"
+#include "TopTools_DataMapOfShapeInteger.hxx"
 #include "TCollection_ExtendedString.hxx"
 #include "Handle_TDataStd_Name.hxx"
 #include "Handle_TDataStd_ExtStringArray.hxx"
@@ -40,26 +42,23 @@
 #include "TopoDS_Shape.hxx"
 #include "TDF_ChildIterator.hxx"
 #include <vector>
+typedef std::map<int, TDF_Label>::value_type labType;
 
 void OCCAttribSet::FindShape(TopoDS_Shape& shape,
                              TDF_Label& aLabel,
                              CubitBoolean& found) 
 {
-  for (TDF_ChildIterator it1(OCCQueryEngine::instance()->mainLabel, CUBIT_FALSE);
-    it1.More(); it1.Next())
+  found = CUBIT_FALSE;
+  if(!OCCQueryEngine::instance()->OCCMap->IsBound(shape))
+    return;
+
+  int k = OCCQueryEngine::instance()->OCCMap->Find(shape);
+  std::map<int, TDF_Label>::iterator it = 
+            OCCQueryEngine::instance()->Shape_Label_Map->find(k);
+  if(it != OCCQueryEngine::instance()->Shape_Label_Map->end())
   {
-    //find the same shape attribute first
-    aLabel = it1.Value();
-
-    Handle_TDataXtd_Shape attr_shape;
-    TopoDS_Shape old_shape;
-    if(aLabel.FindAttribute(TDataXtd_Shape::GetID(), attr_shape))
-      old_shape = attr_shape->Get(aLabel);
-    if(old_shape.IsPartner(shape))
-    {
-      found = CUBIT_TRUE;
-      break;
-    }
+    aLabel = (*it).second; 
+    found = CUBIT_TRUE;
   }
 }
 


More information about the cgma-dev mailing list