From ca282cf42b35564fc303efbc4d4e05cdc351bf51 Mon Sep 17 00:00:00 2001 From: dpasukhi Date: Sat, 21 Jan 2023 12:16:00 +0000 Subject: [PATCH] // in the process --- src/DE/DE_ConfigurationNode.cxx | 9 + src/DE/DE_ConfigurationNode.hxx | 14 +- src/DE/DE_Provider.cxx | 275 +- src/DE/DE_Provider.hxx | 97 +- src/DrawResources/DrawPlugin | 9 +- src/IGESControl/IGESControl_Reader.cxx | 1 - src/IGESSelect/IGESSelect.cxx | 3 - .../STEPCAFControl_Provider.cxx | 17 + src/TKXSDRAW/EXTERNLIB | 1 + src/TKXSDRAW/PACKAGES | 3 - src/TKXSDRAWDEWrapper/EXTERNLIB | 3 + src/TKXSDRAWGLTF/EXTERNLIB | 1 + src/TKXSDRAWIGES/EXTERNLIB | 3 + src/TKXSDRAWOBJ/EXTERNLIB | 1 + src/TKXSDRAWPLY/EXTERNLIB | 1 + src/TKXSDRAWSTEP/EXTERNLIB | 3 + src/TKXSDRAWSTL/EXTERNLIB | 1 + src/TKXSDRAWVRML/EXTERNLIB | 1 + src/XDEDRAW/XDEDRAW.cxx | 29 - src/XDEDRAW/XDEDRAW.hxx | 1 - src/XDEDRAW/XDEDRAW_Colors.cxx | 1 - src/XDEDRAW/XDEDRAW_Common.cxx | 172 +- src/XDEDRAW/XDEDRAW_GDTs.cxx | 2 - src/XDEDRAW/XDEDRAW_Layers.cxx | 11 - src/XDEDRAW/XDEDRAW_Props.cxx | 14 - src/XDEDRAW/XDEDRAW_Shapes.cxx | 2 - src/XDEDRAW/XDEDRAW_Views.cxx | 1 - src/XSControl/XSControl_Reader.cxx | 1 - src/XSDRAW/FILES | 2 +- src/XSDRAW/XSDRAW.cxx | 295 +- src/XSDRAW/XSDRAW.hxx | 17 +- src/XSDRAW/XSDRAW_Functions.cxx | 193 +- src/XSDRAW/XSDRAW_FunctionsSession.cxx | 2416 +++++------------ src/XSDRAW/XSDRAW_FunctionsShape.cxx | 586 ++-- src/XSDRAWBase/XSDRAWBase.cxx | 103 + src/XSDRAWBase/XSDRAWBase.hxx | 34 +- src/XSDRAWDEWrapper/XSDRAWDEWrapper.cxx | 4 + src/XSDRAWGLTF/XSDRAWGLTF.cxx | 11 + src/XSDRAWIGES/XSDRAWIGES.cxx | 483 ++-- src/XSDRAWOBJ/XSDRAWOBJ.cxx | 10 + src/XSDRAWPLY/XSDRAWPLY.cxx | 10 + src/XSDRAWSTEP/XSDRAWSTEP.cxx | 394 +-- src/XSDRAWSTEP/XSDRAWSTEP.hxx | 2 - src/XSDRAWSTL/XSDRAWSTL.cxx | 10 + src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx | 7 - src/XSDRAWSTLVRML/XSDRAWSTLVRML.hxx | 2 - src/XSDRAWSTLVRML/XSDRAWSTLVRML_CoordsMap.hxx | 1 - ...DRAWSTLVRML_DataMapIteratorOfCoordsMap.hxx | 1 - ...WSTLVRML_DataMapIteratorOfElemNodesMap.hxx | 1 - .../XSDRAWSTLVRML_DataSource.hxx | 16 - .../XSDRAWSTLVRML_DataSource3D.cxx | 1 - .../XSDRAWSTLVRML_DataSource3D.hxx | 16 - .../XSDRAWSTLVRML_DrawableMesh.cxx | 1 - .../XSDRAWSTLVRML_DrawableMesh.hxx | 17 - .../XSDRAWSTLVRML_ElemNodesMap.hxx | 1 - src/XSDRAWVRML/XSDRAWVRML.cxx | 5 + tests/bugs/demo/bug14673_3 | 2 +- tests/bugs/heal/begin | 2 +- tests/bugs/mesh/bug28118 | 2 +- tests/bugs/mesh/bug29715 | 2 +- tests/bugs/modalg_4/bug8842_1 | 2 +- tests/bugs/modalg_4/bug8842_10 | 2 +- tests/bugs/modalg_4/bug8842_11 | 2 +- tests/bugs/modalg_4/bug8842_12 | 2 +- tests/bugs/modalg_4/bug8842_13 | 2 +- tests/bugs/modalg_4/bug8842_14 | 2 +- tests/bugs/modalg_4/bug8842_15 | 2 +- tests/bugs/modalg_4/bug8842_16 | 2 +- tests/bugs/modalg_4/bug8842_2 | 2 +- tests/bugs/modalg_4/bug8842_3 | 2 +- tests/bugs/modalg_4/bug8842_4 | 2 +- tests/bugs/modalg_4/bug8842_5 | 2 +- tests/bugs/modalg_4/bug8842_6 | 2 +- tests/bugs/modalg_4/bug8842_7 | 2 +- tests/bugs/modalg_4/bug8842_8 | 2 +- tests/bugs/modalg_4/bug8842_9 | 2 +- tests/bugs/modalg_5/bug25175 | 2 +- tests/bugs/modalg_5/bug25410 | 2 +- tests/bugs/modalg_7/bug30595_2 | 2 +- tests/bugs/modalg_7/bug30829 | 2 +- tests/bugs/modalg_8/bug33165 | 2 +- tests/bugs/stlvrml/begin | 2 +- 82 files changed, 2171 insertions(+), 3197 deletions(-) diff --git a/src/DE/DE_ConfigurationNode.cxx b/src/DE/DE_ConfigurationNode.cxx index 2d978fc71a..2b2e6e09d8 100644 --- a/src/DE/DE_ConfigurationNode.cxx +++ b/src/DE/DE_ConfigurationNode.cxx @@ -114,6 +114,15 @@ bool DE_ConfigurationNode::IsExportSupported() const return false; } +//======================================================================= +// function : IsExportSupported +// purpose : +//======================================================================= +bool DE_ConfigurationNode::IsStreamSupported() const +{ + return false; +} + //======================================================================= // function : CheckForSupport // purpose : diff --git a/src/DE/DE_ConfigurationNode.hxx b/src/DE/DE_ConfigurationNode.hxx index 0f48ac5e55..db5fd766fa 100644 --- a/src/DE/DE_ConfigurationNode.hxx +++ b/src/DE/DE_ConfigurationNode.hxx @@ -102,6 +102,10 @@ public: //! @return Standard_True if export is support Standard_EXPORT virtual bool IsExportSupported() const; + //! Checks the stream for import/export supporting + //! @return Standard_True if stream is support + Standard_EXPORT virtual bool IsStreamSupported() const; + //! Gets CAD format name of associated provider //! @return provider CAD format Standard_EXPORT virtual TCollection_AsciiString GetFormat() const = 0; @@ -128,17 +132,11 @@ public: //! Gets the provider loading status //! @return Standard_True if the load is correct - Standard_Boolean IsEnabled() const - { - return myIsEnabled; - } + Standard_Boolean IsEnabled() const { return myIsEnabled; } //! Sets the provider loading status //! @param[in] theIsLoaded input load status - void SetEnabled(const Standard_Boolean theIsLoaded) - { - myIsEnabled = theIsLoaded; - } + void SetEnabled(const Standard_Boolean theIsLoaded) { myIsEnabled = theIsLoaded; } public: diff --git a/src/DE/DE_Provider.cxx b/src/DE/DE_Provider.cxx index 606e5af854..9b041be13d 100644 --- a/src/DE/DE_Provider.cxx +++ b/src/DE/DE_Provider.cxx @@ -14,10 +14,111 @@ #include #include +#include +#include +#include +#include #include +#include + IMPLEMENT_STANDARD_RTTIEXT(DE_Provider, Standard_Transient) +namespace +{ + class DE_TemporaryFile + { + public: + DE_TemporaryFile(const TCollection_AsciiString& theFolderPath, + const TCollection_AsciiString& theExtension); + + ~DE_TemporaryFile(); + + TCollection_AsciiString Path() const { return myTempPath; } + + Standard_Boolean IsDone() const { return myIsCreated; } + + private: + + Standard_Boolean myIsCreated = Standard_False; + TCollection_AsciiString myTempPath; + OSD_File myFile; + }; +} + +//======================================================================= +// function : DE_TemporaryFile +// purpose : +//======================================================================= +DE_TemporaryFile::DE_TemporaryFile(const TCollection_AsciiString& theFolderPath, + const TCollection_AsciiString& theExtension) +{ + Standard_Boolean anIsCreated = Standard_False; + OSD_Directory aDirectory; + if (!theFolderPath.IsEmpty()) + { + OSD_Directory anInternalFolder(theFolderPath); + if (!anInternalFolder.Failed()) + { + aDirectory = anInternalFolder; + anIsCreated = Standard_True; + } + } + if (!anIsCreated) + { + aDirectory = OSD_Directory::BuildTemporary(); + } + OSD_Path aPath; + aDirectory.Path(aPath); + TCollection_AsciiString aFullPath; + aPath.SystemName(aFullPath); + if (!anIsCreated) + { + Message::SendTrace() << "DE Provider : Using temporary folder from system : [" + << aFullPath << "]"; + } + if (aDirectory.Failed()) + { + Message::SendFail() << "Error: DE Provider : Can't create folder by path : [" + << aFullPath << "]"; + } + TCollection_AsciiString aTempName(tempnam(aFullPath.ToCString(), nullptr)); + aTempName += "."; + aTempName += theExtension; + myFile = OSD_File(aTempName); + myFile.Build(OSD_ReadWrite, OSD_Protection()); + if (myFile.Failed()) + { + Message::SendFail() << "Error: DE Provider : Can't create tempolary file by path : [" + << aTempName << "]"; + return; + } + myIsCreated = Standard_True; + myTempPath = aTempName; +} + +//======================================================================= +// function : DE_TemporaryFile +// purpose : +//======================================================================= +DE_TemporaryFile::~DE_TemporaryFile() +{ + if (!myIsCreated) + { + return; + } + if (myFile.IsLocked()) + { + myFile.UnLock(); + } + myFile.Close(); + if (std::remove(myTempPath.ToCString()) != 0) + { + Message::SendFail() << "Error: DE Provider : Can't remove tempolary file by path : [" + << myTempPath << "]"; + } +} + //======================================================================= // function : DE_Provider // purpose : @@ -47,10 +148,52 @@ Standard_Boolean DE_Provider::Read(const TCollection_AsciiString& thePath, (void)theWS; (void)theProgress; Message::SendFail() << "Error: provider " << GetFormat() << - " " << GetVendor() <<" doesn't support read operation"; + " " << GetVendor() << " doesn't support read operation"; return Standard_False; } +//======================================================================= +// function : Read +// purpose : +//======================================================================= +bool DE_Provider::Read(std::istream& theIStream, + const Handle(TDocStd_Document)& theDocument, + const TCollection_AsciiString theName, + Handle(XSControl_WorkSession)& theWS, + const Message_ProgressRange& theProgress) +{ + (void)theName; + if (myNode.IsNull() || + myNode->GetFormat() != GetFormat() || + myNode->GetVendor() != GetVendor()) + { + Message::SendFail() << "Error: provider " << GetFormat() << + " " << GetVendor() << " : Incorrect Configuration node"; + return Standard_False; + } + if (!myNode->IsImportSupported()) + { + Message::SendFail() << "Error: provider " << GetFormat() << + " " << GetVendor() << " doesn't support read operation"; + return Standard_False; + } + TColStd_ListOfAsciiString anExtns = myNode->GetExtensions(); + TCollection_AsciiString anExt("tmp"); + if (!anExtns.IsEmpty()) + { + anExt = anExtns.First(); + } + DE_TemporaryFile aTempFile(myTempFolder, anExt); + if (!aTempFile.IsDone()) + { + return Standard_False; + } + std::ofstream aStream; + OSD_OpenStream(aStream, aTempFile.Path(), std::ios::out | std::ios::binary); + aStream << theIStream.rdbuf(); + return Read(aTempFile.Path(), theDocument, theWS, theProgress); +} + //======================================================================= // function : Write // purpose : @@ -69,6 +212,50 @@ Standard_Boolean DE_Provider::Write(const TCollection_AsciiString& thePath, return Standard_False; } +//======================================================================= +// function : Write +// purpose : +//======================================================================= +bool DE_Provider::Write(std::ostream& theOStream, + const Handle(TDocStd_Document)& theDocument, + Handle(XSControl_WorkSession)& theWS, + const Message_ProgressRange& theProgress) +{ + if (myNode.IsNull() || + myNode->GetFormat() != GetFormat() || + myNode->GetVendor() != GetVendor()) + { + Message::SendFail() << "Error: provider " << GetFormat() << + " " << GetVendor() << " : Incorrect Configuration node"; + return Standard_False; + } + if (!myNode->IsExportSupported()) + { + Message::SendFail() << "Error: provider " << GetFormat() << + " " << GetVendor() << " doesn't support write operation"; + return Standard_False; + } + TColStd_ListOfAsciiString anExtns = myNode->GetExtensions(); + TCollection_AsciiString anExt("tmp"); + if (!anExtns.IsEmpty()) + { + anExt = anExtns.First(); + } + DE_TemporaryFile aTempFile(myTempFolder, anExt); + if (!aTempFile.IsDone()) + { + return Standard_False; + } + if (!Write(aTempFile.Path(), theDocument, theWS, theProgress)) + { + return Standard_False; + } + std::ifstream aStream; + OSD_OpenStream(aStream, aTempFile.Path().ToCString(), std::ios::in | std::ios::binary); + theOStream << aStream.rdbuf(); + return Standard_True; +} + //======================================================================= // function : Read // purpose : @@ -87,6 +274,48 @@ Standard_Boolean DE_Provider::Read(const TCollection_AsciiString& thePath, return Standard_False; } +//======================================================================= +// function : Read +// purpose : +//======================================================================= +bool DE_Provider::Read(std::istream& theIStream, + TopoDS_Shape& theShape, + const TCollection_AsciiString theName, + Handle(XSControl_WorkSession)& theWS, + const Message_ProgressRange& theProgress) +{ + (void)theName; + if (myNode.IsNull() || + myNode->GetFormat() != GetFormat() || + myNode->GetVendor() != GetVendor()) + { + Message::SendFail() << "Error: provider " << GetFormat() << + " " << GetVendor() << " : Incorrect Configuration node"; + return Standard_False; + } + if (!myNode->IsImportSupported()) + { + Message::SendFail() << "Error: provider " << GetFormat() << + " " << GetVendor() << " doesn't support read operation"; + return Standard_False; + } + TColStd_ListOfAsciiString anExtns = myNode->GetExtensions(); + TCollection_AsciiString anExt("tmp"); + if (!anExtns.IsEmpty()) + { + anExt = anExtns.First(); + } + DE_TemporaryFile aTempFile(myTempFolder, anExt); + if (!aTempFile.IsDone()) + { + return Standard_False; + } + std::ofstream aStream; + OSD_OpenStream(aStream, aTempFile.Path(), std::ios::out | std::ios::binary); + aStream << theIStream.rdbuf(); + return Read(aTempFile.Path(), theShape, theWS, theProgress); +} + //======================================================================= // function : Write // purpose : @@ -104,3 +333,47 @@ Standard_Boolean DE_Provider::Write(const TCollection_AsciiString& thePath, " " << GetVendor() << " doesn't support write operation"; return Standard_False; } + +//======================================================================= +// function : Write +// purpose : +//======================================================================= +bool DE_Provider::Write(std::ostream& theOStream, + const TopoDS_Shape& theShape, + Handle(XSControl_WorkSession)& theWS, + const Message_ProgressRange& theProgress) +{ + if (myNode.IsNull() || + myNode->GetFormat() != GetFormat() || + myNode->GetVendor() != GetVendor()) + { + Message::SendFail() << "Error: provider " << GetFormat() << + " " << GetVendor() << " : Incorrect Configuration node"; + return Standard_False; + } + if (!myNode->IsExportSupported()) + { + Message::SendFail() << "Error: provider " << GetFormat() << + " " << GetVendor() << " doesn't support write operation"; + return Standard_False; + } + TColStd_ListOfAsciiString anExtns = myNode->GetExtensions(); + TCollection_AsciiString anExt("tmp"); + if (!anExtns.IsEmpty()) + { + anExt = anExtns.First(); + } + DE_TemporaryFile aTempFile(myTempFolder, anExt); + if (!aTempFile.IsDone()) + { + return Standard_False; + } + if (!Write(aTempFile.Path(), theShape, theWS, theProgress)) + { + return Standard_False; + } + std::ifstream aStream; + OSD_OpenStream(aStream, aTempFile.Path().ToCString(), std::ios::in | std::ios::binary); + theOStream << aStream.rdbuf(); + return Standard_True; +} diff --git a/src/DE/DE_Provider.hxx b/src/DE/DE_Provider.hxx index c67175c1bb..fa3af4f89c 100644 --- a/src/DE/DE_Provider.hxx +++ b/src/DE/DE_Provider.hxx @@ -61,10 +61,23 @@ public: //! @param[in] theWS current work session //! @param theProgress[in] progress indicator //! @return True if Read was successful - Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath, - const Handle(TDocStd_Document)& theDocument, - Handle(XSControl_WorkSession)& theWS, - const Message_ProgressRange& theProgress = Message_ProgressRange()); + Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath, + const Handle(TDocStd_Document)& theDocument, + Handle(XSControl_WorkSession)& theWS, + const Message_ProgressRange& theProgress = Message_ProgressRange()); + + //! Reads a CAD file, according internal configuration + //! @param[in] theIStream stream to import CAD data + //! @param[out] theDocument document to save result + //! @paramp[in] theName name of CAD file, can be empty + //! @param[in] theWS current work session + //! @param theProgress[in] progress indicator + //! @return true if Read operation has ended correctly + Standard_EXPORT virtual bool Read(std::istream& theIStream, + const Handle(TDocStd_Document)& theDocument, + const TCollection_AsciiString theName, + Handle(XSControl_WorkSession)& theWS, + const Message_ProgressRange& theProgress = Message_ProgressRange()); //! Writes a CAD file, according internal configuration //! @param[in] thePath path to the export CAD file @@ -72,10 +85,21 @@ public: //! @param[in] theWS current work session //! @param theProgress[in] progress indicator //! @return True if Write was successful - Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath, - const Handle(TDocStd_Document)& theDocument, - Handle(XSControl_WorkSession)& theWS, - const Message_ProgressRange& theProgress = Message_ProgressRange()); + Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath, + const Handle(TDocStd_Document)& theDocument, + Handle(XSControl_WorkSession)& theWS, + const Message_ProgressRange& theProgress = Message_ProgressRange()); + + //! Writes a CAD file, according internal configuration + //! @param[in] theOStream stream to export CAD data + //! @param[out] theDocument document to export + //! @param[in] theWS current work session + //! @param theProgress[in] progress indicator + //! @return true if Write operation has ended correctly + Standard_EXPORT virtual bool Write(std::ostream& theOStream, + const Handle(TDocStd_Document)& theDocument, + Handle(XSControl_WorkSession)& theWS, + const Message_ProgressRange& theProgress = Message_ProgressRange()); //! Reads a CAD file, according internal configuration //! @param[in] thePath path to the import CAD file @@ -83,10 +107,23 @@ public: //! @param[in] theWS current work session //! @param theProgress[in] progress indicator //! @return True if Read was successful - Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath, - TopoDS_Shape& theShape, - Handle(XSControl_WorkSession)& theWS, - const Message_ProgressRange& theProgress = Message_ProgressRange()); + Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath, + TopoDS_Shape& theShape, + Handle(XSControl_WorkSession)& theWS, + const Message_ProgressRange& theProgress = Message_ProgressRange()); + + //! Reads a CAD file, according internal configuration + //! @param[in] theIStream stream to the CAD file + //! @param[out] theShape shape to save result + //! @paramp[in] theName name of CAD file, can be empty + //! @param[in] theWS current work session + //! @param theProgress[in] progress indicator + //! @return true if Read operation has ended correctly + Standard_EXPORT virtual bool Read(std::istream& theIStream, + TopoDS_Shape& theShape, + const TCollection_AsciiString theName, + Handle(XSControl_WorkSession)& theWS, + const Message_ProgressRange& theProgress = Message_ProgressRange()); //! Writes a CAD file, according internal configuration //! @param[in] thePath path to the export CAD file @@ -94,10 +131,21 @@ public: //! @param[in] theWS current work session //! @param theProgress[in] progress indicator //! @return True if Write was successful - Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath, - const TopoDS_Shape& theShape, - Handle(XSControl_WorkSession)& theWS, - const Message_ProgressRange& theProgress = Message_ProgressRange()); + Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath, + const TopoDS_Shape& theShape, + Handle(XSControl_WorkSession)& theWS, + const Message_ProgressRange& theProgress = Message_ProgressRange()); + + //! Writes a CAD file, according internal configuration + //! @param[in] theOStream stream to export CAD data + //! @param[out] theShape shape to export + //! @param[in] theWS current work session + //! @param theProgress[in] progress indicator + //! @return true if Write operation has ended correctly + Standard_EXPORT virtual bool Write(std::ostream& theOStream, + const TopoDS_Shape& theShape, + Handle(XSControl_WorkSession)& theWS, + const Message_ProgressRange& theProgress = Message_ProgressRange()); public: @@ -111,21 +159,22 @@ public: //! Gets internal configuration node //! @return configuration node object - Handle(DE_ConfigurationNode) GetNode() const - { - return myNode; - } + Handle(DE_ConfigurationNode) GetNode() const { return myNode; } //! Sets internal configuration node //! @param[in] theNode configuration node to set - void SetNode(const Handle(DE_ConfigurationNode)& theNode) - { - myNode = theNode; - } + void SetNode(const Handle(DE_ConfigurationNode)& theNode) { myNode = theNode; } + + //! Gets path to folder to create temp CAD files, that not support stream + TCollection_AsciiString GetTempFolderPath() const { return myTempFolder; } + + //! Sets path to folder to create temp CAD files, that not support stream + void SetTempFolderPath(const TCollection_AsciiString& theFolder) { myTempFolder = theFolder; } private: Handle(DE_ConfigurationNode) myNode; //!< Internal configuration for the own format + TCollection_AsciiString myTempFolder; //!< Path to folder to create temp CAD files, that not support stream }; #endif // _DE_Provider_HeaderFile diff --git a/src/DrawResources/DrawPlugin b/src/DrawResources/DrawPlugin index b9938be7af..7c2fac4635 100755 --- a/src/DrawResources/DrawPlugin +++ b/src/DrawResources/DrawPlugin @@ -36,7 +36,7 @@ OCAFKERNEL : DCAF DATAEXCHANGEKERNEL : XSDRAW OCAF : VISUALIZATION, OCAFKERNEL DATAEXCHANGE : XDE, VISUALIZATION -XDE : DATAEXCHANGEKERNEL, XDEDRAW +XDE : DATAEXCHANGEKERNEL, XDEDRAW, STEP, IGES, GLTF, OBJ, PLY, STL, VRML ALL : MODELING, OCAFKERNEL, DATAEXCHANGE TOPTEST : TKTopTest @@ -54,3 +54,10 @@ DFBROWSER : TKDFBrowser QAcommands : TKQADraw VIS : TKIVtkDraw INSPECTOR : TKToolsDraw +STEP : TKXSDRAWSTEP +IGES : TKXSDRAWIGES +GLTF : TKXSDRAWGLTF +OBJ : TKXSDRAWOBJ +PLY : TKXSDRAWPLY +STL : TKXSDRAWSTL +VRML : TKXSDRAWVRML diff --git a/src/IGESControl/IGESControl_Reader.cxx b/src/IGESControl/IGESControl_Reader.cxx index d9346bb415..080302554a 100644 --- a/src/IGESControl/IGESControl_Reader.cxx +++ b/src/IGESControl/IGESControl_Reader.cxx @@ -16,7 +16,6 @@ #include #include -#include #include #include #include diff --git a/src/IGESSelect/IGESSelect.cxx b/src/IGESSelect/IGESSelect.cxx index fa1a76ba7c..ae89ab9db5 100644 --- a/src/IGESSelect/IGESSelect.cxx +++ b/src/IGESSelect/IGESSelect.cxx @@ -13,7 +13,6 @@ #include -#include #include #include #include @@ -26,8 +25,6 @@ void IGESSelect::Run () { -// Handle(IFSelect_BasicActivator) Activator = new IFSelect_BasicActivator; - IFSelect_Functions::Init(); Handle(IFSelect_SessionPilot) pilot = new IFSelect_SessionPilot("XSTEP-IGES>"); Handle(IGESSelect_Activator) igesact = new IGESSelect_Activator; pilot->SetSession (new IFSelect_WorkSession ( )); diff --git a/src/STEPCAFControl/STEPCAFControl_Provider.cxx b/src/STEPCAFControl/STEPCAFControl_Provider.cxx index f5a007359c..b84f50ae70 100644 --- a/src/STEPCAFControl/STEPCAFControl_Provider.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Provider.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -708,11 +709,16 @@ bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath, personizeWS(theWS); STEPControl_Writer aWriter(theWS, Standard_True); Handle(StepData_StepModel) aModel = aWriter.Model(); + Standard_Integer aNbEntities = (aModel.IsNull() ? 0 : aModel->NbEntities()); aModel->SetWriteLengthUnit(UnitsMethods::GetLengthUnitScale( aNode->InternalParameters.WriteUnit, UnitsMethods_LengthUnit_Millimeter)); IFSelect_ReturnStatus aWritestat = aWriter.Transfer(theShape, aNode->InternalParameters.WriteModelType, true, theProgress); + if (aNbEntities > 0) + { + Message::SendTrace() << "STEPCAFControl_Provider : Model not empty before transferring"; + } if (aWritestat != IFSelect_RetDone) { Message::SendFail() << "Error: STEPCAFControl_Provider : " @@ -720,6 +726,12 @@ bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath, resetStatic(); return false; } + if (thePath == ".") + { + resetStatic(); + Message::SendInfo() << "Step model has been translated into the session"; + return true; + } if (aWriter.Write(thePath.ToCString()) != IFSelect_RetDone) { Message::SendFail() << "Error: STEPCAFControl_Provider : " @@ -754,11 +766,16 @@ bool STEPCAFControl_Provider::Write(std::ostream& theOStream, personizeWS(theWS); STEPControl_Writer aWriter(theWS, Standard_True); Handle(StepData_StepModel) aModel = aWriter.Model(); + Standard_Integer aNbEntities = (aModel.IsNull() ? 0 : aModel->NbEntities()); aModel->SetWriteLengthUnit(UnitsMethods::GetLengthUnitScale( aNode->InternalParameters.WriteUnit, UnitsMethods_LengthUnit_Millimeter)); IFSelect_ReturnStatus aWritestat = aWriter.Transfer(theShape, aNode->InternalParameters.WriteModelType, true, theProgress); + if (aNbEntities > 0) + { + Message::SendTrace() << "STEPCAFControl_Provider : Model not empty before transferring"; + } if (aWritestat != IFSelect_RetDone) { Message::SendFail() << "Error: STEPCAFControl_Provider : " diff --git a/src/TKXSDRAW/EXTERNLIB b/src/TKXSDRAW/EXTERNLIB index 1947db4b4f..5b7039675c 100755 --- a/src/TKXSDRAW/EXTERNLIB +++ b/src/TKXSDRAW/EXTERNLIB @@ -22,3 +22,4 @@ TKLCAF TKDCAF TKXCAF TKRWMesh +TKXSDRAWBase \ No newline at end of file diff --git a/src/TKXSDRAW/PACKAGES b/src/TKXSDRAW/PACKAGES index da48d7c48c..c06294d598 100755 --- a/src/TKXSDRAW/PACKAGES +++ b/src/TKXSDRAW/PACKAGES @@ -1,4 +1 @@ XSDRAW -XSDRAWIGES -XSDRAWSTEP -XSDRAWSTLVRML diff --git a/src/TKXSDRAWDEWrapper/EXTERNLIB b/src/TKXSDRAWDEWrapper/EXTERNLIB index 1947db4b4f..fd5b972224 100644 --- a/src/TKXSDRAWDEWrapper/EXTERNLIB +++ b/src/TKXSDRAWDEWrapper/EXTERNLIB @@ -22,3 +22,6 @@ TKLCAF TKDCAF TKXCAF TKRWMesh +TKXSBase +TKXDE +TKXSDRAWBase \ No newline at end of file diff --git a/src/TKXSDRAWGLTF/EXTERNLIB b/src/TKXSDRAWGLTF/EXTERNLIB index 1947db4b4f..5b7039675c 100644 --- a/src/TKXSDRAWGLTF/EXTERNLIB +++ b/src/TKXSDRAWGLTF/EXTERNLIB @@ -22,3 +22,4 @@ TKLCAF TKDCAF TKXCAF TKRWMesh +TKXSDRAWBase \ No newline at end of file diff --git a/src/TKXSDRAWIGES/EXTERNLIB b/src/TKXSDRAWIGES/EXTERNLIB index 1947db4b4f..98b7ff9935 100644 --- a/src/TKXSDRAWIGES/EXTERNLIB +++ b/src/TKXSDRAWIGES/EXTERNLIB @@ -22,3 +22,6 @@ TKLCAF TKDCAF TKXCAF TKRWMesh +TKXSBase +TKXDEIGES +TKXSDRAWBase \ No newline at end of file diff --git a/src/TKXSDRAWOBJ/EXTERNLIB b/src/TKXSDRAWOBJ/EXTERNLIB index 1947db4b4f..5b7039675c 100644 --- a/src/TKXSDRAWOBJ/EXTERNLIB +++ b/src/TKXSDRAWOBJ/EXTERNLIB @@ -22,3 +22,4 @@ TKLCAF TKDCAF TKXCAF TKRWMesh +TKXSDRAWBase \ No newline at end of file diff --git a/src/TKXSDRAWPLY/EXTERNLIB b/src/TKXSDRAWPLY/EXTERNLIB index 1947db4b4f..5b7039675c 100644 --- a/src/TKXSDRAWPLY/EXTERNLIB +++ b/src/TKXSDRAWPLY/EXTERNLIB @@ -22,3 +22,4 @@ TKLCAF TKDCAF TKXCAF TKRWMesh +TKXSDRAWBase \ No newline at end of file diff --git a/src/TKXSDRAWSTEP/EXTERNLIB b/src/TKXSDRAWSTEP/EXTERNLIB index 1947db4b4f..769c251788 100644 --- a/src/TKXSDRAWSTEP/EXTERNLIB +++ b/src/TKXSDRAWSTEP/EXTERNLIB @@ -22,3 +22,6 @@ TKLCAF TKDCAF TKXCAF TKRWMesh +TKXSBase +TKXDESTEP +TKXSDRAWBase \ No newline at end of file diff --git a/src/TKXSDRAWSTL/EXTERNLIB b/src/TKXSDRAWSTL/EXTERNLIB index 1947db4b4f..5b7039675c 100644 --- a/src/TKXSDRAWSTL/EXTERNLIB +++ b/src/TKXSDRAWSTL/EXTERNLIB @@ -22,3 +22,4 @@ TKLCAF TKDCAF TKXCAF TKRWMesh +TKXSDRAWBase \ No newline at end of file diff --git a/src/TKXSDRAWVRML/EXTERNLIB b/src/TKXSDRAWVRML/EXTERNLIB index 1947db4b4f..5b7039675c 100644 --- a/src/TKXSDRAWVRML/EXTERNLIB +++ b/src/TKXSDRAWVRML/EXTERNLIB @@ -22,3 +22,4 @@ TKLCAF TKDCAF TKXCAF TKRWMesh +TKXSDRAWBase \ No newline at end of file diff --git a/src/XDEDRAW/XDEDRAW.cxx b/src/XDEDRAW/XDEDRAW.cxx index 71561d359e..859ca585d3 100644 --- a/src/XDEDRAW/XDEDRAW.cxx +++ b/src/XDEDRAW/XDEDRAW.cxx @@ -149,7 +149,6 @@ static Standard_Integer newDoc (Draw_Interpretor& di, Standard_Integer argc, con return 0; } - //======================================================================= //function : saveDoc //purpose : @@ -316,7 +315,6 @@ static Standard_Integer dump (Draw_Interpretor& di, Standard_Integer argc, const return 0; } - //======================================================================= //function : StatAssembly //purpose : recursive part of statistics @@ -441,7 +439,6 @@ static void StatAssembly(const TDF_Label L, } - //======================================================================= //function : statdoc //purpose : @@ -524,7 +521,6 @@ static Standard_Integer statdoc (Draw_Interpretor& di, Standard_Integer argc, co return 0; } - //======================================================================= //function : setPrs //purpose : @@ -575,7 +571,6 @@ static Standard_Integer setPrs (Draw_Interpretor& di, Standard_Integer argc, con return 0; } - //======================================================================= //function : show //purpose : @@ -994,7 +989,6 @@ static Standard_Integer xwd (Draw_Interpretor& di, Standard_Integer argc, const return 0; } - //======================================================================= //function : XAttributeValue //purpose : @@ -1023,7 +1017,6 @@ static Standard_Integer XAttributeValue (Draw_Interpretor& di, Standard_Integer return 0; } - //======================================================================= //function : setviewName //purpose : @@ -1040,7 +1033,6 @@ static Standard_Integer setviewName (Draw_Interpretor& di, Standard_Integer argc return 0; } - //======================================================================= //function : getviewName //purpose : auxiliary @@ -1053,7 +1045,6 @@ static Standard_Integer getviewName (Draw_Interpretor& di, Standard_Integer /*a return 0; } - //======================================================================= //function : XSetTransparency //purpose : @@ -1721,7 +1712,6 @@ static Standard_Integer testDoc (Draw_Interpretor&, return 0; } - //======================================================================= //function : Init //purpose : @@ -1848,32 +1838,13 @@ void XDEDRAW::Init(Draw_Interpretor& di) XDEDRAW_Views::InitCommands(di); XDEDRAW_Notes::InitCommands(di); XDEDRAW_Common::InitCommands ( di );//moved from EXE - - DE_Wrapper::GlobalWrapper()->Bind(new RWObj_ConfigurationNode()); - DE_Wrapper::GlobalWrapper()->Bind(new RWPly_ConfigurationNode()); - DE_Wrapper::GlobalWrapper()->Bind(new RWGltf_ConfigurationNode()); - DE_Wrapper::GlobalWrapper()->Bind(new IGESCAFControl_ConfigurationNode()); - DE_Wrapper::GlobalWrapper()->Bind(new STEPCAFControl_ConfigurationNode()); - DE_Wrapper::GlobalWrapper()->Bind(new Vrml_ConfigurationNode()); - DE_Wrapper::GlobalWrapper()->Bind(new DEXCAFCascade_ConfigurationNode()); - DE_Wrapper::GlobalWrapper()->Bind(new RWStl_ConfigurationNode()); - DE_Wrapper::GlobalWrapper()->Bind(new DEBRepCascade_ConfigurationNode()); } - //============================================================================== // XDEDRAW::Factory //============================================================================== void XDEDRAW::Factory(Draw_Interpretor& theDI) { - XSDRAWIGES::InitSelect(); - XSDRAWIGES::InitToBRep(theDI); - XSDRAWIGES::InitFromBRep(theDI); - - XSDRAWSTEP::InitCommands(theDI); - - XSDRAW::LoadDraw(theDI); - XDEDRAW::Init(theDI); #ifdef OCCT_DEBUG diff --git a/src/XDEDRAW/XDEDRAW.hxx b/src/XDEDRAW/XDEDRAW.hxx index f7a4c641e3..33584a2374 100644 --- a/src/XDEDRAW/XDEDRAW.hxx +++ b/src/XDEDRAW/XDEDRAW.hxx @@ -21,7 +21,6 @@ #include - //! Provides DRAW commands for work with DECAF data structures class XDEDRAW { diff --git a/src/XDEDRAW/XDEDRAW_Colors.cxx b/src/XDEDRAW/XDEDRAW_Colors.cxx index faf8258d83..d4a6404fba 100644 --- a/src/XDEDRAW/XDEDRAW_Colors.cxx +++ b/src/XDEDRAW/XDEDRAW_Colors.cxx @@ -13,7 +13,6 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. - #include #include #include diff --git a/src/XDEDRAW/XDEDRAW_Common.cxx b/src/XDEDRAW/XDEDRAW_Common.cxx index 266d1a6355..c8cc360bfa 100644 --- a/src/XDEDRAW/XDEDRAW_Common.cxx +++ b/src/XDEDRAW/XDEDRAW_Common.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -50,60 +51,6 @@ #include -namespace -{ - static XSControl_WorkSessionMap THE_PREVIOUS_WORK_SESSIONS; -} - -//======================================================================= -//function : parseCoordinateSystem -//purpose : Parse RWMesh_CoordinateSystem enumeration. -//======================================================================= -static bool parseCoordinateSystem(const char* theArg, - RWMesh_CoordinateSystem& theSystem) -{ - TCollection_AsciiString aCSStr(theArg); - aCSStr.LowerCase(); - if (aCSStr == "zup") - { - theSystem = RWMesh_CoordinateSystem_Zup; - } - else if (aCSStr == "yup") - { - theSystem = RWMesh_CoordinateSystem_Yup; - } - else - { - return Standard_False; - } - return Standard_True; -} - -//======================================================================= -//function : CollectActiveWorkSessions -//purpose : Fill map with active workSession items -//======================================================================= -static void CollectActiveWorkSessions(const Handle(XSControl_WorkSession)& theWS, - const TCollection_AsciiString& theName, - XSControl_WorkSessionMap& theMap, - const Standard_Boolean theIsFirst = Standard_True) -{ - if (theIsFirst) - { - theMap.Clear(); - } - if (theMap.IsBound(theName)) - { - return; - } - theMap.Bind(theName, theWS); - for (XSControl_WorkSessionMap::Iterator anIter(theWS->ReferenceWS()); - anIter.More(); anIter.Next()) - { - CollectActiveWorkSessions(anIter.Value(), anIter.Key(), theMap, Standard_False); - } -} - //======================================================================= //function : SetCurWS //purpose : Set current file if many files are read @@ -112,27 +59,26 @@ static Standard_Integer SetCurWS(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - if (theNbArgs < 2) - { - theDI << "Use: " << theArgVec[0] << " filename \n"; - return 1; - } - const TCollection_AsciiString aSessionName(theArgVec[1]); - Handle(XSControl_WorkSession) aSession; - if (!THE_PREVIOUS_WORK_SESSIONS.Find(aSessionName, aSession)) - { - TCollection_AsciiString aWSs; - for (XSControl_WorkSessionMap::Iterator anIter(THE_PREVIOUS_WORK_SESSIONS); - anIter.More(); anIter.Next()) - { - aWSs += "\""; - aWSs += anIter.Key(); - aWSs += "\"\n"; - } - theDI << "Error: Can't find active session. Active sessions list:\n" << aWSs; - return 1; - } - XSDRAW::Pilot()->SetSession(aSession); + //if (theNbArgs < 2) + //{ + // theDI << "Use: " << theArgVec[0] << " filename \n"; + // return 1; + //} + //const TCollection_AsciiString aSessionName(theArgVec[1]); + //Handle(XSControl_WorkSession) aSession; + //if (!THE_PREVIOUS_WORK_SESSIONS.Find(aSessionName, aSession)) + //{ + // TCollection_AsciiString aWSs; + // for (XSControl_WorkSessionMap::Iterator anIter(THE_PREVIOUS_WORK_SESSIONS); + // anIter.More(); anIter.Next()) + // { + // aWSs += "\""; + // aWSs += anIter.Key(); + // aWSs += "\"\n"; + // } + // theDI << "Error: Can't find active session. Active sessions list:\n" << aWSs; + // return 1; + //} return 0; } @@ -144,15 +90,15 @@ static Standard_Integer GetDicWSList(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - (void)theNbArgs; - (void)theArgVec; - Message::SendInfo() << "Active sessions list:"; - TCollection_AsciiString aWSs; - for (XSControl_WorkSessionMap::Iterator anIter(THE_PREVIOUS_WORK_SESSIONS); - anIter.More(); anIter.Next()) - { - theDI << "\"" << anIter.Key() << "\"\n"; - } + //(void)theNbArgs; + //(void)theArgVec; + //Message::SendInfo() << "Active sessions list:"; + //TCollection_AsciiString aWSs; + //for (XSControl_WorkSessionMap::Iterator anIter(THE_PREVIOUS_WORK_SESSIONS); + // anIter.More(); anIter.Next()) + //{ + // theDI << "\"" << anIter.Key() << "\"\n"; + //} return 0; } @@ -166,30 +112,11 @@ static Standard_Integer GetCurWS(Draw_Interpretor& theDI, { (void)theNbArgs; (void)theArgVec; - Handle(XSControl_WorkSession) WS = XSDRAW::Session(); + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); theDI << "\"" << WS->LoadedFile() << "\""; return 0; } -//======================================================================= -//function : GetLengthUnit -//purpose : Gets length unit value from static interface and document in M -//======================================================================= -static Standard_Real GetLengthUnit(const Handle(TDocStd_Document)& theDoc = nullptr) -{ - if (!theDoc.IsNull()) - { - Standard_Real aUnit = 1.; - if (XCAFDoc_DocumentTool::GetLengthUnit(theDoc, aUnit, - UnitsMethods_LengthUnit_Millimeter)) - { - return aUnit; - } - } - XSAlgo::AlgoContainer()->PrepareForTransfer(); - return UnitsMethods::GetCasCadeLengthUnit(); -} - //======================================================================= //function : FromShape //purpose : Apply fromshape command to all the loaded WSs @@ -198,28 +125,25 @@ static Standard_Integer FromShape(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - if (theNbArgs < 2) - { - theDI << theArgVec[0] << " shape: search for shape origin among all last tranalated files\n"; - return 0; - } + //if (theNbArgs < 2) + //{ + // theDI << theArgVec[0] << " shape: search for shape origin among all last tranalated files\n"; + // return 0; + //} - char command[256]; - Sprintf(command, "fromshape %.200s -1", theArgVec[1]); - XSControl_WorkSessionMap DictWS = THE_PREVIOUS_WORK_SESSIONS; - if (DictWS.IsEmpty()) - return theDI.Eval(command); - - Handle(XSControl_WorkSession) WS = XSDRAW::Session(); - for (XSControl_WorkSessionMap::Iterator DicIt(DictWS); - DicIt.More(); DicIt.Next()) - { - Handle(XSControl_WorkSession) CurrentWS = DicIt.Value(); - XSDRAW::Pilot()->SetSession(CurrentWS); - theDI.Eval(command); - } + //char command[256]; + //Sprintf(command, "fromshape %.200s -1", theArgVec[1]); + //XSControl_WorkSessionMap DictWS = THE_PREVIOUS_WORK_SESSIONS; + //if (DictWS.IsEmpty()) + // return theDI.Eval(command); - XSDRAW::Pilot()->SetSession(WS); + //Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + //for (XSControl_WorkSessionMap::Iterator DicIt(DictWS); + // DicIt.More(); DicIt.Next()) + //{ + // Handle(XSControl_WorkSession) CurrentWS = DicIt.Value(); + // theDI.Eval(command); + //} return 0; } diff --git a/src/XDEDRAW/XDEDRAW_GDTs.cxx b/src/XDEDRAW/XDEDRAW_GDTs.cxx index 58a0073b59..c68504d0c5 100644 --- a/src/XDEDRAW/XDEDRAW_GDTs.cxx +++ b/src/XDEDRAW/XDEDRAW_GDTs.cxx @@ -50,7 +50,6 @@ #include - static Standard_Integer DumpDGTs (Draw_Interpretor& di, Standard_Integer argc, const char** argv) { if (argc < 3) { @@ -741,7 +740,6 @@ static Standard_Integer getDatumPosition (Draw_Interpretor& di, Standard_Integer return 0; } - static Standard_Integer getDatum (Draw_Interpretor& di, Standard_Integer argc, const char** argv) { if (argc < 3) { diff --git a/src/XDEDRAW/XDEDRAW_Layers.cxx b/src/XDEDRAW/XDEDRAW_Layers.cxx index 50d4733f90..c5f65a1808 100644 --- a/src/XDEDRAW/XDEDRAW_Layers.cxx +++ b/src/XDEDRAW/XDEDRAW_Layers.cxx @@ -13,7 +13,6 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. - #include #include #include @@ -90,7 +89,6 @@ static Standard_Integer removeLayer (Draw_Interpretor& di, Standard_Integer argc return 0; } - static Standard_Integer setLayer (Draw_Interpretor& di, Standard_Integer argc, const char** argv) { if (argc<4) { @@ -119,7 +117,6 @@ static Standard_Integer setLayer (Draw_Interpretor& di, Standard_Integer argc, c return 0; } - static Standard_Integer getLayers (Draw_Interpretor& di, Standard_Integer argc, const char** argv) { if (argc!=3) { @@ -151,7 +148,6 @@ static Standard_Integer getLayers (Draw_Interpretor& di, Standard_Integer argc, return 0; } - static Standard_Integer getLayerLabels (Draw_Interpretor& di, Standard_Integer argc, const char** argv) { if (argc!=2) { @@ -179,7 +175,6 @@ static Standard_Integer getLayerLabels (Draw_Interpretor& di, Standard_Integer a return 0; } - static Standard_Integer getOneLayer (Draw_Interpretor& di, Standard_Integer argc, const char** argv) { if (argc!=3) { @@ -200,7 +195,6 @@ static Standard_Integer getOneLayer (Draw_Interpretor& di, Standard_Integer argc return 0; } - static Standard_Integer setLinkLayer (Draw_Interpretor& di, Standard_Integer argc, const char** argv) { if (argc<4) { @@ -231,7 +225,6 @@ static Standard_Integer setLinkLayer (Draw_Interpretor& di, Standard_Integer arg return 0; } - static Standard_Integer getAllLayers (Draw_Interpretor& di, Standard_Integer argc, const char** argv) { if (argc!=2) { @@ -261,7 +254,6 @@ static Standard_Integer getAllLayers (Draw_Interpretor& di, Standard_Integer arg return 0; } - static Standard_Integer unSetLayer (Draw_Interpretor& di, Standard_Integer argc, const char** argv) { if (argc!=4) { @@ -288,7 +280,6 @@ static Standard_Integer unSetLayer (Draw_Interpretor& di, Standard_Integer argc, return 0; } - static Standard_Integer unSetAllLayers (Draw_Interpretor& di, Standard_Integer argc, const char** argv) { if (argc!=3) { @@ -314,7 +305,6 @@ static Standard_Integer unSetAllLayers (Draw_Interpretor& di, Standard_Integer a return 0; } - static Standard_Integer removeAllLayers (Draw_Interpretor& di, Standard_Integer argc, const char** argv) { if (argc!=2) { @@ -365,7 +355,6 @@ static Standard_Integer setVisibility (Draw_Interpretor& di, Standard_Integer ar return 0; } - static Standard_Integer isVisible (Draw_Interpretor& di, Standard_Integer argc, const char** argv) { if (argc!=3) { diff --git a/src/XDEDRAW/XDEDRAW_Props.cxx b/src/XDEDRAW/XDEDRAW_Props.cxx index 98f4790b4b..03806766dc 100644 --- a/src/XDEDRAW/XDEDRAW_Props.cxx +++ b/src/XDEDRAW/XDEDRAW_Props.cxx @@ -93,7 +93,6 @@ static double TetraVol(gp_Pnt RefPoint, gp_Pnt Som1, gp_Pnt Som2, gp_Pnt Som3) return (-curVolume); } - //======================================================================= //function : TetraCen //purpose : auxiliary @@ -109,7 +108,6 @@ static gp_XYZ TetraCen(const gp_Pnt& RefPoint, return curCentr; } - //======================================================================= //function : CalculVolume //purpose : auxiliary @@ -174,10 +172,8 @@ static Standard_Real CalculVolume(const TopoDS_Shape& So, return (myVolume); } - // --------------------- VolumeFix End --- - //======================================================================= // Section: Work with val props //======================================================================= @@ -243,7 +239,6 @@ static Standard_Integer SetProps (Draw_Interpretor& di, Standard_Integer argc, c return 0; } - //======================================================================= //function : SetVolume //purpose : @@ -281,7 +276,6 @@ static Standard_Integer SetVolume (Draw_Interpretor& di, Standard_Integer argc, return 0; } - //======================================================================= //function : SetArea //purpose : @@ -318,7 +312,6 @@ static Standard_Integer SetArea (Draw_Interpretor& di, Standard_Integer argc, co return 0; } - //======================================================================= //function : SetCentroid //purpose : @@ -357,7 +350,6 @@ static Standard_Integer SetCentroid (Draw_Interpretor& di, Standard_Integer argc return 0; } - //======================================================================= //function : GetVolume //purpose : @@ -393,7 +385,6 @@ static Standard_Integer GetVolume (Draw_Interpretor& di, Standard_Integer argc, return 0; } - //======================================================================= //function : GetArea //purpose : @@ -429,7 +420,6 @@ static Standard_Integer GetArea (Draw_Interpretor& di, Standard_Integer argc, co return 0; } - //======================================================================= //function : GetCentroid //purpose : @@ -679,7 +669,6 @@ static Standard_Integer CheckProps (Draw_Interpretor& di, Standard_Integer argc, return 0; } - //======================================================================= //function : ShapeVolume //purpose : @@ -709,7 +698,6 @@ static Standard_Integer ShapeVolume (Draw_Interpretor& di, Standard_Integer argc return 0; } - //======================================================================= //function : GetMassProps //purpose : auxiliary for ShapeMassProps @@ -793,7 +781,6 @@ static Standard_Boolean GetMassProps(const TDF_Label& aLabel, gp_XYZ& theCenterG return Standard_True; } - //======================================================================= //function : ShapeMassProps //purpose : @@ -863,7 +850,6 @@ static Standard_Integer ShapeMassProps (Draw_Interpretor& di, Standard_Integer a return 0; } - //======================================================================= //function : SetMaterial //purpose : diff --git a/src/XDEDRAW/XDEDRAW_Shapes.cxx b/src/XDEDRAW/XDEDRAW_Shapes.cxx index dc0edf0b5e..8936f71954 100644 --- a/src/XDEDRAW/XDEDRAW_Shapes.cxx +++ b/src/XDEDRAW/XDEDRAW_Shapes.cxx @@ -13,7 +13,6 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. - #include #include #include @@ -252,7 +251,6 @@ static Standard_Integer findMainShape(Draw_Interpretor& di, Standard_Integer arg return 0; } - static Standard_Integer addSubShape(Draw_Interpretor& di, Standard_Integer argc, const char** argv) { if (argc != 4) { diff --git a/src/XDEDRAW/XDEDRAW_Views.cxx b/src/XDEDRAW/XDEDRAW_Views.cxx index 70f3aac009..1c812747c6 100644 --- a/src/XDEDRAW/XDEDRAW_Views.cxx +++ b/src/XDEDRAW/XDEDRAW_Views.cxx @@ -103,7 +103,6 @@ static Standard_Integer removeView(Draw_Interpretor& di, Standard_Integer argc, return 0; } - //======================================================================= //function : setClippingPlanes //purpose : diff --git a/src/XSControl/XSControl_Reader.cxx b/src/XSControl/XSControl_Reader.cxx index 02107b2176..faf2376aa0 100644 --- a/src/XSControl/XSControl_Reader.cxx +++ b/src/XSControl/XSControl_Reader.cxx @@ -15,7 +15,6 @@ //: gka 14.04.99: S4136: apply scaling #include -#include #include #include #include diff --git a/src/XSDRAW/FILES b/src/XSDRAW/FILES index 5747f7fea3..d0a6c9fd4b 100755 --- a/src/XSDRAW/FILES +++ b/src/XSDRAW/FILES @@ -5,4 +5,4 @@ XSDRAW_Functions.hxx XSDRAW_FunctionsSession.cxx XSDRAW_FunctionsSession.hxx XSDRAW_FunctionsShape.cxx -XSDRAW_FunctionsShape.hxx \ No newline at end of file +XSDRAW_FunctionsShape.hxx diff --git a/src/XSDRAW/XSDRAW.cxx b/src/XSDRAW/XSDRAW.cxx index bdb67f9b6c..0d4c506fae 100644 --- a/src/XSDRAW/XSDRAW.cxx +++ b/src/XSDRAW/XSDRAW.cxx @@ -11,294 +11,25 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include - -#include -#include -//#include -static int deja = 0, dejald = 0; -//unused variable -//static int okxset = 0; - -static NCollection_DataMap theolds; -static Handle(TColStd_HSequenceOfAsciiString) thenews; - -static Handle(IFSelect_SessionPilot) thepilot; // detient Session, Model - -static Standard_Integer XSTEPDRAWRUN (Draw_Interpretor& di, Standard_Integer argc, const char** argv) -{ - TCollection_AsciiString mess; - for (Standard_Integer i = 0; i < argc; i ++) { - mess.AssignCat(argv[i]); mess.AssignCat(" "); - } - - const Handle(Message_Messenger)& aMsgMgr = Message::DefaultMessenger(); - Message_SequenceOfPrinters aPrinters; - aPrinters.Append (aMsgMgr->ChangePrinters()); - aMsgMgr->AddPrinter (new Draw_Printer (di)); - - IFSelect_ReturnStatus stat = thepilot->Execute (mess.ToCString()); - - aMsgMgr->RemovePrinters (STANDARD_TYPE(Draw_Printer)); - aMsgMgr->ChangePrinters().Append (aPrinters); - - if (stat == IFSelect_RetError || stat == IFSelect_RetFail) return 1; - else return 0; -} - - void XSDRAW::ChangeCommand - (const Standard_CString oldname, const Standard_CString newname) -{ - Standard_Integer num = 0; - if (newname[0] != '\0') { - if (thenews.IsNull()) thenews = new TColStd_HSequenceOfAsciiString(); - TCollection_AsciiString newstr(newname); - thenews->Append(newstr); - num = thenews->Length(); - } - theolds.Bind(oldname,num); -} - - void XSDRAW::RemoveCommand - (const Standard_CString oldname) -{ - ChangeCommand (oldname,""); -} - - Standard_Boolean XSDRAW::LoadSession () -{ - if (deja) return Standard_False; - deja = 1; - thepilot = new IFSelect_SessionPilot("XSTEP-DRAW>"); - Handle(XSControl_WorkSession) WS = new XSControl_WorkSession; - //WS->SetVars (new XSDRAW_Vars); - thepilot->SetSession (WS); - IFSelect_Functions::Init(); - XSControl_Functions::Init(); - XSControl_FuncShape::Init(); -// XSDRAW_Shape::Init(); passe a present par theCommands - return Standard_True; -} +#include +#include +#include +#include -void XSDRAW::LoadDraw (Draw_Interpretor& theCommands) +void XSDRAW::Factory(Draw_Interpretor& theDI) { - if (dejald) + static Standard_Boolean initactor = Standard_False; + if (initactor) { return; } - dejald = 1; -// Pour tout faire d un coup : BRepTest & cie: - LoadSession(); - - //skl: we make remove commands "x" and "exit" in order to this commands are - // performed not in IFSelect_SessionPilot but in standard Tcl interpretor - XSDRAW::RemoveCommand("x"); - XSDRAW::RemoveCommand("exit"); - -// if (!getenv("WBHOSTTOP")) XSDRAW::RemoveCommand("xsnew"); - Handle(TColStd_HSequenceOfAsciiString) list = IFSelect_Activator::Commands (0); - for (TColStd_HSequenceOfAsciiString::Iterator aCmdIter (*list); aCmdIter.More(); aCmdIter.Next()) - { - Standard_Integer num = -1; - const TCollection_AsciiString& aCmd = aCmdIter.Value(); - if (!theolds.IsEmpty()) - { - theolds.Find (aCmd, num); - } - if (num == 0) - { - continue; - } - - Standard_Integer nact = 0; - Handle(IFSelect_Activator) anAct; - TCollection_AsciiString aHelp; - if (!IFSelect_Activator::Select (aCmd.ToCString(), nact, anAct)) - { - aHelp = TCollection_AsciiString("type : xhelp ") + aCmd + " for help"; - } - else if (!anAct.IsNull()) - { - aHelp = anAct->Help (nact); - } - - const TCollection_AsciiString& aCmdName = num < 0 ? aCmd : thenews->Value (num); - theCommands.Add (aCmdName.ToCString(), aHelp.ToCString(), "", XSTEPDRAWRUN, anAct->Group()); - } -} - - Standard_Integer XSDRAW::Execute - (const Standard_CString command, const Standard_CString varname) -{ - char mess[100]; - Sprintf (mess,command,varname); - thepilot->Execute (mess); - return 1; // stat ? -} - - Handle(IFSelect_SessionPilot) XSDRAW::Pilot () - { return thepilot; } - - Handle(XSControl_WorkSession) XSDRAW::Session () - { return XSControl::Session(thepilot); } - - void XSDRAW::SetController (const Handle(XSControl_Controller)& control) -{ - if (thepilot.IsNull()) XSDRAW::LoadSession(); - if (control.IsNull()) std::cout<<"XSTEP Controller not defined"<SetController (control); - else std::cout<<"XSTEP Session badly or not defined"<NormAdaptor(); } - - Standard_Boolean XSDRAW::SetNorm - (const Standard_CString norm) -{ - return Session()->SelectNorm (norm); -} - - Handle(Interface_Protocol) XSDRAW::Protocol () - { return thepilot->Session()->Protocol(); } - - Handle(Interface_InterfaceModel) XSDRAW::Model () - { return thepilot->Session()->Model(); } - - void XSDRAW::SetModel - (const Handle(Interface_InterfaceModel)& model, const Standard_CString file) -{ - thepilot->Session()->SetModel(model); - if (file && file[0] != '\0') thepilot->Session()->SetLoadedFile(file); -} - - Handle(Interface_InterfaceModel) XSDRAW::NewModel () - { return Session()->NewModel(); } - - Handle(Standard_Transient) XSDRAW::Entity (const Standard_Integer num) - { return thepilot->Session()->StartingEntity(num); } - - Standard_Integer XSDRAW::Number (const Handle(Standard_Transient)& ent) - { return thepilot->Session()->StartingNumber(ent); } - - void XSDRAW::SetTransferProcess (const Handle(Standard_Transient)& ATP) -{ - DeclareAndCast(Transfer_FinderProcess,FP,ATP); - DeclareAndCast(Transfer_TransientProcess,TP,ATP); - -// Cas FinderProcess ==> TransferWriter - if (!FP.IsNull()) Session()->SetMapWriter(FP); - -// Cas TransientProcess ==> TransferReader - if (!TP.IsNull()) { - if (!TP->Model().IsNull() && TP->Model() != Session()->Model()) - Session()->SetModel (TP->Model()); - Session()->SetMapReader(TP); - } -} - - Handle(Transfer_TransientProcess) XSDRAW::TransientProcess () - { return Session()->TransferReader()->TransientProcess(); } - - Handle(Transfer_FinderProcess) XSDRAW::FinderProcess () - { return Session()->TransferWriter()->FinderProcess(); } - - - void XSDRAW::InitTransferReader (const Standard_Integer mode) -{ -// 0 nullify 1 clear -// 2 init TR avec contenu TP (roots) 3 init TP avec contenu TR -// 4 init avec model (debut scratch) - Session()->InitTransferReader(mode); -} - - Handle(XSControl_TransferReader) XSDRAW::TransferReader () - { return Session()->TransferReader(); } - - -// ############ AUXILIAIRES ############# - - Handle(Standard_Transient) XSDRAW::GetEntity (const Standard_CString name) - { return IFSelect_Functions::GiveEntity (Session(),name); } - - Standard_Integer XSDRAW::GetEntityNumber (const Standard_CString name) - { return IFSelect_Functions::GiveEntityNumber (Session(),name); } - - - Handle(TColStd_HSequenceOfTransient) XSDRAW::GetList - (const Standard_CString first, const Standard_CString second) -{ - if ( !first || first[0] == '\0' ) - { - std::string aLineFirst; - std::cin >> aLineFirst; - - char terminateSymbol = '\0'; - std::cin.get(terminateSymbol); - - if ( terminateSymbol == '\n' ) - return XSDRAW::GetList (aLineFirst.c_str(), nullptr); - else - { - std::string aLineSecond; - std::cin >> aLineSecond; - return XSDRAW::GetList (aLineFirst.c_str(), aLineSecond.c_str()); - } - } - return IFSelect_Functions::GiveList (Session(),first,second); + initactor = Standard_True; + XSDRAW_Functions::Init(theDI); + XSDRAW_FunctionsSession::Init(theDI); + XSDRAW_FunctionsShape::Init(theDI); } - - Standard_Boolean XSDRAW::FileAndVar - (const Standard_CString file, const Standard_CString var, - const Standard_CString def, - TCollection_AsciiString& resfile, TCollection_AsciiString& resvar) -{ return XSControl_FuncShape::FileAndVar - (XSDRAW::Session(),file,var,def,resfile,resvar); } - - Standard_Integer XSDRAW::MoreShapes - (Handle(TopTools_HSequenceOfShape)& list, const Standard_CString name) -{ return XSControl_FuncShape::MoreShapes (XSDRAW::Session(),list,name); } - - -// FONCTION POUR LE DEBUG - -Standard_Integer XSDRAW_WHAT (const Handle(Standard_Transient)& ent) -{ - if (ent.IsNull()) { std::cout<<"(Null Handle)"<DynamicType()->Name()<Print (ent, std::cout, 0); - std::cout<<" -- Recorded Type:"<TypeName (ent)<Number(ent); -} +// Declare entry point PLUGINFACTORY +DPLUGIN(XSDRAW) diff --git a/src/XSDRAW/XSDRAW.hxx b/src/XSDRAW/XSDRAW.hxx index d5979e533f..b1611d00a7 100644 --- a/src/XSDRAW/XSDRAW.hxx +++ b/src/XSDRAW/XSDRAW.hxx @@ -30,10 +30,23 @@ class XSDRAW DEFINE_STANDARD_ALLOC public: - Standard_EXPORT static void Init(); - //! Loads all Draw commands of XSDRAWDEWrapper. Used for plugin. Standard_EXPORT static void Factory(Draw_Interpretor& theDI); + +public: + + class StreamContainer + { + DEFINE_STANDARD_ALLOC + public: + StreamContainer(Draw_Interpretor& theDI) : myDI(&theDI) {} + Standard_SStream& SStream() { return myStream; } + ~StreamContainer() { *myDI << myStream; } + private: + Draw_Interpretor* myDI; + Standard_SStream myStream; + }; + }; #endif // _XSDRAW_HeaderFile diff --git a/src/XSDRAW/XSDRAW_Functions.cxx b/src/XSDRAW/XSDRAW_Functions.cxx index 1c084a87af..dd4111e827 100644 --- a/src/XSDRAW/XSDRAW_Functions.cxx +++ b/src/XSDRAW/XSDRAW_Functions.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -38,23 +39,24 @@ static Standard_Integer XSControl_xinit(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); if (theNbArgs != 2 && theNbArgs != 1) { - theDI << "Error:"; + aSSC.SStream() << "Error:"; return 1; } if (theNbArgs > 1) { - if (!XSDRAWBase::Session()->SelectNorm(theArgVec[1])); + if (!XSDRAWBase::Session()->SelectNorm(theArgVec[1])) { - theDI << "Error:"; + aSSC.SStream() << "Error:"; return 1; } } else { - Message::SendInfo() << "Selected Norm:"; - theDI << XSDRAWBase::Session()->SelectedNorm() << "\n"; + aSSC.SStream() << "Selected Norm:"; + aSSC.SStream() << XSDRAWBase::Session()->SelectedNorm() << "\n"; } return 0; } @@ -67,23 +69,25 @@ static Standard_Integer XSControl_xnorm(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); Handle(XSControl_Controller) control = WS->NormAdaptor(); if (theNbArgs == 1) { - Message::SendInfo() << "Current Norm. xnorm newnorm to change"; + aSSC.SStream() << "Current Norm. xnorm newnorm to change"; } else { - Message::SendInfo() << "Selected Norm:"; + aSSC.SStream() << "Selected Norm:"; } if (control.IsNull()) { - Message::SendInfo() << "no norm currently defined"; + aSSC.SStream() << "no norm currently defined"; } else { - Message::SendInfo() << " Long Name (complete) : " + aSSC.SStream() << " Long Name (complete) : " << control->Name(Standard_False) << " Short name (resource) : " << control->Name(Standard_True); } @@ -95,12 +99,12 @@ static Standard_Integer XSControl_xnorm(Draw_Interpretor& theDI, control = XSControl_Controller::Recorded(theArgVec[1]); if (control.IsNull()) { - Message::SendInfo() << " No norm named : " << theArgVec[1]; + aSSC.SStream() << " No norm named : " << theArgVec[1]; return 1; } WS->SetController(control); - Message::SendInfo() << "new norm : " << control->Name(); + aSSC.SStream() << "new norm : " << control->Name(); return 0; } @@ -112,12 +116,10 @@ static Standard_Integer XSControl_newmodel(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - if (!XSDRAWBase::Session()->NewModel().IsNull()) - { - return 0; - } - Message::SendInfo() << "No new Model produced"; - return 1; + (void)theDI; + (void)theNbArgs; + (void)theArgVec; + return 0; } //======================================================================= @@ -128,6 +130,9 @@ static Standard_Integer XSControl_tpclear(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + (void)theNbArgs; const Standard_Boolean modew = (theArgVec[0][2] == 'w'); Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); const Handle(Transfer_FinderProcess)& FP = @@ -137,14 +142,14 @@ static Standard_Integer XSControl_tpclear(Draw_Interpretor& theDI, if (modew) { if (!FP.IsNull()) FP->Clear(); - else Message::SendInfo() << "No Transfer Write"; + else aSSC.SStream() << "No Transfer Write"; } else { if (!TP.IsNull()) TP->Clear(); else - Message::SendInfo() << "No Transfer Read"; + aSSC.SStream() << "No Transfer Read"; } return 0; } @@ -157,13 +162,15 @@ static Standard_Integer XSControl_tpstat(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; const Standard_CString arg1 = theArgVec[1]; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); const Handle(Transfer_TransientProcess)& TP = WS->TransferReader()->TransientProcess(); if (TP.IsNull()) { - Message::SendInfo() << "No Transfer Read"; + aSSC.SStream() << "No Transfer Read"; return 1; } // **** tpstat **** @@ -208,10 +215,10 @@ static Standard_Integer XSControl_tpstat(Draw_Interpretor& theDI, } // A present help eventuel if (mod1 < -1) - Message::SendInfo() << "Unknown Mode"; + aSSC.SStream() << "Unknown Mode"; if (mod1 < 0) { - Message::SendInfo() << "Modes available :\n" + aSSC.SStream() << "Modes available :\n" << "g : general c : checks (count) C (list)\n" << " f : fails (count) F (list)\n" << " n : numbers of transferred entities (on TRANSFER ROOTS)\n" @@ -230,14 +237,14 @@ static Standard_Integer XSControl_tpstat(Draw_Interpretor& theDI, if (!TP.IsNull()) { - Message::SendInfo() << "TransferRead :"; - if (TP->Model() != WS->Model()) Message::SendInfo() << "Model differs from the session"; + aSSC.SStream() << "TransferRead :"; + if (TP->Model() != WS->Model()) aSSC.SStream() << "Model differs from the session"; Handle(TColStd_HSequenceOfTransient) list = - IFSelect_Functions::GiveList(WS, pilot->CommandPart(2)); + WS->GiveList(theArgVec[2]); XSControl_TransferReader::PrintStatsOnList(TP, list, mod1, mod2); - // TP->PrintStats (1,Message::SendInfo()); + // TP->PrintStats (1,aSSC.SStream()); } - else Message::SendInfo() << "TransferRead : not defined"; + else aSSC.SStream() << "TransferRead : not defined"; return 0; } @@ -249,6 +256,8 @@ static Standard_Integer XSControl_tpent(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; const Standard_CString arg1 = theArgVec[1]; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); const Handle(Transfer_TransientProcess)& TP = @@ -256,7 +265,7 @@ static Standard_Integer XSControl_tpent(Draw_Interpretor& theDI, // **** tpent **** if (TP.IsNull()) { - Message::SendInfo() << "No Transfer Read"; + aSSC.SStream() << "No Transfer Read"; return 1; } Handle(Interface_InterfaceModel) model = TP->Model(); @@ -265,22 +274,22 @@ static Standard_Integer XSControl_tpent(Draw_Interpretor& theDI, if (theNbArgs < 2) { - Message::SendInfo() << "Give ENTITY NUMBER (IN MODEL TransferProcess)"; + aSSC.SStream() << "Give ENTITY NUMBER (IN MODEL TransferProcess)"; return 1; } Standard_Integer num = atoi(arg1); if (num <= 0 || num > model->NbEntities()) { - Message::SendInfo() << "Number not in [1 - " + aSSC.SStream() << "Number not in [1 - " << model->NbEntities() << "]"; return 1; } Handle(Standard_Transient) ent = model->Value(num); Standard_Integer index = TP->MapIndex(ent); if (index == 0) - Message::SendInfo() << "Entity " << num << " not recorded in transfer"; + aSSC.SStream() << "Entity " << num << " not recorded in transfer"; else - WS->PrintTransferStatus(index, Standard_False, Message::SendInfo()); + WS->PrintTransferStatus(index, Standard_False, aSSC.SStream()); return 0; } @@ -292,11 +301,13 @@ static Standard_Integer XSControl_tpitem(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; const Standard_CString arg1 = theArgVec[1]; // **** tpitem/tproot/twitem/twroot **** if (theNbArgs < 2) { - Message::SendInfo() << "Give ITEM NUMBER (in TransferProcess)"; + aSSC.SStream() << "Give ITEM NUMBER (in TransferProcess)"; return 1; } Standard_Integer num = atoi(arg1); @@ -306,9 +317,9 @@ static Standard_Integer XSControl_tpitem(Draw_Interpretor& theDI, Handle(Transfer_Binder) binder; Handle(Transfer_Finder) finder; Handle(Standard_Transient) ent; - if (!XSDRAWBase::Session()->PrintTransferStatus(num, modew, Message::SendInfo())) + if (!XSDRAWBase::Session()->PrintTransferStatus(num, modew, aSSC.SStream())) { - Message::SendInfo() << " - Num=" << num << " incorrect"; + aSSC.SStream() << " - Num=" << num << " incorrect"; } return 0; } @@ -321,6 +332,8 @@ static Standard_Integer XSControl_trecord(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; const Standard_CString arg1 = theArgVec[1]; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); const Handle(Transfer_TransientProcess)& TP = WS->TransferReader()->TransientProcess(); @@ -332,7 +345,7 @@ static Standard_Integer XSControl_trecord(Draw_Interpretor& theDI, Handle(Standard_Transient) ent; if (mdl.IsNull() || TR.IsNull() || TP.IsNull()) { - Message::SendInfo() << " init not done"; + aSSC.SStream() << " init not done"; return 1; } if (!tous) @@ -341,24 +354,24 @@ static Standard_Integer XSControl_trecord(Draw_Interpretor& theDI, if (tous) { Standard_Integer nb = TP->NbRoots(); - Message::SendInfo() << " Recording " << nb << " Roots"; + aSSC.SStream() << " Recording " << nb << " Roots"; for (Standard_Integer i = 1; i <= nb; i++) { ent = TP->Root(i); if (TR->RecordResult(ent)) - Message::SendInfo() << " Root n0." << i; + aSSC.SStream() << " Root n0." << i; else - Message::SendInfo() << " Root n0." << i << " not recorded"; + aSSC.SStream() << " Root n0." << i << " not recorded"; } } else { if (num < 1 || num > mdl->NbEntities()) - Message::SendInfo() << "incorrect number:" << num; + aSSC.SStream() << "incorrect number:" << num; else if (TR->RecordResult(mdl->Value(num))) - Message::SendInfo() << " Entity n0." << num; + aSSC.SStream() << " Entity n0." << num; else - Message::SendInfo() << " Entity n0." << num << " not recorded"; + aSSC.SStream() << " Entity n0." << num << " not recorded"; } return 0; } @@ -371,26 +384,28 @@ static Standard_Integer XSControl_trstat(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; const Standard_CString arg1 = theArgVec[1]; // **** trstat : TransferReader **** Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); const Handle(XSControl_TransferReader)& TR = WS->TransferReader(); if (TR.IsNull()) { - Message::SendInfo() << " init not done"; + aSSC.SStream() << " init not done"; return 1; } Handle(Interface_InterfaceModel) mdl = TR->Model(); if (mdl.IsNull()) { - Message::SendInfo() << " No model"; + aSSC.SStream() << " No model"; return 1; } - Message::SendInfo() << " Statistics : FileName : " << TR->FileName(); + aSSC.SStream() << " Statistics : FileName : " << TR->FileName(); if (theNbArgs == 1) { // stats generales - TR->PrintStats(Message::SendInfo(), 10, 0); + TR->PrintStats(aSSC.SStream(), 10, 0); } else { @@ -398,31 +413,31 @@ static Standard_Integer XSControl_trstat(Draw_Interpretor& theDI, Standard_Integer num = atoi(arg1); if (num < 1 || num > mdl->NbEntities()) { - Message::SendInfo() << " incorrect number:" << arg1; + aSSC.SStream() << " incorrect number:" << arg1; return 1; } Handle(Standard_Transient) ent = mdl->Value(num); if (!TR->IsRecorded(ent)) { - Message::SendInfo() << " Entity " << num << " not recorded"; + aSSC.SStream() << " Entity " << num << " not recorded"; return 1; } Handle(Transfer_ResultFromModel) RM = TR->FinalResult(ent); Handle(TColStd_HSequenceOfTransient) list = TR->CheckedList(ent); Standard_Integer i, nb = list->Length(); if (nb > 0) - Message::SendInfo() << " Entities implied by Check/Result :" << nb << " i.e.:"; + aSSC.SStream() << " Entities implied by Check/Result :" << nb << " i.e.:"; for (i = 1; i <= nb; i++) { - Message::SendInfo() << " "; mdl->Print(list->Value(i), Message::SendInfo()); + aSSC.SStream() << " "; mdl->Print(list->Value(i), aSSC.SStream()); } if (RM.IsNull()) { - Message::SendInfo() << " no other info"; + aSSC.SStream() << " no other info"; return 0; } Interface_CheckIterator chl = RM->CheckList(Standard_False); - WS->PrintCheckList(Message::SendInfo(), chl, Standard_False, IFSelect_EntitiesByItem); + WS->PrintCheckList(aSSC.SStream(), chl, Standard_False, IFSelect_EntitiesByItem); } return 0; } @@ -435,6 +450,8 @@ static Standard_Integer XSControl_trbegin(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; // **** trbegin : TransferReader **** Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); Handle(XSControl_TransferReader) TR = WS->TransferReader(); @@ -449,7 +466,7 @@ static Standard_Integer XSControl_trbegin(Draw_Interpretor& theDI, TR = WS->TransferReader(); if (TR.IsNull()) { - Message::SendInfo() << " init not done or failed"; + aSSC.SStream() << " init not done or failed"; return 1; } } @@ -465,20 +482,21 @@ static Standard_Integer XSControl_tread(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - Standard_Integer theNbArgs = theNbArgs; + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; //const Standard_CString arg1 = pilot->Arg(1); // **** tread : TransferReader **** Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); Handle(XSControl_TransferReader) TR = WS->TransferReader(); if (TR.IsNull()) { - Message::SendInfo() << " init not done"; + aSSC.SStream() << " init not done"; return 1; } const Handle(Interface_InterfaceModel)& mdl = TR->Model(); if (mdl.IsNull()) { - Message::SendInfo() << " No model"; + aSSC.SStream() << " No model"; return 1; } if (theNbArgs < 2) @@ -487,19 +505,19 @@ static Standard_Integer XSControl_tread(Draw_Interpretor& theDI, Handle(Standard_Transient) sel = WS->NamedItem("xst-model-roots"); if (sel.IsNull()) { - Message::SendInfo() << "Select Roots absent"; + aSSC.SStream() << "Select Roots absent"; return 1; } Handle(TColStd_HSequenceOfTransient) list = WS->GiveList(sel); - Message::SendInfo() << " Transferring all roots i.e. : " << TR->TransferList(list); + aSSC.SStream() << " Transferring all roots i.e. : " << TR->TransferList(list); } else { Handle(TColStd_HSequenceOfTransient) list = - IFSelect_Functions::GiveList(WS, pilot->CommandPart(1)); - Message::SendInfo() << " Transfer of " << list->Length() << " entities"; + WS->GiveList(theArgVec[1]); + aSSC.SStream() << " Transfer of " << list->Length() << " entities"; Standard_Integer nb = TR->TransferList(list); - Message::SendInfo() << " Gives " << nb << " results"; + aSSC.SStream() << " Gives " << nb << " results"; } return 0; } @@ -512,13 +530,17 @@ static Standard_Integer XSControl_trtp(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + (void)theNbArgs; + (void)theArgVec; // **** TReader -> TProcess **** Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); const Handle(XSControl_TransferReader)& TR = WS->TransferReader(); if (TR.IsNull()) - Message::SendInfo() << " No TransferReader"; + aSSC.SStream() << " No TransferReader"; else if (TR->TransientProcess().IsNull()) - Message::SendInfo() << " Transfer Reader without Process"; + aSSC.SStream() << " Transfer Reader without Process"; return 0; } @@ -530,6 +552,10 @@ static Standard_Integer XSControl_tptr(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + (void)theNbArgs; + (void)theArgVec; // **** TProcess -> TReader **** XSDRAWBase::Session()->InitTransferReader(3); return 0; @@ -543,7 +569,8 @@ static Standard_Integer XSControl_twmode(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - Standard_Integer theNbArgs = theNbArgs; + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; const Standard_CString arg1 = theArgVec[1]; // **** twmode **** Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); @@ -552,20 +579,20 @@ static Standard_Integer XSControl_twmode(Draw_Interpretor& theDI, Standard_Integer modemin, modemax; if (control->ModeWriteBounds(modemin, modemax)) { - Message::SendInfo() << "Write Mode : allowed values " << modemin << " to " << modemax; + aSSC.SStream() << "Write Mode : allowed values " << modemin << " to " << modemax; for (Standard_Integer modd = modemin; modd <= modemax; modd++) { - Message::SendInfo() << modd << " : " << control->ModeWriteHelp(modd); + aSSC.SStream() << modd << " : " << control->ModeWriteHelp(modd); } } - Message::SendInfo() << "Write Mode : actual = " << TW->TransferMode(); + aSSC.SStream() << "Write Mode : actual = " << TW->TransferMode(); if (theNbArgs <= 1) return 0; Standard_Integer mod = atoi(arg1); - Message::SendInfo() << "New value -> " << arg1; + aSSC.SStream() << "New value -> " << arg1; TW->SetTransferMode(mod); if (!control->IsModeWrite(mod)) - Message::SendInfo() << "Warning : this new value is not supported"; + aSSC.SStream() << "Warning : this new value is not supported"; return 0; } @@ -577,36 +604,25 @@ static Standard_Integer XSControl_twstat(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - //Standard_Integer theNbArgs = theNbArgs; - //const Standard_CString arg1 = pilot->Arg(1); - //const Standard_CString arg2 = pilot->Arg(2); + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + (void)theNbArgs; + (void)theArgVec; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); const Handle(Transfer_FinderProcess)& FP = WS->TransferWriter()->FinderProcess(); // **** twstat **** // Pour Write if (!FP.IsNull()) { - Message::SendInfo() << "TransferWrite:"; + aSSC.SStream() << "TransferWrite:"; // XSControl_TransferWriter::PrintStatsProcess (FP,mod1,mod2); - FP->PrintStats(1, Message::SendInfo()); + FP->PrintStats(1, aSSC.SStream()); } else - Message::SendInfo() << "TransferWrite: not defined"; + aSSC.SStream() << "TransferWrite: not defined"; return 0; } -//======================================================================= -//function : XSControl_settransfert -//purpose : -//======================================================================= -static Standard_Integer XSControl_settransfert(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - // **** SelectForTransfer **** - return pilot->RecordItem(new XSControl_SelectForTransfer(XSDRAWBase::Session()->TransferReader())); -} - //======================================================================= //function : Init //purpose : @@ -667,7 +683,4 @@ void XSDRAW_Functions::Init(Draw_Interpretor& theDI) "displays mode transfer write, + num changes it", __FILE__, XSControl_twmode, aGroup); theDI.Add("twstat", "Statistics on TransferProcess (WRITE)", __FILE__, XSControl_twstat, aGroup); - - theDI.Add("selecttransfer", - "selection (recognize from transfer actor)", __FILE__, XSControl_settransfert); } diff --git a/src/XSDRAW/XSDRAW_FunctionsSession.cxx b/src/XSDRAW/XSDRAW_FunctionsSession.cxx index 5e23f906cf..e968885888 100644 --- a/src/XSDRAW/XSDRAW_FunctionsSession.cxx +++ b/src/XSDRAW/XSDRAW_FunctionsSession.cxx @@ -69,31 +69,9 @@ #include #include #include +#include #include -//======================================================================= -//function : SplitFileName -//purpose : Decomposition of a file name in its parts : prefix, root, suffix -//======================================================================= -static void SplitFileName(const Standard_CString filename, - TCollection_AsciiString& prefix, - TCollection_AsciiString& fileroot, - TCollection_AsciiString& suffix) -{ - Standard_Integer nomdeb, nomfin, nomlon; - TCollection_AsciiString resfile(filename); - nomlon = resfile.Length(); - nomdeb = resfile.SearchFromEnd("/"); - if (nomdeb <= 0) nomdeb = resfile.SearchFromEnd("\\"); // pour NT - if (nomdeb < 0) nomdeb = 0; - nomfin = resfile.SearchFromEnd("."); - if (nomfin < nomdeb) nomfin = nomlon + 1; - - if (nomdeb > 0) prefix = resfile.SubString(1, nomdeb); - fileroot = resfile.SubString(nomdeb + 1, nomfin - 1); - if (nomfin <= nomlon) suffix = resfile.SubString(nomfin, nomlon); -} - //======================================================================= //function : GiveList //purpose : @@ -112,80 +90,6 @@ Handle(TColStd_HSequenceOfTransient) GiveList(const Handle(XSControl_WorkSession // Or a name of dispatch + a parameter : dispatch-name(param-value) // According to type of Dispatch : integer , signature name -//======================================================================= -//function : GiveDispatch -//purpose : -//======================================================================= -Handle(IFSelect_Dispatch) GiveDispatch(const Handle(XSControl_WorkSession)& WS, - const Standard_CString name, - const Standard_Boolean mode) -{ - DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(name)); - if (!disp.IsNull()) return disp; // OK as it is given - -// Else, let s try special cases - TCollection_AsciiString nam(name); - Standard_Integer paro = nam.Location(1, '(', 1, nam.Length()); - Standard_Integer parf = nam.Location(1, ')', 1, nam.Length()); - nam.SetValue(paro, '\0'); nam.SetValue(parf, '\0'); - if (paro <= 0 && parf <= 0) return disp; - disp = GetCasted(IFSelect_Dispatch, WS->NamedItem(nam.ToCString())); - if (disp.IsNull()) return disp; // KO anyway - -// According to the type of dispatch : - DeclareAndCast(IFSelect_DispPerCount, dc, disp); - if (!dc.IsNull()) - { - Standard_Integer nb = atoi(&(nam.ToCString())[paro]); - if (nb <= 0) - { - Message::SendInfo() << " DispPerCount, count is not positive"; - disp.Nullify(); - return disp; - } - if (mode) - { - Handle(IFSelect_IntParam) val = new IFSelect_IntParam; - val->SetValue(nb); - dc->SetCount(val); - } - return dc; - } - DeclareAndCast(IFSelect_DispPerFiles, dp, disp); - if (!dp.IsNull()) - { - Standard_Integer nb = atoi(&(nam.ToCString())[paro]); - if (nb <= 0) - { - Message::SendInfo() << " DispPerFiles, count is not positive"; - disp.Nullify(); - return disp; - } - if (mode) - { - Handle(IFSelect_IntParam) val = new IFSelect_IntParam; - val->SetValue(nb); - dp->SetCount(val); - } - return dp; - } - DeclareAndCast(IFSelect_DispPerSignature, ds, disp); - if (!ds.IsNull()) - { - DeclareAndCast(IFSelect_Signature, sg, WS->NamedItem(&(nam.ToCString())[paro])); - if (sg.IsNull()) - { - Message::SendInfo() << "DispPerSignature " << nam << " , Signature not valid : " << &(nam.ToCString())[paro]; - disp.Nullify(); - return disp; - } - if (mode) ds->SetSignCounter(new IFSelect_SignCounter(sg)); - return ds; - } - Message::SendInfo() << "Dispatch : " << name << " , Parameter : " << &(nam.ToCString())[paro]; - return disp; -} - // Functions definit un certain nombre de commandes // enregistrees dans le Dictionnaire de Activator (par des Act unitaires) // Les actions elles-memes sont regroupees en fin de fichier @@ -200,12 +104,16 @@ static Standard_Integer funstatus(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + (void)theNbArgs; + (void)theArgVec; // **** Version & cie **** //#58 rln - Message::SendInfo() << "Processor Version : " << XSTEP_PROCESSOR_VERSION; - Message::SendInfo() << "OL Version : " << XSTEP_SYSTEM_VERSION; - Message::SendInfo() << "Configuration : " << XSTEP_Config; - Message::SendInfo() << "UL Names : " << XSTEP_ULNames; + aSSC.SStream() << "Processor Version : " << XSTEP_PROCESSOR_VERSION; + aSSC.SStream() << "OL Version : " << XSTEP_SYSTEM_VERSION; + aSSC.SStream() << "Configuration : " << XSTEP_Config; + aSSC.SStream() << "UL Names : " << XSTEP_ULNames; return 0; } @@ -217,11 +125,15 @@ static Standard_Integer fun1(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + (void)theNbArgs; + (void)theArgVec; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** ToggleHandler **** Standard_Boolean hand = !WS->ErrorHandle(); - if (hand) Message::SendInfo() << " -- Mode Catch Error now Active"; - else Message::SendInfo() << " -- Mode Catch Error now Inactive"; + if (hand) aSSC.SStream() << " -- Mode Catch Error now Active"; + else aSSC.SStream() << " -- Mode Catch Error now Inactive"; WS->SetErrorHandle(hand); return 0; } @@ -234,42 +146,44 @@ static Standard_Integer fun3(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** XRead / Load **** if (theNbArgs < 2) { - Message::SendInfo() << "Read/Load : give file name !"; + aSSC.SStream() << "Read/Load : give file name !"; return 1; } if (WS->Protocol().IsNull()) { - Message::SendInfo() << "Protocol not defined"; + aSSC.SStream() << "Protocol not defined"; return 1; } if (WS->WorkLibrary().IsNull()) { - Message::SendInfo() << "WorkLibrary not defined"; + aSSC.SStream() << "WorkLibrary not defined"; return 1; } - IFSelect_ReturnStatus status = WS->ReadFile(arg1); // status : 0 OK, 1 erreur lecture, 2 Fail(try/catch), // -1 fichier non trouve, -2 lecture faite mais resultat vide switch (status) { - case IFSelect_RetVoid: Message::SendInfo() << "file:" << arg1 << " gives empty result"; break; - case IFSelect_RetError: Message::SendInfo() << "file:" << arg1 << " could not be opened"; break; - case IFSelect_RetDone: Message::SendInfo() << "file:" << arg1 << " read"; break; - case IFSelect_RetFail: Message::SendInfo() << "file:" << arg1 << " : error while reading"; break; - case IFSelect_RetStop: Message::SendInfo() << "file:" << arg1 << " : EXCEPTION while reading"; break; - default: Message::SendInfo() << "file:" << arg1 << " could not be read"; break; + case IFSelect_RetVoid: aSSC.SStream() << "file:" << arg1 << " gives empty result"; break; + case IFSelect_RetError: aSSC.SStream() << "file:" << arg1 << " could not be opened"; break; + case IFSelect_RetDone: aSSC.SStream() << "file:" << arg1 << " read"; break; + case IFSelect_RetFail: aSSC.SStream() << "file:" << arg1 << " : error while reading"; break; + case IFSelect_RetStop: aSSC.SStream() << "file:" << arg1 << " : EXCEPTION while reading"; break; + default: aSSC.SStream() << "file:" << arg1 << " could not be read"; break; } - if (status != IFSelect_RetDone) return status; - // Message::SendInfo()<<" - clearing list of already written files"<BeginSentFiles(Standard_True); - return status; + return 0; } //======================================================================= @@ -280,47 +194,18 @@ static Standard_Integer fun4(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** Write All **** if (theNbArgs < 2) { - Message::SendInfo() << "Write All : give file name !"; - return 1; - } - return WS->SendAll(arg1); -} - -//======================================================================= -//function : fun5 -//purpose : -//======================================================================= -static Standard_Integer fun5(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; - const Standard_CString arg1 = theArgVec[1]; - // const Standard_CString arg2 = theArgVec[2]; - // **** Write Selected **** - if (theNbArgs < 3) - { - Message::SendInfo() << "Write Selected : give file name + givelist !"; - return 1; - } - Handle(TColStd_HSequenceOfTransient) result = - XSDRAW_FunctionsSession::GiveList(WS, pilot->CommandPart(2)); - if (result.IsNull()) - { - Message::SendInfo() << "No entity selected"; + aSSC.SStream() << "Write All : give file name !"; return 1; } - else Message::SendInfo() << "Nb Entities selected : " << result->Length(); - Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed; - sp->SetList(result); - return WS->SendSelected(arg1, sp); + return WS->SendAll(arg1) == IFSelect_RetDone; } //======================================================================= @@ -331,40 +216,42 @@ static Standard_Integer fun6(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** Write Entite(s) **** if (theNbArgs < 3) { - Message::SendInfo() << "Write Entitie(s) : give file name + n0s entitie(s)!"; + aSSC.SStream() << "Write Entitie(s) : give file name + n0s entitie(s)!"; return 1; } int ko = 0; Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed; for (Standard_Integer ia = 2; ia < theNbArgs; ia++) { - Standard_Integer id = pilot->Number(pilot->Arg(ia)); + Standard_Integer id = WS->NumberFromLabel(theArgVec[ia]); if (id > 0) { Handle(Standard_Transient) item = WS->StartingEntity(id); - if (sp->Add(item)) Message::SendInfo() << "Added:no." << id; + if (sp->Add(item)) aSSC.SStream() << "Added:no." << id; else { - Message::SendInfo() << " Fail Add n0." << id; ko++; + aSSC.SStream() << " Fail Add n0." << id; ko++; } } else { - Message::SendInfo() << "Not an entity number:" << pilot->Arg(ia); ko++; + aSSC.SStream() << "Not an entity number:" << theArgVec[ia]; ko++; } } if (ko > 0) { - Message::SendInfo() << ko << " bad arguments, abandon"; + aSSC.SStream() << ko << " bad arguments, abandon"; return 1; } - return WS->SendSelected(arg1, sp); + return WS->SendSelected(arg1, sp) == IFSelect_RetDone; } //======================================================================= @@ -375,29 +262,31 @@ static Standard_Integer fun7(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** Entity Label **** if (theNbArgs < 2) { - Message::SendInfo() << "Give entity number"; + aSSC.SStream() << "Give entity number"; return 1; } if (!WS->HasModel()) { - Message::SendInfo() << "No loaded model, abandon"; + aSSC.SStream() << "No loaded model, abandon"; return 1; } Standard_Integer nument = WS->NumberFromLabel(arg1); if (nument <= 0 || nument > WS->NbStartingEntities()) { - Message::SendInfo() << "Not a suitable number: " << arg1; + aSSC.SStream() << "Not a suitable number: " << arg1; return 1; } - Message::SendInfo() << "N0." << nument << " ->Label in Model : "; - WS->Model()->PrintLabel(WS->StartingEntity(nument), Message::SendInfo()); - Message::SendInfo(); + aSSC.SStream() << "N0." << nument << " ->Label in Model : "; + WS->Model()->PrintLabel(WS->StartingEntity(nument), aSSC.SStream()); + return 0; } @@ -409,142 +298,60 @@ static Standard_Integer fun8(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** Entity Number **** if (theNbArgs < 2) { - Message::SendInfo() << "Give label to search"; + aSSC.SStream() << "Give label to search"; return 1; } if (!WS->HasModel()) { - Message::SendInfo() << "No loaded model, abandon"; + aSSC.SStream() << "No loaded model, abandon"; return 1; } const Handle(Interface_InterfaceModel)& model = WS->Model(); Standard_Integer i, cnt = 0; Standard_Boolean exact = Standard_False; - Message::SendInfo() << " ** Search Entity Number for Label : " << arg1; + aSSC.SStream() << " ** Search Entity Number for Label : " << arg1; for (i = model->NextNumberForLabel(arg1, 0, exact); i != 0; i = model->NextNumberForLabel(arg1, i, exact)) { cnt++; - Message::SendInfo() << " ** Found n0/id:"; - model->Print(model->Value(i), Message::SendInfo()); - Message::SendInfo(); + aSSC.SStream() << " ** Found n0/id:"; + model->Print(model->Value(i), aSSC.SStream()); + } - if (cnt == 0) Message::SendInfo() << " ** No Match"; - else if (cnt == 1) Message::SendInfo() << " ** 1 Match"; - else Message::SendInfo() << cnt << " Matches"; + if (cnt == 0) aSSC.SStream() << " ** No Match"; + else if (cnt == 1) aSSC.SStream() << " ** 1 Match"; + else aSSC.SStream() << cnt << " Matches"; return 0; } //======================================================================= -//function : fun9 +//function : funsigntype //purpose : //======================================================================= static Standard_Integer fun9(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - // **** List Types **** - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + XSDRAW::StreamContainer aSSC(theDI); + (void)theNbArgs; + (void)theArgVec; + Handle(IFSelect_WorkSession) WS = XSDRAWBase::Session(); Handle(IFSelect_Signature) signtype = WS->SignType(); if (signtype.IsNull()) signtype = new IFSelect_SignType; Handle(IFSelect_SignCounter) counter = new IFSelect_SignCounter(signtype, Standard_False); - return pilot->ExecuteCounter(counter, 1); -} - -//======================================================================= -//function : funcount -//purpose : -//======================================================================= -static Standard_Integer funcount(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; - const Standard_CString arg0 = theArgVec[0]; - const Standard_CString arg1 = theArgVec[1]; - Standard_Boolean listmode = (arg0[0] == 'l'); - // **** List Counter **** - - if (theNbArgs < 2) - { - Message::SendInfo() << "Designer signature ou compteur, + facultatif selection + facultatif entite"; - Message::SendInfo() << " signature/compteur seul -> tout le modele" - << " sign/compteur + selection -> cette selection, evaluation normale" - << " sign/compteur + sel + num -> cette selection evaluee sur entite n0 num"; - return 1; - } - DeclareAndCast(IFSelect_SignCounter, counter, WS->NamedItem(arg1)); - if (counter.IsNull()) - { - DeclareAndCast(IFSelect_Signature, signa, WS->NamedItem(arg1)); - if (!signa.IsNull()) counter = new IFSelect_SignCounter(signa, Standard_False, listmode); - } - // Handle(IFSelect_Selection) sel; - // Standard_Integer n3 = 0; if (theNbArgs > 3) n3 = WS->NumberFromLabel(arg3); - // if (theNbArgs > 2) sel = GetCasted(IFSelect_Selection,WS->NamedItem(arg2)); - // if (counter.IsNull() || (theNbArgs > 2 && n3 <= 0 && sel.IsNull()) ) { - // Message::SendInfo()<<"Nom:"< 2) Message::SendInfo()<<" et/ou "<GiveSelection(arg1); - DeclareAndCast(IFSelect_SelectDeduct, seld, sel); - if (!seld.IsNull()) - { - // Si onflag, faire une SelectSuite - if (onflag > 2) - { - Handle(IFSelect_SelectSuite) suite = new IFSelect_SelectSuite; - for (i = 1; i < onflag; i++) - { - sel = WS->GiveSelection(theArgVec[i]); - if (!suite->AddInput(sel)) - { - Message::SendInfo() << "Incorrect definition for applied selection"; - return 1; - } - } - seld = suite; - } - - Handle(IFSelect_GraphCounter) gc = new IFSelect_GraphCounter(Standard_False, listmode); - gc->SetApplied(seld); - counter = gc; - } - - if (counter.IsNull()) - { - Message::SendInfo() << "Neither Counter nor Signature : " << arg1; - return 1; - } - - if (onflag == 0) onflag = 1; - IFSelect_PrintCount pcm = IFSelect_ListByItem; - if (arg0[0] == 'c') pcm = IFSelect_CountByItem; - if (arg0[0] == 's') pcm = IFSelect_CountSummary; - return pilot->ExecuteCounter(counter, onflag + 1, pcm); + counter->AddModel(WS->Model()); + counter->PrintList(aSSC.SStream(), WS->Model(), IFSelect_CountByItem); + return 0; } //======================================================================= @@ -555,43 +362,45 @@ static Standard_Integer funsigntype(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** Sign Type **** Handle(IFSelect_Signature) signtype = WS->SignType(); - if (signtype.IsNull()) Message::SendInfo() << "signtype actually undefined"; + if (signtype.IsNull()) aSSC.SStream() << "signtype actually undefined"; else { Handle(TCollection_HAsciiString) str = WS->Name(signtype); Standard_Integer id = WS->ItemIdent(signtype); - Message::SendInfo() << signtype->Label(); + aSSC.SStream() << signtype->Label(); if (str.IsNull()) { - if (id > 0) Message::SendInfo() << "signtype : item n0 " << id; + if (id > 0) aSSC.SStream() << "signtype : item n0 " << id; } else { - Message::SendInfo() << "signtype : also named as " << str->ToCString(); + aSSC.SStream() << "signtype : also named as " << str->ToCString(); } } - if (theNbArgs < 2) Message::SendInfo() << "signtype newitem to change, signtype . to clear"; + if (theNbArgs < 2) aSSC.SStream() << "signtype newitem to change, signtype . to clear"; else { if (arg1[0] == '.' && arg1[1] == '\0') { signtype.Nullify(); - Message::SendInfo() << "signtype now cleared"; + aSSC.SStream() << "signtype now cleared"; } else { signtype = GetCasted(IFSelect_Signature, WS->NamedItem(arg1)); if (signtype.IsNull()) { - Message::SendInfo() << "Not a Signature : " << arg1; + aSSC.SStream() << "Not a Signature : " << arg1; return 1; } - else Message::SendInfo() << "signtype now set to " << arg1; + else aSSC.SStream() << "signtype now set to " << arg1; } WS->SetSignType(signtype); return 0; @@ -607,29 +416,32 @@ static Standard_Integer funsigncase(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + (void)theNbArgs; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); const Standard_CString arg1 = theArgVec[1]; // **** Sign Case **** Handle(IFSelect_Signature) signcase = GetCasted(IFSelect_Signature, WS->NamedItem(arg1)); - if (signcase.IsNull()) Message::SendInfo() << "Not a Signature : " << arg1; + if (signcase.IsNull()) aSSC.SStream() << "Not a Signature : " << arg1; else { Standard_Boolean hasmin, hasmax; Standard_Integer valmin, valmax; if (signcase->IsIntCase(hasmin, valmin, hasmax, valmax)) { - Message::SendInfo() << "Signature " << arg1 << " : Integer Case"; - if (hasmin) Message::SendInfo() << " - Mini:" << valmin; - if (hasmax) Message::SendInfo() << " - Maxi:" << valmax; - Message::SendInfo(); + aSSC.SStream() << "Signature " << arg1 << " : Integer Case"; + if (hasmin) aSSC.SStream() << " - Mini:" << valmin; + if (hasmax) aSSC.SStream() << " - Maxi:" << valmax; + } Handle(TColStd_HSequenceOfAsciiString) caselist = signcase->CaseList(); - if (caselist.IsNull()) Message::SendInfo() << "Signature " << arg1 << " : no predefined case, see command count " << arg1; + if (caselist.IsNull()) aSSC.SStream() << "Signature " << arg1 << " : no predefined case, see command count " << arg1; else { Standard_Integer i, nb = caselist->Length(); - Message::SendInfo() << "Signature " << arg1 << " : " << nb << " basic cases :"; - for (i = 1; i <= nb; i++) Message::SendInfo() << " " << caselist->Value(i); - Message::SendInfo(); + aSSC.SStream() << "Signature " << arg1 << " : " << nb << " basic cases :"; + for (i = 1; i <= nb; i++) aSSC.SStream() << " " << caselist->Value(i); + } } return 0; @@ -643,28 +455,30 @@ static Standard_Integer fun10(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** Entity Status **** Standard_Integer i, nb; if (theNbArgs < 2) { nb = Interface_Category::NbCategories(); - Message::SendInfo() << " Categories defined :" << nb << " i.e. :\n"; + aSSC.SStream() << " Categories defined :" << nb << " i.e. :\n"; for (i = 0; i <= nb; i++) - Message::SendInfo() << "Cat." << i << " : " << Interface_Category::Name(i) << "\n"; - Message::SendInfo() << " On a given entity : give its number"; + aSSC.SStream() << "Cat." << i << " : " << Interface_Category::Name(i) << "\n"; + aSSC.SStream() << " On a given entity : give its number"; return 0; } - Standard_Integer num = pilot->Number(arg1); + Standard_Integer num = WS->NumberFromLabel(arg1); if (num <= 0 || num > WS->NbStartingEntities()) { - Message::SendInfo() << "Not a suitable entity number : " << arg1; + aSSC.SStream() << "Not a suitable entity number : " << arg1; return 1; } Handle(Standard_Transient) ent = WS->StartingEntity(num); - WS->PrintEntityStatus(ent, Message::SendInfo()); + WS->PrintEntityStatus(ent, aSSC.SStream()); return 0; } @@ -676,8 +490,11 @@ static Standard_Integer fun11(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + (void)theNbArgs; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - // Standard_Integer theNbArgs = theNbArgs; + // const Standard_CString arg1 = theArgVec[1]; // **** DumpModel (Data) **** Standard_Integer niv = 0; @@ -686,7 +503,7 @@ static Standard_Integer fun11(Draw_Interpretor& theDI, switch (arg1[0]) { case '?': - Message::SendInfo() << "? for this help, else give a listing mode (first letter suffices) :\n" + aSSC.SStream() << "? for this help, else give a listing mode (first letter suffices) :\n" << " general General Statistics\n roots Roots\n" << " entities All Entities\n" << " listfails CheckList (fails) per entity\n" @@ -707,7 +524,7 @@ static Standard_Integer fun11(Draw_Interpretor& theDI, case 'T': niv = 7; break; case 'f': niv = 8; break; case 'F': niv = 10; break; - default: Message::SendInfo() << "Unknown Mode . data tout court pour help"; + default: aSSC.SStream() << "Unknown Mode . data tout court pour help"; return 1; } WS->TraceDumpModel(niv); @@ -722,46 +539,50 @@ static Standard_Integer fundumpent(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; Handle(IFSelect_WorkLibrary) WL = WS->WorkLibrary(); + Standard_SStream aStream; Standard_Integer levdef = 0, levmax = 10, level; WL->DumpLevels(levdef, levmax); if (theNbArgs < 2 || (theNbArgs == 2 && levmax < 0)) { - Message::SendInfo() << "Give n0 or id of entity"; - if (levmax < 0) Message::SendInfo() << " and dump level"; - else Message::SendInfo() << " + optional, dump level in [0 - " << levmax << "] , default = " << levdef; + aSSC.SStream() << "Give n0 or id of entity"; + if (levmax < 0) + aSSC.SStream() << " and dump level"; + else + aSSC.SStream() << " + optional, dump level in [0 - " << levmax << "] , default = " << levdef; for (level = 0; level <= levmax; level++) { Standard_CString help = WL->DumpHelp(level); - if (help[0] != '\0') Message::SendInfo() << level << " : " << help; + if (help[0] != '\0') + aStream << level << " : " << help; } return 1; } const Standard_CString arg1 = theArgVec[1]; const Standard_CString arg2 = theArgVec[2]; - Standard_Integer num = pilot->Number(arg1); + Standard_Integer num = WS->NumberFromLabel(arg1); if (num == 0) return 1; level = levdef; - if (theNbArgs > 2) level = atoi(arg2); + if (theNbArgs > 2) + level = atoi(arg2); Handle(Standard_Transient) ent = WS->StartingEntity(num); if (ent.IsNull()) { - Message::SendInfo() << "No entity with given id " << arg1 << " (" << num << ") is found in the current model"; + aStream << "No entity with given id " << arg1 << " (" << num << ") is found in the current model"; } else { - Message::SendInfo() << " -- DUMP Entity n0 " << num << " level " << level; - WL->DumpEntity(WS->Model(), WS->Protocol(), ent, Message::SendInfo(), level); + aStream << " -- DUMP Entity n0 " << num << " level " << level; + WL->DumpEntity(WS->Model(), WS->Protocol(), ent, aStream, level); Interface_CheckIterator chl = WS->CheckOne(ent); - if (!chl.IsEmpty(Standard_False)) chl.Print(Message::SendInfo(), WS->Model(), Standard_False); + if (!chl.IsEmpty(Standard_False)) + chl.Print(aStream, WS->Model(), Standard_False); } - // Message::SendInfo() << std::flush; - return 0; } @@ -773,26 +594,28 @@ static Standard_Integer funsign(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; const Standard_CString arg2 = theArgVec[2]; if (theNbArgs < 3) { - Message::SendInfo() << " Give signature name + n0 or id of entity"; + aSSC.SStream() << " Give signature name + n0 or id of entity"; return 1; } DeclareAndCast(IFSelect_Signature, sign, WS->NamedItem(arg1)); if (sign.IsNull()) { - Message::SendInfo() << "Not a signature : " << arg1; + aSSC.SStream() << "Not a signature : " << arg1; return 1; } - Standard_Integer num = pilot->Number(arg2); + Standard_Integer num = WS->NumberFromLabel(arg2); Handle(Standard_Transient) ent = WS->StartingEntity(num); if (num == 0) return 1; - Message::SendInfo() << "Entity n0 " << num << " : " << WS->SignValue(sign, ent); + aSSC.SStream() << "Entity n0 " << num << " : " << WS->SignValue(sign, ent); return 0; } @@ -804,23 +627,25 @@ static Standard_Integer funqp(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; const Standard_CString arg2 = theArgVec[2]; if (theNbArgs < 3) { - Message::SendInfo() << " Give 2 numeros or labels : dad son"; + aSSC.SStream() << " Give 2 numeros or labels : dad son"; return 1; } Standard_Integer n1 = WS->NumberFromLabel(arg1); Standard_Integer n2 = WS->NumberFromLabel(arg2); - Message::SendInfo() << "QueryParent for dad:" << arg1 << ":" << n1 << " and son:" << arg2 << ":" << n2; + aSSC.SStream() << "QueryParent for dad:" << arg1 << ":" << n1 << " and son:" << arg2 << ":" << n2; Standard_Integer qp = WS->QueryParent(WS->StartingEntity(n1), WS->StartingEntity(n2)); - if (qp < 0) Message::SendInfo() << arg1 << " is not super-entity of " << arg2; - else if (qp == 0) Message::SendInfo() << arg1 << " is same as " << arg2; - else Message::SendInfo() << arg1 << " is super-entity of " << arg2 << " , max level found=" << qp; - // Message::SendInfo()<<" Trouve "<DumpShare(); return 0; + WS->DumpShare(); + return 0; } //======================================================================= @@ -845,31 +675,13 @@ static Standard_Integer fun13(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + (void)theNbArgs; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** ListItems **** - WS->ListItems(theArgVec[1]); return 0; -} - -//======================================================================= -//function : fun14 -//purpose : -//======================================================================= -static Standard_Integer fun14(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; - const Standard_CString arg1 = theArgVec[1]; - // **** NewInt **** - if (theNbArgs < 1) - { - Message::SendInfo() << "Donner la valeur entiere pour IntParam"; - return 1; - } - Handle(IFSelect_IntParam) intpar = new IFSelect_IntParam; - if (theNbArgs >= 1) intpar->SetValue(atoi(arg1)); - return pilot->RecordItem(intpar); + WS->ListItems(theArgVec[1]); + return 0; } //======================================================================= @@ -880,14 +692,16 @@ static Standard_Integer fun15(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; const Standard_CString arg2 = theArgVec[2]; // **** SetInt **** if (theNbArgs < 3) { - Message::SendInfo() << "Donner 2 arguments : nom Parametre et Valeur"; + aSSC.SStream() << "Donner 2 arguments : nom Parametre et Valeur"; return 1; } Standard_Integer val = atoi(arg2); @@ -897,28 +711,6 @@ static Standard_Integer fun15(Draw_Interpretor& theDI, return 0; } -//======================================================================= -//function : fun16 -//purpose : -//======================================================================= -static Standard_Integer fun16(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; - const Standard_CString arg1 = theArgVec[1]; - // **** NewText **** - if (theNbArgs < 1) - { - Message::SendInfo() << "Donner la valeur texte pour TextParam"; - return 1; - } - Handle(TCollection_HAsciiString) textpar = new TCollection_HAsciiString(); - if (theNbArgs >= 1) textpar->AssignCat(arg1); - return pilot->RecordItem(textpar); -} - //======================================================================= //function : fun17 //purpose : @@ -927,14 +719,16 @@ static Standard_Integer fun17(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; const Standard_CString arg2 = theArgVec[2]; // **** SetText **** if (theNbArgs < 3) { - Message::SendInfo() << "Donner 2 arguments : nom Parametre et Valeur"; + aSSC.SStream() << "Donner 2 arguments : nom Parametre et Valeur"; return 1; } DeclareAndCast(TCollection_HAsciiString, par, WS->NamedItem(arg1)); @@ -951,148 +745,21 @@ static Standard_Integer fun19(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** DumpSel **** if (theNbArgs < 2) { - Message::SendInfo() << "Give 1 argument : Selection Name"; + aSSC.SStream() << "Give 1 argument : Selection Name"; return 1; } WS->DumpSelection(GetCasted(IFSelect_Selection, WS->NamedItem(arg1))); return 0; } -//======================================================================= -//function : fun20 -//purpose : -//======================================================================= -static Standard_Integer fun20(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; - // **** EvalSel **** - // **** GiveList **** - // **** GiveShort GivePointed **** - // **** MakeList **** - char mode = theArgVec[0][0]; // givelist/makelist - if (mode == 'g') mode = theArgVec[0][4]; // l list s short p pointed - if (theNbArgs < 2) - { - Message::SendInfo() << "Give Entity ID, or Selection Name [+ optional other selection or entity]"; - return 1; - } - - // MakeList : sur Pointed existante ou a creer - Handle(IFSelect_SelectPointed) pnt; - if (mode == 'm') - { - const Standard_CString arg1 = theArgVec[1]; - Handle(Standard_Transient) item = WS->NamedItem(arg1); - pnt = GetCasted(IFSelect_SelectPointed, item); - if (!pnt.IsNull()) - { - Message::SendInfo() << arg1 << ":Already existing Selection for List, cleared then filled"; - pnt->Clear(); - } - else if (!item.IsNull()) - { - Message::SendInfo() << arg1 << ":Already existing Item not for a List, command ignored"; - return 1; - } - else - { - pnt = new IFSelect_SelectPointed; - WS->AddNamedItem(arg1, pnt); - } - } - - Handle(TColStd_HSequenceOfTransient) result = - XSDRAW_FunctionsSession::GiveList(WS, pilot->CommandPart((mode == 'm' ? 2 : 1))); - if (result.IsNull()) - return 1; - Interface_EntityIterator iter(result); - Message::SendInfo() << pilot->CommandPart((mode == 'm' ? 2 : 1)) << " : "; - if (mode == 'l') WS->ListEntities(iter, 0, Message::SendInfo()); - else if (mode == 's' || mode == 'm') WS->ListEntities(iter, 2, Message::SendInfo()); - else if (mode == 'p') - { - Message::SendInfo() << iter.NbEntities() << " Entities : "; - for (iter.Start(); iter.More(); iter.Next()) - Message::SendInfo() << " +" << WS->StartingNumber(iter.Value()); - Message::SendInfo(); - } - - if (!pnt.IsNull()) - { - pnt->SetList(result); - Message::SendInfo() << "List set to a SelectPointed : " << theArgVec[1]; - Message::SendInfo() << "Later editable by command setlist"; - } - - return 0; -} - -//======================================================================= -//function : fun20c -//purpose : -//======================================================================= -static Standard_Integer fun20c(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; - // **** GiveCount **** - if (theNbArgs < 2) - { - Message::SendInfo() << "Give Entity ID, or Selection Name [+ optional other selection or entity]"; - return 1; - } - // WS->EvaluateSelection(GetCasted(IFSelect_Selection,WS->NamedItem(arg1))); - Handle(TColStd_HSequenceOfTransient) result = - XSDRAW_FunctionsSession::GiveList(WS, pilot->CommandPart(1)); - if (result.IsNull()) - return 1; - Message::SendInfo() << pilot->CommandPart(1) << " : List of " << result->Length() << " Entities"; - return 0; -} - -//======================================================================= -//function : funselsuite -//purpose : -//======================================================================= -static Standard_Integer funselsuite(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; - // **** SelSuite **** - if (theNbArgs < 2) - { - Message::SendInfo() << "Give Entity ID, or Selection Name [+ optional other selection or entity]"; - return 1; - } - // WS->EvaluateSelection(GetCasted(IFSelect_Selection,WS->NamedItem(arg1))); - Handle(IFSelect_SelectSuite) selsuite = new IFSelect_SelectSuite; - - for (Standard_Integer i = 1; i < theNbArgs; i++) - { - Handle(IFSelect_Selection) sel = WS->GiveSelection(theArgVec[i]); - if (!selsuite->AddInput(sel)) - { - Message::SendInfo() << pilot->Arg(i - 1) << " : not a SelectDeduct, no more can be added. Abandon"; - return 1; - } - } - selsuite->SetLabel(pilot->CommandPart(1)); - return pilot->RecordItem(selsuite); -} - //======================================================================= //function : fun21 //purpose : @@ -1101,6 +768,10 @@ static Standard_Integer fun21(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + (void)theNbArgs; + (void)theArgVec; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** ClearItems **** WS->ClearItems(); WS->ClearFinalModifiers(); WS->ClearShareOut(Standard_False); @@ -1111,8 +782,10 @@ static Standard_Integer fun22(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** ClearData **** Standard_Integer mode = -1; @@ -1127,10 +800,10 @@ static Standard_Integer fun22(Draw_Interpretor& theDI, else mode = 0; if (mode <= 0) { - if (mode < 0) Message::SendInfo() << "Give a suitable mode"; - Message::SendInfo() << " Available Modes :\n" + if (mode < 0) aSSC.SStream() << "Give a suitable mode"; + aSSC.SStream() << " Available Modes :\n" << " a : all data g : graph+check c : check p : selectpointed"; - return (mode < 0 ? IFSelect_RetError : IFSelect_RetVoid); + return 1; } WS->ClearData(mode); return 0; @@ -1144,13 +817,15 @@ static Standard_Integer fun24(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + // **** Item Label **** TCollection_AsciiString label; if (theNbArgs < 2) { - Message::SendInfo() << " Give label to search"; + aSSC.SStream() << " Give label to search"; return 1; } for (int i = 1; i < theNbArgs; i++) @@ -1161,16 +836,16 @@ static Standard_Integer fun24(Draw_Interpretor& theDI, for (int mode = 0; mode <= 2; mode++) { int nbitems = 0; int id; - Message::SendInfo() << "Searching label : " << label << ". in mode "; - if (mode == 0) Message::SendInfo() << " exact"; - if (mode == 1) Message::SendInfo() << " same head"; - if (mode == 2) Message::SendInfo() << " search if present"; + aSSC.SStream() << "Searching label : " << label << ". in mode "; + if (mode == 0) aSSC.SStream() << " exact"; + if (mode == 1) aSSC.SStream() << " same head"; + if (mode == 2) aSSC.SStream() << " search if present"; for (id = WS->NextIdentForLabel(label.ToCString(), 0, mode); id != 0; id = WS->NextIdentForLabel(label.ToCString(), id, mode)) { - Message::SendInfo() << " " << id; nbitems++; + aSSC.SStream() << " " << id; nbitems++; } - Message::SendInfo() << " -- giving " << nbitems << " found"; + aSSC.SStream() << " -- giving " << nbitems << " found"; } return 0; } @@ -1183,13 +858,15 @@ static Standard_Integer fun25(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** Save (Dump) **** if (theNbArgs < 2) { - Message::SendInfo() << "Donner nom du Fichier"; + aSSC.SStream() << "Donner nom du Fichier"; return 1; } IFSelect_SessionFile dumper(WS, arg1); @@ -1206,20 +883,23 @@ static Standard_Integer fun26(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** Restore (Dump) **** if (theNbArgs < 2) { - Message::SendInfo() << "Donner nom du Fichier"; + aSSC.SStream() << "Donner nom du Fichier"; return 1; } IFSelect_SessionFile dumper(WS); Standard_Integer readstat = dumper.Read(arg1); - if (readstat == 0) return 0; - else if (readstat > 0) Message::SendInfo() << "-- Erreur Lecture Fichier " << arg1; - else Message::SendInfo() << "-- Pas pu ouvrir Fichier " << arg1; + if (readstat == 0) + return 0; + else if (readstat > 0) aSSC.SStream() << "-- Erreur Lecture Fichier " << arg1; + else aSSC.SStream() << "-- Pas pu ouvrir Fichier " << arg1; return 0; } @@ -1231,7 +911,8 @@ static Standard_Integer fun27(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - Standard_Integer theNbArgs = theNbArgs; + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); const Standard_CString arg1 = theArgVec[1]; Standard_CString arg2 = theArgVec[2]; @@ -1260,15 +941,15 @@ static Standard_Integer fun27(Draw_Interpretor& theDI, { aPatternNb = nb; } - Message::SendInfo() << " List of parameters : " << aPatternNb << " items : "; + aSSC.SStream() << " List of parameters : " << aPatternNb << " items : "; for (i = 1; i <= nb; i++) { if (theNbArgs == 3 && strncmp(li->Value(i)->String().ToCString(), arg2, aPatternLen) != 0) { continue; } - Message::SendInfo() << li->Value(i)->String(); - Message::SendInfo() << " : " << Interface_Static::CVal(li->Value(i)->ToCString()); + aSSC.SStream() << li->Value(i)->String(); + aSSC.SStream() << " : " << Interface_Static::CVal(li->Value(i)->ToCString()); } return 0; } @@ -1279,36 +960,36 @@ static Standard_Integer fun27(Draw_Interpretor& theDI, } else { - if (theNbArgs > 2) Message::SendInfo() << " FORMER STATUS of Static Parameter " << arg1; - else Message::SendInfo() << " ACTUAL STATUS of Static Parameter " << arg1; + if (theNbArgs > 2) aSSC.SStream() << " FORMER STATUS of Static Parameter " << arg1; + else aSSC.SStream() << " ACTUAL STATUS of Static Parameter " << arg1; if (!Interface_Static::IsPresent(arg1)) { - Message::SendInfo() << " Parameter " << arg1 << " undefined"; + aSSC.SStream() << " Parameter " << arg1 << " undefined"; return 1; } - if (!Interface_Static::IsSet(arg1)) Message::SendInfo() << " Parameter " << arg1 << " not valued"; - else if (theNbArgs == 2) Interface_Static::Static(arg1)->Print(Message::SendInfo()); - else Message::SendInfo() << " Value : " << Interface_Static::CVal(arg1); + if (!Interface_Static::IsSet(arg1)) aSSC.SStream() << " Parameter " << arg1 << " not valued"; + else if (theNbArgs == 2) Interface_Static::Static(arg1)->Print(aSSC.SStream()); + else aSSC.SStream() << " Value : " << Interface_Static::CVal(arg1); - if (theNbArgs == 2) Message::SendInfo() << "To modify, param name_param new_val"; + if (theNbArgs == 2) aSSC.SStream() << "To modify, param name_param new_val"; else { if (strlen(arg2) != 0) { - Message::SendInfo() << " New demanded value : " << arg2; + aSSC.SStream() << " New demanded value : " << arg2; } else { - Message::SendInfo() << " New demanded value : not valued"; + aSSC.SStream() << " New demanded value : not valued"; } if (Interface_Static::SetCVal(arg1, arg2)) { - Message::SendInfo() << " OK"; + aSSC.SStream() << " OK"; return 0; } else { - Message::SendInfo() << " , refused"; + aSSC.SStream() << " , refused"; return 1; } } @@ -1324,17 +1005,22 @@ static Standard_Integer fun29(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + (void)theNbArgs; + (void)theArgVec; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** SentFiles **** Handle(TColStd_HSequenceOfHAsciiString) list = WS->SentFiles(); if (list.IsNull()) { - Message::SendInfo() << "List of Sent Files not enabled"; return 0; + aSSC.SStream() << "List of Sent Files not enabled"; + return 0; } Standard_Integer i, nb = list->Length(); - Message::SendInfo() << " Sent Files : " << nb << " : "; + aSSC.SStream() << " Sent Files : " << nb << " : "; for (i = 1; i <= nb; i++) - Message::SendInfo() << list->Value(i)->ToCString(); + aSSC.SStream() << list->Value(i)->ToCString(); return 0; } @@ -1346,15 +1032,17 @@ static Standard_Integer fun30(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** FilePrefix **** if (theNbArgs < 2) { - if (WS->FilePrefix().IsNull()) Message::SendInfo() << "Pas de prefixe defini"; - else Message::SendInfo() << "Prefixe : " << WS->FilePrefix()->ToCString(); - Message::SendInfo() << "Pour changer : filepref newprefix"; + if (WS->FilePrefix().IsNull()) aSSC.SStream() << "Pas de prefixe defini"; + else aSSC.SStream() << "Prefixe : " << WS->FilePrefix()->ToCString(); + aSSC.SStream() << "Pour changer : filepref newprefix"; return 0; } WS->SetFilePrefix(arg1); @@ -1369,15 +1057,17 @@ static Standard_Integer fun31(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** FileExtension **** if (theNbArgs < 2) { - if (WS->FileExtension().IsNull()) Message::SendInfo() << "Pas d extension definie"; - else Message::SendInfo() << "Extension : " << WS->FileExtension()->ToCString(); - Message::SendInfo() << "Pour changer : fileext newext"; + if (WS->FileExtension().IsNull()) aSSC.SStream() << "Pas d extension definie"; + else aSSC.SStream() << "Extension : " << WS->FileExtension()->ToCString(); + aSSC.SStream() << "Pour changer : fileext newext"; return 0; } WS->SetFileExtension(arg1); @@ -1392,22 +1082,24 @@ static Standard_Integer fun32(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; const Standard_CString arg2 = theArgVec[2]; // **** FileRoot **** if (theNbArgs < 2) { - Message::SendInfo() << "Donner Dispatch et nom de Root"; + aSSC.SStream() << "Donner Dispatch et nom de Root"; return 1; } DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(arg1)); if (theNbArgs < 3) { - if (WS->FileRoot(disp).IsNull()) Message::SendInfo() << "Pas de racine definie pour " << arg1; - else Message::SendInfo() << "Racine pour " << arg1 << " : " << WS->FileRoot(disp)->ToCString(); - Message::SendInfo() << "Pour changer : fileroot nomdisp newroot"; + if (WS->FileRoot(disp).IsNull()) aSSC.SStream() << "Pas de racine definie pour " << arg1; + else aSSC.SStream() << "Racine pour " << arg1 << " : " << WS->FileRoot(disp)->ToCString(); + aSSC.SStream() << "Pour changer : fileroot nomdisp newroot"; return 0; } if (!WS->SetFileRoot(disp, arg2)) @@ -1423,15 +1115,17 @@ static Standard_Integer fun33(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** Default File Root **** if (theNbArgs < 2) { - if (WS->DefaultFileRoot().IsNull()) Message::SendInfo() << "Pas de racine par defaut definie"; - else Message::SendInfo() << "Racine par defaut : " << WS->DefaultFileRoot()->ToCString(); - Message::SendInfo() << "Pour changer : filedef newdef"; + if (WS->DefaultFileRoot().IsNull()) aSSC.SStream() << "Pas de racine par defaut definie"; + else aSSC.SStream() << "Racine par defaut : " << WS->DefaultFileRoot()->ToCString(); + aSSC.SStream() << "Pour changer : filedef newdef"; return 0; } WS->SetDefaultFileRoot(arg1); @@ -1446,15 +1140,19 @@ static Standard_Integer fun34(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + (void)theNbArgs; + (void)theArgVec; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** EvalFile **** if (!WS->HasModel()) { - Message::SendInfo() << "Pas de Modele charge, abandon"; + aSSC.SStream() << "Pas de Modele charge, abandon"; return 1; } - Message::SendInfo() << "Evaluation avec Memorisation des resultats"; + aSSC.SStream() << "Evaluation avec Memorisation des resultats"; WS->EvaluateFile(); Standard_Integer nbf = WS->NbFiles(); for (Standard_Integer i = 1; i <= nbf; i++) @@ -1462,11 +1160,11 @@ static Standard_Integer fun34(Draw_Interpretor& theDI, Handle(Interface_InterfaceModel) mod = WS->FileModel(i); if (mod.IsNull()) { - Message::SendInfo() << "Modele " << i << " Model non genere ..."; continue; + aSSC.SStream() << "Modele " << i << " Model non genere ..."; continue; } TCollection_AsciiString name = WS->FileName(i); - Message::SendInfo() << "Fichier n0 " << i << " Nb Entites : " << mod->NbEntities() << " Nom: "; - Message::SendInfo() << name; + aSSC.SStream() << "Fichier n0 " << i << " Nb Entites : " << mod->NbEntities() << " Nom: "; + aSSC.SStream() << name; } return 0; } @@ -1479,6 +1177,10 @@ static Standard_Integer fun35(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + (void)theNbArgs; + (void)theArgVec; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** ClearFile **** WS->ClearFile(); @@ -1493,11 +1195,13 @@ static Standard_Integer fun36(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + // **** Split **** IFSelect_ReturnStatus stat = IFSelect_RetVoid; - if (theNbArgs < 2) Message::SendInfo() << "Split : derniere liste de dispatches definie"; + if (theNbArgs < 2) aSSC.SStream() << "Split : derniere liste de dispatches definie"; else { WS->ClearShareOut(Standard_True); @@ -1506,13 +1210,14 @@ static Standard_Integer fun36(Draw_Interpretor& theDI, DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(theArgVec[i])); if (disp.IsNull()) { - Message::SendInfo() << "Pas un dispatch:" << theArgVec[i] << ", Splitt abandonne"; + aSSC.SStream() << "Pas un dispatch:" << theArgVec[i] << ", Splitt abandonne"; stat = IFSelect_RetError; } else WS->SetActive(disp, Standard_True); } } - if (stat == IFSelect_RetError) return stat; + if (stat == IFSelect_RetError) + return stat; WS->BeginSentFiles(Standard_True); if (!WS->SendSplit()) return 1; @@ -1527,8 +1232,10 @@ static Standard_Integer fun37(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** Remaining Data **** char mode = '?'; IFSelect_RemainMode numod = IFSelect_RemainDisplay; @@ -1539,11 +1246,15 @@ static Standard_Integer fun37(Draw_Interpretor& theDI, else if (mode == 'f') numod = IFSelect_RemainForget; else { - if (theNbArgs < 2) Message::SendInfo() << "Donner un Mode - "; - Message::SendInfo() << "Modes possibles : l list, c compute, u undo, f forget"; - if (mode == '?') return 0; else return 1; + if (theNbArgs < 2) aSSC.SStream() << "Donner un Mode - "; + aSSC.SStream() << "Modes possibles : l list, c compute, u undo, f forget"; + if (mode == '?') + return 0; + else + return 1; } - if (!WS->SetRemaining(numod)) return 0; + if (!WS->SetRemaining(numod)) + return 0; return 0; } @@ -1555,39 +1266,41 @@ static Standard_Integer fun38(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; const Standard_CString arg2 = theArgVec[2]; // **** SetModelContent **** if (theNbArgs < 3) { - Message::SendInfo() << "Donner nom selection et mode (k=keep,r=remove)"; + aSSC.SStream() << "Donner nom selection et mode (k=keep,r=remove)"; return 1; } Standard_Boolean keepmode; DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1)); if (sel.IsNull()) { - Message::SendInfo() << "Pas de Selection de Nom : " << arg1; + aSSC.SStream() << "Pas de Selection de Nom : " << arg1; return 1; } if (arg2[0] == 'k') { - Message::SendInfo() << " -- SetContent keep ..."; keepmode = Standard_True; + aSSC.SStream() << " -- SetContent keep ..."; keepmode = Standard_True; } else if (arg2[0] == 'r') { - Message::SendInfo() << " -- SetContent remove ..."; keepmode = Standard_False; + aSSC.SStream() << " -- SetContent remove ..."; keepmode = Standard_False; } else { - Message::SendInfo() << "Donner nom selection et mode (k=keep,r=remove)"; + aSSC.SStream() << "Donner nom selection et mode (k=keep,r=remove)"; return 1; } - if (WS->SetModelContent(sel, keepmode)) Message::SendInfo() << " Done"; - else Message::SendInfo() << " Result empty, ignored"; + if (WS->SetModelContent(sel, keepmode)) aSSC.SStream() << " Done"; + else aSSC.SStream() << " Result empty, ignored"; return 0; } @@ -1599,10 +1312,15 @@ static Standard_Integer fun40(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + (void)theNbArgs; + (void)theArgVec; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** ListModif **** WS->ListFinalModifiers(Standard_True); - WS->ListFinalModifiers(Standard_False); return 0; + WS->ListFinalModifiers(Standard_False); + return 0; } //======================================================================= @@ -1613,40 +1331,43 @@ static Standard_Integer fun41(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** Modifier **** if (theNbArgs < 2) { - Message::SendInfo() << "Donner Nom du Modifier"; + aSSC.SStream() << "Donner Nom du Modifier"; return 1; } DeclareAndCast(IFSelect_GeneralModifier, modif, WS->NamedItem(arg1)); if (modif.IsNull()) { - Message::SendInfo() << "Pas de Modifier de Nom : " << arg1; return 0; + aSSC.SStream() << "Pas de Modifier de Nom : " << arg1; + return 0; } Handle(IFSelect_IntParam) low, up; Handle(IFSelect_Dispatch) disp = modif->Dispatch(); - Message::SendInfo() << "Modifier : " << arg1 << " Label : " << modif->Label(); + aSSC.SStream() << "Modifier : " << arg1 << " Label : " << modif->Label(); Standard_Integer rank = WS->ModifierRank(modif); if (modif->IsKind(STANDARD_TYPE(IFSelect_Modifier))) - Message::SendInfo() << "Model Modifier n0." << rank; - else Message::SendInfo() << "File Modifier n0." << rank; - if (disp.IsNull()) Message::SendInfo() << " Applique a tous les Dispatchs"; + aSSC.SStream() << "Model Modifier n0." << rank; + else aSSC.SStream() << "File Modifier n0." << rank; + if (disp.IsNull()) aSSC.SStream() << " Applique a tous les Dispatchs"; else { - Message::SendInfo() << " Dispatch : " << disp->Label(); - if (WS->HasName(disp)) Message::SendInfo() << " - Nom:" << WS->Name(disp)->ToCString(); - Message::SendInfo(); + aSSC.SStream() << " Dispatch : " << disp->Label(); + if (WS->HasName(disp)) aSSC.SStream() << " - Nom:" << WS->Name(disp)->ToCString(); + } Handle(IFSelect_Selection) sel = modif->Selection(); - if (!sel.IsNull()) Message::SendInfo() << " Selection : " << sel->Label(); - if (WS->HasName(sel)) Message::SendInfo() << " - Nom:" << WS->Name(sel)->ToCString(); - Message::SendInfo(); + if (!sel.IsNull()) aSSC.SStream() << " Selection : " << sel->Label(); + if (WS->HasName(sel)) aSSC.SStream() << " - Nom:" << WS->Name(sel)->ToCString(); + return 0; } @@ -1658,21 +1379,23 @@ static Standard_Integer fun42(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; const Standard_CString arg2 = theArgVec[2]; // **** ModifSel **** if (theNbArgs < 2) { - Message::SendInfo() << "Donner Nom Modifier; + Nom Selection optionnel\n" + aSSC.SStream() << "Donner Nom Modifier; + Nom Selection optionnel\n" << "Selection pour Mettre une Selection, sinon Annule"; return 1; } DeclareAndCast(IFSelect_GeneralModifier, modif, WS->NamedItem(arg1)); if (modif.IsNull()) { - Message::SendInfo() << "Pas un nom de Modifier : " << arg1; + aSSC.SStream() << "Pas un nom de Modifier : " << arg1; return 1; } Handle(IFSelect_Selection) sel; @@ -1681,7 +1404,7 @@ static Standard_Integer fun42(Draw_Interpretor& theDI, sel = GetCasted(IFSelect_Selection, WS->NamedItem(arg2)); if (sel.IsNull()) { - Message::SendInfo() << "Pas un nom de Selection : " << arg2; + aSSC.SStream() << "Pas un nom de Selection : " << arg2; return 1; } } @@ -1698,14 +1421,16 @@ static Standard_Integer fun43(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; const Standard_CString arg2 = theArgVec[2]; // **** SetAppliedModifier **** if (theNbArgs < 2) { - Message::SendInfo() << "Donner Nom Modifier; + Nom Dispatch ou Transformer optionnel :\n" + aSSC.SStream() << "Donner Nom Modifier; + Nom Dispatch ou Transformer optionnel :\n" << " - rien : tous Dispatches\n - Dispatch : ce Dispatch seul\n" << " - Transformer : pas un Dispatch mais un Transformer"; return 1; @@ -1713,7 +1438,7 @@ static Standard_Integer fun43(Draw_Interpretor& theDI, DeclareAndCast(IFSelect_GeneralModifier, modif, WS->NamedItem(arg1)); if (modif.IsNull()) { - Message::SendInfo() << "Pas un nom de Modifier : " << arg1; + aSSC.SStream() << "Pas un nom de Modifier : " << arg1; return 1; } Handle(Standard_Transient) item; @@ -1722,7 +1447,7 @@ static Standard_Integer fun43(Draw_Interpretor& theDI, item = WS->NamedItem(arg2); if (item.IsNull()) { - Message::SendInfo() << "Pas un nom connu : " << arg2; + aSSC.SStream() << "Pas un nom connu : " << arg2; return 1; } } @@ -1740,19 +1465,21 @@ static Standard_Integer fun44(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** ResetApplied (modifier) **** if (theNbArgs < 2) { - Message::SendInfo() << "Designer un modifier"; + aSSC.SStream() << "Designer un modifier"; return 1; } DeclareAndCast(IFSelect_GeneralModifier, modif, WS->NamedItem(arg1)); if (modif.IsNull()) { - Message::SendInfo() << "Pas un nom de Modifier : " << arg1; + aSSC.SStream() << "Pas un nom de Modifier : " << arg1; return 1; } if (!WS->ResetAppliedModifier(modif)) @@ -1768,15 +1495,17 @@ static Standard_Integer fun45(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; const Standard_CString arg2 = theArgVec[2]; const Standard_CString arg3 = theArgVec[3]; // **** ModifMove **** if (theNbArgs < 4) { - Message::SendInfo() << "modifmove MF rang1 rang2, M pour Model F pour File"; + aSSC.SStream() << "modifmove MF rang1 rang2, M pour Model F pour File"; return 1; } Standard_Boolean formodel; @@ -1784,14 +1513,14 @@ static Standard_Integer fun45(Draw_Interpretor& theDI, else if (arg1[0] == 'f' || arg1[0] == 'F') formodel = Standard_False; else { - Message::SendInfo() << "preciser M pour Model, F pour File"; + aSSC.SStream() << "preciser M pour Model, F pour File"; return 1; } Standard_Integer before = atoi(arg2); Standard_Integer after = atoi(arg3); if (before == 0 || after == 0) { - Message::SendInfo() << "Donner 2 Entiers Positifs"; + aSSC.SStream() << "Donner 2 Entiers Positifs"; return 1; } if (!WS->ChangeModifierRank(formodel, before, after)) @@ -1807,25 +1536,27 @@ static Standard_Integer fun51(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); const Standard_CString arg1 = theArgVec[1]; const Standard_CString arg2 = theArgVec[2]; // **** DispSel **** if (theNbArgs < 3) { - Message::SendInfo() << "Donner Noms Dispatch et Selection Finale"; + aSSC.SStream() << "Donner Noms Dispatch et Selection Finale"; return 1; } DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(arg1)); if (disp.IsNull()) { - Message::SendInfo() << "Pas un nom de Dispatch : " << arg1; + aSSC.SStream() << "Pas un nom de Dispatch : " << arg1; return 1; } DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg2)); if (sel.IsNull()) { - Message::SendInfo() << "Pas un nom de Selection : " << arg2; + aSSC.SStream() << "Pas un nom de Selection : " << arg2; return 1; } if (!WS->SetItemSelection(disp, sel)) @@ -1833,207 +1564,101 @@ static Standard_Integer fun51(Draw_Interpretor& theDI, return 0; } -////======================================================================= -////function : fun_dispone -////purpose : -////======================================================================= -//static Standard_Integer fun_dispone(Draw_Interpretor& theDI, -// Standard_Integer theNbArgs, -// const char** theArgVec) -//{ -// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); -// // **** DispOne **** -// Handle(IFSelect_DispPerOne) disp = new IFSelect_DispPerOne; -// return pilot->RecordItem(disp); -//} - -////======================================================================= -////function : fun_dispglob -////purpose : -////======================================================================= -//static Standard_Integer fun_dispglob(Draw_Interpretor& theDI, -// Standard_Integer theNbArgs, -// const char** theArgVec) -//{ -// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); -// // **** DispGlob **** -// Handle(IFSelect_DispGlobal) disp = new IFSelect_DispGlobal; -// return pilot->RecordItem(disp); -//} - -//======================================================================= -//function : fun_dispcount +//======================================================================= +//function : fun56 //purpose : //======================================================================= -static Standard_Integer fun_dispcount(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) +static Standard_Integer fun56(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; - // **** DispCount **** + // **** Dispatch **** if (theNbArgs < 2) { - Message::SendInfo() << "Donner Nom IntParam pour Count"; + aSSC.SStream() << "Donner Nom du Dispatch"; return 1; } - DeclareAndCast(IFSelect_IntParam, par, WS->NamedItem(arg1)); - if (par.IsNull()) + DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(arg1)); + if (disp.IsNull()) { - Message::SendInfo() << "Pas un nom de IntParam : " << arg1; + aSSC.SStream() << "Pas un dispatch : " << arg1; return 1; } - Handle(IFSelect_DispPerCount) disp = new IFSelect_DispPerCount; - disp->SetCount(par); - return pilot->RecordItem(disp); + Standard_Integer num = WS->DispatchRank(disp); + aSSC.SStream() << "Dispatch de Nom : " << arg1 << " , en ShareOut, Numero " << num << " : "; + Handle(IFSelect_Selection) sel = WS->ItemSelection(disp); + Handle(TCollection_HAsciiString) selname = WS->Name(sel); + if (sel.IsNull()) aSSC.SStream() << "Pas de Selection Finale"; + else if (selname.IsNull()) aSSC.SStream() << "Selection Finale : #" << WS->ItemIdent(sel); + else aSSC.SStream() << "Selection Finale : " << selname->ToCString(); + if (disp->HasRootName()) aSSC.SStream() << "-- Racine nom de fichier : " + << disp->RootName()->ToCString(); + return 0; } //======================================================================= -//function : fun_dispfiles +//function : fun57 //purpose : //======================================================================= -static Standard_Integer fun_dispfiles(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) +static Standard_Integer fun57(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; - // **** DispFiles **** + // **** Remove **** if (theNbArgs < 2) { - Message::SendInfo() << "Donner Nom IntParam pour NbFiles"; + aSSC.SStream() << "Give Name to Remove !"; return 1; } - DeclareAndCast(IFSelect_IntParam, par, WS->NamedItem(arg1)); - if (par.IsNull()) - { - Message::SendInfo() << "Pas un nom de IntParam : " << arg1; + if (!WS->RemoveNamedItem(arg1)) return 1; - } - Handle(IFSelect_DispPerFiles) disp = new IFSelect_DispPerFiles; - disp->SetCount(par); - return pilot->RecordItem(disp); + return 0; } //======================================================================= -//function : fun_dispsign -//purpose : -//======================================================================= -static Standard_Integer fun_dispsign(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; - const Standard_CString arg1 = theArgVec[1]; - // **** DispFiles **** - if (theNbArgs < 2) - { - Message::SendInfo() << "Donner Nom Signature"; - return 1; - } - DeclareAndCast(IFSelect_Signature, sig, WS->NamedItem(arg1)); - if (sig.IsNull()) - { - Message::SendInfo() << "Pas un nom de Signature : " << arg1; - return 1; - } - Handle(IFSelect_DispPerSignature) disp = new IFSelect_DispPerSignature; - disp->SetSignCounter(new IFSelect_SignCounter(sig)); - return pilot->RecordItem(disp); -} - -//======================================================================= -//function : fun56 -//purpose : -//======================================================================= -static Standard_Integer fun56(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; - const Standard_CString arg1 = theArgVec[1]; - // **** Dispatch **** - if (theNbArgs < 2) - { - Message::SendInfo() << "Donner Nom du Dispatch"; - return 1; - } - DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(arg1)); - if (disp.IsNull()) - { - Message::SendInfo() << "Pas un dispatch : " << arg1; - return 1; - } - Standard_Integer num = WS->DispatchRank(disp); - Message::SendInfo() << "Dispatch de Nom : " << arg1 << " , en ShareOut, Numero " << num << " : "; - Handle(IFSelect_Selection) sel = WS->ItemSelection(disp); - Handle(TCollection_HAsciiString) selname = WS->Name(sel); - if (sel.IsNull()) Message::SendInfo() << "Pas de Selection Finale"; - else if (selname.IsNull()) Message::SendInfo() << "Selection Finale : #" << WS->ItemIdent(sel); - else Message::SendInfo() << "Selection Finale : " << selname->ToCString(); - if (disp->HasRootName()) Message::SendInfo() << "-- Racine nom de fichier : " - << disp->RootName()->ToCString(); - return 0; -} - -//======================================================================= -//function : fun57 -//purpose : -//======================================================================= -static Standard_Integer fun57(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; - const Standard_CString arg1 = theArgVec[1]; - // **** Remove **** - if (theNbArgs < 2) - { - Message::SendInfo() << "Give Name to Remove !"; - return 1; - } - if (!WS->RemoveNamedItem(arg1)) - return 1; - return 0; -} - -//======================================================================= -//function : fun58 +//function : fun58 //purpose : //======================================================================= static Standard_Integer fun58(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** EvalDisp **** if (theNbArgs < 3) { - Message::SendInfo() << "evaldisp mode disp [disp ...] : Mode + Name(s) of Dispatch(es). Mode:\n" + aSSC.SStream() << "evaldisp mode disp [disp ...] : Mode + Name(s) of Dispatch(es). Mode:\n" << " 0 brief 1 +forgotten ents 2 +duplicata 3 1+2" << "See also : evaladisp writedisp xsplit"; return 0; } Standard_Boolean OK = Standard_True; - Standard_Integer i, mode = atoi(arg1); Message::SendInfo() << " Mode " << mode << "\n"; + Standard_Integer i, mode = atoi(arg1); aSSC.SStream() << " Mode " << mode << "\n"; for (i = 2; i < theNbArgs; i++) { DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(theArgVec[i])); if (disp.IsNull()) { - Message::SendInfo() << "Not a dispatch:" << theArgVec[i]; OK = Standard_False; + aSSC.SStream() << "Not a dispatch:" << theArgVec[i]; OK = Standard_False; } } if (!OK) { - Message::SendInfo() << "Some of the parameters are not correct"; + aSSC.SStream() << "Some of the parameters are not correct"; return 1; } @@ -2048,145 +1673,6 @@ static Standard_Integer fun58(Draw_Interpretor& theDI, return 0; } -//======================================================================= -//function : fun_evaladisp -//purpose : -//======================================================================= -static Standard_Integer fun_evaladisp(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; - const Standard_CString arg1 = theArgVec[1]; - // **** EvalADisp [GiveList] **** - if (theNbArgs < 3) - { - Message::SendInfo() << "evaladisp mode(=0-1-2-3) disp [givelist] : Mode + Dispatch [+ GiveList]\n If GiveList not given, computed from Selection of the Dispatch. Mode:\n" - << " 0 brief 1 +forgotten ents 2 +duplicata 3 1+2" - << "See also : writedisp"; - return 0; - } - if (arg1[1] != '\0') - { - Message::SendInfo() << "first parameter : mode, must be a number between 0 and 3"; - return 1; - } - Standard_Integer mode = atoi(arg1); Message::SendInfo() << " Mode " << mode << "\n"; - // DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(theArgVec[2])); - Handle(IFSelect_Dispatch) disp = XSDRAW_FunctionsSession::GiveDispatch(WS, theArgVec[2], Standard_True); - if (disp.IsNull()) - { - Message::SendInfo() << "Not a dispatch:" << theArgVec[2]; - return 1; - } - Handle(IFSelect_Selection) selsav = disp->FinalSelection(); - Handle(IFSelect_Selection) sel; - if (theNbArgs > 3) - { - Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed; - Handle(TColStd_HSequenceOfTransient) list = XSDRAW_FunctionsSession::GiveList - (XSDRAWBase::Session(), pilot->CommandPart(3)); - Standard_Integer nb = (list.IsNull() ? 0 : list->Length()); - if (nb > 0) - { - sp->AddList(list); sel = sp; - } - } - - if (sel.IsNull() && selsav.IsNull()) - { - Message::SendInfo() << "No Selection nor GiveList defined"; - return 1; - } - if (sel.IsNull() && !selsav.IsNull()) - { - if (theNbArgs > 3) Message::SendInfo() << "GiveList is empty, hence computed from the Selection of the Dispatch"; - sel = selsav; - } - disp->SetFinalSelection(sel); - // WS->ClearShareOut(Standard_True); - // WS->SetActive(disp,Standard_True); - WS->EvaluateDispatch(disp, mode); - disp->SetFinalSelection(selsav); - - return 0; -} - -//======================================================================= -//function : fun_writedisp -//purpose : -//======================================================================= -static Standard_Integer fun_writedisp(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; - const Standard_CString arg1 = theArgVec[1]; - // **** EvalADisp [GiveList] **** - if (theNbArgs < 3) - { - Message::SendInfo() << "writedisp filename disp [givelist] : FileName + Dispatch [+ GiveList]\n If GiveList not given, computed from Selection of the Dispatch.\n" - << "FileName : rootname.ext will gives rootname_1.ext etc...\n" - << " path/rootname.ext gives path/rootname_1.ext etc...\n" - << "See also : evaladisp"; - return 0; - } - TCollection_AsciiString prefix, rootname, suffix; - SplitFileName(arg1, prefix, rootname, suffix); - if (rootname.Length() == 0 || suffix.Length() == 0) - { - Message::SendInfo() << "Empty Root Name or Extension"; - return 1; - } - - // DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(theArgVec[2])); - Handle(IFSelect_Dispatch) disp = XSDRAW_FunctionsSession::GiveDispatch(WS, theArgVec[2], Standard_True); - if (disp.IsNull()) - { - Message::SendInfo() << "Not a dispatch:" << theArgVec[2]; - return 1; - } - Handle(IFSelect_Selection) selsav = disp->FinalSelection(); - Handle(IFSelect_Selection) sel; - if (theNbArgs > 3) - { - Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed; - Handle(TColStd_HSequenceOfTransient) list = XSDRAW_FunctionsSession::GiveList - (XSDRAWBase::Session(), pilot->CommandPart(3)); - Standard_Integer nb = (list.IsNull() ? 0 : list->Length()); - if (nb > 0) - { - sp->AddList(list); sel = sp; - } - } - - if (sel.IsNull() && selsav.IsNull()) - { - Message::SendInfo() << "No Selection nor GiveList defined"; - return 1; - } - if (sel.IsNull() && !selsav.IsNull()) - { - if (theNbArgs > 3) Message::SendInfo() << "GiveList is empty, hence computed from the Selection of the Dispatch"; - sel = selsav; - } - - WS->ClearShareOut(Standard_True); - disp->SetFinalSelection(sel); - WS->SetActive(disp, Standard_True); - WS->BeginSentFiles(Standard_True); - - WS->SetFilePrefix(prefix.ToCString()); - WS->SetFileExtension(suffix.ToCString()); - WS->SetFileRoot(disp, rootname.ToCString()); - - Standard_Boolean OK = WS->SendSplit(); - disp->SetFinalSelection(selsav); - return (OK ? IFSelect_RetDone : IFSelect_RetFail); -} - //======================================================================= //function : fun59 //purpose : @@ -2195,17 +1681,20 @@ static Standard_Integer fun59(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** EvalComplete **** Standard_Integer mode = 0; - if (theNbArgs < 2) Message::SendInfo() << " -- mode par defaut 0\n"; + if (theNbArgs < 2) aSSC.SStream() << " -- mode par defaut 0\n"; else { - mode = atoi(arg1); Message::SendInfo() << " -- mode : " << mode; + mode = atoi(arg1); aSSC.SStream() << " -- mode : " << mode; } - WS->EvaluateComplete(mode); return 0; + WS->EvaluateComplete(mode); + return 0; } //======================================================================= @@ -2216,12 +1705,16 @@ static Standard_Integer fun60(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + (void)theNbArgs; + (void)theArgVec; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); // **** LastRunCheckList **** Interface_CheckIterator chlist = WS->LastRunCheckList(); Handle(IFSelect_CheckCounter) counter = new IFSelect_CheckCounter(0); counter->Analyse(chlist, WS->Model(), Standard_False); - counter->PrintCount(Message::SendInfo()); + counter->PrintCount(aSSC.SStream()); return 0; } @@ -2233,599 +1726,213 @@ static Standard_Integer fun61(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** RunTransformer **** if (theNbArgs < 2) { - Message::SendInfo() << "Donner Nom de Transformer"; + aSSC.SStream() << "Donner Nom de Transformer"; return 1; } DeclareAndCast(IFSelect_Transformer, tsf, WS->NamedItem(arg1)); Standard_Integer effect = WS->RunTransformer(tsf); switch (effect) { - case -4: Message::SendInfo() << "Edition sur place, nouveau Protocole, erreur recalcul graphe"; break; - case -3: Message::SendInfo() << "Erreur, Transformation ignoree"; break; - case -2: Message::SendInfo() << "Erreur sur edition sur place, risque de corruption (verifier)"; break; - case -1: Message::SendInfo() << "Erreur sur edition locale, risque de corruption (verifier)"; break; + case -4: aSSC.SStream() << "Edition sur place, nouveau Protocole, erreur recalcul graphe"; break; + case -3: aSSC.SStream() << "Erreur, Transformation ignoree"; break; + case -2: aSSC.SStream() << "Erreur sur edition sur place, risque de corruption (verifier)"; break; + case -1: aSSC.SStream() << "Erreur sur edition locale, risque de corruption (verifier)"; break; case 0: - if (tsf.IsNull()) Message::SendInfo() << "Erreur, pas un Transformer: " << arg1; - else Message::SendInfo() << "Execution non faite"; + if (tsf.IsNull()) aSSC.SStream() << "Erreur, pas un Transformer: " << arg1; + else aSSC.SStream() << "Execution non faite"; break; - case 1: Message::SendInfo() << "Transformation locale (graphe non touche)"; break; - case 2: Message::SendInfo() << "Edition sur place (graphe recalcule)"; break; - case 3: Message::SendInfo() << "Modele reconstruit"; break; - case 4: Message::SendInfo() << "Edition sur place, nouveau Protocole"; break; - case 5: Message::SendInfo() << "Nouveau Modele avec nouveau Protocole"; break; - default: break; - } - return ((effect > 0) ? IFSelect_RetDone : IFSelect_RetFail); -} - -//======================================================================= -//function : fun62 -//purpose : -//======================================================================= -static Standard_Integer fun62(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - // **** TransformStandard Copy **** - return pilot->RecordItem(WS->NewTransformStandard(Standard_True)); -} - -//======================================================================= -//function : fun63 -//purpose : -//======================================================================= -static Standard_Integer fun63(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - // **** TransformStandard OntheSpot **** - return pilot->RecordItem(WS->NewTransformStandard(Standard_False)); -} - -//======================================================================= -//function : fun6465 -//purpose : -//======================================================================= -static Standard_Integer fun6465(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; - const Standard_CString arg1 = theArgVec[1]; - // **** Run Modifier avec Standard Copy **** - // **** Run Modifier avec OnTheSpot **** - Standard_Boolean runcopy = (theArgVec[0][3] == 'c'); - // soit c est un nom, sinon c est une commande - Handle(IFSelect_Modifier) modif; - if (WS->NameIdent(arg1) > 0) - modif = GetCasted(IFSelect_Modifier, WS->NamedItem(arg1)); - else - { - pilot->RemoveWord(0); // c etait la commande run - pilot->Perform(); - modif = GetCasted(IFSelect_Modifier, pilot->RecordedItem()); - } - Message_Messenger::StreamBuffer Message::SendInfo() = Message::SendInfo(); - if (modif.IsNull()) - { - Message::SendInfo() << "Pas un nom de Modifier : " << arg1; - return 1; - } - - Handle(TColStd_HSequenceOfTransient) list; - Handle(IFSelect_SelectPointed) sp; - if (theNbArgs > 2) - { - list = XSDRAW_FunctionsSession::GiveList(WS, pilot->CommandPart(2)); - sp = new IFSelect_SelectPointed; - sp->SetList(list); - } - - Standard_Integer effect = 0; - effect = WS->RunModifierSelected(modif, sp, runcopy); - // Message::SendInfo()<<"Modifier applique sur TransformStandard #"<ItemIdent(tsf)< 0) ? IFSelect_RetDone : IFSelect_RetFail); -} - -//======================================================================= -//function : fun66 -//purpose : -//======================================================================= -static Standard_Integer fun66(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - // **** (xset) ModifReorder **** - char opt = ' '; - Standard_Integer theNbArgs = theNbArgs; - if (theNbArgs >= 2) opt = pilot->Word(1).Value(1); - if (opt != 'f' && opt != 'l') - { - Message::SendInfo() << "Donner option : f -> root-first l -> root-last"; - return 1; - } - return pilot->RecordItem(new IFSelect_ModifReorder(opt == 'l')); -} - -//======================================================================= -//function : fun70 -//purpose : -//======================================================================= -static Standard_Integer fun70(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; - const Standard_CString arg1 = theArgVec[1]; - // **** SelToggle **** - if (theNbArgs < 2) - { - Message::SendInfo() << "Donner Nom de Selection"; - return 1; - } - DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1)); - if (!WS->ToggleSelectExtract(sel)) - { - Message::SendInfo() << "Pas une SelectExtract : " << arg1; - return 1; - } - if (WS->IsReversedSelectExtract(sel)) Message::SendInfo() << arg1 << " a present Reversed"; - else Message::SendInfo() << arg1 << " a present Directe"; - return 0; -} - -//======================================================================= -//function : fun71 -//purpose : -//======================================================================= -static Standard_Integer fun71(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; - const Standard_CString arg1 = theArgVec[1]; - const Standard_CString arg2 = theArgVec[2]; - // **** SelInput **** - if (theNbArgs < 3) - { - Message::SendInfo() << "Donner Noms Selections cible et input"; - return 1; - } - DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1)); - DeclareAndCast(IFSelect_Selection, sou, WS->NamedItem(arg2)); - if (sel.IsNull() || sou.IsNull()) - { - Message::SendInfo() << "Incorrect : " << arg1 << "," << arg2; - return 1; - } - if (!WS->SetInputSelection(sel, sou)) - { - Message::SendInfo() << "Nom incorrect ou Selection " << arg1 << " ni Extract ni Deduct"; - return 1; - } - return 0; -} - -//======================================================================= -//function : fun72 -//purpose : -//======================================================================= -static Standard_Integer fun72(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - // **** SelModelRoots **** - return pilot->RecordItem(new IFSelect_SelectModelRoots); -} - -//======================================================================= -//function : fun73 -//purpose : -//======================================================================= -static Standard_Integer fun73(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; - const Standard_CString arg1 = theArgVec[1]; - const Standard_CString arg2 = theArgVec[2]; - // **** SelRange **** - if (theNbArgs >= 2 && arg1[0] == '?') theNbArgs = 1; - if (theNbArgs < 2) - { - Message::SendInfo() << "Donner la description du SelectRange" - << " Formes admises :\n : Range de a \n" - << " tout seul : Range n0 \n from : Range From \n" - << " until : Range Until "; - return 0; - } - - Handle(IFSelect_IntParam) low, up; - Handle(IFSelect_SelectRange) sel; - // Range From - if (pilot->Word(1).IsEqual("from")) - { - if (theNbArgs < 3) - { - Message::SendInfo() << "Forme admise : from "; - return 1; - } - low = GetCasted(IFSelect_IntParam, WS->NamedItem(arg2)); - sel = new IFSelect_SelectRange; - sel->SetFrom(low); - // Range Until - } - else if (pilot->Word(1).IsEqual("until")) - { - if (theNbArgs < 3) - { - Message::SendInfo() << "Forme admise : until "; - return 1; - } - up = GetCasted(IFSelect_IntParam, WS->NamedItem(arg2)); - sel = new IFSelect_SelectRange; - sel->SetUntil(up); - // Range One (n-th) - } - else if (theNbArgs < 3) - { - low = GetCasted(IFSelect_IntParam, WS->NamedItem(arg1)); - sel = new IFSelect_SelectRange; - sel->SetOne(low); - // Range (from-to) - } - else - { - low = GetCasted(IFSelect_IntParam, WS->NamedItem(arg1)); - up = GetCasted(IFSelect_IntParam, WS->NamedItem(arg2)); - sel = new IFSelect_SelectRange; - sel->SetRange(low, up); - } - return pilot->RecordItem(sel); -} - -//======================================================================= -//function : fun74 -//purpose : -//======================================================================= -static Standard_Integer fun74(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - // **** SelRoots **** - return pilot->RecordItem(new IFSelect_SelectRoots); -} - -//======================================================================= -//function : fun75 -//purpose : -//======================================================================= -static Standard_Integer fun75(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - // **** SelShared **** - return pilot->RecordItem(new IFSelect_SelectShared); -} - -//======================================================================= -//function : fun76 -//purpose : -//======================================================================= -static Standard_Integer fun76(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; - const Standard_CString arg1 = theArgVec[1]; - const Standard_CString arg2 = theArgVec[2]; - // **** SelDiff **** - Handle(IFSelect_Selection) sel = new IFSelect_SelectDiff; - if (sel.IsNull()) - return 1; - if (theNbArgs < 3) Message::SendInfo() << "Diff sans input : ne pas oublier de les definir (ctlmain, ctlsec)!"; - DeclareAndCast(IFSelect_Selection, selmain, WS->NamedItem(arg1)); - DeclareAndCast(IFSelect_Selection, selsec, WS->NamedItem(arg2)); - if (theNbArgs >= 2) - if (!WS->SetControl(sel, selmain, Standard_True)) - Message::SendInfo() << "Echec ControlMain:" << arg1 << " , a refaire (ctlmain)"; - if (theNbArgs >= 3) - if (!WS->SetControl(sel, selsec, Standard_False)) - Message::SendInfo() << "Echec ControlSecond:" << arg2 << " , a refaire (ctlsec)"; - return pilot->RecordItem(sel); -} - -//======================================================================= -//function : fun77 -//purpose : -//======================================================================= -static Standard_Integer fun77(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; - const Standard_CString arg1 = theArgVec[1]; - const Standard_CString arg2 = theArgVec[2]; - // **** SelControlMain **** - if (theNbArgs < 3) - { - Message::SendInfo() << "Donner Noms de Control et MainInput"; - return 1; - } - DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1)); - DeclareAndCast(IFSelect_Selection, selmain, WS->NamedItem(arg2)); - if (WS->SetControl(sel, selmain, Standard_True)) return 0; - Message::SendInfo() << "Nom incorrect ou Selection " << arg1 << " pas de type Control"; - return 1; -} - -//======================================================================= -//function : fun78 -//purpose : -//======================================================================= -static Standard_Integer fun78(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; - const Standard_CString arg1 = theArgVec[1]; - const Standard_CString arg2 = theArgVec[2]; - // **** SelControlSecond **** - if (theNbArgs < 3) - { - Message::SendInfo() << "Donner Noms de Control et SecondInput"; - return 1; - } - DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1)); - DeclareAndCast(IFSelect_Selection, seldif, WS->NamedItem(arg2)); - if (WS->SetControl(sel, seldif, Standard_False)) return 0; - Message::SendInfo() << "Nom incorrect ou Selection " << arg1 << " pas de type Control"; - return 1; -} - -//======================================================================= -//function : fun79 -//purpose : -//======================================================================= -static Standard_Integer fun79(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - // **** SelModelAll **** - return pilot->RecordItem(new IFSelect_SelectModelEntities); -} - -//======================================================================= -//function : fun80 -//purpose : -//======================================================================= -static Standard_Integer fun80(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; - const Standard_CString arg1 = theArgVec[1]; - const Standard_CString arg2 = theArgVec[2]; - // **** SelCombAdd **** - if (theNbArgs < 3) - { - Message::SendInfo() << "Donner n0 Combine et une Input"; - return 1; - } - DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1)); - DeclareAndCast(IFSelect_Selection, seladd, WS->NamedItem(arg2)); - if (WS->CombineAdd(sel, seladd)) return 0; - Message::SendInfo() << "Nom incorrect ou Selection " << arg1 << " pas Combine"; - return 1; -} - -//======================================================================= -//function : fun81 -//purpose : -//======================================================================= -static Standard_Integer fun81(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; - const Standard_CString arg1 = theArgVec[1]; - const Standard_CString arg2 = theArgVec[2]; - // **** SelCombRem **** - if (theNbArgs < 3) - { - Message::SendInfo() << "Donner n0 Combine et RANG a supprimer"; - return 1; + case 1: aSSC.SStream() << "Transformation locale (graphe non touche)"; break; + case 2: aSSC.SStream() << "Edition sur place (graphe recalcule)"; break; + case 3: aSSC.SStream() << "Modele reconstruit"; break; + case 4: aSSC.SStream() << "Edition sur place, nouveau Protocole"; break; + case 5: aSSC.SStream() << "Nouveau Modele avec nouveau Protocole"; break; + default: break; } - DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1)); - DeclareAndCast(IFSelect_Selection, inp, WS->NamedItem(arg2)); - if (WS->CombineRemove(sel, inp)) return 0; - Message::SendInfo() << "Nom incorrect ou Selection " << arg1 << " ni Union ni Intersection"; - return 1; + return ((effect > 0) ? IFSelect_RetDone : IFSelect_RetFail); } //======================================================================= -//function : fun82 +//function : fun70 //purpose : //======================================================================= -static Standard_Integer fun82(Draw_Interpretor& theDI, +static Standard_Integer fun70(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; - // **** SelEntNumber **** + // **** SelToggle **** if (theNbArgs < 2) { - Message::SendInfo() << "Donner Nom IntParam pour n0 Entite"; + aSSC.SStream() << "Donner Nom de Selection"; return 1; } - DeclareAndCast(IFSelect_IntParam, par, WS->NamedItem(arg1)); - Handle(IFSelect_SelectEntityNumber) sel = new IFSelect_SelectEntityNumber; - sel->SetNumber(par); - return pilot->RecordItem(sel); + DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1)); + if (!WS->ToggleSelectExtract(sel)) + { + aSSC.SStream() << "Pas une SelectExtract : " << arg1; + return 1; + } + if (WS->IsReversedSelectExtract(sel)) aSSC.SStream() << arg1 << " a present Reversed"; + else aSSC.SStream() << arg1 << " a present Directe"; + return 0; } //======================================================================= -//function : fun83 +//function : fun71 //purpose : //======================================================================= -static Standard_Integer fun83(Draw_Interpretor& theDI, +static Standard_Integer fun71(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - // **** SelUnion **** - return pilot->RecordItem(new IFSelect_SelectUnion); + + const Standard_CString arg1 = theArgVec[1]; + const Standard_CString arg2 = theArgVec[2]; + // **** SelInput **** + if (theNbArgs < 3) + { + aSSC.SStream() << "Donner Noms Selections cible et input"; + return 1; + } + DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1)); + DeclareAndCast(IFSelect_Selection, sou, WS->NamedItem(arg2)); + if (sel.IsNull() || sou.IsNull()) + { + aSSC.SStream() << "Incorrect : " << arg1 << "," << arg2; + return 1; + } + if (!WS->SetInputSelection(sel, sou)) + { + aSSC.SStream() << "Nom incorrect ou Selection " << arg1 << " ni Extract ni Deduct"; + return 1; + } + return 0; } //======================================================================= -//function : fun84 +//function : fun77 //purpose : //======================================================================= -static Standard_Integer fun84(Draw_Interpretor& theDI, +static Standard_Integer fun77(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - // **** SelIntersection **** - return pilot->RecordItem(new IFSelect_SelectIntersection); -} -//======================================================================= -//function : fun85 -//purpose : -//======================================================================= -static Standard_Integer fun85(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Standard_Integer theNbArgs = theNbArgs; const Standard_CString arg1 = theArgVec[1]; - // **** SelTextType Exact **** - if (theNbArgs < 2) + const Standard_CString arg2 = theArgVec[2]; + // **** SelControlMain **** + if (theNbArgs < 3) { - Message::SendInfo() << "Donner le TYPE a selectionner"; + aSSC.SStream() << "Donner Noms de Control et MainInput"; return 1; } - return pilot->RecordItem(new IFSelect_SelectSignature - (new IFSelect_SignType, arg1, Standard_True)); + DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1)); + DeclareAndCast(IFSelect_Selection, selmain, WS->NamedItem(arg2)); + if (WS->SetControl(sel, selmain, Standard_True)) + return 0; + aSSC.SStream() << "Nom incorrect ou Selection " << arg1 << " pas de type Control"; + return 1; } //======================================================================= -//function : fun86 +//function : fun78 //purpose : //======================================================================= -static Standard_Integer fun86(Draw_Interpretor& theDI, +static Standard_Integer fun78(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - // **** SelErrorEntities **** - return pilot->RecordItem(new IFSelect_SelectErrorEntities); -} + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); -//======================================================================= -//function : fun87 -//purpose : -//======================================================================= -static Standard_Integer fun87(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - // **** SelUnknownEntities ** - return pilot->RecordItem(new IFSelect_SelectUnknownEntities); + const Standard_CString arg1 = theArgVec[1]; + const Standard_CString arg2 = theArgVec[2]; + // **** SelControlSecond **** + if (theNbArgs < 3) + { + aSSC.SStream() << "Donner Noms de Control et SecondInput"; + return 1; + } + DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1)); + DeclareAndCast(IFSelect_Selection, seldif, WS->NamedItem(arg2)); + if (WS->SetControl(sel, seldif, Standard_False)) return 0; + aSSC.SStream() << "Nom incorrect ou Selection " << arg1 << " pas de type Control"; + return 1; } //======================================================================= -//function : fun88 +//function : fun80 //purpose : //======================================================================= -static Standard_Integer fun88(Draw_Interpretor& theDI, +static Standard_Integer fun80(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - // **** SelSharing **** - return pilot->RecordItem(new IFSelect_SelectSharing); -} + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); -//======================================================================= -//function : fun89 -//purpose : -//======================================================================= -static Standard_Integer fun89(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Standard_Integer theNbArgs = theNbArgs; const Standard_CString arg1 = theArgVec[1]; - // **** SelTextType Contain ** - if (theNbArgs < 2) + const Standard_CString arg2 = theArgVec[2]; + // **** SelCombAdd **** + if (theNbArgs < 3) { - Message::SendInfo() << "Donner le TYPE a selectionner"; + aSSC.SStream() << "Donner n0 Combine et une Input"; return 1; } - return pilot->RecordItem(new IFSelect_SelectSignature - (new IFSelect_SignType, arg1, Standard_False)); + DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1)); + DeclareAndCast(IFSelect_Selection, seladd, WS->NamedItem(arg2)); + if (WS->CombineAdd(sel, seladd)) + return 0; + aSSC.SStream() << "Nom incorrect ou Selection " << arg1 << " pas Combine"; + return 1; } //======================================================================= -//function : fun90 +//function : fun81 //purpose : //======================================================================= -static Standard_Integer fun90(Draw_Interpretor& theDI, +static Standard_Integer fun81(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - // **** SelPointed **** - Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed; - if (theNbArgs > 1) + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); + + const Standard_CString arg1 = theArgVec[1]; + const Standard_CString arg2 = theArgVec[2]; + // **** SelCombRem **** + if (theNbArgs < 3) { - Handle(TColStd_HSequenceOfTransient) list = GiveList - (XSDRAWBase::Session(), pilot->CommandPart(1)); - if (list.IsNull()) - return 1; - Message::SendInfo() << "SelectPointed : " << list->Length() << " entities"; - sp->AddList(list); + aSSC.SStream() << "Donner n0 Combine et RANG a supprimer"; + return 1; } - return pilot->RecordItem(sp); + DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1)); + DeclareAndCast(IFSelect_Selection, inp, WS->NamedItem(arg2)); + if (WS->CombineRemove(sel, inp)) + return 0; + aSSC.SStream() << "Nom incorrect ou Selection " << arg1 << " ni Union ni Intersection"; + return 1; } //======================================================================= @@ -2836,13 +1943,15 @@ static Standard_Integer fun91(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - Standard_Integer theNbArgs = theNbArgs; + const Standard_CString arg1 = theArgVec[1]; // **** SetPointed (edit) / SetList (edit) **** if (theNbArgs < 2) { - Message::SendInfo() << "Donner NOM SelectPointed + Option(s) :\n" + aSSC.SStream() << "Donner NOM SelectPointed + Option(s) :\n" << " aucune : liste des entites pointees\n" << " 0: Clear +nn ajout entite nn -nn enleve nn /nn toggle nn"; return 1; @@ -2850,180 +1959,71 @@ static Standard_Integer fun91(Draw_Interpretor& theDI, DeclareAndCast(IFSelect_SelectPointed, sp, WS->NamedItem(arg1)); if (sp.IsNull()) { - Message::SendInfo() << "Pas une SelectPointed:" << arg1; + aSSC.SStream() << "Pas une SelectPointed:" << arg1; return 1; } const Handle(Interface_InterfaceModel)& model = WS->Model(); // pour Print if (theNbArgs == 2) { // listage simple Standard_Integer nb = sp->NbItems(); - Message::SendInfo() << " SelectPointed : " << arg1 << " : " << nb << " Items :"; + aSSC.SStream() << " SelectPointed : " << arg1 << " : " << nb << " Items :"; for (Standard_Integer i = 1; i <= nb; i++) { Handle(Standard_Transient) pointed = sp->Item(i); Standard_Integer id = WS->StartingNumber(pointed); - if (id == 0) Message::SendInfo() << " (inconnu)"; + if (id == 0) aSSC.SStream() << " (inconnu)"; else { - Message::SendInfo() << " "; model->Print(pointed, Message::SendInfo()); + aSSC.SStream() << " "; model->Print(pointed, aSSC.SStream()); } } - if (nb > 0) Message::SendInfo(); return 0; } for (Standard_Integer ia = 2; ia < theNbArgs; ia++) { - const TCollection_AsciiString argi = pilot->Word(ia); - Standard_Integer id = pilot->Number(&(argi.ToCString())[1]); + const TCollection_AsciiString argi = theArgVec[ia]; + Standard_Integer id = WS->NumberFromLabel(&(argi.ToCString())[1]); if (id == 0) { - if (!argi.IsEqual("0")) Message::SendInfo() << "Incorrect,ignore:" << argi; + if (!argi.IsEqual("0")) aSSC.SStream() << "Incorrect,ignore:" << argi; else { - Message::SendInfo() << "Clear SelectPointed"; sp->Clear(); + aSSC.SStream() << "Clear SelectPointed"; sp->Clear(); } } else if (argi.Value(1) == '-') { Handle(Standard_Transient) item = WS->StartingEntity(id); - if (sp->Remove(item)) Message::SendInfo() << "Removed:no." << id; - else Message::SendInfo() << " Echec Remove " << id; - Message::SendInfo() << ": "; - model->Print(item, Message::SendInfo()); + if (sp->Remove(item)) aSSC.SStream() << "Removed:no." << id; + else aSSC.SStream() << " Echec Remove " << id; + aSSC.SStream() << ": "; + model->Print(item, aSSC.SStream()); } else if (argi.Value(1) == '/') { Handle(Standard_Transient) item = WS->StartingEntity(id); - if (sp->Remove(item)) Message::SendInfo() << "Toggled:n0." << id; - else Message::SendInfo() << " Echec Toggle " << id; - Message::SendInfo() << ": "; - model->Print(item, Message::SendInfo()); + if (sp->Remove(item)) aSSC.SStream() << "Toggled:n0." << id; + else aSSC.SStream() << " Echec Toggle " << id; + aSSC.SStream() << ": "; + model->Print(item, aSSC.SStream()); } else if (argi.Value(1) == '+') { Handle(Standard_Transient) item = WS->StartingEntity(id); - if (sp->Add(item)) Message::SendInfo() << "Added:no." << id; - else Message::SendInfo() << " Echec Add " << id; - Message::SendInfo() << ": "; - model->Print(item, Message::SendInfo()); + if (sp->Add(item)) aSSC.SStream() << "Added:no." << id; + else aSSC.SStream() << " Echec Add " << id; + aSSC.SStream() << ": "; + model->Print(item, aSSC.SStream()); } else { - Message::SendInfo() << "Ignore:" << argi << " , donner n0 PRECEDE de + ou - ou /"; + aSSC.SStream() << "Ignore:" << argi << " , donner n0 PRECEDE de + ou - ou /"; } } return 0; } -//======================================================================= -//function : fun92 -//purpose : -//======================================================================= -static Standard_Integer fun92(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - // **** SelIncorrectEntities **** - WS->ComputeCheck(); - return pilot->RecordItem(new IFSelect_SelectIncorrectEntities); -} - -//======================================================================= -//function : fun93 -//purpose : -//======================================================================= -static Standard_Integer fun93(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Standard_Integer theNbArgs = theNbArgs; - const Standard_CString arg1 = theArgVec[1]; - const Standard_CString arg2 = theArgVec[2]; - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - // **** SelSignature **** - if (theNbArgs < 3) - { - Message::SendInfo() << "Give name of Signature or Counter, text + option exact(D) else contains"; - return 1; - } - Standard_Boolean exact = Standard_True; - if (theNbArgs > 3) - { - if (theArgVec[3][0] == 'c') exact = Standard_False; - } - - DeclareAndCast(IFSelect_Signature, sign, WS->NamedItem(arg1)); - DeclareAndCast(IFSelect_SignCounter, cnt, WS->NamedItem(arg1)); - Handle(IFSelect_SelectSignature) sel; - - if (!sign.IsNull()) sel = new IFSelect_SelectSignature(sign, arg2, exact); - else if (!cnt.IsNull()) sel = new IFSelect_SelectSignature(cnt, arg2, exact); - else - { - Message::SendInfo() << arg1 << ":neither Signature nor Counter"; - return 1; - } - - return pilot->RecordItem(sel); -} - -//======================================================================= -//function : fun94 -//purpose : -//======================================================================= -static Standard_Integer fun94(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Standard_Integer theNbArgs = theNbArgs; - const Standard_CString arg1 = theArgVec[1]; - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - // **** SignCounter **** - if (theNbArgs < 2) - { - Message::SendInfo() << "Donner nom signature"; - return 1; - } - DeclareAndCast(IFSelect_Signature, sign, WS->NamedItem(arg1)); - if (sign.IsNull()) - { - Message::SendInfo() << arg1 << ":pas une signature"; - return 1; - } - Handle(IFSelect_SignCounter) cnt = new IFSelect_SignCounter(sign, Standard_True, Standard_True); - return pilot->RecordItem(cnt); -} - -//======================================================================= -//function : funbselected -//purpose : -//======================================================================= -static Standard_Integer funbselected(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Standard_Integer theNbArgs = theNbArgs; - const Standard_CString arg1 = theArgVec[1]; - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - // **** NbSelected = GraphCounter **** - if (theNbArgs < 2) - { - Message::SendInfo() << "Donner nom selection (deduction) a appliquer"; - return 1; - } - DeclareAndCast(IFSelect_SelectDeduct, applied, WS->GiveSelection(arg1)); - if (applied.IsNull()) - { - Message::SendInfo() << arg1 << ":pas une SelectDeduct"; - return 1; - } - Handle(IFSelect_GraphCounter) cnt = new IFSelect_GraphCounter(Standard_True, Standard_True); - cnt->SetApplied(applied); - return pilot->RecordItem(cnt); -} - //======================================================================= //function : fun_editlist //purpose : @@ -3032,10 +2032,11 @@ static Standard_Integer fun_editlist(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - Standard_Integer theNbArgs = theNbArgs; + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; if (theNbArgs < 2) { - Message::SendInfo() << "Give the name of an EditForm or an Editor"; + aSSC.SStream() << "Give the name of an EditForm or an Editor"; return 1; } const Standard_CString arg1 = theArgVec[1]; @@ -3048,25 +2049,25 @@ static Standard_Integer fun_editlist(Draw_Interpretor& theDI, Handle(IFSelect_Editor) edt; if (!edf.IsNull()) { - Message::SendInfo() << "Print EditForm " << arg1; + aSSC.SStream() << "Print EditForm " << arg1; edt = edf->Editor(); if (theNbArgs < 3) { - // DEFINITIONS : Editor (direct ou via EditForm) if (edt.IsNull()) edt = GetCasted(IFSelect_Editor, WS->NamedItem(arg1)); - if (edt.IsNull()) return 0; + if (edt.IsNull()) + return 0; - Message::SendInfo() << "Editor, Label : " << edt->Label(); - Message::SendInfo() << " -- Names (short - complete) + Labels of Values"; - edt->PrintNames(Message::SendInfo()); - Message::SendInfo() << " -- Definitions --"; - edt->PrintDefs(Message::SendInfo()); + aSSC.SStream() << "Editor, Label : " << edt->Label(); + aSSC.SStream() << " -- Names (short - complete) + Labels of Values"; + edt->PrintNames(aSSC.SStream()); + aSSC.SStream() << " -- Definitions --"; + edt->PrintDefs(aSSC.SStream()); if (!edf.IsNull()) { - edf->PrintDefs(Message::SendInfo()); - Message::SendInfo() << "To display values, add an option : o original f final m modified"; + edf->PrintDefs(aSSC.SStream()); + aSSC.SStream() << "To display values, add an option : o original f final m modified"; } return 0; @@ -3079,129 +2080,10 @@ static Standard_Integer fun_editlist(Draw_Interpretor& theDI, if (opt == 'o') what = -1; else if (opt == 'f') what = 1; - edf->PrintValues(Message::SendInfo(), what, Standard_False); - } - } - - return 0; -} - -//======================================================================= -//function : fun_editvalue -//purpose : -//======================================================================= -static Standard_Integer fun_editvalue(Draw_Interpretor& theDI, - Standard_Integer theNbArgs, - const char** theArgVec) -{ - Standard_Integer theNbArgs = theNbArgs; - if (theNbArgs < 3) - { - Message::SendInfo() << "Give the name of an EditForm + name of Value [+ newvalue or . to nullify]"; - return 1; - } - const Standard_CString arg1 = theArgVec[1]; - const Standard_CString arg2 = theArgVec[2]; - Handle(XSControl_WorkSession) WS = XSDRAWBase::Session(); - DeclareAndCast(IFSelect_EditForm, edf, WS->NamedItem(arg1)); - if (edf.IsNull()) - { - Message::SendInfo() << "Not an EditForm : " << arg1; - return 1; - } - Standard_Integer num = edf->NameNumber(arg2); - if (num == 0) Message::SendInfo() << "Unknown Value Name : " << arg2; - if (num < 0) Message::SendInfo() << "Not Extracted Value Name : " << arg2; - if (num <= 0) - return 1; - - Standard_Boolean islist = edf->Editor()->IsList(num); - Standard_CString name = edf->Editor()->Name(num, Standard_True); // vrai nom - Handle(TColStd_HSequenceOfHAsciiString) listr; - Handle(TCollection_HAsciiString) str; - Message::SendInfo() << "Value Name : " << name << (edf->IsModified(num) ? "(already edited) : " : " : "); - - if (islist) - { - listr = edf->EditedList(num); - if (listr.IsNull()) Message::SendInfo() << "(NULL LIST)"; - else - { - Standard_Integer ilist, nblist = listr->Length(); - Message::SendInfo() << "(List : " << nblist << " Items)"; - for (ilist = 1; ilist <= nblist; ilist++) - { - str = listr->Value(ilist); - Message::SendInfo() << " [" << ilist << "] " << (str.IsNull() ? "(NULL)" : str->ToCString()); - } + edf->PrintValues(aSSC.SStream(), what, Standard_False); } - if (theNbArgs < 4) Message::SendInfo() << "To Edit, options by editval edit-form value-name ?"; - } - else - { - str = edf->EditedValue(num); - Message::SendInfo() << (str.IsNull() ? "(NULL)" : str->ToCString()); } - if (theNbArgs < 4) return 0; - // Valeur simple ou liste ? - Standard_Integer numarg = 3; - str.Nullify(); - - const Standard_CString argval = pilot->Arg(numarg); - if (islist) - { - if (argval[0] == '?') - { - Message::SendInfo() << "To Edit, options" << " + val : add value at end (blanks allowed)" - << " +nn text : insert val before item nn" - << " nn text : replace item nn with a new value" - << " -nn : remove item nn" << " . : clear the list"; - return 0; - } - Standard_Boolean stated = Standard_False; - Handle(IFSelect_ListEditor) listed = edf->ListEditor(num); - if (listed.IsNull()) - return 1; - if (argval[0] == '.') - { - listr.Nullify(); stated = listed->LoadEdited(listr); - } - else if (argval[0] == '+') - { - Standard_Integer numadd = 0; - if (argval[1] != '\0') numadd = atoi(argval); - stated = listed->AddValue(new TCollection_HAsciiString(pilot->CommandPart(numarg + 1)), numadd); - } - else if (argval[0] == '-') - { - Standard_Integer numrem = atoi(argval); - stated = listed->Remove(numrem); - } - else - { - Standard_Integer numset = atoi(argval); - if (numset > 0) stated = listed->AddValue - (new TCollection_HAsciiString(pilot->CommandPart(numarg + 1)), numset); - } - if (stated) stated = edf->ModifyList(num, listed, Standard_True); - if (stated) Message::SendInfo() << "List Edition done"; - else Message::SendInfo() << "List Edition not done, option" << argval; - } - else - { - if (argval[0] == '.' && argval[1] == '\0') str.Nullify(); - else str = new TCollection_HAsciiString(pilot->CommandPart(numarg)); - if (edf->Modify(num, str, Standard_True)) - { - Message::SendInfo() << "Now set to " << (str.IsNull() ? "(NULL)" : str->ToCString()); - } - else - { - Message::SendInfo() << "Modify not done"; - return 1; - } - } return 0; } @@ -3213,9 +2095,11 @@ static Standard_Integer fun_editclear(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; if (theNbArgs < 2) { - Message::SendInfo() << "Give the name of an EditForm [+ name of Value else all]"; + aSSC.SStream() << "Give the name of an EditForm [+ name of Value else all]"; return 1; } const Standard_CString arg1 = theArgVec[1]; @@ -3224,26 +2108,27 @@ static Standard_Integer fun_editclear(Draw_Interpretor& theDI, DeclareAndCast(IFSelect_EditForm, edf, WS->NamedItem(arg1)); if (edf.IsNull()) { - Message::SendInfo() << "Not an EditForm : " << arg1; + aSSC.SStream() << "Not an EditForm : " << arg1; return 1; } if (theNbArgs < 3) { - edf->ClearEdit(); Message::SendInfo() << "All Modifications Cleared"; + edf->ClearEdit(); aSSC.SStream() << "All Modifications Cleared"; } else { Standard_Integer num = edf->NameNumber(arg2); - if (num == 0) Message::SendInfo() << "Unknown Value Name : " << arg2; - if (num < 0) Message::SendInfo() << "Not Extracted Value Name : " << arg2; + if (num == 0) aSSC.SStream() << "Unknown Value Name : " << arg2; + if (num < 0) aSSC.SStream() << "Not Extracted Value Name : " << arg2; if (num <= 0) return 1; if (!edf->IsModified(num)) { - Message::SendInfo() << "Value " << arg2 << " was not modified"; return 0; + aSSC.SStream() << "Value " << arg2 << " was not modified"; + return 0; } edf->ClearEdit(num); - Message::SendInfo() << "Modification on Value " << arg2 << " Cleared"; + aSSC.SStream() << "Modification on Value " << arg2 << " Cleared"; } return 0; } @@ -3256,9 +2141,11 @@ static Standard_Integer fun_editapply(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; if (theNbArgs < 2) { - Message::SendInfo() << "Give the name of an EditForm [+ option keep to re-apply edited values]"; + aSSC.SStream() << "Give the name of an EditForm [+ option keep to re-apply edited values]"; return 1; } const Standard_CString arg1 = theArgVec[1]; @@ -3267,7 +2154,7 @@ static Standard_Integer fun_editapply(Draw_Interpretor& theDI, DeclareAndCast(IFSelect_EditForm, edf, WS->NamedItem(arg1)); if (edf.IsNull()) { - Message::SendInfo() << "Not an EditForm : " << arg1; + aSSC.SStream() << "Not an EditForm : " << arg1; return 1; } @@ -3275,30 +2162,30 @@ static Standard_Integer fun_editapply(Draw_Interpretor& theDI, Handle(Interface_InterfaceModel) model = edf->Model(); if (!model.IsNull()) { - if (ent.IsNull()) Message::SendInfo() << "Applying modifications on loaded model"; + if (ent.IsNull()) aSSC.SStream() << "Applying modifications on loaded model"; else { - Message::SendInfo() << "Applying modifications on loaded entity : "; - model->PrintLabel(ent, Message::SendInfo()); + aSSC.SStream() << "Applying modifications on loaded entity : "; + model->PrintLabel(ent, aSSC.SStream()); } } - else Message::SendInfo() << "Applying modifications"; + else aSSC.SStream() << "Applying modifications"; if (!edf->ApplyData(edf->Entity(), edf->Model())) { - Message::SendInfo() << "Modifications could not be applied"; + aSSC.SStream() << "Modifications could not be applied"; return 1; } - Message::SendInfo() << "Modifications have been applied"; + aSSC.SStream() << "Modifications have been applied"; Standard_Boolean stat = Standard_True; if (theNbArgs > 2 && arg2[0] == 'k') stat = Standard_False; if (stat) { edf->ClearEdit(); - Message::SendInfo() << "Edited values are cleared"; + aSSC.SStream() << "Edited values are cleared"; } - else Message::SendInfo() << "Edited values are kept for another loading/applying"; + else aSSC.SStream() << "Edited values are kept for another loading/applying"; return 0; } @@ -3311,9 +2198,11 @@ static Standard_Integer fun_editload(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; if (theNbArgs < 2) { - Message::SendInfo() << "Give the name of an EditForm [+ Entity-Ident]"; + aSSC.SStream() << "Give the name of an EditForm [+ Entity-Ident]"; return 1; } const Standard_CString arg1 = theArgVec[1]; @@ -3322,70 +2211,37 @@ static Standard_Integer fun_editload(Draw_Interpretor& theDI, DeclareAndCast(IFSelect_EditForm, edf, WS->NamedItem(arg1)); if (edf.IsNull()) { - Message::SendInfo() << "Not an EditForm : " << arg1; + aSSC.SStream() << "Not an EditForm : " << arg1; return 1; } - Standard_Integer num = (theNbArgs < 3 ? 0 : pilot->Number(arg2)); + Standard_Integer num = (theNbArgs < 3 ? 0 : WS->NumberFromLabel(arg2)); Standard_Boolean stat = Standard_False; if (theNbArgs < 3) { - Message::SendInfo() << "EditForm " << arg1 << " : Loading Model"; + aSSC.SStream() << "EditForm " << arg1 << " : Loading Model"; stat = edf->LoadModel(WS->Model()); } else if (num <= 0) { - Message::SendInfo() << "Not an entity ident : " << arg2; + aSSC.SStream() << "Not an entity ident : " << arg2; return 1; } else { - Message::SendInfo() << "EditForm " << arg1 << " : Loading Entity " << arg2; + aSSC.SStream() << "EditForm " << arg1 << " : Loading Entity " << arg2; stat = edf->LoadData(WS->StartingEntity(num), WS->Model()); } if (!stat) { - Message::SendInfo() << "Loading not done"; + aSSC.SStream() << "Loading not done"; return 1; } - Message::SendInfo() << "Loading done"; + aSSC.SStream() << "Loading done"; return 0; } -//======================================================================= -//function : GiveEntity -//purpose : -//======================================================================= -Handle(Standard_Transient) GiveEntity(const Handle(XSControl_WorkSession)& WS, - const Standard_CString name) -{ - Handle(Standard_Transient) ent; // demarre a Null - Standard_Integer num = GiveEntityNumber(WS, name); - if (num > 0) ent = WS->StartingEntity(num); - return ent; -} - -//======================================================================= -//function : GiveEntityNumber -//purpose : -//======================================================================= -Standard_Integer GiveEntityNumber(const Handle(XSControl_WorkSession)& WS, - const Standard_CString name) -{ - Standard_Integer num = 0; - if (!name || name[0] == '\0') - { - char ligne[80]; ligne[0] = '\0'; - std::cin >> ligne; - // std::cin.clear(); std::cin.getline (ligne,79); - if (ligne[0] == '\0') return 0; - num = WS->NumberFromLabel(ligne); - } - else num = WS->NumberFromLabel(name); - return num; -} - //======================================================================= //function : Init //purpose : @@ -3405,16 +2261,16 @@ void XSDRAW_FunctionsSession::Init(Draw_Interpretor& theDI) theDI.Add("xload", "file:string : Read File -> Load Model", __FILE__, fun3, aGroup); theDI.Add("xread", "file:string : Read File -> Load Model", __FILE__, fun3, aGroup); theDI.Add("writeall", "file:string : Write all model (no split)", __FILE__, fun4, aGroup); - theDI.Add("writesel", "file:string sel:Selection : Write Selected (no split)", __FILE__, fun5, aGroup); + //theDI.Add("writesel", "file:string sel:Selection : Write Selected (no split)", __FILE__, fun5, aGroup); theDI.Add("writeent", "file:string n1ent n2ent...:integer : Write Entite(s) (no split)", __FILE__, fun6, aGroup); theDI.Add("writent", "file:string n1ent n2ent...:integer : Write Entite(s) (no split)", __FILE__, fun6, aGroup); theDI.Add("elabel", "nument:integer : Displays Label Model of an entity", __FILE__, fun7, aGroup); theDI.Add("enum", "label:string : Displays entities n0.s of which Label Model ends by..", __FILE__, fun8, aGroup); theDI.Add("listtypes", "List nb entities per type. Optional selection name else all model", __FILE__, fun9, aGroup); - theDI.Add("count", "Count : counter [selection]", __FILE__, funcount, aGroup); - theDI.Add("listcount", "List Counted : counter [selection [nument]]", __FILE__, funcount, aGroup); - theDI.Add("sumcount", "Summary Counted : counter [selection [nument]]", __FILE__, funcount, aGroup); + //theDI.Add("count", "Count : counter [selection]", __FILE__, funcount, aGroup); + //theDI.Add("listcount", "List Counted : counter [selection [nument]]", __FILE__, funcount, aGroup); + //theDI.Add("sumcount", "Summary Counted : counter [selection [nument]]", __FILE__, funcount, aGroup); theDI.Add("signtype", "Sign Type [newone]", __FILE__, funsigntype, aGroup); theDI.Add("signcase", "signature : displays possible cases", __FILE__, funsigncase, aGroup); @@ -3426,18 +2282,18 @@ void XSDRAW_FunctionsSession::Init(Draw_Interpretor& theDI) theDI.Add("dumpshare", "Dump Share (dispatches, IntParams)", __FILE__, fun12, aGroup); theDI.Add("listitems", "List Items [label else all] ->Type,Label[,Name]", __FILE__, fun13, aGroup); - theDI.Add("integer", "value:integer : cree un IntParam", __FILE__, fun14, aGroup); + //theDI.Add("integer", "value:integer : cree un IntParam", __FILE__, fun14, aGroup); theDI.Add("setint", "name:IntParam newValue:integer : Change valeur IntParam", __FILE__, fun15, aGroup); - theDI.Add("text", "value:string : cree un TextParam", __FILE__, fun16, aGroup); + //theDI.Add("text", "value:string : cree un TextParam", __FILE__, fun16, aGroup); theDI.Add("settext", "Name:TextParam newValue:string : Change valeur TextParam", __FILE__, fun17, aGroup); theDI.Add("dumpsel", "Dump Selection suivi du Nom de la Selection a dumper", __FILE__, fun19, aGroup); - theDI.Add("evalsel", "name:Selection [num/sel] : Evalue une Selection", __FILE__, fun20, aGroup); - theDI.Add("givelist", "num/sel [num/sel ...] : Evaluates GiveList", __FILE__, fun20, aGroup); - theDI.Add("giveshort", "num/sel [num/sel ...] : GiveList in short form", __FILE__, fun20, aGroup); - theDI.Add("givepointed", "num/sel [num/sel ...] : GiveList to fill a SelectPointed", __FILE__, fun20, aGroup); - theDI.Add("makelist", "listname [givelist] : Makes a List(SelectPointed) from GiveList", __FILE__, fun20, aGroup); - theDI.Add("givecount", "num/sel [num/sel ...] : Counts GiveList", __FILE__, fun20c, aGroup); - theDI.Add("selsuite", "sel sel ... : Creates a SelectSuite", __FILE__, funselsuite, aGroup); + //theDI.Add("evalsel", "name:Selection [num/sel] : Evalue une Selection", __FILE__, fun20, aGroup); + //theDI.Add("givelist", "num/sel [num/sel ...] : Evaluates GiveList", __FILE__, fun20, aGroup); + //theDI.Add("giveshort", "num/sel [num/sel ...] : GiveList in short form", __FILE__, fun20, aGroup); + //theDI.Add("givepointed", "num/sel [num/sel ...] : GiveList to fill a SelectPointed", __FILE__, fun20, aGroup); + //theDI.Add("makelist", "listname [givelist] : Makes a List(SelectPointed) from GiveList", __FILE__, fun20, aGroup); + //theDI.Add("givecount", "num/sel [num/sel ...] : Counts GiveList", __FILE__, fun20c, aGroup); + //theDI.Add("selsuite", "sel sel ... : Creates a SelectSuite", __FILE__, funselsuite, aGroup); theDI.Add("clearitems", "Clears all items (selections, dispatches, etc)", __FILE__, fun21, aGroup); theDI.Add("cleardata", "mode:a-g-c-p : Clears all or some data (model, check...)", __FILE__, fun22, aGroup); @@ -3467,59 +2323,59 @@ void XSDRAW_FunctionsSession::Init(Draw_Interpretor& theDI) theDI.Add("modifmove", "modif:Modifier M(model)/F(file) avant,apres:integer : Deplace un Modifier (sortie fichier)", __FILE__, fun45, aGroup); theDI.Add("dispsel", "disp:Dispatch sel:Selection -> Selection Finale de Dispatch", __FILE__, fun51, aGroup); - theDI.Add("dispone", "cree DispPerOne", __FILE__, fun_dispone, aGroup); - theDI.Add("dispglob", "cree DispGlobal", __FILE__, fun_dispglob, aGroup); - theDI.Add("dispcount", "count:IntParam : cree DispPerCount", __FILE__, fun_dispcount, aGroup); - theDI.Add("dispfile", "files:IntParam : cree DispPerFiles", __FILE__, fun_dispfiles, aGroup); - theDI.Add("dispsign", "sign:Signature : cree DispPerSignature", __FILE__, fun_dispsign, aGroup); + //theDI.Add("dispone", "cree DispPerOne", __FILE__, fun_dispone, aGroup); + //theDI.Add("dispglob", "cree DispGlobal", __FILE__, fun_dispglob, aGroup); + //theDI.Add("dispcount", "count:IntParam : cree DispPerCount", __FILE__, fun_dispcount, aGroup); + //theDI.Add("dispfile", "files:IntParam : cree DispPerFiles", __FILE__, fun_dispfiles, aGroup); + //theDI.Add("dispsign", "sign:Signature : cree DispPerSignature", __FILE__, fun_dispsign, aGroup); theDI.Add("dumpdisp", "disp:Dispatch : Affiche le Statut d'un Dispatch", __FILE__, fun56, aGroup); theDI.Add("xremove", "nom : Remove a Control Item de la Session", __FILE__, fun57, aGroup); theDI.Add("evaldisp", "mode=[0-3] disp:Dispatch : Evaluates one or more Dispatch(es)", __FILE__, fun58, aGroup); - theDI.Add("evaladisp", "mode=[0-3] disp:Dispatch [givelist] : Evaluates a Dispatch (on a GiveList)", __FILE__, fun_evaladisp, aGroup); - theDI.Add("writedisp", "filepattern disp:Dispatch [givelist] : Writes Entities by Splitting by a Dispatch", __FILE__, fun_writedisp, aGroup); + //theDI.Add("evaladisp", "mode=[0-3] disp:Dispatch [givelist] : Evaluates a Dispatch (on a GiveList)", __FILE__, fun_evaladisp, aGroup); + //theDI.Add("writedisp", "filepattern disp:Dispatch [givelist] : Writes Entities by Splitting by a Dispatch", __FILE__, fun_writedisp, aGroup); theDI.Add("evalcomplete", "Evaluation Complete de la Repartition", __FILE__, fun59, aGroup); theDI.Add("runcheck", "affiche LastRunCheckList (write,modif)", __FILE__, fun60, aGroup); theDI.Add("runtranformer", "transf:Transformer : Applique un Transformer", __FILE__, fun61, aGroup); - theDI.Add("copy", "cree TransformStandard, option Copy, vide", __FILE__, fun62, aGroup); - theDI.Add("onthespot", "cree TransformStandard, option OntheSpot, vide", __FILE__, fun63, aGroup); - theDI.Add("runcopy", "modif:ModelModifier [givelist] : Run via TransformStandard option Copy", __FILE__, fun6465, aGroup); - theDI.Add("runonthespot", "modif:ModelModifier [givelist] : Run via TransformStandard option OnTheSpot", __FILE__, fun6465, aGroup); - theDI.Add("reorder", "[f ou t] reordonne le modele", __FILE__, fun66, aGroup); + //theDI.Add("copy", "cree TransformStandard, option Copy, vide", __FILE__, fun62, aGroup); + //theDI.Add("onthespot", "cree TransformStandard, option OntheSpot, vide", __FILE__, fun63, aGroup); + //theDI.Add("runcopy", "modif:ModelModifier [givelist] : Run via TransformStandard option Copy", __FILE__, fun6465, aGroup); + //theDI.Add("runonthespot", "modif:ModelModifier [givelist] : Run via TransformStandard option OnTheSpot", __FILE__, fun6465, aGroup); + //theDI.Add("reorder", "[f ou t] reordonne le modele", __FILE__, fun66, aGroup); theDI.Add("toggle", "sel:Selection genre Extract : Toggle Direct/Reverse", __FILE__, fun70, aGroup); theDI.Add("input", "sel:Selection genre Deduct ou Extract input:Selection : Set Input", __FILE__, fun71, aGroup); - theDI.Add("modelroots", "cree SelectModelRoots", __FILE__, fun72, aGroup); - theDI.Add("range", "options... : cree SelectRange ...; tout court pour help", __FILE__, fun73, aGroup); - theDI.Add("roots", "cree SelectRoots (local roots)", __FILE__, fun74, aGroup); - theDI.Add("shared", "cree SelectShared", __FILE__, fun75, aGroup); - theDI.Add("diff", "[main:Selection diff:Selection] : cree SelectDiff", __FILE__, fun76, aGroup); + //theDI.Add("modelroots", "cree SelectModelRoots", __FILE__, fun72, aGroup); + //theDI.Add("range", "options... : cree SelectRange ...; tout court pour help", __FILE__, fun73, aGroup); + //theDI.Add("roots", "cree SelectRoots (local roots)", __FILE__, fun74, aGroup); + //theDI.Add("shared", "cree SelectShared", __FILE__, fun75, aGroup); + //theDI.Add("diff", "[main:Selection diff:Selection] : cree SelectDiff", __FILE__, fun76, aGroup); theDI.Add("selmain", "sel:Selection genre Control main:Selection : Set Main Input", __FILE__, fun77, aGroup); theDI.Add("selsecond", "sel:Selection genre Control sec:Selection : Set Second Input", __FILE__, fun78, aGroup); - theDI.Add("modelall", "cree SelectModelAll", __FILE__, fun79, aGroup); + //theDI.Add("modelall", "cree SelectModelAll", __FILE__, fun79, aGroup); theDI.Add("seladd", "sel:Selection genre Combine input:Selection : Add Selection", __FILE__, fun80, aGroup); theDI.Add("selrem", "sel:Selection genre Combine input:Selection : Remove Selection", __FILE__, fun81, aGroup); - theDI.Add("number", "num:IntParam : Cree SelectEntityNumber", __FILE__, fun82, aGroup); - - theDI.Add("union", "cree SelectUnion (vide), cf aussi combadd, combrem", __FILE__, fun83, aGroup); - theDI.Add("intersect", "cree SelectIntersection (vide), cf aussi combadd, combrem", __FILE__, fun84, aGroup); - theDI.Add("typexact", "type:string : cree SelectTextType Exact", __FILE__, fun85, aGroup); - theDI.Add("errors", "cree SelectErrorEntities (from file)", __FILE__, fun86, aGroup); - theDI.Add("unknown", "cree SelectUnknownEntities", __FILE__, fun87, aGroup); - theDI.Add("sharing", "cree SelectSharing", __FILE__, fun88, aGroup); - theDI.Add("typecontain", "type:string : cree SelectTextType Contains", __FILE__, fun89, aGroup); - theDI.Add("pointed", "cree SelectPointed [num/sel num/sel]", __FILE__, fun90, aGroup); + //theDI.Add("number", "num:IntParam : Cree SelectEntityNumber", __FILE__, fun82, aGroup); + + //theDI.Add("union", "cree SelectUnion (vide), cf aussi combadd, combrem", __FILE__, fun83, aGroup); + //theDI.Add("intersect", "cree SelectIntersection (vide), cf aussi combadd, combrem", __FILE__, fun84, aGroup); + //theDI.Add("typexact", "type:string : cree SelectTextType Exact", __FILE__, fun85, aGroup); + //theDI.Add("errors", "cree SelectErrorEntities (from file)", __FILE__, fun86, aGroup); + //theDI.Add("unknown", "cree SelectUnknownEntities", __FILE__, fun87, aGroup); + //theDI.Add("sharing", "cree SelectSharing", __FILE__, fun88, aGroup); + //theDI.Add("typecontain", "type:string : cree SelectTextType Contains", __FILE__, fun89, aGroup); + //theDI.Add("pointed", "cree SelectPointed [num/sel num/sel]", __FILE__, fun90, aGroup); theDI.Add("setpointed", "sel:SelectPointed : edition SelectPointed. tout court pour help", __FILE__, fun91, aGroup); theDI.Add("setlist", "sel:SelectPointed : edition SelectPointed. tout court pour help", __FILE__, fun91, aGroup); - theDI.Add("incorrect", "cree SelectIncorrectEntities (computed)", __FILE__, fun92, aGroup); + //theDI.Add("incorrect", "cree SelectIncorrectEntities (computed)", __FILE__, fun92, aGroup); - theDI.Add("signsel", "sign:Signature|cnt:Counter text:string [e(D)|c] : cree SelectSignature", __FILE__, fun93, aGroup); - theDI.Add("signcounter", "sign:Signature : cree SignCounter", __FILE__, fun94, aGroup); - theDI.Add("nbselected", "applied:Selection : cree GraphCounter(=NbSelected)", __FILE__, funbselected, aGroup); + //theDI.Add("signsel", "sign:Signature|cnt:Counter text:string [e(D)|c] : cree SelectSignature", __FILE__, fun93, aGroup); + //theDI.Add("signcounter", "sign:Signature : cree SignCounter", __FILE__, fun94, aGroup); + //theDI.Add("nbselected", "applied:Selection : cree GraphCounter(=NbSelected)", __FILE__, funbselected, aGroup); theDI.Add("editlist", "editor or editform : lists defs + values", __FILE__, fun_editlist, aGroup); - theDI.Add("editvalue", "editform paramname [newval or .] : lists-changes a value", __FILE__, fun_editvalue, aGroup); + //theDI.Add("editvalue", "editform paramname [newval or .] : lists-changes a value", __FILE__, fun_editvalue, aGroup); theDI.Add("editclear", "editform [paramname] : clears edition on all or one param", __FILE__, fun_editclear, aGroup); theDI.Add("editload", "editform [entity-id] : loads from model or an entity", __FILE__, fun_editload, aGroup); theDI.Add("editapply", "editform [keep] : applies on loaded data", __FILE__, fun_editapply, aGroup); diff --git a/src/XSDRAW/XSDRAW_FunctionsShape.cxx b/src/XSDRAW/XSDRAW_FunctionsShape.cxx index 52a5c19748..506bc80bfb 100644 --- a/src/XSDRAW/XSDRAW_FunctionsShape.cxx +++ b/src/XSDRAW/XSDRAW_FunctionsShape.cxx @@ -15,6 +15,8 @@ #include #include +#include +#include #include #include #include @@ -39,39 +41,60 @@ #include #include #include -#include +#include +#include #include #include #include #include -#include +//======================================================================= +//function : GiveEntityNumber +//purpose : +//======================================================================= +static Standard_Integer GiveEntityNumber(const Handle(XSControl_WorkSession)& WS, + const Standard_CString name) +{ + Standard_Integer num = 0; + if (!name || name[0] == '\0') + { + char ligne[80]; ligne[0] = '\0'; + std::cin >> ligne; + // std::cin.clear(); std::cin.getline (ligne,79); + if (ligne[0] == '\0') return 0; + num = WS->NumberFromLabel(ligne); + } + else num = WS->NumberFromLabel(name); + return num; +} //======================================================================= //function : XSControl_tpdraw //purpose : //======================================================================= -static Standard_Integer XSControl_tpdraw -(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) +static Standard_Integer XSControl_tpdraw(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); - const Standard_CString arg3 = pilot->Arg(3); - const Handle(Transfer_TransientProcess)& TP = XSControl::Session(pilot)->TransferReader()->TransientProcess(); - Message_Messenger::StreamBuffer sout = Message::SendInfo(); + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + const Standard_CString arg1 = theArgVec[1]; + const Standard_CString arg2 = theArgVec[2]; + const Standard_CString arg3 = theArgVec[3]; + const Handle(Transfer_TransientProcess)& TP = XSDRAWBase::Session()->TransferReader()->TransientProcess(); if (TP.IsNull()) { - sout << "No Transfer Read" << std::endl; return IFSelect_RetError; + aSSC.SStream() << "No Transfer Read" << std::endl; + return 1; } // **** tpdraw **** - if (argc < 2) + if (theNbArgs < 2) { - sout << "Donner [mode facultatif : item ou root] , NUMERO , nom DRAW facultatif" << std::endl; - sout << " mode si present : item ou root, sinon n0 d entite modele" << std::endl; - sout << " NUMERO entier : d entite, d item transfert ou de root transfert\n" + aSSC.SStream() << "Donner [mode facultatif : item ou root] , NUMERO , nom DRAW facultatif" << std::endl; + aSSC.SStream() << " mode si present : item ou root, sinon n0 d entite modele" << std::endl; + aSSC.SStream() << " NUMERO entier : d entite, d item transfert ou de root transfert\n" << " ou * pour dire tous" << std::endl; - return IFSelect_RetError; + return 1; } Standard_Integer mode = 0, num = 0; if (arg1[0] == 'i') mode = 1; @@ -79,17 +102,18 @@ static Standard_Integer XSControl_tpdraw Standard_Boolean tout = Standard_False; if (mode == 0) { - if (argc < 2) + if (theNbArgs < 2) { - sout << "Donner au moins un NUMERO ou *" << std::endl; return IFSelect_RetError; + aSSC.SStream() << "Donner au moins un NUMERO ou *" << std::endl; + return 1; } if (arg1[0] == '*') tout = Standard_True; - else num = IFSelect_Functions::GiveEntityNumber(XSControl::Session(pilot), arg1); + else num = GiveEntityNumber(XSDRAWBase::Session(), arg1); } else { if (arg2[0] == '*') tout = Standard_True; - else num = IFSelect_Functions::GiveEntityNumber(XSControl::Session(pilot), arg2); + else num = GiveEntityNumber(XSDRAWBase::Session(), arg2); } Standard_Integer nbvar = 0; @@ -104,36 +128,36 @@ static Standard_Integer XSControl_tpdraw { if (mode == 0) { - sout << "Pas de modele, preciser n0 d item de transfert" << std::endl; - return IFSelect_RetError; + aSSC.SStream() << "Pas de modele, preciser n0 d item de transfert" << std::endl; + return 1; } } if (mode == 0) { - sout << "Entite de modele"; max = model->NbEntities(); + aSSC.SStream() << "Entite de modele"; max = model->NbEntities(); } if (mode == 1) { - sout << "Item de transfert"; max = TP->NbMapped(); + aSSC.SStream() << "Item de transfert"; max = TP->NbMapped(); } if (mode == 2) { - sout << "Racine de transfert"; max = TP->NbRoots(); + aSSC.SStream() << "Racine de transfert"; max = TP->NbRoots(); } if (tout) { n1 = 1; n2 = max; - sout << ", listage de 1 a " << max << std::endl; + aSSC.SStream() << ", listage de 1 a " << max << std::endl; } else if (num <= 0 || num > max) { - sout << " - Num=" << num << " hors limite (de 1 a " << max << ")" << std::endl; - return IFSelect_RetError; + aSSC.SStream() << " - Num=" << num << " hors limite (de 1 a " << max << ")" << std::endl; + return 1; } else { n1 = n2 = num; nbvar = -1; // nbvar : 1ere shape simple = pas de n0 - sout << ", n0 " << num << std::endl; + aSSC.SStream() << ", n0 " << num << std::endl; } for (i = n1; i <= n2; i++) @@ -163,12 +187,12 @@ static Standard_Integer XSControl_tpdraw if (binder.IsNull()) index = 0; if (index == 0) { - if (!tout) sout << "Entite n0 " << num << " : non repertoriee" << std::endl; + if (!tout) aSSC.SStream() << "Entite n0 " << num << " : non repertoriee" << std::endl; continue; } if (!binder->HasResult()) { - if (!tout) sout << "Entite n0 " << num << " : pas de resultat" << std::endl; + if (!tout) aSSC.SStream() << "Entite n0 " << num << " : pas de resultat" << std::endl; continue; } sh = TransferBRep::ShapeResult(binder); @@ -179,51 +203,51 @@ static Standard_Integer XSControl_tpdraw nbvar++; if (sh.IsNull()) { - sout << " (no Shape recorded)" << std::endl; continue; + aSSC.SStream() << " (no Shape recorded)" << std::endl; continue; } - if (tout) sout << "[ " << i << " ]:"; - if (num == 0) sout << " pas dans le modele"; - else sout << " ent.n0 " << num; - sout << ", item transfert n0 " << index; + if (tout) aSSC.SStream() << "[ " << i << " ]:"; + if (num == 0) aSSC.SStream() << " pas dans le modele"; + else aSSC.SStream() << " ent.n0 " << num; + aSSC.SStream() << ", item transfert n0 " << index; if (nbvar == 0) { - if (argc > 3 && mode > 0) sprintf(nomvar, "%s", arg3); - else if (argc > 2 && mode == 0) sprintf(nomvar, "%s", arg2); + if (theNbArgs > 3 && mode > 0) sprintf(nomvar, "%s", arg3); + else if (theNbArgs > 2 && mode == 0) sprintf(nomvar, "%s", arg2); else sprintf(nomvar, "tp_%d", i); } else { - if (argc > 3 && mode > 0) sprintf(nomvar, "%s_%d", arg3, nbvar); - else if (argc > 2 && mode == 0) sprintf(nomvar, "%s_%d", arg2, nbvar); + if (theNbArgs > 3 && mode > 0) sprintf(nomvar, "%s_%d", arg3, nbvar); + else if (theNbArgs > 2 && mode == 0) sprintf(nomvar, "%s_%d", arg2, nbvar); else sprintf(nomvar, "tp_%d", i); } - sout << " -> 1 DRAW Shape: " << nomvar << std::endl; - XSControl::Vars(pilot)->SetShape(nomvar, sh); + aSSC.SStream() << " -> 1 DRAW Shape: " << nomvar << std::endl; + DBRep::Set(nomvar, sh); continue; } DeclareAndCast(TransferBRep_ShapeListBinder, slb, binder); if (!slb.IsNull()) { Standard_Integer nbs = slb->NbShapes(); - if (tout) sout << "[ " << i << " ]:"; - if (num == 0) sout << " pas dans le modele"; - else sout << " ent.n0 " << num; - sout << ", item transfert n0 " << index; - sout << " -> " << nbs << " DRAW Shapes :"; + if (tout) aSSC.SStream() << "[ " << i << " ]:"; + if (num == 0) aSSC.SStream() << " pas dans le modele"; + else aSSC.SStream() << " ent.n0 " << num; + aSSC.SStream() << ", item transfert n0 " << index; + aSSC.SStream() << " -> " << nbs << " DRAW Shapes :"; for (Standard_Integer j = 1; j <= nbs; j++) { sh = slb->Shape(j); if (nbvar < 0) nbvar = 0; nbvar++; if (sh.IsNull()) { - sout << " (no Shape recorded)" << std::endl; continue; + aSSC.SStream() << " (no Shape recorded)" << std::endl; continue; } - if (argc > 3 && mode > 0) sprintf(nomvar, "%s_%d", arg3, nbvar); - else if (argc > 2 && mode == 0) sprintf(nomvar, "%s_%d", arg2, nbvar); + if (theNbArgs > 3 && mode > 0) sprintf(nomvar, "%s_%d", arg3, nbvar); + else if (theNbArgs > 2 && mode == 0) sprintf(nomvar, "%s_%d", arg2, nbvar); else sprintf(nomvar, "tp_%d_%d", i, nbvar); - sout << " " << nomvar; - XSControl::Vars(pilot)->SetShape(nomvar, sh); + aSSC.SStream() << " " << nomvar; + DBRep::Set(nomvar, sh); } - sout << std::endl; + aSSC.SStream() << std::endl; continue; } DeclareAndCast(Transfer_SimpleBinderOfTransient, trb, binder); @@ -232,121 +256,130 @@ static Standard_Integer XSControl_tpdraw Handle(Standard_Transient) resu = trb->Result(); if (resu.IsNull()) { - sout << "Entite n0 " << num << " : pas de resultat" << std::endl; + aSSC.SStream() << "Entite n0 " << num << " : pas de resultat" << std::endl; continue; } DeclareAndCast(Geom_Geometry, geom, resu); - sout << "Entite n0 " << num << " : resultat " << resu->DynamicType()->Name(); + aSSC.SStream() << "Entite n0 " << num << " : resultat " << resu->DynamicType()->Name(); if (geom.IsNull()) { - sout << std::endl; continue; + aSSC.SStream() << std::endl; continue; } nbvar++; if (nbvar == 0) { - if (argc > 3 && mode > 0) sprintf(nomvar, "%s", arg3); - else if (argc > 2 && mode == 0) sprintf(nomvar, "%s", arg2); + if (theNbArgs > 3 && mode > 0) sprintf(nomvar, "%s", arg3); + else if (theNbArgs > 2 && mode == 0) sprintf(nomvar, "%s", arg2); else sprintf(nomvar, "tp_%d", i); } else { - if (argc > 3 && mode > 0) sprintf(nomvar, "%s_%d", arg3, nbvar); - else if (argc > 2 && mode == 0) sprintf(nomvar, "%s_%d", arg2, nbvar); + if (theNbArgs > 3 && mode > 0) sprintf(nomvar, "%s_%d", arg3, nbvar); + else if (theNbArgs > 2 && mode == 0) sprintf(nomvar, "%s_%d", arg2, nbvar); else sprintf(nomvar, "tp_%d", i); } char* nomv = nomvar; - XSControl::Vars(pilot)->Set(nomv, geom); - sout << " -> DRAW Geom : " << nomvar << std::endl; + DrawTrSurf::Set(nomv, geom); + aSSC.SStream() << " -> DRAW Geom : " << nomvar << std::endl; continue; } if (sh.IsNull() && trb.IsNull()) - if (!tout) sout << "Entite n0 " << num << " : resultat pas une Shape mais " << binder->ResultTypeName() << std::endl; + if (!tout) aSSC.SStream() << "Entite n0 " << num << " : resultat pas une Shape mais " << binder->ResultTypeName() << std::endl; } - if (sh.IsNull()) sout << " (No Shape)" << std::endl; - return IFSelect_RetDone; + if (sh.IsNull()) aSSC.SStream() << " (No Shape)" << std::endl; + return 0; } //======================================================================= //function : XSControl_tpcompound //purpose : //======================================================================= -static Standard_Integer XSControl_tpcompound -(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) +static Standard_Integer XSControl_tpcompound(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - const Handle(Transfer_TransientProcess)& TP = XSControl::Session(pilot)->TransferReader()->TransientProcess(); - Message_Messenger::StreamBuffer sout = Message::SendInfo(); + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + const Standard_CString arg1 = theArgVec[1]; + const Handle(Transfer_TransientProcess)& TP = XSDRAWBase::Session()->TransferReader()->TransientProcess(); if (TP.IsNull()) { - sout << "No Transfer Read" << std::endl; return IFSelect_RetError; + aSSC.SStream() << "No Transfer Read" << std::endl; + return 1; } // **** tpcompound **** - if (argc < 2) + if (theNbArgs < 2) { - sout << "Give a NAME for the Compound + optional givelist, else roots are taken" << std::endl; return IFSelect_RetError; + aSSC.SStream() << "Give a NAME for the Compound + optional givelist, else roots are taken" << std::endl; + return 1; } Handle(TopTools_HSequenceOfShape) list; - if (argc == 2) list = TransferBRep::Shapes(TP); + if (theNbArgs == 2) list = TransferBRep::Shapes(TP); else { - Handle(TColStd_HSequenceOfTransient) lise = IFSelect_Functions::GiveList(pilot->Session(), pilot->CommandPart(2)); + Handle(TColStd_HSequenceOfTransient) lise = XSDRAWBase::Session()->GiveList(theArgVec[2]); if (lise.IsNull()) { - sout << "Not a valid entity list : " << pilot->CommandPart(2) << std::endl; return IFSelect_RetError; + aSSC.SStream() << "Not a valid entity list : " << theArgVec[2] << std::endl; + return 1; } list = TransferBRep::Shapes(TP, lise); - sout << lise->Length() << " Entities, "; + aSSC.SStream() << lise->Length() << " Entities, "; } if (list.IsNull()) { - sout << "No Shape listed" << std::endl; return IFSelect_RetError; + aSSC.SStream() << "No Shape listed" << std::endl; + return 1; } Standard_Integer nb = list->Length(); - sout << nb << " Shape(s) listed" << std::endl; + aSSC.SStream() << nb << " Shape(s) listed" << std::endl; TopoDS_Compound C; BRep_Builder B; B.MakeCompound(C); for (Standard_Integer i = 1; i <= nb; i++) B.Add(C, list->Value(i)); - XSControl::Vars(pilot)->SetShape(arg1, C); - return IFSelect_RetDone; + DBRep::Set(arg1, C); + return 0; } //======================================================================= //function : XSControl_traccess //purpose : //======================================================================= -static Standard_Integer XSControl_traccess -(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) +static Standard_Integer XSControl_traccess(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + const Standard_CString arg1 = theArgVec[1]; + const Standard_CString arg2 = theArgVec[2]; + TCollection_AsciiString aCommand(theArgVec[0]); // **** trdraw : TransferReader **** 26 // **** trsave : TransferReader **** 27 // **** trcomp (comp -> DRAW) **** 28 // **** trscomp (comp -> save) **** 29 - Standard_Boolean cascomp = (pilot->Word(0).Location(1, 'o', 1, 5) > 0); - Standard_Boolean cassave = (pilot->Word(0).Location(1, 's', 1, 5) > 0); + Standard_Boolean cascomp = (aCommand.Location(1, 'o', 1, 5) > 0); + Standard_Boolean cassave = (aCommand.Location(1, 's', 1, 5) > 0); TCollection_AsciiString nomsh, noms; - const Handle(XSControl_TransferReader)& TR = XSControl::Session(pilot)->TransferReader(); - Message_Messenger::StreamBuffer sout = Message::SendInfo(); + const Handle(XSControl_TransferReader)& TR = XSDRAWBase::Session()->TransferReader(); if (TR.IsNull()) { - sout << " manque init" << std::endl; return IFSelect_RetError; + aSSC.SStream() << " manque init" << std::endl; + return 1; } const Handle(Interface_InterfaceModel)& mdl = TR->Model(); if (mdl.IsNull()) { - sout << " modele absent" << std::endl; return IFSelect_RetError; + aSSC.SStream() << " modele absent" << std::endl; + return 1; } - Standard_Integer num = (argc > 1 ? IFSelect_Functions::GiveEntityNumber(XSControl::Session(pilot), arg1) : 0); + Standard_Integer num = (theNbArgs > 1 ? GiveEntityNumber(XSDRAWBase::Session(), arg1) : 0); - if (argc > 1) nomsh = arg1; + if (theNbArgs > 1) nomsh = arg1; else nomsh = cascomp ? "TREAD_COMP" : "TREAD_LIST"; - if (cassave) sout << " save shapes -> current directory" << std::endl; + if (cassave) aSSC.SStream() << " save shapes -> current directory" << std::endl; if (num == 0 || cascomp) { @@ -355,41 +388,43 @@ static Standard_Integer XSControl_traccess B.MakeCompound(C); const Handle(TopTools_HSequenceOfShape)& list = TR->ShapeResultList(Standard_True); - sout << " TOUS RESULTATS par ShapeResultList, soit " << list->Length() << std::endl; + aSSC.SStream() << " TOUS RESULTATS par ShapeResultList, soit " << list->Length() << std::endl; for (Standard_Integer i = 1, nb = list->Length(); i <= nb; ++i) { noms = nomsh + "_" + i; - if ((i % 1000) == 0) sout << "(" << i << ")" << std::endl; - else if ((i % 100) == 0) sout << "*"; - else if ((i % 10) == 0) sout << "0"; - else sout << "."; + if ((i % 1000) == 0) aSSC.SStream() << "(" << i << ")" << std::endl; + else if ((i % 100) == 0) aSSC.SStream() << "*"; + else if ((i % 10) == 0) aSSC.SStream() << "0"; + else aSSC.SStream() << "."; if (list->Value(i).IsNull()) continue; - if (!cascomp && !cassave) XSControl::Vars(pilot)->SetShape(noms.ToCString(), list->Value(i)); + if (!cascomp && !cassave) DBRep::Set(noms.ToCString(), list->Value(i)); else if (!cascomp && cassave) BRepTools::Write(list->Value(i), noms.ToCString()); else if (cascomp) B.Add(C, list->Value(i)); } - sout << std::endl; - if (cascomp && !cassave) XSControl::Vars(pilot)->SetShape(nomsh.ToCString(), C); + aSSC.SStream() << std::endl; + if (cascomp && !cassave) DBRep::Set(nomsh.ToCString(), C); else if (cascomp && cassave) BRepTools::Write(C, nomsh.ToCString()); } else { if (num < 1 || num > mdl->NbEntities()) { - sout << " incorrect:" << arg1 << std::endl; return IFSelect_RetError; + aSSC.SStream() << " incorrect:" << arg1 << std::endl; + return 1; } TopoDS_Shape sh = TR->ShapeResult(mdl->Value(num)); if (sh.IsNull()) { - sout << " Pas de resultat pour " << arg1 << std::endl; return IFSelect_RetError; + aSSC.SStream() << " Pas de resultat pour " << arg1 << std::endl; + return 1; } - if (argc > 2) nomsh = arg2; + if (theNbArgs > 2) nomsh = arg2; else nomsh = TCollection_AsciiString("TREAD_") + num; - if (!cascomp && !cassave) XSControl::Vars(pilot)->SetShape(nomsh.ToCString(), sh); + if (!cascomp && !cassave) DBRep::Set(nomsh.ToCString(), sh); else if (!cascomp && cassave) BRepTools::Write(sh, nomsh.ToCString()); - else sout << "Option non comprise" << std::endl; + else aSSC.SStream() << "Option non comprise" << std::endl; } - return IFSelect_RetDone; + return 0; } //======================================================================= @@ -398,7 +433,8 @@ static Standard_Integer XSControl_traccess //======================================================================= // PTV 23.08.2000 Added for checking where are an entity from. static Standard_Boolean XSControl_IsEqualSubShape(const TopoDS_Shape& Shape, - TopoDS_Shape& sh, Standard_Integer aLevel) + TopoDS_Shape& sh, + Standard_Integer aLevel) { if (sh.IsSame(Shape)) return Standard_True; if (aLevel > 0) @@ -419,29 +455,30 @@ static Standard_Boolean XSControl_IsEqualSubShape(const TopoDS_Shape& Shape, //function : XSControl_fromshape //purpose : //======================================================================= -static Standard_Integer XSControl_fromshape -(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) +static Standard_Integer XSControl_fromshape(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + const Standard_CString arg1 = theArgVec[1]; // **** fromshape (tread) **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 2) + if (theNbArgs < 2) { - sout << "Give name of a DRAW Shape" << std::endl; - return IFSelect_RetError; + aSSC.SStream() << "Give name of a DRAW Shape" << std::endl; + return 1; } const char* a1 = (char*)arg1; - TopoDS_Shape Shape = XSControl::Vars(pilot)->GetShape(a1); + TopoDS_Shape Shape = DBRep::Get(a1); if (Shape.IsNull()) { - sout << "Not a DRAW Shape:" << arg1 << std::endl; - return IFSelect_RetError; + aSSC.SStream() << "Not a DRAW Shape:" << arg1 << std::endl; + return 1; } Standard_Boolean yena = Standard_False; Standard_Integer aLevel = 1; - if (argc >= 3) - aLevel = atoi(pilot->Arg(2)); + if (theNbArgs >= 3) + aLevel = atoi(theArgVec[2]); Standard_Boolean silent = Standard_False; if (aLevel < 0) { @@ -450,14 +487,14 @@ static Standard_Integer XSControl_fromshape } // IMPORT - const Handle(XSControl_TransferReader)& TR = XSControl::Session(pilot)->TransferReader(); + const Handle(XSControl_TransferReader)& TR = XSDRAWBase::Session()->TransferReader(); if (TR.IsNull()) { - } // sout<<"No read transfer (import) recorded"<EntityFromShapeResult(Shape, modrec); if (ent.IsNull()) @@ -472,8 +509,8 @@ static Standard_Integer XSControl_fromshape if (TP.IsNull()) { if (silent) - sout << "Shape " << arg1 << " : "; - sout << "no map" << std::endl; + aSSC.SStream() << "Shape " << arg1 << " : "; + aSSC.SStream() << "no map" << std::endl; } else { @@ -481,7 +518,7 @@ static Standard_Integer XSControl_fromshape TopLoc_Location L; S0.Location(L); Standard_Integer i, nb = TP->NbMapped(); - if (!silent) sout << "searching in map among " << nb << " ..."; + if (!silent) aSSC.SStream() << "searching in map among " << nb << " ..."; for (i = 1; i <= nb; i++) { ent = TP->Mapped(i); @@ -502,19 +539,19 @@ static Standard_Integer XSControl_fromshape } if (!ent.IsNull()) { - if (silent) sout << "Shape " << arg1 << ": "; - if (modrec < 0) sout << "(moved from origin) "; - //else sout<<"(origin) "; + if (silent) aSSC.SStream() << "Shape " << arg1 << ": "; + if (modrec < 0) aSSC.SStream() << "(moved from origin) "; + //else aSSC.SStream()<<"(origin) "; } // on affiche if (ent.IsNull()) { - if (!silent) sout << " unknown as imported"; + if (!silent) aSSC.SStream() << " unknown as imported"; // skl 11.05.2004 // if Shape is a compound try to make "fromshape" for its subshapes if (Shape.ShapeType() == TopAbs_COMPOUND) { - sout << std::endl << "Subshapes imported from entities:"; + aSSC.SStream() << std::endl << "Subshapes imported from entities:"; TopoDS_Iterator Iter(Shape); for (; Iter.More(); Iter.Next()) { @@ -528,22 +565,22 @@ static Standard_Integer XSControl_fromshape } if (!subent.IsNull()) { - sout << " " << XSControl::Session(pilot)->Model()->Number(subent); + aSSC.SStream() << " " << XSDRAWBase::Session()->Model()->Number(subent); } } } } else { - sout << "imported from entity "; - XSControl::Session(pilot)->Model()->Print(ent, sout); - if (silent) sout << " in file " << XSControl::Session(pilot)->LoadedFile() << std::endl; + aSSC.SStream() << "imported from entity "; + XSDRAWBase::Session()->Model()->Print(ent, aSSC.SStream()); + if (silent) aSSC.SStream() << " in file " << XSDRAWBase::Session()->LoadedFile() << std::endl; } - if (!silent) sout << std::endl; + if (!silent) aSSC.SStream() << std::endl; } // ET EN EXPORT ? - const Handle(Transfer_FinderProcess)& FP = XSControl::Session(pilot)->TransferWriter()->FinderProcess(); + const Handle(Transfer_FinderProcess)& FP = XSDRAWBase::Session()->TransferWriter()->FinderProcess(); if (FP.IsNull()) { } @@ -555,10 +592,10 @@ static Standard_Integer XSControl_fromshape if (!fnd.IsNull()) ent = FP->FindTransient(fnd); if (!ent.IsNull()) { - sout << "Shape " << arg1 << ": exported to entity "; - XSControl::Session(pilot)->Model()->Print(ent, sout); - if (silent) sout << " in file " << XSControl::Session(pilot)->LoadedFile(); - sout << std::endl; + aSSC.SStream() << "Shape " << arg1 << ": exported to entity "; + XSDRAWBase::Session()->Model()->Print(ent, aSSC.SStream()); + if (silent) aSSC.SStream() << " in file " << XSDRAWBase::Session()->LoadedFile(); + aSSC.SStream() << std::endl; } // abv 31.08.00: treat case of split shape (several results) // it is supposed that results are of the same type and lie in one-level comp @@ -573,16 +610,16 @@ static Standard_Integer XSControl_fromshape if (!TransientListBinder.IsNull()) { Standard_Integer i = 1, nb = TransientListBinder->NbTransients(); - if (nb > 0) sout << "Shape " << arg1 << ": exported to entities "; + if (nb > 0) aSSC.SStream() << "Shape " << arg1 << ": exported to entities "; for (; i <= nb; i++) { - XSControl::Session(pilot)->Model()->Print(TransientListBinder->Transient(i), sout); - if (i < nb) sout << ", "; + XSDRAWBase::Session()->Model()->Print(TransientListBinder->Transient(i), aSSC.SStream()); + if (i < nb) aSSC.SStream() << ", "; } if (nb > 0) { - if (silent) sout << " in file " << XSControl::Session(pilot)->LoadedFile(); - sout << std::endl; + if (silent) aSSC.SStream() << " in file " << XSDRAWBase::Session()->LoadedFile(); + aSSC.SStream() << std::endl; } } /* else { @@ -595,236 +632,109 @@ static Standard_Integer XSControl_fromshape Handle(Standard_Transient) cent = FP->FindTransient (cfnd); if ( cent.IsNull() ) continue; if ( start ) - sout<<"Shape "<Model()->Print(cent,sout); + XSControl::Session(pilot)->Model()->Print(cent,aSSC.SStream()); } - if ( ! start ) sout<NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + const Standard_CString arg1 = theArgVec[1]; // **** connected entities (last transfer) **** - const Handle(XSControl_TransferReader)& TR = XSControl::Session(pilot)->TransferReader(); + const Handle(XSControl_TransferReader)& TR = XSDRAWBase::Session()->TransferReader(); Handle(Transfer_TransientProcess) TP; if (!TR.IsNull()) TP = TR->TransientProcess(); - Message_Messenger::StreamBuffer sout = Message::SendInfo(); if (TP.IsNull()) { - sout << "no transfer map" << std::endl; return IFSelect_RetVoid; + aSSC.SStream() << "no transfer map" << std::endl; + return 1; } - if (argc < 2) + if (theNbArgs < 2) { - sout << "Give name of a DRAW Shape + optional shape type v-e-w-f(D)-s" << std::endl; - return IFSelect_RetError; + aSSC.SStream() << "Give name of a DRAW Shape + optional shape type v-e-w-f(D)-s" << std::endl; + return 1; } - const char* a1 = (const char*)arg1; - TopoDS_Shape Shape = XSControl::Vars(pilot)->GetShape(a1); + const char* a1 = arg1; + TopoDS_Shape Shape = DBRep::Get(a1); if (Shape.IsNull()) { - sout << "Not a DRAW Shape:" << arg1 << std::endl; return IFSelect_RetError; + aSSC.SStream() << "Not a DRAW Shape:" << arg1 << std::endl; + return 1; } - sout << "Shape " << arg1 << " : "; + aSSC.SStream() << "Shape " << arg1 << " : "; Handle(TColStd_HSequenceOfTransient) list = XSControl_ConnectedShapes::AdjacentEntities(Shape, TP, TopAbs_FACE); Standard_Integer i, nb = list->Length(); - sout << nb << " Entities produced Connected Shapes :" << std::endl; - const Handle(Interface_InterfaceModel)& model = XSControl::Session(pilot)->Model(); - sout << "("; + aSSC.SStream() << nb << " Entities produced Connected Shapes :" << std::endl; + const Handle(Interface_InterfaceModel)& model = XSDRAWBase::Session()->Model(); + aSSC.SStream() << "("; for (i = 1; i <= nb; i++) { - if (i > 1) sout << ","; - sout << model->Number(list->Value(i)); - } - sout << ")" << std::endl; - return IFSelect_RetDone; -} - -//======================================================================= -//function : XSControl_trimport -//purpose : -//======================================================================= -static Standard_Integer XSControl_trimport -(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) -{ - // FileName ou . (pour courant) VarName GiveList (obligatoire) - // GiveList : * pour xst-transferrable-roots - Handle(XSControl_WorkSession) WS = XSControl::Session(pilot); - - Standard_Integer argc = pilot->NbWords(); - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - if (argc < 4) - { - sout << "Give : filename or . for current model; varname or . to take fileroot\n GiveList, * for all transferrable roots" << std::endl; - return IFSelect_RetError; - } - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); - const Standard_CString arg3 = pilot->Arg(3); - - // File Name and Variable (root) Name - - TCollection_AsciiString fnom, rnom; - Standard_Boolean modfic = XSDRAW_FunctionsShape::FileAndVar - (WS, arg1, arg2, "IMPORT", fnom, rnom); - if (modfic) sout << " File to read : " << fnom << std::endl; - else sout << " Model taken from the session : " << fnom << std::endl; - sout << " -- Names of variables BREP-DRAW prefixed by : " << rnom << std::endl; - - // keep the current command, because sub-commands will be called - TCollection_AsciiString compart = pilot->CommandPart(3); - - // Reading file if required - - if (modfic) - { - TCollection_AsciiString comload("xload "); - comload.AssignCat(arg1); - IFSelect_ReturnStatus status = pilot->Execute(comload); - if (status != IFSelect_RetDone) - { - sout << "Abandon import" << std::endl; return status; - } - } - else - { - sout << "Currently Loaded Model" << std::endl; - } - - // Selecting Entities - - Handle(TColStd_HSequenceOfTransient) list; - if (arg3[0] == '*' && arg3[1] == '\0') - { - list = WS->GiveList("xst-transferrable-roots"); - sout << "All Transferrable Roots : "; + if (i > 1) aSSC.SStream() << ","; + aSSC.SStream() << model->Number(list->Value(i)); } - else - { - sout << "List given by " << compart.ToCString() << " : "; - list = WS->GiveList(compart.ToCString()); - } - if (list.IsNull()) - { - sout << "No list defined. Abandon" << std::endl; return IFSelect_RetError; - } - Standard_Integer nbl = list->Length(); - sout << "Nb entities selected : " << nbl << std::endl; - - // Starting Transfer - - WS->InitTransferReader(0); - const Handle(XSControl_TransferReader)& TR = WS->TransferReader(); - if (TR.IsNull()) - { - sout << " init not done or failed" << std::endl; return IFSelect_RetError; - } - - TR->BeginTransfer(); - - // Transferring - Standard_Integer nbt = TR->TransferList(list); - sout << "Nb Entities Selected : " << nbl << " have given " << nbt << " results" << std::endl; - - // Filling VARS. one compound (trimpcomp) or one shape per ent (trimport) - Standard_Boolean iscomp = (pilot->Arg(0)[5] == 'c'); - Standard_Integer nbs = 0; - TopoDS_Shape sh; - TopoDS_Compound C; - BRep_Builder B; - B.MakeCompound(C); - Handle(Interface_InterfaceModel) mdl = TR->Model(); - if (mdl.IsNull()) - { - sout << " modele absent" << std::endl; return IFSelect_RetError; - } - for (Standard_Integer il = 1; il <= nbl; il++) - { - Handle(Standard_Transient) ent = list->Value(il); - sh = TR->ShapeResult(ent); - if (sh.IsNull()) continue; - nbs++; - if (iscomp) B.Add(C, sh); - else - { - char nomsh[50]; - sprintf(nomsh, "%s_%d", rnom.ToCString(), nbs); - XSControl::Vars(pilot)->SetShape(nomsh, sh); - } - } - if (nbs == 0) sout << "No Shape produced" << std::endl; - else if (nbs == 1) - { - sout << "One Shape produced, named " << rnom.ToCString() << std::endl; - XSControl::Vars(pilot)->SetShape(rnom.ToCString(), sh); - } - else if (iscomp) - { - sout << "One compound made of " << nbs << " Shapes, named " << rnom.ToCString() << std::endl; - XSControl::Vars(pilot)->SetShape(rnom.ToCString(), C); - } - else - { // several individual shapes - sout << nbs << " Shapes, named " << rnom.ToCString() << "_1 to " << rnom.ToCString() << "_" << nbs << std::endl; - } - - return IFSelect_RetDone; + aSSC.SStream() << ")" << std::endl; + return 0; } //======================================================================= //function : XSControl_twrite //purpose : //======================================================================= -static Standard_Integer XSControl_twrite -(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) +static Standard_Integer XSControl_twrite(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) { - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); + XSDRAW::StreamContainer aSSC(theDI); + (void)theDI; + const Standard_CString arg1 = theArgVec[1]; // **** twrite **** - Message_Messenger::StreamBuffer sout = Message::SendInfo(); - Handle(XSControl_TransferWriter) TW = XSControl::Session(pilot)->TransferWriter(); - if (argc < 2) + Handle(XSControl_TransferWriter) TW = XSDRAWBase::Session()->TransferWriter(); + if (theNbArgs < 2) { - sout << " donner nom de shape draw" << std::endl; return IFSelect_RetError; + aSSC.SStream() << " donner nom de shape draw" << std::endl; + return 1; } - sout << "Attention, on alimente le modele courant ..." << std::endl; + aSSC.SStream() << "Attention, on alimente le modele courant ..." << std::endl; // Shape - for (Standard_Integer i = 1; i < argc; i++) + for (Standard_Integer i = 1; i < theNbArgs; i++) { - const char* ai = (const char*)pilot->Arg(i); - TopoDS_Shape Shape = XSControl::Vars(pilot)->GetShape(ai); + const char* ai = theArgVec[i]; + TopoDS_Shape Shape = DBRep::Get(ai); if (Shape.IsNull()) { - sout << "pas un nom de shape draw:" << arg1 << std::endl; continue; + aSSC.SStream() << "pas un nom de shape draw:" << arg1 << std::endl; continue; } - sout << "Pour Shape : " << ai; - Standard_Integer stat = TW->TransferWriteShape(XSControl::Session(pilot)->Model(), Shape); - sout << " Transfer Write Status = " << stat << std::endl; + aSSC.SStream() << "Pour Shape : " << ai; + Standard_Integer stat = TW->TransferWriteShape(XSDRAWBase::Session()->Model(), Shape); + aSSC.SStream() << " Transfer Write Status = " << stat << std::endl; } - pilot->Session()->ComputeGraph(); + XSDRAWBase::Session()->ComputeGraph(); // Transient ? (Geom) : ignore - return IFSelect_RetDone; + return 0; } - //======================================================================= //function : Init //purpose : @@ -838,16 +748,14 @@ void XSDRAW_FunctionsShape::Init(Draw_Interpretor& theDI) } THE_XSDRAW_FunctionsShape_initactor = 1; - IFSelect_Act::SetGroup("DE: General"); - IFSelect_Act::AddFunc("tpdraw", "[mode:item or root] num|* [nomvar] Passes an ITEM to Shape Draw (Start or Result)", XSControl_tpdraw); - IFSelect_Act::AddFunc("tpcompound", "name:cstring [givelist] : -> compound with Shapes Root or from givelist", XSControl_tpcompound); - IFSelect_Act::AddFunc("trdraw", "results ->DRAW : all; or num [name] : from ent.num -> DRAW [name/tread_num]", XSControl_traccess); - IFSelect_Act::AddFunc("trsave", "results ->files : all; or num [name] : from ent.num -> DRAW [name/tread_num]", XSControl_traccess); - IFSelect_Act::AddFunc("trcomp", "results -> 1 compound -> DRAW + name optional", XSControl_traccess); - IFSelect_Act::AddFunc("trscomp", "results -> 1 compound -> file + name optional", XSControl_traccess); - IFSelect_Act::AddFunc("fromshape", "shape [level=1]: imported/exported entity (when known)", XSControl_fromshape); - IFSelect_Act::AddFunc("trconnexent", "name of draw shape : entities -> connected shapes (when known)", XSControl_trconnexentities); - IFSelect_Act::AddFunc("trimport", "filename or . varname givelist -> 1 shape per entity", XSControl_trimport); - IFSelect_Act::AddFunc("trimpcomp", "filename or . varname givelist -> one xcompound", XSControl_trimport); - IFSelect_Act::AddFunc("twrite", "shape : transfer write for this shape, AFTER newmodel !", XSControl_twrite); + Standard_CString aGroup = "DE: General"; + theDI.Add("tpdraw", "[mode:item or root] num|* [nomvar] Passes an ITEM to Shape Draw (Start or Result)", XSControl_tpdraw, aGroup); + theDI.Add("tpcompound", "name:cstring [givelist] : -> compound with Shapes Root or from givelist", __FILE__, XSControl_tpcompound, aGroup); + theDI.Add("trdraw", "results ->DRAW : all; or num [name] : from ent.num -> DRAW [name/tread_num]", __FILE__, XSControl_traccess, aGroup); + theDI.Add("trsave", "results ->files : all; or num [name] : from ent.num -> DRAW [name/tread_num]", __FILE__, XSControl_traccess, aGroup); + theDI.Add("trcomp", "results -> 1 compound -> DRAW + name optional", __FILE__, XSControl_traccess, aGroup); + theDI.Add("trscomp", "results -> 1 compound -> file + name optional", __FILE__, XSControl_traccess, aGroup); + theDI.Add("fromshape", "shape [level=1]: imported/exported entity (when known)", __FILE__, XSControl_fromshape, aGroup); + theDI.Add("trconnexent", "name of draw shape : entities -> connected shapes (when known)", __FILE__, XSControl_trconnexentities, aGroup); + theDI.Add("twrite", "shape : transfer write for this shape, AFTER newmodel !", __FILE__, XSControl_twrite, aGroup); } diff --git a/src/XSDRAWBase/XSDRAWBase.cxx b/src/XSDRAWBase/XSDRAWBase.cxx index e8d1f7fb73..f3be329dcb 100644 --- a/src/XSDRAWBase/XSDRAWBase.cxx +++ b/src/XSDRAWBase/XSDRAWBase.cxx @@ -13,3 +13,106 @@ #include +#include +#include +#include +#include +#include + +#include + +namespace +{ + //======================================================================= + //function : collectActiveWorkSessions + //purpose : + //======================================================================= + static void collectActiveWorkSessions(const Handle(XSControl_WorkSession)& theWS, + const TCollection_AsciiString& theName, + XSControl_WorkSessionMap& theMap, + const Standard_Boolean theIsFirst) + { + if (theIsFirst) + { + theMap.Clear(); + } + if (theMap.IsBound(theName)) + { + return; + } + theMap.Bind(theName, theWS); + for (XSControl_WorkSessionMap::Iterator anIter(theWS->ReferenceWS()); + anIter.More(); anIter.Next()) + { + collectActiveWorkSessions(anIter.Value(), anIter.Key(), theMap, Standard_False); + } + } +} + +//======================================================================= +//function : Session +//purpose : +//======================================================================= +Handle(XSControl_WorkSession)& XSDRAWBase::Session() +{ + static Handle(XSControl_WorkSession) THE_SINGLETON_SESSION; + if (THE_SINGLETON_SESSION.IsNull()) + { + THE_SINGLETON_SESSION = new XSControl_WorkSession; + } + return THE_SINGLETON_SESSION; +} + +//======================================================================= +//function : GetLengthUnit +//purpose : +//======================================================================= +Standard_Real XSDRAWBase::GetLengthUnit(const Handle(TDocStd_Document)& theDoc) +{ + if (!theDoc.IsNull()) + { + Standard_Real aUnit = 1.; + if (XCAFDoc_DocumentTool::GetLengthUnit(theDoc, aUnit, + UnitsMethods_LengthUnit_Millimeter)) + { + return aUnit; + } + } + XSAlgo::AlgoContainer()->PrepareForTransfer(); + return UnitsMethods::GetCasCadeLengthUnit(); +} + +//======================================================================= +//function : WorkSessionList +//purpose : +//======================================================================= +XSControl_WorkSessionMap& XSDRAWBase::WorkSessionList() +{ + static std::shared_ptr THE_PREVIOUS_WORK_SESSIONS; + if (THE_PREVIOUS_WORK_SESSIONS == nullptr) + { + THE_PREVIOUS_WORK_SESSIONS = + std::make_shared(); + } + return *THE_PREVIOUS_WORK_SESSIONS; +} + +//======================================================================= +//function : CollectActiveWorkSessions +//purpose : +//======================================================================= +void XSDRAWBase::CollectActiveWorkSessions(const Handle(XSControl_WorkSession)& theWS, + const TCollection_AsciiString& theName, + XSControl_WorkSessionMap& theMap) +{ + collectActiveWorkSessions(theWS, theName, theMap, Standard_True); +} + +//======================================================================= +//function : CollectActiveWorkSessions +//purpose : +//======================================================================= +void XSDRAWBase::CollectActiveWorkSessions(const TCollection_AsciiString& theName) +{ + collectActiveWorkSessions(Session(), theName, WorkSessionList(), Standard_True); +} \ No newline at end of file diff --git a/src/XSDRAWBase/XSDRAWBase.hxx b/src/XSDRAWBase/XSDRAWBase.hxx index 3b6c7d42bb..8f91a1ebb9 100644 --- a/src/XSDRAWBase/XSDRAWBase.hxx +++ b/src/XSDRAWBase/XSDRAWBase.hxx @@ -17,21 +17,10 @@ #include #include -#include -#include -#include +#include +#include -class IFSelect_SessionPilot; -class Interface_Protocol; -class Interface_InterfaceModel; -class Standard_Transient; -class TCollection_AsciiString; class TDocStd_Document; -class Transfer_TransientProcess; -class Transfer_FinderProcess; -class XSControl_Controller; -class XSControl_TransferReader; -class XSControl_WorkSession; //! Basic package to work functions of X-STEP (IFSelect & Co) //! under control of DRAW @@ -44,18 +33,9 @@ class XSDRAWBase DEFINE_STANDARD_ALLOC public: - //! Returns the WorkSession defined in AddDraw (through Pilot) + //! Returns the WorkSession defined in AddDraw //! It is from XSControl, it brings functionalities for Transfers - Standard_EXPORT static Handle(XSControl_WorkSession) Session(); - - //! Evaluates and returns a list of entity, from : - //! keyboard if and are empty, see below - //! first if second is empty : can be a number/label of an entity - //! or the name of a selection to be evaluated (standard) - //! first : name of a selection, evaluated from a list defined by - //! second - //! In case of failure, returns a Null Handle - Standard_EXPORT static Handle(TColStd_HSequenceOfTransient) GetList(const Standard_CString first = "", const Standard_CString second = ""); + Standard_EXPORT static Handle(XSControl_WorkSession)& Session(); //! Standard_EXPORT static Standard_Real GetLengthUnit(const Handle(TDocStd_Document)& theDoc = nullptr); @@ -66,8 +46,10 @@ public: //! Standard_EXPORT static void CollectActiveWorkSessions(const Handle(XSControl_WorkSession)& theWS, const TCollection_AsciiString& theName, - XSControl_WorkSessionMap& theMap, - const Standard_Boolean theIsFirst = Standard_True); + XSControl_WorkSessionMap& theMap); + + //! + Standard_EXPORT static void CollectActiveWorkSessions(const TCollection_AsciiString& theName); }; #endif // _XSDRAWBase_HeaderFile diff --git a/src/XSDRAWDEWrapper/XSDRAWDEWrapper.cxx b/src/XSDRAWDEWrapper/XSDRAWDEWrapper.cxx index 7363f0fb5e..524fe6af26 100644 --- a/src/XSDRAWDEWrapper/XSDRAWDEWrapper.cxx +++ b/src/XSDRAWDEWrapper/XSDRAWDEWrapper.cxx @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -419,3 +420,6 @@ void XSDRAWDEWrapper::Factory(Draw_Interpretor& theDI) "\n\t\t: Write CAD file to shape with registered format's providers. Use global configuration by default.", __FILE__, WriteFile, aGroup); } + +// Declare entry point PLUGINFACTORY +DPLUGIN(XSDRAWDEWrapper) diff --git a/src/XSDRAWGLTF/XSDRAWGLTF.cxx b/src/XSDRAWGLTF/XSDRAWGLTF.cxx index c0b582963a..f7b7c1bb20 100644 --- a/src/XSDRAWGLTF/XSDRAWGLTF.cxx +++ b/src/XSDRAWGLTF/XSDRAWGLTF.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -485,6 +486,12 @@ static Standard_Integer WriteGltf(Draw_Interpretor& theDI, //======================================================================= void XSDRAWGLTF::Factory(Draw_Interpretor& theDI) { + static Standard_Boolean initactor = Standard_False; + if (initactor) + { + return; + } + initactor = Standard_True; const char* aGroup = "XSTEP-STL/VRML"; // Step transfer file commands theDI.Add("ReadGltf", @@ -540,3 +547,7 @@ void XSDRAWGLTF::Factory(Draw_Interpretor& theDI) "writegltf shape file", __FILE__, WriteGltf, aGroup); } + + +// Declare entry point PLUGINFACTORY +DPLUGIN(XSDRAWGLTF) diff --git a/src/XSDRAWIGES/XSDRAWIGES.cxx b/src/XSDRAWIGES/XSDRAWIGES.cxx index 85e3a5486e..a69ac96898 100644 --- a/src/XSDRAWIGES/XSDRAWIGES.cxx +++ b/src/XSDRAWIGES/XSDRAWIGES.cxx @@ -13,11 +13,14 @@ #include +#include #include #include #include #include +#include #include +#include #include #include #include @@ -35,10 +38,103 @@ #include #include #include +#include #include +#include #include #include #include +#include +#include + +//======================================================================= +//function : WriteShape +//purpose : Creates a file Shape_'number' +//======================================================================= +void WriteShape(const TopoDS_Shape& shape, + const Standard_Integer number) +{ + char fname[110]; + sprintf(fname, "Shape_%d", number); + std::ofstream f(fname, std::ios::out | std::ios::binary); + std::cout << "Output file name : " << fname << std::endl; + f << "DBRep_DrawableShape\n"; + + BRepTools::Write(shape, f); + f.close(); +} + +//======================================================================= +//function : XSDRAW_CommandPart +//purpose : +//======================================================================= +TCollection_AsciiString XSDRAW_CommandPart(Standard_Integer argc, + const char** argv, + const Standard_Integer argf) +{ + TCollection_AsciiString res; + for (Standard_Integer i = argf; i < argc; i++) + { + if (i > argf) res.AssignCat(" "); + res.AssignCat(argv[i]); + } + return res; +} + +//======================================================================= +//function : GiveEntityNumber +//purpose : +//======================================================================= +static Standard_Integer GiveEntityNumber(const Handle(XSControl_WorkSession)& WS, + const Standard_CString name) +{ + Standard_Integer num = 0; + if (!name || name[0] == '\0') + { + char ligne[80]; ligne[0] = '\0'; + std::cin >> ligne; + // std::cin.clear(); std::cin.getline (ligne,79); + if (ligne[0] == '\0') return 0; + num = WS->NumberFromLabel(ligne); + } + else num = WS->NumberFromLabel(name); + return num; +} + +//======================================================================= +//function : FileAndVar +//purpose : +//======================================================================= +Standard_Boolean FileAndVar(const Handle(XSControl_WorkSession)& session, + const Standard_CString file, + const Standard_CString var, + const Standard_CString def, + TCollection_AsciiString& resfile, + TCollection_AsciiString& resvar) +{ + Standard_Boolean iafic = Standard_True; + resfile.Clear(); resvar.Clear(); + if (file) + if (file[0] == '\0' || + (file[0] == '.' && file[1] == '\0')) iafic = Standard_False; + if (!iafic) resfile.AssignCat(session->LoadedFile()); + else resfile.AssignCat(file); + + if (var && var[0] != '\0' && (var[0] != '.' || var[1] != '\0')) + resvar.AssignCat(var); + else if (resfile.Length() == 0) resvar.AssignCat(def); + else + { + Standard_Integer nomdeb, nomfin; + nomdeb = resfile.SearchFromEnd("/"); + if (nomdeb <= 0) nomdeb = resfile.SearchFromEnd("\\"); // pour NT + if (nomdeb < 0) nomdeb = 0; + nomfin = resfile.SearchFromEnd("."); + if (nomfin < nomdeb) nomfin = resfile.Length() + 1; + resvar = resfile.SubString(nomdeb + 1, nomfin - 1); + } + return iafic; +} //======================================================================= //function : igesbrep @@ -48,8 +144,13 @@ static Standard_Integer igesbrep(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - DeclareAndCast(IGESControl_Controller, ctl, XSDRAWBase::Controller()); - if (ctl.IsNull()) XSDRAWBase::SetNorm("IGES"); + Handle(XSControl_WorkSession) aWS = XSDRAWBase::Session(); + Handle(IGESControl_Controller) aCtl = + Handle(IGESControl_Controller)::DownCast(aWS->NormAdaptor()); + if (aCtl.IsNull()) + { + aWS->SelectNorm("IGES"); + } // Progress indicator Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator(theDI, 1); @@ -58,13 +159,11 @@ static Standard_Integer igesbrep(Draw_Interpretor& theDI, IGESControl_Reader Reader(XSDRAWBase::Session(), Standard_False); Standard_Boolean aFullMode = Standard_True; Reader.WS()->SetModeStat(aFullMode); - if (ctl.IsNull()) - ctl = Handle(IGESControl_Controller)::DownCast(XSDRAWBase::Controller()); TCollection_AsciiString fnom, rnom; - Standard_Boolean modfic = XSDRAWBase::FileAndVar - (theArgVec[1], theArgVec[2], "IGESBREP", fnom, rnom); + Standard_Boolean modfic = FileAndVar + (aWS, theArgVec[1], theArgVec[2], "IGESBREP", fnom, rnom); if (modfic) theDI << " File IGES to read : " << fnom.ToCString() << "\n"; else theDI << " Model taken from the session : " << fnom.ToCString() << "\n"; theDI << " -- Names of variables BREP-DRAW prefixed by : " << rnom.ToCString() << "\n"; @@ -75,7 +174,6 @@ static Standard_Integer igesbrep(Draw_Interpretor& theDI, IDT_SetLevel(3); #endif - // Reading the file aPSRoot.SetName("Loading"); progress->Show(aPSRoot); @@ -127,7 +225,6 @@ static Standard_Integer igesbrep(Draw_Interpretor& theDI, theDI << " To modify : command param read.iges.bspline.continuity\n"; const Handle(XSControl_WorkSession)& thesession = Reader.WS(); thesession->TransferReader()->Context().Clear(); - XSDRAWBase::SetTransferProcess(thesession->TransferReader()->TransientProcess()); aPSRoot.SetName("Translation"); progress->Show(aPSRoot); @@ -210,7 +307,7 @@ static Standard_Integer igesbrep(Draw_Interpretor& theDI, std::cout << "spline_continuity (read) : " << Interface_Static::IVal("read.iges.bspline.continuity") << " (0 : no modif, 1 : C1, 2 : C2)" << std::endl; std::cout << " To modify : command param read.iges.bspline.continuity" << std::endl; std::cout << " give the number of the Entity : " << std::flush; - nent = XSDRAWBase::GetEntityNumber(); + nent = GiveEntityNumber(aWS, ""); if (!Reader.TransferOne(nent)) theDI << "Transfer entity n0 " << nent << " : no result\n"; @@ -241,7 +338,6 @@ static Standard_Integer igesbrep(Draw_Interpretor& theDI, theDI << " To modify : command param read.iges.bspline.continuity\n"; const Handle(XSControl_WorkSession)& thesession = Reader.WS(); thesession->TransferReader()->Context().Clear(); - XSDRAWBase::SetTransferProcess(thesession->TransferReader()->TransientProcess()); aPSRoot.SetName("Translation"); progress->Show(aPSRoot); @@ -280,13 +376,13 @@ static Standard_Integer igesbrep(Draw_Interpretor& theDI, if (theArgVec[3][0] == '*' && theArgVec[3][1] == 'r' && theArgVec[3][2] == '\0') { theDI << "All Roots : "; - list = XSDRAWBase::GetList("xst-model-roots"); + list = XSDRAWBase::Session()->GiveList("xst-model-roots"); } else { TCollection_AsciiString compart = XSDRAW_CommandPart(theNbArgs, theArgVec, 3); theDI << "List given by " << compart.ToCString() << " : "; - list = XSDRAWBase::GetList(compart.ToCString()); + list = XSDRAWBase::Session()->GiveList(compart.ToCString()); } if (list.IsNull()) { @@ -297,7 +393,7 @@ static Standard_Integer igesbrep(Draw_Interpretor& theDI, else { std::cout << "Name of Selection :" << std::flush; - list = XSDRAWBase::GetList(); + list = XSDRAWBase::Session()->GiveList(""); if (list.IsNull()) { std::cout << "No list defined" << std::endl; continue; } } @@ -330,7 +426,6 @@ static Standard_Integer igesbrep(Draw_Interpretor& theDI, Standard_Integer nbt = 0; Handle(XSControl_WorkSession) thesession = Reader.WS(); - XSDRAWBase::SetTransferProcess(thesession->TransferReader()->TransientProcess()); aPSRoot.SetName("Translation"); progress->Show(aPSRoot); @@ -364,38 +459,38 @@ static Standard_Integer igesbrep(Draw_Interpretor& theDI, return 0; } -////======================================================================= -////function : testread -////purpose : -////======================================================================= -//static Standard_Integer testread(Draw_Interpretor& theDI, -// Standard_Integer theNbArgs, -// const char** theArgVec) -//{ -// if (theNbArgs != 3) -// { -// theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n"; -// theDI << " Usage : " << theArgVec[0] << " file_name shape_name\n"; -// return 1; -// } -// IGESControl_Reader Reader; -// Standard_CString filename = theArgVec[1]; -// IFSelect_ReturnStatus readstat = Reader.ReadFile(filename); -// theDI << "Status from reading IGES file " << filename << " : "; -// switch (readstat) -// { -// case IFSelect_RetVoid: { theDI << "empty file\n"; return 1; } -// case IFSelect_RetDone: { theDI << "file read\n"; break; } -// case IFSelect_RetError: { theDI << "file not found\n"; return 1; } -// case IFSelect_RetFail: { theDI << "error during read\n"; return 1; } -// default: { theDI << "failure\n"; return 1; } -// } -// Reader.TransferRoots(); -// TopoDS_Shape shape = Reader.OneShape(); -// DBRep::Set(theArgVec[2], shape); -// theDI << "Count of shapes produced : " << Reader.NbShapes() << "\n"; -// return 0; -//} +//======================================================================= +//function : testread +//purpose : +//======================================================================= +static Standard_Integer testread(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) +{ + if (theNbArgs != 3) + { + theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n"; + theDI << " Usage : " << theArgVec[0] << " file_name shape_name\n"; + return 1; + } + IGESControl_Reader Reader; + Standard_CString filename = theArgVec[1]; + IFSelect_ReturnStatus readstat = Reader.ReadFile(filename); + theDI << "Status from reading IGES file " << filename << " : "; + switch (readstat) + { + case IFSelect_RetVoid: { theDI << "empty file\n"; return 1; } + case IFSelect_RetDone: { theDI << "file read\n"; break; } + case IFSelect_RetError: { theDI << "file not found\n"; return 1; } + case IFSelect_RetFail: { theDI << "error during read\n"; return 1; } + default: { theDI << "failure\n"; return 1; } + } + Reader.TransferRoots(); + TopoDS_Shape shape = Reader.OneShape(); + DBRep::Set(theArgVec[2], shape); + theDI << "Count of shapes produced : " << Reader.NbShapes() << "\n"; + return 0; +} //======================================================================= //function : brepiges @@ -405,7 +500,8 @@ static Standard_Integer brepiges(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - XSDRAWBase::SetNorm("IGES"); + Handle(XSControl_WorkSession) aWS = XSDRAWBase::Session(); + aWS->SelectNorm("IGES"); // ecriture dans le model d'une entite : // - model_AddEntity(ent) : ecriture de l`entite seule // - model->AddWithRefs(ent, protocol): ecriture de l`entite et eventuellement @@ -427,7 +523,7 @@ static Standard_Integer brepiges(Draw_Interpretor& theDI, Message_ProgressScope aPSRoot(progress->Start(), "Translating", 100); progress->Show(aPSRoot); - Message_ProgressScope aPS(aPSRoot.Next(90), NULL, n); + Message_ProgressScope aPS(aPSRoot.Next(90), NULL, theNbArgs); for (Standard_Integer i = 1; i < theNbArgs && aPS.More(); i++) { const char* nomvar = theArgVec[i]; @@ -439,15 +535,13 @@ static Standard_Integer brepiges(Draw_Interpretor& theDI, else if (ICW.AddGeom(DrawTrSurf::GetSurface(nomvar))) npris++; } ICW.ComputeModel(); - XSDRAWBase::SetModel(ICW.Model()); - XSDRAWBase::SetTransferProcess(ICW.TransferProcess()); if (aPSRoot.UserBreak()) return 1; aPSRoot.SetName("Writing"); progress->Show(aPSRoot); - theDI << npris << " Shapes written, giving " << XSDRAWBase::Model()->NbEntities() << " Entities\n"; + theDI << npris << " Shapes written, giving " << ICW.Model()->NbEntities() << " Entities\n"; if (!nomfic) // delayed write { @@ -456,62 +550,67 @@ static Standard_Integer brepiges(Draw_Interpretor& theDI, } // write file - if (!ICW.Write(nomfic)) theDI << " Error: could not write file " << nomfic; - else theDI << " File " << nomfic << " written"; + if (!ICW.Write(nomfic)) + { + theDI << " Error: could not write file " << nomfic << "\n"; + return 1; + } + theDI << " File " << nomfic << " written\n"; + aWS->SetModel(ICW.Model()); return 0; } -////======================================================================= -////function : testwrite -////purpose : -////======================================================================= -//static Standard_Integer testwrite(Draw_Interpretor& theDI, -// Standard_Integer theNbArgs, -// const char** theArgVec) -//{ -// if (theNbArgs != 3) -// { -// theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n"; -// theDI << " Usage : " << theArgVec[0] << " file_name shape_name\n"; -// return 1; -// } -// IGESControl_Writer Writer; -// Standard_CString filename = theArgVec[1]; -// TopoDS_Shape shape = DBRep::Get(theArgVec[2]); -// Standard_Boolean ok = Writer.AddShape(shape); -// if (!ok) -// { -// theDI << "Shape not add\n"; -// return 1; -// } -// -// if (!(Writer.Write(filename))) -// { -// theDI << "Error on writing file\n"; -// return 1; -// } -// theDI << "File Is Written\n"; -// return 0; -//} - -////======================================================================= -////function : igesparam -////purpose : -////======================================================================= -//static Standard_Integer igesparam(Draw_Interpretor& theDI, -// Standard_Integer, -// const char**) -//{ -// // liste des parametres -// theDI << "List of parameters which control IGES :\n"; -// theDI << " unit : write.iges.unit\n mode write : write.iges.brep.mode\n spline_continuity (read) : read.iges.bspline.continuity\nSee definition by defparam, read/edit value by param\n"; -// theDI << "unit (write) : " << Interface_Static::CVal("write.iges.unit") << "\n"; -// theDI << "mode write : " << Interface_Static::CVal("write.iges.brep.mode") << "\n"; -// theDI << "spline_continuity (read) : " << Interface_Static::IVal("read.iges.bspline.continuity") << " (0 : no modif, 1 : C1, 2 : C2)\n"; -// theDI << "\n To modifier, param nom_param new_val\n"; -// return 0; -//} +//======================================================================= +//function : testwrite +//purpose : +//======================================================================= +static Standard_Integer testwrite(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) +{ + if (theNbArgs != 3) + { + theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n"; + theDI << " Usage : " << theArgVec[0] << " file_name shape_name\n"; + return 1; + } + IGESControl_Writer Writer; + Standard_CString filename = theArgVec[1]; + TopoDS_Shape shape = DBRep::Get(theArgVec[2]); + Standard_Boolean ok = Writer.AddShape(shape); + if (!ok) + { + theDI << "Shape not add\n"; + return 1; + } + + if (!(Writer.Write(filename))) + { + theDI << "Error on writing file\n"; + return 1; + } + theDI << "File Is Written\n"; + return 0; +} + +//======================================================================= +//function : igesparam +//purpose : +//======================================================================= +static Standard_Integer igesparam(Draw_Interpretor& theDI, + Standard_Integer, + const char**) +{ + // liste des parametres + theDI << "List of parameters which control IGES :\n"; + theDI << " unit : write.iges.unit\n mode write : write.iges.brep.mode\n spline_continuity (read) : read.iges.bspline.continuity\nSee definition by defparam, read/edit value by param\n"; + theDI << "unit (write) : " << Interface_Static::CVal("write.iges.unit") << "\n"; + theDI << "mode write : " << Interface_Static::CVal("write.iges.brep.mode") << "\n"; + theDI << "spline_continuity (read) : " << Interface_Static::IVal("read.iges.bspline.continuity") << " (0 : no modif, 1 : C1, 2 : C2)\n"; + theDI << "\n To modifier, param nom_param new_val\n"; + return 0; +} //======================================================================= //function : XSDRAWIGES_tplosttrim @@ -521,12 +620,8 @@ static Standard_Integer XSDRAWIGES_tplosttrim(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - Handle(IFSelect_SessionPilot) pilot = XSDRAWBase::Pilot(); - - // Standard_Integer narg = pilot->NbWords(); - Standard_Integer narg = theNbArgs; - - const Handle(Transfer_TransientProcess)& TP = XSControl::Session(pilot)->TransferReader()->TransientProcess(); + Handle(XSControl_WorkSession) aWS = XSDRAWBase::Session(); + const Handle(Transfer_TransientProcess)& TP = aWS->TransferReader()->TransientProcess(); TColStd_Array1OfAsciiString strarg(1, 3); TColStd_Array1OfAsciiString typarg(1, 3); strarg.SetValue(1, "xst-type(CurveOnSurface)"); @@ -537,10 +632,9 @@ static Standard_Integer XSDRAWIGES_tplosttrim(Draw_Interpretor& theDI, typarg.SetValue(3, "IGESSolid_Face"); if (TP.IsNull()) { theDI << "No Transfer Read\n"; return 1; } Standard_Integer nbFaces = 0, totFaces = 0; - Handle(IFSelect_WorkSession) WS = pilot->Session(); Transfer_IteratorOfProcessForTransient itrp = TP->AbnormalResult(); Standard_Integer k = 0; - if (narg > 1) + if (theNbArgs > 1) { // TCollection_AsciiString Arg = pilot->Word(1); TCollection_AsciiString Arg(theArgVec[1]); @@ -553,8 +647,8 @@ static Standard_Integer XSDRAWIGES_tplosttrim(Draw_Interpretor& theDI, for (Standard_Integer j = 1; j <= 3; j++) { TColStd_MapOfTransient aMap; - if (narg == 1) k = j; - Handle(TColStd_HSequenceOfTransient) list = IFSelect_Functions::GiveList(pilot->Session(), strarg.Value(k).ToCString()); + if (theNbArgs == 1) k = j; + Handle(TColStd_HSequenceOfTransient) list = aWS->GiveList(strarg.Value(k).ToCString()); if (!list.IsNull()) itrp.Filter(list); else { @@ -564,7 +658,7 @@ static Standard_Integer XSDRAWIGES_tplosttrim(Draw_Interpretor& theDI, for (itrp.Start(); itrp.More(); itrp.Next()) { Handle(Standard_Transient) ent = itrp.Starting(); - Handle(TColStd_HSequenceOfTransient) super = WS->Sharings(ent); + Handle(TColStd_HSequenceOfTransient) super = aWS->Sharings(ent); if (!super.IsNull()) { Standard_Integer nb = super->Length(); @@ -595,7 +689,7 @@ static Standard_Integer XSDRAWIGES_tplosttrim(Draw_Interpretor& theDI, Standard_SStream aTmpStream; for (itmap.Initialize(aMap); itmap.More(); itmap.Next()) { - XSDRAWBase::Model()->Print(itmap.Key(), aTmpStream); + aWS->Model()->Print(itmap.Key(), aTmpStream); aTmpStream << " "; } theDI << aTmpStream.str().c_str(); @@ -603,7 +697,7 @@ static Standard_Integer XSDRAWIGES_tplosttrim(Draw_Interpretor& theDI, theDI << "\nNumber:" << nbFaces << "\n"; totFaces += nbFaces; } - if (narg > 1) break; + if (theNbArgs > 1) break; nbFaces = 0; } @@ -612,73 +706,71 @@ static Standard_Integer XSDRAWIGES_tplosttrim(Draw_Interpretor& theDI, return 0; } -////======================================================================= -////function : XSDRAWIGES_TPSTAT -////purpose : -////======================================================================= -//static Standard_Integer XSDRAWIGES_TPSTAT(Draw_Interpretor& theDI, -// Standard_Integer theNbArgs, -// const char** theArgVec) -//{ -// Handle(IFSelect_SessionPilot) pilot = XSDRAWBase::Pilot(); -// Standard_Integer theNbArgs = theNbArgs;//= pilot->NbWords(); -// const Standard_CString arg1 = theArgVec[1];//pilot->Arg(1); -// const Handle(Transfer_TransientProcess)& TP = XSControl::Session(pilot)->TransferReader()->TransientProcess(); -// IGESControl_Reader read; //(XSControl::Session(pilot),Standard_False); -//// **** tpent **** -// Handle(Interface_InterfaceModel) model = TP->Model(); -// if (model.IsNull()) { theDI << "No Transfer Read\n"; return -1; } -// Handle(XSControl_WorkSession) thesession = read.WS(); -// thesession->SetMapReader(TP); -// Standard_Integer mod1 = 0; -// if (theNbArgs > 1) -// { -// char a2 = arg1[1]; if (a2 == '\0') a2 = '!'; -// switch (arg1[0]) -// { -// case 'g': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_GeneralInfo); break; -// case 'c': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_CountByItem); break; -// case 'C': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_ListByItem); break; -// case 'r': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_ResultCount); break; -// case 's': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_Mapping); break; -// case '?': mod1 = -1; break; -// default: mod1 = -2; break; -// } -// } -// if (mod1 < -1) theDI << "Unknown Mode\n"; -// if (mod1 < 0) -// { -// theDI << "Modes available :\n" -// << "g : general c : checks (count) C (list)\n" -// << "r : number of CasCade resulting shapes\n" -// << "s : mapping between IGES entities and CasCade shapes\n"; -// if (mod1 < -1) return -1; -// return 0; -// } -// return 0; -//} - -////======================================================================= -////function : etest -////purpose : -////======================================================================= -//static Standard_Integer etest(Draw_Interpretor& theDI, -// Standard_Integer theNbArgs, -// const char** theArgVec) -//{ -// if (theNbArgs < 3) -// { -// theDI << "etest igesfile shape\n"; -// return 0; -// } -// IGESControl_Reader aReader; -// aReader.ReadFile(theArgVec[1]); -// aReader.SetReadVisible(Standard_True); -// aReader.TransferRoots(); -// TopoDS_Shape shape = aReader.OneShape(); -// DBRep::Set(theArgVec[2], shape); -// return 0; -//} +//======================================================================= +//function : XSDRAWIGES_TPSTAT +//purpose : +//======================================================================= +static Standard_Integer XSDRAWIGES_TPSTAT(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) +{ + Handle(XSControl_WorkSession) aWS = XSDRAWBase::Session(); + const Standard_CString arg1 = theArgVec[1]; + const Handle(Transfer_TransientProcess)& TP = aWS->TransferReader()->TransientProcess(); + IGESControl_Reader read; + Handle(Interface_InterfaceModel) model = TP->Model(); + if (model.IsNull()) { theDI << "No Transfer Read\n"; return -1; } + Handle(XSControl_WorkSession) thesession = read.WS(); + thesession->SetMapReader(TP); + Standard_Integer mod1 = 0; + if (theNbArgs > 1) + { + char a2 = arg1[1]; if (a2 == '\0') a2 = '!'; + switch (arg1[0]) + { + case 'g': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_GeneralInfo); break; + case 'c': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_CountByItem); break; + case 'C': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_ListByItem); break; + case 'r': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_ResultCount); break; + case 's': read.PrintTransferInfo(IFSelect_FailAndWarn, IFSelect_Mapping); break; + case '?': mod1 = -1; break; + default: mod1 = -2; break; + } + } + if (mod1 < -1) theDI << "Unknown Mode\n"; + if (mod1 < 0) + { + theDI << "Modes available :\n" + << "g : general c : checks (count) C (list)\n" + << "r : number of CasCade resulting shapes\n" + << "s : mapping between IGES entities and CasCade shapes\n"; + if (mod1 < -1) return -1; + return 0; + } + return 0; +} + +//======================================================================= +//function : etest +//purpose : +//======================================================================= +static Standard_Integer etest(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) +{ + if (theNbArgs < 3) + { + theDI << "etest igesfile shape\n"; + return 0; + } + IGESControl_Reader aReader; + aReader.ReadFile(theArgVec[1]); + aReader.SetReadVisible(Standard_True); + aReader.TransferRoots(); + TopoDS_Shape shape = aReader.OneShape(); + DBRep::Set(theArgVec[2], shape); + return 0; +} //======================================================================= //function : ReadIges @@ -787,27 +879,36 @@ static Standard_Integer WriteIges(Draw_Interpretor& theDI, return 0; } - //======================================================================= //function : InitToBRep //purpose : //======================================================================= void XSDRAWIGES::Factory(Draw_Interpretor& theDI) { + static Standard_Boolean initactor = Standard_False; + if (initactor) + { + return; + } + IGESControl_Controller::Init(); + + initactor = Standard_True; const char* aGroup = "DE: IGES"; theDI.Add("tplosttrim", "number of untrimmed faces during last transfer", __FILE__, XSDRAWIGES_tplosttrim, aGroup); - //theDI.Add("igesbrep", "igesbrep [file else already loaded model] [name DRAW]", __FILE__, igesbrep, aGroup); - //theDI.Add("testreadiges", "testreadiges [file else already loaded model] [name DRAW]", __FILE__, testread, aGroup); - //theDI.Add("igesparam", "igesparam ->list, + name ->one param, + name val->change", __FILE__, igesparam, aGroup); - //theDI.Add("TPSTAT", " ", __FILE__, XSDRAWIGES_TPSTAT, aGroup); - //theDI.Add("etest", "test of eviewer", __FILE__, etest, aGroup); + theDI.Add("igesbrep", "igesbrep [file else already loaded model] [name DRAW]", __FILE__, igesbrep, aGroup); + theDI.Add("testreadiges", "testreadiges [file else already loaded model] [name DRAW]", __FILE__, testread, aGroup); + theDI.Add("igesparam", "igesparam ->list, + name ->one param, + name val->change", __FILE__, igesparam, aGroup); + theDI.Add("TPSTAT", " ", __FILE__, XSDRAWIGES_TPSTAT, aGroup); + theDI.Add("etest", "test of eviewer", __FILE__, etest, aGroup); theDI.Add("ReadIges", "Doc filename: Read IGES file to DECAF document", __FILE__, ReadIges, aGroup); theDI.Add("WriteIges", "Doc filename: Write DECAF document to IGES file", __FILE__, WriteIges, aGroup); theDI.Add("igesread", "igesread [file else already loaded model] [name DRAW]", __FILE__, igesbrep, aGroup); theDI.Add("igeswrite", "igesread [file else already loaded model] [name DRAW]", __FILE__, brepiges, aGroup); - //theDI.Add("brepiges", "brepiges sh1 [+sh2 [+sh3 ..]] filename.igs", __FILE__, brepiges, aGroup); - //theDI.Add("testwriteiges", "testwriteiges filename.igs shape", __FILE__, testwrite, aGroup); + theDI.Add("brepiges", "brepiges sh1 [+sh2 [+sh3 ..]] filename.igs", __FILE__, brepiges, aGroup); + theDI.Add("testwriteiges", "testwriteiges filename.igs shape", __FILE__, testwrite, aGroup); } +// Declare entry point PLUGINFACTORY +DPLUGIN(XSDRAWIGES) \ No newline at end of file diff --git a/src/XSDRAWOBJ/XSDRAWOBJ.cxx b/src/XSDRAWOBJ/XSDRAWOBJ.cxx index 8bb0f16027..c7b3ec9a33 100644 --- a/src/XSDRAWOBJ/XSDRAWOBJ.cxx +++ b/src/XSDRAWOBJ/XSDRAWOBJ.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -327,6 +328,12 @@ static Standard_Integer WriteObj(Draw_Interpretor& theDI, //======================================================================= void XSDRAWOBJ::Factory(Draw_Interpretor& theDI) { + static Standard_Boolean initactor = Standard_False; + if (initactor) + { + return; + } + initactor = Standard_True; const char* g = "XSTEP-STL/VRML"; // Step transfer file commands theDI.Add("ReadObj", "ReadObj Doc file [-fileCoordSys {Zup|Yup}] [-fileUnit Unit]" @@ -360,3 +367,6 @@ void XSDRAWOBJ::Factory(Draw_Interpretor& theDI) "writeobj shape file", __FILE__, WriteObj, g); } + +// Declare entry point PLUGINFACTORY +DPLUGIN(XSDRAWOBJ) diff --git a/src/XSDRAWPLY/XSDRAWPLY.cxx b/src/XSDRAWPLY/XSDRAWPLY.cxx index 762f937102..f32b43685f 100644 --- a/src/XSDRAWPLY/XSDRAWPLY.cxx +++ b/src/XSDRAWPLY/XSDRAWPLY.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -326,6 +327,12 @@ static Standard_Integer WritePly(Draw_Interpretor& theDI, //======================================================================= void XSDRAWPLY::Factory(Draw_Interpretor& theDI) { + static Standard_Boolean initactor = Standard_False; + if (initactor) + { + return; + } + initactor = Standard_True; const char* g = "XSTEP-STL/VRML"; // Step transfer file commands //XSDRAW::LoadDraw(theCommands); theDI.Add("WritePly", R"( @@ -348,3 +355,6 @@ Generate point cloud out of the shape and write it into PLY file. "writeply shape file", __FILE__, WritePly, g); } + +// Declare entry point PLUGINFACTORY +DPLUGIN(XSDRAWPLY) diff --git a/src/XSDRAWSTEP/XSDRAWSTEP.cxx b/src/XSDRAWSTEP/XSDRAWSTEP.cxx index 3daa2fdb2c..f109b02e04 100644 --- a/src/XSDRAWSTEP/XSDRAWSTEP.cxx +++ b/src/XSDRAWSTEP/XSDRAWSTEP.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -46,6 +47,64 @@ #include #include +namespace +{ + //======================================================================= + //function : GiveEntityNumber + //purpose : + //======================================================================= + static Standard_Integer GiveEntityNumber(const Handle(XSControl_WorkSession)& WS, + const Standard_CString name) + { + Standard_Integer num = 0; + if (!name || name[0] == '\0') + { + char ligne[80]; ligne[0] = '\0'; + std::cin >> ligne; + // std::cin.clear(); std::cin.getline (ligne,79); + if (ligne[0] == '\0') return 0; + num = WS->NumberFromLabel(ligne); + } + else num = WS->NumberFromLabel(name); + return num; + } + + //======================================================================= + //function : FileAndVar + //purpose : + //======================================================================= + Standard_Boolean FileAndVar(const Handle(XSControl_WorkSession)& session, + const Standard_CString file, + const Standard_CString var, + const Standard_CString def, + TCollection_AsciiString& resfile, + TCollection_AsciiString& resvar) + { + Standard_Boolean iafic = Standard_True; + resfile.Clear(); resvar.Clear(); + if (file) + if (file[0] == '\0' || + (file[0] == '.' && file[1] == '\0')) iafic = Standard_False; + if (!iafic) resfile.AssignCat(session->LoadedFile()); + else resfile.AssignCat(file); + + if (var && var[0] != '\0' && (var[0] != '.' || var[1] != '\0')) + resvar.AssignCat(var); + else if (resfile.Length() == 0) resvar.AssignCat(def); + else + { + Standard_Integer nomdeb, nomfin; + nomdeb = resfile.SearchFromEnd("/"); + if (nomdeb <= 0) nomdeb = resfile.SearchFromEnd("\\"); // pour NT + if (nomdeb < 0) nomdeb = 0; + nomfin = resfile.SearchFromEnd("."); + if (nomfin < nomdeb) nomfin = resfile.Length() + 1; + resvar = resfile.SubString(nomdeb + 1, nomfin - 1); + } + return iafic; + } +} + //======================================================================= //function : stepread //purpose : @@ -66,8 +125,8 @@ static Standard_Integer stepread(Draw_Interpretor& theDI, STEPControl_Reader sr(XSDRAWBase::Session(), Standard_False); TCollection_AsciiString fnom, rnom; - Standard_Boolean modfic = XSDRAWBase::FileAndVar - (theArgVec[1], theArgVec[2], "STEP", fnom, rnom); + Standard_Boolean modfic = FileAndVar + (XSDRAWBase::Session(), theArgVec[1], theArgVec[2], "STEP", fnom, rnom); if (modfic) theDI << " File STEP to read : " << fnom.ToCString() << "\n"; else theDI << " Model taken from the session : " << fnom.ToCString() << "\n"; theDI << " -- Names of variables BREP-DRAW prefixed by : " << rnom.ToCString() << "\n"; @@ -103,7 +162,6 @@ static Standard_Integer stepread(Draw_Interpretor& theDI, sr.WS()->SetModeStat(aFullMode); - if (modfic) readstat = sr.ReadFile(fnom.ToCString()); else if (XSDRAWBase::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone; @@ -170,7 +228,7 @@ static Standard_Integer stepread(Draw_Interpretor& theDI, } else if (modepri == 3) { - std::cout << "Entity : " << std::flush; num = XSDRAWBase::GetEntityNumber(); + std::cout << "Entity : " << std::flush; num = GiveEntityNumber(XSDRAWBase::Session(), ""); if (!sr.TransferOne(num)) theDI << "Transfer entity n0 " << num << " : no result\n"; else @@ -196,7 +254,7 @@ static Standard_Integer stepread(Draw_Interpretor& theDI, if (theArgVec[k][0] == '*' && theArgVec[k][1] == '\0') { theDI << "Transferrable Roots : "; - list = XSDRAWBase::GetList("xst-transferrable-roots"); + list = XSDRAWBase::Session()->GiveList("xst-transferrable-roots"); //list = new TColStd_HSequenceOfTransient; //for(Standard_Integer j=1; j<=num; j++) // list->Append(sr.RootForTransfer(j)); @@ -206,14 +264,14 @@ static Standard_Integer stepread(Draw_Interpretor& theDI, theDI << "List given by " << theArgVec[k]; if (theNbArgs > k + 1) theDI << " " << theArgVec[k + 1]; theDI << " : "; - list = XSDRAWBase::GetList(theArgVec[k], (theNbArgs > (k + 1) ? theArgVec[k + 1] : 0)); + list = XSDRAWBase::Session()->GiveList(theArgVec[k], (theNbArgs > (k + 1) ? theArgVec[k + 1] : 0)); } if (list.IsNull()) { theDI << "No list defined. Give a selection name or * for all transferrable roots\n"; continue; } } else { std::cout << "Name of Selection :" << std::flush; - list = XSDRAWBase::GetList(); + list = XSDRAWBase::Session()->GiveList(""); if (list.IsNull()) { theDI << "No list defined\n"; continue; } } @@ -249,56 +307,56 @@ static Standard_Integer stepread(Draw_Interpretor& theDI, return 0; } -////======================================================================= -////function : testreadstep -////purpose : -////======================================================================= -//static Standard_Integer testreadstep(Draw_Interpretor& theDI, -// Standard_Integer theNbArgs, -// const char** theArgVec) -//{ -// if (theNbArgs < 3 || theNbArgs > 4) -// { -// theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n"; -// theDI << " Usage : " << theArgVec[0] << " file_name shape_name [-stream]\n"; -// theDI << " Option -stream forces usage of API accepting stream\n"; -// return 1; -// } -// -// Standard_Boolean useStream = (theNbArgs > 3 && !strcasecmp(theArgVec[3], "-stream")); -// -// STEPControl_Reader Reader; -// Standard_CString filename = theArgVec[1]; -// IFSelect_ReturnStatus readstat; -// if (useStream) -// { -// std::ifstream aStream; -// OSD_OpenStream(aStream, filename, std::ios::in | std::ios::binary); -// TCollection_AsciiString aFolder, aFileNameShort; -// OSD_Path::FolderAndFileFromPath(filename, aFolder, aFileNameShort); -// readstat = Reader.ReadStream(aFileNameShort.ToCString(), aStream); -// } -// else -// { -// readstat = Reader.ReadFile(filename); -// } -// theDI << "Status from reading STEP file " << filename << " : "; -// switch (readstat) -// { -// case IFSelect_RetVoid: { theDI << "empty file\n"; return 1; } -// case IFSelect_RetDone: { theDI << "file read\n"; break; } -// case IFSelect_RetError: { theDI << "file not found\n"; return 1; } -// case IFSelect_RetFail: { theDI << "error during read\n"; return 1; } -// default: { theDI << "failure\n"; return 1; } -// } -// XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info -// Reader.SetSystemLengthUnit(UnitsMethods::GetCasCadeLengthUnit()); -// Reader.TransferRoots(); -// TopoDS_Shape shape = Reader.OneShape(); -// DBRep::Set(theArgVec[2], shape); -// theDI << "Count of shapes produced : " << Reader.NbShapes() << "\n"; -// return 0; -//} +//======================================================================= +//function : testreadstep +//purpose : +//======================================================================= +static Standard_Integer testreadstep(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) +{ + if (theNbArgs < 3 || theNbArgs > 4) + { + theDI << "ERROR in " << theArgVec[0] << "Wrong Number of Arguments.\n"; + theDI << " Usage : " << theArgVec[0] << " file_name shape_name [-stream]\n"; + theDI << " Option -stream forces usage of API accepting stream\n"; + return 1; + } + + Standard_Boolean useStream = (theNbArgs > 3 && !strcasecmp(theArgVec[3], "-stream")); + + STEPControl_Reader Reader; + Standard_CString filename = theArgVec[1]; + IFSelect_ReturnStatus readstat; + if (useStream) + { + std::ifstream aStream; + OSD_OpenStream(aStream, filename, std::ios::in | std::ios::binary); + TCollection_AsciiString aFolder, aFileNameShort; + OSD_Path::FolderAndFileFromPath(filename, aFolder, aFileNameShort); + readstat = Reader.ReadStream(aFileNameShort.ToCString(), aStream); + } + else + { + readstat = Reader.ReadFile(filename); + } + theDI << "Status from reading STEP file " << filename << " : "; + switch (readstat) + { + case IFSelect_RetVoid: { theDI << "empty file\n"; return 1; } + case IFSelect_RetDone: { theDI << "file read\n"; break; } + case IFSelect_RetError: { theDI << "file not found\n"; return 1; } + case IFSelect_RetFail: { theDI << "error during read\n"; return 1; } + default: { theDI << "failure\n"; return 1; } + } + XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info + Reader.SetSystemLengthUnit(UnitsMethods::GetCasCadeLengthUnit()); + Reader.TransferRoots(); + TopoDS_Shape shape = Reader.OneShape(); + DBRep::Set(theArgVec[2], shape); + theDI << "Count of shapes produced : " << Reader.NbShapes() << "\n"; + return 0; +} //======================================================================= //function : steptrans @@ -313,6 +371,7 @@ static Standard_Integer steptrans(Draw_Interpretor& theDI, theDI << "give shape-name new-shape + entity-n0 entity-n0: AXIS2\n"; return 1; } + Handle(XSControl_WorkSession) aWS = XSDRAWBase::Session(); TopoDS_Shape shape = DBRep::Get(theArgVec[1]); if (shape.IsNull()) { @@ -321,12 +380,12 @@ static Standard_Integer steptrans(Draw_Interpretor& theDI, } Handle(StepGeom_Axis2Placement3d) ax1, ax2; Standard_Integer n1 = 0, n2 = 0; - n1 = XSDRAWBase::GetEntityNumber(theArgVec[3]); - if (theNbArgs > 4) n2 = XSDRAWBase::GetEntityNumber(theArgVec[4]); + n1 = GiveEntityNumber(aWS, theArgVec[3]); + if (theNbArgs > 4) n2 = GiveEntityNumber(aWS, theArgVec[4]); if (n1 > 0) ax1 = Handle(StepGeom_Axis2Placement3d)::DownCast - (XSDRAWBase::Entity(n1)); + (aWS->StartingEntity(n1)); if (n2 > 0) ax2 = Handle(StepGeom_Axis2Placement3d)::DownCast - (XSDRAWBase::Entity(n2)); + (aWS->StartingEntity(n2)); StepToTopoDS_MakeTransformed mktrans; if (mktrans.Compute(ax1, ax2)) { @@ -341,26 +400,30 @@ static Standard_Integer steptrans(Draw_Interpretor& theDI, return 0; } -// ######## COMMANDE stepwrite : teste le Writer ######### - //======================================================================= //function : stepwrite -//purpose : +//purpose : //======================================================================= static Standard_Integer stepwrite(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { + Handle(XSControl_WorkSession) aWS = XSDRAWBase::Session(); + Handle(STEPControl_Controller) aCtl = + Handle(STEPControl_Controller)::DownCast(aWS->NormAdaptor()); + if (aCtl.IsNull()) + { + aWS->SelectNorm("STEP"); + } if (theNbArgs < 3) { - theDI << "Give mode[1-4] and Shape name + optional file. Mode possible\n"; + theDI << "Error: Give mode[1-4] and Shape name + optional file. Mode possible\n"; theDI << "f ou 1 : FacettedBRep s ou 2 : ShellBasedSurfaceModel\n" << "m ou 3 : ManifoldSolidBrep w ou 4 : GeometricCurveSet/WireFrame\n"; return 1; } - char modeshape = theArgVec[1][0]; STEPControl_StepModelType mode; - switch (modeshape) + switch (theArgVec[1][0]) { case 'a': case '0': mode = STEPControl_AsIs; break; @@ -372,17 +435,15 @@ static Standard_Integer stepwrite(Draw_Interpretor& theDI, case '3': mode = STEPControl_ManifoldSolidBrep; break; case 'w': case '4': mode = STEPControl_GeometricCurveSet; break; - default: theDI << "1st arg = mode, incorrect [give fsmw]\n"; return 1; + default: theDI << "Error: 1st arg = mode, incorrect [give fsmw]\n"; return 1; } - - //:k8 abv 6 Jan 98: using parameter for writing mode (assemblies/shapes) Handle(STEPControl_ActorWrite) ActWrite = - Handle(STEPControl_ActorWrite)::DownCast(ctl->ActorWrite()); + Handle(STEPControl_ActorWrite)::DownCast(aWS->NormAdaptor()->ActorWrite()); if (!ActWrite.IsNull()) ActWrite->SetGroupMode(Interface_Static::IVal("write.step.assembly")); TopoDS_Shape shape = DBRep::Get(theArgVec[2]); - STEPControl_Writer sw(XSDRAWBase::Session(), Standard_False); + STEPControl_Writer sw(aWS, Standard_False); Handle(Interface_InterfaceModel) stepmodel = sw.Model(); Standard_Integer nbavant = (stepmodel.IsNull() ? 0 : stepmodel->NbEntities()); @@ -399,7 +460,6 @@ static Standard_Integer stepwrite(Draw_Interpretor& theDI, { theDI << "Error: translation failed, status = " << stat << "\n"; } - if (aPSRoot.UserBreak()) return 1; aPSRoot.SetName("Writing"); @@ -417,96 +477,95 @@ static Standard_Integer stepwrite(Draw_Interpretor& theDI, theDI << " Now, to write a file, command : writeall filename\n"; return 0; } - const char* nomfic = theArgVec[3]; stat = sw.Write(nomfic); switch (stat) { - case IFSelect_RetVoid: theDI << "Error: No file written\n"; break; + case IFSelect_RetVoid: theDI << "Error: No file written\n"; return 1; case IFSelect_RetDone: theDI << "File " << nomfic << " written\n"; break; - case IFSelect_RetStop: theDI << "Error on writing file: no space on disk or destination is write protected\n"; break; - default: theDI << "Error: File " << nomfic << " written with fail messages\n"; break; + case IFSelect_RetStop: theDI << "Error on writing file: no space on disk or destination is write protected\n"; return 1; + default: theDI << "Error: File " << nomfic << " written with fail messages\n"; return 1; } - + XSDRAWBase::CollectActiveWorkSessions(aWS, nomfic, XSDRAWBase::WorkSessionList()); return 0; } -////======================================================================= -////function : testwritestep -////purpose : -////======================================================================= -//static Standard_Integer testwrite(Draw_Interpretor& theDI, -// Standard_Integer theNbArgs, -// const char** theArgVec) -//{ -// TCollection_AsciiString aFilePath; -// TopoDS_Shape aShape; -// bool toTestStream = false; -// for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter) -// { -// TCollection_AsciiString anArgCase(theArgVec[anArgIter]); -// anArgCase.LowerCase(); -// if (anArgCase == "-stream") -// { -// toTestStream = true; -// } -// else if (aFilePath.IsEmpty()) -// { -// aFilePath = theArgVec[anArgIter]; -// } -// else if (aShape.IsNull()) -// { -// aShape = DBRep::Get(theArgVec[anArgIter]); -// if (aShape.IsNull()) -// { -// theDI << "Syntax error: '" << theArgVec[anArgIter] << "' is not a shape"; -// return 1; -// } -// } -// else -// { -// theDI << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'"; -// return 1; -// } -// } -// if (aShape.IsNull()) -// { -// theDI << "Syntax error: wrong number of arguments"; -// return 1; -// } -// -// STEPControl_Writer aWriter; -// IFSelect_ReturnStatus aStat = aWriter.Transfer(aShape, STEPControl_AsIs); -// if (aStat != IFSelect_RetDone) -// { -// theDI << "Error on transferring shape"; -// return 1; -// } -// -// if (toTestStream) -// { -// std::ofstream aStream; -// OSD_OpenStream(aStream, aFilePath, std::ios::out | std::ios::binary); -// aStat = aWriter.WriteStream(aStream); -// aStream.close(); -// if (!aStream.good() -// && aStat == IFSelect_RetDone) -// { -// aStat = IFSelect_RetFail; -// } -// } -// else -// { -// aStat = aWriter.Write(aFilePath.ToCString()); -// } -// if (aStat != IFSelect_RetDone) -// { -// theDI << "Error on writing file"; -// return 1; -// } -// theDI << "File Is Written"; -// return 0; -//} +//======================================================================= +//function : testwrite +//purpose : +//======================================================================= +static Standard_Integer testwrite(Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) +{ + TCollection_AsciiString aFilePath; + TopoDS_Shape aShape; + bool toTestStream = false; + for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter) + { + TCollection_AsciiString anArgCase(theArgVec[anArgIter]); + anArgCase.LowerCase(); + if (anArgCase == "-stream") + { + toTestStream = true; + } + else if (aFilePath.IsEmpty()) + { + aFilePath = theArgVec[anArgIter]; + } + else if (aShape.IsNull()) + { + aShape = DBRep::Get(theArgVec[anArgIter]); + if (aShape.IsNull()) + { + theDI << "Syntax error: '" << theArgVec[anArgIter] << "' is not a shape\n"; + return 1; + } + } + else + { + theDI << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'\n"; + return 1; + } + } + if (aShape.IsNull()) + { + theDI << "Syntax error: wrong number of arguments\n"; + return 1; + } + + STEPControl_Writer aWriter; + IFSelect_ReturnStatus aStat = aWriter.Transfer(aShape, STEPControl_AsIs); + if (aStat != IFSelect_RetDone) + { + theDI << "Error on transferring shape\n"; + return 1; + } + + if (toTestStream) + { + std::ofstream aStream; + OSD_OpenStream(aStream, aFilePath, std::ios::out | std::ios::binary); + aStat = aWriter.WriteStream(aStream); + aStream.close(); + if (!aStream.good() + && aStat == IFSelect_RetDone) + { + aStat = IFSelect_RetFail; + } + } + else + { + aStat = aWriter.Write(aFilePath.ToCString()); + } + if (aStat != IFSelect_RetDone) + { + theDI << "Error on writing file\n"; + return 1; + } + theDI << "File Is Written\n"; + return 0; +} //======================================================================= //function : countexpected @@ -566,20 +625,16 @@ static Standard_Integer stepfileunits(Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** theArgVec) { - if (theNbArgs < 2) { theDI << "Error: Invalid number of parameters. Should be: getfileunits name_file\n"; return 1; } STEPControl_Reader aStepReader; - IFSelect_ReturnStatus readstat = IFSelect_RetVoid; readstat = aStepReader.ReadFile(theArgVec[1]); - if (readstat != IFSelect_RetDone) { - theDI << "No model loaded\n"; return 1; } @@ -688,8 +743,6 @@ static Standard_Integer ReadStep(Draw_Interpretor& theDI, { std::ifstream aStream; OSD_OpenStream(aStream, aFilePath.ToCString(), std::ios::in | std::ios::binary); - TCollection_AsciiString aFolder, aFileNameShort; - OSD_Path::FolderAndFileFromPath(aFilePath, aFolder, aFileNameShort); aReadStat = aProvider->Read(aStream, aDoc, aFilePath, aWS, aProgress->Start()); } @@ -823,8 +876,6 @@ static Standard_Integer WriteStep(Draw_Interpretor& theDI, { std::ofstream aStream; OSD_OpenStream(aStream, aFilePath, std::ios::out | std::ios::binary); - TCollection_AsciiString aFolder, aFileNameShort; - OSD_Path::FolderAndFileFromPath(aFilePath, aFolder, aFileNameShort); aReadStat = aProvider->Write(aStream, aDoc, aWS, aProgress->Start()); } @@ -848,12 +899,18 @@ static Standard_Integer WriteStep(Draw_Interpretor& theDI, //======================================================================= void XSDRAWSTEP::Factory(Draw_Interpretor& theDI) { + static Standard_Boolean initactor = Standard_False; + if (initactor) + { + return; + } + initactor = Standard_True; const char* g = "DE: STEP"; // Step transfer file commands - theDI.Add("stepwrite", "stepwrite [mode[0-4 afsmw]] shape", __FILE__, stepwrite, g); - //theDI.Add("testwritestep", "testwritestep filename.stp shape [-stream]", - // __FILE__, testwrite, g); - theDI.Add("stepread", "stepread [file] [f or r (type of model full or reduced)]", __FILE__, stepread, g); - //theDI.Add("testreadstep", "testreadstep file shape [-stream]", __FILE__, testreadstep, g); + theDI.Add("stepwrite", "stepwrite mode[0-4 afsmw] shape", __FILE__, stepwrite, g); + theDI.Add("testwritestep", "testwritestep filename.stp shape [-stream]", + __FILE__, testwrite, g); + theDI.Add("stepread", "stepread [file] [f or r (type of model full or reduced)]", __FILE__, stepread, g); + theDI.Add("testreadstep", "testreadstep file shape [-stream]", __FILE__, testreadstep, g); theDI.Add("steptrans", "steptrans shape stepax1 stepax2", __FILE__, steptrans, g); theDI.Add("countexpected", "TEST", __FILE__, countexpected, g); theDI.Add("dumpassembly", "TEST", __FILE__, dumpassembly, g); @@ -875,3 +932,6 @@ void XSDRAWSTEP::Factory(Draw_Interpretor& theDI) "\n\t\t: -stream read using ostream writing interface (testing)", __FILE__, WriteStep, g); } + +// Declare entry point PLUGINFACTORY +DPLUGIN(XSDRAWSTEP) diff --git a/src/XSDRAWSTEP/XSDRAWSTEP.hxx b/src/XSDRAWSTEP/XSDRAWSTEP.hxx index 3b6c3b42f1..0a5b90898a 100644 --- a/src/XSDRAWSTEP/XSDRAWSTEP.hxx +++ b/src/XSDRAWSTEP/XSDRAWSTEP.hxx @@ -24,8 +24,6 @@ class XSDRAWSTEP DEFINE_STANDARD_ALLOC public: - Standard_EXPORT static void Init(); - //! Loads all Draw commands of XSDRAWSTEP. Used for plugin. Standard_EXPORT static void Factory(Draw_Interpretor& theDI); }; diff --git a/src/XSDRAWSTL/XSDRAWSTL.cxx b/src/XSDRAWSTL/XSDRAWSTL.cxx index 0d345d657b..ec7f474865 100644 --- a/src/XSDRAWSTL/XSDRAWSTL.cxx +++ b/src/XSDRAWSTL/XSDRAWSTL.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -168,6 +169,12 @@ static Standard_Integer readstl(Draw_Interpretor& theDI, //============================================================================= void XSDRAWSTL::Factory(Draw_Interpretor& theDI) { + static Standard_Boolean initactor = Standard_False; + if (initactor) + { + return; + } + initactor = Standard_True; const char* g = "XSTEP-STL/VRML"; // Step transfer file commands theDI.Add("writestl", "shape file [ascii/binary (0/1) : 1 by default] [InParallel (0/1) : 0 by default]", __FILE__, writestl, g); @@ -180,3 +187,6 @@ void XSDRAWSTL::Factory(Draw_Interpretor& theDI) "\n\t\t: -multi creates a face per solid in multi-domain files; ignored when -brep is set.", __FILE__, readstl, g); } + +// Declare entry point PLUGINFACTORY +DPLUGIN(XSDRAWSTL) diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx index c8667d6d8b..5706ea53f3 100644 --- a/src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx +++ b/src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx @@ -641,7 +641,6 @@ static Standard_Integer showonly(Draw_Interpretor& theDI, return 0; } - Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext(); Handle(MeshVS_Mesh) aMesh = getMesh(theArgVec[1], theDI); if (aMesh.IsNull()) @@ -798,7 +797,6 @@ static Standard_Integer meshcolors(Draw_Interpretor& theDI, aMesh->AddBuilder(aBuilder, Standard_True); } - if (aMode.IsEqual("nodal")) { Handle(MeshVS_NodalColorPrsBuilder) aBuilder = new MeshVS_NodalColorPrsBuilder( @@ -1306,12 +1304,7 @@ void XSDRAWSTLVRML::InitCommands(Draw_Interpretor& theCommands) //======================================================================= void XSDRAWSTLVRML::Factory(Draw_Interpretor& theDI) { - XSDRAWIGES::InitSelect(); - XSDRAWIGES::InitToBRep(theDI); - XSDRAWIGES::InitFromBRep(theDI); - XSDRAWSTEP::InitCommands(theDI); XSDRAWSTLVRML::InitCommands(theDI); - XSDRAW::LoadDraw(theDI); #ifdef OCCT_DEBUG theDI << "Draw Plugin : All TKXSDRAW commands are loaded\n"; #endif diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML.hxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML.hxx index f7fd4dd7cd..4ec0edd030 100644 --- a/src/XSDRAWSTLVRML/XSDRAWSTLVRML.hxx +++ b/src/XSDRAWSTLVRML/XSDRAWSTLVRML.hxx @@ -22,8 +22,6 @@ #include - - class XSDRAWSTLVRML { public: diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_CoordsMap.hxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_CoordsMap.hxx index 05f130df44..d177d46ee3 100644 --- a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_CoordsMap.hxx +++ b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_CoordsMap.hxx @@ -23,5 +23,4 @@ typedef NCollection_DataMap XSDRAWSTLVRML_CoordsMap; typedef NCollection_DataMap::Iterator XSDRAWSTLVRML_DataMapIteratorOfCoordsMap; - #endif diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataMapIteratorOfCoordsMap.hxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataMapIteratorOfCoordsMap.hxx index 7637bfd853..1975d2a4c6 100644 --- a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataMapIteratorOfCoordsMap.hxx +++ b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataMapIteratorOfCoordsMap.hxx @@ -11,7 +11,6 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. - #ifndef XSDRAWSTLVRML_DataMapIteratorOfCoordsMap_HeaderFile #define XSDRAWSTLVRML_DataMapIteratorOfCoordsMap_HeaderFile diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap.hxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap.hxx index 3ca906cdd6..3649afe9c7 100644 --- a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap.hxx +++ b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap.hxx @@ -11,7 +11,6 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. - #ifndef XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap_HeaderFile #define XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap_HeaderFile diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource.hxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource.hxx index 656d0dce07..830d114361 100644 --- a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource.hxx +++ b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource.hxx @@ -28,14 +28,12 @@ #include #include - class XSDRAWSTLVRML_DataSource; DEFINE_STANDARD_HANDLE(XSDRAWSTLVRML_DataSource, MeshVS_DataSource) //! The sample DataSource for working with STLMesh_Mesh class XSDRAWSTLVRML_DataSource : public MeshVS_DataSource { - public: @@ -68,19 +66,12 @@ public: //! There is default method, for advance reflection this method can be redefined. Standard_EXPORT virtual Standard_Boolean GetNormal (const Standard_Integer Id, const Standard_Integer Max, Standard_Real& nx, Standard_Real& ny, Standard_Real& nz) const Standard_OVERRIDE; - - - DEFINE_STANDARD_RTTIEXT(XSDRAWSTLVRML_DataSource,MeshVS_DataSource) protected: - - - private: - Handle(Poly_Triangulation) myMesh; TColStd_PackedMapOfInteger myNodes; TColStd_PackedMapOfInteger myElements; @@ -88,13 +79,6 @@ private: Handle(TColStd_HArray2OfReal) myNodeCoords; Handle(TColStd_HArray2OfReal) myElemNormals; - }; - - - - - - #endif // _XSDRAWSTLVRML_DataSource_HeaderFile diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource3D.cxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource3D.cxx index 6845cad24e..bf02c2b969 100644 --- a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource3D.cxx +++ b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource3D.cxx @@ -13,7 +13,6 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. - #include #include #include diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource3D.hxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource3D.hxx index 13b7b3877b..ced66f94ef 100644 --- a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource3D.hxx +++ b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DataSource3D.hxx @@ -30,14 +30,12 @@ #include #include - class XSDRAWSTLVRML_DataSource3D; DEFINE_STANDARD_HANDLE(XSDRAWSTLVRML_DataSource3D, MeshVS_DataSource) //! The sample DataSource3D for working with STLMesh_Mesh class XSDRAWSTLVRML_DataSource3D : public MeshVS_DataSource { - public: @@ -74,32 +72,18 @@ public: //! There is default method, for advance reflection this method can be redefined. Standard_EXPORT virtual Standard_Boolean GetNormal (const Standard_Integer theID, const Standard_Integer theMax, Standard_Real& theNx, Standard_Real& theNy, Standard_Real& theNz) const Standard_OVERRIDE; - - - DEFINE_STANDARD_RTTIEXT(XSDRAWSTLVRML_DataSource3D,MeshVS_DataSource) protected: - - - private: - TColStd_PackedMapOfInteger myNodes; TColStd_PackedMapOfInteger myElements; Handle(TColStd_HArray1OfInteger) myElemNbNodes; Handle(TColStd_HArray2OfReal) myNodeCoords; Handle(TColStd_HArray2OfInteger) myElemNodes; - }; - - - - - - #endif // _XSDRAWSTLVRML_DataSource3D_HeaderFile diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DrawableMesh.cxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DrawableMesh.cxx index ef2dd5baa1..73d8a568a6 100644 --- a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DrawableMesh.cxx +++ b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DrawableMesh.cxx @@ -13,7 +13,6 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. - #include #include #include diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DrawableMesh.hxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DrawableMesh.hxx index d4fd63bf29..b87a0590a3 100644 --- a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DrawableMesh.hxx +++ b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_DrawableMesh.hxx @@ -23,14 +23,11 @@ class MeshVS_Mesh; class Draw_Display; - class XSDRAWSTLVRML_DrawableMesh; DEFINE_STANDARD_HANDLE(XSDRAWSTLVRML_DrawableMesh, Draw_Drawable3D) - class XSDRAWSTLVRML_DrawableMesh : public Draw_Drawable3D { - public: @@ -40,28 +37,14 @@ public: Standard_EXPORT Handle(MeshVS_Mesh) GetMesh() const; - - - DEFINE_STANDARD_RTTIEXT(XSDRAWSTLVRML_DrawableMesh,Draw_Drawable3D) protected: - - - private: - Handle(MeshVS_Mesh) myMesh; - }; - - - - - - #endif // _XSDRAWSTLVRML_DrawableMesh_HeaderFile diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_ElemNodesMap.hxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_ElemNodesMap.hxx index c1f3c6e574..bf225b5849 100644 --- a/src/XSDRAWSTLVRML/XSDRAWSTLVRML_ElemNodesMap.hxx +++ b/src/XSDRAWSTLVRML/XSDRAWSTLVRML_ElemNodesMap.hxx @@ -23,5 +23,4 @@ typedef NCollection_DataMap XSDRAWSTLVRML_ElemNodesMap; typedef NCollection_DataMap::Iterator XSDRAWSTLVRML_DataMapIteratorOfElemNodesMap; - #endif diff --git a/src/XSDRAWVRML/XSDRAWVRML.cxx b/src/XSDRAWVRML/XSDRAWVRML.cxx index bff471d557..6f4bb9b54c 100644 --- a/src/XSDRAWVRML/XSDRAWVRML.cxx +++ b/src/XSDRAWVRML/XSDRAWVRML.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -322,3 +323,7 @@ void XSDRAWVRML::Factory(Draw_Interpretor& theDI) theDI.Add("loadvrml", "shape file", __FILE__, loadvrml, aGroup); theDI.Add("writevrml", "shape file [version VRML#1.0/VRML#2.0 (1/2): 2 by default] [representation shaded/wireframe/both (0/1/2): 1 by default]", __FILE__, writevrml, aGroup); } + + +// Declare entry point PLUGINFACTORY +DPLUGIN(XSDRAWVRML) diff --git a/tests/bugs/demo/bug14673_3 b/tests/bugs/demo/bug14673_3 index 03f4e2d750..5900af688c 100644 --- a/tests/bugs/demo/bug14673_3 +++ b/tests/bugs/demo/bug14673_3 @@ -17,6 +17,6 @@ close $fd puts "# Load IGES file which is known to generate the message, and check it" puts "REQUIRED 14673 ALL: $message" -pload XSDRAW +pload XSDRAW IGES igesbrep [locate_data_file hammer.iges] a * tpstat c diff --git a/tests/bugs/heal/begin b/tests/bugs/heal/begin index 58d19fe5d3..0b8cd19508 100755 --- a/tests/bugs/heal/begin +++ b/tests/bugs/heal/begin @@ -1,4 +1,4 @@ -pload XSDRAW +pload XDE set subgroup heal diff --git a/tests/bugs/mesh/bug28118 b/tests/bugs/mesh/bug28118 index d27e71e68c..7c5b4e95a4 100644 --- a/tests/bugs/mesh/bug28118 +++ b/tests/bugs/mesh/bug28118 @@ -6,7 +6,7 @@ puts "" # Mesh generation hangs then crashes ########################################### -pload DATAEXCHANGEKERNEL +pload DATAEXCHANGE testreadstep [locate_data_file bug28118_18547.stp] result vclear diff --git a/tests/bugs/mesh/bug29715 b/tests/bugs/mesh/bug29715 index f222bbafed..f58e69926a 100644 --- a/tests/bugs/mesh/bug29715 +++ b/tests/bugs/mesh/bug29715 @@ -3,7 +3,7 @@ puts "0029715: Mesh - Estimate the grid size of the acceleration structure by th puts "=======" puts "" -if {[info commands stepread] == ""} {pload XSDRAW} +pload XSDRAW STEP stepread [locate_data_file bug29715_slow.stp] a * renamevar a_1 a diff --git a/tests/bugs/modalg_4/bug8842_1 b/tests/bugs/modalg_4/bug8842_1 index 2cd32d7bf9..554c2d9f7e 100755 --- a/tests/bugs/modalg_4/bug8842_1 +++ b/tests/bugs/modalg_4/bug8842_1 @@ -8,7 +8,7 @@ puts "" set BugNumber OCC8842 -if {[info commands testreadiges] == ""} {pload XSDRAW} +pload XSDRAW IGES proc myoffset {result sh val tan} { if {$tan == 1} { diff --git a/tests/bugs/modalg_4/bug8842_10 b/tests/bugs/modalg_4/bug8842_10 index e31fdedff5..7feeaa5cef 100755 --- a/tests/bugs/modalg_4/bug8842_10 +++ b/tests/bugs/modalg_4/bug8842_10 @@ -8,7 +8,7 @@ puts "" set BugNumber OCC8842 -if {[info commands testreadiges] == ""} {pload XSDRAW} +pload XSDRAW IGES proc myoffset {result sh val tan} { if {$tan == 1} { diff --git a/tests/bugs/modalg_4/bug8842_11 b/tests/bugs/modalg_4/bug8842_11 index 55fb7187b5..3ad06e8101 100755 --- a/tests/bugs/modalg_4/bug8842_11 +++ b/tests/bugs/modalg_4/bug8842_11 @@ -8,7 +8,7 @@ puts "" set BugNumber OCC8842 -if {[info commands testreadiges] == ""} {pload XSDRAW} +pload XSDRAW IGES proc myoffset {result sh val tan} { if {$tan == 1} { diff --git a/tests/bugs/modalg_4/bug8842_12 b/tests/bugs/modalg_4/bug8842_12 index 0852f3afe4..1264e75fcc 100755 --- a/tests/bugs/modalg_4/bug8842_12 +++ b/tests/bugs/modalg_4/bug8842_12 @@ -8,7 +8,7 @@ puts "" set BugNumber OCC8842 -if {[info commands testreadiges] == ""} {pload XSDRAW} +pload XSDRAW IGES proc myoffset {result sh val tan} { if {$tan == 1} { diff --git a/tests/bugs/modalg_4/bug8842_13 b/tests/bugs/modalg_4/bug8842_13 index 1fa251f0b7..cf9871c195 100755 --- a/tests/bugs/modalg_4/bug8842_13 +++ b/tests/bugs/modalg_4/bug8842_13 @@ -8,7 +8,7 @@ puts "" set BugNumber OCC8842 -if {[info commands testreadiges] == ""} {pload XSDRAW} +pload XSDRAW IGES proc myoffset {result sh val tan} { if {$tan == 1} { diff --git a/tests/bugs/modalg_4/bug8842_14 b/tests/bugs/modalg_4/bug8842_14 index a7c954ab32..e41c7b8fde 100755 --- a/tests/bugs/modalg_4/bug8842_14 +++ b/tests/bugs/modalg_4/bug8842_14 @@ -8,7 +8,7 @@ puts "" set BugNumber OCC8842 -if {[info commands testreadiges] == ""} {pload XSDRAW} +pload XSDRAW IGES proc myoffset {result sh val tan} { if {$tan == 1} { diff --git a/tests/bugs/modalg_4/bug8842_15 b/tests/bugs/modalg_4/bug8842_15 index fb00750bf2..31e2d0b42f 100755 --- a/tests/bugs/modalg_4/bug8842_15 +++ b/tests/bugs/modalg_4/bug8842_15 @@ -9,7 +9,7 @@ puts "" set BugNumber OCC8842 -if {[info commands testreadiges] == ""} {pload XSDRAW} +pload XSDRAW IGES proc myoffset {result sh val tan} { if {$tan == 1} { diff --git a/tests/bugs/modalg_4/bug8842_16 b/tests/bugs/modalg_4/bug8842_16 index c8d4075ad6..be00aff7d4 100755 --- a/tests/bugs/modalg_4/bug8842_16 +++ b/tests/bugs/modalg_4/bug8842_16 @@ -8,7 +8,7 @@ puts "" set BugNumber OCC8842 -if {[info commands testreadiges] == ""} {pload XSDRAW} +pload XSDRAW IGES proc myoffset {result sh val tan} { if {$tan == 1} { diff --git a/tests/bugs/modalg_4/bug8842_2 b/tests/bugs/modalg_4/bug8842_2 index 29a054a7fe..ebe8434343 100755 --- a/tests/bugs/modalg_4/bug8842_2 +++ b/tests/bugs/modalg_4/bug8842_2 @@ -8,7 +8,7 @@ puts "" set BugNumber OCC8842 -if {[info commands testreadiges] == ""} {pload XSDRAW} +pload XSDRAW IGES proc myoffset {result sh val tan} { if {$tan == 1} { diff --git a/tests/bugs/modalg_4/bug8842_3 b/tests/bugs/modalg_4/bug8842_3 index b21c170049..e975923676 100755 --- a/tests/bugs/modalg_4/bug8842_3 +++ b/tests/bugs/modalg_4/bug8842_3 @@ -10,7 +10,7 @@ puts "" set BugNumber OCC8842 -if {[info commands testreadiges] == ""} {pload XSDRAW} +pload XSDRAW IGES proc myoffset {result sh val tan} { if {$tan == 1} { diff --git a/tests/bugs/modalg_4/bug8842_4 b/tests/bugs/modalg_4/bug8842_4 index f315de1a74..48eeafeb98 100755 --- a/tests/bugs/modalg_4/bug8842_4 +++ b/tests/bugs/modalg_4/bug8842_4 @@ -8,7 +8,7 @@ puts "" set BugNumber OCC8842 -if {[info commands testreadiges] == ""} {pload XSDRAW} +pload XSDRAW IGES proc myoffset {result sh val tan} { if {$tan == 1} { diff --git a/tests/bugs/modalg_4/bug8842_5 b/tests/bugs/modalg_4/bug8842_5 index c3ab3fabdb..52f90a4df3 100755 --- a/tests/bugs/modalg_4/bug8842_5 +++ b/tests/bugs/modalg_4/bug8842_5 @@ -12,7 +12,7 @@ puts "" set BugNumber OCC8842 -if {[info commands testreadiges] == ""} {pload XSDRAW} +pload XSDRAW IGES proc myoffset {result sh val tan} { if {$tan == 1} { diff --git a/tests/bugs/modalg_4/bug8842_6 b/tests/bugs/modalg_4/bug8842_6 index c8d220c302..403cf0cbfe 100755 --- a/tests/bugs/modalg_4/bug8842_6 +++ b/tests/bugs/modalg_4/bug8842_6 @@ -8,7 +8,7 @@ puts "" set BugNumber OCC8842 -if {[info commands testreadiges] == ""} {pload XSDRAW} +pload XSDRAW IGES proc myoffset {result sh val tan} { if {$tan == 1} { diff --git a/tests/bugs/modalg_4/bug8842_7 b/tests/bugs/modalg_4/bug8842_7 index 0f458a213a..f922828795 100755 --- a/tests/bugs/modalg_4/bug8842_7 +++ b/tests/bugs/modalg_4/bug8842_7 @@ -8,7 +8,7 @@ puts "" set BugNumber OCC8842 -if {[info commands testreadiges] == ""} {pload XSDRAW} +pload XSDRAW IGES proc myoffset {result sh val tan} { if {$tan == 1} { diff --git a/tests/bugs/modalg_4/bug8842_8 b/tests/bugs/modalg_4/bug8842_8 index eac4f7ae9b..d63785a95b 100755 --- a/tests/bugs/modalg_4/bug8842_8 +++ b/tests/bugs/modalg_4/bug8842_8 @@ -10,7 +10,7 @@ set BugNumber OCC8842 cpulimit 500 -if {[info commands testreadiges] == ""} {pload XSDRAW} +pload XSDRAW IGES proc myoffset {result sh val tan} { if {$tan == 1} { diff --git a/tests/bugs/modalg_4/bug8842_9 b/tests/bugs/modalg_4/bug8842_9 index 597ab23ac8..6314f8990d 100755 --- a/tests/bugs/modalg_4/bug8842_9 +++ b/tests/bugs/modalg_4/bug8842_9 @@ -8,7 +8,7 @@ puts "" set BugNumber OCC8842 -if {[info commands testreadiges] == ""} {pload XSDRAW} +pload XSDRAW IGES proc myoffset {result sh val tan} { if {$tan == 1} { diff --git a/tests/bugs/modalg_5/bug25175 b/tests/bugs/modalg_5/bug25175 index ee7c73ee82..426fc25d6a 100644 --- a/tests/bugs/modalg_5/bug25175 +++ b/tests/bugs/modalg_5/bug25175 @@ -6,7 +6,7 @@ puts "" # BRepBuilderAPI_Sewing can crash if an edge without 3D curve is presented ########################################################################### -pload XSDRAW +pload XSDRAW IGES igesread [locate_data_file bug25175_3.igs] a * diff --git a/tests/bugs/modalg_5/bug25410 b/tests/bugs/modalg_5/bug25410 index 61e53cc89a..9ab1681f7d 100755 --- a/tests/bugs/modalg_5/bug25410 +++ b/tests/bugs/modalg_5/bug25410 @@ -6,7 +6,7 @@ puts "" # Tool for extended check of validity of the curve on the surface ###################################################### -pload XSDRAW +pload XSDRAW IGES testreadiges [locate_data_file bug25410_Tank8.igs] b1 diff --git a/tests/bugs/modalg_7/bug30595_2 b/tests/bugs/modalg_7/bug30595_2 index a3ae8a39c1..638faccf6c 100644 --- a/tests/bugs/modalg_7/bug30595_2 +++ b/tests/bugs/modalg_7/bug30595_2 @@ -3,7 +3,7 @@ puts "0030595: Oriented Bounding Box seems not optimal for some shapes" puts "===============================================================" puts "" -pload XSDRAW +pload XSDRAW STEP stepread [locate_data_file bug30595_UC1.stp] s * incmesh s_1 0.1 diff --git a/tests/bugs/modalg_7/bug30829 b/tests/bugs/modalg_7/bug30829 index dcf37bf448..7724fb0b80 100644 --- a/tests/bugs/modalg_7/bug30829 +++ b/tests/bugs/modalg_7/bug30829 @@ -3,7 +3,7 @@ puts "0030829: BRepExtrema_ShapeProximity crashes with shape from STL/WRL" puts "========" puts "" -pload XSDRAW +pload XSDRAW STL box b 10 10 10 pcylinder c 5 10 diff --git a/tests/bugs/modalg_8/bug33165 b/tests/bugs/modalg_8/bug33165 index acc9a454af..a736f52788 100644 --- a/tests/bugs/modalg_8/bug33165 +++ b/tests/bugs/modalg_8/bug33165 @@ -3,7 +3,7 @@ puts "0033165: Data exchange - Instance name is not saved during writing step fi puts "====================================" puts "" -pload OCAF XDEDRAW +pload OCAF XDEDRAW STEP box b 1 1 1 reset b diff --git a/tests/bugs/stlvrml/begin b/tests/bugs/stlvrml/begin index c45bfe9f54..5b036b1cc8 100755 --- a/tests/bugs/stlvrml/begin +++ b/tests/bugs/stlvrml/begin @@ -1,3 +1,3 @@ -pload XSDRAW +pload XSDRAW STL VRML set subgroup stlvrml -- 2.39.5