cgma-dev
Threads by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
July 2008
- 3 participants
- 9 discussions
Author: janehu
Date: 2008-07-31 13:18:13 -0500 (Thu, 31 Jul 2008)
New Revision: 2034
Modified:
cgm/trunk/configure.in
Log:
Change for attribute read and write.
Modified: cgm/trunk/configure.in
===================================================================
--- cgm/trunk/configure.in 2008-07-31 18:16:18 UTC (rev 2033)
+++ cgm/trunk/configure.in 2008-07-31 18:18:13 UTC (rev 2034)
@@ -248,7 +248,7 @@
CUBIT_OCC_LIB=
HAVE_OCC_DEF=
if test "x$occ_DIR" != "xno"; then
- OCC_LIBS="-lTKMath -lTKXSBase -lTKernel -lTKShHealing -lTKBRep -lTKG3d -lTKBO -lTKFeat -lTKFillet -lTKG2d -lTKOffset -lTKBool -lTKGeomAlgo -lTKGeomBase -lTKPrim -lTKTopAlgo -lTKHLR -lTKIGES -lTKMesh -lTKPrim -lTKSTEP209 -lTKSTEPAttr -lTKSTEPBase -lTKSTEP -lTKSTL -lTKTopAlgo -lTKXSBase"
+ OCC_LIBS="-lTKMath -lTKXSBase -lTKernel -lTKShHealing -lTKBRep -lTKG3d -lTKBO -lTKFeat -lTKFillet -lTKG2d -lTKOffset -lTKBool -lTKGeomAlgo -lTKGeomBase -lTKPrim -lTKTopAlgo -lTKHLR -lTKIGES -lTKMesh -lTKPrim -lTKSTEP209 -lTKSTEPAttr -lTKSTEPBase -lTKSTEP -lTKSTL -lTKTopAlgo -lTKXSBase -lTKLCAF"
CUBIT_OCC_LIB="-lcubit_OCC"
# Set OCC_INC_FLAG and OCC_LIB_FLAG based on --with-occ option
1
0
Author: janehu
Date: 2008-07-31 13:16:18 -0500 (Thu, 31 Jul 2008)
New Revision: 2033
Added:
cgm/trunk/geom/OCC/OCCShapeAttributeSet.cpp
cgm/trunk/geom/OCC/OCCShapeAttributeSet.hpp
Modified:
cgm/trunk/geom/OCC/Makefile.am
cgm/trunk/geom/OCC/OCCAttrib.hpp
cgm/trunk/geom/OCC/OCCAttribSet.cpp
cgm/trunk/geom/OCC/OCCAttribSet.hpp
cgm/trunk/geom/OCC/OCCBody.cpp
cgm/trunk/geom/OCC/OCCBody.hpp
cgm/trunk/geom/OCC/OCCCurve.cpp
cgm/trunk/geom/OCC/OCCCurve.hpp
cgm/trunk/geom/OCC/OCCLoop.cpp
cgm/trunk/geom/OCC/OCCLump.cpp
cgm/trunk/geom/OCC/OCCLump.hpp
cgm/trunk/geom/OCC/OCCModifyEngine.hpp
cgm/trunk/geom/OCC/OCCPoint.cpp
cgm/trunk/geom/OCC/OCCPoint.hpp
cgm/trunk/geom/OCC/OCCQueryEngine.cpp
cgm/trunk/geom/OCC/OCCQueryEngine.hpp
cgm/trunk/geom/OCC/OCCSurface.cpp
Log:
Added read-write attribute functionality.
Modified: cgm/trunk/geom/OCC/Makefile.am
===================================================================
--- cgm/trunk/geom/OCC/Makefile.am 2008-07-29 21:22:57 UTC (rev 2032)
+++ cgm/trunk/geom/OCC/Makefile.am 2008-07-31 18:16:18 UTC (rev 2033)
@@ -20,7 +20,7 @@
# The non-template sources
libcubit_OCC_la_SOURCES = \
- OCCAttrib.cpp \
+ OCCShapeAttributeSet.cpp \
OCCAttribSet.cpp \
OCCBody.cpp \
OCCCoEdge.cpp \
@@ -39,7 +39,7 @@
# Headers to be installed. If any file in this list should
# not be installed, move it to the _SOURCES list above.
libcubit_OCC_la_include_HEADERS = \
- OCCAttrib.hpp \
+ OCCShapeAttributeSet.hpp \
OCCAttribSet.hpp \
OCCBody.hpp \
OCCCoEdge.hpp \
Modified: cgm/trunk/geom/OCC/OCCAttrib.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCAttrib.hpp 2008-07-29 21:22:57 UTC (rev 2032)
+++ cgm/trunk/geom/OCC/OCCAttrib.hpp 2008-07-31 18:16:18 UTC (rev 2033)
@@ -1,5 +1,5 @@
-#ifndef FACET_ATTRIB_HPP
-#define FACET_ATTRIB_HPP
+#ifndef OCC_ATTRIB_HPP
+#define OCC_ATTRIB_HPP
#include "CubitDefines.h"
#include "CubitString.hpp"
Modified: cgm/trunk/geom/OCC/OCCAttribSet.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCAttribSet.cpp 2008-07-29 21:22:57 UTC (rev 2032)
+++ cgm/trunk/geom/OCC/OCCAttribSet.cpp 2008-07-31 18:16:18 UTC (rev 2033)
@@ -11,7 +11,8 @@
//-------------------------------------------------------------------------
#include "OCCAttribSet.hpp"
-#include "OCCAttrib.hpp"
+//#include "OCCAttrib.hpp"
+#include "OCCQueryEngine.hpp"
#include "CubitSimpleAttrib.hpp"
#include "CubitFileIOWrapper.hpp"
#include "Handle_TDataStd_Shape.hxx"
@@ -28,293 +29,420 @@
#include "TopoDS_Shape.hxx"
#include "TDF_ChildIterator.hxx"
-void OCCAttribSet::append_attribute( CubitSimpleAttrib* csa, TopoDS_Shape& shape )
+void OCCAttribSet::FindShape(TopoDS_Shape& shape,
+ TDF_Label& aLabel,
+ CubitBoolean& found)
{
- OCCAttrib* new_attrib = new OCCAttrib(csa);
- new_attrib->listNext = listHead;
- listHead = new_attrib;
-
- TDF_Label child;
- //Add attributes on child of myLabel
- //1. add shape attribute, first check to make sure there's no shape attribute
- CubitBoolean found = CUBIT_FALSE;
- for (TDF_ChildIterator it1(myLabel, CUBIT_FALSE); it1.More(); it1.Next())
+ for (TDF_ChildIterator it1(OCCQueryEngine::instance()->mainLabel, CUBIT_FALSE);
+ it1.More(); it1.Next())
{
- //find the same type attribute first
- child = it1.Value();
+ //find the same shape attribute first
+ aLabel = it1.Value();
Handle_TDataStd_Shape attr_shape;
TopoDS_Shape old_shape;
- if(TDataStd_Shape::Find(child, attr_shape))
- old_shape = attr_shape->Get(child);
- if(old_shape.IsEqual(shape))
+ if(aLabel.FindAttribute(TDataStd_Shape::GetID(), attr_shape))
+ old_shape = attr_shape->Get(aLabel);
+ if(old_shape.IsSame(shape))
{
found = CUBIT_TRUE;
break;
}
}
+}
+void OCCAttribSet::append_attribute( CubitSimpleAttrib* csa, TopoDS_Shape& shape )
+{
+ //Add attributes on child of myLabel
+ //1. add shape attribute, first check to make sure there's no shape attribute
+ CubitBoolean found = CUBIT_FALSE;
+ TDF_Label aLabel;
+
+ FindShape(shape, aLabel, found);
+
if(!found)
{
- child = myLabel.NewChild();
- Handle_TDataStd_Shape attr_shape = TDataStd_Shape::Set(child, shape);
- child.AddAttribute(attr_shape);
+ aLabel = OCCQueryEngine::instance()->mainLabel.NewChild();
+ Handle_TDataStd_Shape attr_shape = TDataStd_Shape::Set(aLabel, shape);
+ //myLabel.AddAttribute(attr_shape);
+ //test if the attribute has been attached
+ assert(aLabel.IsAttribute(TDataStd_Shape::GetID()));
}
- //2. add type attribute , belowing attributes are added on child lable of child
- //First create new child label
- TDF_Label lab = child.NewChild();
-
- //Then add child labels
- CubitString type = csa->character_type();
- if(type.length() > 0)
+ //2. add type attribute , below attributes are added on child lable of myLabel
+ //First check if the attributes are already exist, if so, create new data.
+ TDF_Label lab;
+ Handle_TDataStd_Name attr_name;
+ TCollection_ExtendedString name_string;
+ CubitString type = csa->character_type();
+ TCollection_ExtendedString cstring( (Standard_CString)type.c_str() );
+ found = CUBIT_FALSE;
+ for (TDF_ChildIterator it(aLabel,CUBIT_FALSE); it.More(); it.Next())
{
- TCollection_ExtendedString cstring( (Standard_CString)type.c_str() );
- Handle_TDataStd_Name attr_name = TDataStd_Name::Set(lab, cstring);
- lab.AddAttribute(attr_name);
+ lab = it.Value();
+ found = find_attribute(lab, csa);
+ if(!found)
+ {
+ //check if the type attribute is the same, disable it
+ TCollection_ExtendedString old_string;
+ if(lab.FindAttribute(TDataStd_Name::GetID(), attr_name))
+ {
+ old_string = attr_name->Get();
+
+ if(old_string == cstring)
+ lab.ForgetAllAttributes();
+ }
+ }
+ if(found)
+ break;
}
+ //if not exist, create new child label
+ if (!found)
+ {
+ lab = aLabel.NewChild();
+ attr_name = TDataStd_Name::Set(lab, cstring);
+ assert(lab.IsAttribute(TDataStd_Name::GetID()));
+ }
+
+ else//nothing to do
+ return;
+
//3. add string attribute
DLIList<CubitString*>* strings = csa->string_data_list();
- TDF_Label lab_child = lab.NewChild();
Handle_TDataStd_ExtStringArray attr_string;
- if(strings && strings->size() > 0)
+ int size = strings->size()-1;
+ if(strings && size > 0)
{
- //set the length of String Array be 11, can be extended.
- attr_string = TDataStd_ExtStringArray::Set(lab_child, 0, 10);
+ //set the length of String Array .
+ attr_string = TDataStd_ExtStringArray::Set(lab, 0, size-1);
}
-
- for(int i = 0; strings && i < strings->size(); i++)
+ strings->reset();
+ strings->step(); //type string filters out
+ for(int i = 0; strings && i < size; i++)
{
TCollection_ExtendedString
cstring((Standard_CString)strings->get_and_step()->c_str() );
attr_string->SetValue(i, cstring) ;
}
- if(strings && strings->size() > 0)
- lab_child.AddAttribute(attr_string);
+
+ if (strings && size > 0)
+ assert(lab.IsAttribute(TDataStd_ExtStringArray::GetID()));
//4. add double attribute
DLIList<double*>* doubles = csa->double_data_list();
Handle_TDataStd_RealArray attr_double;
- if(doubles && doubles->size() > 0)
+ size = doubles->size();
+ if(doubles && size > 0)
{
- //set the length of double array be 11, can be extended.
- attr_double = TDataStd_RealArray::Set(lab_child,0, 10);
+ //set the length of double array .
+ attr_double = TDataStd_RealArray::Set(lab,0, size-1);
}
-
- for(int i = 0; doubles && i < doubles->size(); i++)
+ doubles->reset();
+ for(int i = 0; doubles && i < size; i++)
attr_double->SetValue(i, *(doubles->get_and_step()));
- if(doubles && doubles->size() > 0)
- lab_child.AddAttribute(attr_double);
+ if(doubles && size > 0)
+ assert(lab.IsAttribute(TDataStd_RealArray::GetID()));
//5. add int attribute
DLIList<int*>* ints = csa->int_data_list();
Handle_TDataStd_IntegerArray attr_int;
- if(ints && ints->size() > 0)
+ size = ints->size();
+ if(ints && size > 0)
{
//set the length of int array be 11, can be extended.
- attr_int = TDataStd_IntegerArray::Set(lab_child, 0, 10);
+ attr_int = TDataStd_IntegerArray::Set(lab, 0, size-1);
}
-
- for(int i = 0; ints && i < ints->size(); i++)
+ ints->reset();
+ for(int i = 0; ints && i < size; i++)
attr_int->SetValue(i, *(ints->get_and_step()));
- if(ints && ints->size() > 0)
- lab_child.AddAttribute(attr_int);
+ if(ints && size > 0)
+ assert(lab.IsAttribute(TDataStd_IntegerArray::GetID()));
}
-void OCCAttribSet::remove_attribute( CubitSimpleAttrib* csa)
+CubitBoolean OCCAttribSet::find_attribute(TDF_Label child,
+ CubitSimpleAttrib* csa)
{
- if( !listHead )
- return;
-
- OCCAttrib* attrib = 0;
- if ( listHead->equals(csa) )
- {
- attrib = listHead;
- listHead = listHead->listNext;
- delete attrib;
- return;
- }
-
- for ( OCCAttrib* prev = listHead; prev->listNext; prev = prev->listNext )
- {
- if( prev->listNext->equals(csa) )
- {
- attrib = prev->listNext;
- prev->listNext = attrib->listNext;
- delete attrib;
- return;
- }
- }
-
- //forget csa attribute from the document
DLIList<int*>* ints = csa->int_data_list();
CubitString type = csa->character_type();
TCollection_ExtendedString cstring( (Standard_CString)type.c_str() );
+ DLIList<double*>* doubles = csa->double_data_list();
+ DLIList<CubitString*>* strings = csa->string_data_list();
- if(type.length() == 0)
- return;
-
- DLIList<double*>* doubles = csa->double_data_list();
- DLIList<CubitString*>* strings = csa->string_data_list();
- for (TDF_ChildIterator it1(myLabel, CUBIT_TRUE); it1.More(); it1.Next())
+ //find the same type attribute first
+ Handle_TDataStd_Name attr_name;
+ TCollection_ExtendedString old_string;
+ if(child.FindAttribute(TDataStd_Name::GetID(), attr_name))
{
- //find the same type attribute first
- TDF_Label child = it1.Value();
+ old_string = attr_name->Get();
- Handle_TDataStd_Name attr_name;
- TCollection_ExtendedString old_string;
- if(child.FindAttribute(TDataStd_Name::GetID(), attr_name))
- old_string = attr_name->Get();
+ if(old_string != cstring)
+ return CUBIT_FALSE;
+ }
- if(old_string != cstring)
- continue;
-
- //continue to compare the rest attributes.
- CubitBoolean is_same = CUBIT_TRUE;
- for(TDF_ChildIterator it2(child,CUBIT_FALSE); it2.More(); it2.Next())
+ else
+ return CUBIT_FALSE;
+
+ //continue to compare the rest attributes.
+ CubitBoolean is_same = CUBIT_TRUE;
+ if(ints->size() > 0 )
+ {
+ Handle_TDataStd_IntegerArray attr_ints;
+ if(child.FindAttribute(TDataStd_IntegerArray::GetID(), attr_ints) &&
+ attr_ints->Length() == ints->size())
{
- is_same = CUBIT_TRUE;
- TDF_Label g_child = it2.Value();
- if(ints->size() > 0 )
- {
- Handle_TDataStd_IntegerArray attr_ints;
- if(g_child.FindAttribute(TDataStd_IntegerArray::GetID(), attr_ints) &&
- attr_ints->Length() == ints->size())
+ for(int i = 0; i < ints->size(); i++)
+ if(attr_ints->Value(i) != *ints->get_and_step())
{
- for(int i = 0; i < ints->size(); i++)
- if(attr_ints->Value(i) != *ints->get_and_step())
- {
- is_same = CUBIT_FALSE;
- break;
- }
+ is_same = CUBIT_FALSE;
+ break;
}
- }
- if(!is_same)
- continue;
-
- if(doubles->size() > 0 )
- {
- Handle_TDataStd_RealArray attr_doubles;
- if(g_child.FindAttribute(TDataStd_RealArray::GetID(), attr_doubles) &&
- attr_doubles->Length() == doubles->size())
+ }
+ }
+ if(!is_same)
+ return is_same;
+
+ if(doubles->size() > 0 )
+ {
+ Handle_TDataStd_RealArray attr_doubles;
+ if(child.FindAttribute(TDataStd_RealArray::GetID(), attr_doubles) &&
+ attr_doubles->Length() == doubles->size())
+ {
+ for(int i = 0; i < doubles->size(); i++)
+ if(attr_doubles->Value(i) != *doubles->get_and_step())
{
- for(int i = 0; i < doubles->size(); i++)
- if(attr_doubles->Value(i) != *doubles->get_and_step())
- {
- is_same = CUBIT_FALSE;
- break;
- }
+ is_same = CUBIT_FALSE;
+ break;
}
- }
+ }
+ }
- if(!is_same)
- continue;
+ if(!is_same)
+ return is_same;
- if(strings->size() > 0 )
+ if(strings->size() > 0 )
+ {
+ Handle_TDataStd_ExtStringArray attr_strings;
+ if(child.FindAttribute(TDataStd_ExtStringArray::GetID(), attr_strings) &&
+ attr_strings->Length() == strings->size()-1)
+ {
+ strings->step();//filter out type string
+ for(int i = 0; i < strings->size()-1; i++)
{
- Handle_TDataStd_ExtStringArray attr_strings;
- if(g_child.FindAttribute(TDataStd_ExtStringArray::GetID(), attr_strings) &&
- attr_strings->Length() == strings->size())
+ CubitString astring = *strings->get_and_step();
+ TCollection_ExtendedString string( (Standard_CString)astring.c_str() );
+ if(attr_strings->Value(i) != string)
{
- for(int i = 0; i < strings->size(); i++)
- {
- CubitString astring = *strings->get_and_step();
- TCollection_ExtendedString string( (Standard_CString)astring.c_str() );
- if(attr_strings->Value(i) != string)
- {
- is_same = CUBIT_FALSE;
- break;
- }
- }
+ is_same = CUBIT_FALSE;
+ break;
}
}
- if(!is_same)
- continue;
-
- child.ForgetAllAttributes( );
}
}
+ return is_same ;
}
-void OCCAttribSet::remove_all_attributes()
+void OCCAttribSet::remove_attribute( CubitSimpleAttrib* csa)
{
- while( listHead )
+ CubitString type = csa->character_type();
+ if(type.length() == 0)
+ return;
+
+ TDF_Label myLabel;
+ for (TDF_ChildIterator it(OCCQueryEngine::instance()->mainLabel, CUBIT_FALSE); it.More(); it.Next())
{
- OCCAttrib* dead = listHead;
- listHead = dead->listNext;
- delete dead;
+ //find the same type attribute first
+ myLabel = it.Value();
+
+ //forget csa attribute from the document
+ for (TDF_ChildIterator it1(myLabel, CUBIT_FALSE); it1.More(); it1.Next())
+ {
+ //find the same type attribute first
+ TDF_Label child = it1.Value();
+
+ CubitBoolean found = find_attribute(child, csa);
+
+ if(found)
+ child.ForgetAllAttributes( );
+ }
}
- myLabel.ForgetAllAttributes( );
}
-CubitStatus OCCAttribSet::get_attributes( DLIList<CubitSimpleAttrib*>& list ) const
+void OCCAttribSet::remove_attribute( CubitSimpleAttrib* csa,
+ TopoDS_Shape& shape)
{
- for( OCCAttrib* attrib = listHead; attrib; attrib = attrib->listNext )
- list.append( attrib->get_CSA() );
- return CUBIT_SUCCESS;
+ CubitBoolean found = CUBIT_FALSE;
+ TDF_Label myLabel;
+
+ FindShape(shape, myLabel, found);
+
+ if(!found)
+ return;
+
+ for (TDF_ChildIterator it1(myLabel, CUBIT_FALSE); it1.More(); it1.Next())
+ {
+ //find the same type attribute first
+ TDF_Label child = it1.Value();
+
+ if(!csa)
+ child.ForgetAllAttributes( );
+
+ else
+ {
+ CubitBoolean found = find_attribute(child, csa);
+
+ if(found)
+ child.ForgetAllAttributes( );
+ }
+ }
}
-CubitStatus OCCAttribSet::get_attributes( const CubitString& name,
- DLIList<CubitSimpleAttrib*>& list ) const
+void OCCAttribSet::get_attributes(TDF_Label &lab,
+ DLIList<CubitSimpleAttrib*>& list)
{
- for( OCCAttrib* attrib = listHead; attrib; attrib = attrib->listNext )
- if( attrib->name() == name )
- list.append( attrib->get_CSA() );
- return CUBIT_SUCCESS;
+ DLIList<CubitString*> strings;
+ CubitString* string;
+ DLIList<double> doubles;
+ DLIList<int> ints;
+
+ Handle_TDataStd_Name attr_name;
+ TCollection_ExtendedString name_string;
+ Handle_TDataStd_ExtStringArray attr_string;
+ Handle_TDataStd_RealArray attr_doubles;
+ Handle_TDataStd_IntegerArray attr_ints;
+
+ if(lab.FindAttribute(TDataStd_Name::GetID(), attr_name))
+ {
+ name_string = attr_name->Get();
+ int length = name_string.Length();
+ char temp_type[length];
+ for (int i = 1 ; i <= length; i++)
+ {
+ Standard_ExtCharacter c = name_string.Value(i);
+ temp_type[i-1] = ToCharacter(c);
+ }
+ CubitString temp_string(temp_type);
+ temp_string = temp_string.substr(0, length);
+ string = new CubitString(temp_string);
+ strings.append(string);
+ }
+ if(lab.FindAttribute(TDataStd_ExtStringArray::GetID(), attr_string))
+ {
+ int length = attr_string->Length();
+ for (int i = 0 ; i < length; i++)
+ {
+ name_string = attr_string->Value(i);
+ int length2 = name_string.Length();
+ char temp_string[length2];
+ for(int j = 1; j <= length2; j ++)
+ {
+ Standard_ExtCharacter c = name_string.Value(j);
+ temp_string[j-1] = ToCharacter(c);
+ }
+ CubitString tmp_string(temp_string);
+ tmp_string = tmp_string.substr(0, length2);
+ string = new CubitString(tmp_string);
+ strings.append(string);
+ }
+ }
+ if(lab.FindAttribute(TDataStd_RealArray::GetID(), attr_doubles))
+ {
+ for(int i = 0; i < attr_doubles->Length(); i++)
+ {
+ double d = attr_doubles->Value(i);
+ doubles.append(d);
+ }
+ }
+ if(lab.FindAttribute(TDataStd_IntegerArray::GetID(), attr_ints))
+ {
+ for(int i = 0; i < attr_ints->Length(); i++)
+ {
+ int j = attr_ints->Value(i);
+ ints.append(j);
+ }
+ }
+ CubitSimpleAttrib *tmp_attrib;
+ if(strings.size() > 0 || doubles.size() || ints.size())
+ {
+ tmp_attrib = new CubitSimpleAttrib(&strings, &doubles, &ints);
+ list.append(tmp_attrib);
+ }
+ for(int i = 0; i < strings.size(); i++)
+ delete strings.get_and_step();
}
-CubitStatus OCCAttribSet::save_attributes( FILE* file_ptr ) const
+CubitStatus OCCAttribSet::get_attributes( TopoDS_Shape& shape,
+ DLIList<CubitSimpleAttrib*>& list)
{
- OCCAttrib *curr_attrib;
- CubitStatus status = CUBIT_SUCCESS;
-
- //save # attribs
- unsigned int size = attribute_count();
- NCubitFile::CIOWrapper wrapper( file_ptr );
- wrapper.Write( &size, 1 );
+ CubitBoolean found = CUBIT_FALSE;
+ TDF_Label myLabel;
- //save each attrib
- for( curr_attrib = listHead; curr_attrib; curr_attrib = curr_attrib->listNext )
- if( !curr_attrib->save(file_ptr) )
- status = CUBIT_FAILURE;
+ FindShape(shape, myLabel, found);
- return status;
+ if(!found)
+ return CUBIT_FAILURE;
+
+ DLIList<CubitString*> strings;
+ CubitString* string;
+ DLIList<double> doubles;
+ DLIList<int> ints;
+ TDF_Label lab;
+ Handle_TDataStd_Name attr_name;
+ TCollection_ExtendedString name_string;
+ Handle_TDataStd_ExtStringArray attr_string;
+ Handle_TDataStd_RealArray attr_doubles;
+ Handle_TDataStd_IntegerArray attr_ints;
+ for (TDF_ChildIterator it(myLabel,CUBIT_FALSE); it.More(); it.Next())
+ {
+ lab = it.Value();
+ get_attributes(lab, list);
+ }
+ return CUBIT_SUCCESS;
}
-
-CubitStatus OCCAttribSet::restore_attributes( FILE* file_ptr, unsigned endian )
+
+CubitStatus OCCAttribSet::get_attributes( const CubitString& name,
+ TopoDS_Shape& shape,
+ DLIList<CubitSimpleAttrib*>& list )
{
- OCCAttrib *curr_attrib;
-
- //Read # attribs
- unsigned int size;
- NCubitFile::CIOWrapper wrapper( endian, file_ptr );
- wrapper.Read( &size, 1 );
+ CubitBoolean found = CUBIT_FALSE;
+ TDF_Label aLabel;
- for (unsigned i = 0; i < size; i++)
+ FindShape(shape, aLabel, found);
+
+ if(!found)
+ return CUBIT_FAILURE;
+
+ Handle_TDataStd_Name attr_name;
+ TCollection_ExtendedString cstring( (Standard_CString)name.c_str() );
+ TDF_Label lab;
+ for (TDF_ChildIterator it(aLabel,CUBIT_FALSE); it.More(); it.Next())
{
- curr_attrib = OCCAttrib::restore( file_ptr, endian);
- if (!curr_attrib)
+ lab = it.Value();
+
+ //check if the type attribute is the same, disable it
+ TCollection_ExtendedString old_string;
+ if(lab.FindAttribute(TDataStd_Name::GetID(), attr_name))
{
- // file corrupt? don't try to read any more
- return CUBIT_FAILURE;
+ old_string = attr_name->Get();
+
+ if(old_string == cstring)
+ {
+ get_attributes(lab, list);
+ break;
+ }
}
-
- curr_attrib->listNext = listHead;
- listHead = curr_attrib;
}
-
+
return CUBIT_SUCCESS;
}
-int OCCAttribSet::attribute_count() const
+int OCCAttribSet::attribute_count()
{
int count = 0;
- for( OCCAttrib* attrib = listHead; attrib; attrib = attrib->listNext )
- count++;
+
return count;
}
Modified: cgm/trunk/geom/OCC/OCCAttribSet.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCAttribSet.hpp 2008-07-29 21:22:57 UTC (rev 2032)
+++ cgm/trunk/geom/OCC/OCCAttribSet.hpp 2008-07-31 18:16:18 UTC (rev 2033)
@@ -12,14 +12,12 @@
#ifndef FACET_BRIDGE_HPP
#define FACET_BRIDGE_HPP
+#include "config.h"
#include <DLIList.hpp>
#include "TDF_Label.hxx"
-#include "TDF_TagSource.hxx"
-#include "OCCQueryEngine.hpp"
class CubitSimpleAttrib;
-class OCCAttrib;
class CubitString;
class TopoDS_Shape;
@@ -28,32 +26,35 @@
public:
- OCCAttribSet() : listHead(0)
- {myLabel = TDF_TagSource::NewChild(OCCQueryEngine::mainLabel);}
+ OCCAttribSet() {};
- ~OCCAttribSet() { remove_all_attributes(); }
+ ~OCCAttribSet() { ; }
+ static void FindShape(TopoDS_Shape& shape,
+ TDF_Label& aLabel,
+ CubitBoolean& found);
- void append_attribute( CubitSimpleAttrib*, TopoDS_Shape& shape );
+ static CubitBoolean find_attribute(TDF_Label child,
+ CubitSimpleAttrib* csa);
+
+ static void append_attribute( CubitSimpleAttrib*, TopoDS_Shape& shape );
- void remove_attribute( CubitSimpleAttrib* );
+ static void remove_attribute( CubitSimpleAttrib* );
- void remove_all_attributes();
+ static void remove_attribute(CubitSimpleAttrib*, TopoDS_Shape& shape );
+
+ static void get_attributes(TDF_Label &lab,
+ DLIList<CubitSimpleAttrib*>& list);
+
+ static CubitStatus get_attributes( TopoDS_Shape& shape,
+ DLIList<CubitSimpleAttrib*>& ) ;
- CubitStatus get_attributes( DLIList<CubitSimpleAttrib*>& ) const;
+ static CubitStatus get_attributes( const CubitString& name,
+ TopoDS_Shape& shape,
+ DLIList<CubitSimpleAttrib*>& ) ;
- CubitStatus get_attributes( const CubitString& name,
- DLIList<CubitSimpleAttrib*>& ) const;
+ static int attribute_count() ;
- CubitStatus save_attributes( FILE* file ) const;
-
- CubitStatus restore_attributes( FILE* file, unsigned int endian );
-
- int attribute_count() const;
-
private:
-
- OCCAttrib* listHead;
- TDF_Label myLabel;
};
#endif
Modified: cgm/trunk/geom/OCC/OCCBody.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.cpp 2008-07-29 21:22:57 UTC (rev 2032)
+++ cgm/trunk/geom/OCC/OCCBody.cpp 2008-07-31 18:16:18 UTC (rev 2033)
@@ -127,27 +127,72 @@
}
void OCCBody::append_simple_attribute_virt(CubitSimpleAttrib *csa)
- { attribSet.append_attribute(csa, *myTopoDSShape); }
+{
+ if(IsSheetBody)
+ {
+ TopoDS_Face * face = mySheetSurface->get_TopoDS_Face();
+ OCCAttribSet::append_attribute(csa, *face);
+ }
+ else if(myShell)
+ {
+ TopoDS_Shell* shell = myShell->get_TopoDS_Shell();
+ OCCAttribSet::append_attribute(csa, *shell);
+ }
+ else
+ OCCAttribSet::append_attribute(csa, *myTopoDSShape);
+}
void OCCBody::remove_simple_attribute_virt(CubitSimpleAttrib *csa)
- { attribSet.remove_attribute(csa); }
+{
+ if(IsSheetBody)
+ {
+ TopoDS_Face * face = mySheetSurface->get_TopoDS_Face();
+ OCCAttribSet::remove_attribute(csa, *face);
+ }
+ else if(myShell)
+ {
+ TopoDS_Shell* shell = myShell->get_TopoDS_Shell();
+ OCCAttribSet::remove_attribute(csa, *shell);
+ }
+ else
+ OCCAttribSet::remove_attribute(csa, *myTopoDSShape);
+}
+
void OCCBody::remove_all_simple_attribute_virt()
- { attribSet.remove_all_attributes(); }
+ { remove_simple_attribute_virt(NULL); }
CubitStatus OCCBody::get_simple_attribute(DLIList<CubitSimpleAttrib*>& csa_list)
- { return attribSet.get_attributes(csa_list); }
+{
+ if(IsSheetBody)
+ {
+ TopoDS_Face * face = mySheetSurface->get_TopoDS_Face();
+ return OCCAttribSet::get_attributes(*face, csa_list);
+ }
+ else if(myShell)
+ {
+ TopoDS_Shell* shell = myShell->get_TopoDS_Shell();
+ return OCCAttribSet::get_attributes(*shell, csa_list);
+ }
+ return OCCAttribSet::get_attributes(*myTopoDSShape,csa_list);
+}
CubitStatus OCCBody::get_simple_attribute( const CubitString& name,
DLIList<CubitSimpleAttrib*>& csa_list )
- { return attribSet.get_attributes( name, csa_list ); }
+{
+ if(IsSheetBody)
+ {
+ TopoDS_Face * face = mySheetSurface->get_TopoDS_Face();
+ return OCCAttribSet::get_attributes(name, *face, csa_list);
+ }
+ else if(myShell)
+ {
+ TopoDS_Shell* shell = myShell->get_TopoDS_Shell();
+ return OCCAttribSet::get_attributes(name, *shell, csa_list);
+ }
+ return OCCAttribSet::get_attributes( name, *myTopoDSShape, csa_list );
+}
-CubitStatus OCCBody::save_attribs( FILE *file_ptr )
- { return attribSet.save_attributes( file_ptr); }
-
-CubitStatus OCCBody::restore_attribs( FILE *file_ptr, unsigned int endian )
- { return attribSet.restore_attributes( file_ptr, endian ); }
-
CubitStatus OCCBody::get_transforms( CubitTransformMatrix &tfm )
{
return CUBIT_SUCCESS;
Modified: cgm/trunk/geom/OCC/OCCBody.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.hpp 2008-07-29 21:22:57 UTC (rev 2032)
+++ cgm/trunk/geom/OCC/OCCBody.hpp 2008-07-31 18:16:18 UTC (rev 2033)
@@ -159,12 +159,6 @@
CubitStatus reflect(double,double,double);
//- reflect about an axis
- CubitStatus save_attribs( FILE* file_ptr );
- // Write FactAttribs out to file
-
- CubitStatus restore_attribs( FILE* file_ptr, unsigned int endian );
- // Read FactAttribs from file
-
virtual void get_parents_virt( DLIList<TopologyBridge*>& parents );
virtual void get_children_virt( DLIList<TopologyBridge*>& children );
Modified: cgm/trunk/geom/OCC/OCCCurve.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.cpp 2008-07-29 21:22:57 UTC (rev 2032)
+++ cgm/trunk/geom/OCC/OCCCurve.cpp 2008-07-31 18:16:18 UTC (rev 2033)
@@ -135,7 +135,7 @@
// Creation Date : 07/14/00
//-------------------------------------------------------------------------
void OCCCurve::append_simple_attribute_virt(CubitSimpleAttrib *csa)
- { attribSet.append_attribute(csa, *myTopoDSEdge); }
+ { OCCAttribSet::append_attribute(csa, *myTopoDSEdge); }
//-------------------------------------------------------------------------
// Purpose : The purpose of this function is to remove a simple
@@ -149,7 +149,7 @@
// Creation Date : 07/14/00
//-------------------------------------------------------------------------
void OCCCurve::remove_simple_attribute_virt(CubitSimpleAttrib *csa)
- { attribSet.remove_attribute(csa); }
+ { OCCAttribSet::remove_attribute(csa, *myTopoDSEdge); }
//-------------------------------------------------------------------------
// Purpose : The purpose of this function is to remove all simple
@@ -164,7 +164,7 @@
// Creation Date : 07/14/00
//-------------------------------------------------------------------------
void OCCCurve::remove_all_simple_attribute_virt()
- { attribSet.remove_all_attributes(); }
+ { OCCAttribSet::remove_attribute(NULL, *myTopoDSEdge); }
//-------------------------------------------------------------------------
// Purpose : The purpose of this function is to get the
@@ -179,21 +179,12 @@
//-------------------------------------------------------------------------
CubitStatus OCCCurve::get_simple_attribute(DLIList<CubitSimpleAttrib*>&
csa_list)
- { return attribSet.get_attributes(csa_list); }
+ { return OCCAttribSet::get_attributes(*myTopoDSEdge, csa_list); }
CubitStatus OCCCurve::get_simple_attribute( const CubitString& name,
DLIList<CubitSimpleAttrib*>& csa_list)
- { return attribSet.get_attributes( name, csa_list ); }
+ { return OCCAttribSet::get_attributes( name, *myTopoDSEdge, csa_list ); }
-
-CubitStatus OCCCurve::save_attribs( FILE *file_ptr )
- { return attribSet.save_attributes(file_ptr); }
-
-CubitStatus OCCCurve::restore_attribs( FILE *file_ptr, unsigned int endian )
- { return attribSet.restore_attributes(file_ptr, endian); }
-
-
-
//-------------------------------------------------------------------------
// Purpose : Get geometry modeling engine: OCCQueryEngine
//
Modified: cgm/trunk/geom/OCC/OCCCurve.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.hpp 2008-07-29 21:22:57 UTC (rev 2032)
+++ cgm/trunk/geom/OCC/OCCCurve.hpp 2008-07-31 18:16:18 UTC (rev 2033)
@@ -17,7 +17,7 @@
// ********** BEGIN STANDARD INCLUDES **********
// ********** END STANDARD INCLUDES **********
-
+#include "config.h"
// ********** BEGIN CUBIT INCLUDES **********
#include "CubitDefines.h"
#include "Curve.hpp"
Modified: cgm/trunk/geom/OCC/OCCLoop.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLoop.cpp 2008-07-29 21:22:57 UTC (rev 2032)
+++ cgm/trunk/geom/OCC/OCCLoop.cpp 2008-07-31 18:16:18 UTC (rev 2033)
@@ -108,9 +108,6 @@
//-------------------------------------------------------------------------
void OCCLoop::append_simple_attribute_virt(CubitSimpleAttrib* /*csattrib_ptr*/)
{
- //PRINT_ERROR("OCCLoop::append_simple_attribute_virt not defined\n");
- return;
-
}
//-------------------------------------------------------------------------
@@ -123,8 +120,6 @@
//-------------------------------------------------------------------------
void OCCLoop::remove_simple_attribute_virt(CubitSimpleAttrib* /*csattrib_ptr*/)
{
- //PRINT_ERROR("OCCLoop::remove_simple_attribute_virt not defined\n");
- return;
}
//-------------------------------------------------------------------------
@@ -138,8 +133,6 @@
//-------------------------------------------------------------------------
void OCCLoop::remove_all_simple_attribute_virt()
{
- //PRINT_ERROR(" OCCLoop::remove_all_simple_attribute_virt not defined\n");
- return;
}
//-------------------------------------------------------------------------
@@ -153,11 +146,9 @@
CubitStatus OCCLoop::get_simple_attribute(DLIList<CubitSimpleAttrib*>&
/*cubit_simple_attrib_list*/)
{
- //PRINT_ERROR("OCCLoop::get_simple_attribute not defined\n");
- return CUBIT_FAILURE;
}
CubitStatus OCCLoop::get_simple_attribute(const CubitString&,
- DLIList<CubitSimpleAttrib*>&)
+ DLIList<CubitSimpleAttrib*>&)
{ return CUBIT_FAILURE; }
void OCCLoop::get_parents_virt( DLIList<TopologyBridge*>& parents )
Modified: cgm/trunk/geom/OCC/OCCLump.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLump.cpp 2008-07-29 21:22:57 UTC (rev 2032)
+++ cgm/trunk/geom/OCC/OCCLump.cpp 2008-07-31 18:16:18 UTC (rev 2033)
@@ -124,7 +124,16 @@
// Creation Date : 11/21/96
//-------------------------------------------------------------------------
void OCCLump::append_simple_attribute_virt(CubitSimpleAttrib *csa)
- { attribSet.append_attribute(csa, *myTopoDSSolid); }
+{
+ TopoDS_Shape shape;
+ if(mySheetSurface)
+ shape = *(mySheetSurface->get_TopoDS_Face());
+ else if(myShell)
+ shape = *(myShell->get_TopoDS_Shell());
+ else
+ shape =*myTopoDSSolid;
+ OCCAttribSet::append_attribute(csa, shape);
+}
//-------------------------------------------------------------------------
// Purpose : The purpose of this function is to remove a simple
@@ -138,7 +147,16 @@
// Creation Date : 03/18/97
//-------------------------------------------------------------------------
void OCCLump::remove_simple_attribute_virt(CubitSimpleAttrib *csa )
- { attribSet.remove_attribute(csa); }
+{
+ TopoDS_Shape shape;
+ if(mySheetSurface)
+ shape = *(mySheetSurface->get_TopoDS_Face());
+ else if(myShell)
+ shape = *(myShell->get_TopoDS_Shell());
+ else
+ shape =*myTopoDSSolid;
+ OCCAttribSet::remove_attribute(csa, shape);
+}
//-------------------------------------------------------------------------
// Purpose : The purpose of this function is to remove all simple
@@ -153,7 +171,16 @@
// Creation Date : 07/10/98
//-------------------------------------------------------------------------
void OCCLump::remove_all_simple_attribute_virt()
-{ attribSet.remove_all_attributes(); }
+{
+ TopoDS_Shape shape;
+ if(mySheetSurface)
+ shape = *(mySheetSurface->get_TopoDS_Face());
+ else if(myShell)
+ shape = *(myShell->get_TopoDS_Shell());
+ else
+ shape =*myTopoDSSolid;
+ OCCAttribSet::remove_attribute(NULL, shape);
+}
//-------------------------------------------------------------------------
// Purpose : The purpose of this function is to get the
@@ -164,21 +191,31 @@
//
//-------------------------------------------------------------------------
CubitStatus OCCLump::get_simple_attribute(DLIList<CubitSimpleAttrib*>& csa_list)
- { return attribSet.get_attributes( csa_list ); }
+{
+ TopoDS_Shape shape;
+ if(mySheetSurface)
+ shape = *(mySheetSurface->get_TopoDS_Face());
+ else if(myShell)
+ shape = *(myShell->get_TopoDS_Shell());
+ else
+ shape =*myTopoDSSolid;
+ return OCCAttribSet::get_attributes(shape, csa_list );
+}
CubitStatus OCCLump::get_simple_attribute( const CubitString& name,
DLIList<CubitSimpleAttrib*>& csa_list )
- { return attribSet.get_attributes( name, csa_list ); }
+{
+ TopoDS_Shape shape;
+ if(mySheetSurface)
+ shape = *(mySheetSurface->get_TopoDS_Face());
+ else if(myShell)
+ shape = *(myShell->get_TopoDS_Shell());
+ else
+ shape =*myTopoDSSolid;
+ return OCCAttribSet::get_attributes( name, shape, csa_list );
+}
-CubitStatus OCCLump::save_attribs( FILE *file_ptr )
- { return attribSet.save_attributes( file_ptr ); }
-CubitStatus OCCLump::restore_attribs( FILE *file_ptr, unsigned int endian )
- { return attribSet.restore_attributes( file_ptr, endian ); }
-
-
-
-
//-------------------------------------------------------------------------
// Purpose : Get the bounding box of the object.
//
Modified: cgm/trunk/geom/OCC/OCCLump.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLump.hpp 2008-07-29 21:22:57 UTC (rev 2032)
+++ cgm/trunk/geom/OCC/OCCLump.hpp 2008-07-31 18:16:18 UTC (rev 2033)
@@ -15,6 +15,7 @@
// ********** BEGIN STANDARD INCLUDES **********
// ********** END STANDARD INCLUDES **********
+#include "config.h"
// ********** BEGIN CUBIT INCLUDES **********
#include "CubitDefines.h"
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2008-07-29 21:22:57 UTC (rev 2032)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2008-07-31 18:16:18 UTC (rev 2033)
@@ -28,6 +28,7 @@
class TopoDS_Edge;
class TopoDS_Face;
class CubitBox;
+class BRepAlgoAPI_BooleanOperation;
class OCCModifyEngine : public GeometryModifyEngine
{
Modified: cgm/trunk/geom/OCC/OCCPoint.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCPoint.cpp 2008-07-29 21:22:57 UTC (rev 2032)
+++ cgm/trunk/geom/OCC/OCCPoint.cpp 2008-07-31 18:16:18 UTC (rev 2033)
@@ -22,7 +22,6 @@
#include "OCCCurve.hpp"
#include "OCCQueryEngine.hpp"
#include "CastTo.hpp"
-#include "OCCAttribSet.hpp"
#include "CubitSimpleAttrib.hpp"
#include "BRep_Tool.hxx"
#include "TopExp.hxx"
@@ -105,7 +104,7 @@
// Creation Date : 07/16/00
//-------------------------------------------------------------------------
void OCCPoint::append_simple_attribute_virt(CubitSimpleAttrib *csa)
- { attribSet.append_attribute(csa, *myTopoDSVertex); }
+ { OCCAttribSet::append_attribute(csa, *myTopoDSVertex); }
//-------------------------------------------------------------------------
// Purpose : The purpose of this function is to remove a simple
@@ -119,7 +118,7 @@
// Creation Date : 07/16/00
//-------------------------------------------------------------------------
void OCCPoint::remove_simple_attribute_virt(CubitSimpleAttrib *csa)
- { attribSet.remove_attribute(csa); }
+ { OCCAttribSet::remove_attribute(csa, *myTopoDSVertex); }
//-------------------------------------------------------------------------
// Purpose : The purpose of this function is to remove all simple
@@ -134,7 +133,7 @@
// Creation Date : 07/16/00
//-------------------------------------------------------------------------
void OCCPoint::remove_all_simple_attribute_virt()
- { attribSet.remove_all_attributes(); }
+ { OCCAttribSet::remove_attribute(NULL, *myTopoDSVertex); }
//-------------------------------------------------------------------------
// Purpose : The purpose of this function is to get the
@@ -149,22 +148,14 @@
//-------------------------------------------------------------------------
CubitStatus OCCPoint::get_simple_attribute(DLIList<CubitSimpleAttrib*>&
csa_list)
- { return attribSet.get_attributes(csa_list);
+ { return OCCAttribSet::get_attributes(*myTopoDSVertex,csa_list);
}
CubitStatus OCCPoint::get_simple_attribute(const CubitString& name,
DLIList<CubitSimpleAttrib*>& csa_list )
- { return attribSet.get_attributes( name, csa_list );
+ { return OCCAttribSet::get_attributes( name, *myTopoDSVertex, csa_list );
}
-CubitStatus OCCPoint::save_attribs( FILE *file_ptr )
- { return attribSet.save_attributes(file_ptr);
- }
-
-CubitStatus OCCPoint::restore_attribs( FILE *file_ptr, unsigned int endian )
- { return attribSet.restore_attributes(file_ptr, endian);
- }
-
//-------------------------------------------------------------------------
// Purpose : Returns the coordinates of this Point.
//
Modified: cgm/trunk/geom/OCC/OCCPoint.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCPoint.hpp 2008-07-29 21:22:57 UTC (rev 2032)
+++ cgm/trunk/geom/OCC/OCCPoint.hpp 2008-07-31 18:16:18 UTC (rev 2033)
@@ -17,7 +17,7 @@
// ********** BEGIN STANDARD INCLUDES **********
// ********** END STANDARD INCLUDES **********
-
+#include "config.h"
// ********** BEGIN CUBIT INCLUDES **********
#include "Point.hpp"
#include <stdio.h>
Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2008-07-29 21:22:57 UTC (rev 2032)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2008-07-31 18:16:18 UTC (rev 2033)
@@ -14,6 +14,7 @@
//
//-------------------------------------------------------------------------
#include "config.h"
+#include <Standard_Stream.hxx>
#include "BRep_Tool.hxx"
#include "gp_Pnt.hxx"
#include "gp_Ax1.hxx"
@@ -23,6 +24,7 @@
#include "BRepBuilderAPI.hxx"
#include "BRepBuilderAPI_Transform.hxx"
#include "BRepBuilderAPI_MakeSolid.hxx"
+#include "OCCShapeAttributeSet.hpp"
#include "BRepBuilderAPI_MakeShell.hxx"
#include "BRepTools_WireExplorer.hxx"
#include "TColgp_Array1OfPnt.hxx"
@@ -95,6 +97,8 @@
#include <BndLib_AddSurface.hxx>
#include <Precision.hxx>
#include <BRepAdaptor_Surface.hxx>
+#include <TDataStd_Shape.hxx>
+#include <TDF_ChildIterator.hxx>
#include "Standard_Boolean.hxx"
//#include "TopOpeBRep_ShapeIntersector.hxx"
@@ -153,6 +157,7 @@
TCollection_ExtendedString xString;
MyDF = new TDocStd_Document(xString);
mainLabel = MyDF->Main();
+ EXPORT_ATTRIB = CUBIT_TRUE;
}
//================================================================================
@@ -1006,13 +1011,63 @@
B.Add(Co, *vertex);
}
- if(!BRepTools::Write(Co, const_cast<char*>(file_name)))
+ TDF_Label label;
+ if(EXPORT_ATTRIB)
+ label = mainLabel;
+
+ if(!Write(Co, const_cast<char*>(file_name),label))
+ //if(!BRepTools::Write(Co, const_cast<char*>(file_name)))
return CUBIT_FAILURE;
return CUBIT_SUCCESS;
}
+CubitBoolean OCCQueryEngine::Write(const TopoDS_Shape& Sh,
+ const Standard_CString File,
+ TDF_Label label)
+{
+ ofstream os;
+ os.open(File, ios::out);
+ if (!os.rdbuf()->is_open()) return Standard_False;
+
+ CubitBoolean isGood = (os.good() && !os.eof());
+ if(!isGood)
+ return isGood;
+ OCCShapeAttributeSet SS;
+ SS.Add(Sh);
+
+ os << "DBRep_DrawableShape\n"; // for easy Draw read
+ SS.Write(os, label);
+ isGood = os.good();
+ if(isGood )
+ SS.Write(Sh,os);
+ os.flush();
+ isGood = os.good();
+ os.close();
+ isGood = os.good() && isGood;
+
+ return isGood;
+}
+
+
+CubitBoolean OCCQueryEngine::Read(TopoDS_Shape& Sh,
+ const Standard_CString File,
+ TDF_Label label)
+{
+ filebuf fic;
+ istream in(&fic);
+ // if (!fic.open(File,input)) return Standard_False;
+ if (!fic.open(File, ios::in)) return Standard_False;
+
+ OCCShapeAttributeSet SS;
+ SS.Read(in, label);
+ int nbshapes = SS.NbShapes();
+ if(!nbshapes) return CUBIT_FALSE;
+ SS.Read(Sh,in,nbshapes);
+ return CUBIT_TRUE;
+}
+
CubitStatus
OCCQueryEngine::import_temp_geom_file(FILE* file_ptr,
const char* file_name,
@@ -1049,7 +1104,7 @@
{
TopoDS_Shape *aShape = new TopoDS_Shape;
BRep_Builder aBuilder;
- Standard_Boolean result = BRepTools::Read(*aShape, (char*) file_name, aBuilder);
+ Standard_Boolean result = Read(*aShape, (char*) file_name, mainLabel);
if (result==0) return CUBIT_FAILURE;
CubitBoolean prev_global_val = PRINT_RESULT;
@@ -1241,7 +1296,7 @@
OCCCoFace * coface = NULL;
int size = cofaces_old.size();
CubitSense sense ;
- if( aShape.Orientation() == CUBIT_REVERSED )
+ if( aShape.Orientation() == TopAbs_REVERSED )
sense = (topo_face.Orientation() == TopAbs_FORWARD ? CUBIT_REVERSED : CUBIT_FORWARD);
else
sense = (topo_face.Orientation() == TopAbs_FORWARD ? CUBIT_FORWARD : CUBIT_REVERSED);
@@ -2573,6 +2628,19 @@
if (!OCCMap->IsBound(old_shape) || old_shape.IsEqual(new_shape))
return -1;
+ //update the attribute label tree
+ DLIList<CubitSimpleAttrib*> list;
+ OCCAttribSet::get_attributes(old_shape, list);
+
+ for(int i = 0; i < list.size(); i ++)
+ {
+ CubitSimpleAttrib* s_attr = list.get_and_step();
+ OCCAttribSet::remove_attribute(s_attr);
+ if(!new_shape.IsNull())
+ OCCAttribSet::append_attribute(s_attr, new_shape);
+ }
+
+ //update CGM-OCC map
int k = OCCMap->Find(old_shape);
assert (k > 0 && k <= iTotalTBCreated);
Modified: cgm/trunk/geom/OCC/OCCQueryEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.hpp 2008-07-29 21:22:57 UTC (rev 2032)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.hpp 2008-07-31 18:16:18 UTC (rev 2033)
@@ -26,13 +26,14 @@
#endif
// ********** END STANDARD INCLUDES **********
-
+#include "TDF_Label.hxx"
// ********** BEGIN CUBIT INCLUDES **********
#include "config.h"
#include "CubitFileIOWrapper.hpp"
#include "GeometryQueryEngine.hpp"
#include "Handle_TDocStd_Document.hxx"
#include <map>
+
// ********** END CUBIT INCLUDES **********
// ********** BEGIN FORWARD DECLARATIONS
@@ -77,7 +78,6 @@
class OCCCurve;
class OCCPoint;
-class TDF_Label;
class BRepBuilderAPI_Transform;
class TopTools_DataMapOfShapeInteger;
class BRepAlgoAPI_BooleanOperation;
@@ -112,6 +112,8 @@
//- Singleton pattern
//- Controlled access and creation of the sole instance of this class.
+ CubitBoolean EXPORT_ATTRIB;
+
int update_OCC_map(TopoDS_Shape old_shape, TopoDS_Shape new_shape);
virtual ~OCCQueryEngine();
@@ -362,7 +364,7 @@
DLIList<OCCLoop*> *WireList; //standalone wire list
DLIList<OCCCurve*> *CurveList ;
Handle(TDocStd_Document) MyDF;
- static TDF_Label mainLabel;
+ TDF_Label mainLabel;
TopTools_DataMapOfShapeInteger* OCCMap;
std::map<int, TopologyBridge*>* OccToCGM;
static int iTotalTBCreated ;
@@ -382,6 +384,14 @@
DLIList<OCCCurve*> &facet_curves,
DLIList<OCCPoint*> &facet_points );
+ CubitBoolean Write(const TopoDS_Shape& Sh,
+ const Standard_CString File,
+ TDF_Label label);
+
+ CubitBoolean Read(TopoDS_Shape& Sh,
+ const Standard_CString File,
+ TDF_Label label);
+
static CubitBoolean PRINT_RESULT;
static OCCQueryEngine* instance_;
Added: cgm/trunk/geom/OCC/OCCShapeAttributeSet.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShapeAttributeSet.cpp (rev 0)
+++ cgm/trunk/geom/OCC/OCCShapeAttributeSet.cpp 2008-07-31 18:16:18 UTC (rev 2033)
@@ -0,0 +1,1784 @@
+// File: OCCShapeAttributeSet.cxx
+// Created: Thur Jul 10 2008
+// Author: Jane Hu
+
+#include <Standard_Stream.hxx>
+#include <BRepTools.hxx>
+#include "OCCShapeAttributeSet.hpp"
+#include "CubitSimpleAttrib.hpp"
+#include "OCCAttribSet.hpp"
+//#include <Poly.hxx>
+#include <TopoDS.hxx>
+#include <TColStd_Array1OfReal.hxx>
+#include <TColStd_HArray1OfInteger.hxx>
+#include <TColgp_Array1OfPnt2d.hxx>
+#include <BRep_GCurve.hxx>
+#include <Handle_BRep_CurveOnClosedSurface.hxx>
+#include <Handle_BRep_CurveOnSurface.hxx>
+#include <TopAbs_ShapeEnum.hxx>
+//#include <BRep_TFace.hxx>
+//#include <BRep_TEdge.hxx>
+//#include <BRep_TVertex.hxx>
+#include <Handle_BRep_GCurve.hxx>
+#include <BRep_Tool.hxx>
+#include <TDF_ChildIterator.hxx>
+#include <Handle_TDataStd_Shape.hxx>
+#include <TopTools_LocationSet.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopoDS_Iterator.hxx>
+//#include <BRep_CurveRepresentation.hxx>
+#include <Poly_Polygon3D.hxx>
+//#include <BRep_Polygon3D.hxx>
+//#include <BRep_PolygonOnSurface.hxx>
+//#include <BRep_PolygonOnClosedSurface.hxx>
+//#include <BRep_PolygonOnTriangulation.hxx>
+//#include <BRep_PolygonOnClosedTriangulation.hxx>
+#include <BRep_CurveOnSurface.hxx>
+#include <BRep_CurveOnClosedSurface.hxx>
+//#include <BRep_ListOfCurveRepresentation.hxx>
+//#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
+#include <BRep_PointOnCurve.hxx>
+#include <BRep_PointOnCurveOnSurface.hxx>
+#include <BRep_PointOnSurface.hxx>
+//#include <BRep_ListIteratorOfListOfPointRepresentation.hxx>
+#include <TDF_Label.hxx>
+#include <TDataStd_Shape.hxx>
+#include <Handle_TDataStd_Name.hxx>
+#include <TDataStd_Name.hxx>
+#include <Handle_TDataStd_ExtStringArray.hxx>
+#include <TDataStd_ExtStringArray.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <Handle_TDataStd_IntegerArray.hxx>
+#include <TDataStd_IntegerArray.hxx>
+#include <Handle_TDataStd_RealArray.hxx>
+#include <TDataStd_RealArray.hxx>
+#include <Handle_BRep_TVertex.hxx>
+#include <BRep_ListIteratorOfListOfPointRepresentation.hxx>
+#include <BRep_TVertex.hxx>
+#include <BRep_PointRepresentation.hxx>
+#include <Handle_BRep_TEdge.hxx>
+#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
+#include <Handle_BRep_TFace.hxx>
+#include <BRep_TFace.hxx>
+#include <BRep_TEdge.hxx>
+#include <BRep_CurveRepresentation.hxx>
+
+#include <TopoDS_Vertex.hxx>
+
+//#include <TColgp_HArray1OfPnt.hxx>
+//#include <TColgp_HArray1OfPnt2d.hxx>
+#include <TColStd_HArray1OfReal.hxx>
+#include <Poly_Triangulation.hxx>
+#include <Poly_PolygonOnTriangulation.hxx>
+
+
+#ifdef MacOS
+#define strcasecmp(p,q) strcmp(p,q)
+#elseif WNT
+#define strcasecmp strcmp
+#elseif AIX
+#include <string.h>
+#endif
+
+const char* dVersion = "CASCADE Topology V1, (c) Matra-Datavision";
+const char* dVersion2 = "CASCADE Topology V2, (c) Matra-Datavision";
+
+//=======================================================================
+//function : PrintShapeEnum
+//purpose :
+//=======================================================================
+
+static void PrintShapeEnum(const TopAbs_ShapeEnum T,
+ Standard_OStream& S,
+ Standard_Boolean C)
+{
+ switch(T) {
+
+ case TopAbs_VERTEX :
+ if (C) S << "Ve"; else S << "VERTEX ";
+ break;
+
+ case TopAbs_EDGE :
+ if (C) S << "Ed"; else S << "EDGE ";
+ break;
+
+ case TopAbs_WIRE :
+ if (C) S << "Wi"; else S << "WIRE ";
+ break;
+
+ case TopAbs_FACE :
+ if (C) S << "Fa"; else S << "FACE ";
+ break;
+
+ case TopAbs_SHELL :
+ if (C) S << "Sh"; else S << "SHELL ";
+ break;
+
+ case TopAbs_SOLID :
+ if (C) S << "So"; else S << "SOLID ";
+ break;
+
+ case TopAbs_COMPSOLID :
+ if (C) S << "CS"; else S << "COMPSOLID";
+ break;
+
+ case TopAbs_COMPOUND :
+ if (C) S << "Co"; else S << "COMPOUND ";
+ break;
+
+ case TopAbs_SHAPE :
+ if (C) S << "Sp"; else S << "SHAPE";
+ break;
+ }
+}
+
+//=======================================================================
+//function : PrintRegularity
+//purpose :
+//=======================================================================
+
+static void PrintRegularity(const GeomAbs_Shape C,
+ Standard_OStream& OS)
+{
+ switch (C) {
+
+ case GeomAbs_C0 :
+ OS << "C0";
+ break;
+
+ case GeomAbs_G1 :
+ OS << "G1";
+ break;
+
+ case GeomAbs_C1 :
+ OS << "C1";
+ break;
+
+ case GeomAbs_G2 :
+ OS << "G2";
+ break;
+
+ case GeomAbs_C2 :
+ OS << "C2";
+ break;
+
+ case GeomAbs_C3 :
+ OS << "C3";
+ break;
+
+ case GeomAbs_CN :
+ OS << "CN";
+ break;
+
+ }
+}
+
+//=======================================================================
+//function : PrintOrientation
+//purpose :
+//=======================================================================
+
+static void PrintOrientation(const TopAbs_Orientation O,
+ Standard_OStream& S,
+ Standard_Boolean C)
+{
+ switch(O) {
+
+ case TopAbs_FORWARD :
+ if (C) S << "+"; else S << "FORWARD";
+ break;
+
+ case TopAbs_REVERSED :
+ if (C) S << "-"; else S << "REVERSED";
+ break;
+
+ case TopAbs_INTERNAL :
+ if (C) S << "i"; else S << "INTERNAL";
+ break;
+
+ case TopAbs_EXTERNAL :
+ if (C) S << "e"; else S << "EXTERNAL";
+ break;
+ }
+}
+
+//=======================================================================
+//function : ReadShapeEnum
+//purpose :
+//=======================================================================
+
+static TopAbs_ShapeEnum ReadShapeEnum(Standard_IStream& IS)
+{
+ char buffer[255];
+ IS >> buffer;
+
+ switch (buffer[0]) {
+
+ case 'V' :
+ return TopAbs_VERTEX;
+
+ case 'E' :
+ return TopAbs_EDGE;
+
+ case 'W' :
+ return TopAbs_WIRE;
+
+ case 'F' :
+ return TopAbs_FACE;
+
+ case 'S' :
+ if (buffer[1] == 'h')
+ return TopAbs_SHELL;
+ else
+ return TopAbs_SOLID;
+
+ case 'C' :
+ if (buffer[1] == 'S')
+ return TopAbs_COMPSOLID;
+ else
+ return TopAbs_COMPOUND;
+
+ }
+ return TopAbs_COMPOUND;
+}
+
+//=======================================================================
+//function : ReadRegularity
+//purpose :
+//=======================================================================
+
+static GeomAbs_Shape ReadRegularity(Standard_IStream& IS)
+{
+ char buffer[255];
+ IS >> buffer;
+ switch (buffer[0]) {
+
+ case 'C' :
+ switch (buffer[1]) {
+
+ case '0' :
+ return GeomAbs_C0;
+
+ case '1' :
+ return GeomAbs_C1;
+
+ case '2' :
+ return GeomAbs_C2;
+
+ case '3' :
+ return GeomAbs_C3;
+
+ case 'N' :
+ return GeomAbs_CN;
+ }
+ break;
+
+ case 'G' :
+ switch (buffer[1]) {
+
+ case '1' :
+ return GeomAbs_G1;
+
+ case '2' :
+ return GeomAbs_G2;
+
+ }
+ break;
+ }
+ return GeomAbs_C0;
+}
+
+//=======================================================================
+//function : OCCShapeAttributeSet
+//purpose :
+//=======================================================================
+
+OCCShapeAttributeSet::OCCShapeAttributeSet()
+ :myFormatNb(1)
+{
+}
+
+//=======================================================================
+//function : OCCShapeAttributeSet
+//purpose :
+//=======================================================================
+
+OCCShapeAttributeSet::OCCShapeAttributeSet (const BRep_Builder& B)
+ :myBuilder(B)
+{
+}
+//=======================================================================
+//function : Add
+//purpose :
+//=======================================================================
+
+Standard_Integer OCCShapeAttributeSet::Add(const TopoDS_Shape& S)
+{
+ if (S.IsNull()) return 0;
+ myLocations.Add(S.Location());
+ TopoDS_Shape S2 = S;
+ S2.Location(TopLoc_Location());
+ Standard_Integer index = myShapes.FindIndex(S2);
+ if (index == 0) {
+ AddGeometry(S2);
+
+ for (TopoDS_Iterator its(S2,Standard_False,Standard_False);
+ its.More(); its.Next())
+ Add(its.Value());
+ index = myShapes.Add(S2);
+ }
+
+ return index;
+}
+
+//=======================================================================
+//function : AddGeometry
+//purpose :
+//=======================================================================
+
+void OCCShapeAttributeSet::AddGeometry(const TopoDS_Shape& S)
+{
+ // Add the geometry
+
+ if (S.ShapeType() == TopAbs_VERTEX) {
+
+ Handle(BRep_TVertex) TV = Handle(BRep_TVertex)::DownCast(S.TShape());
+ BRep_ListIteratorOfListOfPointRepresentation itrp(TV->Points());
+
+ while (itrp.More()) {
+ const Handle(BRep_PointRepresentation)& PR = itrp.Value();
+
+ if (PR->IsPointOnCurve()) {
+ myCurves.Add(PR->Curve());
+ }
+
+ else if (PR->IsPointOnCurveOnSurface()) {
+ myCurves2d.Add(PR->PCurve());
+ mySurfaces.Add(PR->Surface());
+ }
+
+ else if (PR->IsPointOnSurface()) {
+ mySurfaces.Add(PR->Surface());
+ }
+
+ myLocations.Add(PR->Location());
+ itrp.Next();
+ }
+
+ }
+ else if (S.ShapeType() == TopAbs_EDGE) {
+
+ // Add the curve geometry
+ Handle(BRep_TEdge) TE = Handle(BRep_TEdge)::DownCast(S.TShape());
+ BRep_ListIteratorOfListOfCurveRepresentation itrc(TE->Curves());
+
+ while (itrc.More()) {
+ const Handle(BRep_CurveRepresentation)& CR = itrc.Value();
+ if (CR->IsCurve3D()) {
+ if (!CR->Curve3D().IsNull()) {
+ myCurves.Add(CR->Curve3D());
+ myLocations.Add(CR->Location());
+ }
+ }
+ else if (CR->IsCurveOnSurface()) {
+ mySurfaces.Add(CR->Surface());
+ myCurves2d.Add(CR->PCurve());
+ myLocations.Add(CR->Location());
+ if (CR->IsCurveOnClosedSurface())
+ myCurves2d.Add(CR->PCurve2());
+ }
+ else if (CR->IsRegularity()) {
+ mySurfaces.Add(CR->Surface());
+ myLocations.Add(CR->Location());
+ mySurfaces.Add(CR->Surface2());
+ myLocations.Add(CR->Location2());
+ }
+ itrc.Next();
+ }
+ }
+
+ else if (S.ShapeType() == TopAbs_FACE) {
+
+ // Add the surface geometry
+ Handle(BRep_TFace) TF = Handle(BRep_TFace)::DownCast(S.TShape());
+ if (!TF->Surface().IsNull()) mySurfaces.Add(TF->Surface());
+
+ myLocations.Add(TF->Location());
+ }
+}
+
+//=======================================================================
+//function : ReadAttribute
+//purpose :
+//=======================================================================
+
+void OCCShapeAttributeSet::ReadAttribute(TopoDS_Shape& S,
+ Standard_IStream& IS,
+ TDF_Label& l_attr)
+{
+ char buffer[255];
+ DLIList<CubitString*> strings;
+ DLIList<double> doubles;
+ DLIList<int> ints;
+ do {
+ IS >> buffer;
+ int i = 0;
+ while(buffer[i] != '*')
+ i++;
+ strings.clean_out();
+ char type[i];
+
+ i = 0;
+ while(buffer[i] != '*')
+ {
+ type[i] = buffer[i];
+ i++;
+ }
+ CubitString string(type);
+ string = string.substr(0, i );
+ CubitString* string_prt = new CubitString(string);
+ strings.append(string_prt);
+
+ IS >> buffer;
+ //consider there's only one string in the stringdata field
+ i = 0;
+ while(buffer[i] != '*')
+ i++;
+ char* stringdata = NULL;
+ if(i > 0)
+ {
+ stringdata = new char[i];
+ i = 0;
+ while(buffer[i] != '*')
+ {
+ stringdata[i] = buffer[i];
+ i++;
+ }
+ CubitString string2(stringdata);
+ string2 = string2.substr(0, i );
+ CubitString* string_prt2 = new CubitString(string2);
+ strings.append(string_prt2);
+ }
+
+ IS.get(); //' '
+ int ints_[10];
+ double doubles_[10];
+ doubles.clean_out();
+ ints.clean_out();
+ char s;
+ IS.get(s); //either '*' or 'number'
+ i = 0;
+ while (s != '\n')
+ {
+ while(s != '*') // integer attributes
+ {
+ IS.unget();
+ IS >> ints_[i];
+ i++;
+ IS.get(); //' '
+ IS.get(s); //either '*' or 'number'
+ }
+
+ if(i > 0)
+ {
+ for(int j = 0; j < i; j++)
+ ints.append( ints_[j] );
+ }
+ i = 0;
+ IS.get(); //' '
+ IS.get(s); //either '*' or 'number'
+ while(s != '*') // double attributes
+ {
+ IS.unget();
+ IS >> doubles_[i];
+ i++;
+ IS.get(); //' '
+ IS.get(s); //either '*' or 'number'
+ }
+
+ if(i > 0)
+ {
+ for(int j = 0; j < i; j++)
+ doubles.append(doubles_[j]);
+ }
+ IS.get(s); //'\n'
+ }
+
+ CubitSimpleAttrib *tmp_attrib = new CubitSimpleAttrib(&strings, &doubles, &ints);
+
+ for(int i = 0; i < strings.size(); i++)
+ delete strings.get_and_step();
+
+ OCCAttribSet::append_attribute(tmp_attrib, S);
+ delete tmp_attrib;
+
+ IS >> buffer;
+ }while(buffer[0] != '*');
+}
+
+//=======================================================================
+//function : WriteAttribute
+//purpose :
+//=======================================================================
+
+void OCCShapeAttributeSet::WriteAttribute(const TopoDS_Shape& S,
+ Standard_OStream& OS,
+ TDF_Label& l_attr)const
+{
+ if(l_attr.IsNull())
+ return;
+
+ Standard_Boolean found = Standard_False;
+ TDF_Label myLabel;
+ for (TDF_ChildIterator it1(l_attr,Standard_False); it1.More(); it1.Next())
+ {
+ //find the same shape attribute first
+ myLabel = it1.Value();
+
+ Handle_TDataStd_Shape attr_shape;
+ TopoDS_Shape exsiting_shape;
+ if(TDataStd_Shape::Find(myLabel, attr_shape))
+ exsiting_shape = attr_shape->Get(myLabel);
+
+ if(!exsiting_shape.IsNull())
+ {
+ if(exsiting_shape.IsPartner(S))
+ {
+ found = Standard_True;
+ break;
+ }
+ }
+ }
+ if(!found)
+ return;
+
+ if(!myLabel.HasChild())
+ return;
+
+ for (TDF_ChildIterator it2(myLabel,Standard_False); it2.More(); it2.Next())
+ {
+ TDF_Label child = it2.Value();
+ //Write out all attributes
+ Handle_TDataStd_Name attr_name;
+ TCollection_ExtendedString name_string;
+ if(child.FindAttribute(TDataStd_Name::GetID(), attr_name))
+ {
+ OS << "\n";
+ OS << "NEW_SIMPLE_ATTRIB ";
+ name_string = attr_name->Get();
+ name_string.Print(OS);
+ OS << "* " ;
+ }
+ else
+ continue;
+
+ Handle_TDataStd_ExtStringArray attr_strings;
+ if(child.FindAttribute(TDataStd_ExtStringArray::GetID(), attr_strings))
+ {
+ Standard_Integer i = attr_strings->Lower();
+ TCollection_ExtendedString string;
+ int size = attr_strings->Upper();
+ for(; i <= size; i++)
+ {
+ string = attr_strings->Value(i);
+ string.Print(OS);
+ if(i < size )
+ OS << " ";
+ }
+ }
+ OS << "* " ;
+
+ Handle_TDataStd_IntegerArray attr_ints;
+
+ if(child.FindAttribute(TDataStd_IntegerArray::GetID(), attr_ints))
+ {
+ for(Standard_Integer i = attr_ints->Lower(); i <= attr_ints->Upper(); i++)
+ OS << attr_ints->Value(i) << " ";
+ }
+
+ OS << '*' << ' ' ;
+
+ Handle_TDataStd_RealArray attr_doubles;
+ if(child.FindAttribute(TDataStd_RealArray::GetID(), attr_doubles))
+ {
+ Standard_Integer i = attr_doubles->Lower();
+ for(;i <= attr_doubles->Upper(); i++)
+ OS << attr_doubles->Value(i) << " ";
+ }
+ OS << '*' ;
+ }
+ OS << "\n*";
+}
+
+//=======================================================================
+//function : Write
+//purpose :
+//=======================================================================
+
+void OCCShapeAttributeSet::Write(Standard_OStream& OS,
+ TDF_Label l_attr)const
+{
+ //on sauvegarde l'ancien LC_NUMERIC
+
+ char *oldnum,*plocal ;
+ plocal = setlocale(LC_NUMERIC, NULL) ;
+ oldnum = new char[strlen(plocal)+1] ;
+ strcpy(oldnum,plocal);
+
+ // on positionne LC_NUMERIC a "C" (point decimal)
+ setlocale(LC_NUMERIC, "C") ;
+
+ int prec = OS.precision(15);
+
+ // write the copyright
+ if (myFormatNb == 2)
+ OS << "\n" << dVersion2 << endl;
+ else
+ OS << "\n" << dVersion << endl;
+
+ //-----------------------------------------
+ // write the locations
+ //-----------------------------------------
+ myLocations.Write(OS);
+
+ //-----------------------------------------
+ // write the geometry
+ //-----------------------------------------
+
+ WriteGeometry(OS);
+
+ //-----------------------------------------
+ // write the shapes
+ //-----------------------------------------
+ Standard_Integer i, nbShapes = myShapes.Extent();
+
+ OS << "\nTShapes " << nbShapes << "\n";
+
+
+ // subshapes are written first
+ for (i = 1; i <= nbShapes; i++) {
+
+ const TopoDS_Shape& S = myShapes(i);
+
+ // Type
+ PrintShapeEnum(S.ShapeType(),OS,Standard_True);
+ OS << "\n";
+
+ // Geometry
+ WriteGeometry(S,OS);
+
+ // Attributes
+ WriteAttribute(S, OS, l_attr);
+
+ // Flags
+ OS << "\n";
+ OS << (S.Free() ? 1 : 0);
+ OS << (S.Modified() ? 1 : 0);
+ OS << (S.Checked() ? 1 : 0);
+ OS << (S.Orientable() ? 1 : 0);
+ OS << (S.Closed() ? 1 : 0);
+ OS << (S.Infinite() ? 1 : 0);
+ OS << (S.Convex() ? 1 : 0);
+ OS << "\n";
+
+ // sub-shapes
+
+ Standard_Integer l = 0;
+ TopoDS_Iterator its(S,Standard_False,Standard_False);
+ while (its.More()) {
+ Write(its.Value(),OS);
+ l++;
+ if (l == 10) {
+ OS << "\n";
+ l = 0;
+ }
+ its.Next();
+ }
+ Write(TopoDS_Shape(),OS); // Null shape to end the list
+ OS << "\n";
+ }
+
+ OS << endl;
+ OS.precision(prec);
+
+ // on remet le LC_NUMERIC a la precedente valeur
+ setlocale(LC_NUMERIC, oldnum) ;
+ delete[] oldnum;
+}
+
+//=======================================================================
+//function : Read
+//purpose :
+//=======================================================================
+
+void OCCShapeAttributeSet::Read(Standard_IStream& IS,
+ TDF_Label& l_attr)
+{
+ // on sauvegarde l'ancien LC_NUMERIC
+ char *oldnum,*plocal ;
+ plocal = setlocale(LC_NUMERIC, NULL) ;
+ oldnum = new char[strlen(plocal)+1] ;
+ strcpy(oldnum,plocal);
+
+ Clear();
+
+ // Check the version
+ char vers[101];
+ do {
+ IS.getline(vers,100,'\n');
+ // BUC60769 PTV 18.10.2000: remove possible '\r' at the end of the line
+ //Standard_Integer lv = strlen(vers);
+ //char *pm;
+ //if(pm = strchr(vers,'\r'))
+ // *pm ='\0';
+
+ for (Standard_Integer lv = (strlen(vers)- 1); lv > 1 && (vers[lv] == '\r' || vers[lv] == '\n') ;lv--)
+ vers[lv] = '\0';
+
+ } while ( ! IS.fail() && strcmp(vers,dVersion) && strcmp(vers,dVersion2) );
+ if (IS.fail()) {
+ cout << "File was not written with this version of the topology"<<endl;
+ setlocale(LC_NUMERIC, oldnum) ;
+ delete[] oldnum;
+ return;
+ }
+ if (strcmp(vers,dVersion2) == 0) myFormatNb = 2;
+ else myFormatNb = 1;
+
+ //-----------------------------------------
+ // read the locations
+ //-----------------------------------------
+
+ myLocations.Read(IS);
+
+ //-----------------------------------------
+ // read the geometry
+ //-----------------------------------------
+
+ ReadGeometry(IS);
+
+ //-----------------------------------------
+ // read the shapes
+ //-----------------------------------------
+
+ char buffer[255];
+ IS >> buffer;
+ if (strcmp(buffer,"TShapes")) {
+ cout << "Not a TShape table"<<endl;
+ setlocale(LC_NUMERIC, oldnum) ;
+ delete[] oldnum;
+ return;
+ }
+
+ Standard_Integer i, nbShapes;
+ IS >> nbShapes;
+
+ for (i = 1; i <= nbShapes; i++) {
+
+ TopoDS_Shape S;
+
+ //Read type and create empty shape.
+ TopAbs_ShapeEnum T = ReadShapeEnum(IS);
+ ReadGeometry(T,IS,S);
+
+ // Read Attributes and Set the flags
+ IS >> buffer;
+
+ while (buffer[0] == 'N')
+ {
+ ReadAttribute(S, IS,l_attr);
+ IS >> buffer;
+ }
+
+ // sub-shapes
+ TopoDS_Shape SS;
+ do {
+ Read(SS,IS,nbShapes);
+ if (!SS.IsNull())
+ myBuilder.Add(S,SS);
+ } while(!SS.IsNull());
+
+ S.Free (buffer[0] == '1');
+ S.Modified (buffer[1] == '1');
+
+ if (myFormatNb == 2)
+ S.Checked (buffer[2] == '1');
+ else
+ S.Checked (Standard_False); // force check at reading..
+
+ S.Orientable(buffer[3] == '1');
+ S.Closed (buffer[4] == '1');
+ S.Infinite (buffer[5] == '1');
+ S.Convex (buffer[6] == '1');
+
+ // check
+
+ if (myFormatNb == 1)
+ Check(T,S);
+
+ myShapes.Add(S);
+ }
+
+ setlocale(LC_NUMERIC, oldnum) ;
+ delete[] oldnum;
+}
+
+//=======================================================================
+//function : WriteGeometry
+//purpose :
+//=======================================================================
+
+void OCCShapeAttributeSet::WriteGeometry(Standard_OStream& OS) const
+{
+ myCurves2d.Write(OS);
+ myCurves.Write(OS);
+ WritePolygon3D(OS);
+ WritePolygonOnTriangulation(OS);
+ mySurfaces.Write(OS);
+ WriteTriangulation(OS);
+}
+
+//=======================================================================
+//function : ReadGeometry
+//purpose :
+//=======================================================================
+
+void OCCShapeAttributeSet::ReadGeometry(Standard_IStream& IS)
+{
+ myCurves2d.Read(IS);
+ myCurves.Read(IS);
+ ReadPolygon3D(IS);
+ ReadPolygonOnTriangulation(IS);
+ mySurfaces.Read(IS);
+ ReadTriangulation(IS);
+}
+
+//=======================================================================
+//function : WritePolygon3D
+//purpose :
+//=======================================================================
+
+void OCCShapeAttributeSet::WritePolygon3D(Standard_OStream& OS,
+ const Standard_Boolean Compact)const
+{
+ Standard_Integer i, j, nbpol = myPolygons3D.Extent();
+ if (Compact)
+ OS << "Polygon3D " << nbpol << endl;
+ else {
+ OS << " -------\n";
+ OS <<"Dump of " << nbpol << " Polygon3Ds\n";
+ OS << " -------\n";
+ }
+
+ Handle(Poly_Polygon3D) P;
+ for (i = 1; i <= nbpol; i++) {
+ P = Handle(Poly_Polygon3D)::DownCast(myPolygons3D(i));
+ if (Compact) {
+ OS << P->NbNodes() << " ";
+ OS << ((P->HasParameters()) ? "1" : "0") << "\n";
+ }
+ else {
+ OS << " "<< i << " : Polygon3D with " << P->NbNodes() << " Nodes\n";
+ OS << ((P->HasParameters()) ? "with" : "without") << " parameters\n";
+ }
+
+
+ // write the deflection
+ if (!Compact) OS << "Deflection : ";
+ OS << P->Deflection() << "\n";
+
+ // write the nodes
+ if (!Compact) OS << "\nNodes :\n";
+
+ Standard_Integer i1, nbNodes = P->NbNodes();
+ const TColgp_Array1OfPnt& Nodes = P->Nodes();
+ for (j = 1; j <= nbNodes; j++) {
+ if (!Compact) OS << setw(10) << j << " : ";
+ if (!Compact) OS << setw(17);
+ OS << Nodes(j).X() << " ";
+ if (!Compact) OS << setw(17);
+ OS << Nodes(j).Y() << " ";
+ if (!Compact) OS << setw(17);
+ OS << Nodes(j).Z();
+ if (!Compact) OS << "\n";
+ else OS << " ";
+ }
+ OS <<"\n";
+
+ if (P->HasParameters()) {
+ if (!Compact) OS << "\nParameters :\n";
+ const TColStd_Array1OfReal& Param = P->Parameters();
+ for ( i1 = 1; i1 <= nbNodes; i1++ ) {
+ OS << Param(i1) << " ";
+ }
+ OS <<"\n";
+ }
+ }
+}
+
+//=======================================================================
+//function : WritePolygonOnTriangulation
+//purpose :
+//=======================================================================
+
+void OCCShapeAttributeSet::WritePolygonOnTriangulation(
+ Standard_OStream& OS,
+ const Standard_Boolean Compact)const
+{
+ Standard_Integer i, j, nbpOntri = myNodes.Extent();
+ if (Compact)
+ OS << "PolygonOnTriangulations " << nbpOntri << endl;
+ else {
+ OS << " -------\n";
+ OS <<"Dump of " << nbpOntri << " PolygonOnTriangulations\n";
+ OS << " -------\n";
+ }
+
+ Handle(Poly_PolygonOnTriangulation) Poly;
+ Handle(TColStd_HArray1OfReal) Param;
+
+ for (i=1; i<=nbpOntri; i++) {
+ Poly = Handle(Poly_PolygonOnTriangulation)::DownCast(myNodes(i));
+ const TColStd_Array1OfInteger& Nodes = Poly->Nodes();
+ if (!Compact) {
+ OS << " "<< i << " : PolygonOnTriangulation with " << Nodes.Length() << " Nodes\n";
+ }
+ else OS << Nodes.Length()<<" ";
+ if (!Compact) OS <<" ";
+ for (j=1; j <= Nodes.Length(); j++) OS << Nodes.Value(j) << " ";
+ OS << "\n";
+
+ // writing parameters:
+ Param = Poly->Parameters();
+ if (Compact) OS <<"p ";
+
+ // write the deflection
+ if (!Compact) OS << " Deflection : ";
+ OS <<Poly->Deflection() << " ";
+ if (!Compact) OS << "\n";
+
+ if (!Param.IsNull()) {
+ if (!Compact) {
+ OS << " "<< "Parameters :";
+ }
+ else OS << "1 " ;
+ if (!Compact) OS <<" ";
+ for (j=1; j <= Param->Length(); j++) OS << Param->Value(j) << " ";
+ OS << "\n";
+ }
+ else OS <<"0 \n";
+ }
+
+}
+
+//=======================================================================
+//function : WriteTriangulation
+//purpose :
+//=======================================================================
+
+void OCCShapeAttributeSet::WriteTriangulation(Standard_OStream& OS,
+ const Standard_Boolean Compact)const
+{
+ Standard_Integer i, j, nbNodes, nbtri = myTriangulations.Extent();
+ Standard_Integer nbTriangles = 0, n1, n2, n3;
+ if (Compact)
+ OS << "Triangulations " << nbtri << endl;
+ else {
+ OS << " -------\n";
+ OS <<"Dump of " << nbtri << " Triangulations\n";
+ OS << " -------\n";
+ }
+
+ Handle(Poly_Triangulation) T;
+ for (i = 1; i <= nbtri; i++) {
+ T = Handle(Poly_Triangulation)::DownCast(myTriangulations(i));
+ if (Compact) {
+ OS << T->NbNodes() << " " << T->NbTriangles() << " ";
+ OS << ((T->HasUVNodes()) ? "1" : "0") << " ";
+ }
+ else {
+ OS << " "<< i << " : Triangulation with " << T->NbNodes() << " Nodes and "
+ << T->NbTriangles() <<" Triangles\n";
+ OS << " "<<((T->HasUVNodes()) ? "with" : "without") << " UV nodes\n";
+ }
+
+ // write the deflection
+
+ if (!Compact) OS << " Deflection : ";
+ OS <<T->Deflection() << "\n";
+
+ // write the 3d nodes
+
+ if (!Compact) OS << "\n3D Nodes :\n";
+
+ nbNodes = T->NbNodes();
+ const TColgp_Array1OfPnt& Nodes = T->Nodes();
+ for (j = 1; j <= nbNodes; j++) {
+ if (!Compact) OS << setw(10) << j << " : ";
+ if (!Compact) OS << setw(17);
+ OS << Nodes(j).X() << " ";
+ if (!Compact) OS << setw(17);
+ OS << Nodes(j).Y() << " ";
+ if (!Compact) OS << setw(17);
+ OS << Nodes(j).Z();
+ if (!Compact) OS << "\n";
+ else OS << " ";
+ }
+
+ if (T->HasUVNodes()) {
+ if (!Compact) OS << "\nUV Nodes :\n";
+ const TColgp_Array1OfPnt2d& UVNodes = T->UVNodes();
+ for (j = 1; j <= nbNodes; j++) {
+ if (!Compact) OS << setw(10) << j << " : ";
+ if (!Compact) OS << setw(17);
+ OS << UVNodes(j).X() << " ";
+ if (!Compact) OS << setw(17);
+ OS << UVNodes(j).Y();
+ if (!Compact) OS << "\n";
+ else OS << " ";
+ }
+ }
+
+ if (!Compact) OS << "\nTriangles :\n";
+ nbTriangles = T->NbTriangles();
+ const Poly_Array1OfTriangle& Triangles = T->Triangles();
+ for (j = 1; j <= nbTriangles; j++) {
+ if (!Compact) OS << setw(10) << j << " : ";
+ Triangles(j).Get(n1, n2, n3);
+ if (!Compact) OS << setw(10);
+ OS << n1 << " ";
+ if (!Compact) OS << setw(10);
+ OS << n2 << " ";
+ if (!Compact) OS << setw(10);
+ OS << n3;
+ if (!Compact) OS << "\n";
+ else OS << " ";
+ }
+ OS << "\n";
+ }
+
+}
+//=======================================================================
+//function : WriteGeometry
+//purpose :
+//=======================================================================
+
+void OCCShapeAttributeSet::WriteGeometry(const TopoDS_Shape& S,
+ Standard_OStream& OS)const
+{
+ // Write the geometry
+
+ if (S.ShapeType() == TopAbs_VERTEX) {
+
+ // Write the point geometry
+ TopoDS_Vertex V = TopoDS::Vertex(S);
+ OS << BRep_Tool::Tolerance(V) << "\n";
+ gp_Pnt p = BRep_Tool::Pnt(V);
+ OS<<p.X()<<" "<<p.Y()<<" "<<p.Z()<<"\n";
+
+ Handle(BRep_TVertex) TV = Handle(BRep_TVertex)::DownCast(S.TShape());
+ BRep_ListIteratorOfListOfPointRepresentation itrp(TV->Points());
+
+ while (itrp.More()) {
+ const Handle(BRep_PointRepresentation)& PR = itrp.Value();
+
+ OS << PR->Parameter();
+ if (PR->IsPointOnCurve()) {
+ OS << " 1 " << myCurves.Index(PR->Curve());
+ }
+
+ else if (PR->IsPointOnCurveOnSurface()) {
+ OS << " 2 " << myCurves2d.Index(PR->PCurve());
+ OS << " " << mySurfaces.Index(PR->Surface());
+ }
+
+ else if (PR->IsPointOnSurface()) {
+ OS << " 3 " << PR->Parameter2() << " ";
+ OS << mySurfaces.Index(PR->Surface());
+ }
+
+ OS << " " << myLocations.Index(PR->Location());
+ OS << "\n";
+
+ itrp.Next();
+ }
+
+ OS << "0 0\n"; // end representations
+
+ }
+
+ else if (S.ShapeType() == TopAbs_EDGE) {
+
+ // Write the curve geometry
+
+ Handle(BRep_TEdge) TE = Handle(BRep_TEdge)::DownCast(S.TShape());
+
+ OS << " " << TE->Tolerance() << " ";
+ OS << ((TE->SameParameter()) ? 1 : 0) << " ";
+ OS << ((TE->SameRange()) ? 1 : 0) << " ";
+ OS << ((TE->Degenerated()) ? 1 : 0) << "\n";
+
+ Standard_Real first, last;
+ BRep_ListIteratorOfListOfCurveRepresentation itrc = TE->Curves();
+ while (itrc.More()) {
+ const Handle(BRep_CurveRepresentation)& CR = itrc.Value();
+ if (CR->IsCurve3D()) {
+ if (!CR->Curve3D().IsNull()) {
+ Handle(BRep_GCurve) GC = Handle(BRep_GCurve)::DownCast(itrc.Value());
+ GC->Range(first, last);
+ OS << "1 "; // -1- Curve 3D
+ OS << " "<<myCurves.Index(CR->Curve3D());
+ OS << " "<<myLocations.Index(CR->Location());
+ OS << " "<<first<<" "<<last;
+ OS << "\n";
+ }
+ }
+ else if (CR->IsCurveOnSurface()) {
+ Handle(BRep_GCurve) GC = Handle(BRep_GCurve)::DownCast(itrc.Value());
+ GC->Range(first, last);
+ if (!CR->IsCurveOnClosedSurface())
+ OS << "2 "; // -2- Curve on surf
+ else
+ OS << "3 "; // -3- Curve on closed surf
+ OS <<" "<<myCurves2d.Index(CR->PCurve());
+ if (CR->IsCurveOnClosedSurface()) {
+ OS <<" " << myCurves2d.Index(CR->PCurve2());
+ PrintRegularity(CR->Continuity(),OS);
+ }
+ OS << " " << mySurfaces.Index(CR->Surface());
+ OS << " " << myLocations.Index(CR->Location());
+ OS << " "<<first<<" "<<last;
+ OS << "\n";
+
+ // Write UV Points // for XML Persistence higher performance
+ if (myFormatNb == 2)
+ {
+ gp_Pnt2d Pf,Pl;
+ if (CR->IsCurveOnClosedSurface()) {
+ Handle(BRep_CurveOnClosedSurface) COCS =
+ Handle(BRep_CurveOnClosedSurface)::DownCast(CR);
+ COCS->UVPoints2(Pf,Pl);
+ }
+ else {
+ Handle(BRep_CurveOnSurface) COS =
+ Handle(BRep_CurveOnSurface)::DownCast(CR);
+ COS->UVPoints(Pf,Pl);
+ }
+ OS << Pf.X() << " " << Pf.Y() << " " << Pl.X() << " " << Pl.Y() << "\n";
+ }
+ }
+ else if (CR->IsRegularity()) {
+ OS << "4 "; // -4- Regularity
+ PrintRegularity(CR->Continuity(),OS);
+ OS << " "<<mySurfaces.Index(CR->Surface());
+ OS << " "<<myLocations.Index(CR->Location());
+ OS << " "<<mySurfaces.Index(CR->Surface2());
+ OS << " "<<myLocations.Index(CR->Location2());
+ OS << "\n";
+ }
+ itrc.Next();
+ }
+ OS << "0\n"; // end of the list of representations
+ }
+ else if (S.ShapeType() == TopAbs_FACE) {
+
+ Handle(BRep_TFace) TF = Handle(BRep_TFace)::DownCast(S.TShape());
+ const TopoDS_Face& F = TopoDS::Face(S);
+
+ if (!(TF->Surface()).IsNull()) {
+ OS << ((BRep_Tool::NaturalRestriction(F)) ? 1 : 0);
+ OS << " ";
+ // Write the surface geometry
+ OS << " " <<TF->Tolerance();
+ OS << " " <<mySurfaces.Index(TF->Surface());
+ OS << " " <<myLocations.Index(TF->Location());
+ OS << "\n";
+ }
+ }
+
+}
+
+
+//=======================================================================
+//function : Write
+//purpose :
+//=======================================================================
+
+void OCCShapeAttributeSet::Write(const TopoDS_Shape& S,
+ Standard_OStream& OS)const
+{
+ if (S.IsNull()) OS << "*";
+ else {
+ PrintOrientation(S.Orientation(),OS,Standard_True);
+ OS << myShapes.Extent() - myShapes.FindIndex(S.Located(TopLoc_Location())) + 1;
+ OS << " " << myLocations.Index(S.Location()) << " ";
+ }
+}
+
+
+//=======================================================================
+//function : ReadGeometry
+//purpose :
+//=======================================================================
+
+void OCCShapeAttributeSet::ReadGeometry(const TopAbs_ShapeEnum T,
+ Standard_IStream& IS,
+ TopoDS_Shape& S)
+{
+ // Read the geometry
+
+ Standard_Integer val,c,pc,pc2,s,s2,l,l2,t, pt, pt2;
+ Standard_Real tol,X,Y,Z,first,last,p1,p2;
+ Standard_Real PfX,PfY,PlX,PlY;
+ gp_Pnt2d aPf, aPl;
+ Standard_Boolean closed;
+#ifndef DEB
+ GeomAbs_Shape reg = GeomAbs_C0;
+#else
+ GeomAbs_Shape reg;
+#endif
+ switch (T) {
+
+
+ //---------
+ // vertex
+ //---------
+
+ case TopAbs_VERTEX :
+ {
+ TopoDS_Vertex& V = TopoDS::Vertex(S);
+
+ // Read the point geometry
+ IS >> tol;
+ IS >> X >> Y >> Z;
+ myBuilder.MakeVertex(V,gp_Pnt(X,Y,Z),tol);
+ Handle(BRep_TVertex) TV = Handle(BRep_TVertex)::DownCast(V.TShape());
+
+ BRep_ListOfPointRepresentation& lpr = TV->ChangePoints();
+ TopLoc_Location L;
+
+ do {
+ IS >> p1 >> val;
+
+ Handle(BRep_PointRepresentation) PR;
+ switch (val) {
+
+ case 1 :
+ {
+ IS >> c;
+
+ if (myCurves.Curve(c).IsNull())
+ break;
+
+ Handle(BRep_PointOnCurve) POC =
+ new BRep_PointOnCurve(p1,
+ myCurves.Curve(c),
+ L);
+ PR = POC;
+ }
+ break;
+
+ case 2 :
+ {
+ IS >> pc >> s;
+
+ if (myCurves2d.Curve2d(pc).IsNull() ||
+ mySurfaces.Surface(s).IsNull())
+ break;
+
+ Handle(BRep_PointOnCurveOnSurface) POC =
+ new BRep_PointOnCurveOnSurface(p1,
+ myCurves2d.Curve2d(pc),
+ mySurfaces.Surface(s),
+ L);
+ PR = POC;
+ }
+ break;
+
+ case 3 :
+ {
+ IS >> p2 >> s;
+
+ if (mySurfaces.Surface(s).IsNull())
+ break;
+
+ Handle(BRep_PointOnSurface) POC =
+ new BRep_PointOnSurface(p1,p2,
+ mySurfaces.Surface(s),
+ L);
+ PR = POC;
+ }
+ break;
+ }
+
+ if (val > 0) {
+ IS >> l;
+ if (!PR.IsNull()) {
+ PR->Location(myLocations.Location(l));
+ lpr.Append(PR);
+ }
+ }
+ } while (val > 0);
+ }
+ break;
+
+
+ //---------
+ // edge
+ //---------
+
+
+ case TopAbs_EDGE :
+
+ // Create an edge
+ {
+ TopoDS_Edge& E = TopoDS::Edge(S);
+
+ myBuilder.MakeEdge(E);
+
+ // Read the curve geometry
+ IS >> tol;
+ IS >> val;
+ myBuilder.SameParameter(E,(val == 1));
+ IS >> val;
+ myBuilder.SameRange(E,(val == 1));
+ IS >> val;
+ myBuilder.Degenerated(E,(val == 1));
+
+ do {
+ IS >> val;
+ switch (val) {
+
+ case 1 : // -1- Curve 3D
+ IS >> c >> l;
+ if (!myCurves.Curve(c).IsNull()) {
+ myBuilder.UpdateEdge(E,myCurves.Curve(c),
+ myLocations.Location(l),tol);
+ }
+ IS >> first >> last;
+ if (!myCurves.Curve(c).IsNull()) {
+ Standard_Boolean Only3d = Standard_True;
+ myBuilder.Range(E,first,last,Only3d);
+ }
+ break;
+
+
+ case 2 : // -2- Curve on surf
+ case 3 : // -3- Curve on closed surf
+ closed = (val == 3);
+ IS >> pc;
+ if (closed) {
+ IS >> pc2;
+ reg = ReadRegularity(IS);
+ }
+
+ // surface, location
+ IS >> s >> l;
+
+ // range
+ IS >> first >> last;
+
+ // read UV Points // for XML Persistence higher performance
+ if (myFormatNb == 2)
+ {
+ IS >> PfX >> PfY >> PlX >> PlY;
+ aPf = gp_Pnt2d(PfX,PfY);
+ aPl = gp_Pnt2d(PlX,PlY);
+ }
+
+ if (myCurves2d.Curve2d(pc).IsNull() ||
+ (closed && myCurves2d.Curve2d(pc2).IsNull()) ||
+ mySurfaces.Surface(s).IsNull())
+ break;
+
+ if (closed) {
+ if (myFormatNb == 2)
+ myBuilder.UpdateEdge(E,myCurves2d.Curve2d(pc),
+ myCurves2d.Curve2d(pc2),
+ mySurfaces.Surface(s),
+ myLocations.Location(l),tol,
+ aPf, aPl);
+ else
+ myBuilder.UpdateEdge(E,myCurves2d.Curve2d(pc),
+ myCurves2d.Curve2d(pc2),
+ mySurfaces.Surface(s),
+ myLocations.Location(l),tol);
+
+ myBuilder.Continuity(E,
+ mySurfaces.Surface(s),
+ mySurfaces.Surface(s),
+ myLocations.Location(l),
+ myLocations.Location(l),
+ reg);
+ }
+ else
+ {
+ if (myFormatNb == 2)
+ myBuilder.UpdateEdge(E,myCurves2d.Curve2d(pc),
+ mySurfaces.Surface(s),
+ myLocations.Location(l),tol,
+ aPf, aPl);
+ else
+ myBuilder.UpdateEdge(E,myCurves2d.Curve2d(pc),
+ mySurfaces.Surface(s),
+ myLocations.Location(l),tol);
+ }
+ myBuilder.Range(E,
+ mySurfaces.Surface(s),
+ myLocations.Location(l),
+ first,last);
+ break;
+
+ case 4 : // -4- Regularity
+ reg = ReadRegularity(IS);
+ IS >> s >> l >> s2 >> l2;
+ if (mySurfaces.Surface(s).IsNull() ||
+ mySurfaces.Surface(s2).IsNull())
+ break;
+ myBuilder.Continuity(E,
+ mySurfaces.Surface(s),
+ mySurfaces.Surface(s2),
+ myLocations.Location(l),
+ myLocations.Location(l2),
+ reg);
+ break;
+
+ case 5 : // -5- Polygon3D
+ IS >> c >> l;
+ myBuilder.UpdateEdge(E,Handle(Poly_Polygon3D)::DownCast(myPolygons3D(c)), myLocations.Location(l));
+ break;
+
+ case 6 :
+ case 7 :
+ closed = (val == 7);
+ IS >> pt;
+ if (closed) {
+ IS >> pt2;
+ }
+ IS >> t >> l;
+ if (closed) {
+ myBuilder.UpdateEdge
+ (E, Handle(Poly_PolygonOnTriangulation)::DownCast(myNodes(pt)),
+ Handle(Poly_PolygonOnTriangulation)::DownCast(myNodes(pt2)),
+ Handle(Poly_Triangulation)::DownCast(myTriangulations(t)),
+ myLocations.Location(l));
+ }
+ else {
+ myBuilder.UpdateEdge
+ (E,Handle(Poly_PolygonOnTriangulation)::DownCast(myNodes(pt)),
+ Handle(Poly_Triangulation)::DownCast(myTriangulations(t)),
+ myLocations.Location(l));
+ }
+ // range
+
+ break;
+
+ }
+ } while (val > 0);
+ }
+ break;
+
+
+ //---------
+ // wire
+ //---------
+
+ case TopAbs_WIRE :
+ myBuilder.MakeWire(TopoDS::Wire(S));
+ break;
+
+
+ //---------
+ // face
+ //---------
+ case TopAbs_FACE :
+ {
+ // create a face :
+ TopoDS_Face& F = TopoDS::Face(S);
+ myBuilder.MakeFace(F);
+
+ IS >> val; // natural restriction
+ if (val == 0 || val == 1) {
+ IS >> tol >> s >> l;
+ if (!mySurfaces.Surface(s).IsNull()) {
+ myBuilder.UpdateFace(TopoDS::Face(S),
+ mySurfaces.Surface(s),
+ myLocations.Location(l),tol);
+ myBuilder.NaturalRestriction(TopoDS::Face(S),(val == 1));
+ }
+ }
+
+ // BUC60769
+ char string[260];
+ IS.getline ( string, 256, '\n' );
+ IS.getline ( string, 256, '\n' );
+
+ if (string[0] == '2') {
+ // cas triangulation
+ s = atoi ( &string[2] );
+ myBuilder.UpdateFace(TopoDS::Face(S),
+ Handle(Poly_Triangulation)::DownCast(myTriangulations(s)));
+ }
+// else IS.seekg(pos);
+ }
+ break;
+
+
+ //---------
+ // shell
+ //---------
+
+ case TopAbs_SHELL :
+ myBuilder.MakeShell(TopoDS::Shell(S));
+ break;
+
+
+ //---------
+ // solid
+ //---------
+
+ case TopAbs_SOLID :
+ myBuilder.MakeSolid(TopoDS::Solid(S));
+ break;
+
+
+ //---------
+ // compsolid
+ //---------
+
+ case TopAbs_COMPSOLID :
+ myBuilder.MakeCompSolid(TopoDS::CompSolid(S));
+ break;
+
+
+ //---------
+ // compound
+ //---------
+
+ case TopAbs_COMPOUND :
+ myBuilder.MakeCompound(TopoDS::Compound(S));
+ break;
+
+ default:
+ break;
+ }
+
+}
+
+//=======================================================================
+//function : ReadPolygonOnTriangulation
+//purpose :
+//=======================================================================
+
+void OCCShapeAttributeSet::ReadPolygonOnTriangulation(Standard_IStream& IS)
+{
+ char buffer[255];
+ IS >> buffer;
+ if (strstr(buffer,"PolygonOnTriangulations") == NULL) return;
+ Standard_Integer i, j, val, nbpol = 0, nbnodes =0;
+ Standard_Integer hasparameters;
+ Standard_Real par;
+ Handle(TColStd_HArray1OfReal) Param;
+ Handle(Poly_PolygonOnTriangulation) Poly;
+ IS >> nbpol;
+ for (i=1; i<=nbpol; i++) {
+ IS >> nbnodes;
+ TColStd_Array1OfInteger Nodes(1, nbnodes);
+ for (j = 1; j <= nbnodes; j++) {
+ IS >> val;
+ Nodes(j) = val;
+ }
+ IS >> buffer;
+ Standard_Real def;
+ IS >> def;
+ IS >> hasparameters;
+ if (hasparameters) {
+ TColStd_Array1OfReal Param1(1, nbnodes);
+ for (j = 1; j <= nbnodes; j++) {
+ IS >> par;
+ Param1(j) = par;
+ }
+ Poly = new Poly_PolygonOnTriangulation(Nodes, Param1);
+ }
+ else Poly = new Poly_PolygonOnTriangulation(Nodes);
+ Poly->Deflection(def);
+ myNodes.Add(Poly);
+ }
+}
+
+//=======================================================================
+//function : ReadPolygon3D
+//purpose :
+//=======================================================================
+
+void OCCShapeAttributeSet::ReadPolygon3D(Standard_IStream& IS)
+{
+ char buffer[255];
+ // Standard_Integer i, j, p, val, nbpol, nbnodes, hasparameters;
+ Standard_Integer i, j, p, nbpol=0, nbnodes =0, hasparameters = Standard_False; Standard_Real d, x, y, z;
+
+ IS >> buffer;
+ if (strstr(buffer,"Polygon3D") == NULL) return;
+ Handle(Poly_Polygon3D) P;
+ IS >> nbpol;
+ for (i=1; i<=nbpol; i++) {
+ IS >> nbnodes;
+ IS >> hasparameters;
+ TColgp_Array1OfPnt Nodes(1, nbnodes);
+ IS >> d;
+ for (j = 1; j <= nbnodes; j++) {
+ IS >> x >> y >> z;
+ Nodes(j).SetCoord(x,y,z);
+ }
+ if (hasparameters) {
+ TColStd_Array1OfReal Param(1,nbnodes);
+ for (p = 1; p <= nbnodes; p++) {
+ IS >> Param(p);
+ }
+ P = new Poly_Polygon3D(Nodes, Param);
+ }
+ else P = new Poly_Polygon3D(Nodes);
+ P->Deflection(d);
+ myPolygons3D.Add(P);
+ }
+}
+
+//=======================================================================
+//function : ReadTriangulation
+//purpose :
+//=======================================================================
+
+void OCCShapeAttributeSet::ReadTriangulation(Standard_IStream& IS)
+{
+ char buffer[255];
+ // Standard_Integer i, j, val, nbtri;
+ Standard_Integer i, j, nbtri =0;
+ Standard_Real d, x, y, z;
+ Standard_Integer nbNodes =0, nbTriangles=0;
+ Standard_Boolean hasUV= Standard_False;
+
+ Handle(Poly_Triangulation) T;
+
+ IS >> buffer;
+ if (strstr(buffer,"Triangulations") != NULL) {
+ IS >> nbtri;
+ for (i=1; i<=nbtri; i++) {
+ IS >> nbNodes >> nbTriangles >> hasUV;
+ IS >> d;
+
+ TColgp_Array1OfPnt Nodes(1, nbNodes);
+ TColgp_Array1OfPnt2d UVNodes(1, nbNodes);
+
+ for (j = 1; j <= nbNodes; j++) {
+ IS >> x >> y >> z;
+ Nodes(j).SetCoord(x,y,z);
+ }
+
+ if (hasUV) {
+ for (j = 1; j <= nbNodes; j++) {
+ IS >> x >> y;
+ UVNodes(j).SetCoord(x,y);
+ }
+ }
+
+
+ // read the triangles
+ Standard_Integer n1,n2,n3;
+ Poly_Array1OfTriangle Triangles(1, nbTriangles);
+ for (j = 1; j <= nbTriangles; j++) {
+ IS >> n1 >> n2 >> n3;
+ Triangles(j).Set(n1,n2,n3);
+ }
+
+ if (hasUV) T = new Poly_Triangulation(Nodes,UVNodes,Triangles);
+ else T = new Poly_Triangulation(Nodes,Triangles);
+
+ T->Deflection(d);
+
+ myTriangulations.Add(T);
+ }
+ }
+}
+
+//=======================================================================
+//function : Clear
+//purpose :
+//=======================================================================
+
+void OCCShapeAttributeSet::Clear()
+{
+ mySurfaces.Clear();
+ myCurves.Clear();
+ myCurves2d.Clear();
+ myPolygons3D.Clear();
+ myPolygons2D.Clear();
+ myNodes.Clear();
+ myTriangulations.Clear();
+ myShapes.Clear();
+ myLocations.Clear();
+}
+
+//=======================================================================
+//function : Read
+//purpose :
+//=======================================================================
+
+void OCCShapeAttributeSet::Read(TopoDS_Shape& S,
+ Standard_IStream& IS,
+ const int nbshapes)const
+{
+ char buffer[255];
+ IS >> buffer;
+ if (buffer[0] == '*')
+ S = TopoDS_Shape();
+ else {
+ S = myShapes(nbshapes - atoi(buffer+1) + 1);
+ switch (buffer[0]) {
+
+ case '+' :
+ S.Orientation(TopAbs_FORWARD);
+ break;
+
+ case '-' :
+ S.Orientation(TopAbs_REVERSED);
+ break;
+
+ case 'i' :
+ S.Orientation(TopAbs_INTERNAL);
+ break;
+
+ case 'e' :
+ S.Orientation(TopAbs_EXTERNAL);
+ break;
+ }
+
+ Standard_Integer l;
+ IS >> l;
+ S.Location(myLocations.Location(l));
+ }
+}
+
+//=======================================================================
+//function : Check
+//purpose :
+//=======================================================================
+
+void OCCShapeAttributeSet::Check(const TopAbs_ShapeEnum T,
+ TopoDS_Shape& S)
+{
+ if (T == TopAbs_FACE) {
+ const TopoDS_Face& F = TopoDS::Face(S);
+ BRepTools::Update(F);
+ }
+}
+
+//=======================================================================
+//function : NbShapes
+//purpose :
+//=======================================================================
+
+int OCCShapeAttributeSet::NbShapes() const
+{
+ return myShapes.Extent();
+}
+
Added: cgm/trunk/geom/OCC/OCCShapeAttributeSet.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShapeAttributeSet.hpp (rev 0)
+++ cgm/trunk/geom/OCC/OCCShapeAttributeSet.hpp 2008-07-31 18:16:18 UTC (rev 2033)
@@ -0,0 +1,179 @@
+// File: OCCShapeAttributeSet.hxx
+// Created: Thur Jul 10 2008
+// Author: Jane Hu
+
+#ifndef _OCCShapeAttributeSet_HeaderFile
+#define _OCCShapeAttributeSet_HeaderFile
+
+class TopoDS_Shape;
+class TDF_Label;
+
+#ifndef _TopTools_LocationSet_HeaderFile
+#include <TopTools_LocationSet.hxx>
+#endif
+#ifndef _BRep_Builder_HeaderFile
+#include <BRep_Builder.hxx>
+#endif
+#ifndef _TopTools_IndexedMapOfShape_HeaderFile
+#include <TopTools_IndexedMapOfShape.hxx>
+#endif
+#ifndef _GeomTools_SurfaceSet_HeaderFile
+#include <GeomTools_SurfaceSet.hxx>
+#endif
+#ifndef _GeomTools_CurveSet_HeaderFile
+#include <GeomTools_CurveSet.hxx>
+#endif
+#ifndef _GeomTools_Curve2dSet_HeaderFile
+#include <GeomTools_Curve2dSet.hxx>
+#endif
+#ifndef _TColStd_IndexedMapOfTransient_HeaderFile
+#include <TColStd_IndexedMapOfTransient.hxx>
+#endif
+#ifndef _TopAbs_ShapeEnum_HeaderFile
+#include <TopAbs_ShapeEnum.hxx>
+#endif
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+#ifndef _Standard_Macro_HeaderFile
+#include <Standard_Macro.hxx>
+#endif
+
+//! Contains a Shape and all its subshapes, locations <br>
+//! and geometries, and attributes. <br>
+//! <br>
+// It's re-write version of BRepTools_ShapeSet
+class OCCShapeAttributeSet {
+
+public:
+
+ void* operator new(size_t,void* anAddress)
+ {
+ return anAddress;
+ }
+ void* operator new(size_t size)
+ {
+ return Standard::Allocate(size);
+ }
+ void operator delete(void *anAddress)
+ {
+ if (anAddress) Standard::Free((Standard_Address&)anAddress);
+ }
+ // Methods PUBLIC
+ //
+
+//! Builds an empty ShapeAttributeSet. <br>
+OCCShapeAttributeSet();
+
+OCCShapeAttributeSet(const BRep_Builder& B);
+
+//! Stores the goemetry of <S>. <br>
+void AddGeometry(const TopoDS_Shape& S) ;
+
+//! Writes the attributs of <S> on the stream <OS> in a <br>
+//! format that can be read back by Read. <br>
+void WriteAttribute(const TopoDS_Shape& S,
+ Standard_OStream& OS,
+ TDF_Label& l_attr)const;
+
+void ReadAttribute(TopoDS_Shape& S,
+ Standard_IStream& IS,
+ TDF_Label& l_attr);
+
+//! Stores <S> and its sub-shape. Returns the index of <S>. <br>
+//! The method AddGeometry is called on each sub-shape. <br>
+Standard_Integer Add(const TopoDS_Shape& S) ;
+
+void Write(Standard_OStream& OS,
+ TDF_Label l_attr)const;
+
+void Read(Standard_IStream& IS, TDF_Label& l_attr);
+
+void Read(TopoDS_Shape& S,Standard_IStream& IS, const int nbshapes)const;
+
+//! Writes the geometry of me on the stream <OS> in a <br>
+//! format that can be read back by Read. <br>
+void WriteGeometry(Standard_OStream& OS) const;
+
+void ReadGeometry(Standard_IStream& IS);
+
+//! Writes the geometry of <S> on the stream <OS> in a <br>
+//! format that can be read back by Read. <br>
+void WriteGeometry(const TopoDS_Shape& S,Standard_OStream& OS) const;
+
+void ReadGeometry(const TopAbs_ShapeEnum T,
+ Standard_IStream& IS,
+ TopoDS_Shape& S);
+
+//! Writes on <OS> the shape <S>. Writes the <br>
+//! orientation, the index of the TShape and the index <br>
+//! of the Location. <br>
+void Write(const TopoDS_Shape& S,
+ Standard_OStream& OS) const;
+
+//! Writes the 3d polygons <br>
+//! on the stream <OS> in a format that can <br>
+//! be read back by Read. <br>
+Standard_EXPORT void WritePolygon3D(Standard_OStream& OS,const Standard_Boolean Compact = Standard_True) const;
+
+void ReadPolygon3D(Standard_IStream& IS);
+
+//! Writes the polygons on triangulation <br>
+//! on the stream <OS> in a format that can <br>
+//! be read back by Read. <br>
+Standard_EXPORT void WritePolygonOnTriangulation(Standard_OStream& OS,const Standard_Boolean Compact = Standard_True) const;
+
+void ReadPolygonOnTriangulation(Standard_IStream& IS);
+
+//! Writes the triangulation <br>
+//! on the stream <OS> in a format that can <br>
+//! be read back by Read. <br>
+Standard_EXPORT void WriteTriangulation(Standard_OStream& OS,const Standard_Boolean Compact = Standard_True) const;
+
+void ReadTriangulation(Standard_IStream& IS);
+
+void Clear();
+
+void Check(const TopAbs_ShapeEnum T,TopoDS_Shape& S);
+
+int NbShapes() const;
+
+protected:
+ // Methods PROTECTED
+ //
+
+
+ // Fields PROTECTED
+ //
+
+
+private:
+
+ // Methods PRIVATE
+ //
+
+
+ // Fields PRIVATE
+ //
+BRep_Builder myBuilder;
+TopTools_IndexedMapOfShape myShapes;
+TopTools_LocationSet myLocations;
+Standard_Integer myFormatNb;
+GeomTools_SurfaceSet mySurfaces;
+GeomTools_CurveSet myCurves;
+GeomTools_Curve2dSet myCurves2d;
+TColStd_IndexedMapOfTransient myPolygons2D;
+TColStd_IndexedMapOfTransient myPolygons3D;
+TColStd_IndexedMapOfTransient myTriangulations;
+TColStd_IndexedMapOfTransient myNodes;
+};
+
+
+
+
+
+// other Inline functions and methods (like "C++: function call" methods)
+//
+
+
+#endif
Modified: cgm/trunk/geom/OCC/OCCSurface.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.cpp 2008-07-29 21:22:57 UTC (rev 2032)
+++ cgm/trunk/geom/OCC/OCCSurface.cpp 2008-07-31 18:16:18 UTC (rev 2033)
@@ -117,7 +117,7 @@
//
//-------------------------------------------------------------------------
void OCCSurface::append_simple_attribute_virt(CubitSimpleAttrib *csa)
- { attribSet.append_attribute(csa, *myTopoDSFace); }
+ { OCCAttribSet::append_attribute(csa, *myTopoDSFace); }
//-------------------------------------------------------------------------
@@ -129,7 +129,7 @@
//
//-------------------------------------------------------------------------
void OCCSurface::remove_simple_attribute_virt(CubitSimpleAttrib *csa)
- { attribSet.remove_attribute( csa ); }
+ { OCCAttribSet::remove_attribute( csa , *myTopoDSFace); }
//-------------------------------------------------------------------------
@@ -142,7 +142,7 @@
//
//-------------------------------------------------------------------------
void OCCSurface::remove_all_simple_attribute_virt()
- { attribSet.remove_all_attributes(); }
+ { OCCAttribSet::remove_attribute(NULL, *myTopoDSFace); }
//-------------------------------------------------------------------------
@@ -155,21 +155,13 @@
//-------------------------------------------------------------------------
CubitStatus OCCSurface::get_simple_attribute(DLIList<CubitSimpleAttrib*>&
csa_list)
- { return attribSet.get_attributes(csa_list); }
+ { return OCCAttribSet::get_attributes(*myTopoDSFace,csa_list); }
CubitStatus OCCSurface::get_simple_attribute(const CubitString& name,
DLIList<CubitSimpleAttrib*>& csa_list )
- { return attribSet.get_attributes( name, csa_list ); }
+ { return OCCAttribSet::get_attributes( name, *myTopoDSFace, csa_list ); }
-CubitStatus OCCSurface::save_attribs( FILE *file_ptr )
- { return attribSet.save_attributes(file_ptr); }
-
-CubitStatus OCCSurface::restore_attribs( FILE *file_ptr, unsigned int endian )
- { return attribSet.restore_attributes( file_ptr, endian ); }
-
-
-
//-------------------------------------------------------------------------
// Purpose : Get geometry modeling engine: OCCQueryEngine
//
1
0
Author: dcthomp
Date: 2008-07-25 12:54:26 -0500 (Fri, 25 Jul 2008)
New Revision: 2025
Modified:
cgm/trunk/geom/virtual/VirtualQueryEngine.hpp
Log:
COMP: Fix an assert to use variable name instead of address of member function
Modified: cgm/trunk/geom/virtual/VirtualQueryEngine.hpp
===================================================================
--- cgm/trunk/geom/virtual/VirtualQueryEngine.hpp 2008-07-25 04:14:30 UTC (rev 2024)
+++ cgm/trunk/geom/virtual/VirtualQueryEngine.hpp 2008-07-25 17:54:26 UTC (rev 2025)
@@ -467,7 +467,7 @@
if( instance_ == NULL )
{
instance_ = new VirtualQueryEngine;
- assert( instance != NULL );
+ assert( instance_ != NULL );
}
return instance_;
1
0
Author: kraftche
Date: 2008-07-15 09:21:13 -0500 (Tue, 15 Jul 2008)
New Revision: 2012
Modified:
cgm/trunk/Makefile.am
Log:
export more link flags in cgm.make when building against an existing cubit lib
Modified: cgm/trunk/Makefile.am
===================================================================
--- cgm/trunk/Makefile.am 2008-07-15 14:20:32 UTC (rev 2011)
+++ cgm/trunk/Makefile.am 2008-07-15 14:21:13 UTC (rev 2012)
@@ -50,6 +50,8 @@
util/libcubit_util.la
else
CORE_CGM_LIBS = $(CUBIT_LTFLAGS) $(CUBIT_LDFLAGS) $(CUBIT_LIBS)
+ EXT_LINK_FLAGS += $(CUBIT_LDFLAGS)
+ EXT_LIBTOOL_FLAGS += $(CUBIT_LTFLAGS)
endif
1
0
Author: kraftche
Date: 2008-07-15 09:20:32 -0500 (Tue, 15 Jul 2008)
New Revision: 2011
Modified:
cgm/trunk/cgm.make.in
Log:
fix bugs in non-installed cgm.make: need absolute paths rather than relative paths or autoconf vars
Modified: cgm/trunk/cgm.make.in
===================================================================
--- cgm/trunk/cgm.make.in 2008-07-15 02:36:25 UTC (rev 2010)
+++ cgm/trunk/cgm.make.in 2008-07-15 14:20:32 UTC (rev 2011)
@@ -16,8 +16,8 @@
CGM_EXT_LIBS =
CGM_EXT_LDFLAGS =
CGM_EXT_LTFLAGS =
-CGM_INCLUDEDIR = .
-CGM_LIBDIR = $(abs_buildidr)/.libs
+CGM_INCLUDEDIR = @abs_srcdir@
+CGM_LIBDIR = @abs_builddir@/.libs
# Pre-processor flags
CGM_DEFINES = @CANT_USE_STD@ @CANT_USE_STD_IO@ @TEMPLATE_DEFS_INCLUDED@
1
0
Author: kraftche
Date: 2008-07-07 13:08:47 -0500 (Mon, 07 Jul 2008)
New Revision: 1984
Modified:
cgm/trunk/test/Makefile.am
Log:
remove some lines that are no longer necessary
Modified: cgm/trunk/test/Makefile.am
===================================================================
--- cgm/trunk/test/Makefile.am 2008-07-07 16:07:38 UTC (rev 1983)
+++ cgm/trunk/test/Makefile.am 2008-07-07 18:08:47 UTC (rev 1984)
@@ -32,10 +32,6 @@
sheet_SOURCES = sheet.cpp
LDADD = ../libcgm.la
webcut_LDFLAGS = $(LDFLAGS) $(LINK_FLAGS)
-webcut_LDADD = ../geom/ACIS/libcubit_ACIS.la $(LDADD)
makept_LDFLAGS = $(LDFLAGS) $(LINK_FLAGS)
-makept_LDADD = ../geom/OCC/libcubit_OCC.la $(LDADD)
modify_LDFLAGS = $(LDFLAGS) $(LINK_FLAGS)
-modify_LDADD = ../geom/OCC/libcubit_OCC.la $(LDADD)
sheet_LDFLAGS = $(LDFLAGS) $(LINK_FLAGS)
-sheet_LDADD = $(LDADD)
1
0
Author: kraftche
Date: 2008-07-03 16:53:52 -0500 (Thu, 03 Jul 2008)
New Revision: 1982
Removed:
cgm/trunk/itaps/SIDL/iGeom-SIDL-Defs.inc.in
Log:
forgot this one
Deleted: cgm/trunk/itaps/SIDL/iGeom-SIDL-Defs.inc.in
===================================================================
--- cgm/trunk/itaps/SIDL/iGeom-SIDL-Defs.inc.in 2008-07-03 21:51:09 UTC (rev 1981)
+++ cgm/trunk/itaps/SIDL/iGeom-SIDL-Defs.inc.in 2008-07-03 21:53:52 UTC (rev 1982)
@@ -1,18 +0,0 @@
-iGeom_DIR = @abs_srcdir@/..
-
-include ${iGeom_DIR}/iGeom-Defs.inc
-
-iGeom_SIDLINCLUDEDIR = @abs_srcdir@
-iGeom_SIDLLIBDIR = @abs_builddir@
-
-iGeom_SIDL_INCLUDES = \
- -I${iGeom_SIDLINCLUDEDIR} -I${iGeom_SIDLINCLUDEDIR} -I${iGeom_SIDLINCLUDEDIR}/bserver \
- -I${iGeom_SIDLINCLUDEDIR}/gserver -I@BABEL_DIR@/include ${iGeom_INCLUDES}
-
-iGeom_SIDL_LIBS = \
- -L${iGeom_SIDLLIBDIR} -liGeomserver -L@BABEL_DIR@/lib -lsidl \
- -Wl,-rpath,${iGeom_SIDLLIBDIR} -Wl,-rpath,${iGeom_SIDLLIBDIR} -Wl,-rpath,@BABEL_DIR@/lib ${iGeom_LIBS}
-
-iGeom_SIDL_FILES = \
- ${iGeom_SIDLLIBDIR}/libiGeomserver.so
-
1
0
r1981 - in cgm/trunk: . cgm_apps/examples/driverc++ cgm_apps/examples/facetdriver geom geom/ACIS_SRC geom/Cholla geom/OCC geom/facet geom/facetbool geom/parallel geom/virtual init itaps itaps/SIDL test util
by kraftche@mcs.anl.gov 03 Jul '08
by kraftche@mcs.anl.gov 03 Jul '08
03 Jul '08
Author: kraftche
Date: 2008-07-03 16:51:09 -0500 (Thu, 03 Jul 2008)
New Revision: 1981
Removed:
cgm/trunk/itaps/iGeom-Defs.inc.in
Modified:
cgm/trunk/Makefile.am
cgm/trunk/cgm.make.in
cgm/trunk/cgm_apps/examples/driverc++/Makefile.am
cgm/trunk/cgm_apps/examples/facetdriver/Makefile.am
cgm/trunk/configure.in
cgm/trunk/geom/ACIS_SRC/Makefile.am
cgm/trunk/geom/Cholla/Makefile.am
cgm/trunk/geom/Makefile.am
cgm/trunk/geom/OCC/Makefile.am
cgm/trunk/geom/facet/Makefile.am
cgm/trunk/geom/facetbool/Makefile.am
cgm/trunk/geom/parallel/Makefile.am
cgm/trunk/geom/virtual/Makefile.am
cgm/trunk/init/Makefile.am
cgm/trunk/itaps/Makefile.am
cgm/trunk/itaps/SIDL/Makefile.am
cgm/trunk/test/Makefile.am
cgm/trunk/util/Makefile.am
Log:
o Combine all compiled libraries (except SIDL stuff) into a single
libcgm.a, and install only that library.
o Update all tests to reference libcgm.a. This greatly simplifies
build defintions for tests because libcgm automatically pulls
in all conditional dependencies (including libcubiti19.so if
we're not actually building CGM.)
o Greatly simplify makefile stubs by dropping support for using them
before installing CGM.
Modified: cgm/trunk/Makefile.am
===================================================================
--- cgm/trunk/Makefile.am 2008-07-03 19:04:25 UTC (rev 1980)
+++ cgm/trunk/Makefile.am 2008-07-03 21:51:09 UTC (rev 1981)
@@ -1,5 +1,5 @@
AUTOMAKE_OPTIONS = foreign
-SUBDIRS = util geom init itaps test cgm_apps
+SUBDIRS = util geom init itaps . test cgm_apps
# Automake doesn't seem to have a directory defined for
# platform-dependent data (or include) files. So put
@@ -8,14 +8,71 @@
cfgdir = $(libdir)
cfg_DATA = cgm.make
+lib_LTLIBRARIES = libcgm.la
+
+EXT_LINK_FLAGS =
+EXT_LIBTOOL_FLAGS =
+EXT_LIBS =
+EXT_INCLUDE =
+if build_parallel
+ CGM_ll_LIB = geom/parallel/libcubit_parallel.la
+else
+ CGM_ll_LIB =
+endif
+if build_ACIS
+ CGM_ACIS_LIB = $(CGM_ll_LIB) geom/ACIS/libcubit_ACIS.la
+ EXT_LINK_FLAGS += -L$(ACIS_LIB_DIR)
+ EXT_LIBTOOL_FLAGS += -R$(ACIS_LIB_DIR)
+ EXT_LIBS += $(ACIS_LIBS)
+ EXT_INCLUDE += $(ACIS_INCLUDES) $(ACIS_DEFINES)
+else
+ CGM_ACIS_LIB =
+endif
+if WITH_OCC
+ CGM_OCC_LIB = geom/OCC/libcubit_OCC.la
+ EXT_LINK_FLAGS += -L$(OCC_LIB_DIR)
+ EXT_LIBTOOL_FLAGS += -R$(OCC_LIB_DIR)
+ EXT_LIBS += $(OCC_LIBS)
+ EXT_INCLUDE += $(OCC_INC_FLAG)
+else
+ CGM_OCC_LIB =
+endif
+
+if BUILD_CGM
+ CORE_CGM_LIBS = $(CGM_ACIS_LIB) \
+ $(CGM_OCC_LIB) \
+ $(CGM_ll_LIB) \
+ geom/virtual/libcubit_virtual.la \
+ geom/facet/libcubit_facet.la \
+ geom/Cholla/libcholla.la \
+ geom/facetbool/libcubit_facetbool.la \
+ geom/libcubit_geom.la \
+ util/libcubit_util.la
+else
+ CORE_CGM_LIBS = $(CUBIT_LTFLAGS) $(CUBIT_LDFLAGS) $(CUBIT_LIBS)
+endif
+
+
+
+libcgm_la_LIBADD = init/libcgma_init.la \
+ itaps/libiGeom.la \
+ $(CORE_CGM_LIBS) \
+ $(EXT_LINK_FLAGS) \
+ $(EXT_LIBS)
+
+libcgm_la_SOURCES =
+
+
# By default, cmg.make will define these to $(srcdir). We
# want to override that during the INSTALL of the file so
# that the correct values are set (e.g. if someone does
# 'make prefix=/foo install', we don't know the correct install
# directory until we're doing the install.
+CFG_FILE = $(DESTDIR)$(cfgdir)/cgm.make
install-data-hook:
- echo 'CGM_LIBS_LDFLAGS=$$(CGM_LIBS_LDFLAGS_INSTALLED)' >> $(DESTDIR)$(cfgdir)/cgm.make
- echo 'CGMA_INIT_LDFLAGS=$$(CGMA_INIT_LDFLAGS_INSTALLED)' >> $(DESTDIR)$(cfgdir)/cgm.make
- echo 'CGM_INCLUDES=$$(CGM_INC_CPPFLAGS_INSTALLED)' >> $(DESTDIR)$(cfgdir)/cgm.make
- echo "CGM_LIBDIR=${libdir}" >> $(DESTDIR)$(cfgdir)/cgm.make
- echo "CGM_INCLUDEDIR=${includedir}" >> $(DESTDIR)$(cfgdir)/cgm.make
+ echo "CGM_EXT_INCLUDE = $(EXT_INCLUDE)" >> $(CFG_FILE)
+ echo "CGM_EXT_LIBS = $(EXT_LIBS)" >> $(CFG_FILE)
+ echo "CGM_EXT_LDFLAGS = $(EXT_LINK_FLAGS)" >> $(CFG_FILE)
+ echo "CGM_EXT_LTFLAGS = $(EXT_LIBTOOL_FLAGS)" >> $(CFG_FILE)
+ echo "CGM_LIBDIR = $(libdir)" >> $(CFG_FILE)
+ echo "CGM_INCLUDEDIR = $(includedir)" >> $(CFG_FILE)
Modified: cgm/trunk/cgm.make.in
===================================================================
--- cgm/trunk/cgm.make.in 2008-07-03 19:04:25 UTC (rev 1980)
+++ cgm/trunk/cgm.make.in 2008-07-03 21:51:09 UTC (rev 1981)
@@ -11,124 +11,24 @@
#
#==================================================================
-CANT_USE_STD = @CANT_USE_STD@
-CANT_USE_STD_IO = @CANT_USE_STD_IO@
-TEMPLATE_DEFS_INCLUDED = @TEMPLATE_DEFS_INCLUDED@
+# The following variables are overridden when this file is installed
+CGM_EXT_INCLUDE =
+CGM_EXT_LIBS =
+CGM_EXT_LDFLAGS =
+CGM_EXT_LTFLAGS =
+CGM_INCLUDEDIR = .
+CGM_LIBDIR = $(abs_buildidr)/.libs
-ACIS_DEFS = @ACIS_DEFS@
-ACIS_DIR = @ACIS_DIR@
-ACIS_LIB_DIR = @ACIS_LIB_DIR@
-ACIS_LINK_FLAGS = @ACIS_LINK_FLAGS@
-ACIS_VERSION = @ACIS_VERSION@
-ACIS_HEALER = @ACIS_HEALER@
-ACIS_PLATFORM = @ACIS_PLATFORM@
-ACIS_STEP_TRANSLATOR = @ACIS_STEP_TRANSLATOR@
-ACIS_IGES_TRANSLATOR = @ACIS_IGES_TRANSLATOR@
-ACIS_LIBS = @CGM_ACIS_LIBS@ @ACIS_LIBS@
-ACIS_INCLUDES = @ACIS_INCLUDES@
+# Pre-processor flags
+CGM_DEFINES = @CANT_USE_STD@ @CANT_USE_STD_IO@ @TEMPLATE_DEFS_INCLUDED@
+CGM_INCLUDES = $(CGM_EXT_INCLUDE) -I$(CGM_INCLUDEDIR)
+CGM_CPPFLAGS = $(CGM_DEFINES) $(CGM_INCLUDES)
-OCC_INCLUDES = @OCC_INC_FLAG@
-OCC_LIB_DIR = @OCC_LIB_DIR@
-OCC_LIB_FLAG = @OCC_LIB_FLAG@
-OCC_LIBS = @CUBIT_OCC_LIB@ @OCC_LIBS@
+# Link flags
+CGM_LDFLAGS = -L$(CGM_LIBDIR) $(CGM_EXT_LDFLAGS)
+CGM_LTFLAGS = -R$(CGM_LIBDIR) $(CGM_EXT_LTFLAGS)
+CGM_LIBS = -lcgm $(CGM_EXT_LIBS)
+CGM_LIBS_LINK = $(CGM_LDFLAGS) $(CGM_LIBS)
-CGM_PARALLEL_INCLUDE = @CGM_PARALLEL_INCLUDE@
-CGM_PARALLEL_LIB = @CGM_PARALLEL_LIB@
-CGM_PARALLEL_LIB_FILE = @CGM_PARALLEL_LIB_FILE@
-# These get redefined by a makefile target during *install*
-# by appending correct values to the end of the file.
-CGM_LIBDIR = @abs_builddir@
-CGM_INCLUDEDIR = @abs_srcdir@
+# Build-generated values appended after this line
-CGM_CXX = @CXX@
-CGM_CC = @CC@
-CGM_CPPFLAGS = @CUBIT_CGM@ @CANT_USE_STD@ @CANT_USE_STD_IO@ @TEMPLATE_DEFS_INCLUDED@ ${ACIS_DEFS}
-CGM_CXXFLAGS = @CXXFLAGS@
-CGM_CFLAGS = @CFLAGS@
-CGM_LDFLAGS = @LDFLAGS@
-
-CGM_INC_CPPFLAGS_COMMON = ${ACIS_INCLUDES} ${OCC_INCLUDES}
-CGM_INC_CPPFLAGS_UNINSTALLED = \
- -I@abs_srcdir@/util \
- -I@abs_builddir@/util \
- -I@abs_srcdir@/init \
- -I@abs_srcdir@/geom \
- -I@abs_builddir@/geom \
- -I@abs_srcdir@/itaps \
- -I@abs_builddir@/itaps \
- -I@abs_srcdir@/geom/ACIS \
- -I@abs_srcdir@/geom/OCC \
- $(CGM_PARALLEL_INCLUDE) \
- $(CGM_INC_CPPFLAGS_COMMON)
-CGM_INC_CPPFLAGS_INSTALLED = \
- -I$(CGM_INCLUDEDIR) \
- $(CGM_INC_CPPFLAGS_COMMON)
-
-# will be overriden upon install
-CGM_INCLUDES = $(CGM_INC_CPPFLAGS_UNINSTALLED)
-
-CGM_LIBS_LDFLAGS_COMMON = $(ACIS_LINK_FLAGS) $(OCC_LIB_FLAG)
-
-CGM_LIBS_LDFLAGS_UNINSTALLED = \
- -L@abs_builddir@/geom/virtual/.libs \
- -L@abs_builddir@/geom/facetbool/.libs \
- -L@abs_builddir@/geom/facet/.libs \
- -L@abs_builddir@/geom/Cholla/.libs \
- -L@abs_builddir@/geom/ACIS/.libs \
- -L@abs_builddir@/geom/OCC/.libs \
- -L@abs_builddir@/geom/.libs \
- -L@abs_builddir@/util/.libs \
- -L@abs_builddir@/geom/virtual \
- -L@abs_builddir@/geom/facetbool \
- -L@abs_builddir@/geom/facet \
- -L@abs_builddir@/geom/Cholla \
- -L@abs_builddir@/geom/ACIS \
- -L@abs_builddir@/geom \
- -L@abs_builddir@/util \
- $(CGM_LIBS_LDFLAGS_COMMON)
-
-CGM_LIBS_LDFLAGS_INSTALLED = -L$(CGM_LIBDIR) $(CGM_LIBS_LDFLAGS_COMMON)
-
-CGM_LIBS_LIBRARIES = \
- ${ACIS_LIBS} \
- -lcubit_virtual \
- -lcubit_facet \
- -lcubit_facetbool \
- -lcholla \
- ${ACIS_LIBS} \
- -lcubit_geom \
- -lcubit_util \
- ${CGM_PARALLEL_LIB} \
- ${OCC_LIBS}
-
-# Will be overridden upon install
-CGM_LIBS_LDFLAGS = $(CGM_LIBS_LDFLAGS_UNINSTALLED)
-
-CGM_LIBS_LINK_INTERNAL = $(LDFLAGS) $(CGM_LIBS_LDFLAGS) $(CGM_LIBS_LIBRARIES)
-
-CGMA_INIT_LDFLAGS_UNINSTALLED = -L@abs_builddir@/init -L@abs_builddir@/init/.libs
-CGMA_INIT_LDFLAGS_INSTALLED = -L$(CGM_LIBDIR)
-
-# Will be overridden upon install
-CGMA_INIT_LDFLAGS = $(CGMA_INIT_LDFLAGS_UNINSTALLED)
-
-CGM_LIBS_FILES_INTERNAL = \
- $(CGM_LIBDIR)/libcgma_init.la \
- $(CGM_LIBDIR)/libcubit_virtual.la \
- $(CGM_LIBDIR)/libcubit_facetbool.la \
- $(CGM_LIBDIR)/libcubit_facet.la \
- $(CGM_LIBDIR)/libcholla.la \
- $(CGM_LIBDIR)/libcubit_geom.la \
- $(CGM_LIBDIR)/libcubit_util.la \
- ${CGM_PARALLEL_LIB_FILE}
-
-CUBIT_LTFLAGS = @CUBIT_LTFLAGS@
-CUBIT_LDFLAGS = @CUBIT_LDFLAGS@
-CUBIT_LIBS = @CUBIT_LIBS@
-CUBIT_FILE = @CUBIT_FILE@
-
-# CGM_LIBS_LINK is set by configure script to be either
-# "$(CUBIT_LDFLAGS) $(CUBIT_LIBS)" or "$(CGM_LIBS_LINK_INTERNAL)"
-CGM_LIBS_LINK = $(CGMA_INIT_LDFLAGS) -lcgma_init @CGM_LIBS_LINK@
-CGM_LIBS_FILES = @CGM_LIBS_FILES@
-CGM_LIBS_LTFLAGS = @CGM_LIBS_LTFLAGS@
Modified: cgm/trunk/cgm_apps/examples/driverc++/Makefile.am
===================================================================
--- cgm/trunk/cgm_apps/examples/driverc++/Makefile.am 2008-07-03 19:04:25 UTC (rev 1980)
+++ cgm/trunk/cgm_apps/examples/driverc++/Makefile.am 2008-07-03 21:51:09 UTC (rev 1981)
@@ -11,6 +11,5 @@
mergechk_SOURCES = mergechk.cpp
-LDADD = ../../../geom/libcubit_geom.la \
- ../../../geom/ACIS/libcubit_ACIS.la
+LDADD = ../../../libcgm.la
Modified: cgm/trunk/cgm_apps/examples/facetdriver/Makefile.am
===================================================================
--- cgm/trunk/cgm_apps/examples/facetdriver/Makefile.am 2008-07-03 19:04:25 UTC (rev 1980)
+++ cgm/trunk/cgm_apps/examples/facetdriver/Makefile.am 2008-07-03 21:51:09 UTC (rev 1981)
@@ -10,5 +10,4 @@
-I$(top_srcdir)/geom/Cholla \
-I$(top_srcdir)/geom/facet
-LDADD = ../../../geom/libcubit_geom.la \
- ../../../geom/facet/libcubit_facet.la
+LDADD = ../../../libcgm.la
Modified: cgm/trunk/configure.in
===================================================================
--- cgm/trunk/configure.in 2008-07-03 19:04:25 UTC (rev 1980)
+++ cgm/trunk/configure.in 2008-07-03 21:51:09 UTC (rev 1981)
@@ -337,9 +337,7 @@
init/Makefile
cgm.make
itaps/Makefile
- itaps/iGeom-Defs.inc
itaps/SIDL/Makefile
- itaps/SIDL/iGeom-SIDL-Defs.inc
test/Makefile
cgm_apps/Makefile
cgm_apps/examples/Makefile
Modified: cgm/trunk/geom/ACIS_SRC/Makefile.am
===================================================================
--- cgm/trunk/geom/ACIS_SRC/Makefile.am 2008-07-03 19:04:25 UTC (rev 1980)
+++ cgm/trunk/geom/ACIS_SRC/Makefile.am 2008-07-03 21:51:09 UTC (rev 1981)
@@ -12,7 +12,7 @@
-I$(ACIS_DIR)/include
# The name of the library to build
-lib_LTLIBRARIES = libcubit_ACIS.la
+noinst_LTLIBRARIES = libcubit_ACIS.la
# The directory where headers will be installed
libcubit_ACIS_la_includedir = $(includedir)
@@ -80,6 +80,5 @@
gtcAttrib/incl/attrib_name.h \
gtcAttrib/incl/gtcAttrib_exConst.h
-libcubit_ACIS_la_LIBADD = -L$(ACIS_LIB_DIR) $(ACIS_LIBS) \
- ../libcubit_geom.la
+libcubit_ACIS_la_LIBADD = -L$(ACIS_LIB_DIR) $(ACIS_LIBS)
Modified: cgm/trunk/geom/Cholla/Makefile.am
===================================================================
--- cgm/trunk/geom/Cholla/Makefile.am 2008-07-03 19:04:25 UTC (rev 1980)
+++ cgm/trunk/geom/Cholla/Makefile.am 2008-07-03 21:51:09 UTC (rev 1981)
@@ -6,13 +6,11 @@
INCLUDES = -I$(top_srcdir)/util -I$(top_srcdir)/geom
# The name of the library to build
-lib_LTLIBRARIES =
+noinst_LTLIBRARIES =
if BUILD_CGM
- lib_LTLIBRARIES += libcholla.la
+ noinst_LTLIBRARIES += libcholla.la
endif
-libcholla_la_LIBADD = ../libcubit_geom.la
-
# The directory where headers will be installed
libcholla_la_includedir = $(includedir)
Modified: cgm/trunk/geom/Makefile.am
===================================================================
--- cgm/trunk/geom/Makefile.am 2008-07-03 19:04:25 UTC (rev 1980)
+++ cgm/trunk/geom/Makefile.am 2008-07-03 21:51:09 UTC (rev 1981)
@@ -20,13 +20,11 @@
INCLUDES = -I$(top_srcdir)/util -I.
# The name of the library to build
-lib_LTLIBRARIES =
+noinst_LTLIBRARIES =
if BUILD_CGM
- lib_LTLIBRARIES += libcubit_geom.la
+ noinst_LTLIBRARIES += libcubit_geom.la
endif
-libcubit_geom_la_LIBADD = ../util/libcubit_util.la
-
# The directory where headers will be installed
libcubit_geom_la_includedir = $(includedir)
Modified: cgm/trunk/geom/OCC/Makefile.am
===================================================================
--- cgm/trunk/geom/OCC/Makefile.am 2008-07-03 19:04:25 UTC (rev 1980)
+++ cgm/trunk/geom/OCC/Makefile.am 2008-07-03 21:51:09 UTC (rev 1981)
@@ -11,19 +11,10 @@
$(OCC_INC_FLAG)
# The name of the library to build
-OCC_TARGET=
-if WITH_OCC
- OCC_TARGET += libcubit_OCC.la
-endif
+noinst_LTLIBRARIES = libcubit_OCC.la
-lib_LTLIBRARIES =
-if BUILD_CGM
- lib_LTLIBRARIES += $(OCC_TARGET)
-endif
+libcubit_OCC_la_LIBADD = -L$(OCC_LIB_DIR) $(OCC_LIBS)
-libcubit_OCC_la_LIBADD = $(OCC_LIB_FLAG) $(OCC_LIBS) \
- ../libcubit_geom.la
-
# The directory where headers will be installed
libcubit_OCC_la_includedir = $(includedir)
Modified: cgm/trunk/geom/facet/Makefile.am
===================================================================
--- cgm/trunk/geom/facet/Makefile.am 2008-07-03 19:04:25 UTC (rev 1980)
+++ cgm/trunk/geom/facet/Makefile.am 2008-07-03 21:51:09 UTC (rev 1981)
@@ -9,15 +9,11 @@
-I$(top_srcdir)/geom/facetbool
# The name of the library to build
-lib_LTLIBRARIES =
+noinst_LTLIBRARIES =
if BUILD_CGM
- lib_LTLIBRARIES += libcubit_facet.la
+ noinst_LTLIBRARIES += libcubit_facet.la
endif
-libcubit_facet_la_LIBADD = ../libcubit_geom.la \
- ../facetbool/libcubit_facetbool.la \
- ../Cholla/libcholla.la
-
# The directory where headers will be installed
libcubit_facet_la_includedir = $(includedir)
Modified: cgm/trunk/geom/facetbool/Makefile.am
===================================================================
--- cgm/trunk/geom/facetbool/Makefile.am 2008-07-03 19:04:25 UTC (rev 1980)
+++ cgm/trunk/geom/facetbool/Makefile.am 2008-07-03 21:51:09 UTC (rev 1981)
@@ -7,13 +7,11 @@
-I$(top_srcdir)/geom
# The name of the library to build
-lib_LTLIBRARIES =
+noinst_LTLIBRARIES =
if BUILD_CGM
- lib_LTLIBRARIES += libcubit_facetbool.la
+ noinst_LTLIBRARIES += libcubit_facetbool.la
endif
-libcubit_facetbool_la_LIBADD= ../libcubit_geom.la
-
# The directory where headers will be installed
libcubit_facetbool_la_includedir = $(includedir)
Modified: cgm/trunk/geom/parallel/Makefile.am
===================================================================
--- cgm/trunk/geom/parallel/Makefile.am 2008-07-03 19:04:25 UTC (rev 1980)
+++ cgm/trunk/geom/parallel/Makefile.am 2008-07-03 21:51:09 UTC (rev 1981)
@@ -15,13 +15,11 @@
$(MPI_INCLUDE)
# The name of the library to build
-lib_LTLIBRARIES =
+noinst_LTLIBRARIES =
if BUILD_CGM
- lib_LTLIBRARIES += libcubit_parallel.la
+ noinst_LTLIBRARIES += libcubit_parallel.la
endif
-libcubit_parallel_la_LIBADD = ../libcubit_geom.la ../ACIS/libcubit_ACIS.la
-
# The directory where headers will be installed
libcubit_parallel_la_includedir = $(includedir)
Modified: cgm/trunk/geom/virtual/Makefile.am
===================================================================
--- cgm/trunk/geom/virtual/Makefile.am 2008-07-03 19:04:25 UTC (rev 1980)
+++ cgm/trunk/geom/virtual/Makefile.am 2008-07-03 21:51:09 UTC (rev 1981)
@@ -9,13 +9,11 @@
-I$(top_srcdir)/geom/Cholla
# The name of the library to build
-lib_LTLIBRARIES =
+noinst_LTLIBRARIES =
if BUILD_CGM
- lib_LTLIBRARIES += libcubit_virtual.la
+ noinst_LTLIBRARIES += libcubit_virtual.la
endif
-libcubit_virtual_la_LIBADD = ../libcubit_geom.la
-
# The directory where headers will be installed
libcubit_virtual_la_includedir = $(includedir)
Modified: cgm/trunk/init/Makefile.am
===================================================================
--- cgm/trunk/init/Makefile.am 2008-07-03 19:04:25 UTC (rev 1980)
+++ cgm/trunk/init/Makefile.am 2008-07-03 21:51:09 UTC (rev 1981)
@@ -12,7 +12,7 @@
-I$(top_srcdir)/geom/cholla \
-I$(srcdir)
-lib_LTLIBRARIES = libcgma_init.la
+noinst_LTLIBRARIES = libcgma_init.la
libcgma_init_la_includedir = $(includedir)
libcgma_init_la_SOURCES = InitCGMA.cpp
libcgma_init_la_include_HEADERS = InitCGMA.hpp
Modified: cgm/trunk/itaps/Makefile.am
===================================================================
--- cgm/trunk/itaps/Makefile.am 2008-07-03 19:04:25 UTC (rev 1980)
+++ cgm/trunk/itaps/Makefile.am 2008-07-03 21:51:09 UTC (rev 1981)
@@ -10,42 +10,22 @@
SUBDIRS = . $(SIDL_DIR)
-lib_LTLIBRARIES = libiGeom.la
+noinst_LTLIBRARIES = libiGeom.la
if build_ACIS
- TEST_ACISLIBS = $(top_builddir)/geom/ACIS/libcubit_ACIS.la
TEST_ACISPATH = -R$(ACIS_LIB_DIR)
else
- TEST_ACISLIBS =
TEST_ACISPATH =
endif
-if BUILD_CGM
- TEST_XLIBS = $(TEST_ACISLIBS) \
- $(top_builddir)/geom/facet/libcubit_facet.la \
- $(top_builddir)/geom/facetbool/libcubit_facetbool.la \
- $(top_builddir)/geom/Cholla/libcholla.la \
- $(top_builddir)/geom/virtual/libcubit_virtual.la \
- $(top_builddir)/geom/libcubit_geom.la \
- $(top_builddir)/util/libcubit_util.la
-else
- TEST_XLDFLAGS = $(CUBIT_LDFLAGS) $(CUBIT_LTFLAGS)
- TEST_XLIBS = $(CUBIT_LIBS)
-endif
-
-if build_ACIS
- ACIS_CGM_INCLUDES = -I$(top_srcdir)/geom/ACIS
-else
- ACIS_CGM_INCLUDES =
-endif
-
libiGeom_la_includedir = $(includedir)
-libiGeom_la_libadd = $(top_builddir)/init/libcgma_init.la $(TEST_XLIBS)
+libiGeom_la_libadd = $(top_builddir)/libcgm.la
INCLUDES = -I$(top_srcdir)/util \
-I$(top_srcdir)/geom \
-I$(top_srcdir)/init \
+ -I$(top_srcdir)/geom/ACIS \
-I.
libiGeom_la_SOURCES = \
@@ -67,7 +47,7 @@
check_PROGRAMS = $(TESTS)
testgeom_SOURCES = testgeom.cc
-testgeom_LDADD = $(TEST_XLDFLAGS) libiGeom.la ../init/libcgma_init.la $(TEST_XLIBS)
+testgeom_LDADD = ../libcgm.la
testgeom_CPPFLAGS = $(CPPFLAGS) -DSRCDIR=$(srcdir)
testgeom_LDFLAGS = $(TEST_ACISPATH)
@@ -83,11 +63,12 @@
# that the correct values are set (e.g. if someone does
# 'make prefix=/foo install', we don't know the correct install
# directory until we're doing the install.
-install-data-hook:
- echo "iGeom_SRCDIR=${includedir}" >> $(DESTDIR)$(cfgdir)/iGeom-Defs.inc
- echo "iGeom_BLDDIR=${includedir}" >> $(DESTDIR)$(cfgdir)/iGeom-Defs.inc
- echo "iGeom_DIR=${cfgdir}" >> $(DESTDIR)$(cfgdir)/iGeom-Defs.inc
- echo "iGeom_LIBDIR=${libdir}" >> $(DESTDIR)$(cfgdir)/iGeom-Defs.inc
- echo "CGM_LDFLAGS=-L${libdir}" >> $(DESTDIR)$(cfgdir)/iGeom-Defs.inc
- echo "CGM_INCLUDEDIR=${includedir}" >> $(DESTDIR)$(cfgdir)/iGeom-Defs.inc
+iGeom-Defs.inc: Makefile.am
+ @echo "include $(cfgdir)/cgm.make" > $@
+ @echo 'iGeom_LDFLAGS = $$(CGM_LDFLAGS)' >> $@
+ @echo 'iGeom_LTFLAGS = $$(CGM_LTFLAGS)' >> $@
+ @echo 'iGeom_LIBS = $$(CGM_LIBS)' >> $@
+ @echo 'iGeom_DEFINES = $$(CGM_DEFINES)' >> $@
+ @echo 'iGeom_INCLUDES = $$(CGM_INCLUDES)' >> $@
+ @echo 'iGeom_CPPFLAGS = $$(CGM_CPPFLAGS)' >> $@
Modified: cgm/trunk/itaps/SIDL/Makefile.am
===================================================================
--- cgm/trunk/itaps/SIDL/Makefile.am 2008-07-03 19:04:25 UTC (rev 1980)
+++ cgm/trunk/itaps/SIDL/Makefile.am 2008-07-03 21:51:09 UTC (rev 1981)
@@ -143,10 +143,11 @@
# that the correct values are set (e.g. if someone does
# 'make prefix=/foo install', we don't know the correct install
# directory until we're doing the install.
-install-data-hook:
- echo "iGeom_DIR=${cfgdir}" >> $(DESTDIR)$(cfgdir)/iGeom-SIDL-Defs.inc
- echo "iGeom_SIDLLIBDIR=${libdir}" >> $(DESTDIR)$(cfgdir)/iGeom-SIDL-Defs.inc
- echo "iGeom_SIDLINCLUDEDIR=${includedir}/SIDL" >> $(DESTDIR)$(cfgdir)/iGeom-SIDL-Defs.inc
- (cd gserver; install -d ${includedir}/SIDL; install -t ${includedir}/SIDL ${SERVER_HDRS})
-
-#include make.dependencies
+iGeom-SIDL-Defs.inc:
+ @echo "include $(cfgdir)/iGeom-SIDL-Defs.inc" > $@
+ @echo 'iGeom_SIDL_INCLUDES = $$(iGeom_INCLUDES) -I$(BABEL_DIR)/include' >> $@
+ @echo 'iGeom_SIDL_CPPFLAGS = $$(iGeom_CPPFLAGS) -I$(BABEL_DIR)/include' >> $@
+ @echo 'iGeom_SIDL_DEFINES = $$(iGeom_DEFINES)' >> $@
+ @echo 'iGeom_SIDL_LDFLAGS = $$(iGeom_LDFLAGS) -L$(BABEL_DIR)/lib' >> $@
+ @echo 'iGeom_SIDL_LTFLAGS = $$(iGeom_LDFLAGS) -R$(BABEL_DIR)/lib' >> $@
+ @echo 'iGeom_SIDL_LIBS = $$(iGeom_LIBS) -lsidl -liGeomserver' >> $@
Deleted: cgm/trunk/itaps/iGeom-Defs.inc.in
===================================================================
--- cgm/trunk/itaps/iGeom-Defs.inc.in 2008-07-03 19:04:25 UTC (rev 1980)
+++ cgm/trunk/itaps/iGeom-Defs.inc.in 2008-07-03 21:51:09 UTC (rev 1981)
@@ -1,48 +0,0 @@
-ACIS_LIB_DIR = @ACIS_LIB_DIR@
-ACIS_LIBS = @CGM_ACIS_LIBS@ @ACIS_LIBS@
-ACIS_LINK_FLAGS = @ACIS_LINK_FLAGS@
-
-CGM_PARALLEL_LIB = @CGM_PARALLEL_LIB@
-
-CGM_LIBS_LINK_INTERNAL = \
- $(CGM_LDFLAGS) \
- ${ACIS_LINK_FLAGS} \
- ${ACIS_LIBS} -lcubit_virtual -lcubit_facet -lcubit_facetbool -lcholla ${ACIS_LIBS} -lcubit_geom -lcubit_util \
- ${CGM_PARALLEL_LIB}
-
-CUBIT_LTFLAGS = @CUBIT_LTFLAGS@
-CUBIT_LDFLAGS = @CUBIT_LDFLAGS@
-CUBIT_LIBS = @CUBIT_LIBS@
-CUBIT_LINK = $(CUBIT_LDFLAGS) $(CUBIT_LIBS)
-CUBIT_FILE = @CUBIT_FILE@
-
-CGM_LIBS_LINK = @CGM_LIBS_LINK@
-CGM_LIBS_FILES = @CGM_LIBS_FILES@
-CGM_LIBS_LTFLAGS = @CGM_LIBS_LTFLAGS@
-
-iGeom_INCLUDES = -I$(iGeom_SRCDIR) -I$(iGeom_BLDDIR)
-
-iGeom_LIBS = $(iGeom_LDFLAGS) \
- -L${iGeom_LIBDIR} -liGeom \
- $(CGM_LIBS_LINK)
-
-# These get redefined by a makefile target during *install*
-# by appending correct values to the end of the file.
-iGeom_SRCDIR = @abs_srcdir@
-iGeom_BLDDIR = @abs_builddir@
-iGeom_DIR = @abs_builddir@
-iGeom_LIBDIR = @abs_builddir@/.libs
-CGM_LDFLAGS = -L$(abs_topbuilddir)/geom/virtual/.libs \
- -L$(abs_topbuilddir)/geom/virtual \
- -L$(abs_topbuilddir)/geom/facetbool/.libs \
- -L$(abs_topbuilddir)/geom/facetbool \
- -L$(abs_topbuilddir)/geom/facet/.libs \
- -L$(abs_topbuilddir)/geom/facet \
- -L$(abs_topbuilddir)/geom/Cholla/.libs \
- -L$(abs_topbuilddir)/geom/Cholla \
- -L$(abs_topbuilddir)/geom/ACIS/.libs \
- -L$(abs_topbuilddir)/geom/ACIS \
- -L$(abs_topbuilddir)/geom/.libs \
- -L$(abs_topbuilddir)/geom \
- -L$(abs_topbuilddir)/util/.libs \
- -L$(abs_topbuilddir)/util \
Modified: cgm/trunk/test/Makefile.am
===================================================================
--- cgm/trunk/test/Makefile.am 2008-07-03 19:04:25 UTC (rev 1980)
+++ cgm/trunk/test/Makefile.am 2008-07-03 21:51:09 UTC (rev 1981)
@@ -11,17 +11,14 @@
-I$(srcdir) \
$(OCC_INC_FLAG)
-ENGINE_LIBS =
LINK_FLAGS =
TESTS = sheet
if build_ACIS
TESTS += webcut
- ENGINE_LIBS += ../geom/ACIS/libcubit_ACIS.la
LINK_FLAGS += -R$(ACIS_LIB_DIR)
endif
if WITH_OCC
TESTS += modify makept
- ENGINE_LIBS += ../geom/OCC/libcubit_OCC.la
LINK_FLAGS += -R$(OCC_LIB_DIR)
endif
@@ -33,17 +30,12 @@
makept_SOURCES = makept.cpp
modify_SOURCES = modify.cpp
sheet_SOURCES = sheet.cpp
-LDADD = ../geom/virtual/libcubit_virtual.la \
- ../geom/facetbool/libcubit_facetbool.la \
- ../geom/Cholla/libcholla.la \
- ../geom/facet/libcubit_facet.la \
- ../geom/libcubit_geom.la \
- ../util/libcubit_util.la
-webcut_LDFLAGS = $(LDFLAGS) -R$(ACIS_LIB_DIR)
+LDADD = ../libcgm.la
+webcut_LDFLAGS = $(LDFLAGS) $(LINK_FLAGS)
webcut_LDADD = ../geom/ACIS/libcubit_ACIS.la $(LDADD)
-makept_LDFLAGS = $(LDFLAGS) -R$(OCC_LIB_DIR)
+makept_LDFLAGS = $(LDFLAGS) $(LINK_FLAGS)
makept_LDADD = ../geom/OCC/libcubit_OCC.la $(LDADD)
-modify_LDFLAGS = $(LDFLAGS) -R$(OCC_LIB_DIR)
+modify_LDFLAGS = $(LDFLAGS) $(LINK_FLAGS)
modify_LDADD = ../geom/OCC/libcubit_OCC.la $(LDADD)
sheet_LDFLAGS = $(LDFLAGS) $(LINK_FLAGS)
-sheet_LDADD = $(ENGINE_LIBS) $(LDADD)
+sheet_LDADD = $(LDADD)
Modified: cgm/trunk/util/Makefile.am
===================================================================
--- cgm/trunk/util/Makefile.am 2008-07-03 19:04:25 UTC (rev 1980)
+++ cgm/trunk/util/Makefile.am 2008-07-03 21:51:09 UTC (rev 1981)
@@ -5,9 +5,9 @@
DEFS = $(TEMPLATE_DEFS_INCLUDED) $(LITTLE_ENDIAN)
# The name of the library to build
-lib_LTLIBRARIES =
+noinst_LTLIBRARIES =
if BUILD_CGM
- lib_LTLIBRARIES += libcubit_util.la
+ noinst_LTLIBRARIES += libcubit_util.la
endif
# The directory where headers will be installed
1
0
Author: janehu
Date: 2008-07-03 14:04:25 -0500 (Thu, 03 Jul 2008)
New Revision: 1980
Modified:
cgm/trunk/geom/OCC/OCCAttrib.cpp
cgm/trunk/geom/OCC/OCCAttrib.hpp
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/OCCLump.cpp
cgm/trunk/geom/OCC/OCCPoint.cpp
cgm/trunk/geom/OCC/OCCQueryEngine.cpp
cgm/trunk/geom/OCC/OCCQueryEngine.hpp
cgm/trunk/geom/OCC/OCCSurface.cpp
Log:
Added simple attribute append and remove method on CGM side. It's stored in a document system with Labels and Attributes. Labels has a tree structure with one root label and multiple children labels of 3 layers deep. First layer storesshape attribute, any 0d-3d geometry could have attribute, if it has, its shape is stored in the first layer; second layer stores type attribute which is CubitSimpleAttrib's charactertype, each shape level label can have multiple children with character type as the attribute; Last level stores attributes of stringarray, doublearray and intarray. When going to opencascade read and write function, it recognize attribute through different TopoDS_Shapes.
Modified: cgm/trunk/geom/OCC/OCCAttrib.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCAttrib.cpp 2008-07-03 18:46:43 UTC (rev 1979)
+++ cgm/trunk/geom/OCC/OCCAttrib.cpp 2008-07-03 19:04:25 UTC (rev 1980)
@@ -4,7 +4,7 @@
#include "CubitFileIOWrapper.hpp"
// Constructor - copy from CubitSimpleAttrib
-OCCAttrib::OCCAttrib( CubitSimpleAttrib* csa ) : listNext(0)
+OCCAttrib::OCCAttrib( CubitSimpleAttrib* csa) : listNext(0)
{
int i;
Modified: cgm/trunk/geom/OCC/OCCAttrib.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCAttrib.hpp 2008-07-03 18:46:43 UTC (rev 1979)
+++ cgm/trunk/geom/OCC/OCCAttrib.hpp 2008-07-03 19:04:25 UTC (rev 1980)
@@ -3,6 +3,7 @@
#include "CubitDefines.h"
#include "CubitString.hpp"
+
class CubitSimpleAttrib;
class CubitString;
@@ -43,8 +44,8 @@
private:
OCCAttrib( int string_count, CubitString* strings,
- int double_count, double* doubles,
- int integer_count, int* integers );
+ int double_count, double* doubles,
+ int integer_count, int* integers);
};
Modified: cgm/trunk/geom/OCC/OCCAttribSet.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCAttribSet.cpp 2008-07-03 18:46:43 UTC (rev 1979)
+++ cgm/trunk/geom/OCC/OCCAttribSet.cpp 2008-07-03 19:04:25 UTC (rev 1980)
@@ -14,15 +14,117 @@
#include "OCCAttrib.hpp"
#include "CubitSimpleAttrib.hpp"
#include "CubitFileIOWrapper.hpp"
+#include "Handle_TDataStd_Shape.hxx"
+#include "TCollection_ExtendedString.hxx"
+#include "Handle_TDataStd_Name.hxx"
+#include "Handle_TDataStd_ExtStringArray.hxx"
+#include "Handle_TDataStd_RealArray.hxx"
+#include "Handle_TDataStd_IntegerArray.hxx"
+#include "TDataStd_Name.hxx"
+#include "TDataStd_ExtStringArray.hxx"
+#include "TDataStd_RealArray.hxx"
+#include "TDataStd_IntegerArray.hxx"
+#include "TDataStd_Shape.hxx"
+#include "TopoDS_Shape.hxx"
+#include "TDF_ChildIterator.hxx"
-void OCCAttribSet::append_attribute( CubitSimpleAttrib* csa )
+void OCCAttribSet::append_attribute( CubitSimpleAttrib* csa, TopoDS_Shape& shape )
{
OCCAttrib* new_attrib = new OCCAttrib(csa);
new_attrib->listNext = listHead;
listHead = new_attrib;
+
+ TDF_Label child;
+ //Add attributes on child of myLabel
+ //1. add shape attribute, first check to make sure there's no shape attribute
+ CubitBoolean found = CUBIT_FALSE;
+ for (TDF_ChildIterator it1(myLabel, CUBIT_FALSE); it1.More(); it1.Next())
+ {
+ //find the same type attribute first
+ child = it1.Value();
+
+ Handle_TDataStd_Shape attr_shape;
+ TopoDS_Shape old_shape;
+ if(TDataStd_Shape::Find(child, attr_shape))
+ old_shape = attr_shape->Get(child);
+ if(old_shape.IsEqual(shape))
+ {
+ found = CUBIT_TRUE;
+ break;
+ }
+ }
+
+ if(!found)
+ {
+ child = myLabel.NewChild();
+ Handle_TDataStd_Shape attr_shape = TDataStd_Shape::Set(child, shape);
+ child.AddAttribute(attr_shape);
+ }
+
+ //2. add type attribute , belowing attributes are added on child lable of child
+ //First create new child label
+ TDF_Label lab = child.NewChild();
+
+ //Then add child labels
+ CubitString type = csa->character_type();
+ if(type.length() > 0)
+ {
+ TCollection_ExtendedString cstring( (Standard_CString)type.c_str() );
+ Handle_TDataStd_Name attr_name = TDataStd_Name::Set(lab, cstring);
+ lab.AddAttribute(attr_name);
+ }
+
+ //3. add string attribute
+ DLIList<CubitString*>* strings = csa->string_data_list();
+ TDF_Label lab_child = lab.NewChild();
+ Handle_TDataStd_ExtStringArray attr_string;
+ if(strings && strings->size() > 0)
+ {
+ //set the length of String Array be 11, can be extended.
+ attr_string = TDataStd_ExtStringArray::Set(lab_child, 0, 10);
+ }
+
+ for(int i = 0; strings && i < strings->size(); i++)
+ {
+ TCollection_ExtendedString
+ cstring((Standard_CString)strings->get_and_step()->c_str() );
+ attr_string->SetValue(i, cstring) ;
+ }
+ if(strings && strings->size() > 0)
+ lab_child.AddAttribute(attr_string);
+
+ //4. add double attribute
+ DLIList<double*>* doubles = csa->double_data_list();
+ Handle_TDataStd_RealArray attr_double;
+ if(doubles && doubles->size() > 0)
+ {
+ //set the length of double array be 11, can be extended.
+ attr_double = TDataStd_RealArray::Set(lab_child,0, 10);
+ }
+
+ for(int i = 0; doubles && i < doubles->size(); i++)
+ attr_double->SetValue(i, *(doubles->get_and_step()));
+
+ if(doubles && doubles->size() > 0)
+ lab_child.AddAttribute(attr_double);
+
+ //5. add int attribute
+ DLIList<int*>* ints = csa->int_data_list();
+ Handle_TDataStd_IntegerArray attr_int;
+ if(ints && ints->size() > 0)
+ {
+ //set the length of int array be 11, can be extended.
+ attr_int = TDataStd_IntegerArray::Set(lab_child, 0, 10);
+ }
+
+ for(int i = 0; ints && i < ints->size(); i++)
+ attr_int->SetValue(i, *(ints->get_and_step()));
+
+ if(ints && ints->size() > 0)
+ lab_child.AddAttribute(attr_int);
}
-void OCCAttribSet::remove_attribute( CubitSimpleAttrib* csa )
+void OCCAttribSet::remove_attribute( CubitSimpleAttrib* csa)
{
if( !listHead )
return;
@@ -46,6 +148,95 @@
return;
}
}
+
+ //forget csa attribute from the document
+ DLIList<int*>* ints = csa->int_data_list();
+ CubitString type = csa->character_type();
+ TCollection_ExtendedString cstring( (Standard_CString)type.c_str() );
+
+ if(type.length() == 0)
+ return;
+
+ DLIList<double*>* doubles = csa->double_data_list();
+ DLIList<CubitString*>* strings = csa->string_data_list();
+ for (TDF_ChildIterator it1(myLabel, CUBIT_TRUE); it1.More(); it1.Next())
+ {
+ //find the same type attribute first
+ TDF_Label child = it1.Value();
+
+ Handle_TDataStd_Name attr_name;
+ TCollection_ExtendedString old_string;
+ if(child.FindAttribute(TDataStd_Name::GetID(), attr_name))
+ old_string = attr_name->Get();
+
+ if(old_string != cstring)
+ continue;
+
+ //continue to compare the rest attributes.
+ CubitBoolean is_same = CUBIT_TRUE;
+ for(TDF_ChildIterator it2(child,CUBIT_FALSE); it2.More(); it2.Next())
+ {
+ is_same = CUBIT_TRUE;
+ TDF_Label g_child = it2.Value();
+ if(ints->size() > 0 )
+ {
+ Handle_TDataStd_IntegerArray attr_ints;
+ if(g_child.FindAttribute(TDataStd_IntegerArray::GetID(), attr_ints) &&
+ attr_ints->Length() == ints->size())
+ {
+ for(int i = 0; i < ints->size(); i++)
+ if(attr_ints->Value(i) != *ints->get_and_step())
+ {
+ is_same = CUBIT_FALSE;
+ break;
+ }
+ }
+ }
+ if(!is_same)
+ continue;
+
+ if(doubles->size() > 0 )
+ {
+ Handle_TDataStd_RealArray attr_doubles;
+ if(g_child.FindAttribute(TDataStd_RealArray::GetID(), attr_doubles) &&
+ attr_doubles->Length() == doubles->size())
+ {
+ for(int i = 0; i < doubles->size(); i++)
+ if(attr_doubles->Value(i) != *doubles->get_and_step())
+ {
+ is_same = CUBIT_FALSE;
+ break;
+ }
+ }
+ }
+
+ if(!is_same)
+ continue;
+
+ if(strings->size() > 0 )
+ {
+ Handle_TDataStd_ExtStringArray attr_strings;
+ if(g_child.FindAttribute(TDataStd_ExtStringArray::GetID(), attr_strings) &&
+ attr_strings->Length() == strings->size())
+ {
+ for(int i = 0; i < strings->size(); i++)
+ {
+ CubitString astring = *strings->get_and_step();
+ TCollection_ExtendedString string( (Standard_CString)astring.c_str() );
+ if(attr_strings->Value(i) != string)
+ {
+ is_same = CUBIT_FALSE;
+ break;
+ }
+ }
+ }
+ }
+ if(!is_same)
+ continue;
+
+ child.ForgetAllAttributes( );
+ }
+ }
}
void OCCAttribSet::remove_all_attributes()
@@ -56,6 +247,7 @@
listHead = dead->listNext;
delete dead;
}
+ myLabel.ForgetAllAttributes( );
}
CubitStatus OCCAttribSet::get_attributes( DLIList<CubitSimpleAttrib*>& list ) const
Modified: cgm/trunk/geom/OCC/OCCAttribSet.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCAttribSet.hpp 2008-07-03 18:46:43 UTC (rev 1979)
+++ cgm/trunk/geom/OCC/OCCAttribSet.hpp 2008-07-03 19:04:25 UTC (rev 1980)
@@ -14,21 +14,26 @@
#define FACET_BRIDGE_HPP
#include <DLIList.hpp>
+#include "TDF_Label.hxx"
+#include "TDF_TagSource.hxx"
+#include "OCCQueryEngine.hpp"
class CubitSimpleAttrib;
class OCCAttrib;
class CubitString;
+class TopoDS_Shape;
class OCCAttribSet
{
public:
- OCCAttribSet() : listHead(0) {}
+ OCCAttribSet() : listHead(0)
+ {myLabel = TDF_TagSource::NewChild(OCCQueryEngine::mainLabel);}
~OCCAttribSet() { remove_all_attributes(); }
- void append_attribute( CubitSimpleAttrib* );
+ void append_attribute( CubitSimpleAttrib*, TopoDS_Shape& shape );
void remove_attribute( CubitSimpleAttrib* );
@@ -48,6 +53,7 @@
private:
OCCAttrib* listHead;
+ TDF_Label myLabel;
};
#endif
Modified: cgm/trunk/geom/OCC/OCCBody.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.cpp 2008-07-03 18:46:43 UTC (rev 1979)
+++ cgm/trunk/geom/OCC/OCCBody.cpp 2008-07-03 19:04:25 UTC (rev 1980)
@@ -127,7 +127,7 @@
}
void OCCBody::append_simple_attribute_virt(CubitSimpleAttrib *csa)
- { attribSet.append_attribute(csa); }
+ { attribSet.append_attribute(csa, *myTopoDSShape); }
void OCCBody::remove_simple_attribute_virt(CubitSimpleAttrib *csa)
{ attribSet.remove_attribute(csa); }
Modified: cgm/trunk/geom/OCC/OCCCurve.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.cpp 2008-07-03 18:46:43 UTC (rev 1979)
+++ cgm/trunk/geom/OCC/OCCCurve.cpp 2008-07-03 19:04:25 UTC (rev 1980)
@@ -135,7 +135,7 @@
// Creation Date : 07/14/00
//-------------------------------------------------------------------------
void OCCCurve::append_simple_attribute_virt(CubitSimpleAttrib *csa)
- { attribSet.append_attribute(csa); }
+ { attribSet.append_attribute(csa, *myTopoDSEdge); }
//-------------------------------------------------------------------------
// Purpose : The purpose of this function is to remove a simple
Modified: cgm/trunk/geom/OCC/OCCLump.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLump.cpp 2008-07-03 18:46:43 UTC (rev 1979)
+++ cgm/trunk/geom/OCC/OCCLump.cpp 2008-07-03 19:04:25 UTC (rev 1980)
@@ -124,7 +124,7 @@
// Creation Date : 11/21/96
//-------------------------------------------------------------------------
void OCCLump::append_simple_attribute_virt(CubitSimpleAttrib *csa)
- { attribSet.append_attribute(csa); }
+ { attribSet.append_attribute(csa, *myTopoDSSolid); }
//-------------------------------------------------------------------------
// Purpose : The purpose of this function is to remove a simple
Modified: cgm/trunk/geom/OCC/OCCPoint.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCPoint.cpp 2008-07-03 18:46:43 UTC (rev 1979)
+++ cgm/trunk/geom/OCC/OCCPoint.cpp 2008-07-03 19:04:25 UTC (rev 1980)
@@ -105,7 +105,7 @@
// Creation Date : 07/16/00
//-------------------------------------------------------------------------
void OCCPoint::append_simple_attribute_virt(CubitSimpleAttrib *csa)
- { attribSet.append_attribute(csa); }
+ { attribSet.append_attribute(csa, *myTopoDSVertex); }
//-------------------------------------------------------------------------
// Purpose : The purpose of this function is to remove a simple
Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2008-07-03 18:46:43 UTC (rev 1979)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2008-07-03 19:04:25 UTC (rev 1980)
@@ -102,10 +102,13 @@
//#include "TopOpeBRepTool_ShapeTool.hxx"
//#include "BRepPrimAPI_MakePrism.hxx"
//#include "TopOpeBRep_Point2d.hxx"
+#include "TDF_Label.hxx"
#include "TopTools_DataMapOfShapeInteger.hxx"
#include "BRepExtrema_DistShapeShape.hxx"
#include "BRepAlgoAPI_Section.hxx"
#include "BRepBuilderAPI_MakeEdge.hxx"
+#include "TDocStd_Document.hxx"
+#include "TCollection_ExtendedString.hxx"
#include "gp_Lin.hxx"
using namespace NCubitFile;
@@ -147,6 +150,9 @@
WireList = new DLIList<OCCLoop*>;
SurfaceList = new DLIList<OCCSurface*>;
CurveList = new DLIList<OCCCurve*>;
+ TCollection_ExtendedString xString;
+ MyDF = new TDocStd_Document(xString);
+ mainLabel = MyDF->Main();
}
//================================================================================
@@ -1351,7 +1357,7 @@
OCCCoEdge * coedge = NULL;
int size = coedges_old.size();
CubitSense sense ;
- if( aShape.Orientation() == CUBIT_REVERSED )
+ if( aShape.Orientation() == TopAbs_REVERSED )
sense = (Ex.Orientation() == TopAbs_FORWARD ? CUBIT_REVERSED : CUBIT_FORWARD);
else
sense = (Ex.Orientation() == TopAbs_FORWARD ? CUBIT_FORWARD : CUBIT_REVERSED);
Modified: cgm/trunk/geom/OCC/OCCQueryEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.hpp 2008-07-03 18:46:43 UTC (rev 1979)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.hpp 2008-07-03 19:04:25 UTC (rev 1980)
@@ -31,7 +31,7 @@
#include "config.h"
#include "CubitFileIOWrapper.hpp"
#include "GeometryQueryEngine.hpp"
-
+#include "Handle_TDocStd_Document.hxx"
#include <map>
// ********** END CUBIT INCLUDES **********
@@ -77,6 +77,7 @@
class OCCCurve;
class OCCPoint;
+class TDF_Label;
class BRepBuilderAPI_Transform;
class TopTools_DataMapOfShapeInteger;
class BRepAlgoAPI_BooleanOperation;
@@ -360,6 +361,8 @@
DLIList<OCCSurface*> *SurfaceList ;
DLIList<OCCLoop*> *WireList; //standalone wire list
DLIList<OCCCurve*> *CurveList ;
+ Handle(TDocStd_Document) MyDF;
+ static TDF_Label mainLabel;
TopTools_DataMapOfShapeInteger* OCCMap;
std::map<int, TopologyBridge*>* OccToCGM;
static int iTotalTBCreated ;
@@ -387,7 +390,6 @@
static const int OCCQE_MAJOR_VERSION;
static const int OCCQE_MINOR_VERSION;
static const int OCCQE_SUBMINOR_VERSION;
-
};
// ********** BEGIN INLINE FUNCTIONS **********
Modified: cgm/trunk/geom/OCC/OCCSurface.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.cpp 2008-07-03 18:46:43 UTC (rev 1979)
+++ cgm/trunk/geom/OCC/OCCSurface.cpp 2008-07-03 19:04:25 UTC (rev 1980)
@@ -117,7 +117,7 @@
//
//-------------------------------------------------------------------------
void OCCSurface::append_simple_attribute_virt(CubitSimpleAttrib *csa)
- { attribSet.append_attribute(csa); }
+ { attribSet.append_attribute(csa, *myTopoDSFace); }
//-------------------------------------------------------------------------
1
0