1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
nbv
4fd471ed41 0029144: BOP PaveFiller hangs in some case
1. Method IntWalk_PWalking::ExtendLineInCommonZone(...) now is not called if the already found intersection point is on surface boundary.
As result, the intersection line going along any boundary will never be extended. It is appropriate for high-level OCCT-algorithm because they will take the boundary (not computed line) as intersection result.

2. Method IntTools_BeanFaceIntersector::ComputeRangeFromStartPoint(...) has been corrected in order to avoid infinite loop described in the issue. The algorithm of obtaining the neighborhood of the intersection point has been improved.

3. Now, IsInside(...) static function (see BOPAlgo_BuilderFace.cxx file) does not need a 2D-curve for classified edge on the face. It allows avoiding exceptions in cases when the curve creation is impossible.

4. Post-processing has been added to join several common blocks to one. Method BOPDS_DS::RemoveCommonBlock(...) has been added in order to avoid duplication after joining.
2017-10-10 11:53:01 +03:00
37 changed files with 877 additions and 736 deletions

View File

@@ -25,7 +25,7 @@ if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
endif()
endif()
if (MSVC)
if (WIN32)
add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
else()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -fPIC")

282
data/occ/Box.brep Normal file
View File

@@ -0,0 +1,282 @@
DBRep_DrawableShape
CASCADE Topology V1, (c) Matra-Datavision
Locations 0
Curve2ds 24
1 0 0 1 0
1 0 0 1 0
1 50 0 0 -1
1 0 0 0 1
1 0 -80 1 0
1 0 0 1 0
1 0 0 0 -1
1 0 0 0 1
1 0 0 1 0
1 0 77 1 0
1 50 0 0 -1
1 77 0 0 1
1 0 -80 1 0
1 0 77 1 0
1 0 0 0 -1
1 77 0 0 1
1 0 0 0 1
1 0 0 1 0
1 50 0 0 1
1 0 0 1 0
1 0 0 0 1
1 0 80 1 0
1 50 0 0 1
1 0 80 1 0
Curves 12
1 821 803 0 0 0 1
1 821 803 50 0 1 0
1 821 883 0 0 0 1
1 821 803 0 0 1 0
1 898 803 0 0 0 1
1 898 803 50 0 1 0
1 898 883 0 0 0 1
1 898 803 0 0 1 0
1 821 803 0 1 0 0
1 821 803 50 1 0 0
1 821 883 0 1 0 0
1 821 883 50 1 0 0
Polygon3D 0
PolygonOnTriangulations 0
Surfaces 6
1 821 803 0 1 0 0 0 0 1 0 -1 0
1 821 803 0 0 1 0 0 0 1 1 0 0
1 821 803 50 0 0 1 1 0 0 0 1 0
1 821 883 0 0 1 0 0 0 1 1 0 0
1 821 803 0 0 0 1 1 0 0 0 1 0
1 898 803 0 1 0 0 0 0 1 0 -1 0
Triangulations 0
TShapes 34
Ve
1e-007
821 803 50
0 0
0101100
*
Ve
1e-007
821 803 0
0 0
0101100
*
Ed
1e-007 1 1 0
1 1 0 0 50
2 1 1 0 0 50
2 2 2 0 0 50
0
0101000
-34 0 +33 0 *
Ve
1e-007
821 883 50
0 0
0101100
*
Ed
1e-007 1 1 0
1 2 0 0 80
2 3 1 0 0 80
2 4 3 0 0 80
0
0101000
-31 0 +34 0 *
Ve
1e-007
821 883 0
0 0
0101100
*
Ed
1e-007 1 1 0
1 3 0 0 50
2 5 1 0 0 50
2 6 4 0 0 50
0
0101000
-31 0 +29 0 *
Ed
1e-007 1 1 0
1 4 0 0 80
2 7 1 0 0 80
2 8 5 0 0 80
0
0101000
-29 0 +33 0 *
Wi
0101000
-32 0 -30 0 +28 0 +27 0 *
Fa
0 1e-007 1 0
0111000
+26 0 *
Ve
1e-007
898 803 50
0 0
0101100
*
Ve
1e-007
898 803 0
0 0
0101100
*
Ed
1e-007 1 1 0
1 5 0 0 50
2 9 6 0 0 50
2 10 2 0 0 50
0
0101000
-24 0 +23 0 *
Ve
1e-007
898 883 50
0 0
0101100
*
Ed
1e-007 1 1 0
1 6 0 0 80
2 11 6 0 0 80
2 12 3 0 0 80
0
0101000
-21 0 +24 0 *
Ve
1e-007
898 883 0
0 0
0101100
*
Ed
1e-007 1 1 0
1 7 0 0 50
2 13 6 0 0 50
2 14 4 0 0 50
0
0101000
-21 0 +19 0 *
Ed
1e-007 1 1 0
1 8 0 0 80
2 15 6 0 0 80
2 16 5 0 0 80
0
0101000
-19 0 +23 0 *
Wi
0101000
-22 0 -20 0 +18 0 +17 0 *
Fa
0 1e-007 6 0
0111000
+16 0 *
Ed
1e-007 1 1 0
1 9 0 0 77
2 17 2 0 0 77
2 18 5 0 0 77
0
0101000
-23 0 +33 0 *
Ed
1e-007 1 1 0
1 10 0 0 77
2 19 2 0 0 77
2 20 3 0 0 77
0
0101000
-24 0 +34 0 *
Wi
0101000
-14 0 -22 0 +13 0 +32 0 *
Fa
0 1e-007 2 0
0111000
+12 0 *
Ed
1e-007 1 1 0
1 11 0 0 77
2 21 4 0 0 77
2 22 5 0 0 77
0
0101000
-19 0 +29 0 *
Ed
1e-007 1 1 0
1 12 0 0 77
2 23 4 0 0 77
2 24 3 0 0 77
0
0101000
-21 0 +31 0 *
Wi
0101000
-10 0 -18 0 +9 0 +28 0 *
Fa
0 1e-007 4 0
0111000
+8 0 *
Wi
0101000
-27 0 -10 0 +17 0 +14 0 *
Fa
0 1e-007 5 0
0111000
+6 0 *
Wi
0101000
-30 0 -9 0 +20 0 +13 0 *
Fa
0 1e-007 3 0
0111000
+4 0 *
Sh
0101100
-25 0 +15 0 -11 0 +7 0 -5 0 +3 0 *
So
1100000
+2 0 *
+1 0

View File

@@ -593,7 +593,7 @@ void BOPAlgo_BuilderFace::PerformAreas()
// 5.2. Add unused holes to the original face
if (aNbHoles != aNbInOutMap) {
Bnd_Box aBoxF;
BRepBndLib::AddOptimal(myFace, aBoxF, Standard_True, Standard_True);
BRepBndLib::Add(myFace, aBoxF);
if (aBoxF.IsOpenXmin() || aBoxF.IsOpenXmax() ||
aBoxF.IsOpenYmin() || aBoxF.IsOpenYmax() ||
aBoxF.IsOpenZmin() || aBoxF.IsOpenZmax()) {

View File

@@ -600,7 +600,7 @@ void BOPAlgo_BuilderSolid::PerformAreas()
const TopoDS_Shape& aShell = aItLS.Value();
aSB.SetShape(aShell);
//
BRepBndLib::AddOptimal(aShell, aBox, Standard_True, Standard_True);
BRepBndLib::Add(aShell, aBox);
bIsHole=Standard_False;
//
bIsGrowth=IsGrowthShell(aShell, aMHF);
@@ -834,7 +834,7 @@ void BOPAlgo_BuilderSolid::PerformInternalShapes()
const BOPAlgo_FacePnt& aFP=aVFP(k);
const TopoDS_Face& aF=aFP.Face();
//
BRepBndLib::AddOptimal(aF, aBox, Standard_True, Standard_True);
BRepBndLib::Add(aF, aBox);
aTreeFiller.Add(k, aBox);
}
//

View File

@@ -577,7 +577,7 @@ void BOPAlgo_Builder::FillIn3DParts
continue;
}
Bnd_Box aBox;
BRepBndLib::AddOptimal(aSx, aBox, Standard_True, Standard_True);
BRepBndLib::Add(aSx, aBox);
aBox.SetGap(aBox.GetGap() + Precision::Confusion());
//
BOPAlgo_ShapeBox& aSB=aVSB.Append1();

View File

@@ -30,6 +30,7 @@
#include <BOPAlgo_Algo.hxx>
#include <BOPCol_BaseAllocator.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <Standard_Integer.hxx>
#include <BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks.hxx>
#include <Standard_Boolean.hxx>
@@ -493,7 +494,8 @@ protected:
Standard_Boolean myIsPrimary;
Standard_Boolean myAvoidBuildPCurve;
BOPAlgo_GlueEnum myGlue;
TopTools_DataMapOfShapeListOfShape myMapOfErigins;
NCollection_DataMap<Standard_Integer, NCollection_List<Handle(BOPDS_PaveBlock)>> myMapICB;
private:

View File

@@ -97,7 +97,7 @@ void BOPAlgo_PaveFiller::UpdateEdgeTolerance (const Standard_Integer nE,
const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE);
aBB.UpdateEdge(aE, aTol);
Bnd_Box& aBoxE=aSIE.ChangeBox();
BRepBndLib::AddOptimal(aE, aBoxE, Standard_True, Standard_True);
BRepBndLib::Add(aE, aBoxE);
aBoxE.SetGap(aBoxE.GetGap() + Precision::Confusion());
//
aIt.Initialize(aLI);
@@ -113,7 +113,7 @@ void BOPAlgo_PaveFiller::UpdateEdgeTolerance (const Standard_Integer nE,
aBB.UpdateVertex(aV, aTol);
BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nV);
Bnd_Box& aBoxV = aSIV.ChangeBox();
BRepBndLib::AddOptimal(aV, aBoxV, Standard_True, Standard_True);
BRepBndLib::Add(aV, aBoxV);
aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
}
}
@@ -141,7 +141,7 @@ Standard_Integer BOPAlgo_PaveFiller::UpdateVertex
aBB.UpdateVertex(aVSD, aTolNew);
BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVNew);
Bnd_Box& aBoxV = aSIV.ChangeBox();
BRepBndLib::AddOptimal(aVSD, aBoxV, Standard_True, Standard_True);
BRepBndLib::Add(aVSD, aBoxV);
aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
}
return nVNew;
@@ -165,7 +165,7 @@ Standard_Integer BOPAlgo_PaveFiller::UpdateVertex
// bounding box for the new vertex
BOPDS_ShapeInfo& aSIDS = myDS->ChangeShapeInfo(nVNew);
Bnd_Box& aBoxDS = aSIDS.ChangeBox();
BRepBndLib::AddOptimal(aVNew, aBoxDS, Standard_True, Standard_True);
BRepBndLib::Add(aVNew, aBoxDS);
aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
//
// add vertex to SD map

View File

