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

Compare commits

..

12 Commits

Author SHA1 Message Date
dpasukhi
5d8b1a4076 0033350: Data Exchange, Step Import - Improving parsing performance
Improved performance of parser by disable checking for eof (20% parsing time)
Changed step parser's record to keep last one to fast insert into end.
2023-05-14 21:40:28 +01:00
dpasukhi
e4f00dbb7e 0033377: Data Exchange - STEPCAFControl_Reader crash in OCC 7.7.0
Added checking for null object for STEPCAFControl_Reader::SettleShapeData
2023-05-10 19:29:14 +01:00
msmediasofts
359edc7d8a 0033366: Documentation - Add description of BRepAlgoAPI_Algo::Shape()
Added description of BRepAlgoAPI_Algo::Shape()
2023-04-19 18:04:52 +01:00
mzernova
f9998f03ad 0031777: Visualization - improve SelectMgr_EntityOwner to process selection scheme
The selection scheme has been propagated to Owner object interface, and the
AIS_Selection::Select() method has been replaced to unify the logic.
2023-04-05 17:20:33 +01:00
dorlov
c479c4f6d8 0023638: Data Exchange - Reading IGES file produced invalid shape
Removed double healing of Iges group entities
Added ShapeBuild_ReShape member to the IGESData_IGESModel class, shapes which are registered in ShapeBuild_ReShape class does not process to healing
2023-03-28 01:00:42 +01:00
dpasukhi
c51df6bfd2 0033327: Data Exchange, IGES Import - SubfigureDef can't read string
Fixed problem with texted types
Added checking for null string for subfigure via XCAF transferring
2023-03-20 23:11:36 +00:00
dpasukhi
5e43274280 0033337: DRAW - Can't load plugins on Linux OS
WSL 2 have windows FileSystem and as a result we have \r symbols before \n
For this cases we can just remove \r\n (\n is a last symbol) for the node value.
2023-03-20 23:11:35 +00:00
dpasukhi
efe960751c 0033331: Data Exchange, Step Import - Unsupported Representation Items
Fixed problem with iteration on Null RI
2023-03-20 23:11:27 +00:00
anv
6b9e0dc3f8 0033345: Coding - Memory allocation operators got inaccessible
Macros was moved back to public.
2023-03-19 20:53:54 +00:00
akaftasev
2ef94c994e 0033340: Modeling Algorithm - Improve memory management performance in the PaveFiller
Changed NCollection_BaseAllocator to NCollection_IncAllocator in BOPAlgo_PaveFiller::MakeBlocks()
2023-03-19 20:53:53 +00:00
dpasukhi
1dd4b902c0 0033092: Data Exchange, Documentation - Implementation of DE_Wrapper documentation
Implement new user-guide documentation for DE Wrapper
2023-03-19 20:53:53 +00:00
akaftasev
a846d36326 0033264: Modeling Algorithms - Result of section operation is incomplete
Test case added.
2023-03-19 20:53:53 +00:00
28 changed files with 501 additions and 269 deletions

View File

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

View File

