本文整理汇总了C++中TopTools_IndexedDataMapOfShapeListOfShape::Contains方法的典型用法代码示例。如果您正苦于以下问题:C++ TopTools_IndexedDataMapOfShapeListOfShape::Contains方法的具体用法?C++ TopTools_IndexedDataMapOfShapeListOfShape::Contains怎么用?C++ TopTools_IndexedDataMapOfShapeListOfShape::Contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TopTools_IndexedDataMapOfShapeListOfShape
的用法示例。
在下文中一共展示了TopTools_IndexedDataMapOfShapeListOfShape::Contains方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_parents_virt
void OCCSurface::get_parents_virt( DLIList<TopologyBridge*>& parents )
{
if(myShell) //shell or sheet body
{
parents.append(myShell);
return;
}
OCCQueryEngine* oqe = (OCCQueryEngine*) get_geometry_query_engine();
OCCBody * body = NULL;
DLIList <OCCBody* > *bodies = oqe->BodyList;
TopTools_IndexedDataMapOfShapeListOfShape M;
for(int i = 0; i < bodies->size(); i++)
{
body = bodies->get_and_step();
TopExp::MapShapesAndAncestors(*(body->get_TopoDS_Shape()),
TopAbs_FACE, TopAbs_SHELL, M);
if(!M.Contains(*(get_TopoDS_Face())))
continue;
const TopTools_ListOfShape& ListOfShapes =
M.FindFromKey(*(get_TopoDS_Face()));
if (!ListOfShapes.IsEmpty())
{
TopTools_ListIteratorOfListOfShape it(ListOfShapes) ;
for (;it.More(); it.Next())
{
TopoDS_Shell Shell = TopoDS::Shell(it.Value());
int k = oqe->OCCMap->Find(Shell);
parents.append((OCCShell*)(oqe->OccToCGM->find(k))->second);
}
}
}
}
示例2: get_bodies
CubitStatus OCCSurface::get_bodies(DLIList<OCCBody*>& bodies)
{
TopoDS_Face* topo_face = this->get_TopoDS_Face();
OCCQueryEngine* oqe = OCCQueryEngine::instance();
DLIList <OCCBody* > *all_bodies = oqe->BodyList;
TopTools_IndexedDataMapOfShapeListOfShape M;
OCCBody * body = NULL;
for(int j = 0; j < all_bodies->size(); j++)
{
body = all_bodies->get_and_step();
TopExp_Explorer Ex;
TopoDS_Face the_face;
TopoDS_Shape ashape = *(body->get_TopoDS_Shape());
M.Clear();
TopExp::MapShapesAndAncestors(ashape, TopAbs_FACE, TopAbs_COMPSOLID, M);
if(!M.Contains(*topo_face))
continue;
bodies.append_unique(body);
}
return CUBIT_SUCCESS;
}
示例3: DetectSolids
//=======================================================================
//function : DetectSolids
//purpose :
//=======================================================================
void GEOMAlgo_GlueAnalyser::DetectSolids()
{
myErrorStatus=0;
//
Standard_Integer i, aNbF, aNbS, aNbC, aNbX;
TopoDS_Compound aCmp;
BRep_Builder aBB;
TopTools_IndexedDataMapOfShapeListOfShape aMFS;
TopTools_IndexedMapOfShape aMx, aMS;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
GEOMAlgo_CoupleOfShapes aCS;
//
GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape aMPKLS;
GEOMAlgo_PassKeyShape aPKSx;
//
aBB.MakeCompound(aCmp);
//
TopExp::MapShapesAndAncestors(myShape, TopAbs_FACE, TopAbs_SOLID, aMFS);
//
aItIm.Initialize(myImages);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aIm=aItIm.Key();
if (aIm.ShapeType()!=TopAbs_FACE) {
continue;
}
//
const TopTools_ListOfShape& aLF=aItIm.Value();
aNbF=aLF.Extent();
if (aNbF!=2) {
continue;
}
//
TopoDS_Shape aSx[2], aFx[2];
//
aFx[0]=aLF.First();
aFx[1]=aLF.Last();
for (i=0; i<2; ++i) {
if (!aMFS.Contains(aFx[i])) {
continue;// it must not be so
}
//
const TopTools_ListOfShape& aLS=aMFS.FindFromKey(aFx[i]);
aNbS=aLS.Extent();
if (aNbS!=1) {
continue;
}
aSx[i]=aLS.First();
}
//
if (aSx[0].IsNull() || aSx[1].IsNull()) {
continue;
}
//
//aPKSx.Clear();//qft
//qf
//aPKSx.SetIds(aSx[0], aSx[1]);
aPKSx.SetShapes(aSx[0], aSx[1]);
//qt
//
if (!aMPKLS.Contains(aPKSx)) {
TopTools_ListOfShape aLSx;
//
aLSx.Append(aSx[0]);
aLSx.Append(aSx[1]);
//
aMPKLS.Add(aPKSx, aLSx);
}
}
//
mySolidsToGlue.Clear();
mySolidsAlone.Clear();
//
aNbC=aMPKLS.Extent();
if (!aNbC) {
return;
}
//
for (i=1; i<=aNbC; ++i) {
const TopTools_ListOfShape& aLSx=aMPKLS(i);
const TopoDS_Shape& aSx1=aLSx.First();
const TopoDS_Shape& aSx2=aLSx.Last();
aCS.SetShape1(aSx1);
aCS.SetShape2(aSx2);
mySolidsToGlue.Append(aCS);
//
if (!aMx.Contains(aSx1)) {
aBB.Add(aCmp, aSx1);
aMx.Add(aSx1);
}
if (!aMx.Contains(aSx2)) {
aBB.Add(aCmp, aSx2);
aMx.Add(aSx2);
}
}
myResult=aCmp;
//.........这里部分代码省略.........
示例4: FillInternalVertices
//=======================================================================
// function: FillInternalVertices
// purpose:
//=======================================================================
void GEOMAlgo_Builder::FillInternalVertices()
{
const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
NMTTools_PaveFiller* pPF=myPaveFiller;
NMTDS_InterfPool* pIP=pPF->IP();
const Handle(IntTools_Context)& aCtx= pPF->Context();
//
BOPTools_CArray1OfVSInterference& aVFs=pIP->VSInterferences();
BOPTools_CArray1OfESInterference& aEFs=pIP->ESInterferences();
const NMTTools_IndexedDataMapOfIndexedMapOfInteger& aMAV=pPF->AloneVertices();
//
Standard_Boolean bHasImage;
Standard_Integer i, j, nF, aNbS, nV, nVSD, n1, n2, iFlag;
Standard_Integer aNbVFs, aNbAVF, aNbEFs, aNbVC, aNbE, aNbV;
Standard_Real aU1, aU2, aTol;
NMTTools_IndexedDataMapOfIndexedMapOfInteger aMFMV;
TopTools_MapOfShape aMFence;
TopTools_ListIteratorOfListOfShape aIt, aItV;
BRep_Builder aBB;
//
// 1. Collect face-vertex candidates [aMFMV]
//
// 1.1. VFs
aNbVFs=aVFs.Extent();
for (i=1; i<=aNbVFs; ++i) {
const BOPTools_VSInterference& aVS=aVFs(i);
aVS.Indices(n1, n2);
nF=n2;
nV=n1;
if (aDS.Shape(n1).ShapeType()==TopAbs_FACE) {
nF=n1;
nV=n2;
}
nVSD=pPF->FindSDVertex(nV);
if (nVSD) {
nV=nVSD;
}
//
UpdateCandidates(nF, nV, aMFMV);
}
//
// 1.2 EFs
aNbEFs=aEFs.Extent();
for (i=1; i<=aNbEFs; ++i) {
const BOPTools_ESInterference& aEF=aEFs(i);
aEF.Indices(n1, n2);
nV=aEF.NewShape();
if (!nV) {
continue;
}
const TopoDS_Shape& aSnew=aDS.Shape(nV);
if (aSnew.ShapeType()!=TopAbs_VERTEX) {
continue;
}
//
nF=(aDS.Shape(n1).ShapeType()==TopAbs_FACE) ? n1 : n2;
nVSD=pPF->FindSDVertex(nV);
if (nVSD) {
nV=nVSD;
}
UpdateCandidates(nF, nV, aMFMV);
}
//
aNbS=aDS.NumberOfShapesOfTheObject();
for (nF=1; nF<=aNbS; ++nF) {
const TopoDS_Shape& aF=aDS.Shape(nF);
//
if (aF.ShapeType()!=TopAbs_FACE) {
continue;
}
if (!aMFence.Add(aF)) {
continue;
}
//
const TopoDS_Face& aFF=TopoDS::Face(aF);
aTol=BRep_Tool::Tolerance(aFF);
//
// 1.3 FFs
if (aMAV.Contains(nF)) {
const TColStd_IndexedMapOfInteger& aMAVF=aMAV.FindFromKey(nF);
aNbAVF=aMAVF.Extent();
for (j=1; j<=aNbAVF; ++j) {
nV=aMAVF(j);
nVSD=pPF->FindSDVertex(nV);
if (nVSD) {
nV=nVSD;
}
//
UpdateCandidates(nF, nV, aMFMV);
}
}
//
// 1.4 Internal vertices of the face nF
BooleanOperations_OnceExplorer aExp(aDS);
aExp.Init(nF, TopAbs_VERTEX);
for (; aExp.More(); aExp.Next()) {
//.........这里部分代码省略.........
示例5: FillInternalShapes
//.........这里部分代码省略.........
const TopTools_ListOfShape &aLSp=myImages.Image(aSI);
aIt.Initialize(aLSp);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSp=aIt.Value();
aMSI.Add(aSp);
}
}
else {
aMSI.Add(aSI);
}
}
//
// build aux map from splits of solids
if (myImages.HasImage(aS)) {
const TopTools_ListOfShape &aLSp=myImages.Image(aS);
aIt.Initialize(aLSp);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSp=aIt.Value();
if (aMFence.Add(aSp)) {
TopExp::MapShapesAndAncestors(aSp, TopAbs_VERTEX, TopAbs_EDGE, aMSx);
TopExp::MapShapesAndAncestors(aSp, TopAbs_VERTEX, TopAbs_FACE, aMSx);
TopExp::MapShapesAndAncestors(aSp, TopAbs_EDGE , TopAbs_FACE, aMSx);
aLSd.Append(aSp);
}
}
}
else {
if (aMFence.Add(aS)) {
TopExp::MapShapesAndAncestors(aS, TopAbs_VERTEX, TopAbs_EDGE, aMSx);
TopExp::MapShapesAndAncestors(aS, TopAbs_VERTEX, TopAbs_FACE, aMSx);
TopExp::MapShapesAndAncestors(aS, TopAbs_EDGE , TopAbs_FACE, aMSx);
aLSd.Append(aS);
aMSOr.Add(aS);
}
}
}//if (aType==TopAbs_SOLID)
}
//
aNbSd=aLSd.Extent();
//
// 3. Some shapes of aMSI can be already tied with faces of
// split solids
aItM.Initialize(aMSI);
for (; aItM.More(); aItM.Next()) {
const TopoDS_Shape& aSI=aItM.Key();
if (aMSx.Contains(aSI)) {
const TopTools_ListOfShape &aLSx=aMSx.FindFromKey(aSI);
aNbSx=aLSx.Extent();
if (aNbSx) {
aMSI.Remove(aSI);
}
}
}
//
// 4. Just check it
aNbSI=aMSI.Extent();
if (!aNbSI) {
return;
}
//
// 5 Settle internal vertices and edges into solids
aMx.Clear();
aIt.Initialize(aLSd);
for (; aIt.More(); aIt.Next()) {
TopoDS_Solid aSd=TopoDS::Solid(aIt.Value());
//
aItM.Initialize(aMSI);
for (; aItM.More(); aItM.Next()) {
TopoDS_Shape aSI=aItM.Key();
aSI.Orientation(TopAbs_INTERNAL);
//
aState=GEOMAlgo_Tools3D::ComputeStateByOnePoint(aSI, aSd, 1.e-11, aCtx);
if (aState==TopAbs_IN) {
//
if(aMSOr.Contains(aSd)) {
//
TopoDS_Solid aSdx;
//
aBB.MakeSolid(aSdx);
aItS.Initialize(aSd);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aSh=aItS.Value();
aBB.Add(aSdx, aSh);
}
//
aBB.Add(aSdx, aSI);
//
myImages.Bind(aSd, aSdx);
aMSOr.Remove(aSd);
aSd=aSdx;
}
else {
aBB.Add(aSd, aSI);
}
//
aMSI.Remove(aSI);
} //if (aState==TopAbs_IN) {
}// for (; aItM.More(); aItM.Next()) {
}//for (; aIt1.More(); aIt1.Next()) {
}
示例6: Handle
//=======================================================================
//function : FillIn3DParts
//purpose :
//=======================================================================
void GEOMAlgo_Builder::FillIn3DParts()
{
myErrorStatus=0;
//
const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
NMTTools_PaveFiller* pPF=myPaveFiller;
const Handle(IntTools_Context)& aCtx= pPF->Context();
//
Standard_Boolean bIsIN, bHasImage;
Standard_Integer aNbS, aNbSolids, i, j, aNbFaces, aNbFP, aNbFPx, aNbFIN, aNbLIF;
TopAbs_ShapeEnum aType;
TopAbs_State aState;
TopTools_IndexedMapOfShape aMSolids, aMS, aMFaces, aMFIN;
TopTools_MapOfShape aMFDone;
TopTools_IndexedDataMapOfShapeListOfShape aMEF;
TopTools_ListIteratorOfListOfShape aItS;
TopoDS_Iterator aIt, aItF;
BRep_Builder aBB;
TopoDS_Solid aSolidSp;
TopoDS_Face aFP;
//
myDraftSolids.Clear();
//
aNbS=aDS.NumberOfShapesOfTheObject();
for (i=1; i<=aNbS; ++i) {
const TopoDS_Shape& aS=aDS.Shape(i);
//
aType=aS.ShapeType();
if (aType==TopAbs_SOLID) {
// all solids from DS
aMSolids.Add(aS);
}
else if (aType==TopAbs_FACE) {
// all faces (originals from DS or theirs images)
if (myImages.HasImage(aS)) {
const TopTools_ListOfShape& aLS=myImages.Image(aS);
aItS.Initialize(aLS);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aFx=aItS.Value();
//
if (mySameDomainShapes.Contains(aFx)) {
const TopoDS_Shape& aFSDx=mySameDomainShapes.FindFromKey(aFx);
aMFaces.Add(aFSDx);
}
else {
aMFaces.Add(aFx);
}
}
}
else {
if (mySameDomainShapes.Contains(aS)) {
const TopoDS_Shape& aFSDx=mySameDomainShapes.FindFromKey(aS);
aMFaces.Add(aFSDx);
}
else {
aMFaces.Add(aS);
}
}
}
}
//
aNbFaces=aMFaces.Extent();
aNbSolids=aMSolids.Extent();
//
for (i=1; i<=aNbSolids; ++i) {
const TopoDS_Solid& aSolid=TopoDS::Solid(aMSolids(i));
aMFDone.Clear();
aMFIN.Clear();
aMEF.Clear();
//
aBB.MakeSolid(aSolidSp);
//
TopTools_ListOfShape aLIF;
//
BuildDraftSolid(aSolid, aSolidSp, aLIF);
aNbLIF=aLIF.Extent();
//
// 1 all faces/edges from aSolid [ aMS ]
bHasImage=Standard_False;
aMS.Clear();
aIt.Initialize(aSolid);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aShell=aIt.Value();
//
if (myImages.HasImage(aShell)) {
bHasImage=Standard_True;
//
const TopTools_ListOfShape& aLS=myImages.Image(aShell);
aItS.Initialize(aLS);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aSx=aItS.Value();
aMS.Add(aSx);
TopExp::MapShapes(aSx, TopAbs_FACE, aMS);
TopExp::MapShapes(aSx, TopAbs_EDGE, aMS);
TopExp::MapShapesAndAncestors(aSx, TopAbs_EDGE, TopAbs_FACE, aMEF);
}
//.........这里部分代码省略.........
示例7: Perform
TopoDS_Shape BlockFix_UnionEdges::Perform(const TopoDS_Shape& Shape,
const Standard_Real Tol)
{
myContext = new ShapeBuild_ReShape;
myTolerance = Tol;
TopoDS_Shape aResult = myContext->Apply(Shape);
// processing each solid
TopAbs_ShapeEnum aType = TopAbs_SOLID;
TopExp_Explorer exps (Shape, aType);
if (!exps.More()) {
aType = TopAbs_SHELL;
exps.Init(Shape, aType);
}
for (; exps.More(); exps.Next()) {
//TopoDS_Solid aSolid = TopoDS::Solid(exps.Current());
TopoDS_Shape aSolid = exps.Current();
TopTools_IndexedMapOfShape ChangedFaces;
// creating map of edge faces
TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces;
TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces);
Handle(ShapeBuild_ReShape) aContext = new ShapeBuild_ReShape;
TopoDS_Shape aRes = aSolid;
aRes = aContext->Apply(aSolid);
// processing each face
TopExp_Explorer exp;
for (exp.Init(aRes, TopAbs_FACE); exp.More(); exp.Next()) {
TopoDS_Face aFace =
TopoDS::Face(aContext->Apply(exp.Current().Oriented(TopAbs_FORWARD)));
TopTools_IndexedDataMapOfShapeListOfShape aMapFacesEdges;
for (TopExp_Explorer expe(aFace,TopAbs_EDGE); expe.More(); expe.Next()) {
TopoDS_Edge edge = TopoDS::Edge(expe.Current());
if (!aMapEdgeFaces.Contains(edge)) continue;
const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge);
TopTools_ListIteratorOfListOfShape anIter(aList);
for ( ; anIter.More(); anIter.Next()) {
TopoDS_Face face = TopoDS::Face(anIter.Value());
TopoDS_Face face1 = TopoDS::Face(aContext->Apply(anIter.Value()));
if (face1.IsSame(aFace)) continue;
if (aMapFacesEdges.Contains(face)) {
aMapFacesEdges.ChangeFromKey(face).Append(edge);
}
else {
TopTools_ListOfShape ListEdges;
ListEdges.Append(edge);
aMapFacesEdges.Add(face,ListEdges);
}
}
}
for (Standard_Integer i=1; i<=aMapFacesEdges.Extent(); i++) {
const TopTools_ListOfShape& ListEdges = aMapFacesEdges.FindFromIndex(i);
TopTools_SequenceOfShape SeqEdges;
TopTools_ListIteratorOfListOfShape anIter(ListEdges);
for ( ; anIter.More(); anIter.Next()) {
SeqEdges.Append(anIter.Value());
}
if (SeqEdges.Length()==1) continue;
TopoDS_Edge E;
if ( MergeEdges(SeqEdges,aFace,Tol,E) ) {
// now we have only one edge - aChain.Value(1)
// we have to replace old ListEdges with this new edge
aContext->Replace(SeqEdges(1),E);
for (Standard_Integer j=2; j<=SeqEdges.Length(); j++) {
aContext->Remove(SeqEdges(j));
}
TopoDS_Face tmpF = TopoDS::Face(exp.Current());
if ( !ChangedFaces.Contains(tmpF) )
ChangedFaces.Add(tmpF);
tmpF = TopoDS::Face(aMapFacesEdges.FindKey(i));
if ( !ChangedFaces.Contains(tmpF) )
ChangedFaces.Add(tmpF);
}
}
} // end processing each face
// fix changed faces and replace them in the local context
for (Standard_Integer i=1; i<=ChangedFaces.Extent(); i++) {
TopoDS_Face aFace = TopoDS::Face(aContext->Apply(ChangedFaces.FindKey(i)));
Handle(ShapeFix_Face) sff = new ShapeFix_Face(aFace);
sff->SetContext(myContext);
sff->SetPrecision(myTolerance);
sff->SetMinTolerance(myTolerance);
sff->SetMaxTolerance(Max(1.,myTolerance*1000.));
sff->Perform();
aContext->Replace(aFace,sff->Face());
}
if (ChangedFaces.Extent() > 0) {
// fix changed shell and replace it in the local context
TopoDS_Shape aRes1 = aContext->Apply(aRes);
TopExp_Explorer expsh;
for (expsh.Init(aRes1, TopAbs_SHELL); expsh.More(); expsh.Next()) {
TopoDS_Shell aShell = TopoDS::Shell(expsh.Current());
//.........这里部分代码省略.........
示例8: aCI
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_Fillet1dDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
GEOMImpl_IFillet1d aCI (aFunction);
Handle(GEOM_Function) aRefShape = aCI.GetShape();
TopoDS_Shape aShape = aRefShape->GetValue();
if (aShape.IsNull())
return 0;
if (aShape.ShapeType() != TopAbs_WIRE)
Standard_ConstructionError::Raise("Wrong arguments: polyline as wire must be given");
TopoDS_Wire aWire = TopoDS::Wire(aShape);
double rad = aCI.GetR();
if ( rad < Precision::Confusion())
return 0;
// collect vertices for make fillet
TopTools_ListOfShape aVertexList;
TopTools_MapOfShape mapShape;
int aLen = aCI.GetLength();
if ( aLen > 0 ) {
for (int ind = 1; ind <= aLen; ind++) {
TopoDS_Shape aShapeVertex;
if (GEOMImpl_ILocalOperations::GetSubShape
(aWire, aCI.GetVertex(ind), aShapeVertex))
if (mapShape.Add(aShapeVertex))
aVertexList.Append( aShapeVertex );
}
} else { // get all vertices from wire
TopExp_Explorer anExp( aWire, TopAbs_VERTEX );
for ( ; anExp.More(); anExp.Next() ) {
if (mapShape.Add(anExp.Current()))
aVertexList.Append( anExp.Current() );
}
}
if (aVertexList.IsEmpty())
Standard_ConstructionError::Raise("Invalid input no vertices to make fillet");
//INFO: this algorithm implemented in assumption that user can select both
// vertices of some edges to make fillet. In this case we should remember
// already modified initial edges to take care in next fillet step
TopTools_DataMapOfShapeShape anEdgeToEdgeMap;
//iterates on vertices, and make fillet on each couple of edges
//collect result fillet edges in list
TopTools_ListOfShape aListOfNewEdge;
// remember relation between initial and modified map
TopTools_IndexedDataMapOfShapeListOfShape aMapVToEdges;
TopExp::MapShapesAndAncestors( aWire, TopAbs_VERTEX, TopAbs_EDGE, aMapVToEdges );
TopTools_ListIteratorOfListOfShape anIt( aVertexList );
for ( ; anIt.More(); anIt.Next() ) {
TopoDS_Vertex aV = TopoDS::Vertex( anIt.Value() );
if ( aV.IsNull() || !aMapVToEdges.Contains( aV ) )
continue;
const TopTools_ListOfShape& aVertexEdges = aMapVToEdges.FindFromKey( aV );
if ( aVertexEdges.Extent() != 2 )
continue; // no input data to make fillet
TopoDS_Edge anEdge1 = TopoDS::Edge( aVertexEdges.First() );
TopoDS_Edge anEdge2 = TopoDS::Edge( aVertexEdges.Last() );
// check if initial edges already modified in previous fillet operation
if ( anEdgeToEdgeMap.IsBound( anEdge1 ) ) anEdge1 = TopoDS::Edge(anEdgeToEdgeMap.Find( anEdge1 ));
if ( anEdgeToEdgeMap.IsBound( anEdge2 ) ) anEdge2 = TopoDS::Edge(anEdgeToEdgeMap.Find( anEdge2 ));
if ( anEdge1.IsNull() || anEdge2.IsNull() || anEdge1.IsSame( anEdge2 ) )
continue; //no input data to make fillet
// create plane on 2 edges
gp_Pln aPlane;
if ( !takePlane(anEdge1, anEdge2, aV, aPlane) )
continue; // seems edges does not belong to same plane or parallel (fillet can not be build)
GEOMImpl_Fillet1d aFilletAlgo(anEdge1, anEdge2, aPlane);
if ( !aFilletAlgo.Perform(rad) )
continue; // can not create fillet with given radius
// take fillet result in given vertex
TopoDS_Edge aModifE1, aModifE2;
TopoDS_Edge aNewE = aFilletAlgo.Result(BRep_Tool::Pnt(aV), aModifE1, aModifE2);
if (aNewE.IsNull())
continue; // no result found
// add new created edges and take modified edges
aListOfNewEdge.Append( aNewE );
// check if face edges modified,
// if yes, than map to original edges (from vertex-edges list), because edges can be modified before
if (aModifE1.IsNull() || !anEdge1.IsSame( aModifE1 ))
addEdgeRelation( anEdgeToEdgeMap, TopoDS::Edge(aVertexEdges.First()), aModifE1 );
if (aModifE2.IsNull() || !anEdge2.IsSame( aModifE2 ))
addEdgeRelation( anEdgeToEdgeMap, TopoDS::Edge(aVertexEdges.Last()), aModifE2 );
}
//.........这里部分代码省略.........
示例9: if
//=======================================================================
//function : IsInternalFace
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace,
const TopoDS_Solid& theSolid,
const TopTools_IndexedDataMapOfShapeListOfShape& theMEF,
const Standard_Real theTol,
IntTools_Context& theContext)
{
Standard_Boolean bRet;
Standard_Integer aNbF;
TopoDS_Edge aEL;
TopExp_Explorer aExp;
TopTools_ListIteratorOfListOfShape aItF;
//
bRet=Standard_False;
//
// 1 Try to find an edge from theFace in theMEF
aExp.Init(theFace, TopAbs_EDGE);
for(; aExp.More(); aExp.Next()) {
const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current());
if (!theMEF.Contains(aE)) {
continue;
}
//
const TopTools_ListOfShape& aLF=theMEF.FindFromKey(aE);
aNbF=aLF.Extent();
if (!aNbF) {
return bRet; // it can not be so
}
else if (aNbF==1) {
// aE is internal edge on aLF.First()
const TopoDS_Face& aF1=TopoDS::Face(aLF.First());
bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, aE, aF1, aF1, theContext);
return bRet;
}
else if (aNbF==2) {
const TopoDS_Face& aF1=TopoDS::Face(aLF.First());
const TopoDS_Face& aF2=TopoDS::Face(aLF.Last());
//
if (aF2.IsSame(aF1) && BRep_Tool::IsClosed(aE, aF1)) {
// treat as it was for 1 face
bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, aE, aF1, aF2, theContext);
return bRet;
}
}
if (aNbF%2) {
return bRet; // it can not be so
}
else { // aNbF=2,4,6,8,...
bRet=GEOMAlgo_Tools3D::IsInternalFace(theFace, aE, aLF, theContext);
return bRet;
}
}//for(; aExp.More(); aExp.Next()) {
//
//========================================
// 2. Classify face using classifier
//
TopAbs_State aState;
TopTools_IndexedMapOfShape aBounds;
//
aState=GEOMAlgo_Tools3D::ComputeState(theFace, theSolid, theTol, aBounds, theContext);
bRet=(aState==TopAbs_IN);
//
return bRet;
}
示例10: Perform
//=======================================================================
// function: Perform
// purpose:
//=======================================================================
void GEOMAlgo_WireSplitter::Perform()
{
myErrorStatus=2;
myNothingToDo=Standard_True;
Standard_Integer index, i, aNb, aCntIn, aCntOut;
Standard_Boolean anIsIn;
Standard_Real anAngle;
BOP_ListOfEdgeInfo emptyInfo;
TopTools_ListIteratorOfListOfShape anItList;
//
// 1.Filling mySmartMap
mySmartMap.Clear();
anItList.Initialize(myEdges);
for (; anItList.More(); anItList.Next()) {
const TopoDS_Edge& anEdge = TopoDS::Edge(anItList.Value());
//
if (!BOPTools_Tools2D::HasCurveOnSurface (anEdge, myFace)) {
continue;
}
//
TopExp_Explorer anExpVerts (anEdge, TopAbs_VERTEX);
for (; anExpVerts.More(); anExpVerts.Next()) {
const TopoDS_Shape& aVertex= anExpVerts.Current();
index = mySmartMap.FindIndex(aVertex);
if (!index) {
index=mySmartMap.Add(aVertex, emptyInfo);
}
BOP_ListOfEdgeInfo& aListOfEInfo=mySmartMap(index);
BOP_EdgeInfo aEInfo;
aEInfo.SetEdge(anEdge);
TopAbs_Orientation anOr=aVertex.Orientation();
if (anOr==TopAbs_FORWARD) {
aEInfo.SetInFlag(Standard_False);
}
else if (anOr==TopAbs_REVERSED) {
aEInfo.SetInFlag(Standard_True);
}
aListOfEInfo.Append(aEInfo);
}
}
//
aNb=mySmartMap.Extent();
//
// 2. myNothingToDo
myNothingToDo=Standard_True;
for (i=1; i<=aNb; i++) {
aCntIn=0;
aCntOut=0;
const BOP_ListOfEdgeInfo& aLEInfo= mySmartMap(i);
BOP_ListIteratorOfListOfEdgeInfo anIt(aLEInfo);
for (; anIt.More(); anIt.Next()) {
const BOP_EdgeInfo& anEdgeInfo=anIt.Value();
anIsIn=anEdgeInfo.IsIn();
if (anIsIn) {
aCntIn++;
}
else {
aCntOut++;
}
}
if (aCntIn!=1 || aCntOut!=1) {
myNothingToDo=Standard_False;
break;
}
}
//
// Each vertex has one edge In and one - Out. Good. But it is not enought
// to consider that nothing to do with this. We must check edges on TShape
// coinsidence. If there are such edges there is something to do with.
//
if (myNothingToDo) {
Standard_Integer aNbE, aNbMapEE;
TopTools_IndexedDataMapOfShapeListOfShape aMapEE;
aNbE=myEdges.Extent();
anItList.Initialize(myEdges);
for (; anItList.More(); anItList.Next()) {
const TopoDS_Shape& aE = anItList.Value();
if (!aMapEE.Contains(aE)) {
TopTools_ListOfShape aLEx;
aLEx.Append(aE);
aMapEE.Add(aE, aLEx);
}
else {
//.........这里部分代码省略.........