@@ -630,7 +630,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV1);
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
aBoxDS = Bnd_Box();
BRepBndLib::AddOptimal(aV, aBoxDS, Standard_True, Standard_True);
BRepBndLib::Add(aV, aBoxDS);
aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
//
if (aDMVLV.IsBound(nV1))
@@ -681,7 +681,40 @@ void BOPAlgo_PaveFiller::MakeBlocks()
PutSEInOtherFaces();
//
myDS->FilterOfCommonBlocks();
{
NCollection_DataMap<TopoDS_Edge, Handle(BOPDS_CommonBlock)> aMapEC;
BOPDS_VectorOfListOfPaveBlock& aPBP = myDS->ChangePaveBlocksPool();
Standard_Integer aNbPBP = aPBP.Extent();
//
for (i = 0; i < aNbPBP; ++i)
{
BOPDS_ListOfPaveBlock& aLPB = aPBP(i);
BOPDS_ListIteratorOfListOfPaveBlock aItPB;
aItPB.Initialize(aLPB);
for (; aItPB.More(); aItPB.Next())
{
const Handle(BOPDS_PaveBlock) &aPB = aItPB.Value();
if (!myDS->IsCommonBlock(aPB))
continue;
const Standard_Integer anEIdx = aPB->Edge();
const TopoDS_Edge &anE = TopoDS::Edge(myDS->Shape(anEIdx));
Handle(BOPDS_CommonBlock) *aCB = aMapEC.ChangeSeek(anE);
if (!aCB)
{
aCB = aMapEC.Bound(anE, myDS->CommonBlock(aPB));
continue;
}
myDS->RemoveCommonBlock(aPB);
(*aCB)->AddPaveBlock(aPB);
myDS->SetCommonBlock(aPB, *aCB);
}
}
}
//-----------------------------------------------------scope t
aMVStick.Clear();
@@ -1045,22 +1078,11 @@ void BOPAlgo_PaveFiller::PostTreatFF
iE=myDS->Append(aSI);
}
//
// update real edge tolerance according to distances in common block if any
if (aPDS->IsCommonBlock(aPBRx)) {
const Handle(BOPDS_CommonBlock)& aCB = aPDS->CommonBlock(aPBRx);
Standard_Real *pTol = aMCBTol.ChangeSeek(aCB);
if (!pTol) {
Standard_Real aTol = BOPAlgo_Tools::ComputeToleranceOfCB(aCB, aPDS, aPF.Context());
pTol = aMCBTol.Bound(aCB, aTol);
}
//
if (aNC.Tolerance() < *pTol) {
aNC.SetTolerance(*pTol);
}
}
// append new PaveBlock to aLPBC
Handle(BOPDS_PaveBlock) *pPBC = aMEPB.ChangeSeek(iE);
if (!pPBC) {
// append new PaveBlock to aLPBC
if (!pPBC)
{
pPBC = aMEPB.Bound(iE, new BOPDS_PaveBlock());
BOPDS_Pave aPaveR1, aPaveR2;
aPaveR1 = aPBRx->Pave1();
@@ -1073,13 +1095,44 @@ void BOPAlgo_PaveFiller::PostTreatFF
(*pPBC)->SetEdge(iE);
}
//
if (bOld) {
if (bOld)
{
(*pPBC)->SetOriginalEdge(aPB1->OriginalEdge());
aDMExEdges.ChangeFind(aPB1).Append(*pPBC);
}
else {
else
{
aLPBC.Append(*pPBC);
}
// update real edge tolerance according to distances in common block if any
if (aPDS->IsCommonBlock(aPBRx))
{
const Handle(BOPDS_CommonBlock)& aCB = aPDS->CommonBlock(aPBRx);
const Standard_Integer anIdxOriE = aPB1->OriginalEdge();
if (pPBC && (anIdxOriE > 0))
{
// If original edge exists
NCollection_List<Handle(BOPDS_PaveBlock)> *aListOfPB = myMapICB.ChangeSeek(iE);
if (aListOfPB == 0)
{
aListOfPB = myMapICB.Bound(iE, NCollection_List<Handle(BOPDS_PaveBlock)>());
}
aListOfPB->Append(*pPBC);
}
Standard_Real *pTol = aMCBTol.ChangeSeek(aCB);
if (!pTol) {
Standard_Real aTol = BOPAlgo_Tools::ComputeToleranceOfCB(aCB, aPDS, aPF.Context());
pTol = aMCBTol.Bound(aCB, aTol);
}
//
if (aNC.Tolerance() < *pTol) {
aNC.SetTolerance(*pTol);
}
}
}
}
}
@@ -1536,7 +1589,7 @@ void BOPAlgo_PaveFiller::PutBoundPaveOnCurve(const TopoDS_Face& aF1,
//
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVn);
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
BRepBndLib::AddOptimal(aVn, aBoxDS, Standard_True, Standard_True);
BRepBndLib::Add(aVn, aBoxDS);
aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
//
aLVB.Append(nVn);
@@ -2154,7 +2207,7 @@ void BOPAlgo_PaveFiller::PutPaveOnCurve
//
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV);
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
BRepBndLib::AddOptimal(aV, aBoxDS, Standard_True, Standard_True);
BRepBndLib::Add(aV, aBoxDS);
aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
}
}
@@ -2417,18 +2470,35 @@ void BOPAlgo_PaveFiller::UpdateExistingPaveBlocks
anEF.SetContext(myContext);
anEF.Perform();
//
const IntTools_SequenceOfCommonPrts& aCPrts=anEF.CommonParts();
if (aCPrts.Length() == 1) {
const IntTools_SequenceOfCommonPrts& aCPrts = anEF.CommonParts();
if (aCPrts.Length() == 1)
{
Standard_Boolean bCoinc = (aCPrts(1).Type() == TopAbs_EDGE);
if (bCoinc) {
if (bCB) {
if (bCoinc)
{
if (bCB)
{
aCB = myDS->CommonBlock(aPBChangeValue);
} else {
const NCollection_List<Handle(BOPDS_PaveBlock)> *aListOfPB = myMapICB.Seek(aPBChangeValue->Edge());
if (aListOfPB)
{
NCollection_List<Handle(BOPDS_PaveBlock)>::Iterator anItr(*aListOfPB);
for (; anItr.More(); anItr.Next())
{
Handle(BOPDS_PaveBlock) &aCurrPB = anItr.ChangeValue();
aCB->AddPaveBlock(aCurrPB);
myDS->SetCommonBlock(aCurrPB, aCB);
}
}
aCB->AddFace(nF);
}
else
{
aCB = new BOPDS_CommonBlock;
aCB->AddPaveBlock(aPBChangeValue);
aCB->AddFace(nF);
myDS->SetCommonBlock(aPBChangeValue, aCB);
}
aCB->AddFace(nF);
//
aMPBIn.Add(aPBChangeValue);
}

View File

@@ -142,7 +142,7 @@ class BOPAlgo_SplitEdge : public BOPAlgo_Algo {
myV1, myT1,
myV2, myT2,
myESp);
BRepBndLib::AddOptimal(myESp, myBox, Standard_True, Standard_True);
BRepBndLib::Add(myESp, myBox);
myBox.SetGap(myBox.GetGap() + Precision::Confusion());
}
//
@@ -525,7 +525,7 @@ Standard_Integer BOPAlgo_PaveFiller::SplitEdge(const Standard_Integer nE,
aSI.SetShape(aSp);
//
Bnd_Box& aBox=aSI.ChangeBox();
BRepBndLib::AddOptimal(aSp, aBox, Standard_True, Standard_True);
BRepBndLib::Add(aSp, aBox);
aBox.SetGap(aBox.GetGap() + Precision::Confusion());
//
nSp=myDS->Append(aSI);
@@ -691,12 +691,15 @@ void BOPAlgo_PaveFiller::MakePCurves()
Standard_Integer aNb = aVMPC.Extent();
for (i = 0; i < aNb; ++i)
{
if (aVMPC(i).HasErrors())
const TopoDS_Face& aF = TopoDS::Face(aVMPC(i).Face());
const TopoDS_Edge& aE = TopoDS::Edge(aVMPC(i).Edge());
if (!BOPTools_AlgoTools2D::HasCurveOnSurface(aE, aF) ||
aVMPC(i).HasErrors())
{
TopoDS_Compound aWC;
BRep_Builder().MakeCompound(aWC);
BRep_Builder().Add(aWC, aVMPC(i).Edge());
BRep_Builder().Add(aWC, aVMPC(i).Face());
BRep_Builder().Add(aWC, aE);
BRep_Builder().Add(aWC, aF);
AddWarning(new BOPAlgo_AlertBuildingPCurveFailed(aWC));
}
}

View File

@@ -463,7 +463,7 @@ void BOPDS_DS::Init(const Standard_Real theFuzz)
}
//
Bnd_Box& aBox=aSI.ChangeBox();
BRepBndLib::AddOptimal(aE, aBox, Standard_True, Standard_True);
BRepBndLib::Add(aE, aBox);
//
const BOPCol_ListOfInteger& aLV=aSI.SubShapes();
aIt1.Initialize(aLV);
@@ -490,7 +490,7 @@ void BOPDS_DS::Init(const Standard_Real theFuzz)
const TopoDS_Shape& aS=aSI.Shape();
//
Bnd_Box& aBox=aSI.ChangeBox();
BRepBndLib::AddOptimal(aS, aBox, Standard_True, Standard_True);
BRepBndLib::Add(aS, aBox);
//
BOPCol_ListOfInteger& aLW=aSI.ChangeSubShapes();
aIt1.Initialize(aLW);
@@ -1165,6 +1165,18 @@ void BOPDS_DS::SetCommonBlock(const Handle(BOPDS_PaveBlock)& thePB,
}
}
//=======================================================================
//function : RemoveCommonBlock
//purpose :
//=======================================================================
void BOPDS_DS::RemoveCommonBlock(const Handle(BOPDS_PaveBlock)& thePB)
{
//if (!IsCommonBlock(thePB))
// return;
myMapPBCB.UnBind(thePB);
}
//
// FaceInfo
//
@@ -1786,7 +1798,7 @@ void BOPDS_DS::UpdateEdgeTolerance(const Standard_Integer nE,
aBB.UpdateEdge(aE, aTol);
BOPDS_ShapeInfo& aSIE=ChangeShapeInfo(nE);
Bnd_Box& aBoxE=aSIE.ChangeBox();
BRepBndLib::AddOptimal(aE, aBoxE, Standard_True, Standard_True);
BRepBndLib::Add(aE, aBoxE);
aBoxE.SetGap(aBoxE.GetGap() + aTolAdd);
//
const BOPCol_ListOfInteger& aLI = aSIE.SubShapes();
@@ -2107,42 +2119,3 @@ Standard_Boolean BOPDS_DS::IsValidShrunkData(const Handle(BOPDS_PaveBlock)& theP
}
return Standard_True;
}
//=======================================================================
//function : FilterOfCommonBlocks
//purpose :
//=======================================================================
void BOPDS_DS::FilterOfCommonBlocks()
{
NCollection_DataMap<TopoDS_Edge, Handle(BOPDS_CommonBlock)> aMapEC;
BOPDS_VectorOfListOfPaveBlock& aPBP = ChangePaveBlocksPool();
Standard_Integer aNbPBP = aPBP.Extent();
//
for (Standard_Integer i = 0; i < aNbPBP; ++i)
{
BOPDS_ListOfPaveBlock& aLPB = aPBP(i);
BOPDS_ListIteratorOfListOfPaveBlock aItPB;
aItPB.Initialize(aLPB);
for (; aItPB.More(); aItPB.Next())
{
const Handle(BOPDS_PaveBlock) &aPB = aItPB.Value();
if (!IsCommonBlock(aPB))
continue;
const Standard_Integer anEIdx = aPB->Edge();
const TopoDS_Edge &anE = TopoDS::Edge(Shape(anEIdx));
Handle(BOPDS_CommonBlock) *aCB = aMapEC.ChangeSeek(anE);
if (!aCB)
{
aCB = aMapEC.Bound(anE, CommonBlock(aPB));
continue;
}
myMapPBCB.UnBind(aPB);
(*aCB)->AddPaveBlock(aPB);
SetCommonBlock(aPB, *aCB);
}
}
}

View File

@@ -468,8 +468,9 @@ Standard_EXPORT virtual ~BOPDS_DS();
//! of the existing vertices have been increased.
Standard_EXPORT Standard_Boolean IsValidShrunkData(const Handle(BOPDS_PaveBlock)& thePB);
//! Combines the common-blocks and removes excess common-blocks
Standard_EXPORT void FilterOfCommonBlocks();
//! Removes the Common-block from the myMapPBCB map.
Standard_EXPORT void RemoveCommonBlock(const Handle(BOPDS_PaveBlock)& thePB);
protected:

View File

@@ -789,8 +789,7 @@ Standard_Boolean BRepTools::Write(const TopoDS_Shape& Sh,
{
ofstream os;
OSD_OpenStream(os, File, ios::out);
if (!os.is_open() || !os.good())
return Standard_False;
if (!os.rdbuf()->is_open()) return Standard_False;
Standard_Boolean isGood = (os.good() && !os.eof());
if(!isGood)

View File

@@ -141,12 +141,12 @@ static Standard_Integer save(Draw_Interpretor& di, Standard_Integer n, const cha
{
if (n <= 2) return 1;
const char* name = a[2];
ofstream os;
os.precision(15);
OSD_OpenStream(os, name, ios::out);
if (!os.is_open() || !os.good())
{
if (!os.rdbuf()->is_open()) {
di << "Cannot open file for writing "<<name;
return 1;
}

View File

@@ -1345,11 +1345,8 @@ void IntTools_BeanFaceIntersector::ComputeRangeFromStartPoint(const Standard_Boo
// if point found decide to increase aDelta using derivative of distance function
//
// (aDelta*2) and (aDelta/(3/2)).
// Use of constants 2 and 0.5 leads to infinite loop
// connected with the sequence: pointfound == TRUE ==>
// aDelta *= 2.0 ==> pointfound == FALSE ==> aDelta *= 0.5 ...
aDelta *= (pointfound) ? 2.0 : 0.6667;
// (aDelta*2) and (aDelta/(3/2)) to avoid infinite loop
aDelta = (pointfound) ? (aDelta * 2.0) : (aDelta * 0.6667);
aDelta = (aDelta < aDeltaRestrictor) ? aDelta : aDeltaRestrictor;
aCurPar = (ToIncreaseParameter) ? (aPrevPar + aDelta) : (aPrevPar - aDelta);

View File

@@ -199,7 +199,7 @@ Bnd_Box& IntTools_Context::BndBox(const TopoDS_Shape& aS)
new (pBox) Bnd_Box();
//
Bnd_Box &aBox=*pBox;
BRepBndLib::AddOptimal(aS, aBox, Standard_True, Standard_True);
BRepBndLib::Add(aS, aBox);
//
anAdr=(Standard_Address)pBox;
myBndBoxDataMap.Bind(aS, anAdr);

View File

@@ -1668,28 +1668,31 @@ Standard_Boolean IntWalk_PWalking::ExtendLineInCommonZone(const IntImp_ConstIsop
const Standard_Real VLast2 = Adaptor3d_HSurfaceTool::LastVParameter(Caro2);
Standard_Boolean bOutOfTangentZone = Standard_False;
Standard_Boolean bStop = !myIntersectionOn2S.IsTangent();
Standard_Integer dIncKey = 1;
TColStd_Array1OfReal Param(1,4);
IntWalk_StatusDeflection aStatus = IntWalk_OK;
Standard_Integer nbIterWithoutAppend = 0;
Standard_Integer nbEqualPoints = 0;
Standard_Integer parit = 0;
Standard_Integer uvit = 0;
IntSurf_SequenceOfPntOn2S aSeqOfNewPoint;
previousPoint.Parameters(Param(1), Param(2), Param(3), Param(4));
// If the point is already in the boundary
// we avoid extension (see bug #29093).
if (Param(1) - UFirst1 < ResoU1)
{
return bOutOfTangentZone;
}
if (Param(2) - VFirst1 < ResoV1)
else if (Param(2) - VFirst1 < ResoV1)
{
return bOutOfTangentZone;
}
if (Param(3) - UFirst2 < ResoU2)
else if (Param(3) - UFirst2 < ResoU2)
{
return bOutOfTangentZone;
}
if (Param(4) - VFirst2 < ResoV2)
else if (Param(4) - VFirst2 < ResoV2)
{
return bOutOfTangentZone;
}
@@ -1698,33 +1701,20 @@ Standard_Boolean IntWalk_PWalking::ExtendLineInCommonZone(const IntImp_ConstIsop
{
return bOutOfTangentZone;
}
if (Param(2) - VLast1 > -ResoV1)
else if (Param(2) - VLast1 > -ResoV1)
{
return bOutOfTangentZone;
}
else if (Param(3) - ULast2 > -ResoU2)
{
return bOutOfTangentZone;
}
else if (Param(4) - VLast2 > -ResoV2)
{
return bOutOfTangentZone;
}
if (Param(3) - ULast2 > -ResoU2)
{
return bOutOfTangentZone;
}
if (Param(4) - VLast2 > -ResoV2)
{
return bOutOfTangentZone;
}
Standard_Boolean bStop = !myIntersectionOn2S.IsTangent();
Standard_Integer dIncKey = 1;
IntWalk_StatusDeflection aStatus = IntWalk_OK;
Standard_Integer nbIterWithoutAppend = 0;
Standard_Integer nbEqualPoints = 0;
Standard_Integer parit = 0;
Standard_Integer uvit = 0;
IntSurf_SequenceOfPntOn2S aSeqOfNewPoint;
while (!bStop)
{
while (!bStop) {
nbIterWithoutAppend++;
if((nbIterWithoutAppend > 20) || (nbEqualPoints > 20)) {

View File

@@ -242,402 +242,410 @@ void MeshVS_Mesh::scanFacesForSharedNodes (const TColStd_PackedMapOfInteger& the
// Function : ComputeSelection
// Purpose :
//================================================================
void MeshVS_Mesh::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode)
void MeshVS_Mesh::ComputeSelection ( const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode )
{
OSD_Timer gTimer;
Standard_Boolean toShowComputeSelectionTime = Standard_True;
myCurrentDrawer->GetBoolean( MeshVS_DA_ComputeSelectionTime, toShowComputeSelectionTime);
if (toShowComputeSelectionTime)
Standard_Boolean ShowComputeSelectionTime = Standard_True;
myCurrentDrawer->GetBoolean( MeshVS_DA_ComputeSelectionTime, ShowComputeSelectionTime );
if ( ShowComputeSelectionTime )
{
gTimer.Reset();
gTimer.Start();
}
Standard_Integer aMaxFaceNodes = 0;
Handle(MeshVS_DataSource) aSource = GetDataSource();
if (aSource.IsNull()
|| myCurrentDrawer.IsNull()
|| !myCurrentDrawer->GetInteger (MeshVS_DA_MaxFaceNodes, aMaxFaceNodes)
|| aMaxFaceNodes <= 0)
{
Standard_Integer aMaxFaceNodes;
Handle( MeshVS_DataSource ) aSource = GetDataSource();
if ( aSource.IsNull() || myCurrentDrawer.IsNull() || !myCurrentDrawer->GetInteger
( MeshVS_DA_MaxFaceNodes, aMaxFaceNodes ) || aMaxFaceNodes<=0 )
return;
}
const Standard_Integer aMode = HasDisplayMode() ? DisplayMode() : DefaultDisplayMode();
if (myHilighter.IsNull()
|| (aMode & MeshVS_DMF_OCCMask) == 0)
{
MeshVS_Buffer aCoordsBuf (3*aMaxFaceNodes*sizeof(Standard_Real));
TColStd_Array1OfReal aCoords (aCoordsBuf, 1, 3*aMaxFaceNodes);
Standard_Integer NbNodes;
MeshVS_EntityType aType;
Standard_Address anAddr;
TColStd_MapIteratorOfPackedMapOfInteger anIter;
Standard_Real x, y, z;
Standard_Integer aMode = HasDisplayMode() ? DisplayMode() : DefaultDisplayMode();
if ( myHilighter.IsNull() || ( aMode & MeshVS_DMF_OCCMask ) == 0 )
return;
}
const TColStd_PackedMapOfInteger& anAllNodesMap = aSource->GetAllNodes();
const TColStd_PackedMapOfInteger& anAllElementsMap= aSource->GetAllElements();
//agv Standard_Integer i;
// Make two array aliases pointing to the same memory:
// - TColStd_Array1OfReal for getting values from MeshVS_DataSource interface
// - array of gp_Pnt for convenient work with array of points
MeshVS_Buffer aCoordsBuf (3 * aMaxFaceNodes * sizeof(Standard_Real));
NCollection_Array1<gp_Pnt> aPntArray (aCoordsBuf, 1, aMaxFaceNodes);
TColStd_Array1OfReal aPntArrayAsCoordArray (aCoordsBuf, 1, 3 * aMaxFaceNodes);
const TColStd_PackedMapOfInteger& anAllNodesMap = aSource->GetAllNodes();
const TColStd_PackedMapOfInteger& anAllElementsMap = aSource->GetAllElements();
if (aSource->IsAdvancedSelectionEnabled())
{
// skt: advanced mesh selection
if( aSource->IsAdvancedSelectionEnabled() ) {
Handle(MeshVS_MeshOwner) anOwner;
for (MeshVS_DataMapIteratorOfDataMapOfIntegerOwner anIt (GetOwnerMaps (Standard_False)); anIt.More(); anIt.Next())
// Get the owner if it is already created
MeshVS_DataMapIteratorOfDataMapOfIntegerOwner anIt( GetOwnerMaps( Standard_False ) );
for( ; anIt.More(); anIt.Next() )
{
anOwner = Handle(MeshVS_MeshOwner)::DownCast (anIt.Value());
if (!anOwner.IsNull())
{
// get the owner if it is already created
break;
}
anOwner = Handle(MeshVS_MeshOwner)::DownCast( anIt.Value() );
// clear selected entities
if( !anOwner.IsNull() )
break;
}
if (anOwner.IsNull())
{
// create one owner for the whole mesh and for all selection modes
anOwner = new MeshVS_MeshOwner (this, aSource, 5);
}
if( anOwner.IsNull() )
// Create one owner for the whole mesh and for all selection modes
anOwner = new MeshVS_MeshOwner( this, aSource, 5 );
// Save the owner. It will be available via GetOwnerMaps method
if (!myMeshOwners.IsBound (1))
{
myMeshOwners.Bind (1, anOwner);
}
// Create one sensitive entity. It should detect mesh entities correspondingly to selection mode
Handle(MeshVS_SensitiveMesh) aSensMesh = new MeshVS_SensitiveMesh (anOwner, theMode);
theSelection->Add (aSensMesh);
if( !myMeshOwners.IsBound( 1 ) )
myMeshOwners.Bind( 1, anOwner );
// Create one sensitive entity. It should detect mesh entities correspondingly
// to selection mode
Handle(MeshVS_SensitiveMesh) aSensMesh = new MeshVS_SensitiveMesh( anOwner, theMode );
theSelection->Add ( aSensMesh );
}
else
{
switch (theMode)
else {
switch ( theMode )
{
case MeshVS_SMF_Node:
case MeshVS_SMF_Node: // Nodes
myNodeOwners.Clear();
for ( anIter.Initialize( anAllNodesMap ); anIter.More(); anIter.Next() )
{
myNodeOwners.Clear();
for (TColStd_MapIteratorOfPackedMapOfInteger anIter (anAllNodesMap); anIter.More(); anIter.Next())
{
const Standard_Integer aKey = anIter.Key();
Standard_Integer aNbNodes = 0;
MeshVS_EntityType aType = MeshVS_ET_NONE;
if (!myDataSource->GetGeom (aKey, Standard_False, aPntArrayAsCoordArray, aNbNodes, aType))
{
continue;
}
Standard_Integer aKey = anIter.Key();
if ( !myDataSource->GetGeom ( aKey, Standard_False, aCoords, NbNodes, aType ) )
continue;
Standard_Address anAddr = myDataSource->GetAddr (aKey, Standard_False);
Handle(MeshVS_MeshEntityOwner) anOwner = new MeshVS_MeshEntityOwner (this, aKey, anAddr, aType, 5);
myNodeOwners.Bind (aKey, anOwner);
if (IsSelectableNode (aKey))
{
Handle(Select3D_SensitivePoint) aPoint = new Select3D_SensitivePoint (anOwner, aPntArray.First());
theSelection->Add (aPoint);
}
else
{
theSelection->Add (new MeshVS_DummySensitiveEntity (anOwner));
}
}
break;
anAddr = myDataSource->GetAddr ( aKey, Standard_False );
Handle (MeshVS_MeshEntityOwner) anOwner = new MeshVS_MeshEntityOwner
( this, aKey, anAddr, aType, 5 );
myNodeOwners.Bind ( aKey, anOwner );
if ( IsSelectableNode( aKey ) )
{
x = aCoords(1);
y = aCoords(2);
z = aCoords(3);
Handle (Select3D_SensitivePoint) aPoint = new Select3D_SensitivePoint
( anOwner, gp_Pnt (x, y, z) );
theSelection->Add ( aPoint );
}
else
theSelection->Add ( new MeshVS_DummySensitiveEntity ( anOwner ) );
}
case MeshVS_SMF_Mesh:
break;
case MeshVS_SMF_Mesh:
if( myWholeMeshOwner.IsNull() )
myWholeMeshOwner = new SelectMgr_EntityOwner( this );
switch (mySelectionMethod)
{
if (myWholeMeshOwner.IsNull())
{
myWholeMeshOwner = new SelectMgr_EntityOwner (this);
}
switch (mySelectionMethod)
{
case MeshVS_MSM_BOX:
{
Bnd_Box aBndBox;
BoundingBox (aBndBox);
if (!aBndBox.IsVoid())
{
theSelection->Add (new Select3D_SensitiveBox (myWholeMeshOwner, aBndBox));
}
break;
}
case MeshVS_MSM_NODES:
{
theSelection->Add (new MeshVS_CommonSensitiveEntity (myWholeMeshOwner, this, MeshVS_MSM_NODES));
break;
}
case MeshVS_MSM_PRECISE:
{
theSelection->Add (new MeshVS_CommonSensitiveEntity (myWholeMeshOwner, this, MeshVS_MSM_PRECISE));
// since MeshVS_Mesh objects can contain free edges and vertices, it is necessary to create
// separate sensitive entity for each of them
TColStd_PackedMapOfInteger aSharedNodes;
scanFacesForSharedNodes (anAllElementsMap, aMaxFaceNodes, aSharedNodes);
// create sensitive entities for free edges, if there are any
Standard_Integer aNbNodes = 0;
MeshVS_EntityType aType = MeshVS_ET_NONE;
for (TColStd_MapIteratorOfPackedMapOfInteger anElemIter (anAllElementsMap); anElemIter.More(); anElemIter.Next())
{
const Standard_Integer anElemIdx = anElemIter.Key();
if (IsSelectableElem (anElemIdx)
&& myDataSource->GetGeomType (anElemIdx, Standard_True, aType)
&& aType == MeshVS_ET_Link)
{
myDataSource->GetGeom (anElemIdx, Standard_True, aPntArrayAsCoordArray, aNbNodes, aType);
if (aNbNodes == 0)
{
continue;
}
MeshVS_Buffer aNodesBuf (aNbNodes * sizeof(Standard_Integer));
TColStd_Array1OfInteger aElemNodes (aNodesBuf, 1, aNbNodes);
if (!myDataSource->GetNodesByElement (anElemIdx, aElemNodes, aNbNodes))
{
continue;
}
MeshVS_Buffer aPntsBuf (aNbNodes * 3 * sizeof(Standard_Real));
TColgp_Array1OfPnt aLinkPnts (aPntsBuf, 1, aNbNodes);
Standard_Boolean isVertsShared = Standard_True;
for (Standard_Integer aPntIdx = 1; aPntIdx <= aNbNodes; ++aPntIdx)
{
aLinkPnts (aPntIdx) = aPntArray.Value (aPntIdx);
isVertsShared = isVertsShared && aSharedNodes.Contains (aElemNodes (aPntIdx));
aSharedNodes.Add (aElemNodes (aPntIdx));
}
if (!isVertsShared)
{
Handle(Select3D_SensitiveEntity) aLinkEnt = new Select3D_SensitiveSegment (myWholeMeshOwner, aLinkPnts.Value (1), aLinkPnts.Value (2));
theSelection->Add (aLinkEnt);
}
}
}
// create sensitive entities for free nodes, if there are any
for (TColStd_MapIteratorOfPackedMapOfInteger aNodesIter (anAllNodesMap); aNodesIter.More(); aNodesIter.Next())
{
const Standard_Integer aNodeIdx = aNodesIter.Key();
if (IsSelectableNode (aNodeIdx)
&& myDataSource->GetGeom (aNodeIdx, Standard_False, aPntArrayAsCoordArray, aNbNodes, aType)
&& !aSharedNodes.Contains (aNodeIdx))
{
Handle(Select3D_SensitiveEntity) aNodeEnt = new Select3D_SensitivePoint (myWholeMeshOwner, aPntArray.First());
theSelection->Add (aNodeEnt);
}
}
}
break;
}
break;
case MeshVS_MSM_BOX:
{
Bnd_Box aBndBox;
BoundingBox (aBndBox);
if (!aBndBox.IsVoid())
theSelection->Add (new Select3D_SensitiveBox (myWholeMeshOwner, aBndBox));
}
case MeshVS_SMF_Group:
break;
case MeshVS_MSM_NODES:
{
theSelection->Add (new MeshVS_CommonSensitiveEntity (myWholeMeshOwner, this, MeshVS_MSM_NODES));
}
break;
case MeshVS_MSM_PRECISE:
{
theSelection->Add (new MeshVS_CommonSensitiveEntity (myWholeMeshOwner, this, MeshVS_MSM_PRECISE));
// since MeshVS_Mesh objects can contain free edges and vertices, it is necessary to create
// separate sensitive entity for each of them
TColStd_PackedMapOfInteger aSharedNodes;
scanFacesForSharedNodes (anAllElementsMap, aMaxFaceNodes, aSharedNodes);
// create sensitive entities for free edges, if there are any
for (TColStd_MapIteratorOfPackedMapOfInteger anElemIter (anAllElementsMap); anElemIter.More(); anElemIter.Next())
{
const Standard_Integer anElemIdx = anElemIter.Key();
if (IsSelectableElem (anElemIdx) &&
myDataSource->GetGeomType (anElemIdx, Standard_True, aType) &&
aType == MeshVS_ET_Link)
{
myDataSource->GetGeom (anElemIdx, Standard_True, aCoords, NbNodes, aType);
if (NbNodes == 0)
continue;
MeshVS_Buffer aNodesBuf (NbNodes * sizeof (Standard_Integer));
TColStd_Array1OfInteger aElemNodes (aNodesBuf, 1, NbNodes);
if (!myDataSource->GetNodesByElement (anElemIdx, aElemNodes, NbNodes))
continue;
MeshVS_Buffer aPntsBuf (NbNodes * 3 * sizeof (Standard_Real));
TColgp_Array1OfPnt aLinkPnts (aPntsBuf, 1, NbNodes);
Standard_Boolean isVertsShared = Standard_True;
for (Standard_Integer aPntIdx = 1; aPntIdx <= NbNodes; ++aPntIdx)
{
aLinkPnts (aPntIdx) = gp_Pnt (aCoords (3 * aPntIdx - 2),
aCoords (3 * aPntIdx - 1),
aCoords (3 * aPntIdx));
isVertsShared = isVertsShared && aSharedNodes.Contains (aElemNodes (aPntIdx));
aSharedNodes.Add (aElemNodes (aPntIdx));
}
if (!isVertsShared)
{
Handle(Select3D_SensitiveEntity) aLinkEnt
= new Select3D_SensitiveSegment (myWholeMeshOwner, aLinkPnts.Value (1), aLinkPnts.Value (2));
theSelection->Add (aLinkEnt);
}
}
}
// create sensitive entities for free nodes, if there are any
for (TColStd_MapIteratorOfPackedMapOfInteger aNodesIter (anAllNodesMap); aNodesIter.More(); aNodesIter.Next())
{
const Standard_Integer aNodeIdx = aNodesIter.Key();
if (IsSelectableNode (aNodeIdx) &&
myDataSource->GetGeom (aNodeIdx, Standard_False, aCoords, NbNodes, aType) &&
!aSharedNodes.Contains (aNodeIdx))
{
Handle(Select3D_SensitiveEntity) aNodeEnt
= new Select3D_SensitivePoint (myWholeMeshOwner, gp_Pnt ( aCoords(1), aCoords(2), aCoords(3)));
theSelection->Add (aNodeEnt);
}
}
}
break;
}
case MeshVS_SMF_Group:
{
myGroupOwners.Clear();
TColStd_PackedMapOfInteger anAllGroupsMap;
aSource->GetAllGroups (anAllGroupsMap);
aSource->GetAllGroups( anAllGroupsMap );
Handle(MeshVS_HArray1OfSequenceOfInteger) aTopo;
for (TColStd_MapIteratorOfPackedMapOfInteger anIter (anAllGroupsMap); anIter.More(); anIter.Next())
Handle( MeshVS_HArray1OfSequenceOfInteger ) aTopo;
for ( anIter.Initialize( anAllGroupsMap ); anIter.More(); anIter.Next() )
{
const Standard_Integer aKeyGroup = anIter.Key();
MeshVS_EntityType aGroupType = MeshVS_ET_NONE;
Standard_Integer aKeyGroup = anIter.Key();
MeshVS_EntityType aGroupType;
TColStd_PackedMapOfInteger aGroupMap;
if (!myDataSource->GetGroup (aKeyGroup, aGroupType, aGroupMap))
{
if ( !myDataSource->GetGroup( aKeyGroup, aGroupType, aGroupMap ) )
continue;
}
Standard_Address anAddr = myDataSource->GetGroupAddr (aKeyGroup);
anAddr = myDataSource->GetGroupAddr ( aKeyGroup );
Standard_Integer aPrior = 0;
switch (aGroupType)
{
case MeshVS_ET_Volume: aPrior = 1; break;
case MeshVS_ET_Face: aPrior = 2; break;
case MeshVS_ET_Link: aPrior = 3; break;
case MeshVS_ET_0D: aPrior = 4; break;
case MeshVS_ET_Node: aPrior = 5; break;
default: break;
}
Handle(MeshVS_MeshEntityOwner) anOwner = new MeshVS_MeshEntityOwner (this, aKeyGroup, anAddr, aGroupType, aPrior, Standard_True);
myGroupOwners.Bind (aKeyGroup, anOwner);
if( aGroupType == MeshVS_ET_Volume )
aPrior = 1;
if ( aGroupType == MeshVS_ET_Face )
aPrior = 2;
else if ( aGroupType == MeshVS_ET_Link )
aPrior = 3;
else if ( aGroupType == MeshVS_ET_0D )
aPrior = 4;
else if ( aGroupType == MeshVS_ET_Node )
aPrior = 5;
Handle (MeshVS_MeshEntityOwner) anOwner = new MeshVS_MeshEntityOwner
( this, aKeyGroup, anAddr, aGroupType, aPrior, Standard_True );
myGroupOwners.Bind( aKeyGroup, anOwner );
Standard_Boolean added = Standard_False;
Standard_Integer aNbNodes = 0;
MeshVS_EntityType aType = MeshVS_ET_NONE;
for (TColStd_MapIteratorOfPackedMapOfInteger anIterMG (aGroupMap); anIterMG.More(); anIterMG.Next())
for ( TColStd_MapIteratorOfPackedMapOfInteger anIterMG (aGroupMap);
anIterMG.More(); anIterMG.Next() )
{
Standard_Integer aKey = anIterMG.Key();
if (aGroupType == MeshVS_ET_Node)
{
if (myDataSource->GetGeom (aKey, Standard_False, aPntArrayAsCoordArray, aNbNodes, aType)
&& IsSelectableNode/*!IsHiddenNode*/(aKey))
{
theSelection->Add (new Select3D_SensitivePoint (anOwner, aPntArray.First ()));
if ( aGroupType == MeshVS_ET_Node ) {
if( myDataSource->GetGeom( aKey, Standard_False, aCoords, NbNodes, aType ) &&
IsSelectableNode/*!IsHiddenNode*/( aKey ) ) {
theSelection->Add( new Select3D_SensitivePoint( anOwner, gp_Pnt ( aCoords(1), aCoords(2), aCoords(3) ) ) );
added = Standard_True;
}
}
else if (myDataSource->GetGeomType (aKey, Standard_True, aType)
&& IsSelectableElem/*!IsHiddenElem*/(aKey))
{
myDataSource->GetGeom (aKey, Standard_True, aPntArrayAsCoordArray, aNbNodes, aType);
if (aType == MeshVS_ET_Face && aNbNodes > 0) // Faces: 2D-elements
else if ( myDataSource->GetGeomType ( aKey, Standard_True, aType ) &&
IsSelectableElem/*!IsHiddenElem*/( aKey ) ) {
myDataSource->GetGeom ( aKey, Standard_True, aCoords, NbNodes, aType );
TColgp_Array1OfPnt anArr( 1, NbNodes );
for ( Standard_Integer i=1; i<=NbNodes; i++ )
{
x = aCoords(3*i-2);
y = aCoords(3*i-1);
z = aCoords(3*i);
anArr.SetValue ( i, gp_Pnt ( x, y, z ) );
}
if ( aType == MeshVS_ET_Face && NbNodes > 0 ) // Faces: 2D-elements
{
Handle(Select3D_SensitiveEntity) aSensFace;
if (aNbNodes == 3)
if (NbNodes == 3)
{
aSensFace = new Select3D_SensitiveTriangle (anOwner,
aPntArray.Value (1), aPntArray.Value (2), aPntArray.Value (3),
anArr.Value (1), anArr.Value (2), anArr.Value (3),
Select3D_TOS_INTERIOR);
}
else if (aNbNodes == 4)
else if (NbNodes == 4)
{
aSensFace = new MeshVS_SensitiveQuad (anOwner, aPntArray);
aSensFace = new MeshVS_SensitiveQuad (anOwner, anArr);
}
else
{
aSensFace = new MeshVS_SensitiveFace (anOwner, aPntArray);
aSensFace = new MeshVS_SensitiveFace (anOwner, anArr);
}
theSelection->Add (aSensFace);
added = Standard_True;
}
else if (aType == MeshVS_ET_Link && aNbNodes > 0) // Links: 1D-elements
else if ( aType == MeshVS_ET_Link && NbNodes > 0 ) // Links: 1D-elements
{
Handle (MeshVS_SensitiveSegment) aSeg = new MeshVS_SensitiveSegment (anOwner, aPntArray (1), aPntArray (2));
theSelection->Add (aSeg);
Handle (MeshVS_SensitiveSegment) aSeg = new MeshVS_SensitiveSegment
( anOwner, anArr(1), anArr(2) );
theSelection->Add ( aSeg );
added = Standard_True;
}
else if (aType == MeshVS_ET_Volume
&& aSource->Get3DGeom (aKey, aNbNodes, aTopo))
else if( aType == MeshVS_ET_Volume && aSource->Get3DGeom( aKey, NbNodes, aTopo ) )
{
Handle(MeshVS_SensitivePolyhedron) aPolyhedron = new MeshVS_SensitivePolyhedron (anOwner, aPntArray, aTopo);
theSelection->Add (aPolyhedron);
Handle( MeshVS_SensitivePolyhedron ) aPolyhedron =
new MeshVS_SensitivePolyhedron( anOwner, anArr, aTopo );
theSelection->Add( aPolyhedron );
added = Standard_True;
}
else //if ( aType == MeshVS_ET_0D ) // Custom : not only 0D-elements !!!
{
Handle(SelectBasics_SensitiveEntity) anEnt = myHilighter->CustomSensitiveEntity (anOwner, aKey);
if (!anEnt.IsNull())
{
theSelection->Add (anEnt);
Handle (SelectBasics_SensitiveEntity) anEnt =
myHilighter->CustomSensitiveEntity ( anOwner, aKey );
if (!anEnt.IsNull()) {
theSelection->Add ( anEnt );
added = Standard_True;
}
}
}
}
if (!added)
{
theSelection->Add (new MeshVS_DummySensitiveEntity (anOwner));
}
if ( !added )
theSelection->Add ( new MeshVS_DummySensitiveEntity ( anOwner ) );
}
break;
}
default: // all residuary modes
break;
default: // all residuary modes
{
Handle(MeshVS_HArray1OfSequenceOfInteger) aTopo;
Handle( MeshVS_HArray1OfSequenceOfInteger ) aTopo;
myElementOwners.Clear();
MeshVS_DataMapOfIntegerOwner* aCurMap = &my0DOwners;
if (theMode == MeshVS_ET_Link)
{
aCurMap = &myLinkOwners;
}
else if (theMode == MeshVS_ET_Face)
{
aCurMap = &myFaceOwners;
}
else if (theMode == MeshVS_ET_Volume)
{
aCurMap = &myVolumeOwners;
}
aCurMap->Clear();
MeshVS_DataMapOfIntegerOwner* CurMap = &my0DOwners;
if ( theMode == MeshVS_ET_Link )
CurMap = &myLinkOwners;
else if ( theMode == MeshVS_ET_Face )
CurMap = &myFaceOwners;
else if ( theMode == MeshVS_ET_Volume )
CurMap = &myVolumeOwners;
Standard_Integer aNbNodes = 0;
MeshVS_EntityType aType = MeshVS_ET_NONE;
for (TColStd_MapIteratorOfPackedMapOfInteger anIterMV (anAllElementsMap); anIterMV.More(); anIterMV.Next())
CurMap->Clear();
for (TColStd_MapIteratorOfPackedMapOfInteger anIterMV (anAllElementsMap);
anIterMV.More(); anIterMV.Next() )
{
Standard_Integer aKey = anIterMV.Key();
if (myDataSource->GetGeomType (aKey, Standard_True, aType)
&& theMode == aType)
if ( myDataSource->GetGeomType ( aKey, Standard_True, aType ) && theMode == aType )
{
myDataSource->GetGeom (aKey, Standard_True, aPntArrayAsCoordArray, aNbNodes, aType);
Standard_Address anAddr = myDataSource->GetAddr (aKey, Standard_True);
myDataSource->GetGeom ( aKey, Standard_True, aCoords, NbNodes, aType );
anAddr = myDataSource->GetAddr ( aKey, Standard_True );
Standard_Integer aPrior = 0;
switch (aType)
{
case MeshVS_ET_Volume: aPrior = 1; break;
case MeshVS_ET_Face: aPrior = 2; break;
case MeshVS_ET_Link: aPrior = 3; break;
case MeshVS_ET_0D: aPrior = 4; break;
default: break;
}
Handle(MeshVS_MeshEntityOwner) anOwner = new MeshVS_MeshEntityOwner (this, aKey, anAddr, aType, aPrior);
aCurMap->Bind (aKey, anOwner);
if (IsSelectableElem (aKey)) // The element is selectable
if( aType == MeshVS_ET_Volume )
aPrior = 1;
if ( aType == MeshVS_ET_Face )
aPrior = 2;
else if ( aType == MeshVS_ET_Link )
aPrior = 3;
else if ( aType == MeshVS_ET_0D )
aPrior = 4;
Handle (MeshVS_MeshEntityOwner) anOwner = new MeshVS_MeshEntityOwner
( this, aKey, anAddr, aType, aPrior );
CurMap->Bind ( aKey, anOwner );
if ( IsSelectableElem( aKey ) ) //The element is selectable
{
if (aType == MeshVS_ET_Face && aNbNodes > 0) // Faces: 2D-elements
TColgp_Array1OfPnt anArr( 1, NbNodes );
for ( Standard_Integer i=1; i<=NbNodes; i++ )
{
x = aCoords(3*i-2);
y = aCoords(3*i-1);
z = aCoords(3*i);
anArr.SetValue ( i, gp_Pnt ( x, y, z ) );
}
if ( aType == MeshVS_ET_Face && NbNodes > 0 ) // Faces: 2D-elements
{
Handle(Select3D_SensitiveEntity) aSensFace;
if (aNbNodes == 3)
if (NbNodes == 3)
{
aSensFace = new Select3D_SensitiveTriangle (anOwner,
aPntArray.Value (1), aPntArray.Value (2), aPntArray.Value (3),
anArr.Value (1), anArr.Value (2), anArr.Value (3),
Select3D_TOS_INTERIOR);
}
else if (aNbNodes == 4)
else if (NbNodes == 4)
{
aSensFace = new MeshVS_SensitiveQuad (anOwner, aPntArray);
aSensFace = new MeshVS_SensitiveQuad (anOwner, anArr);
}
else
{
aSensFace = new MeshVS_SensitiveFace (anOwner, aPntArray);
aSensFace = new MeshVS_SensitiveFace (anOwner, anArr);
}
theSelection->Add (aSensFace);
}
else if (aType == MeshVS_ET_Link && aNbNodes > 0) // Links: 1D-elements
else if ( aType == MeshVS_ET_Link && NbNodes > 0 ) // Links: 1D-elements
{
Handle(MeshVS_SensitiveSegment) aSeg = new MeshVS_SensitiveSegment (anOwner, aPntArray (1), aPntArray (2));
theSelection->Add (aSeg);
Handle (MeshVS_SensitiveSegment) aSeg = new MeshVS_SensitiveSegment
( anOwner, anArr(1), anArr(2) );
theSelection->Add ( aSeg );
}
else if (aType == MeshVS_ET_Volume
&& aSource->Get3DGeom (aKey, aNbNodes, aTopo))
else if( aType == MeshVS_ET_Volume && aSource->Get3DGeom( aKey, NbNodes, aTopo ) )
{
Handle(MeshVS_SensitivePolyhedron) aPolyhedron = new MeshVS_SensitivePolyhedron (anOwner, aPntArray, aTopo);
theSelection->Add (aPolyhedron);
Handle( MeshVS_SensitivePolyhedron ) aPolyhedron =
new MeshVS_SensitivePolyhedron( anOwner, anArr, aTopo );
theSelection->Add( aPolyhedron );
}
else //if ( aType == MeshVS_ET_0D ) // Custom : not only 0D-elements !!!
{
Handle(SelectBasics_SensitiveEntity) anEnt = myHilighter->CustomSensitiveEntity (anOwner, aKey);
Handle (SelectBasics_SensitiveEntity) anEnt =
myHilighter->CustomSensitiveEntity ( anOwner, aKey );
if (!anEnt.IsNull())
{
theSelection->Add (anEnt);
}
theSelection->Add ( anEnt );
}
}
else
{
theSelection->Add (new MeshVS_DummySensitiveEntity (anOwner));
}
theSelection->Add ( new MeshVS_DummySensitiveEntity ( anOwner ) );
}
}
break;
}
break;
}
}
StdSelect_BRepSelectionTool::PreBuildBVH (theSelection);
if (toShowComputeSelectionTime)
if ( ShowComputeSelectionTime )
{
Standard_Real sec, cpu;
Standard_Integer min, hour;
gTimer.Show (sec, min, hour, cpu);
std::cout << "SelectionMode : " << theMode << "\n";
std::cout << "Compute selection: " << sec << " sec\n";
std::cout << "Compute selection CPU : " << cpu << " sec\n\n";
gTimer.Show ( sec, min, hour, cpu );
cout << "SelectionMode : " << theMode << endl;
cout << "Compute selection: " << sec << " sec" << endl;
cout << "Compute selection CPU : " << cpu << " sec" << endl << endl;
gTimer.Stop();
}
}

View File

@@ -13,70 +13,12 @@
#ifdef _WIN32
#include <windows.h>
#include <share.h>
#endif
#include <OSD_OpenFile.hxx>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
//! Auxiliary function converting C++ ios open mode flags to C fopen() flags.
static int OSD_OpenFile_iosMode2FileFlags (::std::ios_base::openmode theMode)
{
int aFlags = 0;
if (theMode & ::std::ios_base::in)
{
aFlags |= O_RDONLY;
}
if (theMode & ::std::ios_base::out)
{
aFlags |= O_WRONLY;
aFlags |= O_CREAT;
if (theMode & ::std::ios_base::app)
{
aFlags |= O_APPEND;
}
if (theMode & ::std::ios_base::trunc)
{
aFlags |= O_TRUNC;
}
}
#ifdef _WIN32
if (theMode & ::std::ios_base::binary)
{
aFlags |= O_BINARY;
}
else
{
aFlags |= O_TEXT;
}
#endif
return aFlags;
}
// ==============================================
// function : OSD_OpenFile
// purpose : Opens file
// ==============================================
int OSD_OpenFileDescriptor (const TCollection_ExtendedString& theName,
::std::ios_base::openmode theMode)
{
int aFileDesc = -1;
const int aFlags = OSD_OpenFile_iosMode2FileFlags (theMode);
#if defined(_WIN32)
const errno_t anErrCode = _wsopen_s (&aFileDesc, theName.ToWideString(), aFlags, _SH_DENYNO, _S_IREAD | _S_IWRITE);
if (anErrCode != 0)
{
return -1;
}
#else
NCollection_Utf8String aString (theName.ToExtString());
aFileDesc = open (aString.ToCString(), aFlags);
#endif
return aFileDesc;
}
// ==============================================
// function : OSD_OpenFile

View File

@@ -25,10 +25,6 @@
#include <TCollection_ExtendedString.hxx>
#include <NCollection_UtfString.hxx>
#if defined(_WIN32) && defined(__GLIBCXX__)
#include <ext/stdio_filebuf.h> // __gnu_cxx::stdio_filebuf
#endif
//! Function opens the file.
//! @param theName name of file encoded in UTF-16
//! @param theMode opening mode
@@ -41,81 +37,6 @@ __Standard_API FILE* OSD_OpenFile (const TCollection_ExtendedString& theName,
//! @return stat.st_ctime value
__Standard_API Standard_Time OSD_FileStatCTime (const char* theName);
//! Open file descriptor for specified UTF-16 file path.
//! @param theName name of file encoded in UTF-16
//! @param theMode opening mode
//! @return file descriptor on success or -1 on error
__Standard_API int OSD_OpenFileDescriptor (const TCollection_ExtendedString& theName,
::std::ios_base::openmode theMode);
//! Function opens the file buffer.
//! @param theFileBuf file buffer to open
//! @param theName name of file encoded in UTF-16
//! @param theMode opening mode
//! @return true if success, false otherwise
inline bool OSD_OpenStream (::std::filebuf& theFileBuf,
const TCollection_ExtendedString& theName,
const std::ios_base::openmode theMode)
{
#if defined(_WIN32)
#if defined(__GLIBCXX__)
// if file buffer is already open, open() should fail according to C++ standard
if (theFileBuf.is_open())
return false;
// __gnu_cxx::stdio_filebuf is a std::filebuf providing extra constructor taking FILE* or file descriptor;
// It does not modify virtual methods or add any fields - so we can safely use swap (or move operator) here.
// MinGW does not provide open() methods taking wchar_t* or file descriptor - thus, creating __gnu_cxx::stdio_filebuf
// is the only way for opening such files since _wfopen()/_wsopen_s() from C world are available.
const int aFileDesc = OSD_OpenFileDescriptor (theName.ToWideString(), theMode);
__gnu_cxx::stdio_filebuf<char> aGccBuf (aFileDesc, theMode);
if (aGccBuf.is_open())
{
theFileBuf.swap (aGccBuf);
return true;
}
return false;
#else
return theFileBuf.open (theName.ToWideString(), theMode) != 0;
#endif
#else
// conversion to UTF-8 for linux
NCollection_Utf8String aString (theName.ToExtString());
return theFileBuf.open (aString.ToCString(), theMode) != 0;
#endif
}
//! Function opens the file stream.
//! @param theStream stream to open
//! @param theName name of file encoded in UTF-16
//! @param theMode opening mode
template <typename T>
inline void OSD_OpenStream (T& theStream,
const TCollection_ExtendedString& theName,
const std::ios_base::openmode theMode)
{
#if defined(_WIN32)
#if defined(__GLIBCXX__)
// Use hackish code for opening wchar_t* file paths on MinGW,
// which considers implementation details of std::filebuf within std::fstream/std::ifstream/std::ofstream.
// Should be removed when MinGW will be improved to support wchar_t file paths natively within C++ streams.
if (! OSD_OpenStream (*theStream.rdbuf(), theName, theMode))
{
theStream.setstate (std::ios_base::failbit);
}
else
{
theStream.clear();
}
#else
theStream.open (theName.ToWideString(), theMode);
#endif
#else
// conversion in UTF-8 for linux
NCollection_Utf8String aString (theName.ToExtString());
theStream.open (aString.ToCString(), theMode);
#endif
}
//! Function opens the file stream.
//! @param theStream stream to open
//! @param theName name of file encoded in UTF-8
@@ -125,15 +46,33 @@ inline void OSD_OpenStream (T& theStream,
const char* theName,
const std::ios_base::openmode theMode)
{
#if defined(_WIN32)
// redirect to method taking UTF-16 string
#if defined(_WIN32) && defined(_MSC_VER)
// file name is treated as UTF-8 string and converted to UTF-16 one
const TCollection_ExtendedString aFileNameW (theName, Standard_True);
OSD_OpenStream (theStream, aFileNameW, theMode);
theStream.open (aFileNameW.ToWideString(), theMode);
#else
theStream.open (theName, theMode);
#endif
}
//! Function opens the file stream.
//! @param theStream stream to open
//! @param theName name of file encoded in UTF-16
//! @param theMode opening mode
template <typename T>
inline void OSD_OpenStream (T& theStream,
const TCollection_ExtendedString& theName,
const std::ios_base::openmode theMode)
{
#if defined(_WIN32) && defined(_MSC_VER)
theStream.open (theName.ToWideString(), theMode);
#else
// conversion in UTF-8 for linux
NCollection_Utf8String aString (theName.ToExtString());
theStream.open (aString.ToCString(), theMode);
#endif
}
extern "C" {
#endif // __cplusplus

View File

@@ -65,9 +65,10 @@
#include <float.h>
static Standard_Boolean fCtrlBrk;
#if !defined(__CYGWIN32__) && !defined(__MINGW32__)
static Standard_Boolean fMsgBox;
static Standard_Boolean fFltExceptions;
static Standard_Boolean fDbgLoaded;
// used to forbid simultaneous execution of setting / executing handlers
static Standard_Mutex THE_SIGNAL_MUTEX;
@@ -75,20 +76,13 @@ static Standard_Mutex THE_SIGNAL_MUTEX;
static LONG __fastcall _osd_raise ( DWORD, LPSTR );
static BOOL WINAPI _osd_ctrl_break_handler ( DWORD );
#if ! defined(OCCT_UWP) && !defined(__MINGW32__) && !defined(__CYGWIN32__)
static Standard_Boolean fDbgLoaded;
#ifndef OCCT_UWP
static LONG _osd_debug ( void );
#endif
//# define _OSD_FPX ( _EM_INVALID | _EM_DENORMAL | _EM_ZERODIVIDE | _EM_OVERFLOW | _EM_UNDERFLOW )
# define _OSD_FPX ( _EM_INVALID | _EM_DENORMAL | _EM_ZERODIVIDE | _EM_OVERFLOW )
#ifdef OCC_CONVERT_SIGNALS
#define THROW_OR_JUMP(Type,Message) Type::NewInstance(Message)->Jump()
#else
#define THROW_OR_JUMP(Type,Message) throw Type(Message)
#endif
//=======================================================================
//function : CallHandler
//purpose :
@@ -154,8 +148,7 @@ static LONG CallHandler (DWORD dwExceptionCode,
break ;
case STATUS_NO_MEMORY:
// cout << "CallHandler : STATUS_NO_MEMORY:" << endl ;
THROW_OR_JUMP (OSD_Exception_STATUS_NO_MEMORY, "MEMORY ALLOCATION ERROR ( no room in the process heap )");
break;
throw OSD_Exception_STATUS_NO_MEMORY ( "MEMORY ALLOCATION ERROR ( no room in the process heap )" );
case EXCEPTION_ACCESS_VIOLATION:
// cout << "CallHandler : EXCEPTION_ACCESS_VIOLATION:" << endl ;
StringCchPrintfW (buffer, _countof(buffer), L"%s%s%s0x%.8p%s%s%s", L"ACCESS VIOLATION",
@@ -234,7 +227,7 @@ static LONG CallHandler (DWORD dwExceptionCode,
_fpreset();
_clearfp();
#if ! defined(OCCT_UWP) && !defined(__MINGW32__) && !defined(__CYGWIN32__)
#ifndef OCCT_UWP
MessageBeep ( MB_ICONHAND );
int aChoice = ::MessageBoxW (0, buffer, L"OCCT Exception Handler", MB_ABORTRETRYIGNORE | MB_ICONSTOP);
if (aChoice == IDRETRY)
@@ -294,7 +287,7 @@ static void SIGWntHandler (int signum, int sub_code)
break ;
default:
cout << "SIGWntHandler(default) -> throw Standard_NumericError(\"Floating Point Error\");" << endl;
THROW_OR_JUMP (Standard_NumericError, "Floating Point Error");
throw Standard_NumericError("Floating Point Error");
break ;
}
break ;
@@ -316,6 +309,7 @@ static void SIGWntHandler (int signum, int sub_code)
DebugBreak ();
#endif
}
#endif
//=======================================================================
//function : TranslateSE
@@ -348,6 +342,7 @@ static void TranslateSE( unsigned int theCode, EXCEPTION_POINTERS* theExcPtr )
// option and unless user sets his own exception handler with
// ::SetUnhandledExceptionFilter().
//=======================================================================
#if !defined(__CYGWIN32__) && !defined(__MINGW32__)
static LONG WINAPI WntHandler (EXCEPTION_POINTERS *lpXP)
{
DWORD dwExceptionCode = lpXP->ExceptionRecord->ExceptionCode;
@@ -356,6 +351,7 @@ static LONG WINAPI WntHandler (EXCEPTION_POINTERS *lpXP)
lpXP->ExceptionRecord->ExceptionInformation[1],
lpXP->ExceptionRecord->ExceptionInformation[0]);
}
#endif
//=======================================================================
//function : SetSignal
@@ -363,8 +359,11 @@ static LONG WINAPI WntHandler (EXCEPTION_POINTERS *lpXP)
//=======================================================================
void OSD::SetSignal (const Standard_Boolean theFloatingSignal)
{
#if !defined(__CYGWIN32__) && !defined(__MINGW32__)
Standard_Mutex::Sentry aSentry (THE_SIGNAL_MUTEX); // lock the mutex to prevent simultaneous handling
#if !defined(OCCT_UWP) || defined(NTDDI_WIN10_TH2)
LPTOP_LEVEL_EXCEPTION_FILTER aPreviousFilter;
OSD_Environment env ("CSF_DEBUG_MODE");
TCollection_AsciiString val = env.Value();
if (!env.Failed())
@@ -381,7 +380,7 @@ void OSD::SetSignal (const Standard_Boolean theFloatingSignal)
// when user's code is compiled with /EHs
// Replaces the existing top-level exception filter for all existing and all future threads
// in the calling process
::SetUnhandledExceptionFilter (/*(LPTOP_LEVEL_EXCEPTION_FILTER)*/ WntHandler);
aPreviousFilter = ::SetUnhandledExceptionFilter (/*(LPTOP_LEVEL_EXCEPTION_FILTER)*/ WntHandler);
#endif // NTDDI_WIN10_TH2
// Signal handlers will only be used when the method ::raise() will be used
@@ -411,6 +410,9 @@ void OSD::SetSignal (const Standard_Boolean theFloatingSignal)
else {
_controlfp (_OSD_FPX, _OSD_FPX); // JR add :
}
#else
(void)theFloatingSignal; // silence compiler warning on MinGw
#endif
} // end OSD :: SetSignal
//============================================================================
@@ -422,7 +424,7 @@ void OSD::ControlBreak () {
throw OSD_Exception_CTRL_BREAK ( "*** INTERRUPT ***" );
}
} // end OSD :: ControlBreak
#if !defined(__MINGW32__) && !defined(__CYGWIN32__)
#ifndef OCCT_UWP
//============================================================================
//==== _osd_ctrl_break_handler
@@ -437,7 +439,6 @@ static BOOL WINAPI _osd_ctrl_break_handler ( DWORD dwCode ) {
return TRUE;
} // end _osd_ctrl_break_handler
#endif
//============================================================================
//==== _osd_raise
//============================================================================
@@ -448,54 +449,54 @@ static LONG __fastcall _osd_raise ( DWORD dwCode, LPSTR msg )
switch (dwCode)
{
case EXCEPTION_ACCESS_VIOLATION:
THROW_OR_JUMP (OSD_Exception_ACCESS_VIOLATION, msg);
throw OSD_Exception_ACCESS_VIOLATION(msg);
break;
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
THROW_OR_JUMP (OSD_Exception_ARRAY_BOUNDS_EXCEEDED, msg);
throw OSD_Exception_ARRAY_BOUNDS_EXCEEDED(msg);
break;
case EXCEPTION_DATATYPE_MISALIGNMENT:
THROW_OR_JUMP (Standard_ProgramError, msg);
throw Standard_ProgramError(msg);
break;
case EXCEPTION_ILLEGAL_INSTRUCTION:
THROW_OR_JUMP (OSD_Exception_ILLEGAL_INSTRUCTION, msg);
throw OSD_Exception_ILLEGAL_INSTRUCTION(msg);
break;
case EXCEPTION_IN_PAGE_ERROR:
THROW_OR_JUMP (OSD_Exception_IN_PAGE_ERROR, msg);
throw OSD_Exception_IN_PAGE_ERROR(msg);
break;
case EXCEPTION_INT_DIVIDE_BY_ZERO:
THROW_OR_JUMP (Standard_DivideByZero, msg);
throw Standard_DivideByZero(msg);
break;
case EXCEPTION_INT_OVERFLOW:
THROW_OR_JUMP (OSD_Exception_INT_OVERFLOW, msg);
throw OSD_Exception_INT_OVERFLOW(msg);
break;
case EXCEPTION_INVALID_DISPOSITION:
THROW_OR_JUMP (OSD_Exception_INVALID_DISPOSITION, msg);
throw OSD_Exception_INVALID_DISPOSITION(msg);
break;
case EXCEPTION_NONCONTINUABLE_EXCEPTION:
THROW_OR_JUMP (OSD_Exception_NONCONTINUABLE_EXCEPTION, msg);
throw OSD_Exception_NONCONTINUABLE_EXCEPTION(msg);
break;
case EXCEPTION_PRIV_INSTRUCTION:
THROW_OR_JUMP (OSD_Exception_PRIV_INSTRUCTION, msg);
throw OSD_Exception_PRIV_INSTRUCTION(msg);
break;
case EXCEPTION_STACK_OVERFLOW:
THROW_OR_JUMP (OSD_Exception_STACK_OVERFLOW, msg);
throw OSD_Exception_STACK_OVERFLOW(msg);
break;
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
THROW_OR_JUMP (Standard_DivideByZero, msg);
throw Standard_DivideByZero(msg);
break;
case EXCEPTION_FLT_STACK_CHECK:
case EXCEPTION_FLT_OVERFLOW:
THROW_OR_JUMP (Standard_Overflow, msg);
throw Standard_Overflow(msg);
break;
case EXCEPTION_FLT_UNDERFLOW:
THROW_OR_JUMP (Standard_Underflow, msg);
throw Standard_Underflow(msg);
break;
case EXCEPTION_FLT_INVALID_OPERATION:
case EXCEPTION_FLT_DENORMAL_OPERAND:
case EXCEPTION_FLT_INEXACT_RESULT:
case STATUS_FLOAT_MULTIPLE_TRAPS:
case STATUS_FLOAT_MULTIPLE_FAULTS:
THROW_OR_JUMP (Standard_NumericError, msg);
throw Standard_NumericError(msg);
break;
default:
break;
@@ -503,10 +504,10 @@ static LONG __fastcall _osd_raise ( DWORD dwCode, LPSTR msg )
return EXCEPTION_EXECUTE_HANDLER;
} // end _osd_raise
#if ! defined(OCCT_UWP) && !defined(__MINGW32__) && !defined(__CYGWIN32__)
//============================================================================
//==== _osd_debug
//============================================================================
#ifndef OCCT_UWP
LONG _osd_debug ( void ) {
LONG action ;
@@ -589,9 +590,10 @@ LONG _osd_debug ( void ) {
return action ;
} // end _osd_debug
#endif /* ! OCCT_UWP && ! __CYGWIN__ && ! __MINGW32__ */
#else /* ! _WIN32 */
#endif
#endif
#else
//---------- All Systems except Windows NT : ----------------------------------
@@ -1029,7 +1031,7 @@ void OSD :: ControlBreak ()
{
if ( fCtrlBrk ) {
fCtrlBrk = Standard_False;
throw OSD_Exception_CTRL_BREAK ("*** INTERRUPT ***");
throw OSD_Exception_CTRL_BREAK("*** INTERRUPT ***");
}
}

View File

@@ -3401,15 +3401,6 @@ Standard_Integer RWStepAP214_ReadWriteModule::CaseStep
(types(7).IsEqual(StepType(271)))) {
return 323;
}
else if ((types(1).IsEqual(StepType(40))) &&
(types(2).IsEqual(StepType(41))) &&
(types(3).IsEqual(StepType(240))) &&
(types(4).IsEqual(StepType(49))) &&
(types(5).IsEqual(StepType(247))) &&
(types(6).IsEqual(StepType(144))) &&
(types(7).IsEqual(StepType(271)))) {
return 323;
}
}
// Added by FMA
else if (NbComp == 6) {
@@ -3639,11 +3630,6 @@ Standard_Integer RWStepAP214_ReadWriteModule::CaseStep
(types(3).IsEqual(StepType(336)))) {
return 335;
}
else if ((types(1).IsEqual(StepType(169))) &&
(types(2).IsEqual(StepType(336))) &&
(types(3).IsEqual(StepType(264)))) {
return 335;
}
else if ((types(1).IsEqual(StepType(143))) &&
(types(2).IsEqual(StepType(188))) &&
(types(3).IsEqual(StepType(246)))) {

View File

@@ -91,7 +91,7 @@ Standard_Boolean StepSelect_WorkLibrary::WriteFile
ofstream fout;
OSD_OpenStream(fout,ctx.FileName(),ios::out|ios::trunc);
if (!fout || !fout.is_open()) {
if (!fout || !fout.rdbuf()->is_open()) {
ctx.CCheck(0)->AddFail("Step File could not be created");
sout<<" Step File could not be created : " << ctx.FileName() << endl; return 0;
}

View File

@@ -8,9 +8,7 @@ puts ""
pload XDE
# words "it works" translated to Traditional Chinese by Google Translate
set s [encoding convertfrom utf-8 "\xE6\x9C\x89\xE7\x94\xA8"]
set s [encoding convertfrom unicode "\xDE\x30\xF9\x30\xF1\x30"]
igesbrep [locate_data_file bug22125_Part1_badname.igs] a *
brepiges a ${imagedir}/Part1_badname_$s.igs
igesbrep ${imagedir}/Part1_badname_$s.igs result *

View File

@@ -1,14 +0,0 @@
puts "TODO OCC22642 ALL: Faulty shapes in variables faulty_1 to faulty_"
puts "========"
puts "OCC22642"
puts "========"
puts ""
######################################################
# Refactoring of ShapeFix_Wire::FixIntersectingEdges
######################################################
restore [locate_data_file bug22642_ss_47.brep] f
fixshape result f -l -o -h -m -d -s +i -n
checkshape result

View File

@@ -1,18 +0,0 @@
puts "TODO OCC21134 ALL: Error: checkshape command does not return faulty shapes"
puts "============"
puts "OCC21134"
puts "============"
puts ""
######################################################
# checkshape command does not return faulty shapes.
######################################################
restore [locate_data_file bug21134_r.brep] res
checkshape res
set Log [bopcheck res]
if {[regexp "This shape seems to be OK" ${Log}] != 1} {
puts "Error: checkshape command does not return faulty shapes."
}

View File

@@ -1,22 +0,0 @@
puts "TODO OCC21494 ALL: Error: Intersection between cone and sphere fails"
puts "========"
puts "OCC21494"
puts "========"
puts ""
############################################
# Intersection between cone and sphere fails
############################################
pcone c 15 0 10
psphere s 10
explode c f
explode s f
mksurface sc c_1
mksurface ss s_1
intersect i sc ss
if { [info exist i_1] == 0 } {
puts "Error: Intersection between cone and sphere fails"
}

View File

@@ -1,14 +0,0 @@
puts "TODO OCC22732 ALL: Faulty shapes in variables faulty_1 to faulty_"
puts "========"
puts "OCC22732"
puts "========"
puts ""
##############################################
# Reading a STEP file produces invalid shape
##############################################
ReadStep D1 [locate_data_file bug22732_MASTER_ASSEMBLE.stp]
XGetOneShape result D1
checkshape result

View File

@@ -19,19 +19,22 @@ set aFile ${imagedir}/${test_image}.pdf
vcaps -ffp 1
vexport ${aFile} PDF
set refsize_min 144000
set refsize_max 154000
if { [checkplatform -windows] } {
set refsize 153993
} else {
set refsize 144401
}
if { [file exists ${aFile}] } {
puts "Export to PDF format successful"
puts "Export to PDF file was done"
set filesize [file size ${aFile}]
if { $filesize < $refsize_min || $filesize > $refsize_max } {
puts "Error: Export to PDF file was done but size of file is incorrect"
puts " (current = $filesize, expected to be in range \[$refsize_min, $refsize_max\])."
puts "Error: Update refsize limits if necessary."
if { $filesize != $refsize } {
puts "Error: Export to PDF file was done but size of file is incorrect (refsize = $refsize, current = $filesize)."
puts "Error: Compare content of resulting PDF file with reference."
puts "Error: Update refsize if it's necessary."
}
} else {
puts "Error: Export to PDF format has failed"
puts "Faulty : Export to PDF file was not done"
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@@ -45,19 +45,22 @@ set aFile ${imagedir}/${test_image}.pdf
vcaps -ffp 1
vexport ${aFile} PDF
set refsize_min 9060
set refsize_max 9090
if { [checkplatform -windows] } {
set refsize 9087
} else {
set refsize 9063
}
if { [file exists ${aFile}] } {
puts "Export to PDF format successful"
puts "Export to PDF file was done"
set filesize [file size ${aFile}]
if { $filesize < $refsize_min || $filesize > $refsize_max } {
puts "Error: Export to PDF file was done but size of file is incorrect"
puts " (current = $filesize, expected to be in range \[$refsize_min, $refsize_max\])."
puts "Error: Update refsize limits if necessary."
if { $filesize != $refsize } {
puts "Error: Export to PDF file was done but size of file is incorrect (refsize = $refsize, current = $filesize)."
puts "Error: Compare content of resulting PDF file with reference."
puts "Error: Update refsize if it's necessary."
}
} else {
puts "Error: Export to PDF format has failed"
puts "Faulty : Export to PDF file was not done"
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@@ -45,19 +45,22 @@ set aFile ${imagedir}/${test_image}.ps
vcaps -ffp 1
vexport ${aFile} PS
set refsize_min 9540
set refsize_max 9570
if { [checkplatform -windows] } {
set refsize 9568
} else {
set refsize 9544
}
if { [file exists ${aFile}] } {
puts "Export to PS format successful"
puts "Export to PS format was done"
set filesize [file size ${aFile}]
if { $filesize < $refsize_min || $filesize > $refsize_max } {
puts "Error: Export to PS file was done but size of file is incorrect"
puts " (current = $filesize, expected to be in range \[$refsize_min, $refsize_max\])."
puts "Error: Update refsize limits if necessary."
if { $filesize != $refsize } {
puts "Error: Export to PS file was done but size of file is incorrect (refsize = $refsize, current = $filesize)."
puts "Error: Compare content of resulting PS file with reference."
puts "Error: Update refsize if it's necessary."
}
} else {
puts "Error: Export to PS format has failed"
puts "Faulty : Export to PS format was not done"
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@@ -44,19 +44,22 @@ set aFile ${imagedir}/${test_image}.eps
vcaps -ffp 1
vexport ${aFile} EPS
set refsize_min 9480
set refsize_max 9520
if { [checkplatform -windows] } {
set refsize 9512
} else {
set refsize 9488
}
if { [file exists ${aFile}] } {
puts "Export to EPS format successful"
puts "Export to EPS file was done"
set filesize [file size ${aFile}]
if { $filesize < $refsize_min || $filesize > $refsize_max } {
puts "Error: Export to EPS file was done but size of file is incorrect"
puts " (current = $filesize, expected to be in range \[$refsize_min, $refsize_max\])."
puts "Error: Update refsize limits if necessary."
if { $filesize != $refsize } {
puts "Error: Export to EPS file was done but size of file is incorrect (refsize = $refsize, current = $filesize)."
puts "Error: Compare content of resulting EPS file with reference."
puts "Error: Update refsize if it's necessary."
}
} else {
puts "Error: Export to EPS format has failed"
puts "Faulty : Export to EPS file was not done"
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@@ -47,12 +47,12 @@ vcaps -ffp 1
vexport ${aFile} TEX
if { [file exists ${aFile}] } {
puts "Export to TEX file successful"
puts "Export to TEX file was done"
set filesize [file size ${aFile}]
puts "Size of TEX file = $filesize"
if { $filesize > 1500 } {
puts "Error : Export to TEX file succeeded but size of file is incorrect"
puts "Faulty : Export to TEX file was done but size of file is incorrect"
}
} else {
puts "Error : Export to TEX file has failed"
puts "Faulty : Export to TEX file was not done"
}

View File

@@ -45,19 +45,22 @@ set aFile ${imagedir}/${test_image}.svg
vcaps -ffp 1
vexport ${aFile} SVG
set refsize_min 12110
set refsize_max 12130
if { [checkplatform -windows] } {
set refsize 12127
} else {
set refsize 12113
}
if { [file exists ${aFile}] } {
puts "Export to SVG format successful"
puts "Export to SVG file was done"
set filesize [file size ${aFile}]
if { $filesize < $refsize_min || $filesize > $refsize_max } {
puts "Error: Export to SVG file was done but size of file is incorrect"
puts " (current = $filesize, expected to be in range \[$refsize_min, $refsize_max\])."
puts "Error: Update refsize limits if necessary."
if { $filesize != $refsize } {
puts "Error: Export to SVG file was done but size of file is incorrect (refsize = $refsize, current = $filesize)."
puts "Error: Compare content of resulting SVG file with reference."
puts "Error: Update refsize if it's necessary."
}
} else {
puts "Error: Export to SVG format has failed"
puts "Faulty : Export to SVG file was not done"
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@@ -45,19 +45,22 @@ set aFile ${imagedir}/${test_image}.pgf
vcaps -ffp 1
vexport ${aFile} PGF
set refsize_min 17790
set refsize_max 17920
if { [checkplatform -windows] } {
set refsize 17918
} else {
set refsize 17794
}
if { [file exists ${aFile}] } {
puts "Export to PGF format successful"
puts "Export to PGF file was done"
set filesize [file size ${aFile}]
if { $filesize < $refsize_min || $filesize > $refsize_max } {
puts "Error: Export to PGF file was done but size of file is incorrect"
puts " (current = $filesize, expected to be in range \[$refsize_min, $refsize_max\])."
puts "Error: Update refsize limits if necessary."
if { $filesize != $refsize } {
puts "Error: Export to PGF file was done but size of file is incorrect (refsize = $refsize, current = $filesize)."
puts "Error: Compare content of resulting PGF file with reference."
puts "Error: Update refsize if it's necessary."
}
} else {
puts "Error: Export to PGF format has failed"
puts "Faulty : Export to PGF file was not done"
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@@ -14,8 +14,10 @@ vshowfaceboundary b 1 255 0 0 10 1
vfit
vaspects -setwidth 5
if { "[vreadpixel 314 344 rgb name]" != "RED" ||
"[vreadpixel 26 267 rgb name]" != "RED" } {
if { "[vreadpixel 183 190 rgb name]" != "RED"
|| "[vreadpixel 314 344 rgb name]" != "RED"
|| "[vreadpixel 26 267 rgb name]" != "RED"
} {
puts "Error : Boundary of face is not changed"
}

View File

@@ -1,49 +1,51 @@
puts "============"
puts "0026357: Visualization - Panning zooms view if aspect ratio > 1"
puts "CR26357"
puts "============"
puts ""
#########################################################################
puts "Panning regression after fixing 0026082"
#########################################################################
box b 100 100 100
vclear
vinit View1 w=400 h=400
vinit View2 w=200 h=400
vinit View3 w=400 h=200
vclear
vaxo
vdisplay -dispMode 1 -highMode 1 b
vdisplay b
# Test panning with aspect ratio 1:1
vactivate View1
vaxo
vfit
vpan 200 0
vmoveto 399 200
if { [vreadpixel 399 200 rgb name] != "DARKTURQUOISE" } { puts "Error: incorrect color after forward panning in View1" }
checkcolor 399 200 0 1 1
vpan -200 0
vmoveto 200 200
if { [vreadpixel 200 200 rgb name] != "DARKTURQUOISE" } { puts "Error: incorrect color after backward panning in View1" }
checkcolor 200 200 0 1 1
vdump ${imagedir}/${casename}_1.png
# Test panning with aspect ratio 1:2
vactivate View2
vaxo
vfit
vpan 100 0
vmoveto 199 100
if { [vreadpixel 199 100 rgb name] != "DARKTURQUOISE" } { puts "Error: incorrect color after forward panning in View2" }
checkcolor 199 100 0 1 1
vpan -100 0
vmoveto 100 100
if { [vreadpixel 100 100 rgb name] != "DARKTURQUOISE" } { puts "Error: incorrect color after backward panning in View2" }
checkcolor 100 100 0 1 1
vdump ${imagedir}/${casename}_2.png
# Test panning with aspect ratio 2:1
vactivate View3
vaxo
vfit
vpan 200 0
vmoveto 399 100
if { [vreadpixel 399 100 rgb name] != "DARKTURQUOISE" } { puts "Error: incorrect color after forward panning in View3" }
checkcolor 399 100 0 1 1
vpan -200 0
vmoveto 200 100
if { [vreadpixel 200 100 rgb name] != "DARKTURQUOISE" } { puts "Error: incorrect color after backward panning in View3" }
checkcolor 200 100 0 1 1
vdump ${imagedir}/${casename}_3.png

View File

@@ -5,14 +5,9 @@ puts ""
pload MODELING VISUALIZATION
box b 1 2 3
# request software OpenGL implementation - which is OpenGL 1.1 in case of Windows
# (test case is useless for other systems)
vcaps -softMode 1
# disable FPE signals -- these often occur in software OpenGL drivers
dsetsignal 0
vclear
vinit View1
vsetdispmode 1