BRepUtils.cpp
Go to the documentation of this file.00001 #include "BRepUtils.h"
00002
00003 #include <TopoDS_Edge.hxx>
00004 #include <TopoDS_Shape.hxx>
00005 #include <GProp_GProps.hxx>
00006 #include <BRepGProp.hxx>
00007 #include <TopExp.hxx>
00008 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
00009 #include <TopTools_ListOfShape.hxx>
00010 #include <TopTools_ListIteratorOfListOfShape.hxx>
00011 #include <TopExp_Explorer.hxx>
00012 #include <TopoDS.hxx>
00013
00014
00015
00016 double BRepUtils::GetLength(const TopoDS_Edge& edge)
00017 {
00018 GProp_GProps lProps;
00019 BRepGProp::LinearProperties(edge,lProps);
00020 return lProps.Mass();
00021 }
00022
00023 bool BRepUtils::CheckTopologie(const TopoDS_Shape& shape)
00024 {
00025 TopTools_IndexedDataMapOfShapeListOfShape aMap;
00026 aMap.Clear();
00027 TopExp::MapShapesAndAncestors(shape,TopAbs_EDGE,TopAbs_FACE,aMap);
00028 TopExp_Explorer anExplorer;
00029 for(anExplorer.Init(shape,TopAbs_EDGE);anExplorer.More();anExplorer.Next())
00030 {
00031 const TopTools_ListOfShape& aFaceList = aMap.FindFromKey(anExplorer.Current());
00032
00033 TopTools_ListIteratorOfListOfShape aListIterator(aFaceList);
00034 int i=0;
00035 for(aListIterator.Initialize(aFaceList);aListIterator.More();aListIterator.Next())
00036 {
00037 i++;
00038 }
00039 if(i<2)
00040 {
00041 cout << "less" << endl;
00042 }
00043 }
00044 return true;
00045 }