本文整理汇总了C++中TopTools_ListOfShape::Remove方法的典型用法代码示例。如果您正苦于以下问题:C++ TopTools_ListOfShape::Remove方法的具体用法?C++ TopTools_ListOfShape::Remove怎么用?C++ TopTools_ListOfShape::Remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TopTools_ListOfShape
的用法示例。
在下文中一共展示了TopTools_ListOfShape::Remove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PurgeNewEdges
//=======================================================================
//function : PurgeNewEdges
//purpose :
//=======================================================================
static void PurgeNewEdges(TopTools_ListOfShape& ConstEdges,
const TopTools_MapOfOrientedShape& UsedEdges)
{
TopTools_ListIteratorOfListOfShape it(ConstEdges);
while ( it.More()) {
const TopoDS_Shape& NE = it.Value();
if (!UsedEdges.Contains(NE)) {
ConstEdges.Remove(it);
}
else {
it.Next();
}
}
}
示例2: SortShapes
//=======================================================================
//function : SortShapes
//purpose :
//=======================================================================
void GEOMUtils::SortShapes (TopTools_ListOfShape& SL,
const Standard_Boolean isOldSorting)
{
#ifdef STD_SORT_ALGO
std::vector<TopoDS_Shape> aShapesVec;
aShapesVec.reserve(SL.Extent());
TopTools_ListIteratorOfListOfShape it (SL);
for (; it.More(); it.Next()) {
aShapesVec.push_back(it.Value());
}
SL.Clear();
CompareShapes shComp (isOldSorting);
std::stable_sort(aShapesVec.begin(), aShapesVec.end(), shComp);
//std::sort(aShapesVec.begin(), aShapesVec.end(), shComp);
std::vector<TopoDS_Shape>::const_iterator anIter = aShapesVec.begin();
for (; anIter != aShapesVec.end(); ++anIter) {
SL.Append(*anIter);
}
#else
// old implementation
Standard_Integer MaxShapes = SL.Extent();
TopTools_Array1OfShape aShapes (1,MaxShapes);
TColStd_Array1OfInteger OrderInd(1,MaxShapes);
TColStd_Array1OfReal MidXYZ (1,MaxShapes); //X,Y,Z;
TColStd_Array1OfReal Length (1,MaxShapes); //X,Y,Z;
// Computing of CentreOfMass
Standard_Integer Index;
GProp_GProps GPr;
gp_Pnt GPoint;
TopTools_ListIteratorOfListOfShape it(SL);
for (Index=1; it.More(); Index++)
{
TopoDS_Shape S = it.Value();
SL.Remove( it ); // == it.Next()
aShapes(Index) = S;
OrderInd.SetValue (Index, Index);
if (S.ShapeType() == TopAbs_VERTEX) {
GPoint = BRep_Tool::Pnt( TopoDS::Vertex( S ));
Length.SetValue( Index, (Standard_Real) S.Orientation());
}
else {
// BEGIN: fix for Mantis issue 0020842
if (isOldSorting) {
BRepGProp::LinearProperties (S, GPr);
}
else {
if (S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE) {
BRepGProp::LinearProperties (S, GPr);
}
else if (S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL) {
BRepGProp::SurfaceProperties(S, GPr);
}
else {
BRepGProp::VolumeProperties(S, GPr);
}
}
// END: fix for Mantis issue 0020842
GPoint = GPr.CentreOfMass();
Length.SetValue(Index, GPr.Mass());
}
MidXYZ.SetValue(Index, GPoint.X()*999.0 + GPoint.Y()*99.0 + GPoint.Z()*0.9);
//cout << Index << " L: " << Length(Index) << "CG: " << MidXYZ(Index) << endl;
}
// Sorting
Standard_Integer aTemp;
Standard_Boolean exchange, Sort = Standard_True;
Standard_Real tol = Precision::Confusion();
while (Sort)
{
Sort = Standard_False;
for (Index=1; Index < MaxShapes; Index++)
{
exchange = Standard_False;
Standard_Real dMidXYZ = MidXYZ(OrderInd(Index)) - MidXYZ(OrderInd(Index+1));
Standard_Real dLength = Length(OrderInd(Index)) - Length(OrderInd(Index+1));
if ( dMidXYZ >= tol ) {
// cout << "MidXYZ: " << MidXYZ(OrderInd(Index))<< " > " <<MidXYZ(OrderInd(Index+1))
// << " d: " << dMidXYZ << endl;
exchange = Standard_True;
}
else if ( Abs(dMidXYZ) < tol && dLength >= tol ) {
// cout << "Length: " << Length(OrderInd(Index))<< " > " <<Length(OrderInd(Index+1))
// << " d: " << dLength << endl;
exchange = Standard_True;
}
else if ( Abs(dMidXYZ) < tol && Abs(dLength) < tol &&
aShapes(OrderInd(Index)).ShapeType() <= TopAbs_FACE) {
// PAL17233
// equal values possible on shapes such as two halves of a sphere and
// a membrane inside the sphere
Bnd_Box box1,box2;
//.........这里部分代码省略.........
示例3: SelectEdge
//=======================================================================
//function : SelectEdge
//purpose : Find the edge <NE> connected <CE> by the vertex <CV> in the list <LE>.
// <NE> Is erased of the list. If <CE> is too in the list <LE>
// with the same orientation, it's erased of the list
//=======================================================================
static Standard_Boolean SelectEdge(const TopoDS_Face& F,
const TopoDS_Edge& CE,
const TopoDS_Vertex& CV,
TopoDS_Edge& NE,
TopTools_ListOfShape& LE)
{
TopTools_ListIteratorOfListOfShape itl;
NE.Nullify();
for ( itl.Initialize(LE); itl.More(); itl.Next()) {
if (itl.Value().IsEqual(CE)) {
LE.Remove(itl);
break;
}
}
if (LE.Extent() > 1) {
//--------------------------------------------------------------
// Several possible edges.
// - Test the edges differents of CE
//--------------------------------------------------------------
Standard_Real cf, cl, f, l;
TopoDS_Face FForward = F;
Handle(Geom2d_Curve) Cc, C;
FForward.Orientation(TopAbs_FORWARD);
Cc = BRep_Tool::CurveOnSurface(CE,FForward,cf,cl);
Standard_Real dist,distmin = 100*BRep_Tool::Tolerance(CV);
Standard_Real uc,u;
if (CE.Orientation () == TopAbs_FORWARD) uc = cl;
else uc = cf;
gp_Pnt2d P2,PV = Cc->Value(uc);
Standard_Real delta = FindDelta(LE,FForward);
for ( itl.Initialize(LE); itl.More(); itl.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(itl.Value());
if (!E.IsSame(CE)) {
C = BRep_Tool::CurveOnSurface(E,FForward,f,l);
if (E.Orientation () == TopAbs_FORWARD) u = f;
else u = l;
P2 = C->Value(u);
dist = PV.Distance(P2);
if (dist <= distmin){
distmin = dist;
}
}
}
Standard_Real anglemax = - PI;
TopoDS_Edge SelectedEdge;
for ( itl.Initialize(LE); itl.More(); itl.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(itl.Value());
if (!E.IsSame(CE)) {
C = BRep_Tool::CurveOnSurface(E,FForward,f,l);
if (E.Orientation () == TopAbs_FORWARD) u = f;
else u = l;
P2 = C->Value(u);
dist = PV.Distance(P2);
if (dist <= distmin + (1./3)*delta){
gp_Pnt2d PC, P;
gp_Vec2d CTg1, CTg2, Tg1, Tg2;
Cc->D2(uc, PC, CTg1, CTg2);
C->D2(u, P, Tg1, Tg2);
Standard_Real angle;
if (CE.Orientation () == TopAbs_REVERSED && E.Orientation () == TopAbs_FORWARD) {
angle = CTg1.Angle(Tg1.Reversed());
}
else if (CE.Orientation () == TopAbs_FORWARD && E.Orientation () == TopAbs_REVERSED) {
angle = (CTg1.Reversed()).Angle(Tg1);
}
else if (CE.Orientation () == TopAbs_REVERSED && E.Orientation () == TopAbs_REVERSED) {
angle = CTg1.Angle(Tg1);
}
else if (CE.Orientation () == TopAbs_FORWARD && E.Orientation () == TopAbs_FORWARD) {
angle = (CTg1.Reversed()).Angle(Tg1.Reversed());
}
if (angle >= anglemax) {
anglemax = angle ;
SelectedEdge = E;
}
}
}
}
for ( itl.Initialize(LE); itl.More(); itl.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(itl.Value());
if (E.IsEqual(SelectedEdge)) {
NE = TopoDS::Edge(E);
LE.Remove(itl);
break;
}
//.........这里部分代码省略.........