1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

Compare commits

..

2 Commits

Author SHA1 Message Date
dorlov
f501c6ffe2 0033338: Coding - IGESToBRep_CurveAndSurface's method has unreachable code
Applied minor changes in Error Message descriptions and code formatting
2023-03-27 15:40:30 +01:00
dorlov
4c8350dd52 0033338: Coding - IGESToBRep_CurveAndSurface's method has unreachable code
Fixed unreachable code in IGESToBRep_CurveAndSurface::TransferGeometry method
2023-03-27 15:36:24 +01:00
17 changed files with 425 additions and 584 deletions

View File

@@ -3228,30 +3228,6 @@ void AIS_InteractiveContext::ClearSelected (const Standard_Boolean theToUpdateVi
}
}
//=======================================================================
//function : isDetected
//purpose :
//=======================================================================
Standard_Boolean AIS_InteractiveContext::isDetected (const Handle(AIS_InteractiveObject)& theObject)
{
for (Standard_Integer aDetIter = myDetectedSeq.Lower(); aDetIter <= myDetectedSeq.Upper(); aDetIter++)
{
Handle(SelectMgr_EntityOwner) aPicked = MainSelector()->Picked(myDetectedSeq(aDetIter));
Handle(AIS_InteractiveObject) anObj;
if (!aPicked.IsNull())
{
anObj = Handle(AIS_InteractiveObject)::DownCast(aPicked->Selectable());
}
if (!anObj.IsNull()
&& anObj == theObject)
{
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : SetSelected
//purpose : Sets the whole object as selected and highlights it with selection color
@@ -3312,8 +3288,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
}
// added to avoid untimely viewer update...
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
mySelection->ClearAndSelect (anOwner, myFilters, isDetected (anObj));
mySelection->ClearAndSelect (anOwner);
if (myAutoHilight)
{
@@ -3375,7 +3350,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(SelectMgr_EntityOwner)& t
unhighlightSelected();
}
mySelection->ClearAndSelect (theOwner, myFilters, isDetected (anObject));
mySelection->ClearAndSelect (theOwner);
if (myAutoHilight)
{
Handle(Prs3d_Drawer) aCustomStyle;
@@ -3426,17 +3401,16 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
return;
}
if (!myFilters->IsOk (theOwner) && !theOwner->IsSelected())
if (!myFilters->IsOk(theOwner) && !theOwner->IsSelected())
{
return;
}
AIS_SelectionScheme aSelScheme = theOwner->IsSelected() ? AIS_SelectionScheme_Remove : AIS_SelectionScheme_Add;
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
mySelection->Select (theOwner, myFilters, aSelScheme, isDetected (anObj));
mySelection->Select (theOwner);
if (myAutoHilight)
{
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (anObj);
if (!aStatusPtr)
{
@@ -3495,8 +3469,7 @@ Standard_Boolean AIS_InteractiveContext::SetSelectedState (const Handle(SelectMg
}
else
{
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast(theEntity->Selectable());
const AIS_SelectStatus aSelStatus = mySelection->Select (theEntity, myFilters, AIS_SelectionScheme_Remove, isDetected (anObj));
const AIS_SelectStatus aSelStatus = mySelection->Select (theEntity);
theEntity->SetSelected (false);
return aSelStatus == AIS_SS_Removed;
}

View File

@@ -1302,9 +1302,6 @@ protected: //! @name internal methods
Standard_EXPORT AIS_StatusOfDetection moveTo (const Handle(V3d_View)& theView,
const Standard_Boolean theToRedrawOnUpdate);
//! Returns True if the object is detected.
Standard_EXPORT Standard_Boolean isDetected (const Handle(AIS_InteractiveObject)& theObject);
//! Helper function to unhighlight all entity owners currently highlighted with seleciton color.
Standard_EXPORT void unselectOwners (const Handle(AIS_InteractiveObject)& theObject);

View File

@@ -55,38 +55,24 @@ void AIS_Selection::Clear()
//function : Select
//purpose :
//=======================================================================
AIS_SelectStatus AIS_Selection::Select (const Handle(SelectMgr_EntityOwner)& theOwner,
const Handle(SelectMgr_Filter)& theFilter,
const AIS_SelectionScheme theSelScheme,
const Standard_Boolean theIsDetected)
AIS_SelectStatus AIS_Selection::Select (const Handle(SelectMgr_EntityOwner)& theObject)
{
if (theOwner.IsNull()
|| !theOwner->HasSelectable())
if (theObject.IsNull()
|| !theObject->HasSelectable())
{
return AIS_SS_NotDone;
}
const Standard_Boolean isDetected = theIsDetected
&& (theFilter.IsNull() || theFilter->IsOk (theOwner));
const Standard_Boolean wasSelected = theOwner->IsSelected();
const Standard_Boolean toSelect = theOwner->Select (theSelScheme, isDetected);
if (toSelect && !wasSelected)
if (!myResultMap.IsBound (theObject))
{
AIS_NListOfEntityOwner::Iterator aListIter;
myresult.Append (theOwner, aListIter);
myResultMap.Bind (theOwner, aListIter);
theOwner->SetSelected (Standard_True);
myresult.Append (theObject, aListIter);
myResultMap.Bind (theObject, aListIter);
theObject->SetSelected (Standard_True);
return AIS_SS_Added;
}
if (!toSelect && !wasSelected)
{
return AIS_SS_NotDone;
}
AIS_NListOfEntityOwner::Iterator aListIter = myResultMap.Find (theOwner);
AIS_NListOfEntityOwner::Iterator aListIter = myResultMap.Find (theObject);
if (myIterator == aListIter)
{
if (myIterator.More())
@@ -102,14 +88,14 @@ AIS_SelectStatus AIS_Selection::Select (const Handle(SelectMgr_EntityOwner)& the
// In the mode of advanced mesh selection only one owner is created for all selection modes.
// It is necessary to check the current detected entity
// and remove the owner from map only if the detected entity is the same as previous selected (IsForcedHilight call)
if (theOwner->IsForcedHilight())
if (theObject->IsForcedHilight())
{
return AIS_SS_Added;
}
myresult.Remove (aListIter);
myResultMap.UnBind (theOwner);
theOwner->SetSelected (Standard_False);
myResultMap.UnBind (theObject);
theObject->SetSelected (Standard_False);
// update list iterator for next object in <myresult> list if any
if (aListIter.More())
@@ -156,16 +142,23 @@ void AIS_Selection::SelectOwners (const AIS_NArray1OfEntityOwner& thePickedOwner
const Standard_Boolean theToAllowSelOverlap,
const Handle(SelectMgr_Filter)& theFilter)
{
(void)theToAllowSelOverlap;
if (theSelScheme == AIS_SelectionScheme_ReplaceExtra
&& thePickedOwners.Size() == myresult.Size())
(void )theToAllowSelOverlap;
switch (theSelScheme)
{
case AIS_SelectionScheme_UNKNOWN:
{
return;
}
case AIS_SelectionScheme_ReplaceExtra:
{
// If picked owners is equivalent to the selected then just clear selected
// Else go to AIS_SelectionScheme_Replace
if (thePickedOwners.Size() == myresult.Size())
{
// If picked owners is equivalent to the selected then just clear selected.
Standard_Boolean isTheSame = Standard_True;
for (AIS_NArray1OfEntityOwner::Iterator aPickedIter (thePickedOwners); aPickedIter.More(); aPickedIter.Next())
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
{
if (!myResultMap.IsBound (aPickedIter.Value()))
if (!myResultMap.IsBound (aSelIter.Value()))
{
isTheSame = Standard_False;
break;
@@ -177,18 +170,58 @@ void AIS_Selection::SelectOwners (const AIS_NArray1OfEntityOwner& thePickedOwner
return;
}
}
if (theSelScheme == AIS_SelectionScheme_Replace
|| theSelScheme == AIS_SelectionScheme_ReplaceExtra
|| theSelScheme == AIS_SelectionScheme_Clear)
}
Standard_FALLTHROUGH
case AIS_SelectionScheme_Replace:
{
Clear();
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
{
appendOwner (aSelIter.Value(), theFilter);
}
for (AIS_NArray1OfEntityOwner::Iterator aPickedIter (thePickedOwners); aPickedIter.More(); aPickedIter.Next())
return;
}
case AIS_SelectionScheme_Add:
{
const Handle(SelectMgr_EntityOwner)& anOwner = aPickedIter.Value();
Select (anOwner, theFilter, theSelScheme, true);
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
{
appendOwner (aSelIter.Value(), theFilter);
}
return;
}
case AIS_SelectionScheme_Remove:
{
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
{
if (myResultMap.IsBound (aSelIter.Value()))
{
Select (aSelIter.Value());
}
}
return;
}
case AIS_SelectionScheme_XOR:
{
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_EntityOwner)& anOwner = aSelIter.Value();
if (anOwner.IsNull()
|| !anOwner->HasSelectable()
|| !theFilter->IsOk (anOwner))
{
continue;
}
Select (anOwner);
}
return;
}
case AIS_SelectionScheme_Clear:
{
Clear();
return;
}
}
}

View File

@@ -40,30 +40,17 @@ public:
//! if the object is not yet in the selection, it will be added.
//! if the object is already in the selection, it will be removed.
//! @param[in] theOwner element to change selection state
//! @param[in] theFilter context filter
//! @param[in] theSelScheme selection scheme
//! @param[in] theIsDetected flag of object detection
//! @return result of selection
Standard_EXPORT virtual AIS_SelectStatus Select (const Handle(SelectMgr_EntityOwner)& theOwner,
const Handle(SelectMgr_Filter)& theFilter,
const AIS_SelectionScheme theSelScheme,
const Standard_Boolean theIsDetected);
Standard_EXPORT virtual AIS_SelectStatus Select (const Handle(SelectMgr_EntityOwner)& theObject);
//! the object is always add int the selection.
//! faster when the number of objects selected is great.
Standard_EXPORT virtual AIS_SelectStatus AddSelect (const Handle(SelectMgr_EntityOwner)& theObject);
//! clears the selection and adds the object in the selection.
//! @param[in] theObject element to change selection state
//! @param[in] theFilter context filter
//! @param[in] theIsDetected flag of object detection
virtual void ClearAndSelect (const Handle(SelectMgr_EntityOwner)& theObject,
const Handle(SelectMgr_Filter)& theFilter,
const Standard_Boolean theIsDetected)
virtual void ClearAndSelect (const Handle(SelectMgr_EntityOwner)& theObject)
{
Clear();
Select (theObject, theFilter, AIS_SelectionScheme_Add, theIsDetected);
Select (theObject);
}
//! checks if the object is in the selection.

View File

@@ -34,8 +34,6 @@ public:
DEFINE_STANDARD_ALLOC
//! Returns a shape built by the shape construction algorithm.
//! Does not check if the shape is built.
Standard_EXPORT virtual const TopoDS_Shape& Shape() Standard_OVERRIDE;
// Provide access to methods of protected base class BOPAlgo_Options

View File

@@ -23,7 +23,6 @@
#include <Interface_Macros.hxx>
#include <Interface_Static.hxx>
#include <Message_Msg.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <TCollection_HAsciiString.hxx>
@@ -48,7 +47,6 @@ void IGESData_VerifyDate
IGESData_IGESModel::IGESData_IGESModel ()
{
thestart = new TColStd_HSequenceOfHAsciiString();
myReShape = new ShapeBuild_ReShape();
// thecheckstx = new Interface_Check;
// thechecksem = new Interface_Check;
}
@@ -64,7 +62,6 @@ void IGESData_IGESModel::ClearHeader ()
IGESData_GlobalSection newheader; // Un peu brutal, certes
theheader = newheader;
thestart = new TColStd_HSequenceOfHAsciiString();
myReShape = new ShapeBuild_ReShape();
}

View File

@@ -22,10 +22,10 @@
class IGESData_IGESEntity;
class Interface_Check;
class ShapeBuild_ReShape;
class Standard_Transient;
class TCollection_HAsciiString;
class IGESData_IGESModel;
DEFINE_STANDARD_HANDLE(IGESData_IGESModel, Interface_InterfaceModel)
@@ -151,11 +151,8 @@ public:
//! i.e. a string "Dnn" with nn = directory entry number (2*N-1)
Standard_EXPORT Handle(TCollection_HAsciiString) StringLabel (const Handle(Standard_Transient)& ent) const Standard_OVERRIDE;
//! Gets ReShape used to store a model's shapes changes
const Handle(ShapeBuild_ReShape)& ReShape() const { return myReShape; }
//! Sets ReShape used to store a history of changes of the model's shapes
void SetReShape(const Handle(ShapeBuild_ReShape)& theReShape) { myReShape = theReShape; }
DEFINE_STANDARD_RTTIEXT(IGESData_IGESModel,Interface_InterfaceModel)
@@ -169,7 +166,7 @@ private:
Handle(TColStd_HSequenceOfHAsciiString) thestart;
IGESData_GlobalSection theheader;
Handle(ShapeBuild_ReShape) myReShape;
};

View File

@@ -131,6 +131,8 @@ static void TrimTolerances (const TopoDS_Shape& shape,
}
}
//=======================================================================
//function : Transfer
//purpose :
@@ -194,10 +196,9 @@ Handle(Transfer_Binder) IGESToBRep_Actor::Transfer
// fixing shape
Handle(Standard_Transient) info;
shape = XSAlgo::AlgoContainer()->ProcessShape(shape, theeps, CAS.GetMaxTol(),
shape = XSAlgo::AlgoContainer()->ProcessShape( shape, theeps, CAS.GetMaxTol(),
"read.iges.resource.name",
"read.iges.sequence",
info, mymodel->ReShape(),
"read.iges.sequence", info,
aPS.Next());
XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
}

View File

@@ -226,304 +226,270 @@ TopoDS_Shape IGESToBRep_CurveAndSurface::TransferCurveAndSurface
//function : TransferGeometry
//purpose :
//=======================================================================
TopoDS_Shape IGESToBRep_CurveAndSurface::TransferGeometry
(const Handle(IGESData_IGESEntity)& start,
(const Handle(IGESData_IGESEntity)& theStart,
const Message_ProgressRange& theProgress)
{
// Declaration of messages//
// DCE 22/12/98
//Message_Msg msg1005("IGES_1005"); // Software error : start IsNull.
//Message_Msg msg1015("IGES_1015"); // invalid type or exception raising (software error).
//Message_Msg msg1010("IGES_1010"); // Not sameparameter.
// Message_Msg msg1015("IGES_1015");
//Message_Msg msg210 ("XSTEP_210");
//Message_Msg msg202 ("XSTEP_202");
////////////////////////////
TopoDS_Shape res;
gp_Trsf T408;
if (start.IsNull()) {
Message_Msg msg1005("IGES_1005"); // Software error : start IsNull.
SendFail(start, msg1005);
return res;
// Declaration of messages//
// DCE 22/12/98
//Message_Msg aMsg1005("IGES_1001"); // The type of the Start is not recognized
//Message_Msg aMsg1005("IGES_1005"); // Software error : the Start IsNull.
//Message_Msg aMsg1015("IGES_1015"); // invalid type or exception raising (software error).
//Message_Msg aMsg1010("IGES_1010"); // Not sameparameter.
//Message_Msg aMsg1015("IGES_1020"); // Associated entity IsNull
//Message_Msg aMsg1015("IGES_1025"); // No shape is found for the associated entity for the type 308
//Message_Msg aMsg1015("IGES_1030"); // No shape is found for the associated entity for the type 402
//Message_Msg aMsg1015("IGES_1035"); // The conversion of a Location is not possible
//Message_Msg aMsg210 ("XSTEP_210"); // No associated entities for the type 308
//Message_Msg aMsg202 ("XSTEP_202"); // No associated entities for the type 402
////////////////////////////
TopoDS_Shape aRes;
gp_Trsf aT408;
if (theStart.IsNull())
{
const Message_Msg aMsg1005("IGES_1005"); // Software error : start IsNull.
SendFail(theStart, aMsg1005);
return aRes;
}
// Read of the DE number and the type number of the entity
Handle(TCollection_HAsciiString) label = GetModel()->StringLabel(start);
//Standard_Integer typeNumber = start->TypeNumber();
// sln 13.06.2002 OCC448: Avoid transferring invisible sub entities which
// logically depend on the one
Standard_Integer onlyvisible = Interface_Static::IVal("read.iges.onlyvisible");
const Standard_Integer anOnlyvisible = Interface_Static::IVal("read.iges.onlyvisible");
if (IGESToBRep::IsCurveAndSurface(start)) {
if(onlyvisible && start->BlankStatus() == 1)
return res;
try {
if (IGESToBRep::IsCurveAndSurface(theStart))
{
if(anOnlyvisible && theStart->BlankStatus() == 1)
return aRes;
try
{
OCC_CATCH_SIGNALS
res = TransferCurveAndSurface(start, theProgress);
aRes = TransferCurveAndSurface(theStart, theProgress);
}
catch(Standard_Failure const&) {
Message_Msg msg1015("IGES_1015");
SendFail(start, msg1015);
catch(Standard_Failure const&)
{
const Message_Msg aMsg1015("IGES_1015");
SendFail(theStart, aMsg1015);
}
return res;
return aRes;
}
//408 : SingularSubfigure
if (start->IsKind(STANDARD_TYPE(IGESBasic_SingularSubfigure)))
if (theStart->IsKind(STANDARD_TYPE(IGESBasic_SingularSubfigure)))
{
if(onlyvisible && start->BlankStatus() == 1)
return res;
if(anOnlyvisible && theStart->BlankStatus() == 1)
return aRes;
DeclareAndCast(IGESBasic_SingularSubfigure, st408, start);
Handle (IGESBasic_SubfigureDef) stsub = st408->Subfigure();
gp_XYZ trans = st408->Translation();
gp_Vec vectr(trans);
Standard_Real scunit = GetUnitFactor();
vectr.Multiply(scunit);
T408.SetTranslation(vectr);
if (st408->HasScaleFactor()) {
Standard_Real scalef = st408->ScaleFactor();
T408.SetScaleFactor(scalef);
DeclareAndCast(IGESBasic_SingularSubfigure, aSt408, theStart);
Handle (IGESBasic_SubfigureDef) aStsub = aSt408->Subfigure();
const gp_XYZ aTrans = aSt408->Translation();
gp_Vec aVectr(aTrans);
const Standard_Real aScunit = GetUnitFactor();
aVectr.Multiply(aScunit);
aT408.SetTranslation(aVectr);
if (aSt408->HasScaleFactor())
{
const Standard_Real aScalef = aSt408->ScaleFactor();
aT408.SetScaleFactor(aScalef);
}
if (HasShapeResult(stsub)) {
res = GetShapeResult(stsub);
if (HasShapeResult(aStsub))
{
aRes = GetShapeResult(aStsub);
}
else {
try {
else
{
try
{
OCC_CATCH_SIGNALS
res = TransferGeometry(stsub, theProgress);
aRes = TransferGeometry(aStsub, theProgress);
}
catch(Standard_Failure const&) {
res.Nullify();
Message_Msg msg1015("IGES_1015");
SendFail( st408, msg1015);
catch(Standard_Failure const&)
{
aRes.Nullify();
const Message_Msg aMsg1015("IGES_1015");
SendFail(aSt408, aMsg1015);
}
if (!res.IsNull()) {
SetShapeResult(stsub,res);
if (!aRes.IsNull())
{
SetShapeResult(aStsub, aRes);
}
}
}
// 308 : SubfigureDefinition
else if (start->IsKind(STANDARD_TYPE(IGESBasic_SubfigureDef))) {
DeclareAndCast(IGESBasic_SubfigureDef, st308, start);
TopoDS_Compound group;
BRep_Builder B;
B.MakeCompound (group);
if (st308->NbEntities() < 1) {
Message_Msg msg210 ("XSTEP_210");
SendFail( st308, msg210);
return res;
}
Message_ProgressScope PS (theProgress, "Subfigure item", st308->NbEntities());
for (Standard_Integer i=1; i <= st308->NbEntities() && PS.More(); i++)
else if (theStart->IsKind(STANDARD_TYPE(IGESBasic_SubfigureDef)))
{
Message_ProgressRange aRange = PS.Next();
TopoDS_Shape item;
if (st308->AssociatedEntity(i).IsNull()) {
Message_Msg msg1020("IGES_1020");
msg1020.Arg(i);
SendWarning( st308, msg1020);
DeclareAndCast(IGESBasic_SubfigureDef, aSt308, theStart);
TopoDS_Compound aGroup;
BRep_Builder aBuilder;
aBuilder.MakeCompound (aGroup);
if (aSt308->NbEntities() < 1)
{
const Message_Msg aMsg210 ("XSTEP_210");
SendFail(aSt308, aMsg210);
return aRes;
}
Message_ProgressScope aPS (theProgress, "Subfigure item", aSt308->NbEntities());
for (Standard_Integer anIndx =1; anIndx <= aSt308->NbEntities() && aPS.More(); anIndx++)
{
Message_ProgressRange aRange = aPS.Next();
TopoDS_Shape anItem;
if (aSt308->AssociatedEntity(anIndx).IsNull())
{
Message_Msg aMsg1020("IGES_1020");
aMsg1020.Arg(anIndx);
SendWarning(aSt308, aMsg1020);
continue;
}
if(onlyvisible && st308->AssociatedEntity(i)->BlankStatus() == 1 )
if(anOnlyvisible && aSt308->AssociatedEntity(anIndx)->BlankStatus() == 1)
continue;
if (HasShapeResult(st308->AssociatedEntity(i)))
if (HasShapeResult(aSt308->AssociatedEntity(anIndx)))
{
item = GetShapeResult(st308->AssociatedEntity(i));
anItem = GetShapeResult(aSt308->AssociatedEntity(anIndx));
}
else {
try {
else
{
try
{
OCC_CATCH_SIGNALS
item = TransferGeometry (st308->AssociatedEntity(i), aRange);
anItem = TransferGeometry (aSt308->AssociatedEntity(anIndx), aRange);
}
catch(Standard_Failure const&) {
item.Nullify();
Message_Msg msg1015("IGES_1015");
SendFail( st308->AssociatedEntity(i), msg1015);
}
}
if (item.IsNull()) {
Message_Msg msg1025("IGES_1025");
msg1025.Arg(i);
SendWarning (start,msg1025);
}
else {
B.Add(group, item);
SetShapeResult (st308->AssociatedEntity(i),item);
}
}
res = group;
}
else if (start->IsKind(STANDARD_TYPE(IGESBasic_Group))) {
if(onlyvisible && start->BlankStatus() == 1)
return res;
DeclareAndCast(IGESBasic_Group, st402f1, start);
TopoDS_Compound group;
BRep_Builder B;
B.MakeCompound (group);
if (st402f1->NbEntities() < 1) {
Message_Msg msg202 ("XSTEP_202");
msg202.Arg(st402f1->FormNumber());
SendFail(st402f1, msg202);
return res;
}
Message_ProgressScope PS (theProgress, "Group item", st402f1->NbEntities());
Standard_Boolean ProblemInGroup = Standard_False;
for (Standard_Integer i=1; i <= st402f1->NbEntities() && PS.More(); i++)
catch(Standard_Failure const&)
{
Message_ProgressRange aRange = PS.Next();
TopoDS_Shape item;
if (st402f1->Entity(i).IsNull()) {
Message_Msg msg1020("IGES_1020");
msg1020.Arg(i);
SendFail( st402f1, msg1020);
continue;
}
if(onlyvisible && st402f1->Entity(i)->BlankStatus() == 1)
continue;
if (HasShapeResult(st402f1->Entity(i))) {
item = GetShapeResult(st402f1->Entity(i));
}
else {
try {
OCC_CATCH_SIGNALS
item = TransferGeometry (st402f1->Entity(i), aRange);
}
catch(Standard_Failure const&) {
item.Nullify();
Message_Msg msg1015("IGES_1015");
SendFail(st402f1->Entity(i),msg1015);
anItem.Nullify();
const Message_Msg aMsg1015("IGES_1015");
SendFail(aSt308->AssociatedEntity(anIndx), aMsg1015);
}
}
if (item.IsNull()) {
//Message_Msg msg1030("IGES_1030");
//msg1030.Arg(st402f1->FormNumber());
//msg1030.Arg(i);
//SendWarning (st402f1,msg1030);
ProblemInGroup = Standard_True;
}
else {
B.Add(group, item);
SetShapeResult (st402f1->Entity(i),item);
}
}
res = group;
if(ProblemInGroup) {
Message_Msg msg1030("IGES_1030");
msg1030.Arg(st402f1->FormNumber());
SendWarning (st402f1,msg1030);
}
}
else if (start->IsKind(STANDARD_TYPE(IGESBasic_GroupWithoutBackP))) {
if(onlyvisible && start->BlankStatus() == 1)
return res;
DeclareAndCast(IGESBasic_GroupWithoutBackP, st402f7, start);
TopoDS_Compound group;
//unused Handle(TCollection_HAsciiString) label = GetModel()->StringLabel(st402f7);
BRep_Builder B;
B.MakeCompound (group);
if (st402f7->NbEntities() < 1) {
Message_Msg msg202 ("XSTEP_202");
msg202.Arg(st402f7->FormNumber());
SendFail(st402f7, msg202);
return res;
}
Message_ProgressScope PS (theProgress, "Group item", st402f7->NbEntities());
Standard_Boolean ProblemInGroup = Standard_False;
for (Standard_Integer i=1; i <= st402f7->NbEntities() && PS.More(); i++)
if (anItem.IsNull())
{
Message_ProgressRange aRange = PS.Next();
TopoDS_Shape item;
if (st402f7->Entity(i).IsNull()) {
Message_Msg msg1020("IGES_1020");
msg1020.Arg(i);
SendFail( st402f7, msg1020);
Message_Msg aMsg1025("IGES_1025");
aMsg1025.Arg(anIndx);
SendWarning (theStart, aMsg1025);
}
else
{
aBuilder.Add(aGroup, anItem);
SetShapeResult (aSt308->AssociatedEntity(anIndx), anItem);
}
}
aRes = aGroup;
}
// 402 : Group Associativity
else if (theStart->IsKind(STANDARD_TYPE(IGESBasic_Group)))
{
if(anOnlyvisible && theStart->BlankStatus() == 1)
return aRes;
DeclareAndCast(IGESBasic_Group, aSt402, theStart);
TopoDS_Compound aGroup;
BRep_Builder aBuilder;
aBuilder.MakeCompound (aGroup);
const Standard_Integer aNbEnt = aSt402->NbEntities();
if (aNbEnt < 1)
{
Message_Msg aMsg202 ("XSTEP_202");
aMsg202.Arg(aSt402->FormNumber());
SendFail(aSt402, aMsg202);
return aRes;
}
Message_ProgressScope aPS (theProgress, "Group item", aNbEnt);
Standard_Boolean aProblemInGroup = Standard_False;
for (Standard_Integer anIndx=1; anIndx <= aNbEnt && aPS.More(); anIndx++)
{
Message_ProgressRange aRange = aPS.Next();
TopoDS_Shape anItem;
if (aSt402->Entity(anIndx).IsNull())
{
Message_Msg aMsg1020("IGES_1020");
aMsg1020.Arg(anIndx);
SendFail(aSt402, aMsg1020);
continue;
}
if(onlyvisible && st402f7->Entity(i)->BlankStatus() == 1 )
if(anOnlyvisible && aSt402->Entity(anIndx)->BlankStatus() == 1)
continue;
if (HasShapeResult(st402f7->Entity(i))) {
item = GetShapeResult(st402f7->Entity(i));
if (HasShapeResult(aSt402->Entity(anIndx)))
{
anItem = GetShapeResult(aSt402->Entity(anIndx));
}
else {
try {
else
{
try
{
OCC_CATCH_SIGNALS
item = TransferGeometry (st402f7->Entity(i), aRange);
anItem = TransferGeometry (aSt402->Entity(anIndx), aRange);
}
catch(Standard_Failure const&) {
item.Nullify();
Message_Msg msg1015("IGES_1015");
SendFail(st402f7->Entity(i),msg1015);
catch(Standard_Failure const&)
{
anItem.Nullify();
const Message_Msg aMsg1015("IGES_1015");
SendFail(aSt402->Entity(anIndx), aMsg1015);
}
}
if (item.IsNull()) {
//Message_Msg msg1030("IGES_1030");
//msg1030.Arg(st402f7->FormNumber());
//msg1030.Arg(i);
//SendWarning (st402f7,msg1030);
ProblemInGroup = Standard_True;
if (anItem.IsNull())
{
aProblemInGroup = Standard_True;
}
else {
B.Add(group, item);
SetShapeResult (st402f7->Entity(i),item);
else
{
aBuilder.Add(aGroup, anItem);
SetShapeResult (aSt402->Entity(anIndx), anItem);
}
}
res = group;
if(ProblemInGroup) {
Message_Msg msg1030("IGES_1030");
msg1030.Arg(st402f7->FormNumber());
SendWarning (st402f7,msg1030);
aRes = aGroup;
if(aProblemInGroup)
{
Message_Msg aMsg1030("IGES_1030");
aMsg1030.Arg(aSt402->FormNumber());
SendWarning (aSt402, aMsg1030);
}
}
else {
Message_Msg msg1001("IGES_1001");
msg1001.Arg(start->FormNumber());
SendFail (start,msg1001);
return res;
else
{
Message_Msg aMsg1001("IGES_1001");
aMsg1001.Arg(theStart->FormNumber());
SendFail (theStart, aMsg1001);
return aRes;
}
if (start->HasTransf()) {
gp_Trsf T;
if (theStart->HasTransf())
{
gp_Trsf aT;
SetEpsilon(1.E-04);
if (IGESData_ToolLocation::ConvertLocation(GetEpsilon(),start->CompoundLocation(),
T,GetUnitFactor())) {
if (start->IsKind(STANDARD_TYPE(IGESBasic_SingularSubfigure)))
if (IGESData_ToolLocation::ConvertLocation(GetEpsilon(), theStart->CompoundLocation(),
aT, GetUnitFactor()))
{
gp_XYZ tra = T.TranslationPart();
gp_XYZ trans = T408.TranslationPart();
tra.Add(trans);
T.SetTranslationPart(tra);
Standard_Real sc = T.ScaleFactor();
Standard_Real scalef = T408.ScaleFactor();
sc = sc*scalef;
T.SetScaleFactor(sc);
if (theStart->IsKind(STANDARD_TYPE(IGESBasic_SingularSubfigure)))
{
gp_XYZ aTra = aT.TranslationPart();
const gp_XYZ aTrans = aT408.TranslationPart();
aTra.Add(aTrans);
aT.SetTranslationPart(aTra);
Standard_Real aSc = aT.ScaleFactor();
const Standard_Real aScalef = aT408.ScaleFactor();
aSc = aSc*aScalef;
aT.SetScaleFactor(aSc);
}
TopLoc_Location L(T);
res.Move(L, Standard_False);
const TopLoc_Location aLoc(aT);
aRes.Move(aLoc, Standard_False);
}
else {
Message_Msg msg1035("IGES_1035");
SendWarning (start,msg1035);
else
{
const Message_Msg aMsg1035("IGES_1035");
SendWarning (theStart, aMsg1035);
}
}
else {
if (start->IsKind(STANDARD_TYPE(IGESBasic_SingularSubfigure))) {
TopLoc_Location L(T408);
res.Move(L);
else
{
if (theStart->IsKind(STANDARD_TYPE(IGESBasic_SingularSubfigure)))
{
const TopLoc_Location aLoc(aT408);
aRes.Move(aLoc);
}
}
return res;
return aRes;
}

View File

@@ -83,51 +83,6 @@ void SelectMgr_EntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationMa
}
}
// =======================================================================
// function : Select
// purpose :
// =======================================================================
Standard_Boolean SelectMgr_EntityOwner::Select (const AIS_SelectionScheme theSelScheme,
const Standard_Boolean theIsDetected) const
{
switch (theSelScheme)
{
case AIS_SelectionScheme_UNKNOWN:
{
return myIsSelected;
}
case AIS_SelectionScheme_Replace:
{
return theIsDetected;
}
case AIS_SelectionScheme_Add:
{
return !myIsSelected || theIsDetected || IsForcedHilight();
}
case AIS_SelectionScheme_Remove:
{
return myIsSelected && !theIsDetected;
}
case AIS_SelectionScheme_XOR:
{
if (theIsDetected)
{
return !myIsSelected && !IsForcedHilight();
}
return myIsSelected;
}
case AIS_SelectionScheme_Clear:
{
return Standard_False;
}
case AIS_SelectionScheme_ReplaceExtra:
{
return theIsDetected;
}
}
return Standard_False;
}
// =======================================================================
// function : DumpJson
// purpose :

View File

@@ -17,7 +17,6 @@
#ifndef _SelectMgr_EntityOwner_HeaderFile
#define _SelectMgr_EntityOwner_HeaderFile
#include <AIS_SelectionScheme.hxx>
#include <Aspect_VKey.hxx>
#include <PrsMgr_PresentationManager.hxx>
#include <SelectMgr_SelectableObject.hxx>
@@ -140,12 +139,6 @@ public:
//! @param theIsSelected [in] shows if owner is selected.
void SetSelected (const Standard_Boolean theIsSelected) { myIsSelected = theIsSelected; }
//! If the object needs to be selected, it returns true.
//! @param[in] theSelScheme selection scheme
//! @param[in] theIsDetected flag of object detection
Standard_EXPORT Standard_Boolean Select (const AIS_SelectionScheme theSelScheme,
const Standard_Boolean theIsDetected) const;
//! Returns selection state.
Standard_DEPRECATED ("Deprecated method - IsSelected() should be used instead")
Standard_Integer State() const { return myIsSelected ? 1 : 0; }

View File

@@ -112,20 +112,18 @@ Standard_Boolean ShapeFix_Shape::Perform(const Message_ProgressRange& theProgres
TopLoc_Location nullLoc,L;
L = myShape.Location();
TopoDS_Shape aShapeNullLoc = myShape;
const Standard_Boolean aIsRecorded = Context()->IsNewShape(myShape);
aShapeNullLoc.Location(nullLoc);
if(aIsRecorded || myMapFixingShape.Contains(aShapeNullLoc))
{
if(myMapFixingShape.Contains(aShapeNullLoc)) {
myShape.Location(L, Standard_False);
myResult = Context()->Apply(myShape);
status = Standard_True;
return status;
}
myMapFixingShape.Add(aShapeNullLoc);
else myMapFixingShape.Add(aShapeNullLoc);
//---------------------------------------
myShape.Location(L, Standard_False);
TopoDS_Shape S = Context()->Apply(myShape);
if (NeedFix(myFixVertexPositionMode))
if ( NeedFix ( myFixVertexPositionMode ) )
ShapeFix::FixVertexPosition(S,Precision(),Context());
st = S.ShapeType();

View File

@@ -267,7 +267,7 @@ public:
//! Performs an analysis and reorders edges in the wire using class WireOrder.
//! Flag <theModeBoth> determines the use of miscible mode if necessary.
Standard_EXPORT Standard_Boolean FixReorder(Standard_Boolean theModeBoth = Standard_True);
Standard_EXPORT Standard_Boolean FixReorder(Standard_Boolean theModeBoth = Standard_False);
//! Applies FixSmall(num) to all edges in the wire
Standard_EXPORT Standard_Integer FixSmall (const Standard_Boolean lockvtx, const Standard_Real precsmall = 0.0);

View File

@@ -174,7 +174,7 @@ void TopoDSToStep_MakeStepWire::Init (const TopoDS_Wire& aWire,
const TopoDS_Wire ForwardWire = TopoDS::Wire (aWire.Oriented (TopAbs_FORWARD));
Handle(ShapeFix_Wire) STW = new ShapeFix_Wire (ForwardWire, aTool.CurrentFace(), Precision::Confusion());
// for toroidal like surfaces we need to use both (3d and 2d) mode to correctly reorder the edges
STW->FixReorder ();
STW->FixReorder (Standard_True);
Handle(ShapeExtend_WireData) anExtWire = STW->WireData();
//:abv 04.05.00: CAX-IF TRJ4: writing complete sphere with single vertex_loop

View File

@@ -84,127 +84,99 @@ void XSAlgo_AlgoContainer::PrepareForTransfer() const
//function : ProcessShape
//purpose :
//=======================================================================
TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape(const TopoDS_Shape& theShape,
const Standard_Real thePrec,
const Standard_Real theMaxTol,
const Standard_CString thePrscfile,
const Standard_CString thePseq,
Handle(Standard_Transient)& theInfo,
const Handle(ShapeBuild_ReShape)& theReShape,
const Message_ProgressRange& theProgress,
const Standard_Boolean theNonManifold) const
{
if (theShape.IsNull())
{
return theShape;
}
Handle(ShapeProcess_ShapeContext) aContext = Handle(ShapeProcess_ShapeContext)::DownCast(theInfo);
if (aContext.IsNull())
TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape (const TopoDS_Shape& shape,
const Standard_Real Prec,
const Standard_Real maxTol,
const Standard_CString prscfile,
const Standard_CString pseq,
Handle(Standard_Transient)& info,
const Message_ProgressRange& theProgress,
const Standard_Boolean NonManifold) const
{
if ( shape.IsNull() ) return shape;
Handle(ShapeProcess_ShapeContext) context = Handle(ShapeProcess_ShapeContext)::DownCast(info);
if ( context.IsNull() )
{
Standard_CString aRscfile = Interface_Static::CVal(thePrscfile);
if (aRscfile != nullptr && strlen(aRscfile) == 0)
Standard_CString rscfile = Interface_Static::CVal(prscfile);
if (rscfile != nullptr && strlen (rscfile) == 0)
{
aContext = new ShapeProcess_ShapeContext(theShape, nullptr);
Interface_Static::FillMap(aContext->ResourceManager()->GetMap());
context = new ShapeProcess_ShapeContext(shape, nullptr);
Interface_Static::FillMap(context->ResourceManager()->GetMap());
}
else
{
if (!aRscfile)
aRscfile = thePrscfile;
aContext = new ShapeProcess_ShapeContext(theShape, aRscfile);
if (!rscfile)
rscfile = prscfile;
context = new ShapeProcess_ShapeContext(shape, rscfile);
}
aContext->SetDetalisation(TopAbs_EDGE);
context->SetDetalisation(TopAbs_EDGE);
}
aContext->SetNonManifold(theNonManifold);
theInfo = aContext;
context->SetNonManifold(NonManifold);
info = context;
Standard_CString aSeq = Interface_Static::CVal(thePseq);
if (!aSeq) aSeq = thePseq;
Standard_CString seq = Interface_Static::CVal ( pseq );
if ( ! seq ) seq = pseq;
// if resource file is not loaded or does not define <seq>.exec.op,
// do default fixes
Handle(Resource_Manager) aRsc = aContext->ResourceManager();
TCollection_AsciiString aStr(aSeq);
aStr += ".exec.op";
if (!aRsc->Find(aStr.ToCString()))
{
Handle(Resource_Manager) rsc = context->ResourceManager();
TCollection_AsciiString str ( seq );
str += ".exec.op";
if ( ! rsc->Find ( str.ToCString() ) ) {
#ifdef OCCT_DEBUG
{
static Standard_Integer aTime = 0;
if (!aTime)
std::cout << "Warning: XSAlgo_AlgoContainer::ProcessShape(): Sequence " << aStr.ToCString() <<
" is not defined in " << thePrscfile << " resource; do default processing" << std::endl;
aTime++;
static Standard_Integer time = 0;
if ( ! time )
std::cout << "Warning: XSAlgo_AlgoContainer::ProcessShape(): Sequence " << str.ToCString() <<
" is not defined in " << prscfile << " resource; do default processing" << std::endl;
time++;
}
#endif
// if reading, do default ShapeFix
if (!strncmp(thePseq, "read.", 5))
{
if ( ! strncmp ( pseq, "read.", 5 ) ) {
try {
OCC_CATCH_SIGNALS
Handle(ShapeExtend_MsgRegistrator) aMsg = new ShapeExtend_MsgRegistrator;
Handle(ShapeFix_Shape) aSfs = ShapeAlgo::AlgoContainer()->ToolContainer()->FixShape();
aSfs->Init(theShape);
aSfs->SetMsgRegistrator(aMsg);
aSfs->SetPrecision(thePrec);
aSfs->SetMaxTolerance(theMaxTol);
aSfs->FixFaceTool()->FixWireTool()->FixSameParameterMode() = Standard_False;
aSfs->FixSolidTool()->CreateOpenSolidMode() = Standard_False;
aSfs->SetContext(theReShape);
aSfs->Perform(theProgress);
Handle(ShapeExtend_MsgRegistrator) msg = new ShapeExtend_MsgRegistrator;
Handle(ShapeFix_Shape) sfs = ShapeAlgo::AlgoContainer()->ToolContainer()->FixShape();
sfs->Init ( shape );
sfs->SetMsgRegistrator ( msg );
sfs->SetPrecision ( Prec );
sfs->SetMaxTolerance ( maxTol );
sfs->FixFaceTool()->FixWireTool()->FixSameParameterMode() = Standard_False;
sfs->FixSolidTool()->CreateOpenSolidMode() = Standard_False;
sfs->Perform(theProgress);
TopoDS_Shape aShape = aSfs->Shape();
if (!aShape.IsNull() && aShape != theShape)
{
aContext->RecordModification(aSfs->Context(), aMsg);
aContext->SetResult(aShape);
TopoDS_Shape S = sfs->Shape();
if ( ! S.IsNull() && S != shape ) {
context->RecordModification ( sfs->Context(), msg );
context->SetResult ( S );
}
}
catch (Standard_Failure const& anException)
{
catch (Standard_Failure const& anException) {
#ifdef OCCT_DEBUG
std::cout << "Error: XSAlgo_AlgoContainer::ProcessShape(): Exception in ShapeFix::Shape" << std::endl;
anException.Print(std::cout); std::cout << std::endl;
#endif
(void)anException;
}
return aContext->Result();
return context->Result();
}
// for writing, define default sequence of DirectFaces
else if (!strncmp(thePseq, "write.", 6))
{
aRsc->SetResource(aStr.ToCString(), "DirectFaces");
else if ( ! strncmp ( pseq, "write.", 6 ) ) {
rsc->SetResource ( str.ToCString(), "DirectFaces" );
}
}
// Define runtime tolerances and do Shape Processing
aRsc->SetResource("Runtime.Tolerance", thePrec);
aRsc->SetResource("Runtime.MaxTolerance", theMaxTol);
rsc->SetResource ( "Runtime.Tolerance", Prec );
rsc->SetResource ( "Runtime.MaxTolerance", maxTol );
if (!ShapeProcess::Perform(aContext, aSeq, theProgress))
return theShape; // return original shape
if ( !ShapeProcess::Perform(context, seq, theProgress) )
return shape; // return original shape
return aContext->Result();
}
//=======================================================================
//function : ProcessShape
//purpose :
//=======================================================================
TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape(const TopoDS_Shape& theShape,
const Standard_Real thePrec,
const Standard_Real theMaxTol,
const Standard_CString thePrscfile,
const Standard_CString thePseq,
Handle(Standard_Transient)& theInfo,
const Message_ProgressRange& theProgress,
const Standard_Boolean theNonManifold) const
{
Handle(ShapeBuild_ReShape) aReShape = new ShapeBuild_ReShape();
return ProcessShape(theShape, thePrec, theMaxTol, thePrscfile,
thePseq, theInfo, aReShape, theProgress,
theNonManifold);
return context->Result();
}
//=======================================================================

View File

@@ -23,7 +23,6 @@
#include <Standard_Integer.hxx>
#include <Message_ProgressRange.hxx>
class ShapeBuild_ReShape;
class XSAlgo_ToolContainer;
class TopoDS_Shape;
class TopoDS_Edge;
@@ -31,6 +30,7 @@ class TopoDS_Face;
class Transfer_TransientProcess;
class Transfer_FinderProcess;
class XSAlgo_AlgoContainer;
DEFINE_STANDARD_HANDLE(XSAlgo_AlgoContainer, Standard_Transient)
@@ -55,44 +55,16 @@ public:
Standard_EXPORT virtual void PrepareForTransfer() const;
//! Does shape processing with specified tolerances
//! @param[in] theShape shape to process
//! @param[in] thePrec basic precision and tolerance
//! @param[in] theMaxTol maximum allowed tolerance
//! @param[in] thePrscfile name of the resource file
//! @param[in] thePseq name of the sequence of operators defined in the resource file for Shape Processing
//! @param[out] theInfo information to be recorded in the translation map
//! @param[in] theProgress progress indicator
//! @param[in] theNonManifold flag to proceed with non-manifold topology
//! @return the processed shape
Standard_EXPORT virtual TopoDS_Shape ProcessShape (const TopoDS_Shape& theShape,
const Standard_Real thePrec,
const Standard_Real theMaxTol,
const Standard_CString thePrscfile,
const Standard_CString thePseq,
Handle(Standard_Transient)& theInfo,
//! and returns resulting shape and associated information
//! in the form of Transient.
//! This information should be later transmitted to
//! MergeTransferInfo in order to be recorded in the
//! translation map
Standard_EXPORT virtual TopoDS_Shape ProcessShape (
const TopoDS_Shape& shape, const Standard_Real Prec, const Standard_Real MaxTol,
const Standard_CString rscfile, const Standard_CString seq, Handle(Standard_Transient)& info,
const Message_ProgressRange& theProgress = Message_ProgressRange(),
const Standard_Boolean theNonManifold = Standard_False) const;
//! Does shape processing with specified tolerances
//! @param[in] theShape shape to process
//! @param[in] thePrec basic precision and tolerance
//! @param[in] theMaxTol maximum allowed tolerance
//! @param[in] thePrscfile name of the resource file
//! @param[in] thePseq name of the sequence of operators defined in the resource file for Shape Processing
//! @param[out] theInfo information to be recorded in the translation map
//! @param[in] theReShape tool to record the modifications of input shape
//! @param[in] theProgress progress indicator
//! @param[in] theNonManifold flag to proceed with non-manifold topology
//! @return the processed shape
Standard_EXPORT virtual TopoDS_Shape ProcessShape(const TopoDS_Shape& theShape,
const Standard_Real thePrec,
const Standard_Real theMaxTol,
const Standard_CString thePrscfile,
const Standard_CString thePseq,
Handle(Standard_Transient)& theInfo,
const Handle(ShapeBuild_ReShape)& theReShape,
const Message_ProgressRange& theProgress = Message_ProgressRange(),
const Standard_Boolean theNonManifold = Standard_False) const;
const Standard_Boolean NonManifold = Standard_False) const;
//! Checks quality of pcurve of the edge on the given face,
//! and corrects it if necessary.

View File

@@ -1,4 +1,4 @@
puts "TODO OCC23638 ALL: Faulty shapes in variables faulty_1 to faulty_1"
puts "TODO OCC23638 ALL: Faulty shapes in variables faulty_1 to faulty_"
puts "============"
puts "CR23638"
@@ -8,6 +8,8 @@ puts ""
# Reading IGES file produced invalid shape
#######################################################################
param read.surfacecurve.mode -3
igesread [locate_data_file bug23638_cadbad.igs] result *
checkshape result