@@ -1302,6 +1302,9 @@ protected: //! @name internal methods
Standard_EXPORT AIS_StatusOfDetection moveTo (const Handle(V3d_View)& theView, Standard_EXPORT AIS_StatusOfDetection moveTo (const Handle(V3d_View)& theView,
const Standard_Boolean theToRedrawOnUpdate); 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. //! Helper function to unhighlight all entity owners currently highlighted with seleciton color.
Standard_EXPORT void unselectOwners (const Handle(AIS_InteractiveObject)& theObject); Standard_EXPORT void unselectOwners (const Handle(AIS_InteractiveObject)& theObject);

View File

@@ -55,24 +55,38 @@ void AIS_Selection::Clear()
//function : Select //function : Select
//purpose : //purpose :
//======================================================================= //=======================================================================
AIS_SelectStatus AIS_Selection::Select (const Handle(SelectMgr_EntityOwner)& theObject) AIS_SelectStatus AIS_Selection::Select (const Handle(SelectMgr_EntityOwner)& theOwner,
const Handle(SelectMgr_Filter)& theFilter,
const AIS_SelectionScheme theSelScheme,
const Standard_Boolean theIsDetected)
{ {
if (theObject.IsNull() if (theOwner.IsNull()
|| !theObject->HasSelectable()) || !theOwner->HasSelectable())
{ {
return AIS_SS_NotDone; return AIS_SS_NotDone;
} }
if (!myResultMap.IsBound (theObject)) 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)
{ {
AIS_NListOfEntityOwner::Iterator aListIter; AIS_NListOfEntityOwner::Iterator aListIter;
myresult.Append (theObject, aListIter); myresult.Append (theOwner, aListIter);
myResultMap.Bind (theObject, aListIter); myResultMap.Bind (theOwner, aListIter);
theObject->SetSelected (Standard_True); theOwner->SetSelected (Standard_True);
return AIS_SS_Added; return AIS_SS_Added;
} }
AIS_NListOfEntityOwner::Iterator aListIter = myResultMap.Find (theObject); if (!toSelect && !wasSelected)
{
return AIS_SS_NotDone;
}
AIS_NListOfEntityOwner::Iterator aListIter = myResultMap.Find (theOwner);
if (myIterator == aListIter) if (myIterator == aListIter)
{ {
if (myIterator.More()) if (myIterator.More())
@@ -88,14 +102,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. // 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 // 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) // and remove the owner from map only if the detected entity is the same as previous selected (IsForcedHilight call)
if (theObject->IsForcedHilight()) if (theOwner->IsForcedHilight())
{ {
return AIS_SS_Added; return AIS_SS_Added;
} }
myresult.Remove (aListIter); myresult.Remove (aListIter);
myResultMap.UnBind (theObject); myResultMap.UnBind (theOwner);
theObject->SetSelected (Standard_False); theOwner->SetSelected (Standard_False);
// update list iterator for next object in <myresult> list if any // update list iterator for next object in <myresult> list if any
if (aListIter.More()) if (aListIter.More())
@@ -142,23 +156,16 @@ void AIS_Selection::SelectOwners (const AIS_NArray1OfEntityOwner& thePickedOwner
const Standard_Boolean theToAllowSelOverlap, const Standard_Boolean theToAllowSelOverlap,
const Handle(SelectMgr_Filter)& theFilter) const Handle(SelectMgr_Filter)& theFilter)
{ {
(void )theToAllowSelOverlap; (void)theToAllowSelOverlap;
switch (theSelScheme)
{ if (theSelScheme == AIS_SelectionScheme_ReplaceExtra
case AIS_SelectionScheme_UNKNOWN: && thePickedOwners.Size() == myresult.Size())
{
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; Standard_Boolean isTheSame = Standard_True;
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next()) for (AIS_NArray1OfEntityOwner::Iterator aPickedIter (thePickedOwners); aPickedIter.More(); aPickedIter.Next())
{ {
if (!myResultMap.IsBound (aSelIter.Value())) if (!myResultMap.IsBound (aPickedIter.Value()))
{ {
isTheSame = Standard_False; isTheSame = Standard_False;
break; break;
@@ -170,58 +177,18 @@ void AIS_Selection::SelectOwners (const AIS_NArray1OfEntityOwner& thePickedOwner
return; return;
} }
} }
}
Standard_FALLTHROUGH if (theSelScheme == AIS_SelectionScheme_Replace
case AIS_SelectionScheme_Replace: || theSelScheme == AIS_SelectionScheme_ReplaceExtra
|| theSelScheme == AIS_SelectionScheme_Clear)
{ {
Clear(); Clear();
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
{
appendOwner (aSelIter.Value(), theFilter);
} }
return; for (AIS_NArray1OfEntityOwner::Iterator aPickedIter (thePickedOwners); aPickedIter.More(); aPickedIter.Next())
}
case AIS_SelectionScheme_Add:
{ {
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next()) const Handle(SelectMgr_EntityOwner)& anOwner = aPickedIter.Value();
{ Select (anOwner, theFilter, theSelScheme, true);
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,17 +40,30 @@ public:
//! if the object is not yet in the selection, it will be added. //! 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. //! if the object is already in the selection, it will be removed.
Standard_EXPORT virtual AIS_SelectStatus Select (const Handle(SelectMgr_EntityOwner)& theObject); //! @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);
//! the object is always add int the selection. //! the object is always add int the selection.
//! faster when the number of objects selected is great. //! faster when the number of objects selected is great.
Standard_EXPORT virtual AIS_SelectStatus AddSelect (const Handle(SelectMgr_EntityOwner)& theObject); Standard_EXPORT virtual AIS_SelectStatus AddSelect (const Handle(SelectMgr_EntityOwner)& theObject);
//! clears the selection and adds the object in the selection. //! clears the selection and adds the object in the selection.
virtual void ClearAndSelect (const Handle(SelectMgr_EntityOwner)& theObject) //! @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)
{ {
Clear(); Clear();
Select (theObject); Select (theObject, theFilter, AIS_SelectionScheme_Add, theIsDetected);
} }
//! checks if the object is in the selection. //! checks if the object is in the selection.

View File

@@ -62,6 +62,7 @@
#include <IntTools_SequenceOfCurves.hxx> #include <IntTools_SequenceOfCurves.hxx>
#include <IntTools_SequenceOfPntOn2Faces.hxx> #include <IntTools_SequenceOfPntOn2Faces.hxx>
#include <IntTools_Tools.hxx> #include <IntTools_Tools.hxx>
#include <NCollection_IncAllocator.hxx>
#include <NCollection_Vector.hxx> #include <NCollection_Vector.hxx>
#include <Precision.hxx> #include <Precision.hxx>
#include <TColStd_ListOfInteger.hxx> #include <TColStd_ListOfInteger.hxx>
@@ -578,14 +579,12 @@ void BOPAlgo_PaveFiller::MakeBlocks(const Message_ProgressRange& theRange)
Standard_Integer i, nF1, nF2, aNbC, aNbP, j; Standard_Integer i, nF1, nF2, aNbC, aNbP, j;
Standard_Integer nV1, nV2; Standard_Integer nV1, nV2;
Standard_Real aT1, aT2; Standard_Real aT1, aT2;
Handle(NCollection_BaseAllocator) aAllocator; Handle(NCollection_BaseAllocator) aAllocator = new NCollection_IncAllocator;
BOPDS_ListIteratorOfListOfPaveBlock aItLPB; BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
TopoDS_Edge aES; TopoDS_Edge aES;
Handle(BOPDS_PaveBlock) aPBOut; Handle(BOPDS_PaveBlock) aPBOut;
// //
//-----------------------------------------------------scope f //-----------------------------------------------------scope f
aAllocator=
NCollection_BaseAllocator::CommonBaseAllocator();
// //
TColStd_ListOfInteger aLSE(aAllocator), aLBV(aAllocator); TColStd_ListOfInteger aLSE(aAllocator), aLBV(aAllocator);
TColStd_MapOfInteger aMVOnIn(100, aAllocator), aMVCommon(100, aAllocator), TColStd_MapOfInteger aMVOnIn(100, aAllocator), aMVCommon(100, aAllocator),

View File

@@ -34,6 +34,8 @@ public:
DEFINE_STANDARD_ALLOC 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; Standard_EXPORT virtual const TopoDS_Shape& Shape() Standard_OVERRIDE;
// Provide access to methods of protected base class BOPAlgo_Options // Provide access to methods of protected base class BOPAlgo_Options

View File

@@ -322,7 +322,8 @@ Standard_Boolean IGESCAFControl_Reader::Transfer (const Handle(TDocStd_Document)
//Checks that current entity is a subfigure //Checks that current entity is a subfigure
Handle(IGESBasic_SubfigureDef) aSubfigure = Handle(IGESBasic_SubfigureDef)::DownCast (ent); Handle(IGESBasic_SubfigureDef) aSubfigure = Handle(IGESBasic_SubfigureDef)::DownCast (ent);
if (GetNameMode() && !aSubfigure.IsNull() && STool->Search (S, L, Standard_True, Standard_True)) if (GetNameMode() && !aSubfigure.IsNull() && !aSubfigure->Name().IsNull() &&
STool->Search(S, L, Standard_True, Standard_True))
{ {
//In this case we attach subfigure name to the label, instead of default "COMPOUND" //In this case we attach subfigure name to the label, instead of default "COMPOUND"
Handle(TCollection_HAsciiString) aName = aSubfigure->Name(); Handle(TCollection_HAsciiString) aName = aSubfigure->Name();

View File

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

View File

@@ -22,10 +22,10 @@
class IGESData_IGESEntity; class IGESData_IGESEntity;
class Interface_Check; class Interface_Check;
class ShapeBuild_ReShape;
class Standard_Transient; class Standard_Transient;
class TCollection_HAsciiString; class TCollection_HAsciiString;
class IGESData_IGESModel; class IGESData_IGESModel;
DEFINE_STANDARD_HANDLE(IGESData_IGESModel, Interface_InterfaceModel) DEFINE_STANDARD_HANDLE(IGESData_IGESModel, Interface_InterfaceModel)
@@ -151,8 +151,11 @@ public:
//! i.e. a string "Dnn" with nn = directory entry number (2*N-1) //! 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; 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) DEFINE_STANDARD_RTTIEXT(IGESData_IGESModel,Interface_InterfaceModel)
@@ -166,7 +169,7 @@ private:
Handle(TColStd_HSequenceOfHAsciiString) thestart; Handle(TColStd_HSequenceOfHAsciiString) thestart;
IGESData_GlobalSection theheader; IGESData_GlobalSection theheader;
Handle(ShapeBuild_ReShape) myReShape;
}; };

View File

@@ -635,32 +635,53 @@ Standard_Boolean IGESData_ParamReader::ReadXYZ
//function : ReadText //function : ReadText
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean IGESData_ParamReader::ReadText(const IGESData_ParamCursor& thePC,
Standard_Boolean IGESData_ParamReader::ReadText const Message_Msg& theMsg,
(const IGESData_ParamCursor& PC, const Message_Msg& amsg, Handle(TCollection_HAsciiString)& theVal)
Handle(TCollection_HAsciiString)& val)
{ {
if (!PrepareRead(PC,Standard_False)) return Standard_False; if (!PrepareRead(thePC, Standard_False))
const Interface_FileParameter& FP = theparams->Value(theindex+thebase); {
if (FP.ParamType() != Interface_ParamText) { return Standard_False;
if (FP.ParamType() == Interface_ParamVoid) { }
val = new TCollection_HAsciiString(""); const Interface_FileParameter& aFP = theparams->Value(theindex + thebase);
if (aFP.ParamType() != Interface_ParamText)
{
theVal = new TCollection_HAsciiString("");
if (aFP.ParamType() == Interface_ParamVoid)
{
return Standard_True; return Standard_True;
} }
SendFail (amsg); SendFail(theMsg);
return Standard_False; return Standard_False;
} }
Handle(TCollection_HAsciiString) tval = new TCollection_HAsciiString (FP.CValue()); const Handle(TCollection_HAsciiString) aBaseValue = new TCollection_HAsciiString(aFP.CValue());
Standard_Integer lnt = tval->Length(); const Standard_Integer aBaseLength = aBaseValue->Length();
Standard_Integer lnh = tval->Location(1,'H',1,lnt); const Standard_Integer aSymbolLocation = aBaseValue->Location(1, 'H', 1, aBaseLength);
if (lnh <= 1 || lnh >= lnt) { if (aSymbolLocation <= 1 || aSymbolLocation > aBaseLength)
SendFail (amsg); {
theVal = new TCollection_HAsciiString("");
SendFail(theMsg);
return Standard_False; return Standard_False;
} else {
Standard_Integer hol = atoi (tval->SubString(1,lnh-1)->ToCString());
if (hol != (lnt-lnh)) SendWarning (amsg);
} }
val = new TCollection_HAsciiString(tval->SubString(lnh+1,lnt)->ToCString()); const TCollection_AsciiString aSpecialSubString = aBaseValue->String().SubString(1, aSymbolLocation - 1);
if (!aSpecialSubString.IsIntegerValue())
{
theVal = new TCollection_HAsciiString("");
SendFail(theMsg);
return Standard_False;
}
Standard_Integer aResLength = aSpecialSubString.IntegerValue();
if (aResLength != (aBaseLength - aSymbolLocation))
{
SendWarning(theMsg);
aResLength = aBaseLength - aSymbolLocation;
}
TCollection_AsciiString aResString;
if (aResLength > 0)
{
aResString = aBaseValue->String().SubString(aSymbolLocation + 1, aBaseLength);
}
theVal = new TCollection_HAsciiString(aResString);
return Standard_True; return Standard_True;
} }

View File

@@ -200,7 +200,7 @@ public:
//! For Message //! For Message
Standard_EXPORT Standard_Boolean ReadXYZ (const IGESData_ParamCursor& PC, const Standard_CString mess, gp_XYZ& val); Standard_EXPORT Standard_Boolean ReadXYZ (const IGESData_ParamCursor& PC, const Standard_CString mess, gp_XYZ& val);
Standard_EXPORT Standard_Boolean ReadText (const IGESData_ParamCursor& PC, const Message_Msg& amsg, Handle(TCollection_HAsciiString)& val); Standard_EXPORT Standard_Boolean ReadText (const IGESData_ParamCursor& thePC, const Message_Msg& theMsg, Handle(TCollection_HAsciiString)& theVal);
//! Reads a Text value from parameter "num", as a String from //! Reads a Text value from parameter "num", as a String from
//! Collection, that is, Hollerith text without leading "nnnH" //! Collection, that is, Hollerith text without leading "nnnH"

View File

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

View File

@@ -225,6 +225,14 @@ static Resource_KindOfLine WhatKindOfLine(OSD_File& aFile,
aToken2.Clear(); aToken2.Clear();
else { else {
Line.Remove(1,Pos-1); Line.Remove(1,Pos-1);
const Standard_Integer aLineLength = Line.Length();
if (aLineLength >= 2)
{
if (Line.Value(aLineLength - 1) == '\r')
{
Line.Remove(aLineLength - 1);
}
}
Line.Remove(Line.Length()); Line.Remove(Line.Length());
aToken2 = Line; aToken2 = Line;
} }

View File

@@ -4657,6 +4657,8 @@ TDF_Label STEPCAFControl_Reader::SettleShapeData(const Handle(StepRepr_Represent
const Handle(Transfer_TransientProcess)& TP) const const Handle(Transfer_TransientProcess)& TP) const
{ {
TDF_Label aResult = theLab; TDF_Label aResult = theLab;
if (theItem.IsNull())
return aResult;
Handle(TCollection_HAsciiString) hName = theItem->Name(); Handle(TCollection_HAsciiString) hName = theItem->Name();
if (hName.IsNull() || hName->IsEmpty()) if (hName.IsNull() || hName->IsEmpty())
@@ -4692,9 +4694,16 @@ void collectRepresentationItems(const Interface_Graph& theGraph,
const Handle(StepShape_ShapeRepresentation)& theRepresentation, const Handle(StepShape_ShapeRepresentation)& theRepresentation,
NCollection_Sequence<Handle(StepRepr_RepresentationItem)>& theItems) NCollection_Sequence<Handle(StepRepr_RepresentationItem)>& theItems)
{ {
Handle(StepRepr_HArray1OfRepresentationItem) aReprItems = theRepresentation->Items(); for (StepRepr_HArray1OfRepresentationItem::Iterator anIter(theRepresentation->Items()->Array1());
for (Standard_Integer itemIt = aReprItems->Lower(); itemIt <= aReprItems->Upper(); itemIt++) anIter.More(); anIter.Next())
theItems.Append(aReprItems->Value(itemIt)); {
const Handle(StepRepr_RepresentationItem)& anReprItem = anIter.Value();
if (anReprItem.IsNull())
{
continue;
}
theItems.Append(anReprItem);
}
Interface_EntityIterator entIt = theGraph.TypedSharings(theRepresentation, STANDARD_TYPE(StepRepr_RepresentationRelationship)); Interface_EntityIterator entIt = theGraph.TypedSharings(theRepresentation, STANDARD_TYPE(StepRepr_RepresentationRelationship));
for (entIt.Start(); entIt.More(); entIt.Next()) for (entIt.Start(); entIt.More(); entIt.Next())

View File

@@ -47,7 +47,9 @@ class TopoDS_Shape;
//! Also supports multifile writing //! Also supports multifile writing
class STEPCAFControl_Writer class STEPCAFControl_Writer
{ {
public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
public: public:
//! Creates a writer with an empty //! Creates a writer with an empty

View File

@@ -83,6 +83,51 @@ 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 // function : DumpJson
// purpose : // purpose :

View File

@@ -17,6 +17,7 @@
#ifndef _SelectMgr_EntityOwner_HeaderFile #ifndef _SelectMgr_EntityOwner_HeaderFile
#define _SelectMgr_EntityOwner_HeaderFile #define _SelectMgr_EntityOwner_HeaderFile
#include <AIS_SelectionScheme.hxx>
#include <Aspect_VKey.hxx> #include <Aspect_VKey.hxx>
#include <PrsMgr_PresentationManager.hxx> #include <PrsMgr_PresentationManager.hxx>
#include <SelectMgr_SelectableObject.hxx> #include <SelectMgr_SelectableObject.hxx>
@@ -139,6 +140,12 @@ public:
//! @param theIsSelected [in] shows if owner is selected. //! @param theIsSelected [in] shows if owner is selected.
void SetSelected (const Standard_Boolean theIsSelected) { myIsSelected = theIsSelected; } 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. //! Returns selection state.
Standard_DEPRECATED ("Deprecated method - IsSelected() should be used instead") Standard_DEPRECATED ("Deprecated method - IsSelected() should be used instead")
Standard_Integer State() const { return myIsSelected ? 1 : 0; } Standard_Integer State() const { return myIsSelected ? 1 : 0; }

View File

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

View File

@@ -35,20 +35,21 @@ class StepFile_ReadData::CharactersPage {
public: public:
CharactersPage(const Standard_Integer theMaxCar) :myNext(NULL), myUsed(0) CharactersPage(const Standard_Integer theMaxCar) :myNext(nullptr), myUsed(0)
{ {
myCharacters = new char[theMaxCar]; myCharacters = new char[theMaxCar];
} }
~CharactersPage() ~CharactersPage()
{ {
if (myCharacters != NULL) if (myCharacters != nullptr)
{ {
delete[] myCharacters; delete[] myCharacters;
myCharacters = NULL; myCharacters = nullptr;
} }
} }
DEFINE_STANDARD_ALLOC
public: public:
CharactersPage* myNext; //!< Chaining of character pages CharactersPage* myNext; //!< Chaining of character pages
@@ -64,7 +65,7 @@ public:
public: public:
Argument() :myNext(NULL), myValue(NULL), myType(Interface_ParamSub) {} Argument() :myNext(nullptr), myValue(nullptr), myType(Interface_ParamSub) {}
~Argument() {} ~Argument() {}
@@ -83,7 +84,7 @@ public:
public: public:
ArgumentsPage(Standard_Integer theMaxArg) :myNext(NULL), myUsed(0) ArgumentsPage(Standard_Integer theMaxArg) :myNext(nullptr), myUsed(0)
{ {
myArgs = new Argument[theMaxArg]; myArgs = new Argument[theMaxArg];
} }
@@ -91,7 +92,7 @@ public:
~ArgumentsPage() ~ArgumentsPage()
{ {
delete[] myArgs; delete[] myArgs;
myArgs = NULL; myArgs = nullptr;
} }
public: public:
@@ -109,7 +110,7 @@ public:
public: public:
Record() :myNext(NULL), myFirst(NULL), myIdent(NULL), myType(NULL) {} Record() :myNext(nullptr), myFirst(nullptr), myLast(nullptr), myIdent(nullptr), myType(nullptr) {}
~Record() {} ~Record() {}
@@ -117,6 +118,7 @@ public:
Record* myNext; //!< Next record in the list Record* myNext; //!< Next record in the list
Argument* myFirst; //!< First argument in the record Argument* myFirst; //!< First argument in the record
Argument* myLast; //!< Last argument in the record
char* myIdent; //!< Record identifier (Example: "#12345") or scope-end char* myIdent; //!< Record identifier (Example: "#12345") or scope-end
char* myType; //!< Type of the record char* myType; //!< Type of the record
}; };
@@ -129,14 +131,14 @@ public:
public: public:
Scope() :myPrevious(NULL), myRecord(NULL) {} Scope() :myPrevious(nullptr), myRecord(nullptr) {}
~Scope() ~Scope()
{ {
if (myRecord != NULL) if (myRecord != nullptr)
{ {
delete[] myRecord; delete[] myRecord;
myRecord = NULL; myRecord = nullptr;
} }
} }
@@ -151,20 +153,20 @@ class StepFile_ReadData::RecordsPage
public: public:
RecordsPage(const Standard_Integer theMaxRec) :myNext(NULL), myUsed(0) RecordsPage(const Standard_Integer theMaxRec) :myNext(nullptr), myUsed(0)
{ {
myRecords = new Record[theMaxRec]; myRecords = new Record[theMaxRec];
} }
~RecordsPage() ~RecordsPage()
{ {
if (myRecords != NULL) if (myRecords != nullptr)
{ {
delete[] myRecords; delete[] myRecords;
myRecords = NULL; myRecords = nullptr;
} }
} }
DEFINE_STANDARD_ALLOC
public: public:
RecordsPage* myNext; //!< Chaining of records pages RecordsPage* myNext; //!< Chaining of records pages
@@ -177,7 +179,7 @@ class StepFile_ReadData::ErrorsPage
public: public:
ErrorsPage(Standard_CString theError) :myNext(NULL), myError(theError) ErrorsPage(Standard_CString theError) :myNext(nullptr), myError(theError)
{} {}
//! Returns point to the next ErrorsPage //! Returns point to the next ErrorsPage
@@ -189,6 +191,7 @@ public:
//! Returns an error message //! Returns an error message
Standard_CString ErrorMessage() const { return myError.ToCString(); } Standard_CString ErrorMessage() const { return myError.ToCString(); }
DEFINE_STANDARD_ALLOC
private: private:
ErrorsPage* myNext; //!< Chaining of records pages ErrorsPage* myNext; //!< Chaining of records pages
@@ -203,9 +206,9 @@ private:
StepFile_ReadData::StepFile_ReadData() StepFile_ReadData::StepFile_ReadData()
:myMaxChar(50000), myMaxRec(5000), myMaxArg(10000), myModePrint(0), :myMaxChar(50000), myMaxRec(5000), myMaxArg(10000), myModePrint(0),
myNbRec(0), myNbHead(0), myNbPar(0), myYaRec(0), myNbRec(0), myNbHead(0), myNbPar(0), myYaRec(0),
myNumSub(0), myErrorArg(Standard_False), myResText(NULL), myCurrType(TextValue::SubList), myNumSub(0), myErrorArg(Standard_False), myResText(nullptr), myCurrType(TextValue::SubList),
mySubArg(NULL), myTypeArg(Interface_ParamSub), myCurrArg(NULL), myFirstRec(NULL), mySubArg(nullptr), myTypeArg(Interface_ParamSub), myCurrArg(nullptr), myFirstRec(nullptr),
myCurRec(NULL), myLastRec(NULL), myCurScope(NULL), myFirstError(NULL), myCurError(NULL) myCurRec(nullptr), myLastRec(nullptr), myCurScope(nullptr), myFirstError(nullptr), myCurError(nullptr)
{ {
myOneCharPage = new CharactersPage(myMaxChar); myOneCharPage = new CharactersPage(myMaxChar);
myOneArgPage = new ArgumentsPage(myMaxArg); myOneArgPage = new ArgumentsPage(myMaxArg);
@@ -266,7 +269,7 @@ void StepFile_ReadData::RecordNewEntity()
SetTypeArg(Interface_ParamSub); SetTypeArg(Interface_ParamSub);
mySubArg = myCurRec->myIdent; mySubArg = myCurRec->myIdent;
myCurRec = myCurRec->myNext; myCurRec = myCurRec->myNext;
myLastRec->myNext = NULL; myLastRec->myNext = nullptr;
} }
//======================================================================= //=======================================================================
@@ -278,8 +281,9 @@ void StepFile_ReadData::RecordIdent()
{ {
myCurRec = CreateNewRecord(); myCurRec = CreateNewRecord();
GetResultText(&myCurRec->myIdent); GetResultText(&myCurRec->myIdent);
myCurRec->myNext = NULL; myCurRec->myNext = nullptr;
myCurRec->myFirst = NULL; myCurRec->myFirst = nullptr;
myCurRec->myLast = nullptr;
myYaRec = 1; myYaRec = 1;
} }
@@ -294,8 +298,9 @@ void StepFile_ReadData::RecordType()
{ {
myCurRec = CreateNewRecord(); myCurRec = CreateNewRecord();
myCurRec->myIdent = TextValue::IdZero; myCurRec->myIdent = TextValue::IdZero;
myCurRec->myNext = NULL; myCurRec->myNext = nullptr;
myCurRec->myFirst = NULL; myCurRec->myFirst = nullptr;
myCurRec->myLast = nullptr;
} }
GetResultText(&myCurRec->myType); GetResultText(&myCurRec->myType);
myYaRec = myNumSub = 0; myYaRec = myNumSub = 0;
@@ -329,7 +334,8 @@ void StepFile_ReadData::RecordListStart()
aSubRec->myType = myCurrType; aSubRec->myType = myCurrType;
myCurrType = TextValue::SubList; myCurrType = TextValue::SubList;
aSubRec->myNext = myCurRec; aSubRec->myNext = myCurRec;
aSubRec->myFirst = NULL; aSubRec->myFirst = nullptr;
aSubRec->myLast = nullptr;
myCurRec = aSubRec; myCurRec = aSubRec;
} }
myErrorArg = Standard_False; // Reset error arguments mode myErrorArg = Standard_False; // Reset error arguments mode
@@ -364,18 +370,23 @@ void StepFile_ReadData::CreateNewArg()
if (myTypeArg == Interface_ParamMisc) if (myTypeArg == Interface_ParamMisc)
myErrorArg = Standard_True; myErrorArg = Standard_True;
if (myCurRec->myFirst == NULL) if (myCurRec->myFirst == nullptr)
{ {
myCurRec->myFirst = aNewArg; myCurRec->myFirst = aNewArg;
myCurRec->myLast = aNewArg;
}
else if (myCurRec->myLast == nullptr)
{
myCurRec->myFirst->myNext = aNewArg;
myCurRec->myLast = aNewArg;
} }
else else
{ {
Argument* aNextArg = myCurRec->myFirst; Argument* aNextArg = myCurRec->myLast;
while (aNextArg->myNext != NULL)
aNextArg = aNextArg->myNext;
aNextArg->myNext = aNewArg; aNextArg->myNext = aNewArg;
myCurRec->myLast = aNewArg;
} }
aNewArg->myNext = NULL; aNewArg->myNext = nullptr;
} }
//======================================================================= //=======================================================================
@@ -395,10 +406,7 @@ void StepFile_ReadData::CreateErrorArg()
return; return;
} }
Argument* aCurrArg = myCurRec->myFirst; Argument* aCurrArg = myCurRec->myLast;
while (aCurrArg->myNext != NULL)
aCurrArg = aCurrArg->myNext;
GetResultText(&aCurrArg->myValue); GetResultText(&aCurrArg->myValue);
} }
@@ -418,7 +426,8 @@ void StepFile_ReadData::AddNewScope()
aRecord = CreateNewRecord(); aRecord = CreateNewRecord();
aRecord->myIdent = TextValue::Scope; aRecord->myIdent = TextValue::Scope;
aRecord->myType = TextValue::Nil; aRecord->myType = TextValue::Nil;
aRecord->myFirst = NULL; aRecord->myFirst = nullptr;
aRecord->myLast = nullptr;
AddNewRecord(aRecord); AddNewRecord(aRecord);
} }
@@ -431,12 +440,13 @@ void StepFile_ReadData::FinalOfScope()
{ {
Scope* anOldScope; Scope* anOldScope;
Record* aRecord; Record* aRecord;
if (myCurScope == NULL) return; if (myCurScope == nullptr) return;
aRecord = CreateNewRecord(); aRecord = CreateNewRecord();
aRecord->myIdent = TextValue::Scope; aRecord->myIdent = TextValue::Scope;
aRecord->myType = TextValue::Nil; aRecord->myType = TextValue::Nil;
aRecord->myFirst = NULL; aRecord->myFirst = nullptr;
aRecord->myLast = nullptr;
if (mySubArg[0] == '$') if (mySubArg[0] == '$')
{ {
@@ -468,18 +478,18 @@ void StepFile_ReadData::ClearRecorder(const Standard_Integer theMode)
{ {
if (theMode & 1) if (theMode & 1)
{ {
while (myOneRecPage != NULL) while (myOneRecPage != nullptr)
{ {
RecordsPage* aNewPage = myOneRecPage->myNext; RecordsPage* aNewPage = myOneRecPage->myNext;
delete myOneRecPage; delete myOneRecPage;
myOneRecPage = aNewPage; myOneRecPage = aNewPage;
} }
while (myOneArgPage != NULL) { while (myOneArgPage != nullptr) {
ArgumentsPage* aNewPage = myOneArgPage->myNext; ArgumentsPage* aNewPage = myOneArgPage->myNext;
delete myOneArgPage; delete myOneArgPage;
myOneArgPage = aNewPage; myOneArgPage = aNewPage;
} }
while (myFirstError != NULL) while (myFirstError != nullptr)
{ {
ErrorsPage* aNewErrorPage = myFirstError->NextErrorPage(); ErrorsPage* aNewErrorPage = myFirstError->NextErrorPage();
delete myFirstError; delete myFirstError;
@@ -488,7 +498,7 @@ void StepFile_ReadData::ClearRecorder(const Standard_Integer theMode)
} }
if (theMode & 2) if (theMode & 2)
{ {
while (myOneCharPage != NULL) while (myOneCharPage != nullptr)
{ {
CharactersPage* aNewPage = myOneCharPage->myNext; CharactersPage* aNewPage = myOneCharPage->myNext;
delete myOneCharPage; delete myOneCharPage;
@@ -504,7 +514,7 @@ void StepFile_ReadData::ClearRecorder(const Standard_Integer theMode)
Standard_Boolean StepFile_ReadData::GetArgDescription(Interface_ParamType* theType, char** theValue) Standard_Boolean StepFile_ReadData::GetArgDescription(Interface_ParamType* theType, char** theValue)
{ {
if (myCurrArg == NULL) if (myCurrArg == nullptr)
return Standard_False; return Standard_False;
*theType = myCurrArg->myType; *theType = myCurrArg->myType;
*theValue = myCurrArg->myValue; *theValue = myCurrArg->myValue;
@@ -536,11 +546,11 @@ Standard_Boolean StepFile_ReadData::GetRecordDescription(char** theIdent,
char** theType, char** theType,
int* theNbArg) int* theNbArg)
{ {
if (myCurRec == NULL) if (myCurRec == nullptr)
return Standard_False; return Standard_False;
*theIdent = myCurRec->myIdent; *theIdent = myCurRec->myIdent;
*theType = myCurRec->myType; *theType = myCurRec->myType;
*theNbArg = (myCurRec->myFirst != NULL); *theNbArg = (myCurRec->myFirst != nullptr);
myCurrArg = myCurRec->myFirst; myCurrArg = myCurRec->myFirst;
return Standard_True; return Standard_True;
} }
@@ -641,7 +651,7 @@ Standard_Integer StepFile_ReadData::GetNbRecord() const
//======================================================================= //=======================================================================
void StepFile_ReadData::AddError(Standard_CString theErrorMessage) void StepFile_ReadData::AddError(Standard_CString theErrorMessage)
{ {
if (myFirstError == NULL) if (myFirstError == nullptr)
{ {
myFirstError = new ErrorsPage(theErrorMessage); myFirstError = new ErrorsPage(theErrorMessage);
myCurError = myFirstError; myCurError = myFirstError;
@@ -659,16 +669,16 @@ void StepFile_ReadData::AddError(Standard_CString theErrorMessage)
//======================================================================= //=======================================================================
Standard_Boolean StepFile_ReadData::ErrorHandle(const Handle(Interface_Check)& theCheck) const Standard_Boolean StepFile_ReadData::ErrorHandle(const Handle(Interface_Check)& theCheck) const
{ {
if (myFirstError != NULL) if (myFirstError != nullptr)
{ {
ErrorsPage* aCurrent = myFirstError; ErrorsPage* aCurrent = myFirstError;
while (aCurrent != NULL) while (aCurrent != nullptr)
{ {
theCheck->AddFail(aCurrent->ErrorMessage(), "Undefined Parsing"); theCheck->AddFail(aCurrent->ErrorMessage(), "Undefined Parsing");
aCurrent = aCurrent->NextErrorPage(); aCurrent = aCurrent->NextErrorPage();
} }
} }
return myFirstError == NULL; return myFirstError == nullptr;
} }
//======================================================================= //=======================================================================
@@ -677,7 +687,7 @@ Standard_Boolean StepFile_ReadData::ErrorHandle(const Handle(Interface_Check)& t
//======================================================================= //=======================================================================
Standard_CString StepFile_ReadData::GetLastError() const Standard_CString StepFile_ReadData::GetLastError() const
{ {
return myCurError != NULL ? myCurError->ErrorMessage() : NULL; return myCurError != nullptr ? myCurError->ErrorMessage() : nullptr;
} }
//======================================================================= //=======================================================================
@@ -714,8 +724,8 @@ void StepFile_ReadData::GetResultText(char** theText)
void StepFile_ReadData::AddNewRecord(Record* theNewRecord) void StepFile_ReadData::AddNewRecord(Record* theNewRecord)
{ {
myNbRec++; myNbRec++;
if (myFirstRec == NULL) myFirstRec = theNewRecord; if (myFirstRec == nullptr) myFirstRec = theNewRecord;
if (myLastRec != NULL) myLastRec->myNext = theNewRecord; if (myLastRec != nullptr) myLastRec->myNext = theNewRecord;
myLastRec = theNewRecord; myLastRec = theNewRecord;
} }
@@ -750,13 +760,13 @@ void StepFile_ReadData::PrintRecord(Record* theRecord)
int aNumArg = 0; int aNumArg = 0;
int aNumLen = 0; int aNumLen = 0;
int anArgLen = 0; int anArgLen = 0;
if (theRecord == NULL) { Printf("Non defini\n"); return; } if (theRecord == nullptr) { Printf("Not defined\n"); return; }
Printf("Ident : %s Type : %s Nb.Arg.s : %s\n", Printf("Ident : %s Type : %s Nb.Arg.s : %s\n",
theRecord->myIdent, theRecord->myType, theRecord->myIdent, theRecord->myType,
(theRecord->myFirst ? theRecord->myFirst->myValue : "")); (theRecord->myFirst ? theRecord->myFirst->myValue : ""));
if (myModePrint < 2) return; if (myModePrint < 2) return;
myCurrArg = theRecord->myFirst; myCurrArg = theRecord->myFirst;
while (myCurrArg != NULL) while (myCurrArg != nullptr)
{ {
aNumArg++; aNumArg++;
anArgLen = (int)strlen(myCurrArg->myValue) + 18; anArgLen = (int)strlen(myCurrArg->myValue) + 18;

View File

@@ -642,9 +642,11 @@ goto find_rule; \
8bit don't fail on 8-bit input characters 8bit don't fail on 8-bit input characters
warn warn about inconsistencies warn warn about inconsistencies
nodefault don't create default echo-all rule nodefault don't create default echo-all rule
noinput disables the generation of code for reading input from standard input
noyywrap don't use yywrap() function noyywrap don't use yywrap() function
yyclass define name of the scanner class yyclass define name of the scanner class
*/ */
#define YY_NO_INPUT 1
#include <step.tab.hxx> #include <step.tab.hxx>
#include "stdio.h" #include "stdio.h"
@@ -655,6 +657,11 @@ goto find_rule; \
#endif #endif
#define YY_DECL int step::scanner::lex (step::parser::semantic_type* /*yylval*/) #define YY_DECL int step::scanner::lex (step::parser::semantic_type* /*yylval*/)
// Disable checking for eof
#ifdef YY_INTERACTIVE
#undef YY_INTERACTIVE
#endif
typedef step::parser::token token; typedef step::parser::token token;
/* skl 31.01.2002 for OCC133(OCC96,97) - uncorrect /* skl 31.01.2002 for OCC133(OCC96,97) - uncorrect

View File

@@ -18,12 +18,14 @@
8bit don't fail on 8-bit input characters 8bit don't fail on 8-bit input characters
warn warn about inconsistencies warn warn about inconsistencies
nodefault don't create default echo-all rule nodefault don't create default echo-all rule
noinput disables the generation of code for reading input from standard input
noyywrap don't use yywrap() function noyywrap don't use yywrap() function
yyclass define name of the scanner class yyclass define name of the scanner class
*/ */
%option c++ %option c++
%option 8bit warn nodefault %option 8bit warn nodefault
%option noyywrap %option noyywrap
%option noinput
%option yyclass="step::scanner" %option yyclass="step::scanner"
%top{ %top{
@@ -46,6 +48,12 @@
#endif #endif
#define YY_DECL int step::scanner::lex (step::parser::semantic_type* /*yylval*/) #define YY_DECL int step::scanner::lex (step::parser::semantic_type* /*yylval*/)
// Disable checking for eof
#ifdef YY_INTERACTIVE
#undef YY_INTERACTIVE
#endif
#define YY_INTERACTIVE 0
typedef step::parser::token token; typedef step::parser::token token;
/* skl 31.01.2002 for OCC133(OCC96,97) - uncorrect /* skl 31.01.2002 for OCC133(OCC96,97) - uncorrect

View File

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

View File

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

View File

@@ -1,6 +1,3 @@
puts "TODO CR23671 Linux: Error"
puts "TODO CR23671 Linux: Draw_Failure: Could not open"
puts "============" puts "============"
puts "CR23671" puts "CR23671"
puts "============" puts "============"

View File

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

16
tests/bugs/iges/bug33327 Normal file
View File

@@ -0,0 +1,16 @@
puts "============"
puts "0033327: Data Exchange, IGES Import - SubfigureDef can't read string"
puts "============"
pload DCAF
Close D -silent
ReadIges D [locate_data_file "bug33327.igs"]
vclear
vinit View1
XDisplay -dispMode 1 D
vfit
vdump "$imagedir/${casename}_src.png"
Close D

View File

@@ -0,0 +1,15 @@
puts "============"
puts "0033264: Modeling Algorithms - Result of section operation is incomplete"
puts "============"
puts ""
restore [locate_data_file bug33264_1.brep] srf1
restore [locate_data_file bug33264_2.brep] srf2
bsection res srf1 srf2
checknbshapes res -vertex 44 -edge 43
checkprops res -l 51.3377
checksection res
checkview -display res -2d -path ${imagedir}/${test_image}.png

14
tests/bugs/step/bug33331 Normal file
View File

@@ -0,0 +1,14 @@
puts "===================================="
puts "0033331: Data Exchange, Step Import - Unsupported Representation Items"
puts "===================================="
puts ""
pload DCAF
catch {Close D}
param "read.stepcaf.subshapes.name" 1
ReadStep D [locate_data_file bug33331.stp]
param "read.stepcaf.subshapes.name" 0
Close D