From: szv Date: Mon, 17 Oct 2016 12:36:31 +0000 (+0300) Subject: Create TKXSSelect X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=92d3c2487f5f2ebab485e83cf8ddd0c30ce9b8fd;p=occt-copy.git Create TKXSSelect Readers and Writers redesign --- diff --git a/adm/MODULES b/adm/MODULES index e65fb379ee..aab8ec7969 100644 --- a/adm/MODULES +++ b/adm/MODULES @@ -3,5 +3,5 @@ ModelingData TKG2d TKG3d TKGeomBase TKBRep ModelingAlgorithms TKGeomAlgo TKTopAlgo TKPrim TKBO TKBool TKHLR TKFillet TKOffset TKFeat TKMesh TKXMesh TKShHealing Visualization TKService TKV3d TKOpenGl TKMeshVS TKIVtk TKD3DHost ApplicationFramework TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml TKStdL TKStd TKTObj TKBinTObj TKXmlTObj TKVCAF -DataExchange TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF +DataExchange TKXSBase TKXSSelect TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF Draw TKDraw TKTopTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE diff --git a/adm/UDLIST b/adm/UDLIST index 1ea34dcd0d..505c42e714 100644 --- a/adm/UDLIST +++ b/adm/UDLIST @@ -380,6 +380,7 @@ t TKXCAF t TKXDEIGES t TKXDESTEP t TKXSBase +t TKXSSelect t TKXmlXCAF n BOPTest n BRepTest diff --git a/dox/user_guides/draw_test_harness/draw_test_harness.md b/dox/user_guides/draw_test_harness/draw_test_harness.md index 2a5314b433..8d61749aac 100644 --- a/dox/user_guides/draw_test_harness/draw_test_harness.md +++ b/dox/user_guides/draw_test_harness/draw_test_harness.md @@ -8050,7 +8050,6 @@ brepiges aa /disk1/tmp/aaa.igs == mode write : Faces == To modifiy : command param == 1 Shapes written, giving 345 Entities -== Now, to write a file, command : writeall filename == Output on file : /disk1/tmp/aaa.igs == Write OK ~~~~~ diff --git a/dox/user_guides/iges/iges.md b/dox/user_guides/iges/iges.md index cadd35ca01..324e3fcbe1 100644 --- a/dox/user_guides/iges/iges.md +++ b/dox/user_guides/iges/iges.md @@ -62,7 +62,7 @@ Administrative data, in the Global Section of the IGES file (such as the file n Before performing any other operation, you have to load the file using the syntax below. ~~~~~ IGESControl_Reader reader; -IFSelect_ReturnStatus stat = reader.ReadFile(“filename.igs”); +Interface_ReturnStatus stat = reader.ReadFile(“filename.igs”); ~~~~~ The loading operation only loads the IGES file into computer memory; it does not translate it. @@ -1111,11 +1111,6 @@ Draw> brepiges [] ~~~~~ Converts the specified shapes into IGES entities and puts them into the *InterfaceModel*. -~~~~~ -Draw> writeall -~~~~~ -Allows writing the prepared model to a file with name *filename.igs*. - @section occt_iges_5 Reading from and writing to IGES @subsection occt_iges_5_1 Reading from IGES @@ -1125,7 +1120,7 @@ Allows writing the prepared model to a file with name *filename.igs*. Before performing any other operation, you must load an IGES file with: ~~~~~ IGESCAFControl_Reader reader(XSDRAW::Session(), Standard_False); -IFSelect_ReturnStatus stat = reader.ReadFile(“filename.igs”); +Interface_ReturnStatus stat = reader.ReadFile(“filename.igs”); ~~~~~ Loading the file only memorizes, but does not translate the data. @@ -1183,7 +1178,7 @@ aWriter.SetNameMode(mode); You can perform the translation of a document by calling the function: ~~~~~ -IFSelect_ReturnStatus aRetSt = aWriter.Transfer(doc); +Interface_ReturnStatus aRetSt = aWriter.Transfer(doc); ~~~~~ where "doc" is a variable which contains a handle to the input document for transferring and should have a type *Handle(TDocStd_Document)*. @@ -1191,11 +1186,11 @@ where "doc" is a variable which contains a handle to the input document for tran Write an IGES file with: ~~~~~ -IFSelect_ReturnStatus statw = aWriter.WriteFile("filename.igs"); +Interface_ReturnStatus statw = aWriter.WriteFile("filename.igs"); ~~~~~ or ~~~~~ -IFSelect_ReturnStatus statw = writer.WriteFile (S); +Interface_ReturnStatus statw = writer.WriteFile (S); ~~~~~ where S is OStream. diff --git a/dox/user_guides/step/step.md b/dox/user_guides/step/step.md index d31ed41dd2..73d09fec0a 100644 --- a/dox/user_guides/step/step.md +++ b/dox/user_guides/step/step.md @@ -123,7 +123,7 @@ For further information see 2.4 Mapping STEP entities to Open CASCADE Technology Before performing any other operation you have to load the file with: ~~~~~ STEPControl_Reader reader; -IFSelect_ReturnStatus stat = reader.ReadFile(;filename.stp;); +Interface_ReturnStatus stat = reader.ReadFile(;filename.stp;); ~~~~~ Loading the file only memorizes the data, it does not translate it. @@ -958,13 +958,13 @@ If *TopoDS_Compound* contains any other types besides the ones mentioned in the In case if an OCCT shape cannot be translated according to its mode the result of translation is void. ~~~~~ STEP214Control_StepModelTope mode = STEP214Control_ManifoldSolidBrep; -IFSelect_ReturnStatus stat = writer.Transfer(shape,mode); +Interface_ReturnStatus stat = writer.Transfer(shape,mode); ~~~~~ @subsubsection occt_step_3_3_4 Writing the STEP file Write the STEP file with: ~~~~~ -IFSelect_ReturnStatus stat = writer.Write("filename.stp"); +Interface_ReturnStatus stat = writer.Write("filename.stp"); ~~~~~ to give the file name. @@ -1402,7 +1402,7 @@ In addition to the translation of shapes implemented in basic translator, it pro Before performing any other operation, you must load a STEP file with: ~~~~~ STEPCAFControl_Reader reader(XSDRAW::Session(), Standard_False); -IFSelect_ReturnStatus stat = reader.ReadFile("filename.stp"); +Interface_ReturnStatus stat = reader.ReadFile("filename.stp"); ~~~~~ Loading the file only memorizes the data, it does not translate it. @@ -1458,7 +1458,7 @@ aWriter.SetNameMode(mode); You can perform the translation of document by calling the function: ~~~~~ -IFSelect_ReturnStatus aRetSt = aWriter.Transfer(doc); +Interface_ReturnStatus aRetSt = aWriter.Transfer(doc); ~~~~~ where *doc* is a variable, which contains a handle to the input document for transferring and should have a type *Handle(TDocStd_Document)*. @@ -1466,11 +1466,11 @@ where *doc* is a variable, which contains a handle to the input document for tr Write a STEP file with: ~~~~~ -IFSelect_ReturnStatus statw = aWriter.WriteFile("filename.stp"); +Interface_ReturnStatus statw = aWriter.WriteFile("filename.stp"); ~~~~~ or ~~~~~ -IFSelect_ReturnStatus statw = writer.WriteFile (S); +Interface_ReturnStatus statw = writer.WriteFile (S); ~~~~~ where *S* is *OStream*. diff --git a/dox/user_guides/xde/xde.md b/dox/user_guides/xde/xde.md index 7d8db82a6d..b65382cd0b 100644 --- a/dox/user_guides/xde/xde.md +++ b/dox/user_guides/xde/xde.md @@ -625,7 +625,7 @@ To read a STEP file by itself, use: ~~~~~ STEPCAFControl_Reader reader; -IFSelect_ReturnStatus readstat = reader.ReadFile(filename); +Interface_ReturnStatus readstat = reader.ReadFile(filename); // The various ways of reading a file are available here too : // to read it by the reader, to take it from a WorkSession ... Handle(TDocStd_Document) doc... @@ -659,7 +659,7 @@ if ( ! writer.Transfer ( Doc, mode ) ) { // abandon .. } // Writing the File -IFSelect_ReturnStatus stat = writer.Write(file-name); +Interface_ReturnStatus stat = writer.Write(file-name); ~~~~~ @subsubsection occt_xde_2_8_3 Reading an IGES File diff --git a/samples/CSharp/OCCTProxy/OCCTProxy.cpp b/samples/CSharp/OCCTProxy/OCCTProxy.cpp index f9a18c5236..b1bf1b989c 100644 --- a/samples/CSharp/OCCTProxy/OCCTProxy.cpp +++ b/samples/CSharp/OCCTProxy/OCCTProxy.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include //step I/E #include @@ -774,8 +774,8 @@ public: { Standard_CString aFileName = (Standard_CString) theFileName; STEPControl_Reader aReader; - IFSelect_ReturnStatus aStatus = aReader.ReadFile(aFileName); - if ( aStatus == IFSelect_RetDone ) + Interface_ReturnStatus aStatus = aReader.ReadFile(aFileName); + if ( aStatus == Interface_RetDone ) { bool isFailsonly = false; aReader.PrintCheckLoad( isFailsonly, IFSelect_ItemsByEntity ); @@ -814,7 +814,7 @@ public: IGESControl_Reader aReader; int aStatus = aReader.ReadFile( aFileName ); - if ( aStatus == IFSelect_RetDone ) + if ( aStatus == Interface_RetDone ) { aReader.TransferRoots(); TopoDS_Shape aShape = aReader.OneShape(); @@ -853,7 +853,7 @@ public: bool ExportStep(char* theFileName) { STEPControl_StepModelType aType = STEPControl_AsIs; - IFSelect_ReturnStatus aStatus; + Interface_ReturnStatus aStatus; STEPControl_Writer aWriter; for ( myAISContext()->InitCurrent(); myAISContext()->MoreCurrent(); myAISContext()->NextCurrent() ) { @@ -861,14 +861,14 @@ public: Handle(AIS_Shape) anIS=Handle(AIS_Shape)::DownCast(anIO); TopoDS_Shape aShape = anIS->Shape(); aStatus = aWriter.Transfer( aShape , aType ); - if ( aStatus != IFSelect_RetDone ) + if ( aStatus != Interface_RetDone ) { return false; } } aStatus = aWriter.Write( (Standard_CString)theFileName ); - if ( aStatus != IFSelect_RetDone ) + if ( aStatus != Interface_RetDone ) { return false; } diff --git a/samples/CSharp/OCCTProxy_D3D/OCCTProxyD3D.cpp b/samples/CSharp/OCCTProxy_D3D/OCCTProxyD3D.cpp index 8dc71cfc7d..4a49e29922 100644 --- a/samples/CSharp/OCCTProxy_D3D/OCCTProxyD3D.cpp +++ b/samples/CSharp/OCCTProxy_D3D/OCCTProxyD3D.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include //step I/E #include @@ -752,7 +752,7 @@ public: bool ImportStep (char* theFileName) { STEPControl_Reader aReader; - if (aReader.ReadFile (theFileName) != IFSelect_RetDone) + if (aReader.ReadFile (theFileName) != Interface_RetDone) { return false; } @@ -784,7 +784,7 @@ public: bool ImportIges (char* theFileName) { IGESControl_Reader aReader; - if (aReader.ReadFile (theFileName) != IFSelect_RetDone) + if (aReader.ReadFile (theFileName) != Interface_RetDone) { return false; } @@ -830,12 +830,12 @@ public: } TopoDS_Shape aShape = anIS->Shape(); - if (aWriter.Transfer (aShape, aType) != IFSelect_RetDone) + if (aWriter.Transfer (aShape, aType) != Interface_RetDone) { return false; } } - return aWriter.Write (theFileName) == IFSelect_RetDone; + return aWriter.Write (theFileName) == Interface_RetDone; } /// diff --git a/samples/java/jniviewer/jni/OcctJni_Viewer.cxx b/samples/java/jniviewer/jni/OcctJni_Viewer.cxx index e1937b25e6..6d62e6f02a 100644 --- a/samples/java/jniviewer/jni/OcctJni_Viewer.cxx +++ b/samples/java/jniviewer/jni/OcctJni_Viewer.cxx @@ -280,9 +280,9 @@ void OcctJni_Viewer::initContent() //! Load shape from IGES file static TopoDS_Shape loadIGES (const TCollection_AsciiString& thePath) { - TopoDS_Shape aShape; - IGESControl_Reader aReader; - IFSelect_ReturnStatus aReadStatus = IFSelect_RetFail; + TopoDS_Shape aShape; + IGESControl_Reader aReader; + Interface_ReturnStatus aReadStatus = Interface_RetFail; try { aReadStatus = aReader.ReadFile (thePath.ToCString()); @@ -293,7 +293,7 @@ static TopoDS_Shape loadIGES (const TCollection_AsciiString& thePath) return aShape; } - if (aReadStatus != IFSelect_RetDone) + if (aReadStatus != Interface_RetDone) { Message::DefaultMessenger()->Send ("Error: IGES reader, bad file format", Message_Fail); return aShape; @@ -352,8 +352,8 @@ static TopoDS_Shape loadIGES (const TCollection_AsciiString& thePath) //! Load shape from STEP file static TopoDS_Shape loadSTEP (const TCollection_AsciiString& thePath) { - STEPControl_Reader aReader; - IFSelect_ReturnStatus aReadStatus = IFSelect_RetFail; + STEPControl_Reader aReader; + Interface_ReturnStatus aReadStatus = Interface_RetFail; try { aReadStatus = aReader.ReadFile (thePath.ToCString()); @@ -364,7 +364,7 @@ static TopoDS_Shape loadSTEP (const TCollection_AsciiString& thePath) return TopoDS_Shape(); } - if (aReadStatus != IFSelect_RetDone) + if (aReadStatus != Interface_RetDone) { Message::DefaultMessenger()->Send ("Error: STEP reader, bad file format", Message_Fail); return TopoDS_Shape(); diff --git a/samples/mfc/standard/Common/ImportExport/ImportExport.cpp b/samples/mfc/standard/Common/ImportExport/ImportExport.cpp index 4fc1a67f3f..eae52dbe00 100755 --- a/samples/mfc/standard/Common/ImportExport/ImportExport.cpp +++ b/samples/mfc/standard/Common/ImportExport/ImportExport.cpp @@ -276,7 +276,7 @@ dlg.m_ofn.lpstrInitialDir = initdir; TCollection_ExtendedString aFileNameW ((Standard_ExtString )(const wchar_t* )dlg.GetPathName()); TCollection_AsciiString aFileName (aFileNameW, '?'); Standard_Integer status = ReadIGES (aFileName.ToCString(), aSequence); - if (status != IFSelect_RetDone) + if (status != Interface_RetDone) { MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, L"Error : The file is not read", L"CasCade Error", MB_ICONERROR); } @@ -295,7 +295,7 @@ Standard_Integer CImportExport::ReadIGES(const Standard_CString& aFileName, Standard_Integer status = Reader.ReadFile(aFileName); - if (status != IFSelect_RetDone) return status; + if (status != Interface_RetDone) return status; Reader.TransferRoots(); TopoDS_Shape aShape = Reader.OneShape(); aHSequenceOfShape->Append(aShape); @@ -402,16 +402,16 @@ dlg.m_ofn.lpstrInitialDir = initdir; SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); TCollection_ExtendedString aFileNameW ((Standard_ExtString )(const wchar_t* )dlg.GetPathName()); TCollection_AsciiString aFileName (aFileNameW, '?'); - IFSelect_ReturnStatus ReturnStatus = ReadSTEP (aFileName.ToCString(), aSequence); + Interface_ReturnStatus ReturnStatus = ReadSTEP (aFileName.ToCString(), aSequence); switch (ReturnStatus) { - case IFSelect_RetError : + case Interface_RetError : MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, L"Not a valid Step file", L"ERROR", MB_ICONWARNING); break; - case IFSelect_RetFail : + case Interface_RetFail : MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, L"Reading has failed", L"ERROR", MB_ICONWARNING); break; - case IFSelect_RetVoid : + case Interface_RetVoid : MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, L"Nothing to transfer", L"ERROR", MB_ICONWARNING); break; } @@ -420,15 +420,15 @@ dlg.m_ofn.lpstrInitialDir = initdir; return aSequence; } -IFSelect_ReturnStatus CImportExport::ReadSTEP(const Standard_CString& aFileName, - Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape) +Interface_ReturnStatus CImportExport::ReadSTEP(const Standard_CString& aFileName, + Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape) { aHSequenceOfShape->Clear(); // create additional log file STEPControl_Reader aReader; - IFSelect_ReturnStatus status = aReader.ReadFile(aFileName); - if (status != IFSelect_RetDone) + Interface_ReturnStatus status = aReader.ReadFile(aFileName); + if (status != Interface_RetDone) return status; aReader.WS()->TransferReader()->TransientProcess()->SetTraceLevel(2); // increase default trace level @@ -446,7 +446,7 @@ IFSelect_ReturnStatus CImportExport::ReadSTEP(const Standard_CString& aFileName, // Collecting resulting entities Standard_Integer nbs = aReader.NbShapes(); if (nbs == 0) { - return IFSelect_RetVoid; + return Interface_RetVoid; } for (Standard_Integer i=1; i<=nbs; i++) { aHSequenceOfShape->Append(aReader.Shape(i)); @@ -502,15 +502,15 @@ Standard_Boolean TestFacetedBrep(const Handle(TopTools_HSequenceOfShape)& aHSequ return !OneErrorFound; } -IFSelect_ReturnStatus CImportExport::SaveSTEP(const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape) +Interface_ReturnStatus CImportExport::SaveSTEP(const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape) { if (aHSequenceOfShape->Length() == 0) { MessageBox (AfxGetApp()->m_pMainWnd->m_hWnd, L"No Shape in the HSequence!!", L"CasCade Warning", MB_ICONWARNING); - return IFSelect_RetError; + return Interface_RetError; } - IFSelect_ReturnStatus status = IFSelect_RetVoid; + Interface_ReturnStatus status = Interface_RetVoid; CFileSaveSTEPDialog aDlg(NULL); @@ -528,20 +528,20 @@ IFSelect_ReturnStatus CImportExport::SaveSTEP(const Handle(TopTools_HSequenceOfS if (!TestFacetedBrep(aHSequenceOfShape)) { MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, L"At least one shape doesn't contain facetes", L"CasCade Warning", MB_ICONWARNING); - return IFSelect_RetError; + return Interface_RetError; } status = SaveSTEP (aFileName.ToCString(), aHSequenceOfShape, selection); switch (status) { - case IFSelect_RetError: + case Interface_RetError: MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, L"Incorrect Data", L"ERROR", MB_ICONWARNING); break; - case IFSelect_RetFail: + case Interface_RetFail: MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, L"Writing has failed", L"ERROR", MB_ICONWARNING); break; - case IFSelect_RetVoid: + case Interface_RetVoid: MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, L"Nothing to transfer", L"ERROR", MB_ICONWARNING); break; } @@ -550,8 +550,8 @@ IFSelect_ReturnStatus CImportExport::SaveSTEP(const Handle(TopTools_HSequenceOfS return status; } //---------------------------------------------------------------------------------------- -IFSelect_ReturnStatus CImportExport::SaveSTEP(const Standard_CString& aFileName, - const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape, +Interface_ReturnStatus CImportExport::SaveSTEP(const Standard_CString& aFileName, + const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape, const STEPControl_StepModelType aValue /* =TopoDSToCc1Act_ManifoldSolidBrep */ ) @@ -560,11 +560,11 @@ const STEPControl_StepModelType aValue /* =TopoDSToCc1Act_ManifoldSolidBrep */ ) STEPControl_Writer aWriter; - IFSelect_ReturnStatus status; + Interface_ReturnStatus status; for (Standard_Integer i=1;i<=aHSequenceOfShape->Length();i++) { status = aWriter.Transfer(aHSequenceOfShape->Value(i), aValue); - if ( status != IFSelect_RetDone ) return status; + if ( status != Interface_RetDone ) return status; } status = aWriter.Write(aFileName); return status; diff --git a/samples/mfc/standard/Common/ImportExport/ImportExport.h b/samples/mfc/standard/Common/ImportExport/ImportExport.h index 92f35c3a7e..fe9b312ee9 100755 --- a/samples/mfc/standard/Common/ImportExport/ImportExport.h +++ b/samples/mfc/standard/Common/ImportExport/ImportExport.h @@ -10,7 +10,7 @@ #endif // _MSC_VER >= 1000 #include -#include +#include #include #include #include @@ -61,20 +61,19 @@ public : static void ReadSTEP(const Handle(AIS_InteractiveContext)& anInteractiveContext); static Handle(TopTools_HSequenceOfShape) ReadSTEP(); // not by reference --> the sequence is created here !! - static IFSelect_ReturnStatus ReadSTEP(const Standard_CString& aFileName, - Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape); + static Interface_ReturnStatus ReadSTEP(const Standard_CString& aFileName, + Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape); //---------------------------------------------------------------------- static void SaveSTEP(const Handle(AIS_InteractiveContext)& anInteractiveContext); - static IFSelect_ReturnStatus SaveSTEP(const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape); - static IFSelect_ReturnStatus SaveSTEP(const Standard_CString& aFileName, - const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape, - - const STEPControl_StepModelType aValue = STEPControl_AsIs); + static Interface_ReturnStatus SaveSTEP(const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape); + static Interface_ReturnStatus SaveSTEP(const Standard_CString& aFileName, + const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape, + const STEPControl_StepModelType aValue = STEPControl_AsIs); static void ReadSAT(const Handle(AIS_InteractiveContext)& anInteractiveContext); static Handle(TopTools_HSequenceOfShape) ReadSAT(); // not by reference --> the sequence is created here !! - static IFSelect_ReturnStatus ReadSAT(const Standard_CString& aFileName, - Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape); + static Interface_ReturnStatus ReadSAT(const Standard_CString& aFileName, + Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape); //---------------------------------------------------------------------- static Standard_Boolean SaveSTL(const Standard_CString& aFileName, const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape, diff --git a/samples/qt/Interface/src/Translate.cxx b/samples/qt/Interface/src/Translate.cxx index 61f78a3632..e0f62a4009 100755 --- a/samples/qt/Interface/src/Translate.cxx +++ b/samples/qt/Interface/src/Translate.cxx @@ -407,7 +407,7 @@ Handle(TopTools_HSequenceOfShape) Translate::importIGES( const QString& file ) IGESControl_Reader Reader; int status = Reader.ReadFile(aFilePath.ToCString() ); - if ( status == IFSelect_RetDone ) + if ( status == Interface_RetDone ) { aSequence = new TopTools_HSequenceOfShape(); Reader.TransferRoots(); @@ -422,8 +422,8 @@ Handle(TopTools_HSequenceOfShape) Translate::importSTEP( const QString& file ) Handle(TopTools_HSequenceOfShape) aSequence; TCollection_AsciiString aFilePath = file.toUtf8().data(); STEPControl_Reader aReader; - IFSelect_ReturnStatus status = aReader.ReadFile( aFilePath.ToCString() ); - if ( status == IFSelect_RetDone ) + Interface_ReturnStatus status = aReader.ReadFile( aFilePath.ToCString() ); + if ( status == Interface_RetDone ) { //Interface_TraceFile::SetDefault(); bool failsonly = false; @@ -485,7 +485,7 @@ bool Translate::exportSTEP( const QString& file, const Handle(TopTools_HSequence if ( type < 0 ) return false; - IFSelect_ReturnStatus status; + Interface_ReturnStatus status; if ( type == STEPControl_FacetedBrep && !checkFacetedBrep( shapes ) ) { @@ -497,7 +497,7 @@ bool Translate::exportSTEP( const QString& file, const Handle(TopTools_HSequence for ( int i = 1; i <= shapes->Length(); i++ ) { status = writer.Transfer( shapes->Value( i ), type ); - if ( status != IFSelect_RetDone ) + if ( status != Interface_RetDone ) return false; } @@ -505,17 +505,17 @@ bool Translate::exportSTEP( const QString& file, const Handle(TopTools_HSequence switch ( status ) { - case IFSelect_RetError: + case Interface_RetError: myInfo = QObject::tr( "INF_DATA_ERROR" ); break; - case IFSelect_RetFail: + case Interface_RetFail: myInfo = QObject::tr( "INF_WRITING_ERROR" ); break; - case IFSelect_RetVoid: + case Interface_RetVoid: myInfo = QObject::tr( "INF_NOTHING_ERROR" ); break; } - return status == IFSelect_RetDone; + return status == Interface_RetDone; } bool Translate::exportSTL( const QString& file, const Handle(TopTools_HSequenceOfShape)& shapes ) diff --git a/samples/xaml/MainPage.xaml.cpp b/samples/xaml/MainPage.xaml.cpp index 5466e3b11c..a1fda484c1 100644 --- a/samples/xaml/MainPage.xaml.cpp +++ b/samples/xaml/MainPage.xaml.cpp @@ -326,7 +326,7 @@ Standard_Boolean MainPage::SaveSTEP(const wchar_t* theFilePath, const TopoDS_Sha STEPControl_Writer aWriter; - if (aWriter.Transfer(theShape, theValue) != IFSelect_RetDone) { + if (aWriter.Transfer(theShape, theValue) != Interface_RetDone) { Output_TextBlock->Text += L"Error: cannot translate shape to STEP\n"; return Standard_False; } @@ -336,13 +336,13 @@ Standard_Boolean MainPage::SaveSTEP(const wchar_t* theFilePath, const TopoDS_Sha switch (aWriter.Write(theFilePathA)) { - case IFSelect_RetError: + case Interface_RetError: Output_TextBlock->Text += L"Error: Incorrect Data\n"; break; - case IFSelect_RetFail: + case Interface_RetFail: Output_TextBlock->Text += L"Error: Writing has failed\n"; break; - case IFSelect_RetVoid: + case Interface_RetVoid: Output_TextBlock->Text += L"Error: Nothing to transfer\n"; break; default: @@ -413,7 +413,7 @@ Standard_Boolean MainPage::ReadIGES(const wchar_t* theFilePath, TopoDS_Shape& th char theFilePathA[MAX_PATH]; WideCharToMultiByte(CP_UTF8, 0, theFilePath, -1, theFilePathA, sizeof(theFilePathA), NULL, NULL); - if (Reader.ReadFile(theFilePathA) != IFSelect_RetDone) + if (Reader.ReadFile(theFilePathA) != Interface_RetDone) return Standard_False; Reader.TransferRoots(); @@ -437,13 +437,13 @@ Standard_Boolean MainPage::ReadSTEP(const wchar_t* theFilePath, TopoDS_Shape& th switch (aReader.ReadFile(theFilePathA)) { - case IFSelect_RetError: + case Interface_RetError: Output_TextBlock->Text += L"Error: Not a valid Step file\n"; break; - case IFSelect_RetFail: + case Interface_RetFail: Output_TextBlock->Text += L"Error: Reading has failed\n"; break; - case IFSelect_RetVoid: + case Interface_RetVoid: Output_TextBlock->Text += L"Error: Nothing to transfer\n"; break; default: diff --git a/src/IFSelect/FILES b/src/IFSelect/FILES index 9007358569..028b247b9d 100755 --- a/src/IFSelect/FILES +++ b/src/IFSelect/FILES @@ -1,58 +1,11 @@ -IFSelect_Activator.cxx -IFSelect_Activator.hxx -IFSelect_AppliedModifiers.cxx -IFSelect_AppliedModifiers.hxx -IFSelect_BasicDumper.cxx -IFSelect_BasicDumper.hxx IFSelect_CheckCounter.cxx IFSelect_CheckCounter.hxx -IFSelect_ContextModif.cxx -IFSelect_ContextModif.hxx -IFSelect_ContextWrite.cxx -IFSelect_ContextWrite.hxx -IFSelect_Dispatch.cxx -IFSelect_Dispatch.hxx -IFSelect_DispGlobal.cxx -IFSelect_DispGlobal.hxx -IFSelect_DispPerCount.cxx -IFSelect_DispPerCount.hxx -IFSelect_DispPerFiles.cxx -IFSelect_DispPerFiles.hxx -IFSelect_DispPerOne.cxx -IFSelect_DispPerOne.hxx -IFSelect_DispPerSignature.cxx -IFSelect_DispPerSignature.hxx -IFSelect_EditForm.cxx -IFSelect_EditForm.hxx -IFSelect_Editor.cxx -IFSelect_Editor.hxx -IFSelect_EditValue.hxx -IFSelect_GeneralModifier.cxx -IFSelect_GeneralModifier.hxx IFSelect_GraphCounter.cxx IFSelect_GraphCounter.hxx IFSelect_HSeqOfSelection.hxx IFSelect_IntParam.cxx IFSelect_IntParam.hxx -IFSelect_ListEditor.cxx -IFSelect_ListEditor.hxx -IFSelect_ModelCopier.cxx -IFSelect_ModelCopier.hxx -IFSelect_ModelModifier.gxx -IFSelect_ModifEditForm.cxx -IFSelect_ModifEditForm.hxx -IFSelect_Modifier.cxx -IFSelect_Modifier.hxx -IFSelect_ModifReorder.cxx -IFSelect_ModifReorder.hxx -IFSelect_PacketList.cxx -IFSelect_PacketList.hxx -IFSelect_ParamEditor.cxx -IFSelect_ParamEditor.hxx IFSelect_PrintCount.hxx -IFSelect_PrintFail.hxx -IFSelect_RemainMode.hxx -IFSelect_ReturnStatus.hxx IFSelect_SelectAnyList.cxx IFSelect_SelectAnyList.hxx IFSelect_SelectAnyType.cxx @@ -119,19 +72,7 @@ IFSelect_SelectUnion.cxx IFSelect_SelectUnion.hxx IFSelect_SelectUnknownEntities.cxx IFSelect_SelectUnknownEntities.hxx -IFSelect_SequenceOfAppliedModifiers.hxx -IFSelect_SequenceOfGeneralModifier.hxx IFSelect_SequenceOfInterfaceModel.hxx -IFSelect_SessionDumper.cxx -IFSelect_SessionDumper.hxx -IFSelect_SessionFile.cxx -IFSelect_SessionFile.hxx -IFSelect_SessionPilot.cxx -IFSelect_SessionPilot.hxx -IFSelect_ShareOut.cxx -IFSelect_ShareOut.hxx -IFSelect_ShareOutResult.cxx -IFSelect_ShareOutResult.hxx IFSelect_SignAncestor.cxx IFSelect_SignAncestor.hxx IFSelect_Signature.cxx @@ -148,13 +89,8 @@ IFSelect_SignType.cxx IFSelect_SignType.hxx IFSelect_SignValidity.cxx IFSelect_SignValidity.hxx -IFSelect_Transformer.cxx -IFSelect_Transformer.hxx -IFSelect_TransformStandard.cxx -IFSelect_TransformStandard.hxx -IFSelect_TSeqOfDispatch.hxx IFSelect_TSeqOfSelection.hxx -IFSelect_WorkLibrary.cxx -IFSelect_WorkLibrary.hxx +IFSelect_Vars.cxx +IFSelect_Vars.hxx IFSelect_WorkSession.cxx IFSelect_WorkSession.hxx diff --git a/src/IFSelect/IFSelect_Activator.cxx b/src/IFSelect/IFSelect_Activator.cxx deleted file mode 100644 index 67def97ab0..0000000000 --- a/src/IFSelect/IFSelect_Activator.cxx +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// 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 - -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Activator,MMgt_TShared) - -static Handle(Dico_DictionaryOfInteger) thedico; // = new Dico_DictionaryOfInteger; -static TColStd_SequenceOfInteger thenums, themodes; -static TColStd_SequenceOfTransient theacts; - - - void IFSelect_Activator::Adding - (const Handle(IFSelect_Activator)& actor, - const Standard_Integer number, - const Standard_CString command, - const Standard_Integer mode) -{ - Standard_Boolean deja; - if (thedico.IsNull()) thedico = new Dico_DictionaryOfInteger; - Standard_Integer& num = thedico->NewItem(command,deja,Standard_True); - if (deja) { -#ifdef OCCT_DEBUG - cout<<"**** XSTEP commands, name conflict on "<RemoveItem(command); } - - Standard_Boolean IFSelect_Activator::Select - (const Standard_CString command, Standard_Integer& number, - Handle(IFSelect_Activator)& actor) -{ - Standard_Integer num; - if (!thedico->GetItem(command,num,Standard_False)) return Standard_False; - number = thenums(num); - actor = Handle(IFSelect_Activator)::DownCast(theacts(num)); - return Standard_True; -} - - Standard_Integer IFSelect_Activator::Mode - (const Standard_CString command) -{ - Standard_Integer num; - if (!thedico->GetItem(command,num,Standard_False)) return -1; - return themodes(num); -} - - - Handle(TColStd_HSequenceOfAsciiString) IFSelect_Activator::Commands - (const Standard_Integer mode, const Standard_CString command) -{ - Standard_Integer num; - Dico_IteratorOfDictionaryOfInteger iter (thedico,command); - Handle(TColStd_HSequenceOfAsciiString) list = - new TColStd_HSequenceOfAsciiString(); - for (iter.Start(); iter.More(); iter.Next()) { - if (mode < 0) { - DeclareAndCast(IFSelect_Activator,acti,theacts(iter.Value())); - if (acti.IsNull()) continue; - if (command[0] == '\0' || !strcmp(command,acti->Group()) ) - list->Append(iter.Name()); - } else { - num = iter.Value(); - if (themodes(num) == mode) list->Append(iter.Name()); - } - } - return list; -} - - - IFSelect_Activator::IFSelect_Activator () - : thegroup ("XSTEP") { } - - void IFSelect_Activator::SetForGroup - (const Standard_CString group, const Standard_CString file) - { thegroup.Clear(); thegroup.AssignCat (group); - thefile.Clear(); thefile.AssignCat (file); } - - Standard_CString IFSelect_Activator::Group () const - { return thegroup.ToCString(); } - - Standard_CString IFSelect_Activator::File () const - { return thefile.ToCString(); } diff --git a/src/IFSelect/IFSelect_Activator.hxx b/src/IFSelect/IFSelect_Activator.hxx deleted file mode 100644 index 2f343cc7bc..0000000000 --- a/src/IFSelect/IFSelect_Activator.hxx +++ /dev/null @@ -1,130 +0,0 @@ -// Created on: 1993-07-27 -// Created by: Christian CAILLET -// Copyright (c) 1993-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_Activator_HeaderFile -#define _IFSelect_Activator_HeaderFile - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -class Standard_DomainError; -class TCollection_AsciiString; -class IFSelect_SessionPilot; - - -class IFSelect_Activator; -DEFINE_STANDARD_HANDLE(IFSelect_Activator, MMgt_TShared) - -//! Defines the general frame for working with a SessionPilot. -//! Each Activator treats a set of Commands. Commands are given as -//! alphanumeric strings. They can be of two main forms : -//! - classic, to list, evaluate, enrich the session (by itself) : -//! no specific remark, its complete execution must be described -//! - creation of a new item : instead of creatinf it plus adding -//! it to the session (which is a classic way), it is possible -//! to create it and make it recorded by the SessionPilot : -//! then, the Pilot will add it to the session; this way allows -//! the Pilot to manage itself named items -//! -//! In order to make easier the use of Activator, this class -//! provides a simple way to Select an Actor for a Command : -//! each sub-class of SectionActor defines the command titles it -//! recognizes, plus attaches a Number, unique for this sub-class, -//! to each distinct command title. -//! -//! Each time an action is required, the corresponding Number -//! can then be given to help the selection of the action to do. -//! -//! The result of an Execution must indicate if it is worth to be -//! recorded or not : see method Do -class IFSelect_Activator : public MMgt_TShared -{ - public: - - //! Records, in a Dictionary available for all the Activators, - //! the command title an Activator can process, attached with - //! its number, proper for this Activator - //! allows to distinguish various execution modes - //! 0: default mode; 1 : for xset - Standard_EXPORT static void Adding (const Handle(IFSelect_Activator)& actor, const Standard_Integer number, const Standard_CString command, const Standard_Integer mode); - - //! Allows a self-definition by an Activator of the Commands it - //! processes, call the class method Adding (mode 0) - Standard_EXPORT void Add (const Standard_Integer number, const Standard_CString command) const; - - //! Same as Add but specifies that this command is candidate for - //! xset (creation of items, xset : named items; mode 1) - Standard_EXPORT void AddSet (const Standard_Integer number, const Standard_CString command) const; - - //! Removes a Command, if it is recorded (else, does nothing) - Standard_EXPORT static void Remove (const Standard_CString command); - - //! Selects, for a Command given by its title, an actor with its - //! command number. Returns True if found, False else - Standard_EXPORT static Standard_Boolean Select (const Standard_CString command, Standard_Integer& number, Handle(IFSelect_Activator)& actor); - - //! Returns mode recorded for a command. -1 if not found - Standard_EXPORT static Standard_Integer Mode (const Standard_CString command); - - //! Returns, for a root of command title, the list of possible - //! commands. - //! : -1 (D) for all commands if is empty - //! -1 + command : about a Group , >= 0 see Adding - //! By default, it returns the whole list of known commands. - Standard_EXPORT static Handle(TColStd_HSequenceOfAsciiString) Commands (const Standard_Integer mode = -1, const Standard_CString command = ""); - - //! Tries to execute a Command Line. is the number of the - //! command for this Activator. It Must forecast to record the - //! result of the execution, for need of Undo-Redo - //! Must Returns : 0 for a void command (not to be recorded), - //! 1 if execution OK, -1 if command incorrect, -2 if error - //! on execution - Standard_EXPORT virtual IFSelect_ReturnStatus Do (const Standard_Integer number, const Handle(IFSelect_SessionPilot)& pilot) = 0; - - //! Sends a short help message for a given command identified by - //! it number for this Activator (must take one line max) - Standard_EXPORT virtual Standard_CString Help (const Standard_Integer number) const = 0; - - Standard_EXPORT Standard_CString Group() const; - - Standard_EXPORT Standard_CString File() const; - - //! Group and SetGroup define a "Group of commands" which - //! correspond to an Activator. Default is "XSTEP" - //! Also a file may be attached - Standard_EXPORT void SetForGroup (const Standard_CString group, const Standard_CString file = ""); - - DEFINE_STANDARD_RTTIEXT(IFSelect_Activator,MMgt_TShared) - -protected: - - //! Sets the default values - Standard_EXPORT IFSelect_Activator(); - - private: - - TCollection_AsciiString thegroup; - TCollection_AsciiString thefile; -}; - -#endif // _IFSelect_Activator_HeaderFile diff --git a/src/IFSelect/IFSelect_AppliedModifiers.cxx b/src/IFSelect/IFSelect_AppliedModifiers.cxx deleted file mode 100644 index 52a626c610..0000000000 --- a/src/IFSelect/IFSelect_AppliedModifiers.cxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - - -#include -#include -#include - -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_AppliedModifiers,MMgt_TShared) - -IFSelect_AppliedModifiers::IFSelect_AppliedModifiers - (const Standard_Integer nbmax, const Standard_Integer nbent) - : thelists (nbmax+1) -{ - thenbent = nbent; theentcnt = 0; -} - - Standard_Boolean IFSelect_AppliedModifiers::AddModif - (const Handle(IFSelect_GeneralModifier)& modif) -{ - if (themodifs.Length() >= thelists.NbEntities()) return Standard_False; - themodifs.Append(modif); - thelists.SetNumber (themodifs.Length()); - return Standard_True; -} - - Standard_Boolean IFSelect_AppliedModifiers::AddNum - (const Standard_Integer nument) -{ - thelists.Add (nument); - return Standard_True; -} - - - Standard_Integer IFSelect_AppliedModifiers::Count () const - { return themodifs.Length(); } - - Standard_Boolean IFSelect_AppliedModifiers::Item - (const Standard_Integer num, - Handle(IFSelect_GeneralModifier)& modif, - Standard_Integer& entcount) -{ - if (num < 1 || num > themodifs.Length()) return Standard_False; - modif = themodifs.Value(num); - thelists.SetNumber (num); - theentcnt = thelists.Length(); - entcount = (theentcnt > 0 ? theentcnt : thenbent); - return Standard_True; -} - - Standard_Integer IFSelect_AppliedModifiers::ItemNum - (const Standard_Integer nument) const - { return (theentcnt > 0 ? thelists.Value(nument) : nument); } - - Handle(TColStd_HSequenceOfInteger) IFSelect_AppliedModifiers::ItemList () const -{ - Handle(TColStd_HSequenceOfInteger) list = new TColStd_HSequenceOfInteger(); - Standard_Integer i, nb = (theentcnt > 0 ? theentcnt : thenbent); - for (i = 1; i <= nb; i ++) list->Append (ItemNum(i)); - return list; -} - - Standard_Boolean IFSelect_AppliedModifiers::IsForAll () const - { return (theentcnt == 0); } diff --git a/src/IFSelect/IFSelect_AppliedModifiers.hxx b/src/IFSelect/IFSelect_AppliedModifiers.hxx deleted file mode 100644 index 30cc44ae5c..0000000000 --- a/src/IFSelect/IFSelect_AppliedModifiers.hxx +++ /dev/null @@ -1,133 +0,0 @@ -// Created on: 1994-05-02 -// Created by: Christian CAILLET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_AppliedModifiers_HeaderFile -#define _IFSelect_AppliedModifiers_HeaderFile - -#include -#include - -#include -#include -#include -#include -#include -#include -class IFSelect_GeneralModifier; - - -class IFSelect_AppliedModifiers; -DEFINE_STANDARD_HANDLE(IFSelect_AppliedModifiers, MMgt_TShared) - -//! This class allows to memorize and access to the modifiers -//! which are to be applied to a file. To each modifier, is bound -//! a list of integers (optionnal) : if this list is absent, the -//! modifier applies to all the file. Else, it applies to the -//! entities designated by these numbers in the produced file. -//! -//! To record a modifier, and a possible list of entity numbers -//! to be applied on : -//! AddModif (amodifier); -//! loop on AddNum (anumber); -//! -//! To query it, Count gives the count of recorded modifiers, -//! then for each one : -//! Item (numodif, amodifier, entcount); -//! IsForAll () -> can be called, if True, applies on the whole file -//! -//! for (i = 1; i <= entcount; i ++) -//! nument = ItemNum (i); -> return an entity number -class IFSelect_AppliedModifiers : public MMgt_TShared -{ - -public: - - - //! Creates an AppliedModifiers, ready to record up to - //! modifiers, on a model of entities - Standard_EXPORT IFSelect_AppliedModifiers(const Standard_Integer nbmax, const Standard_Integer nbent); - - //! Records a modifier. By default, it is to apply on all a - //! produced file. Further calls to AddNum will restrict this. - //! Returns True if done, False if too many modifiers are already - //! recorded - Standard_EXPORT Standard_Boolean AddModif (const Handle(IFSelect_GeneralModifier)& modif); - - //! Adds a number of entity of the output file to be applied on. - //! If a sequence of AddNum is called after AddModif, this - //! Modifier will be applied on the list of designated entities. - //! Else, it will be applied on all the file - //! Returns True if done, False if no modifier has yet been added - Standard_EXPORT Standard_Boolean AddNum (const Standard_Integer nument); - - //! Returns the count of recorded modifiers - Standard_EXPORT Standard_Integer Count() const; - - //! Returns the description for applied modifier n0 : - //! the modifier itself, and the count of entities to be applied - //! on. If no specific list of number has been defined, returns - //! the total count of entities of the file - //! If this count is zero, then the modifier applies to all - //! the file (see below). Else, the numbers are then queried by - //! calls to ItemNum between 1 and - //! Returns True if OK, False if is out of range - Standard_EXPORT Standard_Boolean Item (const Standard_Integer num, Handle(IFSelect_GeneralModifier)& modif, Standard_Integer& entcount); - - //! Returns a numero of entity to be applied on, given its rank - //! in the list. If no list is defined (i.e. for all the file), - //! returns itself, to give all the entities of the file - //! Returns 0 if out of range - Standard_EXPORT Standard_Integer ItemNum (const Standard_Integer nument) const; - - //! Returns the list of entities to be applied on (see Item) - //! as a HSequence (IsForAll produces the complete list of all - //! the entity numbers of the file - Standard_EXPORT Handle(TColStd_HSequenceOfInteger) ItemList() const; - - //! Returns True if the applied modifier queried by last call to - //! Item is to be applied to all the produced file. - //! Else, returned by Item gives the count of entity - //! numbers, each one is queried by ItemNum - Standard_EXPORT Standard_Boolean IsForAll() const; - - - - - DEFINE_STANDARD_RTTIEXT(IFSelect_AppliedModifiers,MMgt_TShared) - -protected: - - - - -private: - - - IFSelect_SequenceOfGeneralModifier themodifs; - Interface_IntList thelists; - Standard_Integer thenbent; - Standard_Integer theentcnt; - - -}; - - - - - - - -#endif // _IFSelect_AppliedModifiers_HeaderFile diff --git a/src/IFSelect/IFSelect_BasicDumper.cxx b/src/IFSelect/IFSelect_BasicDumper.cxx deleted file mode 100644 index 7883f84f5e..0000000000 --- a/src/IFSelect/IFSelect_BasicDumper.cxx +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// 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 - -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_BasicDumper,IFSelect_SessionDumper) - -//#include -#define FIRSTCHAR 1 -// Param litteral "own" sous la forme :"" -> first = 3 -// A present, forme simplifiee : directement -> first = 1 - - - -IFSelect_BasicDumper::IFSelect_BasicDumper () { } - - Standard_Boolean IFSelect_BasicDumper::WriteOwn - (IFSelect_SessionFile& file, const Handle(Standard_Transient)& item) const -{ - Handle(Standard_Type) type = item->DynamicType(); - if (type == STANDARD_TYPE(IFSelect_SelectModelRoots)) return Standard_True; - if (type == STANDARD_TYPE(IFSelect_SelectModelEntities)) return Standard_True; - if (type == STANDARD_TYPE(IFSelect_SelectEntityNumber)) { - DeclareAndCast(IFSelect_SelectEntityNumber,sen,item); - file.SendItem(sen->Number()); - return Standard_True; - } - if (type == STANDARD_TYPE(IFSelect_SelectPointed)) return Standard_True; - if (type == STANDARD_TYPE(IFSelect_SelectUnion)) return Standard_True; - if (type == STANDARD_TYPE(IFSelect_SelectIntersection)) return Standard_True; - if (type == STANDARD_TYPE(IFSelect_SelectDiff)) return Standard_True; - if (type == STANDARD_TYPE(IFSelect_SelectUnknownEntities)) return Standard_True; - if (type == STANDARD_TYPE(IFSelect_SelectErrorEntities)) return Standard_True; - if (type == STANDARD_TYPE(IFSelect_SelectIncorrectEntities)) return Standard_True; - if (type == STANDARD_TYPE(IFSelect_SelectRoots)) return Standard_True; - if (type == STANDARD_TYPE(IFSelect_SelectRootComps)) return Standard_True; - if (type == STANDARD_TYPE(IFSelect_SelectRange)) { - DeclareAndCast(IFSelect_SelectRange,sra,item); - file.SendItem(sra->Lower()); - file.SendItem(sra->Upper()); - return Standard_True; - } - if (type == STANDARD_TYPE(IFSelect_SelectShared)) return Standard_True; - if (type == STANDARD_TYPE(IFSelect_SelectSharing)) return Standard_True; - - if (type == STANDARD_TYPE(IFSelect_DispPerOne)) return Standard_True; - if (type == STANDARD_TYPE(IFSelect_DispGlobal)) return Standard_True; - if (type == STANDARD_TYPE(IFSelect_DispPerCount)) { - DeclareAndCast(IFSelect_DispPerCount,dpc,item); - file.SendItem(dpc->Count()); - return Standard_True; - } - - if (type == STANDARD_TYPE(IFSelect_TransformStandard)) { - DeclareAndCast(IFSelect_TransformStandard,trs,item); - if (trs->CopyOption()) file.SendText("copy"); - else file.SendText("onthespot"); - Standard_Integer nbm = trs->NbModifiers(); - for (Standard_Integer i = 1; i <= nbm; i ++) - file.SendItem(trs->Modifier(i)); - } - - return Standard_False; -} - - Standard_Boolean IFSelect_BasicDumper::ReadOwn - (IFSelect_SessionFile& file, const TCollection_AsciiString& type, - Handle(Standard_Transient)& item) const -{ - if (type.IsEqual("IFSelect_SelectModelRoots")) - { item = new IFSelect_SelectModelRoots (); return Standard_True; } - if (type.IsEqual("IFSelect_SelectModelEntities")) - { item = new IFSelect_SelectModelEntities (); return Standard_True; } - if (type.IsEqual("IFSelect_SelectEntityNumber")) { - Handle(IFSelect_SelectEntityNumber) sen = - new IFSelect_SelectEntityNumber (); - sen->SetNumber (GetCasted(IFSelect_IntParam,file.ItemValue(1))); - item = sen; - return Standard_True; - } - if (type.IsEqual("IFSelect_SelectPointed")) - { item = new IFSelect_SelectPointed; return Standard_True; } - if (type.IsEqual("IFSelect_SelectUnion")) - { item = new IFSelect_SelectUnion; return Standard_True; } - if (type.IsEqual("IFSelect_SelectIntersection")) - { item = new IFSelect_SelectIntersection; return Standard_True; } - if (type.IsEqual("IFSelect_SelectDiff")) - { item = new IFSelect_SelectDiff; return Standard_True; } - if (type.IsEqual("IFSelect_SelectUnknownEntities")) - { item = new IFSelect_SelectUnknownEntities; return Standard_True; } - if (type.IsEqual("IFSelect_SelectErrorEntities")) - { item = new IFSelect_SelectErrorEntities; return Standard_True; } - if (type.IsEqual("IFSelect_SelectIncorrectEntities")) - { item = new IFSelect_SelectIncorrectEntities; return Standard_True; } - if (type.IsEqual("IFSelect_SelectRoots")) - { item = new IFSelect_SelectRoots; return Standard_True; } - if (type.IsEqual("IFSelect_SelectRootComps")) - { item = new IFSelect_SelectRootComps; return Standard_True; } - if (type.IsEqual("IFSelect_SelectRange")) { - Handle(IFSelect_SelectRange) sra = new IFSelect_SelectRange; - sra->SetRange (GetCasted(IFSelect_IntParam,file.ItemValue(1)), - GetCasted(IFSelect_IntParam,file.ItemValue(2)) ); - item = sra; - return Standard_True; - } - if (type.IsEqual("IFSelect_SelectTextType")) { - const TCollection_AsciiString exname = file.ParamValue(1); - if (exname.Length() < FIRSTCHAR) return Standard_False; - if (exname.Value(FIRSTCHAR) == 'e') {} - else if (exname.Value(FIRSTCHAR) == 'c') {} - else return Standard_False; -// item = new IFSelect_SelectTextType (file.TextValue(2).ToCString(),exact); -// return Standard_True; - } - if (type.IsEqual("IFSelect_SelectShared")) - { item = new IFSelect_SelectShared; return Standard_True; } - if (type.IsEqual("IFSelect_SelectSharing")) - { item = new IFSelect_SelectSharing; return Standard_True; } - - if (type.IsEqual("IFSelect_DispPerOne")) - { item = new IFSelect_DispPerOne; return Standard_True; } - if (type.IsEqual("IFSelect_DispGlobal")) - { item = new IFSelect_DispGlobal; return Standard_True; } - if (type.IsEqual("IFSelect_DispPerCount")) { - Handle(IFSelect_DispPerCount) dpc = new IFSelect_DispPerCount; - dpc->SetCount (GetCasted(IFSelect_IntParam,file.ItemValue(1)) ); - item = dpc; - return Standard_True; - } - - if (type.IsEqual("IFSelect_TransformStandard")) { - Standard_Boolean copyoption; - const TCollection_AsciiString copyname = file.ParamValue(1); - if (copyname.Length() < FIRSTCHAR) return Standard_False; - if (copyname.Value(FIRSTCHAR) == 'c') copyoption = Standard_True; - else if (copyname.Value(FIRSTCHAR) == 'o') copyoption = Standard_False; - else return Standard_False; - Handle(IFSelect_TransformStandard) trs = new IFSelect_TransformStandard; - trs->SetCopyOption(copyoption); - Standard_Integer nbp = file.NbParams(); - for (Standard_Integer i = 2; i <= nbp; i ++) { - DeclareAndCast(IFSelect_Modifier,modif,file.ItemValue(i)); - if (!modif.IsNull()) trs->AddModifier(modif); - } - item = trs; - return Standard_True; - } - - return Standard_False; -} diff --git a/src/IFSelect/IFSelect_BasicDumper.hxx b/src/IFSelect/IFSelect_BasicDumper.hxx deleted file mode 100644 index f89baf13ab..0000000000 --- a/src/IFSelect/IFSelect_BasicDumper.hxx +++ /dev/null @@ -1,76 +0,0 @@ -// Created on: 1993-11-04 -// Created by: Christian CAILLET -// Copyright (c) 1993-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_BasicDumper_HeaderFile -#define _IFSelect_BasicDumper_HeaderFile - -#include -#include - -#include -#include -class IFSelect_SessionFile; -class Standard_Transient; -class TCollection_AsciiString; - - -class IFSelect_BasicDumper; -DEFINE_STANDARD_HANDLE(IFSelect_BasicDumper, IFSelect_SessionDumper) - -//! BasicDumper takes into account, for SessionFile, all the -//! classes defined in the package IFSelect : Selections, -//! Dispatches (there is no Modifier) -class IFSelect_BasicDumper : public IFSelect_SessionDumper -{ - -public: - - - //! Creates a BasicDumper and puts it into the Library of Dumper - Standard_EXPORT IFSelect_BasicDumper(); - - //! Write the Own Parameters of Types defined in package IFSelect - //! Returns True if has been processed, False else - Standard_EXPORT Standard_Boolean WriteOwn (IFSelect_SessionFile& file, const Handle(Standard_Transient)& item) const Standard_OVERRIDE; - - //! Recognizes and Read Own Parameters for Types of package - //! IFSelect. Returns True if done and created, False else - Standard_EXPORT Standard_Boolean ReadOwn (IFSelect_SessionFile& file, const TCollection_AsciiString& type, Handle(Standard_Transient)& item) const Standard_OVERRIDE; - - - - - DEFINE_STANDARD_RTTIEXT(IFSelect_BasicDumper,IFSelect_SessionDumper) - -protected: - - - - -private: - - - - -}; - - - - - - - -#endif // _IFSelect_BasicDumper_HeaderFile diff --git a/src/IFSelect/IFSelect_ContextModif.cxx b/src/IFSelect/IFSelect_ContextModif.cxx deleted file mode 100644 index 508d43f746..0000000000 --- a/src/IFSelect/IFSelect_ContextModif.cxx +++ /dev/null @@ -1,464 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// 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 - -//======================================================================= -//function : IFSelect_ContextModif -//purpose : -//======================================================================= -IFSelect_ContextModif::IFSelect_ContextModif(const Interface_Graph& graph, - const Interface_CopyTool& TC, - const Standard_CString filename) - : thegraf (graph,Standard_False) , thefile (filename) , - thelist (graph.Size(),' ') -{ - themap = TC.Control(); thesel = Standard_False; thecurr = thecurt = 0; - Standard_Integer nb = thelist.Length(); - Handle(Standard_Transient) newent; - for (Standard_Integer i = 1; i <= nb; i ++) { - if (themap->Search(graph.Entity(i),newent)) thelist.SetValue(i,'1'); - } -} - - -//======================================================================= -//function : IFSelect_ContextModif -//purpose : -//======================================================================= - -IFSelect_ContextModif::IFSelect_ContextModif(const Interface_Graph& graph, - const Standard_CString filename) - : thegraf (graph,Standard_False) , thefile (filename) , - thelist (graph.Size(),' ') -{ - thesel = Standard_False; thecurr = thecurt = 0; - Standard_Integer nb = thelist.Length(); - Handle(Standard_Transient) newent; - for (Standard_Integer i = 1; i <= nb; i ++) thelist.SetValue(i,'1'); -} - - -//======================================================================= -//function : Select -//purpose : -//======================================================================= - -void IFSelect_ContextModif::Select (Interface_EntityIterator& list) -{ - thesel = Standard_True; - Standard_Integer nb = thelist.Length(); - for (Standard_Integer i = 1; i <= nb; i ++) thelist.SetValue(i,' '); - for (list.Start(); list.More(); list.Next()) { - Handle(Standard_Transient) start,newent; - start = list.Value(); - Standard_Integer num = thegraf.EntityNumber(start); - if (num > nb || num < 0) num = 0; - if (themap.IsNull() && num > 0) thelist.SetValue(num,'1'); - else if (themap->Search (start,newent)) { - if (num > 0) thelist.SetValue(num,'1'); - } - } -} - - -//======================================================================= -//function : OriginalGraph -//purpose : -//======================================================================= - -const Interface_Graph& IFSelect_ContextModif::OriginalGraph () const -{ - return thegraf; -} - - -//======================================================================= -//function : OriginalModel -//purpose : -//======================================================================= - -Handle(Interface_InterfaceModel) IFSelect_ContextModif::OriginalModel() const -{ - return thegraf.Model(); -} - - -//======================================================================= -//function : SetProtocol -//purpose : -//======================================================================= - -void IFSelect_ContextModif::SetProtocol(const Handle(Interface_Protocol)& prot) -{ - theprot = prot; -} - - -//======================================================================= -//function : Protocol -//purpose : -//======================================================================= - -Handle(Interface_Protocol) IFSelect_ContextModif::Protocol() const -{ - return theprot; -} - - -//======================================================================= -//function : HasFileName -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_ContextModif::HasFileName() const -{ - return (thefile.Length() > 0); -} - - -//======================================================================= -//function : FileName -//purpose : -//======================================================================= - -Standard_CString IFSelect_ContextModif::FileName () const -{ - return thefile.ToCString(); -} - - -//======================================================================= -//function : Control -//purpose : -//======================================================================= - -Handle(Interface_CopyControl) IFSelect_ContextModif::Control () const -{ - return themap; -} - - -//======================================================================= -//function : IsForNone -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_ContextModif::IsForNone () const -{ - if (!thesel) return Standard_False; - Standard_Integer nb = thelist.Length(); - for (Standard_Integer i = 1; i <= nb; i ++) { - if (thelist.Value(i) != ' ') return Standard_False; - } - return Standard_True; -} - - -//======================================================================= -//function : IsForAll -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_ContextModif::IsForAll () const -{ - return (!thesel); -} - - -//======================================================================= -//function : IsTransferred -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_ContextModif::IsTransferred - (const Handle(Standard_Transient)& ent) const -{ - if (themap.IsNull()) return Standard_True; - Handle(Standard_Transient) newent; - return themap->Search(ent,newent); -} - - -//======================================================================= -//function : IsSelected -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_ContextModif::IsSelected - (const Handle(Standard_Transient)& ent) const -{ - // Select a deja verifie "IsTransferred" - Standard_Integer num = thegraf.EntityNumber(ent); - if (num == 0) return Standard_False; - return (thelist.Value(num) != ' '); -} - - -//======================================================================= -//function : SelectedOriginal -//purpose : -//======================================================================= - -Interface_EntityIterator IFSelect_ContextModif::SelectedOriginal () const -{ - Interface_EntityIterator list; - Standard_Integer nb = thelist.Length(); - for (Standard_Integer i = 1; i <= nb; i ++) { - if (thelist.Value(i) != ' ') list.GetOneItem (thegraf.Entity(i)); - } - return list; -} - - -//======================================================================= -//function : SelectedResult -//purpose : -//======================================================================= - -Interface_EntityIterator IFSelect_ContextModif::SelectedResult () const -{ - Interface_EntityIterator list; - Standard_Integer nb = thelist.Length(); - for (Standard_Integer i = 1; i <= nb; i ++) { - Handle(Standard_Transient) newent; - if (themap.IsNull()) newent = thegraf.Entity(i); - else if (thelist.Value(i) != ' ') themap->Search (thegraf.Entity(i),newent); - if (!newent.IsNull()) list.GetOneItem (newent); - } - return list; -} - - -//======================================================================= -//function : SelectedCount -//purpose : -//======================================================================= - -Standard_Integer IFSelect_ContextModif::SelectedCount () const -{ - Standard_Integer nb = thelist.Length(); - Standard_Integer ns = 0; - for (Standard_Integer i = 1; i <= nb; i ++) - { if (thelist.Value(i) != ' ') ns ++; } - return ns; -} - - -//======================================================================= -//function : Start -//purpose : -//======================================================================= - -void IFSelect_ContextModif::Start () -{ - thecurr = thecurt = 0; - Next(); -} - - -//======================================================================= -//function : More -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_ContextModif::More () const -{ - return (thecurr > 0); -} - - -//======================================================================= -//function : Next -//purpose : -//======================================================================= - -void IFSelect_ContextModif::Next() -{ - Standard_Integer nb = thelist.Length(); -// thecurr = thecurt; -// if (thecurr <= 0 && thecurt >= 0) return; - for (Standard_Integer i = thecurr+1; i <= nb; i ++) { - if (thelist.Value(i) != ' ') { thecurr = i; thecurt ++; return; } - } - thecurr = thecurt = 0; -} - - -//======================================================================= -//function : ValueOriginal -//purpose : -//======================================================================= - -Handle(Standard_Transient) IFSelect_ContextModif::ValueOriginal () const -{ - if (thecurr <= 0) Standard_NoSuchObject::Raise("IFSelect_ContextModif"); - return thegraf.Entity(thecurr); -} - - -//======================================================================= -//function : ValueResult -//purpose : -//======================================================================= - -Handle(Standard_Transient) IFSelect_ContextModif::ValueResult () const -{ - if (thecurr <= 0) Standard_NoSuchObject::Raise("IFSelect_ContextModif"); - Handle(Standard_Transient) ent,newent; - ent = thegraf.Entity(thecurr); - if (themap.IsNull()) newent = ent; - else themap->Search(ent,newent); - return newent; -} - - -//======================================================================= -//function : TraceModifier -//purpose : -//======================================================================= - -void IFSelect_ContextModif::TraceModifier - (const Handle(IFSelect_GeneralModifier)& modif) -{ - if (modif.IsNull()) return; - - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - sout << "--- Run Modifier:" << endl; - Handle(IFSelect_Selection) sel = modif->Selection(); - if (!sel.IsNull()) sout<<" Selection:"<Label(); - else sout<<" (no Selection)"; - -// on va simplement compter les entites - Standard_Integer ne = 0, nb = thelist.Length(); - for (Standard_Integer i = 1; i <= nb; i ++) { - if (thelist.Value(i) != ' ') ne ++; - } - if (nb == ne) sout<<" All Model ("<NbFails() + check->NbWarnings() == 0) return; - const Handle(Standard_Transient)& ent = check->Entity(); - Standard_Integer num = thegraf.EntityNumber(ent); - if (num == 0 && !ent.IsNull()) num = -1; // force enregistrement - thechek.Add(check,num); -} - - -//======================================================================= -//function : AddWarning -//purpose : -//======================================================================= - -void IFSelect_ContextModif::AddWarning(const Handle(Standard_Transient)& start, - const Standard_CString mess, - const Standard_CString orig) -{ - thechek.CCheck(thegraf.EntityNumber(start))->AddWarning(mess,orig); -} - - -//======================================================================= -//function : AddFail -//purpose : -//======================================================================= - -void IFSelect_ContextModif::AddFail(const Handle(Standard_Transient)& start, - const Standard_CString mess, - const Standard_CString orig) -{ - thechek.CCheck(thegraf.EntityNumber(start))->AddFail(mess,orig); -} - - -//======================================================================= -//function : CCheck -//purpose : -//======================================================================= - -Handle(Interface_Check) IFSelect_ContextModif::CCheck(const Standard_Integer num) -{ - Handle(Interface_Check) ach = thechek.CCheck(num); - if (num > 0 && num <= thegraf.Size()) ach->SetEntity(thegraf.Entity(num)); - return ach; -} - - -//======================================================================= -//function : CCheck -//purpose : -//======================================================================= - -Handle(Interface_Check) IFSelect_ContextModif::CCheck - (const Handle(Standard_Transient)& ent) -{ - Standard_Integer num = thegraf.EntityNumber(ent); - if (num == 0) num = -1; // force l enregistrement - Handle(Interface_Check)& ach = thechek.CCheck(num); - ach->SetEntity(ent); - return ach; -} - - -//======================================================================= -//function : CheckList -//purpose : -//======================================================================= - -Interface_CheckIterator IFSelect_ContextModif::CheckList () const -{ - return thechek; -} diff --git a/src/IFSelect/IFSelect_ContextModif.hxx b/src/IFSelect/IFSelect_ContextModif.hxx deleted file mode 100644 index 5eb80dd57d..0000000000 --- a/src/IFSelect/IFSelect_ContextModif.hxx +++ /dev/null @@ -1,241 +0,0 @@ -// Created on: 1994-06-08 -// Created by: Christian CAILLET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_ContextModif_HeaderFile -#define _IFSelect_ContextModif_HeaderFile - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -class Interface_Protocol; -class Interface_CopyControl; -class Standard_NoSuchObject; -class Interface_Graph; -class Interface_CopyTool; -class Interface_EntityIterator; -class Interface_InterfaceModel; -class Standard_Transient; -class IFSelect_GeneralModifier; -class Interface_Check; -class Interface_CheckIterator; - - -//! This class gathers various informations used by Model Modifiers -//! apart from the target model itself, and the CopyTool which -//! must be passed directly. -//! -//! These informations report to original data : model, entities, -//! and the selection list if there is one : it allows to query -//! about such or such starting entity, or result entity, or -//! iterate on selection list ... -//! Also data useful for file output are available (because some -//! Modifiers concern models produced for file output). -//! -//! Furthermore, in return, ContextModif can record Checks, either -//! one for all, or one for each Entity. It supports trace too. -class IFSelect_ContextModif -{ -public: - - DEFINE_STANDARD_ALLOC - - - //! Prepares a ContextModif with these informations : - //! - the graph established from original model (target passed - //! directly to Modifier) - //! - the CopyTool which detains the CopyControl, which maps - //! starting (in original) and result (in target) entities - //! - an optional file name (for file output) - //! - //! Such a ContextModif is considered to be applied on all - //! transferred entities (no filter active) - Standard_EXPORT IFSelect_ContextModif(const Interface_Graph& graph, const Interface_CopyTool& TC, const Standard_CString filename = ""); - - //! Prepares a ContextModif with these informations : - //! - the graph established from original model (target passed - //! directly to Modifier) - //! - an optional file name (for file output) - //! Here, no CopyControl, hence all entities are considered equal - //! as starting and result - //! - //! Such a ContextModif is considered to be applied on all - //! transferred entities (no filter active) - Standard_EXPORT IFSelect_ContextModif(const Interface_Graph& graph, const Standard_CString filename = ""); - - //! This method requires ContextModif to be applied with a filter. - //! If a ModelModifier is defined with a Selection criterium, - //! the result of this Selection is used as a filter : - //! - if none of its items has been transferred, the modification - //! does not apply at all - //! - else, the Modifier can query for what entities were selected - //! and what are their results - //! - if this method is not called before working, the Modifier - //! has to work on the whole Model - Standard_EXPORT void Select (Interface_EntityIterator& list); - - //! Returns the original Graph (compared to OriginalModel, it - //! gives more query capabilitites) - Standard_EXPORT const Interface_Graph& OriginalGraph() const; - - //! Returns the original model - Standard_EXPORT Handle(Interface_InterfaceModel) OriginalModel() const; - - //! Allows to transmit a Protocol as part of a ContextModif - Standard_EXPORT void SetProtocol (const Handle(Interface_Protocol)& proto); - - //! Returns the Protocol (Null if not set) - Standard_EXPORT Handle(Interface_Protocol) Protocol() const; - - //! Returns True if a non empty file name has been defined - Standard_EXPORT Standard_Boolean HasFileName() const; - - //! Returns File Name (can be empty) - Standard_EXPORT Standard_CString FileName() const; - - //! Returns the map for a direct use, if required - Standard_EXPORT Handle(Interface_CopyControl) Control() const; - - //! Returns True if Select has determined that a Modifier may not - //! be run (filter defined and empty) - Standard_EXPORT Standard_Boolean IsForNone() const; - - //! Returns True if no filter is defined : a Modifier has to work - //! on all entities of the resulting (target) model - Standard_EXPORT Standard_Boolean IsForAll() const; - - //! Returns True if a starting item has been transferred - Standard_EXPORT Standard_Boolean IsTransferred (const Handle(Standard_Transient)& ent) const; - - //! Returns True if a starting item has been transferred and selected - Standard_EXPORT Standard_Boolean IsSelected (const Handle(Standard_Transient)& ent) const; - - //! Returns True if a starting entity has been transferred, and - //! the result is in . Returns False else - //! (direct call to the map) - Standard_EXPORT Standard_Boolean Search (const Handle(Standard_Transient)& ent, Handle(Standard_Transient)& res) const; - - //! Returns the list of original selected items. - //! See also the iteration - Standard_EXPORT Interface_EntityIterator SelectedOriginal() const; - - //! Returns the list of resulting counterparts of selected items. - //! See also the iteration - Standard_EXPORT Interface_EntityIterator SelectedResult() const; - - //! Returns the count of selected and transferred items - Standard_EXPORT Standard_Integer SelectedCount() const; - - //! Starts an iteration on selected items. It takes into account - //! IsForAll/IsForNone, by really iterating on all selected items. - Standard_EXPORT void Start(); - - //! Returns True until the iteration has finished - Standard_EXPORT Standard_Boolean More() const; - - //! Advances the iteration - Standard_EXPORT void Next(); - - //! Returns the current selected item in the original model - Standard_EXPORT Handle(Standard_Transient) ValueOriginal() const; - - //! Returns the result counterpart of current selected item - //! (in the target model) - Standard_EXPORT Handle(Standard_Transient) ValueResult() const; - - //! Traces the application of a Modifier. Works with default trace - //! File and Level. Fills the trace if default trace level is at - //! least 1. Traces the Modifier (its Label) and its Selection if - //! there is one (its Label). - //! To be called after Select (because status IsForAll is printed) - //! Worths to trace a global modification. See also Trace below - Standard_EXPORT void TraceModifier (const Handle(IFSelect_GeneralModifier)& modif); - - //! Traces the modification of the current entity (see above, - //! ValueOriginal and ValueResult) for default trace level >= 2. - //! To be called on each indivudual entity really modified - //! is an optionnal additional message - Standard_EXPORT void Trace (const Standard_CString mess = ""); - - //! Adds a Check to the CheckList. If it is empty, nothing is done - //! If it concerns an Entity from the Original Model (by SetEntity) - //! to which another Check is attached, it is merged to it. - //! Else, it is added or merged as to GlobalCheck. - Standard_EXPORT void AddCheck (const Handle(Interface_Check)& check); - - //! Adds a Warning Message for an Entity from the original Model - //! If is not an Entity from the original model (e.g. the - //! model itself) this message is added to Global Check. - Standard_EXPORT void AddWarning (const Handle(Standard_Transient)& start, const Standard_CString mess, const Standard_CString orig = ""); - - //! Adds a Fail Message for an Entity from the original Model - //! If is not an Entity from the original model (e.g. the - //! model itself) this message is added to Global Check. - Standard_EXPORT void AddFail (const Handle(Standard_Transient)& start, const Standard_CString mess, const Standard_CString orig = ""); - - //! Returns a Check given an Entity number (in the original Model) - //! by default a Global Check. Creates it the first time. - //! It can then be acknowledged on the spot, in condition that the - //! caller works by reference ("Interface_Check& check = ...") - Standard_EXPORT Handle(Interface_Check) CCheck (const Standard_Integer num = 0); - - //! Returns a Check attached to an Entity from the original Model - //! It can then be acknowledged on the spot, in condition that the - //! caller works by reference ("Interface_Check& check = ...") - Standard_EXPORT Handle(Interface_Check) CCheck (const Handle(Standard_Transient)& start); - - //! Returns the complete CheckList - Standard_EXPORT Interface_CheckIterator CheckList() const; - - - - -protected: - - - - - -private: - - - - Interface_Graph thegraf; - Handle(Interface_Protocol) theprot; - Handle(Interface_CopyControl) themap; - TCollection_AsciiString thefile; - TCollection_AsciiString thelist; - Interface_CheckIterator thechek; - Standard_Boolean thesel; - Standard_Integer thecurr; - Standard_Integer thecurt; - - -}; - - - - - - - -#endif // _IFSelect_ContextModif_HeaderFile diff --git a/src/IFSelect/IFSelect_ContextWrite.cxx b/src/IFSelect/IFSelect_ContextWrite.cxx deleted file mode 100644 index 8bd9f61f7b..0000000000 --- a/src/IFSelect/IFSelect_ContextWrite.cxx +++ /dev/null @@ -1,298 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// 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 - -//======================================================================= -//function : IFSelect_ContextWrite -//purpose : -//======================================================================= -IFSelect_ContextWrite::IFSelect_ContextWrite - (const Handle(Interface_InterfaceModel)& model, - const Handle(Interface_Protocol)& proto, - const Handle(IFSelect_AppliedModifiers)& applieds, - const Standard_CString filename) - : themodel (model) , theproto (proto) , thefile (filename) , - theapply (applieds) , thenumod(0) , thenbent (0) , thecurr (0) { } - - -//======================================================================= -//function : IFSelect_ContextWrite -//purpose : -//======================================================================= - -IFSelect_ContextWrite::IFSelect_ContextWrite - (const Handle(Interface_HGraph)& hgraph, - const Handle(Interface_Protocol)& proto, - const Handle(IFSelect_AppliedModifiers)& applieds, - const Standard_CString filename) - : themodel (hgraph->Graph().Model()) , - theproto (proto) , thefile (filename) , theapply (applieds) , - thehgraf (hgraph) , thenumod(0) , thenbent (0) , thecurr (0) { } - - -//======================================================================= -//function : Model -//purpose : -//======================================================================= - -Handle(Interface_InterfaceModel) IFSelect_ContextWrite::Model () const -{ - return themodel; -} - - -//======================================================================= -//function : Protocol -//purpose : -//======================================================================= - -Handle(Interface_Protocol) IFSelect_ContextWrite::Protocol () const -{ - return theproto; -} - - -//======================================================================= -//function : FileName -//purpose : -//======================================================================= - -Standard_CString IFSelect_ContextWrite::FileName () const -{ - return thefile.ToCString(); -} - - -//======================================================================= -//function : AppliedModifiers -//purpose : -//======================================================================= - -Handle(IFSelect_AppliedModifiers) IFSelect_ContextWrite::AppliedModifiers () const -{ - return theapply; -} - - -//======================================================================= -//function : Graph -//purpose : -//======================================================================= - -const Interface_Graph& IFSelect_ContextWrite::Graph () -{ - if (thehgraf.IsNull()) thehgraf = new Interface_HGraph(themodel,theproto); - return thehgraf->Graph(); -} - - -//======================================================================= -//function : NbModifiers -//purpose : -//======================================================================= - -Standard_Integer IFSelect_ContextWrite::NbModifiers () const - { return (theapply.IsNull() ? 0 : theapply->Count()); } - - Standard_Boolean IFSelect_ContextWrite::SetModifier - (const Standard_Integer numod) -{ - themodif.Nullify(); thenumod = thenbent = thecurr = 0; - if (theapply.IsNull()) return Standard_False; - if (numod < 1 || numod > theapply->Count()) return Standard_False; - theapply->Item(numod,themodif,thenbent); - return Standard_True; -} - - -//======================================================================= -//function : FileModifier -//purpose : -//======================================================================= - -Handle(IFSelect_GeneralModifier) IFSelect_ContextWrite::FileModifier () const -{ - return themodif; -} - - -//======================================================================= -//function : IsForNone -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_ContextWrite::IsForNone () const -{ - return (thenbent == 0); -} - - -//======================================================================= -//function : IsForAll -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_ContextWrite::IsForAll () const -{ - return theapply->IsForAll(); -} - - -//======================================================================= -//function : NbEntities -//purpose : -//======================================================================= - -Standard_Integer IFSelect_ContextWrite::NbEntities () const -{ - return thenbent; -} - - -//======================================================================= -//function : Start -//purpose : -//======================================================================= - -void IFSelect_ContextWrite::Start () -{ - thecurr = 1; -} - - -//======================================================================= -//function : More -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_ContextWrite::More () const -{ - return (thecurr <= thenbent); -} - - -//======================================================================= -//function : Next -//purpose : -//======================================================================= - -void IFSelect_ContextWrite::Next () -{ - thecurr ++; -} - - -//======================================================================= -//function : Value -//purpose : -//======================================================================= - -Handle(Standard_Transient) IFSelect_ContextWrite::Value() const -{ - if (thecurr < 1 || thecurr > thenbent) - Standard_NoSuchObject::Raise("IFSelect_ContextWrite:Value"); - Standard_Integer num = theapply->ItemNum (thecurr); - return themodel->Value(num); -} - - -//======================================================================= -//function : AddCheck -//purpose : -//======================================================================= - -void IFSelect_ContextWrite::AddCheck (const Handle(Interface_Check)& check) -{ - if (check->NbFails() + check->NbWarnings() == 0) return; - const Handle(Standard_Transient)& ent = check->Entity(); - Standard_Integer num = themodel->Number(ent); - if (num == 0 && !ent.IsNull()) num = -1; // force enregistrement - thecheck.Add(check,num); -} - - -//======================================================================= -//function : AddWarning -//purpose : -//======================================================================= - -void IFSelect_ContextWrite::AddWarning(const Handle(Standard_Transient)& start, - const Standard_CString mess, - const Standard_CString orig) -{ - thecheck.CCheck(themodel->Number(start))->AddWarning(mess,orig); -} - - -//======================================================================= -//function : AddFail -//purpose : -//======================================================================= - -void IFSelect_ContextWrite::AddFail(const Handle(Standard_Transient)& start, - const Standard_CString mess, - const Standard_CString orig) -{ - thecheck.CCheck(themodel->Number(start))->AddFail(mess,orig); -} - - -//======================================================================= -//function : CCheck -//purpose : -//======================================================================= - -Handle(Interface_Check) IFSelect_ContextWrite::CCheck (const Standard_Integer num) -{ - Handle(Interface_Check) ach = thecheck.CCheck(num); - if (num > 0 && num <= themodel->NbEntities()) ach->SetEntity(themodel->Value(num)); - return ach; -} - - -//======================================================================= -//function : CCheck -//purpose : -//======================================================================= - -Handle(Interface_Check) IFSelect_ContextWrite::CCheck(const Handle(Standard_Transient)& ent) -{ - Standard_Integer num = themodel->Number(ent); - if (num == 0) num = -1; // force l enregistrement - Handle(Interface_Check) ach = thecheck.CCheck(num); - ach->SetEntity(ent); - return ach; -} - - -//======================================================================= -//function : CheckList -//purpose : -//======================================================================= - -Interface_CheckIterator IFSelect_ContextWrite::CheckList () const -{ - return thecheck; -} diff --git a/src/IFSelect/IFSelect_ContextWrite.hxx b/src/IFSelect/IFSelect_ContextWrite.hxx deleted file mode 100644 index f064f89a6b..0000000000 --- a/src/IFSelect/IFSelect_ContextWrite.hxx +++ /dev/null @@ -1,185 +0,0 @@ -// Created on: 1996-01-26 -// Created by: Christian CAILLET -// Copyright (c) 1996-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_ContextWrite_HeaderFile -#define _IFSelect_ContextWrite_HeaderFile - -#include -#include -#include - -#include -#include -#include -#include -#include -class Interface_InterfaceModel; -class Interface_Protocol; -class IFSelect_AppliedModifiers; -class Interface_HGraph; -class IFSelect_GeneralModifier; -class Standard_NoSuchObject; -class Interface_Graph; -class Standard_Transient; -class Interface_Check; -class Interface_CheckIterator; - - -//! This class gathers various informations used by File Modifiers -//! apart from the writer object, which is specific of the norm -//! and of the physical format -//! -//! These informations are controlled by an object AppliedModifiers -//! (if it is not defined, no modification is allowed on writing) -//! -//! Furthermore, in return, ContextModif can record Checks, either -//! one for all, or one for each Entity. It supports trace too. -class IFSelect_ContextWrite -{ -public: - - DEFINE_STANDARD_ALLOC - - - //! Prepares a ContextWrite with these informations : - //! - the model which is to be written - //! - the protocol to be used - //! - the filename - //! - an object AppliedModifiers to work. It gives a list of - //! FileModifiers to be ran, and for each one it can give - //! a restricted list of entities (in the model), else all - //! the model is considered - Standard_EXPORT IFSelect_ContextWrite(const Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& proto, const Handle(IFSelect_AppliedModifiers)& applieds, const Standard_CString filename); - - //! Same as above but with an already computed Graph - Standard_EXPORT IFSelect_ContextWrite(const Handle(Interface_HGraph)& hgraph, const Handle(Interface_Protocol)& proto, const Handle(IFSelect_AppliedModifiers)& applieds, const Standard_CString filename); - - //! Returns the Model - Standard_EXPORT Handle(Interface_InterfaceModel) Model() const; - - //! Returns the Protocol; - Standard_EXPORT Handle(Interface_Protocol) Protocol() const; - - //! Returns the File Name - Standard_EXPORT Standard_CString FileName() const; - - //! Returns the object AppliedModifiers - Standard_EXPORT Handle(IFSelect_AppliedModifiers) AppliedModifiers() const; - - //! Returns the Graph, either given when created, else created - //! the first time it is queried - Standard_EXPORT const Interface_Graph& Graph(); - - //! Returns the count of recorded File Modifiers - Standard_EXPORT Standard_Integer NbModifiers() const; - - //! Sets active the File Modifier n0 - //! Then, it prepares the list of entities to consider, if any - //! Returns False if out of range - Standard_EXPORT Standard_Boolean SetModifier (const Standard_Integer numod); - - //! Returns the currently active File Modifier. Cast to be done - //! Null if not properly set : must be test IsNull after casting - Standard_EXPORT Handle(IFSelect_GeneralModifier) FileModifier() const; - - //! Returns True if no modifier is currently set - Standard_EXPORT Standard_Boolean IsForNone() const; - - //! Returns True if the current modifier is to be applied to - //! the whole model. Else, a restricted list of selected entities - //! is defined, it can be exploited by the File Modifier - Standard_EXPORT Standard_Boolean IsForAll() const; - - //! Returns the total count of selected entities - Standard_EXPORT Standard_Integer NbEntities() const; - - //! Starts an iteration on selected items. It takes into account - //! IsForAll/IsForNone, by really iterating on all selected items. - Standard_EXPORT void Start(); - - //! Returns True until the iteration has finished - Standard_EXPORT Standard_Boolean More() const; - - //! Advances the iteration - Standard_EXPORT void Next(); - - //! Returns the current selected entity in the model - Standard_EXPORT Handle(Standard_Transient) Value() const; - - //! Adds a Check to the CheckList. If it is empty, nothing is done - //! If it concerns an Entity from the Model (by SetEntity) - //! to which another Check is attached, it is merged to it. - //! Else, it is added or merged as to GlobalCheck. - Standard_EXPORT void AddCheck (const Handle(Interface_Check)& check); - - //! Adds a Warning Message for an Entity from the Model - //! If is not an Entity from the model (e.g. the - //! model itself) this message is added to Global Check. - Standard_EXPORT void AddWarning (const Handle(Standard_Transient)& start, const Standard_CString mess, const Standard_CString orig = ""); - - //! Adds a Fail Message for an Entity from the Model - //! If is not an Entity from the model (e.g. the - //! model itself) this message is added to Global Check. - Standard_EXPORT void AddFail (const Handle(Standard_Transient)& start, const Standard_CString mess, const Standard_CString orig = ""); - - //! Returns a Check given an Entity number (in the Model) - //! by default a Global Check. Creates it the first time. - //! It can then be acknowledged on the spot, in condition that the - //! caller works by reference ("Interface_Check& check = ...") - Standard_EXPORT Handle(Interface_Check) CCheck (const Standard_Integer num = 0); - - //! Returns a Check attached to an Entity from the Model - //! It can then be acknowledged on the spot, in condition that the - //! caller works by reference ("Interface_Check& check = ...") - Standard_EXPORT Handle(Interface_Check) CCheck (const Handle(Standard_Transient)& start); - - //! Returns the complete CheckList - Standard_EXPORT Interface_CheckIterator CheckList() const; - - - - -protected: - - - - - -private: - - - - Handle(Interface_InterfaceModel) themodel; - Handle(Interface_Protocol) theproto; - TCollection_AsciiString thefile; - Handle(IFSelect_AppliedModifiers) theapply; - Handle(Interface_HGraph) thehgraf; - Interface_CheckIterator thecheck; - Standard_Integer thenumod; - Standard_Integer thenbent; - Standard_Integer thecurr; - Handle(IFSelect_GeneralModifier) themodif; - - -}; - - - - - - - -#endif // _IFSelect_ContextWrite_HeaderFile diff --git a/src/IFSelect/IFSelect_DispGlobal.cxx b/src/IFSelect/IFSelect_DispGlobal.cxx deleted file mode 100644 index 76cec696b2..0000000000 --- a/src/IFSelect/IFSelect_DispGlobal.cxx +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - - -#include -#include -#include -#include -#include -#include -#include - -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_DispGlobal,IFSelect_Dispatch) - -// Genere un seul paquet avec la sortie finale -IFSelect_DispGlobal::IFSelect_DispGlobal () { } - - TCollection_AsciiString IFSelect_DispGlobal::Label () const -{ return TCollection_AsciiString ("One File for All Input"); } - - Standard_Boolean IFSelect_DispGlobal::LimitedMax - (const Standard_Integer /* nbent */, Standard_Integer& pcount) const - { pcount = 1; return Standard_True; } - -// 1 packet ( a partir de UniqueResult) - void IFSelect_DispGlobal::Packets - (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const -{ - packs.AddPart(); - packs.GetFromIter(FinalSelection()->UniqueResult(G)); -} diff --git a/src/IFSelect/IFSelect_DispGlobal.hxx b/src/IFSelect/IFSelect_DispGlobal.hxx deleted file mode 100644 index 2ca327d20d..0000000000 --- a/src/IFSelect/IFSelect_DispGlobal.hxx +++ /dev/null @@ -1,79 +0,0 @@ -// Created on: 1992-11-17 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_DispGlobal_HeaderFile -#define _IFSelect_DispGlobal_HeaderFile - -#include -#include - -#include -#include -#include -class TCollection_AsciiString; -class Interface_Graph; -class IFGraph_SubPartsIterator; - - -class IFSelect_DispGlobal; -DEFINE_STANDARD_HANDLE(IFSelect_DispGlobal, IFSelect_Dispatch) - -//! A DispGlobal gathers all the input Entities into only one -//! global Packet -class IFSelect_DispGlobal : public IFSelect_Dispatch -{ - -public: - - - //! Creates a DispGlobal - Standard_EXPORT IFSelect_DispGlobal(); - - //! Returns as Label, "One File for all Input" - Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE; - - //! Returns True : maximum equates 1 - Standard_EXPORT virtual Standard_Boolean LimitedMax (const Standard_Integer nbent, Standard_Integer& max) const Standard_OVERRIDE; - - //! Computes the list of produced Packets. It is made of only ONE - //! Packet, which gets the RootResult from the Final Selection. - //! Remark : the inherited exception raising is never activated. - Standard_EXPORT void Packets (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const Standard_OVERRIDE; - - - - - DEFINE_STANDARD_RTTIEXT(IFSelect_DispGlobal,IFSelect_Dispatch) - -protected: - - - - -private: - - - - -}; - - - - - - - -#endif // _IFSelect_DispGlobal_HeaderFile diff --git a/src/IFSelect/IFSelect_DispPerCount.cxx b/src/IFSelect/IFSelect_DispPerCount.cxx deleted file mode 100644 index d013045df2..0000000000 --- a/src/IFSelect/IFSelect_DispPerCount.cxx +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// 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 - -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_DispPerCount,IFSelect_Dispatch) - -IFSelect_DispPerCount::IFSelect_DispPerCount () { } - - Handle(IFSelect_IntParam) IFSelect_DispPerCount::Count () const - { return thecount; } - - void IFSelect_DispPerCount::SetCount - (const Handle(IFSelect_IntParam)& pcount) - { thecount = pcount; } - - Standard_Integer IFSelect_DispPerCount::CountValue () const -{ - Standard_Integer pcount = 0; - if (!thecount.IsNull()) pcount = thecount->Value(); - if (pcount <= 0) pcount = 1; // option prise par defaut - return pcount; -} - - TCollection_AsciiString IFSelect_DispPerCount::Label () const -{ - TCollection_AsciiString lab(CountValue()); - lab.Insert(1,"One File per "); - lab.AssignCat(" Entities"); - return lab; -} - - - Standard_Boolean IFSelect_DispPerCount::LimitedMax - (const Standard_Integer nbent, Standard_Integer& pcount) const -{ - pcount = 1 + nbent / CountValue(); - return Standard_True; -} - - void IFSelect_DispPerCount::Packets - (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const -{ -// Ressemble a DispPerOne, mais fait un AddPart tous les "count" racines - Standard_Integer pcount = CountValue(); - - IFGraph_SCRoots roots(G,Standard_False); - roots.SetLoad(); - roots.GetFromIter(FinalSelection()->UniqueResult(G)); -// SCRoots a initie la resolution : decoupage en StrongComponants + selection -// des racines. Un paquet correspond des lors a racines -// Donc, il faut iterer sur les Parts de roots et les prendre par - - Standard_Integer i = 0; - for (roots.Start(); roots.More(); roots.Next()) { - if (i == 0) packs.AddPart(); - i ++; if (i >= pcount) i = 0; // regroupement selon "count" - packs.GetFromIter(roots.Entities()); - } -} diff --git a/src/IFSelect/IFSelect_DispPerCount.hxx b/src/IFSelect/IFSelect_DispPerCount.hxx deleted file mode 100644 index 9b9d7a6c5c..0000000000 --- a/src/IFSelect/IFSelect_DispPerCount.hxx +++ /dev/null @@ -1,94 +0,0 @@ -// Created on: 1992-11-17 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_DispPerCount_HeaderFile -#define _IFSelect_DispPerCount_HeaderFile - -#include -#include - -#include -#include -#include -class IFSelect_IntParam; -class Interface_InterfaceError; -class TCollection_AsciiString; -class Interface_Graph; -class IFGraph_SubPartsIterator; - - -class IFSelect_DispPerCount; -DEFINE_STANDARD_HANDLE(IFSelect_DispPerCount, IFSelect_Dispatch) - -//! A DispPerCount gathers all the input Entities into one or -//! several Packets, each containing a defined count of Entity -//! This count is a Parameter of the DispPerCount, given as an -//! IntParam, thus allowing external control of its Value -class IFSelect_DispPerCount : public IFSelect_Dispatch -{ - -public: - - - //! Creates a DispPerCount with no Count (default value 1) - Standard_EXPORT IFSelect_DispPerCount(); - - //! Returns the Count Parameter used for splitting - Standard_EXPORT Handle(IFSelect_IntParam) Count() const; - - //! Sets a new Parameter for Count - Standard_EXPORT void SetCount (const Handle(IFSelect_IntParam)& count); - - //! Returns the effective value of the count parameter - //! (if Count Parameter not Set or value not positive, returns 1) - Standard_EXPORT Standard_Integer CountValue() const; - - //! Returns as Label, "One File per Input Entities" - Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE; - - //! Returns True, maximum count is given as - Standard_EXPORT virtual Standard_Boolean LimitedMax (const Standard_Integer nbent, Standard_Integer& max) const Standard_OVERRIDE; - - //! Computes the list of produced Packets. It defines Packets in - //! order to have at most Entities per Packet, Entities - //! are given by RootResult from the Final Selection. - Standard_EXPORT void Packets (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const Standard_OVERRIDE; - - - - - DEFINE_STANDARD_RTTIEXT(IFSelect_DispPerCount,IFSelect_Dispatch) - -protected: - - - - -private: - - - Handle(IFSelect_IntParam) thecount; - - -}; - - - - - - - -#endif // _IFSelect_DispPerCount_HeaderFile diff --git a/src/IFSelect/IFSelect_DispPerFiles.cxx b/src/IFSelect/IFSelect_DispPerFiles.cxx deleted file mode 100644 index 8107729786..0000000000 --- a/src/IFSelect/IFSelect_DispPerFiles.cxx +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// 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 - -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_DispPerFiles,IFSelect_Dispatch) - -IFSelect_DispPerFiles::IFSelect_DispPerFiles () { } - - Handle(IFSelect_IntParam) IFSelect_DispPerFiles::Count () const - { return thecount; } - - void IFSelect_DispPerFiles::SetCount - (const Handle(IFSelect_IntParam)& pcount) - { thecount = pcount; } - - Standard_Integer IFSelect_DispPerFiles::CountValue () const -{ - Standard_Integer pcount = 0; - if (!thecount.IsNull()) pcount = thecount->Value(); - if (pcount <= 0) pcount = 1; // option prise par defaut - return pcount; -} - - TCollection_AsciiString IFSelect_DispPerFiles::Label () const -{ - TCollection_AsciiString lab(CountValue()); - lab.Insert(1,"Maximum "); - lab.AssignCat(" Files"); - return lab; -} - - - Standard_Boolean IFSelect_DispPerFiles::LimitedMax - (const Standard_Integer /* nbent */, Standard_Integer& pcount) const -{ - pcount = CountValue(); - return Standard_True; -} - - void IFSelect_DispPerFiles::Packets - (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const -{ -// Ressemble a DispPerOne, mais fait "count" AddPart racines - Standard_Integer pcount = CountValue(); - - IFGraph_SCRoots roots(G,Standard_False); - roots.SetLoad(); - roots.GetFromIter(FinalSelection()->UniqueResult(G)); -// SCRoots a initie la resolution : decoupage en StrongComponants + selection -// des racines. Un paquet correspond des lors a racines -// Donc, il faut iterer sur les Parts de roots et les prendre par - roots.Start(); // Start fait Evaluate specifique - Standard_Integer nb = roots.NbParts(); - if (pcount > 0) pcount = (nb-1) / pcount +1; // par packet - - Standard_Integer i = 0; - for (; roots.More(); roots.Next()) { // Start deja fait - if (i == 0) packs.AddPart(); - i ++; if (i >= pcount) i = 0; // regroupement selon "count" - packs.GetFromIter(roots.Entities()); - } -} diff --git a/src/IFSelect/IFSelect_DispPerFiles.hxx b/src/IFSelect/IFSelect_DispPerFiles.hxx deleted file mode 100644 index ad815130de..0000000000 --- a/src/IFSelect/IFSelect_DispPerFiles.hxx +++ /dev/null @@ -1,98 +0,0 @@ -// Created on: 1994-12-21 -// Created by: Christian CAILLET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_DispPerFiles_HeaderFile -#define _IFSelect_DispPerFiles_HeaderFile - -#include -#include - -#include -#include -#include -class IFSelect_IntParam; -class Interface_InterfaceError; -class TCollection_AsciiString; -class Interface_Graph; -class IFGraph_SubPartsIterator; - - -class IFSelect_DispPerFiles; -DEFINE_STANDARD_HANDLE(IFSelect_DispPerFiles, IFSelect_Dispatch) - -//! A DispPerFiles produces a determined count of Packets from the -//! input Entities. It divides, as equally as possible, the input -//! list into a count of files. This count is the parameter of the -//! DispPerFiles. If the input list has less than this count, of -//! course there will be one packet per input entity. -//! This count is a Parameter of the DispPerFiles, given as an -//! IntParam, thus allowing external control of its Value -class IFSelect_DispPerFiles : public IFSelect_Dispatch -{ - -public: - - - //! Creates a DispPerFiles with no Count (default value 1 file) - Standard_EXPORT IFSelect_DispPerFiles(); - - //! Returns the Count Parameter used for splitting - Standard_EXPORT Handle(IFSelect_IntParam) Count() const; - - //! Sets a new Parameter for Count - Standard_EXPORT void SetCount (const Handle(IFSelect_IntParam)& count); - - //! Returns the effective value of the count parameter - //! (if Count Parameter not Set or value not positive, returns 1) - Standard_EXPORT Standard_Integer CountValue() const; - - //! Returns as Label, "Maximum Files" - Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE; - - //! Returns True, maximum count is given as CountValue - Standard_EXPORT virtual Standard_Boolean LimitedMax (const Standard_Integer nbent, Standard_Integer& max) const Standard_OVERRIDE; - - //! Computes the list of produced Packets. It defines Packets in - //! order to have Packets, except if the input count of - //! Entities is lower. Entities are given by RootResult from the - //! Final Selection. - Standard_EXPORT void Packets (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const Standard_OVERRIDE; - - - - - DEFINE_STANDARD_RTTIEXT(IFSelect_DispPerFiles,IFSelect_Dispatch) - -protected: - - - - -private: - - - Handle(IFSelect_IntParam) thecount; - - -}; - - - - - - - -#endif // _IFSelect_DispPerFiles_HeaderFile diff --git a/src/IFSelect/IFSelect_DispPerOne.cxx b/src/IFSelect/IFSelect_DispPerOne.cxx deleted file mode 100644 index 4778c80792..0000000000 --- a/src/IFSelect/IFSelect_DispPerOne.cxx +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// 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 - -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_DispPerOne,IFSelect_Dispatch) - -// Genere un paquet par racine (strong comp.) locale a la liste transmise -IFSelect_DispPerOne::IFSelect_DispPerOne () { } - - TCollection_AsciiString IFSelect_DispPerOne::Label () const -{ return TCollection_AsciiString ("One File per Input Entity"); } - - - Standard_Boolean IFSelect_DispPerOne::LimitedMax - (const Standard_Integer nbent, Standard_Integer& pcount) const -{ pcount = nbent; return Standard_True; } - - void IFSelect_DispPerOne::Packets - (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const -{ - IFGraph_SCRoots packsc(G,Standard_False); // OK pour SubPartsIterator - packsc.SetLoad(); - packsc.GetFromIter(FinalSelection()->UniqueResult(G)); -// SCRoots a initie la resolution : decoupage en StrongComponants + selection -// des Racines. Chaque Racine correspond a un Packet. CQFD - packs.GetParts(packsc); -} diff --git a/src/IFSelect/IFSelect_DispPerOne.hxx b/src/IFSelect/IFSelect_DispPerOne.hxx deleted file mode 100644 index 1dffd834a4..0000000000 --- a/src/IFSelect/IFSelect_DispPerOne.hxx +++ /dev/null @@ -1,79 +0,0 @@ -// Created on: 1992-11-17 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_DispPerOne_HeaderFile -#define _IFSelect_DispPerOne_HeaderFile - -#include -#include - -#include -#include -#include -class TCollection_AsciiString; -class Interface_Graph; -class IFGraph_SubPartsIterator; - - -class IFSelect_DispPerOne; -DEFINE_STANDARD_HANDLE(IFSelect_DispPerOne, IFSelect_Dispatch) - -//! A DispPerOne gathers all the input Entities into as many -//! Packets as there Root Entities from the Final Selection, -//! that is, one Packet per Entity -class IFSelect_DispPerOne : public IFSelect_Dispatch -{ - -public: - - - //! Creates a DispPerOne - Standard_EXPORT IFSelect_DispPerOne(); - - //! Returns as Label, "One File per Input Entity" - Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE; - - //! Returns True, maximum limit is given as - Standard_EXPORT virtual Standard_Boolean LimitedMax (const Standard_Integer nbent, Standard_Integer& max) const Standard_OVERRIDE; - - //! Returns the list of produced Packets. It defines one Packet - //! per Entity given by RootResult from the Final Selection. - Standard_EXPORT void Packets (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const Standard_OVERRIDE; - - - - - DEFINE_STANDARD_RTTIEXT(IFSelect_DispPerOne,IFSelect_Dispatch) - -protected: - - - - -private: - - - - -}; - - - - - - - -#endif // _IFSelect_DispPerOne_HeaderFile diff --git a/src/IFSelect/IFSelect_DispPerSignature.cxx b/src/IFSelect/IFSelect_DispPerSignature.cxx deleted file mode 100644 index 9668d042a4..0000000000 --- a/src/IFSelect/IFSelect_DispPerSignature.cxx +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// 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 -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_DispPerSignature,IFSelect_Dispatch) - -IFSelect_DispPerSignature::IFSelect_DispPerSignature () { } - - Handle(IFSelect_SignCounter) IFSelect_DispPerSignature::SignCounter () const -{ return thesign; } - - void IFSelect_DispPerSignature::SetSignCounter - (const Handle(IFSelect_SignCounter)& sign) -{ thesign = sign; thesign->SetList (Standard_True); } - - Standard_CString IFSelect_DispPerSignature::SignName () const -{ return (Standard_CString ) (thesign.IsNull() ? "???" : thesign->Name()); } - - TCollection_AsciiString IFSelect_DispPerSignature::Label () const -{ - char lab[50]; - sprintf (lab,"One File per Signature %s",SignName()); - return TCollection_AsciiString(lab); -} - - Standard_Boolean IFSelect_DispPerSignature::LimitedMax - (const Standard_Integer nbent, Standard_Integer& max) const -{ - max = nbent; - return Standard_True; -} - - void IFSelect_DispPerSignature::Packets - (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const -{ - if (thesign.IsNull()) { - packs.AddPart(); - packs.GetFromIter (FinalSelection()->RootResult(G)); - return; - } - - thesign->Clear(); - thesign->AddList (FinalSelection()->RootResult(G).Content(),G.Model()); - Handle(TColStd_HSequenceOfHAsciiString) list = thesign->List(); - Standard_Integer i,nb,is,nbs = list->Length(); - Handle(TCollection_HAsciiString) asign; - Handle(TColStd_HSequenceOfTransient) ents; - for (is = 1; is <= nbs; is ++) { - asign = list->Value(is); - ents = thesign->Entities (asign->ToCString()); - if (ents.IsNull()) continue; - packs.AddPart(); - nb = ents->Length(); - for (i = 1; i <= nb; i ++) - packs.GetFromEntity (ents->Value(i),Standard_False); - } -} diff --git a/src/IFSelect/IFSelect_DispPerSignature.hxx b/src/IFSelect/IFSelect_DispPerSignature.hxx deleted file mode 100644 index 0601a540c8..0000000000 --- a/src/IFSelect/IFSelect_DispPerSignature.hxx +++ /dev/null @@ -1,95 +0,0 @@ -// Created on: 1994-12-21 -// Created by: Christian CAILLET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_DispPerSignature_HeaderFile -#define _IFSelect_DispPerSignature_HeaderFile - -#include -#include - -#include -#include -#include -#include -class IFSelect_SignCounter; -class Interface_InterfaceError; -class TCollection_AsciiString; -class Interface_Graph; -class IFGraph_SubPartsIterator; - - -class IFSelect_DispPerSignature; -DEFINE_STANDARD_HANDLE(IFSelect_DispPerSignature, IFSelect_Dispatch) - -//! A DispPerSignature sorts input Entities according to a -//! Signature : it works with a SignCounter to do this. -class IFSelect_DispPerSignature : public IFSelect_Dispatch -{ - -public: - - - //! Creates a DispPerSignature with no SignCounter (by default, - //! produces only one packet) - Standard_EXPORT IFSelect_DispPerSignature(); - - //! Returns the SignCounter used for splitting - Standard_EXPORT Handle(IFSelect_SignCounter) SignCounter() const; - - //! Sets a SignCounter for sort - //! Remark : it is set to record lists of entities, not only counts - Standard_EXPORT void SetSignCounter (const Handle(IFSelect_SignCounter)& sign); - - //! Returns the name of the SignCounter, which caracterises the - //! sorting criterium for this Dispatch - Standard_EXPORT Standard_CString SignName() const; - - //! Returns as Label, "One File per Signature " - Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE; - - //! Returns True, maximum count is given as - Standard_EXPORT virtual Standard_Boolean LimitedMax (const Standard_Integer nbent, Standard_Integer& max) const Standard_OVERRIDE; - - //! Computes the list of produced Packets. It defines Packets from - //! the SignCounter, which sirts the input Entities per Signature - //! (specific of the SignCounter). - Standard_EXPORT void Packets (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const Standard_OVERRIDE; - - - - - DEFINE_STANDARD_RTTIEXT(IFSelect_DispPerSignature,IFSelect_Dispatch) - -protected: - - - - -private: - - - Handle(IFSelect_SignCounter) thesign; - - -}; - - - - - - - -#endif // _IFSelect_DispPerSignature_HeaderFile diff --git a/src/IFSelect/IFSelect_Dispatch.cxx b/src/IFSelect/IFSelect_Dispatch.cxx deleted file mode 100644 index 87355102db..0000000000 --- a/src/IFSelect/IFSelect_Dispatch.cxx +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// 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 - -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Dispatch,MMgt_TShared) - -void IFSelect_Dispatch::SetRootName - (const Handle(TCollection_HAsciiString)& name) -{ - thename = name; -} - - Standard_Boolean IFSelect_Dispatch::HasRootName () const - { return (!thename.IsNull()); } - - const Handle(TCollection_HAsciiString)& IFSelect_Dispatch::RootName () const - { return thename; } - - void IFSelect_Dispatch::SetFinalSelection - (const Handle(IFSelect_Selection)& sel) - { thefinal = sel; } - - Handle(IFSelect_Selection) IFSelect_Dispatch::FinalSelection () const - { return thefinal; } - - IFSelect_SelectionIterator IFSelect_Dispatch::Selections () const -{ - IFSelect_SelectionIterator iter; - iter.AddItem(thefinal); - for(; iter.More(); iter.Next()) { - iter.Value()->FillIterator(iter); // Iterateur qui se court apres - } - return iter; -} - - - Standard_Boolean IFSelect_Dispatch::CanHaveRemainder () const - { return Standard_False; } - - Standard_Boolean IFSelect_Dispatch::LimitedMax - (const Standard_Integer , Standard_Integer& max) const - { max = 0; return Standard_False; } - - Interface_EntityIterator IFSelect_Dispatch::GetEntities - (const Interface_Graph& G) const - { return thefinal->UniqueResult(G); } - - Interface_EntityIterator IFSelect_Dispatch::Packeted - (const Interface_Graph& G) const -{ - Interface_EntityIterator total = GetEntities(G); - Interface_EntityIterator remain = Remainder(G); - if (remain.NbEntities() == 0) return total; -// sinon, faire la difference ! - IFGraph_Compare GC(G); - GC.GetFromIter (total, Standard_True); - GC.GetFromIter (remain,Standard_False); - return GC.FirstOnly(); -} - - Interface_EntityIterator IFSelect_Dispatch::Remainder - (const Interface_Graph& ) const - { Interface_EntityIterator iter; return iter; } // par defaut vide diff --git a/src/IFSelect/IFSelect_Dispatch.hxx b/src/IFSelect/IFSelect_Dispatch.hxx deleted file mode 100644 index f9126277b5..0000000000 --- a/src/IFSelect/IFSelect_Dispatch.hxx +++ /dev/null @@ -1,153 +0,0 @@ -// Created on: 1992-11-17 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_Dispatch_HeaderFile -#define _IFSelect_Dispatch_HeaderFile - -#include -#include - -#include -#include -#include -class TCollection_HAsciiString; -class IFSelect_Selection; -class Interface_InterfaceError; -class IFSelect_SelectionIterator; -class TCollection_AsciiString; -class Interface_EntityIterator; -class Interface_Graph; -class IFGraph_SubPartsIterator; - - -class IFSelect_Dispatch; -DEFINE_STANDARD_HANDLE(IFSelect_Dispatch, MMgt_TShared) - -//! This class allows to describe how a set of Entities has to be -//! dispatched into resulting Packets : a Packet is a sub-set of -//! the initial set of entities. -//! -//! Thus, it can generate zero, one, or more Packets according -//! input set and criterium of dispatching. And it can let apart -//! some entities : it is the Remainder, which can be recovered -//! by a specific Selection (RemainderFromDispatch). -//! -//! Depending of sub-classes, a Dispatch can potentially generate -//! a limited or not count of packet, and a remainder or none. -//! -//! The input set is read from a specified Selection, attached to -//! the Dispatch : the Final Selection of the Dispatch. The input -//! is the Unique Root Entities list of the Final Selection -class IFSelect_Dispatch : public MMgt_TShared -{ - -public: - - - //! Sets a Root Name as an HAsciiString - //! To reset it, give a Null Handle (then, a ShareOut will have - //! to define the Default Root Name) - Standard_EXPORT void SetRootName (const Handle(TCollection_HAsciiString)& name); - - //! Returns True if a specific Root Name has been set - //! (else, the Default Root Name has to be used) - Standard_EXPORT Standard_Boolean HasRootName() const; - - //! Returns the Root Name for files produced by this dispatch - //! It is empty if it has not been set or if it has been reset - Standard_EXPORT const Handle(TCollection_HAsciiString)& RootName() const; - - //! Stores (or Changes) the Final Selection for a Dispatch - Standard_EXPORT void SetFinalSelection (const Handle(IFSelect_Selection)& sel); - - //! Returns the Final Selection of a Dispatch - //! we 'd like : C++ : return const & - Standard_EXPORT Handle(IFSelect_Selection) FinalSelection() const; - - //! Returns the complete list of source Selections (starting - //! from FinalSelection) - Standard_EXPORT IFSelect_SelectionIterator Selections() const; - - //! Returns True if a Dispatch can have a Remainder, i.e. if its - //! criterium can let entities apart. It is a potential answer, - //! remainder can be empty at run-time even if answer is True. - //! (to attach a RemainderFromDispatch Selection is not allowed if - //! answer is True). - //! Default answer given here is False (can be redefined) - Standard_EXPORT virtual Standard_Boolean CanHaveRemainder() const; - - //! Returns True if a Dispatch generates a count of Packets always - //! less than or equal to a maximum value : it can be computed - //! from the total count of Entities to be dispatched : . - //! If answer is False, no limited maximum is expected for account - //! If answer is True, expected maximum is given in argument - //! Default answer given here is False (can be redefined) - Standard_EXPORT virtual Standard_Boolean LimitedMax (const Standard_Integer nbent, Standard_Integer& max) const; - - //! Returns a text which defines the way a Dispatch produces - //! packets (which will become files) from its Input - Standard_EXPORT virtual TCollection_AsciiString Label() const = 0; - - //! Gets Unique Root Entities from the Final Selection, given an - //! input Graph - //! This the starting step for an Evaluation (Packets - Remainder) - Standard_EXPORT Interface_EntityIterator GetEntities (const Interface_Graph& G) const; - - //! Returns the list of produced Packets into argument . - //! Each Packet corresponds to a Part, the Entities listed are the - //! Roots given by the Selection. Input is given as a Graph. - //! Thus, to create a file from a packet, it suffices to take the - //! entities listed in a Part of Packets (that is, a Packet) - //! without worrying about Shared entities - //! This method can raise an Exception if data are not coherent - Standard_EXPORT virtual void Packets (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const = 0; - - //! Returns the list of all Input Entities (see GetEntities) which - //! are put in a Packet. That is, Entities listed in GetEntities - //! but not in Remainder (see below). Input is given as a Graph. - Standard_EXPORT Interface_EntityIterator Packeted (const Interface_Graph& G) const; - - //! Returns Remainder which is a set of Entities. Can be empty. - //! Default evaluation is empty (has to be redefined if - //! CanHaveRemainder is redefined to return True). - Standard_EXPORT virtual Interface_EntityIterator Remainder (const Interface_Graph& G) const; - - - - - DEFINE_STANDARD_RTTIEXT(IFSelect_Dispatch,MMgt_TShared) - -protected: - - - - -private: - - - Handle(TCollection_HAsciiString) thename; - Handle(IFSelect_Selection) thefinal; - - -}; - - - - - - - -#endif // _IFSelect_Dispatch_HeaderFile diff --git a/src/IFSelect/IFSelect_EditForm.cxx b/src/IFSelect/IFSelect_EditForm.cxx deleted file mode 100644 index 73415b884c..0000000000 --- a/src/IFSelect/IFSelect_EditForm.cxx +++ /dev/null @@ -1,548 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// 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 - -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_EditForm,MMgt_TShared) - -IFSelect_EditForm::IFSelect_EditForm - (const Handle(IFSelect_Editor)& editor, - const Standard_Boolean readonly, const Standard_Boolean undoable, - const Standard_CString label) - : thecomplete (Standard_True) , - theloaded (Standard_False) , - thekeepst (Standard_False) , - thelabel (label) , - thenums (0,1) , - theorigs (0, (undoable ? editor->NbValues() : 0) ) , - themodifs (0, (readonly ? 0 : editor->NbValues()) ) , - thestatus (0, (readonly ? 0 : editor->NbValues()) ) , - theeditor (editor) , - thetouched (0) { } - - IFSelect_EditForm::IFSelect_EditForm - (const Handle(IFSelect_Editor)& editor, - const TColStd_SequenceOfInteger& nums, - const Standard_Boolean readonly, const Standard_Boolean undoable, - const Standard_CString label) - : thecomplete (Standard_False) , - theloaded (Standard_False) , - thekeepst (Standard_False) , - thelabel (label) , - thenums (0,nums.Length()) , - theorigs (0, (undoable ? nums.Length() : 0) ) , - themodifs (0, (readonly ? 0 : nums.Length()) ) , - thestatus (0, (readonly ? 0 : nums.Length()) ) , - theeditor (editor) , - thetouched (0) -{ - Standard_Integer i,nb = nums.Length(); - for (i = 1; i <= nb; i ++) thenums.SetValue (i,nums.Value(i)); -} - - Standard_Boolean& IFSelect_EditForm::EditKeepStatus () - { return thekeepst; } - - Standard_CString IFSelect_EditForm::Label () const - { return thelabel.ToCString(); } - - Standard_Boolean IFSelect_EditForm::IsLoaded () const - { return theloaded; } - - void IFSelect_EditForm::ClearData () - { theent.Nullify(); themodel.Nullify(); theloaded = Standard_False; } - - void IFSelect_EditForm::SetData - (const Handle(Standard_Transient)& ent, - const Handle(Interface_InterfaceModel)& model) - { theent = ent; themodel = model; } - - void IFSelect_EditForm::SetEntity - (const Handle(Standard_Transient)& ent) - { theent = ent; } - - void IFSelect_EditForm::SetModel - (const Handle(Interface_InterfaceModel)& model) - { themodel = model; } - - Handle(Standard_Transient) IFSelect_EditForm::Entity () const - { return theent; } - - Handle(Interface_InterfaceModel) IFSelect_EditForm::Model () const - { return themodel; } - - Handle(IFSelect_Editor) IFSelect_EditForm::Editor () const - { return theeditor; } - - Standard_Boolean IFSelect_EditForm::IsComplete () const - { return thecomplete; } - - Standard_Integer IFSelect_EditForm::NbValues - (const Standard_Boolean editable) const -{ - if (!editable || thecomplete) return theeditor->NbValues(); - return thenums.Upper(); -} - - Standard_Integer IFSelect_EditForm::NumberFromRank - (const Standard_Integer rank) const -{ - if (thecomplete) return rank; - if (rank < 1 || rank > thenums.Upper()) return 0; - return thenums.Value(rank); -} - - Standard_Integer IFSelect_EditForm::RankFromNumber - (const Standard_Integer num) const -{ - if (thecomplete) return num; - Standard_Integer i, n = thenums.Upper(); - for (i = 1; i <= n; i ++) { - if (thenums.Value(i) == num) return i; - } - return 0; -} - - Standard_Integer IFSelect_EditForm::NameNumber - (const Standard_CString name) const -{ - Standard_Integer res = theeditor->NameNumber(name); - if (thecomplete || res == 0) return res; -// Sinon, chercher res dans thenums - Standard_Integer i, nb = thenums.Length(); - for (i = 1; i <= nb; i ++) { - if (res == thenums.Value(i)) return res; - } - return -res; -} - - Standard_Integer IFSelect_EditForm::NameRank - (const Standard_CString name) const -{ - Standard_Integer res = theeditor->NameNumber(name); - if (thecomplete || res == 0) return res; -// Sinon, chercher res dans thenums - Standard_Integer i, nb = thenums.Length(); - for (i = 1; i <= nb; i ++) { - if (res == thenums.Value(i)) return i; - } - return 0; -} - - - void IFSelect_EditForm::LoadDefault () -{ - theloaded = Standard_True; - thetouched = 0; - Standard_Integer i,nb = theorigs.Upper(); - if (nb == 0) return; - for (i = 1; i <= nb; i ++) { - Standard_Integer num = NumberFromRank(i); - if (num == 0) continue; - Handle(TCollection_HAsciiString) str = theeditor->StringValue (this,num); - theorigs.SetValue (i,str); - } -} - - - Standard_Boolean IFSelect_EditForm::LoadData - (const Handle(Standard_Transient)& ent, - const Handle(Interface_InterfaceModel)& model) -{ - thetouched = 0; - if (!theeditor->Load (this,ent,model)) return Standard_False; - SetData (ent,model); - theloaded = Standard_True; - return Standard_True; -} - - Standard_Boolean IFSelect_EditForm::LoadEntity - (const Handle(Standard_Transient)& ent) -{ - thetouched = 0; - Handle(Interface_InterfaceModel) model; - if (!theeditor->Load (this,ent,model)) return Standard_False; - SetEntity (ent); - theloaded = Standard_True; - return Standard_True; -} - - Standard_Boolean IFSelect_EditForm::LoadModel - (const Handle(Interface_InterfaceModel)& model) -{ - thetouched = 0; - Handle(Standard_Transient) ent; - if (!theeditor->Load (this,ent,model)) return Standard_False; - SetData (ent,model); - theloaded = Standard_True; - return Standard_True; -} - - Standard_Boolean IFSelect_EditForm::LoadData () -{ - thetouched = 0; - Handle(Interface_InterfaceModel) model; - Handle(Standard_Transient) ent; - if (!theeditor->Load (this,ent,model)) return Standard_False; - theloaded = Standard_True; - return Standard_True; -} - - -// ######## VALUES ######## - - Handle(IFSelect_ListEditor) IFSelect_EditForm::ListEditor - (const Standard_Integer num) const -{ - Standard_Integer n = RankFromNumber(num); - Handle(IFSelect_ListEditor) led; - if (n <= 0 || n > theorigs.Upper()) return led; - if (!theeditor->IsList(n)) return led; - led = theeditor->ListEditor (num); - Handle(TColStd_HSequenceOfHAsciiString) lis = theeditor->ListValue(this,num); - led->LoadModel (themodel); - led->LoadValues (lis); - return led; -} - - void IFSelect_EditForm::LoadValue - (const Standard_Integer num, const Handle(TCollection_HAsciiString)& val) -{ - Standard_Integer n = RankFromNumber(num); - if (n <= 0 || n > theorigs.Upper()) return; - theorigs.SetValue (n,val); -} - - void IFSelect_EditForm::LoadList - (const Standard_Integer num, const Handle(TColStd_HSequenceOfHAsciiString)& list) -{ - Standard_Integer n = RankFromNumber(num); - if (n <= 0 || n > theorigs.Upper()) return; - theorigs.SetValue (n,list); -} - - - Handle(TCollection_HAsciiString) IFSelect_EditForm::OriginalValue - (const Standard_Integer num) const -{ - Standard_Integer n = RankFromNumber(num); - Handle(TCollection_HAsciiString) val; - if (theorigs.Upper() == 0) return theeditor->StringValue (this,num); - else return Handle(TCollection_HAsciiString)::DownCast(theorigs.Value(n)); -} - - Handle(TColStd_HSequenceOfHAsciiString) IFSelect_EditForm::OriginalList - (const Standard_Integer num) const -{ - Standard_Integer n = RankFromNumber(num); - Handle(TColStd_HSequenceOfHAsciiString) list; - if (theorigs.Upper() == 0) return theeditor->ListValue (this,num); - else return Handle(TColStd_HSequenceOfHAsciiString)::DownCast(theorigs.Value(n)); -} - - Handle(TCollection_HAsciiString) IFSelect_EditForm::EditedValue - (const Standard_Integer num) const -{ - if (themodifs.Upper() == 0) return OriginalValue(num); - if (!IsModified(num)) return OriginalValue(num); - Standard_Integer n = RankFromNumber(num); - return Handle(TCollection_HAsciiString)::DownCast(themodifs.Value(n)); -} - - Handle(TColStd_HSequenceOfHAsciiString) IFSelect_EditForm::EditedList - (const Standard_Integer num) const -{ - if (themodifs.Upper() == 0) return OriginalList(num); - if (!IsModified(num)) return OriginalList(num); - Standard_Integer n = RankFromNumber(num); - return Handle(TColStd_HSequenceOfHAsciiString)::DownCast(themodifs.Value(n)); -} - - - Standard_Boolean IFSelect_EditForm::IsModified - (const Standard_Integer num) const -{ - if (thestatus.Upper() == 0) return Standard_False; - Standard_Integer n = RankFromNumber(num); - return (thestatus.Value(n) != 0); -} - - Standard_Boolean IFSelect_EditForm::IsTouched - (const Standard_Integer num) const -{ - if (thestatus.Upper() == 0) return Standard_False; - Standard_Integer n = RankFromNumber(num); - return (thestatus.Value(n) == 2); -} - - Standard_Boolean IFSelect_EditForm::Modify - (const Standard_Integer num, const Handle(TCollection_HAsciiString)& newval, - const Standard_Boolean enforce) -{ -// Peut-on editer - thetouched = 0; - if (themodifs.Upper() == 0) return Standard_False; - Standard_Integer tnum = RankFromNumber(num); - if (tnum == 0) return Standard_False; - IFSelect_EditValue acc = theeditor->EditMode (num); - if (newval.IsNull() && acc != IFSelect_Optional) return Standard_False; - if (!enforce && (acc == IFSelect_EditProtected || acc == IFSelect_EditComputed)) return Standard_False; - -// Satisfies ? - Handle(Interface_TypedValue) typval = theeditor->TypedValue(num); - if (!typval->Satisfies(newval)) return Standard_False; - Interface_ParamType pty = typval->Type(); - if (pty == Interface_ParamIdent && !newval.IsNull()) { - if (themodel.IsNull()) return Standard_False; - if (themodel->NextNumberForLabel(newval->ToCString(),0,Standard_False) <= 0) - return Standard_False; - } - -// Update ? - if (!theeditor->Update(this,num,newval,enforce)) return Standard_False; - - thestatus.SetValue (tnum,1); - themodifs.SetValue (tnum,newval); - return Standard_True; -} - - Standard_Boolean IFSelect_EditForm::ModifyList - (const Standard_Integer num, const Handle(IFSelect_ListEditor)& edited, - const Standard_Boolean enforce) -{ -// Faut-il prendre - if (edited.IsNull()) return Standard_False; - if (!edited->IsTouched()) return Standard_False; - Handle(TColStd_HSequenceOfHAsciiString) newlist = edited->EditedValues(); - -// Peut-on editer - thetouched = 0; - if (themodifs.Upper() == 0) return Standard_False; - Standard_Integer tnum = RankFromNumber(num); - if (tnum == 0) return Standard_False; - IFSelect_EditValue acc = theeditor->EditMode (num); - if (acc == IFSelect_EditRead || acc == IFSelect_EditDynamic) return Standard_False; - if (newlist.IsNull() && acc != IFSelect_Optional) return Standard_False; - if (!enforce && (acc == IFSelect_EditProtected || acc == IFSelect_EditComputed)) return Standard_False; - -// Update ? - if (!theeditor->UpdateList(this,num,newlist,enforce)) return Standard_False; - - thestatus.SetValue (tnum,1); - themodifs.SetValue (tnum,newlist); - return Standard_True; -} - - Standard_Boolean IFSelect_EditForm::ModifyListValue - (const Standard_Integer num, const Handle(TColStd_HSequenceOfHAsciiString)& list, - const Standard_Boolean enforce) -{ - Handle(IFSelect_ListEditor) led = ListEditor (num); - if (led.IsNull()) return Standard_False; - if (!led->LoadEdited(list)) return Standard_False; - return ModifyList (num,led,enforce); -} - - - Standard_Boolean IFSelect_EditForm::Touch - (const Standard_Integer num, const Handle(TCollection_HAsciiString)& newval) -{ - if (themodifs.Upper() == 0) return Standard_False; - Standard_Integer tnum = RankFromNumber(num); - if (tnum == 0) return Standard_False; - - thestatus.SetValue (tnum,2); - themodifs.SetValue (tnum,newval); - thetouched ++; - return Standard_True; -} - - Standard_Boolean IFSelect_EditForm::TouchList - (const Standard_Integer num, const Handle(TColStd_HSequenceOfHAsciiString)& newlist) -{ - if (themodifs.Upper() == 0) return Standard_False; - Standard_Integer tnum = RankFromNumber(num); - if (tnum == 0) return Standard_False; - - thestatus.SetValue (tnum,2); - themodifs.SetValue (tnum,newlist); - thetouched ++; - return Standard_True; -} - - - void IFSelect_EditForm::ClearEdit (const Standard_Integer num) -{ - Standard_Integer i, nb = thestatus.Upper(); - if (num == 0) { - for (i = 1; i <= nb; i ++) thestatus.SetValue (i,0); - } else { - Standard_Integer tnum = RankFromNumber(num); - if (tnum > 0 && num <= nb) thestatus.SetValue (tnum,0); - } -} - - - void IFSelect_EditForm::PrintDefs (const Handle(Message_Messenger)& S) const -{ - Standard_Integer iv, nbv = NbValues(Standard_True); - S<<"***** EditForm, Label : "<Length(); - S<<"(List : "<Value(i); - S<<" ["<ToCString())<DynamicType()->Name(); - } else { - if (theent.IsNull()) S<<"***** No loaded entity"; - else { S<<"***** Loaded entity : "; themodel->PrintLabel (theent,S); } - } - } - S<MaxNameLength (names ? 0 : -1); - if (maxnam == 0) { maxnam = theeditor->MaxNameLength (0); nams = Standard_True; } - Standard_Integer nbmod = 0; - if (what != 0) S<<"Mod N0 Name Value"<Name(jv,!nams); - -// Original ou Final - if (what != 0) { - Handle(TCollection_HAsciiString) str; - if (IsModified(jv)) S<<"* "; - else S<<" "; - S <IsList(jv)) { - Handle(TColStd_HSequenceOfHAsciiString) list; - if (what < 0) list = OriginalList (jv); - if (what > 0) list = EditedList (jv); - PrintList (list,S,alsolist); - continue; - } - - if (what < 0) str = OriginalValue (jv); - if (what > 0) str = EditedValue (jv); - - S << (str.IsNull() ? "(NULL)" : str->ToCString()) <IsList(jv)) { - Handle(TColStd_HSequenceOfHAsciiString) list= OriginalList (jv); - S <ToCString()) <ToCString()) <Recognize(this); } - - Standard_Boolean IFSelect_EditForm::ApplyData - (const Handle(Standard_Transient)& ent, - const Handle(Interface_InterfaceModel)& model) - { return theeditor->Apply (this,ent,model); } - - - Standard_Boolean IFSelect_EditForm::Undo () -{ - if (thestatus.Upper() == 0 || theorigs.Upper() == 0) return Standard_False; - Standard_Integer i, nb = thestatus.Upper(); - for (i = 1; i <= nb; i ++) { - if (thestatus.Value (i) != 0) themodifs.SetValue (i,theorigs.Value(i)); - } - return Apply (); -} diff --git a/src/IFSelect/IFSelect_EditForm.hxx b/src/IFSelect/IFSelect_EditForm.hxx deleted file mode 100644 index 5623548cd8..0000000000 --- a/src/IFSelect/IFSelect_EditForm.hxx +++ /dev/null @@ -1,319 +0,0 @@ -// Created on: 1998-02-23 -// Created by: Christian CAILLET -// Copyright (c) 1998-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_EditForm_HeaderFile -#define _IFSelect_EditForm_HeaderFile - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -class IFSelect_Editor; -class Standard_Transient; -class Interface_InterfaceModel; -class IFSelect_ListEditor; -class TCollection_HAsciiString; -class Message_Messenger; - - -class IFSelect_EditForm; -DEFINE_STANDARD_HANDLE(IFSelect_EditForm, MMgt_TShared) - -//! An EditForm is the way to apply an Editor on an Entity or on -//! the Model -//! It gives read-only or read-write access, with or without undo -//! -//! It can be complete (all the values of the Editor are present) -//! or partial (a sub-list of these value are present) -//! Anyway, all references to Number (argument ) refer to -//! Number of Value for the Editor -//! While references to Rank are for rank in the EditForm, which -//! may differ if it is not Complete -//! Two methods give the correspondance between this Number and -//! the Rank in the EditForm : RankFromNumber and NumberFromRank -class IFSelect_EditForm : public MMgt_TShared -{ - -public: - - - //! Creates a complete EditForm from an Editor - //! A specific Label can be given - Standard_EXPORT IFSelect_EditForm(const Handle(IFSelect_Editor)& editor, const Standard_Boolean readonly, const Standard_Boolean undoable, const Standard_CString label = ""); - - //! Creates an extracted EditForm from an Editor, limited to - //! the values identified in - //! A specific Label can be given - Standard_EXPORT IFSelect_EditForm(const Handle(IFSelect_Editor)& editor, const TColStd_SequenceOfInteger& nums, const Standard_Boolean readonly, const Standard_Boolean undoable, const Standard_CString label = ""); - - //! Returns and may change the keep status on modif - //! It starts as False - //! If it is True, Apply does not clear modification status - //! and the EditForm can be loaded again, modified value remain - //! and may be applied again - //! Remark that ApplyData does not clear the modification status, - //! a call to ClearEdit does - Standard_EXPORT Standard_Boolean& EditKeepStatus(); - - Standard_EXPORT Standard_CString Label() const; - - //! Tells if the EditForm is loaded now - Standard_EXPORT Standard_Boolean IsLoaded() const; - - Standard_EXPORT void ClearData(); - - Standard_EXPORT void SetData (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model); - - Standard_EXPORT void SetEntity (const Handle(Standard_Transient)& ent); - - Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& model); - - Standard_EXPORT Handle(Standard_Transient) Entity() const; - - Standard_EXPORT Handle(Interface_InterfaceModel) Model() const; - - Standard_EXPORT Handle(IFSelect_Editor) Editor() const; - - //! Tells if an EditForm is complete or is an extract from Editor - Standard_EXPORT Standard_Boolean IsComplete() const; - - //! Returns the count of values - //! True : count of editable values, i.e. - //! For a complete EditForm, it is given by the Editor - //! Else, it is the length of the extraction map - //! False : all the values from the Editor - Standard_EXPORT Standard_Integer NbValues (const Standard_Boolean editable) const; - - //! Returns the Value Number in the Editor from a given Rank in - //! the EditForm - //! For a complete EditForm, both are equal - //! Else, it is given by the extraction map - //! Returns 0 if exceeds the count of editable values, - Standard_EXPORT Standard_Integer NumberFromRank (const Standard_Integer rank) const; - - //! Returns the Rank in the EditForm from a given Number of Value - //! for the Editor - //! For a complete EditForm, both are equal - //! Else, it is given by the extraction map - //! Returns 0 if is not forecast to be edited, or is - //! out of range - Standard_EXPORT Standard_Integer RankFromNumber (const Standard_Integer number) const; - - //! Returns the Value Number in the Editor for a given Name - //! i.e. the true ValueNumber which can be used in various methods - //! of EditForm - //! If it is not complete, for a recorded (in the Editor) but - //! non-loaded name, returns negative value (- number) - Standard_EXPORT Standard_Integer NameNumber (const Standard_CString name) const; - - //! Returns the Rank of Value in the EditForm for a given Name - //! i.e. if it is not complete, for a recorded (in the Editor) but - //! non-loaded name, returns 0 - Standard_EXPORT Standard_Integer NameRank (const Standard_CString name) const; - - //! For a read-write undoable EditForm, loads original values - //! from defaults stored in the Editor - Standard_EXPORT void LoadDefault(); - - //! Loads modifications to data - //! Default uses Editor. Can be redefined - //! Remark that and/or may be null, according to the - //! kind of Editor. Shortcuts are available for these cases, but - //! they finally call LoadData (hence, just ignore non-used args) - Standard_EXPORT virtual Standard_Boolean LoadData (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model); - - //! Shortcut for LoadData when is not used - Standard_EXPORT Standard_Boolean LoadEntity (const Handle(Standard_Transient)& ent); - - //! Shortcut for LoadData when only the model is concerned - Standard_EXPORT Standard_Boolean LoadModel (const Handle(Interface_InterfaceModel)& model); - - //! Shortcut when both and are not used - //! (when the Editor works on fully static or global data) - Standard_EXPORT Standard_Boolean LoadData(); - - //! Returns a ListEditor to edit the parameter of the - //! EditForm, if it is a List - //! The Editor created it (by ListEditor) then loads it (by - //! ListValue) - //! For a single parameter, returns a Null Handle ... - Standard_EXPORT Handle(IFSelect_ListEditor) ListEditor (const Standard_Integer num) const; - - //! Loads an original value (single). Called by the Editor only - Standard_EXPORT void LoadValue (const Standard_Integer num, const Handle(TCollection_HAsciiString)& val); - - //! Loads an original value as a list. Called by the Editor only - Standard_EXPORT void LoadList (const Standard_Integer num, const Handle(TColStd_HSequenceOfHAsciiString)& list); - - //! From an edited value, returns its ... value (original one) - //! Null means that this value is not defined - //! is for the EditForm, not the Editor - //! It is for a single parameter. For a list, gives a Null Handle - Standard_EXPORT Handle(TCollection_HAsciiString) OriginalValue (const Standard_Integer num) const; - - //! Returns an original value, as a list - //! is for the EditForm, not the Editor - //! For a single parameter, gives a Null Handle - Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) OriginalList (const Standard_Integer num) const; - - //! Returns the Edited (i.e. Modified) Value (string for single) - //! reports to the EditForm - //! If IsModified is False, returns OriginalValue - //! Null with IsModified True : means that this value is not - //! defined or has been removed - //! It is for a single parameter. For a list, gives a Null Handle - Standard_EXPORT Handle(TCollection_HAsciiString) EditedValue (const Standard_Integer num) const; - - //! Returns the Edited Value as a list - //! If IsModified is False, returns OriginalValue - //! Null with IsModified True : means that this value is not - //! defined or has been removed - //! For a single parameter, gives a Null Handle - Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) EditedList (const Standard_Integer num) const; - - //! Tells if a Value (of the EditForm) is modified (directly or - //! through touching by Update) - Standard_EXPORT Standard_Boolean IsModified (const Standard_Integer num) const; - - //! Tells if a Value (of the EditForm) has been touched, i.e. - //! not modified directly but by the modification of another one - //! (by method Update from the Editor) - Standard_EXPORT Standard_Boolean IsTouched (const Standard_Integer num) const; - - //! Gives a new value for the item of the EditForm, if - //! it is a single parameter (for a list, just returns False) - //! Null means to Remove it - //! True to overpass Protected or Computed Access Mode - //! Calls the method Update from the Editor, which can touch other - //! parameters (see NbTouched) - //! Returns True if well recorded, False if this value is not - //! allowed - //! Warning : Does not apply immediately : will be applied by the method - //! Apply - Standard_EXPORT Standard_Boolean Modify (const Standard_Integer num, const Handle(TCollection_HAsciiString)& newval, const Standard_Boolean enforce = Standard_False); - - //! Changes the value of an item of the EditForm, if it is a List - //! (else, just returns False) - //! The ListEditor contains the edited values of the list - //! If no edition was recorded, just returns False - //! Calls the method Update from the Editor, which can touch other - //! parameters (see NbTouched) - //! Returns True if well recorded, False if this value is not - //! allowed - //! Warning : Does not apply immediately : will be applied by the method - //! Apply - Standard_EXPORT Standard_Boolean ModifyList (const Standard_Integer num, const Handle(IFSelect_ListEditor)& edited, const Standard_Boolean enforce = Standard_False); - - //! As ModifyList but the new value is given as such - //! Creates a ListEditor, Loads it, then calls ModifyList - Standard_EXPORT Standard_Boolean ModifyListValue (const Standard_Integer num, const Handle(TColStd_HSequenceOfHAsciiString)& list, const Standard_Boolean enforce = Standard_False); - - //! Gives a new value computed by the Editor, if another parameter - //! commands the value of - //! It is generally the case for a Computed Parameter for instance - //! Increments the counter of touched parameters - //! Warning : it gives no protection for ReadOnly etc... while it is the - //! internal way of touching parameters - //! Does not work (returns False) if is for a list - Standard_EXPORT Standard_Boolean Touch (const Standard_Integer num, const Handle(TCollection_HAsciiString)& newval); - - //! Acts as Touch but for a list - //! Does not work (returns False) if is for a single param - Standard_EXPORT Standard_Boolean TouchList (const Standard_Integer num, const Handle(TColStd_HSequenceOfHAsciiString)& newlist); - - //! Returns the count of parameters touched by the last Modify - //! (apart from the modified parameter itself) - //! Normally it is zero - Standard_EXPORT Standard_Integer NbTouched() const; - - //! Clears modification status : by default all, or one by its - //! numbers (in the Editor) - Standard_EXPORT void ClearEdit (const Standard_Integer num = 0); - - //! Prints Definitions, relative to the Editor - Standard_EXPORT void PrintDefs (const Handle(Message_Messenger)& S) const; - - //! Prints Values, according to what and alsolist - //! True : prints Long Names; False : prints Short Names - //! < 0 : prints Original Values (+ flag Modified) - //! > 0 : prints Final Values (+flag Modified) - //! = 0 : prints Modified Values (Original + Edited) - //! False (D) : lists are printed only as their count - //! True : lists are printed for all their items - Standard_EXPORT void PrintValues (const Handle(Message_Messenger)& S, const Standard_Integer what, const Standard_Boolean names, const Standard_Boolean alsolist = Standard_False) const; - - //! Applies modifications to own data - //! Calls ApplyData then Clears Status according EditKeepStatus - Standard_EXPORT Standard_Boolean Apply(); - - //! Tells if this EditForm can work with its Editor and its actual - //! Data (Entity and Model) - //! Default uses Editor. Can be redefined - Standard_EXPORT virtual Standard_Boolean Recognize() const; - - //! Applies modifications to data - //! Default uses Editor. Can be redefined - Standard_EXPORT virtual Standard_Boolean ApplyData (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model); - - //! For an undoable EditForm, Applies ... origibal values ! - //! and clears modified ones - //! Can be run only once - Standard_EXPORT Standard_Boolean Undo(); - - - - - DEFINE_STANDARD_RTTIEXT(IFSelect_EditForm,MMgt_TShared) - -protected: - - - - -private: - - - Standard_Boolean thecomplete; - Standard_Boolean theloaded; - Standard_Boolean thekeepst; - TCollection_AsciiString thelabel; - TColStd_Array1OfInteger thenums; - TColStd_Array1OfTransient theorigs; - TColStd_Array1OfTransient themodifs; - TColStd_Array1OfInteger thestatus; - Handle(IFSelect_Editor) theeditor; - Handle(Standard_Transient) theent; - Handle(Interface_InterfaceModel) themodel; - Standard_Integer thetouched; - - -}; - - - - - - - -#endif // _IFSelect_EditForm_HeaderFile diff --git a/src/IFSelect/IFSelect_EditValue.hxx b/src/IFSelect/IFSelect_EditValue.hxx deleted file mode 100644 index 5d59fe424e..0000000000 --- a/src/IFSelect/IFSelect_EditValue.hxx +++ /dev/null @@ -1,37 +0,0 @@ -// Created on: 1992-09-21 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_EditValue_HeaderFile -#define _IFSelect_EditValue_HeaderFile - -//! Controls access on Values by an Editor -//! EditOptional : normal access, in addition may be removed -//! Editable : normal access, must be present -//! EditProtected : access must be validated -//! EditComputed : why write it ? it will be recomputed -//! EditRead : no way to write it, only for read -//! EditDynamic : not a field, only to be displayed -enum IFSelect_EditValue -{ -IFSelect_Optional, -IFSelect_Editable, -IFSelect_EditProtected, -IFSelect_EditComputed, -IFSelect_EditRead, -IFSelect_EditDynamic -}; - -#endif // _IFSelect_EditValue_HeaderFile diff --git a/src/IFSelect/IFSelect_Editor.cxx b/src/IFSelect/IFSelect_Editor.cxx deleted file mode 100644 index a5cf629848..0000000000 --- a/src/IFSelect/IFSelect_Editor.cxx +++ /dev/null @@ -1,231 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// 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 -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Editor,MMgt_TShared) - -IFSelect_Editor::IFSelect_Editor (const Standard_Integer nbval) - : thenbval (nbval) , themaxsh (0) , themaxco (0) , themaxla (0) , - thevalues (1,nbval) , theshorts (1,nbval) , themodes (1,nbval) , - thelists (1,nbval) - { thenames = new Dico_DictionaryOfInteger; thelists.Init(-1); } - - void IFSelect_Editor::SetNbValues (const Standard_Integer nbval) -{ - if (nbval > thevalues.Upper()) Standard_OutOfRange::Raise("IFSelect_Editor:SetNbValues"); - thenbval = nbval; -} - - void IFSelect_Editor::SetValue - (const Standard_Integer num, const Handle(Interface_TypedValue)& typval, - const Standard_CString shortname, const IFSelect_EditValue editmode) -{ - if (num < 1 || num > thenbval) return; - TCollection_AsciiString shn (shortname); - Standard_Integer lng = shn.Length(); - if (lng > 0) thenames->SetItem (shortname,num); - if (lng > themaxsh) themaxsh = lng; - lng = (Standard_Integer) strlen (typval->Name()); - if (lng > themaxco) themaxco = lng; - lng = (Standard_Integer) strlen (typval->Label()); - if (lng > themaxla) themaxla = lng; - - thenames->SetItem (typval->Name(),num); - Standard_Integer edm = (Standard_Integer) editmode; - thevalues.SetValue (num,typval); - theshorts.SetValue (num,shn); - themodes.SetValue (num,edm); -} - - void IFSelect_Editor::SetList - (const Standard_Integer num, const Standard_Integer max) -{ - if (num < 1 || num > thenbval) return; - thelists.SetValue (num,max); -} - - Standard_Integer IFSelect_Editor::NbValues () const - { return thenbval; } - - Handle(Interface_TypedValue) IFSelect_Editor::TypedValue - (const Standard_Integer num) const - { return Handle(Interface_TypedValue)::DownCast(thevalues.Value(num)); } - -Standard_Boolean IFSelect_Editor::IsList (const Standard_Integer num) const -{ - if (num < 1 || num > thenbval) return Standard_False; - return (thelists.Value(num) >= 0); -} - -Standard_Integer IFSelect_Editor::MaxList (const Standard_Integer num) const -{ - if (num < 1 || num > thenbval) return -1; - return thelists.Value(num); -} - - Standard_CString IFSelect_Editor::Name - (const Standard_Integer num, const Standard_Boolean isshort) const -{ - if (num < 1 || num > thenbval) return ""; - if (isshort) return theshorts.Value (num).ToCString(); - else return TypedValue (num)->Name(); -} - - IFSelect_EditValue IFSelect_Editor::EditMode - (const Standard_Integer num) const -{ - if (num < 1 || num > thenbval) return IFSelect_EditDynamic; - Standard_Integer edm = themodes.Value(num); - return (IFSelect_EditValue) edm; -} - - void IFSelect_Editor::PrintNames (const Handle(Message_Messenger)& S) const -{ - Standard_Integer i, nb = NbValues(); - S<<"**** Editor : "< 0) S<<"Short"< 0) { - const TCollection_AsciiString& sho = theshorts(i); - S<Name()<Name(),themaxco)<<" "<Label()< 0) S<<"Short"<Label()<Label(),themaxla); - else { - if (themaxsh > 0) { - const TCollection_AsciiString& sho = theshorts(i); - S<Name()<Name(),themaxco); - } - - S<<" "; - Standard_Integer maxls = MaxList (i); - if (maxls == 0) S<<" (List) "; - else if (maxls > 0) S<<" (List <= "<Definition()<GetItem(name,res,Standard_False)) return res; - res = atoi (name); // si c est un entier, on tente le coup - if (res < 1 || res > NbValues()) res = 0; - return res; -} - - - Handle(IFSelect_EditForm) IFSelect_Editor::Form - (const Standard_Boolean readonly, const Standard_Boolean undoable) const -{ - return new IFSelect_EditForm (this,readonly,undoable,Label().ToCString()); -} - - Handle(IFSelect_ListEditor) IFSelect_Editor::ListEditor - (const Standard_Integer num) const -{ - Handle(IFSelect_ListEditor) led; - Standard_Integer max = MaxList (num); - if (max < 0) return led; - led = new IFSelect_ListEditor (TypedValue(num),max); - return led; -} - - Handle(TColStd_HSequenceOfHAsciiString) IFSelect_Editor::ListValue - (const Handle(IFSelect_EditForm)& /*form*/, const Standard_Integer /*num*/) const -{ - Handle(TColStd_HSequenceOfHAsciiString) list; - return list; -} - - - Standard_Boolean IFSelect_Editor::Update - (const Handle(IFSelect_EditForm)& /*form*/, const Standard_Integer /*num*/, - const Handle(TCollection_HAsciiString)& /*newval*/, - const Standard_Boolean /*enforce*/) const - { return Standard_True; } - - Standard_Boolean IFSelect_Editor::UpdateList - (const Handle(IFSelect_EditForm)& /*form*/, const Standard_Integer /*num*/, - const Handle(TColStd_HSequenceOfHAsciiString)& /*newval*/, - const Standard_Boolean /*enforce*/) const - { return Standard_True; } diff --git a/src/IFSelect/IFSelect_Editor.hxx b/src/IFSelect/IFSelect_Editor.hxx deleted file mode 100644 index 1e95d96c59..0000000000 --- a/src/IFSelect/IFSelect_Editor.hxx +++ /dev/null @@ -1,200 +0,0 @@ -// Created on: 1998-02-23 -// Created by: Christian CAILLET -// Copyright (c) 1998-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_Editor_HeaderFile -#define _IFSelect_Editor_HeaderFile - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -class Dico_DictionaryOfInteger; -class Standard_OutOfRange; -class Interface_TypedValue; -class Message_Messenger; -class TCollection_AsciiString; -class IFSelect_EditForm; -class TCollection_HAsciiString; -class IFSelect_ListEditor; -class Standard_Transient; -class Interface_InterfaceModel; - - -class IFSelect_Editor; -DEFINE_STANDARD_HANDLE(IFSelect_Editor, MMgt_TShared) - -//! An Editor defines a set of values and a way to edit them, on -//! an entity or on the model (e.g. on its header) -//! -//! Each Value is controlled by a TypedValue, with a number (it is -//! an Integer) and a name under two forms (complete and short) -//! and an edit mode -class IFSelect_Editor : public MMgt_TShared -{ - -public: - - - //! Sets a Typed Value for a given ident and short name, with an - //! Edit Mode - Standard_EXPORT void SetValue (const Standard_Integer num, const Handle(Interface_TypedValue)& typval, const Standard_CString shortname = "", const IFSelect_EditValue accessmode = IFSelect_Editable); - - //! Sets a parameter to be a List - //! max < 0 : not for a list (set when starting) - //! max = 0 : list with no length limit (default for SetList) - //! max > 0 : list limited to items - Standard_EXPORT void SetList (const Standard_Integer num, const Standard_Integer max = 0); - - //! Returns the count of Typed Values - Standard_EXPORT Standard_Integer NbValues() const; - - //! Returns a Typed Value from its ident - Standard_EXPORT Handle(Interface_TypedValue) TypedValue (const Standard_Integer num) const; - - //! Tells if a parameter is a list - Standard_EXPORT Standard_Boolean IsList (const Standard_Integer num) const; - - //! Returns max length allowed for a list - //! = 0 means : list with no limit - //! < 0 means : not a list - Standard_EXPORT Standard_Integer MaxList (const Standard_Integer num) const; - - //! Returns the name of a Value (complete or short) from its ident - //! Short Name can be empty - Standard_EXPORT Standard_CString Name (const Standard_Integer num, const Standard_Boolean isshort = Standard_False) const; - - //! Returns the edit mode of a Value - Standard_EXPORT IFSelect_EditValue EditMode (const Standard_Integer num) const; - - //! Returns the number (ident) of a Value, from its name, short or - //! complete. If not found, returns 0 - Standard_EXPORT Standard_Integer NameNumber (const Standard_CString name) const; - - Standard_EXPORT void PrintNames (const Handle(Message_Messenger)& S) const; - - Standard_EXPORT void PrintDefs (const Handle(Message_Messenger)& S, const Standard_Boolean labels = Standard_False) const; - - //! Returns the MaxLength of, according to what : - //! = -1 : length of short names - //! = 0 : length of complete names - //! = 1 : length of values labels - Standard_EXPORT Standard_Integer MaxNameLength (const Standard_Integer what) const; - - //! Returns the specific label - Standard_EXPORT virtual TCollection_AsciiString Label() const = 0; - - //! Builds and Returns an EditForm, empty (no data yet) - //! Can be redefined to return a specific type of EditForm - Standard_EXPORT virtual Handle(IFSelect_EditForm) Form (const Standard_Boolean readonly, const Standard_Boolean undoable = Standard_True) const; - - //! Tells if this Editor can work on this EditForm and its content - //! (model, entity ?) - Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(IFSelect_EditForm)& form) const = 0; - - //! Returns the value of an EditForm, for a given item - //! (if not a list. for a list, a Null String may be returned) - Standard_EXPORT virtual Handle(TCollection_HAsciiString) StringValue (const Handle(IFSelect_EditForm)& form, const Standard_Integer num) const = 0; - - //! Returns a ListEditor for a parameter which is a List - //! Default returns a basic ListEditor for a List, a Null Handle - //! if is not for a List. Can be redefined - Standard_EXPORT virtual Handle(IFSelect_ListEditor) ListEditor (const Standard_Integer num) const; - - //! Returns the value of an EditForm as a List, for a given item - //! If not a list, a Null Handle should be returned - //! Default returns a Null Handle, because many Editors have - //! no list to edit. To be redefined as required - Standard_EXPORT virtual Handle(TColStd_HSequenceOfHAsciiString) ListValue (const Handle(IFSelect_EditForm)& form, const Standard_Integer num) const; - - //! Loads original values from some data, to an EditForm - //! Remark: may be Null, this means all is concerned - //! Also may be Null, if no context applies for - //! And both and may be Null, for a full static - //! editor - Standard_EXPORT virtual Standard_Boolean Load (const Handle(IFSelect_EditForm)& form, const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const = 0; - - //! Updates the EditForm when a parameter is modified - //! I.E. default does nothing, can be redefined, as follows : - //! Returns True when done (even if does nothing), False in case - //! of refuse (for instance, if the new value is not suitable) - //! is the rank of the parameter for the EDITOR itself - //! True means that protected parameters can be touched - //! - //! If a parameter commands the value of other ones, when it is - //! modified, it is necessary to touch them by Touch from EditForm - Standard_EXPORT virtual Standard_Boolean Update (const Handle(IFSelect_EditForm)& form, const Standard_Integer num, const Handle(TCollection_HAsciiString)& newval, const Standard_Boolean enforce) const; - - //! Acts as Update, but when the value is a list - Standard_EXPORT virtual Standard_Boolean UpdateList (const Handle(IFSelect_EditForm)& form, const Standard_Integer num, const Handle(TColStd_HSequenceOfHAsciiString)& newlist, const Standard_Boolean enforce) const; - - //! Applies modified values of the EditForm with some data - //! Remark: may be Null, this means all is concerned - //! Also may be Null, if no context applies for - //! And both and may be Null, for a full static - //! editor - Standard_EXPORT virtual Standard_Boolean Apply (const Handle(IFSelect_EditForm)& form, const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const = 0; - - - - - DEFINE_STANDARD_RTTIEXT(IFSelect_Editor,MMgt_TShared) - -protected: - - - //! Prepares the list of Typed Values (gives its count) - //! This count can be tuned later, to a LOWER value, this allows - //! to initialize with a "maximum reservation" then cut the extra - Standard_EXPORT IFSelect_Editor(const Standard_Integer nbval); - - //! Adjusts the true count of values. It can be LOWER or equal to - //! the initial size (which then acts as a reservation), but never - //! greater - Standard_EXPORT void SetNbValues (const Standard_Integer nbval); - - - -private: - - - Standard_Integer thenbval; - Standard_Integer themaxsh; - Standard_Integer themaxco; - Standard_Integer themaxla; - Handle(Dico_DictionaryOfInteger) thenames; - TColStd_Array1OfTransient thevalues; - TColStd_Array1OfAsciiString theshorts; - TColStd_Array1OfInteger themodes; - TColStd_Array1OfInteger thelists; - - -}; - - - - - - - -#endif // _IFSelect_Editor_HeaderFile diff --git a/src/IFSelect/IFSelect_GeneralModifier.cxx b/src/IFSelect/IFSelect_GeneralModifier.cxx deleted file mode 100644 index 26bad6a67c..0000000000 --- a/src/IFSelect/IFSelect_GeneralModifier.cxx +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - - -#include -#include -#include -#include -#include - -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_GeneralModifier,MMgt_TShared) - -IFSelect_GeneralModifier::IFSelect_GeneralModifier - (const Standard_Boolean maychangegraph) { thechgr = maychangegraph; } - - Standard_Boolean IFSelect_GeneralModifier::MayChangeGraph () const - { return thechgr; } - - void IFSelect_GeneralModifier::SetDispatch - (const Handle(IFSelect_Dispatch)& disp) - { thedisp = disp; } - - Handle(IFSelect_Dispatch) IFSelect_GeneralModifier::Dispatch () const - { return thedisp; } - - Standard_Boolean IFSelect_GeneralModifier::Applies - (const Handle(IFSelect_Dispatch)& disp) const -{ - if (thedisp.IsNull()) return Standard_True; - if (thedisp != disp) return Standard_False; - return Standard_True; -} - - - void IFSelect_GeneralModifier::SetSelection - (const Handle(IFSelect_Selection)& sel) - { thesel = sel; } - - void IFSelect_GeneralModifier::ResetSelection () - { thesel.Nullify(); } - - Standard_Boolean IFSelect_GeneralModifier::HasSelection () const - { return !thesel.IsNull(); } - - Handle(IFSelect_Selection) IFSelect_GeneralModifier::Selection () const - { return thesel; } diff --git a/src/IFSelect/IFSelect_GeneralModifier.hxx b/src/IFSelect/IFSelect_GeneralModifier.hxx deleted file mode 100644 index 8f2d760e51..0000000000 --- a/src/IFSelect/IFSelect_GeneralModifier.hxx +++ /dev/null @@ -1,121 +0,0 @@ -// Created on: 1993-10-19 -// Created by: Christian CAILLET -// Copyright (c) 1993-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_GeneralModifier_HeaderFile -#define _IFSelect_GeneralModifier_HeaderFile - -#include -#include - -#include -#include -class IFSelect_Selection; -class IFSelect_Dispatch; -class TCollection_AsciiString; - - -class IFSelect_GeneralModifier; -DEFINE_STANDARD_HANDLE(IFSelect_GeneralModifier, MMgt_TShared) - -//! This class gives a frame for Actions which modify the effect -//! of a Dispatch, i.e. : -//! By Selections and Dispatches, an original Model can be -//! splitted into one or more "target" Models : these Models -//! contain Entities copied from the original one (that is, a -//! part of it). Basically, these dispatched Entities are copied -//! as identical to their original counterparts. Also the copied -//! Models reproduce the Header of the original one. -//! -//! Modifiers allow to change this copied content : this is the -//! way to be used for any kind of alterations, adaptations ... -//! They are exploited by a ModelCopier, which firstly performs -//! the copy operation described by Dispatches, then invokes the -//! Modifiers to work on the result. -//! -//! Each GeneralModifier can be attached to : -//! - all the Models produced -//! - a Dispatch (it will be applied to all the Models obtained -//! from this Dispatch) designated by its Ident in a ShareOut -//! - in addition, to a Selection (facultative) : this adds a -//! criterium, the Modifier is invoked on a produced Model only -//! if this Model contains an Entity copied from one of the -//! Entities designated by this Selection. -//! (for special Modifiers from IFAdapt, while they must work on -//! definite Entities, this Selection is mandatory to run) -//! -//! Remark : this class has no action attached, it only provides -//! a frame to work on criteria. Then, sub-classes will define -//! their kind of action, which can be applied at a precise step -//! of the production of a File : see Modifier, and in the -//! package IFAdapt, EntityModifier and EntityCopier -class IFSelect_GeneralModifier : public MMgt_TShared -{ - public: - - //! Returns True if this modifier may change the graph of - //! dependences (aknowledged at creation time) - Standard_EXPORT Standard_Boolean MayChangeGraph() const; - - //! Attaches to a Dispatch. If is Null, Resets it - //! (to apply the Modifier on every Dispatch) - Standard_EXPORT void SetDispatch (const Handle(IFSelect_Dispatch)& disp); - - //! Returns the Dispatch to be matched, Null if not set - Standard_EXPORT Handle(IFSelect_Dispatch) Dispatch() const; - - //! Returns True if a Model obtained from the Dispatch - //! is to be treated (apart from the Selection criterium) - //! If Dispatch(me) is Null, returns True. Else, checks - Standard_EXPORT Standard_Boolean Applies (const Handle(IFSelect_Dispatch)& disp) const; - - //! Sets a Selection : a Model is treated if it contains one or - //! more Entities designated by the Selection - Standard_EXPORT void SetSelection (const Handle(IFSelect_Selection)& sel); - - //! Resets the Selection : this criterium is not longer active - Standard_EXPORT void ResetSelection(); - - //! Returns True if a Selection is set as an additionnal criterium - Standard_EXPORT Standard_Boolean HasSelection() const; - - //! Returns the Selection, or a Null Handle if not set - Standard_EXPORT Handle(IFSelect_Selection) Selection() const; - - //! Returns a short text which defines the operation performed - Standard_EXPORT virtual TCollection_AsciiString Label() const = 0; - - DEFINE_STANDARD_RTTIEXT(IFSelect_GeneralModifier,MMgt_TShared) - - protected: - - //! Sets the Modifier criteria to default Values - //! (i.e. "always applies") - //! must be provided at creation time, to : - //! - False if this GeneralModifier surely lets the graph of - //! dependencies unchanged (NO edition of any reference, BUT - //! also NO entity added or replaced or removed) - //! - True if there is a possibility of changing the graph of - //! dependencies when this modifier is applied - Standard_EXPORT IFSelect_GeneralModifier(const Standard_Boolean maychangegraph); - - private: - - Handle(IFSelect_Selection) thesel; - Handle(IFSelect_Dispatch) thedisp; - Standard_Boolean thechgr; -}; - -#endif // _IFSelect_GeneralModifier_HeaderFile diff --git a/src/IFSelect/IFSelect_ListEditor.cxx b/src/IFSelect/IFSelect_ListEditor.cxx deleted file mode 100644 index 78c7be68c3..0000000000 --- a/src/IFSelect/IFSelect_ListEditor.cxx +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - - -#include -#include -#include -#include -#include - -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_ListEditor,MMgt_TShared) - -IFSelect_ListEditor::IFSelect_ListEditor () -: themax (0) , thetouc (0) { } - - IFSelect_ListEditor::IFSelect_ListEditor - (const Handle(Interface_TypedValue)& def, const Standard_Integer max) -: themax (max) , thedef (def) , thetouc (0) { } - - -void IFSelect_ListEditor::LoadModel (const Handle(Interface_InterfaceModel)& model) -{ themodl = model; } - -void IFSelect_ListEditor::LoadValues (const Handle(TColStd_HSequenceOfHAsciiString)& vals) -{ - theorig = vals; - ClearEdit(); -} - - -void IFSelect_ListEditor::SetTouched () -{ thetouc = 1; } - -void IFSelect_ListEditor::ClearEdit () -{ - theedit = new TColStd_HSequenceOfHAsciiString(); - thestat = new TColStd_HSequenceOfInteger(); - if (theorig.IsNull()) return; - Standard_Integer i,nb = theorig->Length(); - for (i = 1; i <= nb; i ++) { - theedit->Append (theorig->Value(i)); - thestat->Append (0); - } - thetouc = 0; -} - -// ######## CHECK ######## - -static Standard_Boolean CheckValue - (const Handle(TCollection_HAsciiString)& val, - const Handle(Interface_InterfaceModel)& modl, - const Handle(Interface_TypedValue)& thedef) -{ - if (val.IsNull() || modl.IsNull() || thedef.IsNull()) return Standard_True; - - Interface_ParamType pty = thedef->Type(); - if (!thedef->Satisfies(val)) return Standard_False; - if (pty == Interface_ParamIdent && !val.IsNull()) { - if (modl->NextNumberForLabel(val->ToCString(),0) <= 0) - return Standard_False; - } - return Standard_True; -} - -// ######## EDITION ######## - -Standard_Boolean IFSelect_ListEditor::LoadEdited - (const Handle(TColStd_HSequenceOfHAsciiString)& list) -{ - if (list.IsNull()) return Standard_False; - Standard_Integer i, nb = list->Length(); - if (nb > themax) return Standard_False; - -// check values - if (!thedef.IsNull()) { - for (i = 1; i <= nb; i ++) { - Handle(TCollection_HAsciiString) newval = list->Value(i); - if (!CheckValue (newval,themodl,thedef)) return Standard_False; - } - } - -// OK - theedit = list; - thestat = new TColStd_HSequenceOfInteger(); - for (i = 1; i <= nb; i ++) thestat->Append (1); - thetouc = 1; - - return Standard_True; -} - - -Standard_Boolean IFSelect_ListEditor::SetValue - (const Standard_Integer num, const Handle(TCollection_HAsciiString)& val) -{ - if (theedit.IsNull()) return Standard_False; - if (num < 1 || num > theedit->Length()) return Standard_False; - -// check value - if (!CheckValue(val,themodl,thedef)) return Standard_False; - -// OK - theedit->SetValue (num,val); - thestat->SetValue (num,1); - thetouc = 1; - return Standard_True; -} - - -Standard_Boolean IFSelect_ListEditor::AddValue - (const Handle(TCollection_HAsciiString)& val, const Standard_Integer atnum) -{ - if (theedit.IsNull()) return Standard_False; - if (themax > 0 && theedit->Length() >= themax) return Standard_False; - if (!CheckValue (val,themodl,thedef)) return Standard_False; - if (atnum > 0) { - theedit->InsertBefore (atnum,val); - thestat->InsertBefore (atnum,2); - } else { - theedit->Append (val); - thestat->Append (2); - } - thetouc = 2; - return Standard_True; -} - - -Standard_Boolean IFSelect_ListEditor::Remove - (const Standard_Integer num, const Standard_Integer howmany) -{ - if (theedit.IsNull()) return Standard_False; - Standard_Integer nb = theedit->Length(); - if (num < 0) return Standard_False; - if (num == 0) return Remove (nb-howmany,howmany); - - if ((num+howmany) > nb) return Standard_False; - theedit->Remove(num,howmany); - thestat->Remove(num,howmany); - thetouc = 3; - return Standard_True; -} - - -// ######## QUERIES ######## - -Handle(TColStd_HSequenceOfHAsciiString) IFSelect_ListEditor::OriginalValues () const -{ return theorig; } - -Handle(TColStd_HSequenceOfHAsciiString) IFSelect_ListEditor::EditedValues () const -{ return theedit; } - - -Standard_Integer IFSelect_ListEditor::NbValues (const Standard_Boolean edited) const -{ - if (edited) return (theedit.IsNull() ? 0 : theedit->Length()); - return (theorig.IsNull() ? 0 : theorig->Length()); -} - - -Handle(TCollection_HAsciiString) IFSelect_ListEditor::Value - (const Standard_Integer num, const Standard_Boolean edited) const -{ - Handle(TCollection_HAsciiString) val; - if (edited) { - if (theedit.IsNull()) return val; - if (num < 1 || num > theedit->Length()) return val; - val = theedit->Value(num); - } else { - if (theorig.IsNull()) return val; - if (num < 1 || num > theorig->Length()) return val; - val = theorig->Value(num); - } - return val; -} - -Standard_Boolean IFSelect_ListEditor::IsChanged (const Standard_Integer num) const -{ - if (thestat.IsNull()) return Standard_False; - if (num < 1 || num > thestat->Length()) return Standard_False; - Standard_Integer stat = thestat->Value(num); - return (stat != 0); -} - -Standard_Boolean IFSelect_ListEditor::IsModified (const Standard_Integer num) const -{ - if (thestat.IsNull()) return Standard_False; - if (num < 1 || num > thestat->Length()) return Standard_False; - Standard_Integer stat = thestat->Value(num); - return (stat == 1); -} - -Standard_Boolean IFSelect_ListEditor::IsAdded (const Standard_Integer num) const -{ - if (thestat.IsNull()) return Standard_False; - if (num < 1 || num > thestat->Length()) return Standard_False; - Standard_Integer stat = thestat->Value(num); - return (stat == 2); -} - -Standard_Boolean IFSelect_ListEditor::IsTouched () const - { return (thetouc != 0); } diff --git a/src/IFSelect/IFSelect_ListEditor.hxx b/src/IFSelect/IFSelect_ListEditor.hxx deleted file mode 100644 index c42631dd85..0000000000 --- a/src/IFSelect/IFSelect_ListEditor.hxx +++ /dev/null @@ -1,173 +0,0 @@ -// Created on: 1998-07-28 -// Created by: Christian CAILLET -// Copyright (c) 1998-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_ListEditor_HeaderFile -#define _IFSelect_ListEditor_HeaderFile - -#include -#include - -#include -#include -#include -#include -#include -class Interface_TypedValue; -class Interface_InterfaceModel; -class TCollection_HAsciiString; - - -class IFSelect_ListEditor; -DEFINE_STANDARD_HANDLE(IFSelect_ListEditor, MMgt_TShared) - -//! A ListEditor is an auxiliary operator for Editor/EditForm -//! I.E. it works on parameter values expressed as strings -//! -//! For a parameter which is a list, it may not be edited in once -//! by just setting a new value (as a string) -//! -//! Firstly, a list can be long (and tedious to be accessed flat) -//! then requires a better way of accessing -//! -//! Moreover, not only its VALUES may be changed (SetValue), but -//! also its LENGTH : items may be added or removed ... -//! -//! Hence, the way of editing a parameter as a list is : -//! - edit it separately, with the help of a ListEditor -//! - it remains possible to prepare a new list of values apart -//! - then give the new list in once to the EditForm -//! -//! An EditList is produced by the Editor, with a basic definition -//! This definition (brought by this class) can be redefined -//! Hence the Editor may produce a specific ListEditor as needed -class IFSelect_ListEditor : public MMgt_TShared -{ - -public: - - - //! Creates a ListEditor with absolutely no constraint - Standard_EXPORT IFSelect_ListEditor(); - - //! Creates a ListEditor, for which items of the list to edit are - //! defined by , and describes max length : - //! 0 (D) means no limit - //! value > 0 means : no more the items are allowed - Standard_EXPORT IFSelect_ListEditor(const Handle(Interface_TypedValue)& def, const Standard_Integer max = 0); - - //! Loads a Model. It is used to check items of type Entity(Ident) - Standard_EXPORT void LoadModel (const Handle(Interface_InterfaceModel)& model); - - //! Loads the original values for the list - //! Remark : If its length is mor then MaxLength, editions remain - //! allowed, except Add - Standard_EXPORT void LoadValues (const Handle(TColStd_HSequenceOfHAsciiString)& vals); - - //! Declares this ListEditor to have been touched (whatever action) - Standard_EXPORT void SetTouched(); - - //! Clears all editions already recorded - Standard_EXPORT void ClearEdit(); - - //! Loads a new list to replace the older one, in once ! - //! By default (can be redefined) checks the length of the list - //! and the value of each item according to the def - //! Items are all recorded as Modified - //! - //! If no def has been given at creation time, no check is done - //! Returns True when done, False if checks have failed ... a - //! specialisation may also lock it by returning always False ... - Standard_EXPORT virtual Standard_Boolean LoadEdited (const Handle(TColStd_HSequenceOfHAsciiString)& list); - - //! Sets a new value for the item (in edited list) - //! may be a Null Handle, then the value will be cleared but - //! not removed - //! Returns True when done. False if is out of range or if - //! does not satisfy the definition - Standard_EXPORT virtual Standard_Boolean SetValue (const Standard_Integer num, const Handle(TCollection_HAsciiString)& val); - - //! Adds a new item. By default appends (at the end of the list) - //! Can insert before a given rank , if positive - //! Returns True when done. False if MaxLength may be overpassed - //! or if does not satisfy the definition - Standard_EXPORT virtual Standard_Boolean AddValue (const Handle(TCollection_HAsciiString)& val, const Standard_Integer atnum = 0); - - //! Removes items from the list - //! By default removes one item. Else, count given by - //! Remove from rank included. By default, from the end - //! Returns True when done, False (and does not work) if case of - //! out of range of if is greater than current length - Standard_EXPORT virtual Standard_Boolean Remove (const Standard_Integer num = 0, const Standard_Integer howmany = 1); - - //! Returns the value from which the edition started - Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) OriginalValues() const; - - //! Returns the result of the edition - Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) EditedValues() const; - - //! Returns count of values, edited (D) or original - Standard_EXPORT Standard_Integer NbValues (const Standard_Boolean edited = Standard_True) const; - - //! Returns a value given its rank. Edited (D) or Original - //! A Null String means the value is cleared but not removed - Standard_EXPORT Handle(TCollection_HAsciiString) Value (const Standard_Integer num, const Standard_Boolean edited = Standard_True) const; - - //! Tells if a value (in edited list) has been changed, i.e. - //! either modified-value, or added - Standard_EXPORT Standard_Boolean IsChanged (const Standard_Integer num) const; - - //! Tells if a value (in edited list) has been modified-value - //! (not added) - Standard_EXPORT Standard_Boolean IsModified (const Standard_Integer num) const; - - //! Tells if a value (in edited list) has been added (new one) - Standard_EXPORT Standard_Boolean IsAdded (const Standard_Integer num) const; - - //! Tells if at least one edition (SetValue-AddValue-Remove) has - //! been recorded - Standard_EXPORT Standard_Boolean IsTouched() const; - - - - - DEFINE_STANDARD_RTTIEXT(IFSelect_ListEditor,MMgt_TShared) - -protected: - - - - -private: - - - Standard_Integer themax; - Handle(Interface_TypedValue) thedef; - Standard_Integer thetouc; - Handle(TColStd_HSequenceOfHAsciiString) theorig; - Handle(TColStd_HSequenceOfHAsciiString) theedit; - Handle(TColStd_HSequenceOfInteger) thestat; - Handle(Interface_InterfaceModel) themodl; - - -}; - - - - - - - -#endif // _IFSelect_ListEditor_HeaderFile diff --git a/src/IFSelect/IFSelect_ModelCopier.cxx b/src/IFSelect/IFSelect_ModelCopier.cxx deleted file mode 100644 index 278eca1949..0000000000 --- a/src/IFSelect/IFSelect_ModelCopier.cxx +++ /dev/null @@ -1,539 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// 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 -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_ModelCopier,MMgt_TShared) - -//#define MISOPOINT -IFSelect_ModelCopier::IFSelect_ModelCopier () { } - - void IFSelect_ModelCopier::SetShareOut - (const Handle(IFSelect_ShareOut)& sho) - { theshareout = sho; } - - -// ######################################################################## -// ######## OPERATIONS DE TRANSFERT GLOBAL (memorise ou non) ######## - - - void IFSelect_ModelCopier::ClearResult () - { thefilemodels.Clear(); thefilenames.Clear(); theapplieds.Clear(); - theremain.Nullify(); } - - - Standard_Boolean IFSelect_ModelCopier::AddFile - (const TCollection_AsciiString& filename, - const Handle(Interface_InterfaceModel)& content) -{ - Standard_Integer nb = thefilenames.Length(); - for (Standard_Integer i = 1; i <= nb; i ++) { - if (filename.IsEmpty()) continue; - if (thefilenames(i).IsEqual(filename)) return Standard_False; - } - Handle(IFSelect_AppliedModifiers) nulapplied; - thefilenames.Append (filename); - thefilemodels.Append (content); - theapplieds.Append (nulapplied); - return Standard_True; -} - - Standard_Boolean IFSelect_ModelCopier::NameFile - (const Standard_Integer num, - const TCollection_AsciiString& filename) -{ - Standard_Integer nb = thefilenames.Length(); - if (num <= 0 || num > nb) return Standard_False; - for (Standard_Integer i = 1; i <= nb; i ++) { - if (filename.IsEmpty()) continue; - if (thefilenames(i).IsEqual(filename)) return Standard_False; - } - thefilenames.SetValue(num,filename); - return Standard_True; -} - - Standard_Boolean IFSelect_ModelCopier::ClearFile - (const Standard_Integer num) -{ - Standard_Integer nb = thefilenames.Length(); - if (num <= 0 || num > nb) return Standard_False; - thefilenames.ChangeValue(num).Clear(); - return Standard_True; -} - - Standard_Boolean IFSelect_ModelCopier::SetAppliedModifiers - (const Standard_Integer num, const Handle(IFSelect_AppliedModifiers)& applied) -{ - Standard_Integer nb = theapplieds.Length(); - if (num <= 0 || num > nb) return Standard_False; - theapplieds.SetValue(num,applied); - return Standard_True; -} - - Standard_Boolean IFSelect_ModelCopier::ClearAppliedModifiers - (const Standard_Integer num) -{ - Standard_Integer nb = theapplieds.Length(); - if (num <= 0 || num > nb) return Standard_False; - theapplieds.ChangeValue(num).Nullify(); - return Standard_True; -} - -// .... Copy : Opere les Transferts, les Memorise (pas d envoi fichier ici) - - Interface_CheckIterator IFSelect_ModelCopier::Copy - (IFSelect_ShareOutResult& eval, - const Handle(IFSelect_WorkLibrary)& WL, - const Handle(Interface_Protocol)& protocol) -{ - Interface_CopyTool TC (eval.Graph().Model(), protocol); - return Copying (eval,WL,protocol,TC); -} - -// Copy Interne - - Interface_CheckIterator IFSelect_ModelCopier::Copying - (IFSelect_ShareOutResult& eval, - const Handle(IFSelect_WorkLibrary)& WL, - const Handle(Interface_Protocol)& protocol, - Interface_CopyTool& TC) -{ - Message::DefaultMessenger() << - "** WorkSession : Copying split data before sending"<Init(0); - for (eval.Evaluate(); eval.More(); eval.Next()) { - Handle(Interface_InterfaceModel) model; - TCollection_AsciiString filename = eval.FileName(); - Standard_Integer dispnum = eval.DispatchRank(); - Standard_Integer numod, nbmod; - eval.PacketsInDispatch (numod,nbmod); - Handle(IFSelect_AppliedModifiers) curapp; - CopiedModel (G, WL,protocol, eval.PacketRoot(), filename,dispnum,numod, TC, - model, curapp,checks); - - AddFile (filename, model); - theapplieds.SetValue (theapplieds.Length(), curapp); - } - theshareout->SetLastRun (theshareout->NbDispatches()); - checks.SetName ("X-STEP WorkSession : Split Copy (no Write)"); - return checks; -} - -// Send a deux arguments : Envoi Fichier du Resultat deja memorise - - Interface_CheckIterator IFSelect_ModelCopier::SendCopied - (const Handle(IFSelect_WorkLibrary)& WL, - const Handle(Interface_Protocol)& protocol) -{ - Message::DefaultMessenger() << - "** WorkSession : Sending split data already copied"< 0) { - for (Standard_Integer i = 1; i <= nb; i ++) { - if (FileName(i).Length() == 0) continue; - Handle(IFSelect_AppliedModifiers) curapp = theapplieds.Value(i); - IFSelect_ContextWrite ctx (FileModel(i),protocol,curapp,FileName(i).ToCString()); - Standard_Boolean res = WL->WriteFile (ctx); - Interface_CheckIterator checklst = ctx.CheckList(); - checks.Merge(checklst); -// (FileName(i).ToCString(), FileModel(i),protocol,curapp,checks); -// if (!checks.IsEmpty(Standard_False)) { -// sout<<" ** On Sending File n0."<AddFail (mess); - Message::DefaultMessenger() << - " ** Sending File n0."<Init(0); - for (eval.Evaluate(); eval.More(); eval.Next()) { - i ++; - Handle(Interface_InterfaceModel) model; - TCollection_AsciiString filename = eval.FileName(); - Standard_Integer dispnum = eval.DispatchRank(); - Standard_Integer numod, nbmod; - eval.PacketsInDispatch (numod,nbmod); - Handle(IFSelect_AppliedModifiers) curapp; - CopiedModel (G, WL,protocol, eval.PacketRoot(), filename,dispnum,numod, TC, - model, curapp, checks); - IFSelect_ContextWrite ctx (model,protocol,curapp,filename.ToCString()); - Standard_Boolean res = WL->WriteFile (ctx); - Interface_CheckIterator checklst = ctx.CheckList(); - checks.Merge(checklst); -// (filename.ToCString(), model, protocol, curapp, checks); -// if (!checks.IsEmpty(Standard_False)) { -// sout<<" ** On Sending File "<AddFail (mess); - Message::DefaultMessenger() << - " ** Sending File "<SetLastRun (theshareout->NbDispatches()); - checks.SetName ("X-STEP WorkSession : Split Send (only Write)"); - return checks; -} - - -// .... SendAll : Donnees a tranferer dans G, aucun split, envoi sur fichier - - Interface_CheckIterator IFSelect_ModelCopier::SendAll - (const Standard_CString filename, const Interface_Graph& G, - const Handle(IFSelect_WorkLibrary)& WL, - const Handle(Interface_Protocol)& protocol) -{ - Interface_CheckIterator checks; - checks.SetName ("X-STEP WorkSession : Send All"); - Message::DefaultMessenger() << - "** WorkSession : Sending all data"<NbEntities(); - for (i = 1; i <= nb; i ++) TC.Bind (model->Value(i),model->Value(i)); - - Interface_EntityIterator pipo; - Handle(Interface_InterfaceModel) newmod; - Handle(IFSelect_AppliedModifiers) applied; - CopiedModel (G, WL,protocol,pipo,TCollection_AsciiString(filename), - 0,0,TC,newmod, applied,checks); - - IFSelect_ContextWrite ctx (model,protocol,applied,filename); - Standard_Boolean res = WL->WriteFile (ctx); - Interface_CheckIterator checklst = ctx.CheckList(); - checks.Merge(checklst); - if (!res) checks.CCheck(0)->AddFail ("SendAll (WriteFile) has failed"); -// if (!checks.IsEmpty(Standard_False)) { -// Message::DefaultMessenger() << -// " ** SendAll has produced Check Messages : **"<NewEmptyModel(); - Interface_CopyTool TC (original, protocol); - TC.FillModel(newmod); // pour Header ... - -// Pas de copie : AddWithRefs plus declaration de Bind - Interface_GeneralLib lib(protocol); - for (list.Start(); list.More(); list.Next()) { - newmod->AddWithRefs (list.Value(),lib); - } - Standard_Integer i, nb = newmod->NbEntities(); - for (i = 1; i <= nb; i ++) TC.Bind (newmod->Value(i),newmod->Value(i)); - if (theremain.IsNull()) - { theremain = new TColStd_HArray1OfInteger(0,G.Size()); theremain->Init(0); } - - Interface_EntityIterator pipo; - Handle(IFSelect_AppliedModifiers) applied; - CopiedModel (G, WL,protocol, pipo,TCollection_AsciiString(filename), - 0,0,TC,newmod, applied,checks); -// Alimenter Remaining : les entites copiees sont a noter - Handle(Standard_Transient) ent1,ent2; - for (Standard_Integer ic = TC.LastCopiedAfter (0,ent1,ent2); ic > 0; - ic = TC.LastCopiedAfter (ic,ent1,ent2) ) { - if (ic <= theremain->Upper()) - theremain->SetValue(ic,theremain->Value(ic)+1); - } - IFSelect_ContextWrite ctx (newmod,protocol,applied,filename); - Standard_Boolean res = WL->WriteFile (ctx); - Interface_CheckIterator checklst = ctx.CheckList(); - checks.Merge(checklst); - if (!res) checks.CCheck(0)->AddFail ("SendSelected (WriteFile) has failed"); -// if (!checks.IsEmpty(Standard_False)) { -// Message::DefaultMessenger() << -// " ** SendSelected has produced Check Messages : **"< 0) { - newmod = original->NewEmptyModel(); - TC.Clear(); - WL->CopyModel (original,newmod,tocopy,TC); - - Handle(Standard_Transient) ent1,ent2; -// Alimenter Remaining : les entites copiees sont a noter - for (Standard_Integer ic = TC.LastCopiedAfter (0,ent1,ent2); ic > 0; - ic = TC.LastCopiedAfter (ic,ent1,ent2) ) { - if (ic <= theremain->Upper()) - theremain->SetValue(ic,theremain->Value(ic)+1); - } - } - else if (newmod.IsNull()) newmod = original; - -// ... Ensuite : On prend en compte les Model Modifiers ... - Standard_Integer nbmod = 0; - if (!theshareout.IsNull()) nbmod = theshareout->NbModifiers(Standard_True); - Standard_Integer i; // svv Jan11 2000 : porting on DEC - for (i = 1; i <= nbmod; i ++) { - Handle(IFSelect_Modifier) unmod = theshareout->ModelModifier(i); - -// D abord, critere Dispatch/Packet - if (dispnum > 0) - if (!unmod->Applies (theshareout->Dispatch(dispnum))) continue; - IFSelect_ContextModif ctx (G,TC,filename.ToCString()); -// Ensuite, la Selection - Handle(IFSelect_Selection) sel = unmod->Selection(); - if (!sel.IsNull()) { - Interface_EntityIterator entiter = sel->UniqueResult(G); - ctx.Select (entiter); - } - if (ctx.IsForNone()) continue; - unmod->Perform (ctx,newmod,protocol,TC); - Interface_CheckIterator checklst = ctx.CheckList(); - checks.Merge (checklst); - -// Faut-il enregistrer les erreurs dans newmod ? bonne question -// if (!checks.IsEmpty(Standard_False)) { -// Message::DefaultMessenger() << -// " Messages on Copied Model n0 "<NbModifiers(Standard_False); - if (nbmod == 0) return; - applied = new IFSelect_AppliedModifiers (nbmod,newmod->NbEntities()); - for (i = 1; i <= nbmod; i ++) { - Handle(IFSelect_GeneralModifier) unmod = theshareout->GeneralModifier(Standard_False,i); - -// D abord, critere Dispatch/Packet - if (dispnum > 0) - if (!unmod->Applies (theshareout->Dispatch(dispnum))) continue; -// Ensuite, la Selection - Handle(IFSelect_Selection) sel = unmod->Selection(); - if (sel.IsNull()) applied->AddModif (unmod); // vide -> on prend tout - else { - Interface_EntityIterator list = sel->UniqueResult(G); - Handle(Standard_Transient) newent; - -// Entites designees par la Selection et Copiees ? -// -> s ilyena au moins une, le Modifier s applique, sinon il est rejete -// -> et cette liste est exploitable par le Modifier ... - for (list.Start(); list.More(); list.Next()) { - if (TC.Search (list.Value(),newent)) - applied->AddNum (newmod->Number(newent)); - } - } - } -} - - - void IFSelect_ModelCopier::CopiedRemaining - (const Interface_Graph& G, const Handle(IFSelect_WorkLibrary)& WL, - Interface_CopyTool& TC, Handle(Interface_InterfaceModel)& newmod) -{ - Handle(Interface_InterfaceModel) original = G.Model(); -// Interface_CopyTool TC(original,protocol); - newmod = original->NewEmptyModel(); - TC.Clear(); - Interface_EntityIterator tocopy; - Standard_Integer nb = G.Size(); - theremain = new TColStd_HArray1OfInteger(0,nb+1); theremain->Init(0); - for (Standard_Integer i = 1; i <= nb; i ++) { - if (G.Status(i) == 0) tocopy.AddItem (original->Value(i)); - else theremain->SetValue(i,-1); // ?? -1 - } - WL->CopyModel (original,newmod,tocopy,TC); - - if (newmod->NbEntities() == 0) newmod.Nullify(); - else { -// CE QUI SUIT NE DOIT PAS ETRE SUPPRIME ! cf theremain - Handle(Standard_Transient) ent1,ent2; - for (Standard_Integer ic = TC.LastCopiedAfter (0,ent1,ent2); ic > 0; - ic = TC.LastCopiedAfter (ic,ent1,ent2) ) { - if (ic <= theremain->Upper()) - theremain->SetValue(ic,1); - } -// qq impressions de mise au point -#ifdef MISOPOINT - cout << " Remaining Model : " << newmod->NbEntities() << " Entities"<Value(i) == 0) { - if (ne == 0) cout << " Refractaires : "; - ne ++; cout << " " << i; - } - } - if (ne > 0) cout << " -- " << ne << " Entities" << endl; - else cout<<" -- Remaining data complete"<Upper()) return Standard_False; - for (Standard_Integer i = 1; i <= nb; i ++) { - if (CG.Status(i) >= 0) CG.SetStatus(i,CG.Status(i)+theremain->Value(i)); - } - theremain->Init(0); - return Standard_True; -} - -// ########################################################################## -// ######## RESULTAT de la Memorisation des Transferts ######## - - Standard_Integer IFSelect_ModelCopier::NbFiles () const - { return thefilemodels.Length(); } - - TCollection_AsciiString IFSelect_ModelCopier::FileName - (const Standard_Integer num) const - { return thefilenames.Value(num); } - - Handle(Interface_InterfaceModel) IFSelect_ModelCopier::FileModel - (const Standard_Integer num) const - { return thefilemodels.Value(num); } - - Handle(IFSelect_AppliedModifiers) IFSelect_ModelCopier::AppliedModifiers - (const Standard_Integer num) const - { return theapplieds.Value(num); } - - - void IFSelect_ModelCopier::BeginSentFiles - (const Handle(IFSelect_ShareOut)& sho, const Standard_Boolean record) -{ - thesentfiles.Nullify(); - if (record) thesentfiles = new TColStd_HSequenceOfHAsciiString(); -// et numerotation des fichiers par defaut : detenue par ShareOut - if (sho.IsNull()) return; - Standard_Integer lastrun = sho->LastRun(); - sho->ClearResult (Standard_True); - sho->SetLastRun (lastrun); // on ne s interesse quaux numeros -} - - void IFSelect_ModelCopier::AddSentFile (const Standard_CString filename) - { if (!thesentfiles.IsNull()) - thesentfiles->Append(new TCollection_HAsciiString(filename)); } - - Handle(TColStd_HSequenceOfHAsciiString) IFSelect_ModelCopier::SentFiles () const - { return thesentfiles; } diff --git a/src/IFSelect/IFSelect_ModelCopier.hxx b/src/IFSelect/IFSelect_ModelCopier.hxx deleted file mode 100644 index 6b486549a9..0000000000 --- a/src/IFSelect/IFSelect_ModelCopier.hxx +++ /dev/null @@ -1,278 +0,0 @@ -// Created on: 1993-08-26 -// Created by: Christian CAILLET -// Copyright (c) 1993-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_ModelCopier_HeaderFile -#define _IFSelect_ModelCopier_HeaderFile - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -class IFSelect_ShareOut; -class TCollection_AsciiString; -class Interface_InterfaceModel; -class IFSelect_AppliedModifiers; -class Interface_CheckIterator; -class IFSelect_ShareOutResult; -class IFSelect_WorkLibrary; -class Interface_Protocol; -class Interface_CopyTool; -class Interface_Graph; -class Interface_EntityIterator; - - -class IFSelect_ModelCopier; -DEFINE_STANDARD_HANDLE(IFSelect_ModelCopier, MMgt_TShared) - -//! This class performs the Copy operations involved by the -//! description of a ShareOut (evaluated by a ShareOutResult) -//! plus, if there are, the Modifications on the results, with -//! the help of Modifiers. Each Modifier can work on one or more -//! resulting packets, accoding its criteria : it operates on a -//! Model once copied and filled with the content of the packet. -//! -//! Modifiers can be : -//! - Model Modifiers, inheriting from the specific class Modifier -//! able to run on the content of a Model (header or entities), -//! activated by the ModelCopier itself -//! - File Modifiers, inheriting directly from GeneralModifier, -//! intended to be activated under the control of a WorkLibrary, -//! once the Model has been produced (i.e. to act on output -//! format, or other specific file features) -//! -//! The Copy operations can be : -//! - immediately put to files : for each packet, a Model is -//! created and filled, then the file is output, at that's all -//! - memorized : for each packet, a Model is created and filled, -//! it is memorized with the corresponding file name. -//! it is possible to query the result of memorization (list of -//! produced Models and their file names) -//! -> it is also possible to send it into the files : -//! once files are written, the result is cleared -//! -//! In addition, a list of really written files is managed : -//! A first call to BeginSentFiles clears the list and commands, -//! either to begin a new list, or to stop recording it. A call -//! to SentFiles returns the list (if recording has been required) -//! This list allows to globally exploit the set of produced files -//! -//! Remark : For operations which concern specific Entities, see -//! also in package IFAdapt : a sub-class of ModelCopier allows -//! to work with EntityModifier, in addition to Modifier itself -//! which still applies to a whole copied Model. -class IFSelect_ModelCopier : public MMgt_TShared -{ - -public: - - - //! Creates an empty ModelCopier - Standard_EXPORT IFSelect_ModelCopier(); - - //! Sets the ShareOut, which is used to define Modifiers to apply - Standard_EXPORT void SetShareOut (const Handle(IFSelect_ShareOut)& sho); - - //! Clears the list of produced Models - Standard_EXPORT void ClearResult(); - - //! Records a new File to be sent, as a couple - //! (Name as AsciiString, Content as InterfaceModel) - //! Returns True if Done, False if is already attached - //! to another File - Standard_EXPORT Standard_Boolean AddFile (const TCollection_AsciiString& filename, const Handle(Interface_InterfaceModel)& content); - - //! Changes the Name attached to a File which was formerly defined - //! by a call to AddFile - //! Returns True if Done, False else : if out of range or if - //! the new is already attached to another File - //! Remark : Giving an empty File Name is equivalent to ClearFile - Standard_EXPORT Standard_Boolean NameFile (const Standard_Integer num, const TCollection_AsciiString& filename); - - //! Clears the Name attached to a File which was formerly defined - //! by a call to AddFile. This Clearing can be undone by a call to - //! NameFile (with same ) - //! Returns True if Done, False else : if is out of range - Standard_EXPORT Standard_Boolean ClearFile (const Standard_Integer num); - - //! Sets a list of File Modifiers to be applied on a file - Standard_EXPORT Standard_Boolean SetAppliedModifiers (const Standard_Integer num, const Handle(IFSelect_AppliedModifiers)& applied); - - //! Clears the list of File Modifiers to be applied on a file - Standard_EXPORT Standard_Boolean ClearAppliedModifiers (const Standard_Integer num); - - //! Performs the Copy Operations, which include the Modifications - //! defined by the list of Modifiers. Memorizes the result, as a - //! list of InterfaceModels with the corresponding FileNames - //! They can then be sent, by the method Send, or queried - //! Copy calls internal method Copying. - //! Returns the produced CheckList - Standard_EXPORT Interface_CheckIterator Copy (IFSelect_ShareOutResult& eval, const Handle(IFSelect_WorkLibrary)& WL, const Handle(Interface_Protocol)& protocol); - - //! Sends the formerly defined results (see method Copy) to files, - //! then clears it - //! Remark : A Null File Name cause file to be not produced - Standard_EXPORT Interface_CheckIterator SendCopied (const Handle(IFSelect_WorkLibrary)& WL, const Handle(Interface_Protocol)& protocol); - - //! Performs the Copy Operations (which include the Modifications) - //! and Sends the result on files, without memorizing it. - //! (the memorized result is ignored : neither queried not filled) - Standard_EXPORT Interface_CheckIterator Send (IFSelect_ShareOutResult& eval, const Handle(IFSelect_WorkLibrary)& WL, const Handle(Interface_Protocol)& protocol); - - //! Sends a model (defined in ) into one file, without managing - //! remaining data, already sent files, etc. Applies the Model and - //! File Modifiers. - //! Returns True if well done, False else - Standard_EXPORT Interface_CheckIterator SendAll (const Standard_CString filename, const Interface_Graph& G, const Handle(IFSelect_WorkLibrary)& WL, const Handle(Interface_Protocol)& protocol); - - //! Sends a part of a model into one file. Model is gotten from - //! , the part is defined in . - //! Remaining data are managed and can be later be worked on. - //! Returns True if well done, False else - Standard_EXPORT Interface_CheckIterator SendSelected (const Standard_CString filename, const Interface_Graph& G, const Handle(IFSelect_WorkLibrary)& WL, const Handle(Interface_Protocol)& protocol, const Interface_EntityIterator& iter); - - //! Produces a Model copied from the Remaining List as - //! is a Null Handle if this list is empty - //! performs the copy by using - //! is assumed to have been defined with the starting model - //! same as defined by . - Standard_EXPORT void CopiedRemaining (const Interface_Graph& G, const Handle(IFSelect_WorkLibrary)& WL, Interface_CopyTool& TC, Handle(Interface_InterfaceModel)& newmod); - - //! Updates Graph status for remaining data, for each entity : - //! - Entities just Sent to file or Copied (by CopiedRemaining) - //! have their status set to 1 - //! - the other keep their former status (1 for Send/Copied, - //! 0 for Remaining) - //! These status are computed by Copying/Sending/CopiedRemaining - //! Then, SetRemaining updates graph status, and mustr be called - //! just after one of these method has been called - //! Returns True if done, False if remaining info if not in phase - //! which the Graph (not same counts of items) - Standard_EXPORT Standard_Boolean SetRemaining (Interface_Graph& CG) const; - - //! Returns the count of Files produced, i.e. the count of Models - //! memorized (produced by the mmethod Copy) with their file names - Standard_EXPORT Standard_Integer NbFiles() const; - - //! Returns the File Name for a file given its rank - //! It is empty after a call to ClearFile on same - Standard_EXPORT TCollection_AsciiString FileName (const Standard_Integer num) const; - - //! Returns the content of a file before sending, under the form - //! of an InterfaceModel, given its rank - Standard_EXPORT Handle(Interface_InterfaceModel) FileModel (const Standard_Integer num) const; - - //! Returns the list of File Modifiers to be applied on a file - //! when it will be sent, as computed by CopiedModel : - //! If it is a null handle, no File Modifier has to be applied. - Standard_EXPORT Handle(IFSelect_AppliedModifiers) AppliedModifiers (const Standard_Integer num) const; - - //! Begins a sequence of recording the really sent files - //! : the default file numbering is cleared - //! If is False, clears the list and stops recording - //! If is True, clears the list and commands recording - //! Creation time corresponds to "stop recording" - Standard_EXPORT void BeginSentFiles (const Handle(IFSelect_ShareOut)& sho, const Standard_Boolean record); - - //! Adds the name of a just sent file, if BeginSentFiles - //! has commanded recording; else does nothing - //! It is called by methods SendCopied Sending - Standard_EXPORT void AddSentFile (const Standard_CString filename); - - //! Returns the list of recorded names of sent files. Can be empty - //! (if no file has been sent). Returns a Null Handle if - //! BeginSentFiles has stopped recording. - Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) SentFiles() const; - - - - - DEFINE_STANDARD_RTTIEXT(IFSelect_ModelCopier,MMgt_TShared) - -protected: - - - //! Internal routine which does the effective Copy. It allows to - //! work, either with a standard CopyTool, or a specialised one - //! Copying itself is done by which uses a CopyTool - Standard_EXPORT Interface_CheckIterator Copying (IFSelect_ShareOutResult& eval, const Handle(IFSelect_WorkLibrary)& WL, const Handle(Interface_Protocol)& protocol, Interface_CopyTool& TC); - - //! Internal routine which does the effective Send. It allows to - //! work, either with a standard CopyTool, or a specialised one - Standard_EXPORT Interface_CheckIterator Sending (IFSelect_ShareOutResult& eval, const Handle(IFSelect_WorkLibrary)& WL, const Handle(Interface_Protocol)& protocol, Interface_CopyTool& TC); - - //! Performs the Copy of a unitary Packet - //! Input parameters are : - //! is the graph which defines the starting entities, it - //! contains the original InterfaceModel - //! performs the copy by using - //! is the used protocol (can be usefull for Modifiers) - //! is the list of Entities which are the Roots of the - //! packet to be copied - //! is the name of the file which will receive it - //! is the Identifier of the Dispatch which have produced - //! this packet, is the rank of the packet for this - //! Dispatch - //! is a CopyTool, which performs the copy - //! - //! Returned values (as arguments) are : - //! is the result of the copy, as a new InterfaceModel on - //! which Model Modifiers have already been applied (if there are) - //! determines the File Modifiers which remain to be - //! applied (when the file itself will be output) : for each File - //! Modifier recorded in , 's Value is : - //! - Null if this Modifier has not to be applied - //! - an empty list if this Modifier has to be applied without - //! distinguishing specific entities - //! - a list of numbers of entities in if this Modifier - //! concerns particularly these entities (which are the results - //! of copying the result of its input selection) - //! is the produced Check List (by Modifiers as required) - //! - //! Warning : File Modifiers are evaluated at the time of Copy itself - //! If their list is changed between this Copy and the Sending - //! itself of the file, these changes are ignored - Standard_EXPORT void CopiedModel (const Interface_Graph& G, const Handle(IFSelect_WorkLibrary)& WL, const Handle(Interface_Protocol)& protocol, const Interface_EntityIterator& topcopy, const TCollection_AsciiString& filename, const Standard_Integer dispnum, const Standard_Integer numod, Interface_CopyTool& TC, Handle(Interface_InterfaceModel)& newmod, Handle(IFSelect_AppliedModifiers)& applied, Interface_CheckIterator& checks) const; - - - -private: - - - IFSelect_SequenceOfInterfaceModel thefilemodels; - TColStd_SequenceOfAsciiString thefilenames; - IFSelect_SequenceOfAppliedModifiers theapplieds; - Handle(IFSelect_ShareOut) theshareout; - Handle(TColStd_HArray1OfInteger) theremain; - Handle(TColStd_HSequenceOfHAsciiString) thesentfiles; - - -}; - - - - - - - -#endif // _IFSelect_ModelCopier_HeaderFile diff --git a/src/IFSelect/IFSelect_ModelModifier.gxx b/src/IFSelect/IFSelect_ModelModifier.gxx deleted file mode 100644 index dd35c34442..0000000000 --- a/src/IFSelect/IFSelect_ModelModifier.gxx +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -//#include -#include - -IFSelect_ModelModifier::IFSelect_ModelModifier (const Standard_Boolean grf) - : IFSelect_Modifier (grf) { } - - void IFSelect_ModelModifier::Perform - (IFSelect_ContextModif& ctx, - const Handle(Interface_InterfaceModel)& target, - const Handle(Interface_Protocol)& protocol, - Interface_CopyTool& TC) const -{ - ctx.TraceModifier(this); - Handle(Model) targ = Handle(Model)::DownCast(target); - Handle(Proto) prot = Handle(Proto)::DownCast(protocol); - if (targ.IsNull()) { - ctx.CCheck()->AddFail("Model to Modify : unproper type"); - return; - } - PerformProtocol (ctx,targ,prot,TC); -} - - void IFSelect_ModelModifier::PerformProtocol - (IFSelect_ContextModif& ctx, - const Handle(Model)& target, - const Handle(Proto)& protocol, - Interface_CopyTool& TC) const -{ ctx.SetProtocol(protocol); Performing (ctx,target,TC); } diff --git a/src/IFSelect/IFSelect_ModifEditForm.cxx b/src/IFSelect/IFSelect_ModifEditForm.cxx deleted file mode 100644 index 8a731b33bb..0000000000 --- a/src/IFSelect/IFSelect_ModifEditForm.cxx +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// 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 - -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_ModifEditForm,IFSelect_Modifier) - -IFSelect_ModifEditForm::IFSelect_ModifEditForm - (const Handle(IFSelect_EditForm)& editform) - : IFSelect_Modifier (Standard_False) { theedit = editform; } - - Handle(IFSelect_EditForm) IFSelect_ModifEditForm::EditForm () const - { return theedit; } - - - void IFSelect_ModifEditForm::Perform - (IFSelect_ContextModif& ctx, - const Handle(Interface_InterfaceModel)& target, - const Handle(Interface_Protocol)& /*protocol*/, - Interface_CopyTool& /*TC*/) const -{ - for (ctx.Start(); ctx.More(); ctx.Next()) { - Standard_Boolean done = theedit->ApplyData(ctx.ValueResult(),target); - if (done) ctx.Trace(); - else ctx.AddWarning (ctx.ValueResult(),"EditForm could not be applied"); - } -} - - TCollection_AsciiString IFSelect_ModifEditForm::Label () const -{ - Standard_CString editlab = theedit->Label(); - TCollection_AsciiString lab ("Apply EditForm"); - if (editlab && editlab[0] != '\0') { - lab.AssignCat (" : "); - lab.AssignCat (editlab); - } - return lab; -} diff --git a/src/IFSelect/IFSelect_ModifEditForm.hxx b/src/IFSelect/IFSelect_ModifEditForm.hxx deleted file mode 100644 index 3965d1a2a6..0000000000 --- a/src/IFSelect/IFSelect_ModifEditForm.hxx +++ /dev/null @@ -1,78 +0,0 @@ -// Created on: 1998-02-27 -// Created by: Christian CAILLET -// Copyright (c) 1998-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_ModifEditForm_HeaderFile -#define _IFSelect_ModifEditForm_HeaderFile - -#include -#include - -#include -class IFSelect_EditForm; -class IFSelect_ContextModif; -class Interface_InterfaceModel; -class Interface_Protocol; -class Interface_CopyTool; -class TCollection_AsciiString; - - -class IFSelect_ModifEditForm; -DEFINE_STANDARD_HANDLE(IFSelect_ModifEditForm, IFSelect_Modifier) - -//! This modifier applies an EditForm on the entities selected -class IFSelect_ModifEditForm : public IFSelect_Modifier -{ - -public: - - - //! Creates a ModifEditForm. It may not change the graph - Standard_EXPORT IFSelect_ModifEditForm(const Handle(IFSelect_EditForm)& editform); - - //! Returns the EditForm - Standard_EXPORT Handle(IFSelect_EditForm) EditForm() const; - - //! Acts by applying an EditForm to entities, selected or all model - Standard_EXPORT void Perform (IFSelect_ContextModif& ctx, const Handle(Interface_InterfaceModel)& target, const Handle(Interface_Protocol)& protocol, Interface_CopyTool& TC) const Standard_OVERRIDE; - - //! Returns Label as "Apply EditForm <+ label of EditForm>" - Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE; - - - - - DEFINE_STANDARD_RTTIEXT(IFSelect_ModifEditForm,IFSelect_Modifier) - -protected: - - - - -private: - - - Handle(IFSelect_EditForm) theedit; - - -}; - - - - - - - -#endif // _IFSelect_ModifEditForm_HeaderFile diff --git a/src/IFSelect/IFSelect_ModifReorder.cxx b/src/IFSelect/IFSelect_ModifReorder.cxx deleted file mode 100644 index 76f675e7ea..0000000000 --- a/src/IFSelect/IFSelect_ModifReorder.cxx +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// 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 - -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_ModifReorder,IFSelect_Modifier) - -IFSelect_ModifReorder::IFSelect_ModifReorder (const Standard_Boolean rootlast) - : IFSelect_Modifier (Standard_True) { thertl = rootlast; } - - void IFSelect_ModifReorder::Perform (IFSelect_ContextModif& ctx, - const Handle(Interface_InterfaceModel)& target, - const Handle(Interface_Protocol)& /*protocol*/, - Interface_CopyTool& /*TC*/) const -{ - Interface_ShareTool sht (ctx.OriginalGraph()); - Interface_EntityIterator list = sht.All (ctx.OriginalModel(),thertl); - target->ClearEntities(); - for (list.Start(); list.More(); list.Next()) target->AddEntity (list.Value()); -} - -TCollection_AsciiString IFSelect_ModifReorder::Label () const -{ - Standard_CString astr = (Standard_CString ) ( thertl ? "Reorder, Roots last" : "Reorder, Roots first"); - return TCollection_AsciiString( astr ) ; -// ( thertl ? "Reorder, Roots last" : "Reorder, Roots first"); -} diff --git a/src/IFSelect/IFSelect_ModifReorder.hxx b/src/IFSelect/IFSelect_ModifReorder.hxx deleted file mode 100644 index b974c6bf2a..0000000000 --- a/src/IFSelect/IFSelect_ModifReorder.hxx +++ /dev/null @@ -1,83 +0,0 @@ -// Created on: 1996-03-15 -// Created by: Christian CAILLET -// Copyright (c) 1996-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_ModifReorder_HeaderFile -#define _IFSelect_ModifReorder_HeaderFile - -#include -#include - -#include -#include -class IFSelect_ContextModif; -class Interface_InterfaceModel; -class Interface_Protocol; -class Interface_CopyTool; -class TCollection_AsciiString; - - -class IFSelect_ModifReorder; -DEFINE_STANDARD_HANDLE(IFSelect_ModifReorder, IFSelect_Modifier) - -//! This modifier reorders a whole model from its roots, i.e. -//! according to status, it considers each of its -//! roots, then it orders all its shared entities at any level, -//! the result begins by the lower level entities ... ends by -//! the roots. -class IFSelect_ModifReorder : public IFSelect_Modifier -{ - -public: - - - //! Creates a ModifReorder. It may change the graph (it does !) - //! If is True (D), roots are set at the end of packets - //! Else, they are set at beginning (as done by AddWithRefs) - Standard_EXPORT IFSelect_ModifReorder(const Standard_Boolean rootlast = Standard_True); - - //! Acts by computing orders (by method All from ShareTool) then - //! forcing them in the model. Remark that selection is ignored : - //! ALL the model is processed in once - Standard_EXPORT void Perform (IFSelect_ContextModif& ctx, const Handle(Interface_InterfaceModel)& target, const Handle(Interface_Protocol)& protocol, Interface_CopyTool& TC) const Standard_OVERRIDE; - - //! Returns Label as "Reorder, Roots (last or first)" - Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE; - - - - - DEFINE_STANDARD_RTTIEXT(IFSelect_ModifReorder,IFSelect_Modifier) - -protected: - - - - -private: - - - Standard_Boolean thertl; - - -}; - - - - - - - -#endif // _IFSelect_ModifReorder_HeaderFile diff --git a/src/IFSelect/IFSelect_Modifier.cxx b/src/IFSelect/IFSelect_Modifier.cxx deleted file mode 100644 index eeebc1ec5b..0000000000 --- a/src/IFSelect/IFSelect_Modifier.cxx +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - - -#include -#include -#include -#include -#include -#include - -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Modifier,IFSelect_GeneralModifier) - -IFSelect_Modifier::IFSelect_Modifier (const Standard_Boolean grf) - : IFSelect_GeneralModifier (grf) { } diff --git a/src/IFSelect/IFSelect_Modifier.hxx b/src/IFSelect/IFSelect_Modifier.hxx deleted file mode 100644 index 71be4d71ca..0000000000 --- a/src/IFSelect/IFSelect_Modifier.hxx +++ /dev/null @@ -1,87 +0,0 @@ -// Created on: 1993-08-26 -// Created by: Christian CAILLET -// Copyright (c) 1993-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_Modifier_HeaderFile -#define _IFSelect_Modifier_HeaderFile - -#include -#include - -#include -#include -class IFSelect_ContextModif; -class Interface_InterfaceModel; -class Interface_Protocol; -class Interface_CopyTool; - - -class IFSelect_Modifier; -DEFINE_STANDARD_HANDLE(IFSelect_Modifier, IFSelect_GeneralModifier) - -//! This class gives a frame for Actions which can work globally -//! on a File once completely defined (i.e. afterwards) -//! -//! Remark : if no Selection is set as criterium, the Modifier is -//! set to work and should consider all the content of the Model -//! produced. -class IFSelect_Modifier : public IFSelect_GeneralModifier -{ - -public: - - - //! This deferred method defines the action specific to each class - //! of Modifier. It is called by a ModelCopier, once the Model - //! generated and filled. ModelCopier has already checked the - //! criteria (Dispatch, Model Rank, Selection) before calling it. - //! - //! detains informations about original data and selection. - //! The result of copying, on which modifications are to be done, - //! is . - //! allows to run additional copies as required - //! - //! In case of Error, use methods CCheck from the ContextModif - //! to aknowledge an entity Check or a Global Check with messages - Standard_EXPORT virtual void Perform (IFSelect_ContextModif& ctx, const Handle(Interface_InterfaceModel)& target, const Handle(Interface_Protocol)& protocol, Interface_CopyTool& TC) const = 0; - - - - - DEFINE_STANDARD_RTTIEXT(IFSelect_Modifier,IFSelect_GeneralModifier) - -protected: - - - //! Calls inherited Initialize, transmits to it the information - //! - Standard_EXPORT IFSelect_Modifier(const Standard_Boolean maychangegraph); - - - -private: - - - - -}; - - - - - - - -#endif // _IFSelect_Modifier_HeaderFile diff --git a/src/IFSelect/IFSelect_PacketList.cxx b/src/IFSelect/IFSelect_PacketList.cxx deleted file mode 100644 index 84969ab606..0000000000 --- a/src/IFSelect/IFSelect_PacketList.cxx +++ /dev/null @@ -1,146 +0,0 @@ -// Created on: 1994-09-02 -// Created by: Christian CAILLET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - - -#include -#include -#include -#include -#include -#include -#include - -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_PacketList,MMgt_TShared) - -IFSelect_PacketList::IFSelect_PacketList - (const Handle(Interface_InterfaceModel)& model) - : thedupls (0,model->NbEntities()) , - thepacks (100) , - theflags (0,model->NbEntities()) , - thename ("Packets") -{ - themodel = model; thelast = 0; thebegin = Standard_False; // begin-begin - thedupls.Init(0); theflags.Init(0); -} - - void IFSelect_PacketList::SetName (const Standard_CString name) - { thename.Clear(); thename.AssignCat (name); } - - Standard_CString IFSelect_PacketList::Name () const - { return thename.ToCString(); } - - Handle(Interface_InterfaceModel) IFSelect_PacketList::Model () const - { return themodel; } - - void IFSelect_PacketList::AddPacket () -{ - Standard_Integer nbl = thepacks.NbEntities(); - Standard_Integer nbe = theflags.Upper(); - for (Standard_Integer i = 1; i <= nbe; i ++) theflags.SetValue(i,0); - - if (thelast >= nbl) thepacks.SetNbEntities (nbl*2); - - if (!thebegin) thelast ++; - thepacks.SetNumber (thelast); - thebegin = Standard_False; -} - - - void IFSelect_PacketList::Add - (const Handle(Standard_Transient)& ent) -{ - Standard_Integer num = themodel->Number(ent); - if (num == 0) Interface_InterfaceError::Raise - ("PacketList:Add, Entity not in Model"); - if (thelast == 0) Interface_InterfaceError::Raise - ("PacketList:Add, no Packet yet added"); - if (theflags(num) != 0) return; - theflags(num) = 1; - thedupls(num) ++; - thepacks.Add(num); - thebegin = Standard_False; -} - - void IFSelect_PacketList::AddList - (const Handle(TColStd_HSequenceOfTransient)& list) -{ - if (list.IsNull()) return; - Standard_Integer i , nb = list->Length(); - thepacks.Reservate (nb+1); - for (i = 1; i <= nb; i ++) Add (list->Value(i)); -} - - - Standard_Integer IFSelect_PacketList::NbPackets () const - { return (thebegin ? thelast-1 : thelast); } - - Standard_Integer IFSelect_PacketList::NbEntities - (const Standard_Integer numpack) const -{ - if (numpack <= 0 || numpack > NbPackets()) return 0; - Interface_IntList lisi(thepacks,Standard_False); lisi.SetNumber (numpack); - return lisi.Length(); -} - - Interface_EntityIterator IFSelect_PacketList::Entities - (const Standard_Integer numpack) const -{ - Interface_EntityIterator list; - if (numpack <= 0 || numpack > NbPackets()) return list; - Interface_IntList lisi(thepacks,Standard_False); lisi.SetNumber (numpack); - Standard_Integer i , nb = lisi.Length(); - for (i = 1; i <= nb; i ++) - list.AddItem(themodel->Value(lisi.Value(i))); - return list; -} - - Standard_Integer IFSelect_PacketList::HighestDuplicationCount () const -{ - Standard_Integer i , nb = themodel->NbEntities(); - Standard_Integer high = 0; - for (i = 1; i <= nb; i ++) { - Standard_Integer j = thedupls.Value(i); - if (j > high) high = j; - } - return high; -} - - Standard_Integer IFSelect_PacketList::NbDuplicated - (const Standard_Integer newcount, const Standard_Boolean andmore) const -{ - Standard_Integer i, nb = themodel->NbEntities(); - Standard_Integer nbdu = 0; - - for (i = 1; i <= nb; i ++) { - Standard_Integer j = thedupls.Value(i); - if (j == newcount || (j > newcount && andmore)) nbdu ++; - } - return nbdu; -} - - Interface_EntityIterator IFSelect_PacketList::Duplicated - (const Standard_Integer newcount, const Standard_Boolean andmore) const -{ - Standard_Integer nb = themodel->NbEntities(); - Interface_EntityIterator list; - - Standard_Integer i; - for (i = 1; i <= nb; i ++) { - Standard_Integer j = thedupls.Value(i); - if (j == newcount || (j > newcount && andmore)) list.AddItem(themodel->Value(i)); - } - return list; -} diff --git a/src/IFSelect/IFSelect_PacketList.hxx b/src/IFSelect/IFSelect_PacketList.hxx deleted file mode 100644 index be14217f71..0000000000 --- a/src/IFSelect/IFSelect_PacketList.hxx +++ /dev/null @@ -1,136 +0,0 @@ -// Created on: 1994-09-02 -// Created by: Christian CAILLET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_PacketList_HeaderFile -#define _IFSelect_PacketList_HeaderFile - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -class Interface_InterfaceModel; -class Interface_InterfaceError; -class Standard_Transient; -class Interface_EntityIterator; - - -class IFSelect_PacketList; -DEFINE_STANDARD_HANDLE(IFSelect_PacketList, MMgt_TShared) - -//! This class gives a simple way to return then consult a -//! list of packets, determined from the content of a Model, -//! by various criteria. -//! -//! It allows to describe several lists with entities from a -//! given model, possibly more than one list knowing every entity, -//! and to determine the remaining list (entities in no lists) and -//! the duplications (with their count). -class IFSelect_PacketList : public MMgt_TShared -{ - -public: - - - //! Creates a PackList, empty, ready to receive entities from a - //! given Model - Standard_EXPORT IFSelect_PacketList(const Handle(Interface_InterfaceModel)& model); - - //! Sets a name to a packet list : this makes easier a general - //! routine to print it. Default is "Packets" - Standard_EXPORT void SetName (const Standard_CString name); - - //! Returns the recorded name for a packet list - Standard_EXPORT Standard_CString Name() const; - - //! Returns the Model of reference - Standard_EXPORT Handle(Interface_InterfaceModel) Model() const; - - //! Declares a new Packet, ready to be filled - //! The entities to be added will be added to this Packet - Standard_EXPORT void AddPacket(); - - //! Adds an entity from the Model into the current packet for Add - Standard_EXPORT void Add (const Handle(Standard_Transient)& ent); - - //! Adds an list of entities into the current packet for Add - Standard_EXPORT void AddList (const Handle(TColStd_HSequenceOfTransient)& list); - - //! Returns the count of non-empty packets - Standard_EXPORT Standard_Integer NbPackets() const; - - //! Returns the count of entities in a Packet given its rank, or 0 - Standard_EXPORT Standard_Integer NbEntities (const Standard_Integer numpack) const; - - //! Returns the content of a Packet given its rank - //! Null Handle if is out of range - Standard_EXPORT Interface_EntityIterator Entities (const Standard_Integer numpack) const; - - //! Returns the highest number of packets which know a same entity - //! For no duplication, should be one - Standard_EXPORT Standard_Integer HighestDuplicationCount() const; - - //! Returns the count of entities duplicated : - //! times, if is False, or - //! or more times, if is True - //! See Duplicated for more details - Standard_EXPORT Standard_Integer NbDuplicated (const Standard_Integer count, const Standard_Boolean andmore) const; - - //! Returns a list of entities duplicated : - //! times, if is False, or - //! or more times, if is True - //! Hence, count=2 & andmore=True gives all duplicated entities - //! count=1 gives non-duplicated entities (in only one packet) - //! count=0 gives remaining entities (in no packet at all) - Standard_EXPORT Interface_EntityIterator Duplicated (const Standard_Integer count, const Standard_Boolean andmore) const; - - - - - DEFINE_STANDARD_RTTIEXT(IFSelect_PacketList,MMgt_TShared) - -protected: - - - - -private: - - - Handle(Interface_InterfaceModel) themodel; - TColStd_Array1OfInteger thedupls; - Interface_IntList thepacks; - TColStd_Array1OfInteger theflags; - Standard_Integer thelast; - Standard_Boolean thebegin; - TCollection_AsciiString thename; - - -}; - - - - - - - -#endif // _IFSelect_PacketList_HeaderFile diff --git a/src/IFSelect/IFSelect_ParamEditor.cxx b/src/IFSelect/IFSelect_ParamEditor.cxx deleted file mode 100644 index 3380692fb0..0000000000 --- a/src/IFSelect/IFSelect_ParamEditor.cxx +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// 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 - -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_ParamEditor,IFSelect_Editor) - -IFSelect_ParamEditor::IFSelect_ParamEditor - (const Standard_Integer nbmax, const Standard_CString label) -: IFSelect_Editor (nbmax) , thelabel (label) -{ - SetNbValues (0); - if (thelabel.Length() == 0) thelabel.AssignCat ("Param Editor"); -} - -void IFSelect_ParamEditor::AddValue - (const Handle(Interface_TypedValue)& val, const Standard_CString shortname) -{ - SetNbValues (NbValues() + 1); - SetValue (NbValues(), val, shortname); -} - -void IFSelect_ParamEditor::AddConstantText - (const Standard_CString val, const Standard_CString shortname, - const Standard_CString longname) -{ - Handle(Interface_TypedValue) tv = new Interface_TypedValue - (longname[0] == '\0' ? shortname : longname); - tv->SetCStringValue (val); - SetNbValues (NbValues() + 1); - SetValue (NbValues(), tv, shortname, IFSelect_EditRead); -} - - -TCollection_AsciiString IFSelect_ParamEditor::Label () const - { return thelabel; } - -Standard_Boolean IFSelect_ParamEditor::Recognize - (const Handle(IFSelect_EditForm)& /*form*/) const - { return Standard_True; } // pas de contrainte - -Handle(TCollection_HAsciiString) IFSelect_ParamEditor::StringValue - (const Handle(IFSelect_EditForm)& /*form*/,const Standard_Integer num) const - { return TypedValue(num)->HStringValue(); } - - -Standard_Boolean IFSelect_ParamEditor::Load - (const Handle(IFSelect_EditForm)& form, - const Handle(Standard_Transient)& /*ent*/, - const Handle(Interface_InterfaceModel)& /*model*/) const -{ - Standard_Integer i, nb = NbValues(); - for (i = 1; i <= nb; i ++) form->LoadValue (i,TypedValue(i)->HStringValue()); - - return Standard_True; -} - - -Standard_Boolean IFSelect_ParamEditor::Apply - (const Handle(IFSelect_EditForm)& form, - const Handle(Standard_Transient)& /*ent*/, - const Handle(Interface_InterfaceModel)& /*model*/) const -{ - Standard_Integer i, nb = NbValues(); - for (i = 1; i <= nb; i ++) - if (form->IsModified(i)) - TypedValue (i)->SetHStringValue (form->EditedValue(i)); - - return Standard_True; -} - -Handle(IFSelect_ParamEditor) IFSelect_ParamEditor::StaticEditor - (const Handle(TColStd_HSequenceOfHAsciiString)& list, - const Standard_CString label) -{ - Handle(IFSelect_ParamEditor) editor; - if (list.IsNull()) return editor; - Standard_Integer i,nb = list->Length(); -// if (nb == 0) return editor; - editor = new IFSelect_ParamEditor (nb+10,label); - for (i = 1; i <= nb; i ++) { - Handle(Interface_Static) val = Interface_Static::Static - (list->Value(i)->ToCString()); - if (!val.IsNull()) editor->AddValue(val); - } - return editor; -} diff --git a/src/IFSelect/IFSelect_ParamEditor.hxx b/src/IFSelect/IFSelect_ParamEditor.hxx deleted file mode 100644 index 3386be0ca5..0000000000 --- a/src/IFSelect/IFSelect_ParamEditor.hxx +++ /dev/null @@ -1,107 +0,0 @@ -// Created on: 1998-07-30 -// Created by: Christian CAILLET -// Copyright (c) 1998-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_ParamEditor_HeaderFile -#define _IFSelect_ParamEditor_HeaderFile - -#include -#include - -#include -#include -#include -#include -#include -#include -class Interface_TypedValue; -class TCollection_AsciiString; -class IFSelect_EditForm; -class TCollection_HAsciiString; -class Standard_Transient; -class Interface_InterfaceModel; - - -class IFSelect_ParamEditor; -DEFINE_STANDARD_HANDLE(IFSelect_ParamEditor, IFSelect_Editor) - -//! A ParamEditor gives access for edition to a list of TypedValue -//! (i.e. of Static too) -//! Its definition is made of the TypedValue to edit themselves, -//! and can add some constants, which can then be displayed but -//! not changed (for instance, system name, processor version ...) -//! -//! I.E. it gives a way of editing or at least displaying -//! parameters as global -class IFSelect_ParamEditor : public IFSelect_Editor -{ - -public: - - - //! Creates a ParamEditor, empty, with a maximum count of params - //! (default is 100) - //! And a label, by default it will be "Param Editor" - Standard_EXPORT IFSelect_ParamEditor(const Standard_Integer nbmax = 100, const Standard_CString label = ""); - - //! Adds a TypedValue - //! By default, its short name equates its complete name, it can - //! be explicited - Standard_EXPORT void AddValue (const Handle(Interface_TypedValue)& val, const Standard_CString shortname = ""); - - //! Adds a Constant Text, it will be Read Only - //! By default, its long name equates its shortname - Standard_EXPORT void AddConstantText (const Standard_CString val, const Standard_CString shortname, const Standard_CString completename = ""); - - Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE; - - Standard_EXPORT Standard_Boolean Recognize (const Handle(IFSelect_EditForm)& form) const Standard_OVERRIDE; - - Standard_EXPORT Handle(TCollection_HAsciiString) StringValue (const Handle(IFSelect_EditForm)& form, const Standard_Integer num) const Standard_OVERRIDE; - - Standard_EXPORT Standard_Boolean Load (const Handle(IFSelect_EditForm)& form, const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE; - - Standard_EXPORT Standard_Boolean Apply (const Handle(IFSelect_EditForm)& form, const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE; - - //! Returns a ParamEditor to work on the Static Parameters of - //! which names are listed in - //! Null Handle if is null or empty - Standard_EXPORT static Handle(IFSelect_ParamEditor) StaticEditor (const Handle(TColStd_HSequenceOfHAsciiString)& list, const Standard_CString label = ""); - - - - - DEFINE_STANDARD_RTTIEXT(IFSelect_ParamEditor,IFSelect_Editor) - -protected: - - - - -private: - - - TCollection_AsciiString thelabel; - - -}; - - - - - - - -#endif // _IFSelect_ParamEditor_HeaderFile diff --git a/src/IFSelect/IFSelect_PrintFail.hxx b/src/IFSelect/IFSelect_PrintFail.hxx deleted file mode 100644 index 626e5416e6..0000000000 --- a/src/IFSelect/IFSelect_PrintFail.hxx +++ /dev/null @@ -1,32 +0,0 @@ -// Created on: 1992-09-21 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_PrintFail_HeaderFile -#define _IFSelect_PrintFail_HeaderFile - -//! Indicates whether there will -//! be information on warnings as well as on failures. The -//! terms of this enumeration have the following semantics: -//! - IFSelect_FailOnly gives information on failures only -//! - IFSelect_FailAndWarn gives information on both -//! failures and warnings. used to pilot PrintCheckList -enum IFSelect_PrintFail -{ -IFSelect_FailOnly, -IFSelect_FailAndWarn -}; - -#endif // _IFSelect_PrintFail_HeaderFile diff --git a/src/IFSelect/IFSelect_RemainMode.hxx b/src/IFSelect/IFSelect_RemainMode.hxx deleted file mode 100644 index 658cc57ec3..0000000000 --- a/src/IFSelect/IFSelect_RemainMode.hxx +++ /dev/null @@ -1,29 +0,0 @@ -// Created on: 1992-09-21 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_RemainMode_HeaderFile -#define _IFSelect_RemainMode_HeaderFile - - -enum IFSelect_RemainMode -{ -IFSelect_RemainForget, -IFSelect_RemainCompute, -IFSelect_RemainDisplay, -IFSelect_RemainUndo -}; - -#endif // _IFSelect_RemainMode_HeaderFile diff --git a/src/IFSelect/IFSelect_ReturnStatus.hxx b/src/IFSelect/IFSelect_ReturnStatus.hxx deleted file mode 100644 index b95172fb27..0000000000 --- a/src/IFSelect/IFSelect_ReturnStatus.hxx +++ /dev/null @@ -1,36 +0,0 @@ -// Created on: 1992-09-21 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_ReturnStatus_HeaderFile -#define _IFSelect_ReturnStatus_HeaderFile - -//! Qualifies an execution status : -//! RetVoid : normal execution which created nothing, or -//! no data to process -//! RetDone : normal execution with a result -//! RetError : error in command or input data, no execution -//! RetFail : execution was run and has failed -//! RetStop : indicates end or stop (such as Raise) -enum IFSelect_ReturnStatus -{ -IFSelect_RetVoid, -IFSelect_RetDone, -IFSelect_RetError, -IFSelect_RetFail, -IFSelect_RetStop -}; - -#endif // _IFSelect_ReturnStatus_HeaderFile diff --git a/src/IFSelect/IFSelect_SelectPointed.cxx b/src/IFSelect/IFSelect_SelectPointed.cxx index a043635ffb..c374a66410 100644 --- a/src/IFSelect/IFSelect_SelectPointed.cxx +++ b/src/IFSelect/IFSelect_SelectPointed.cxx @@ -13,7 +13,6 @@ #include -#include #include #include #include @@ -159,18 +158,6 @@ IFSelect_SelectPointed::IFSelect_SelectPointed () } } - void IFSelect_SelectPointed::Update - (const Handle(IFSelect_Transformer)& trf) -{ - Standard_Integer nb = theitems.Length(); - for (Standard_Integer i = nb; i > 0; i --) { - Handle(Standard_Transient) enfr, ento; - enfr = theitems.Value(i); - if (!trf->Updated(enfr,ento)) theitems.Remove(i); - else theitems.SetValue(i,ento); - } -} - // .... Actions Generales Interface_EntityIterator IFSelect_SelectPointed::RootResult diff --git a/src/IFSelect/IFSelect_SelectPointed.hxx b/src/IFSelect/IFSelect_SelectPointed.hxx index 2daaf83758..af27105f35 100644 --- a/src/IFSelect/IFSelect_SelectPointed.hxx +++ b/src/IFSelect/IFSelect_SelectPointed.hxx @@ -28,7 +28,6 @@ class Interface_InterfaceError; class Standard_Transient; class Interface_CopyControl; -class IFSelect_Transformer; class Interface_EntityIterator; class Interface_Graph; class TCollection_AsciiString; @@ -111,10 +110,6 @@ public: //! bound result is replaced by this result, else it is removed. Standard_EXPORT void Update (const Handle(Interface_CopyControl)& control); - //! Rebuilds the selected list, by querying a Transformer - //! (same principle as from a CopyControl) - Standard_EXPORT void Update (const Handle(IFSelect_Transformer)& trf); - //! Returns the list of selected items. Only the selected entities //! which are present in the graph are given (this result assures //! uniqueness). diff --git a/src/IFSelect/IFSelect_SequenceOfAppliedModifiers.hxx b/src/IFSelect/IFSelect_SequenceOfAppliedModifiers.hxx deleted file mode 100644 index c6ae78a2db..0000000000 --- a/src/IFSelect/IFSelect_SequenceOfAppliedModifiers.hxx +++ /dev/null @@ -1,26 +0,0 @@ -// Created on: 1992-09-21 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef IFSelect_SequenceOfAppliedModifiers_HeaderFile -#define IFSelect_SequenceOfAppliedModifiers_HeaderFile - -#include -#include - -typedef NCollection_Sequence IFSelect_SequenceOfAppliedModifiers; - - -#endif diff --git a/src/IFSelect/IFSelect_SequenceOfGeneralModifier.hxx b/src/IFSelect/IFSelect_SequenceOfGeneralModifier.hxx deleted file mode 100644 index ad292c62ce..0000000000 --- a/src/IFSelect/IFSelect_SequenceOfGeneralModifier.hxx +++ /dev/null @@ -1,26 +0,0 @@ -// Created on: 1992-09-21 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef IFSelect_SequenceOfGeneralModifier_HeaderFile -#define IFSelect_SequenceOfGeneralModifier_HeaderFile - -#include -#include - -typedef NCollection_Sequence IFSelect_SequenceOfGeneralModifier; - - -#endif diff --git a/src/IFSelect/IFSelect_SessionDumper.cxx b/src/IFSelect/IFSelect_SessionDumper.cxx deleted file mode 100644 index add7efe846..0000000000 --- a/src/IFSelect/IFSelect_SessionDumper.cxx +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - - -#include -#include -#include -#include -#include -#include - -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SessionDumper,MMgt_TShared) - -static Handle(IFSelect_SessionDumper) thefirst; -static int cefait = 0; -// On commence la serie avec celui-la - - - IFSelect_SessionDumper::IFSelect_SessionDumper () -{ - if (!cefait) - { cefait = 1; Handle(IFSelect_BasicDumper) bid = new IFSelect_BasicDumper; } - else thenext = thefirst; - thefirst = this; // as Handle -} - - Handle(IFSelect_SessionDumper) IFSelect_SessionDumper::First () - { return thefirst; } - - Handle(IFSelect_SessionDumper) IFSelect_SessionDumper::Next () const - { return thenext; } diff --git a/src/IFSelect/IFSelect_SessionDumper.hxx b/src/IFSelect/IFSelect_SessionDumper.hxx deleted file mode 100644 index 10febf2f79..0000000000 --- a/src/IFSelect/IFSelect_SessionDumper.hxx +++ /dev/null @@ -1,121 +0,0 @@ -// Created on: 1993-11-04 -// Created by: Christian CAILLET -// Copyright (c) 1993-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_SessionDumper_HeaderFile -#define _IFSelect_SessionDumper_HeaderFile - -#include -#include - -#include -#include -class IFSelect_SessionFile; -class Standard_Transient; -class TCollection_AsciiString; - - -class IFSelect_SessionDumper; -DEFINE_STANDARD_HANDLE(IFSelect_SessionDumper, MMgt_TShared) - -//! A SessionDumper is called by SessionFile. It takes into -//! account a set of classes (such as Selections, Dispatches ...). -//! SessionFile writes the Type (as defined by cdl) of each Item -//! and its general Parameters. It manages the names of the Items. -//! -//! A SessionDumper must be able to Write the Parameters which are -//! own of each Item it takes into account, given its Class, then -//! to Recognize the Type and Read its Own Parameters to create -//! an Item of this Type with these own Parameters. -//! -//! Then, there must be defined one sub-type of SessionDumper per -//! consistent set of classes (e.g. a package). -//! -//! By Own Parameters, understand Parameters given at Creation Time -//! if there are, or specific of a given class, apart from those -//! defined at superclass levels (e.g. Final Selection for a -//! Dispatch, Input Selection for a SelectExtract or SelectDeduct, -//! Direct Status for a SelectExtract, etc...). -//! -//! The Parameters are those stored in a WorkSession, they can be -//! of Types : IntParam, HAsciiString (for TextParam), Selection, -//! Dispatch. -//! -//! SessionDumpers are organized in a Library which is used by -//! SessionFile. They are put at Creation Time in this Library. -class IFSelect_SessionDumper : public MMgt_TShared -{ - -public: - - - //! Returns the First item of the Library of Dumper. The Next ones - //! are then obtained by Next on the returned items - Standard_EXPORT static Handle(IFSelect_SessionDumper) First(); - - //! Returns the Next SesionDumper in the Library. Returns a Null - //! Handle at the End. - Standard_EXPORT Handle(IFSelect_SessionDumper) Next() const; - - //! Writes the Own Parameters of a given Item, if it forecast to - //! manage its Type. - //! Returns True if it has recognized the Type of the Item (in - //! this case, it is assumed to have written the Own Parameters if - //! there are some), False else : in that case, SessionFile will - //! try another SessionDumper in the Library. - //! WriteOwn can use these methods from SessionFile : SendVoid, - //! SendItem, SendText, and if necessary, WorkSession. - Standard_EXPORT virtual Standard_Boolean WriteOwn (IFSelect_SessionFile& file, const Handle(Standard_Transient)& item) const = 0; - - //! Recognizes a Type (given as ) then Creates an Item of - //! this Type with the Own Parameter, as required. - //! Returns True if it has recognized the Type (in this case, it - //! is assumed to have created the Item, returned as ), - //! False else : in that case, SessionFile will try another - //! SessionDumper in the Library. - //! ReadOwn can use these methods from SessionFile to access Own - //! Parameters : NbOwnParams, IsVoid, IsText, TextValue, ItemValue - Standard_EXPORT virtual Standard_Boolean ReadOwn (IFSelect_SessionFile& file, const TCollection_AsciiString& type, Handle(Standard_Transient)& item) const = 0; - - - - - DEFINE_STANDARD_RTTIEXT(IFSelect_SessionDumper,MMgt_TShared) - -protected: - - - //! The Initialization puts a just created SessionDumper in the - //! Library of SessionDumper. Then, it suffices to create once - //! a SessionDumper to fill the Library with it - Standard_EXPORT IFSelect_SessionDumper(); - - - -private: - - - Handle(IFSelect_SessionDumper) thenext; - - -}; - - - - - - - -#endif // _IFSelect_SessionDumper_HeaderFile diff --git a/src/IFSelect/IFSelect_SessionFile.cxx b/src/IFSelect/IFSelect_SessionFile.cxx deleted file mode 100644 index c69a136bc4..0000000000 --- a/src/IFSelect/IFSelect_SessionFile.cxx +++ /dev/null @@ -1,888 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// 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 -static int deja = 0; - - - IFSelect_SessionFile::IFSelect_SessionFile - (const Handle(IFSelect_WorkSession)& WS) -{ - ClearLines(); - themode = Standard_False; - if (!deja) { // au moins celui-la : - Handle(IFSelect_BasicDumper) basedumper = new IFSelect_BasicDumper; - deja = 1; - } - thedone = Standard_False; - thelastgen = 0; - thesess = WS; -} - - IFSelect_SessionFile::IFSelect_SessionFile - (const Handle(IFSelect_WorkSession)& WS, const Standard_CString filename) -{ - ClearLines(); - themode = Standard_True; - if (!deja) { // au moins celui-la : - Handle(IFSelect_BasicDumper) basedumper = new IFSelect_BasicDumper; - deja = 1; - } - thedone = Standard_False; - theownflag = Standard_False; - thelastgen = 0; - thesess = WS; - thedone = (Write (filename) == 0); -// Close fait par Write (selon les cas) -} - - - void IFSelect_SessionFile::ClearLines () - { thelist.Clear(); thenl = 0; } - - Standard_Integer IFSelect_SessionFile::NbLines () const - { return thelist.Length(); } - - - const TCollection_AsciiString& IFSelect_SessionFile::Line - (const Standard_Integer num) const - { return thelist.Value(num); } - - - void IFSelect_SessionFile::AddLine (const Standard_CString line) - { thelist.Append (TCollection_AsciiString(line) ); } - - void IFSelect_SessionFile::RemoveLastLine () - { if (thelist.Length() > 1) thelist.Remove(thelist.Length()); } - - - Standard_Boolean IFSelect_SessionFile::WriteFile - (const Standard_CString filename) -{ - FILE* lefic = OSD_OpenFile(filename,"w"); - Standard_Integer nbl = thelist.Length(); - for (Standard_Integer i = 1; i <= nbl; i ++) - fprintf (lefic,"%s\n",thelist.Value(i).ToCString()); - fclose ( lefic ); - ClearLines(); - return Standard_True; -} - - Standard_Boolean IFSelect_SessionFile::ReadFile - (const Standard_CString filename) -{ - char ligne[201]; - FILE* lefic = OSD_OpenFile(filename,"r"); - if (!lefic) return Standard_False; - ClearLines(); -// read mode : lire les lignes -// On charge le fichier dans "thelist" - Standard_Boolean header = Standard_False; - for(;;) { - ligne[0] = '\0'; - if (fgets(ligne,200,lefic) == NULL - || feof(lefic) != 0) - { - break; - } - if (ligne[0] == '\0') continue; -// D abord ligne initiale ? - if (!header) - { if (!RecognizeFile(ligne)) break; header = Standard_True; } - ligne[200] = '\0'; // fin forcee ... - TCollection_AsciiString onemore(ligne); - thelist.Append(onemore); - } - fclose ( lefic ); - return header; -} - - Standard_Boolean IFSelect_SessionFile::RecognizeFile - (const Standard_CString headerline) -{ - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - - SplitLine (headerline); - if (theline.Length() != 4) { sout<<"File Form Incorrect"<DynamicType(); - if (!theline.Value(1).IsEqual("!XSTEP") || - !theline.Value(2).IsEqual("SESSION") || - !theline.Value(4).IsEqual(sesstype->Name()) ) - { sout<<"Lineno."<MaxIdent(); - thenums = new TColStd_HArray1OfInteger (0,nbidents); thenums->Init(0); - Standard_Integer i; // svv Jan11 2000 : porting on DEC - for ( i = 1; i <= nbidents; i ++) { - Handle(Standard_Transient) item = thesess->Item(i); - if (!item.IsNull()) thenums->SetValue(i,-1); - } - -// ... ECRITURE - sprintf (laligne,"!XSTEP SESSION V1 %s",thesess->DynamicType()->Name()); - WriteLine(laligne,'\n'); - sprintf (laligne,"!GENERALS"); - WriteLine(laligne,'\n'); - sprintf (laligne,"ErrorHandle %d", (thesess->ErrorHandle() ? 1 : 0)); - WriteLine(laligne,'\n'); - Handle(TColStd_HSequenceOfInteger) idents; - Standard_Integer nb; - Handle(TCollection_HAsciiString) name; - - idents = thesess->ItemIdents(STANDARD_TYPE(IFSelect_IntParam)); - nb = idents->Length(); - if (nb > 0) WriteLine ("!INTEGERS",'\n'); - Standard_Integer j; // svv Jan11 2000 : porting on DEC - for (j = 1; j <= nb; j ++) { - i = idents->Value(j); - Handle(IFSelect_IntParam) P = thesess->IntParam(i); - name = thesess->Name(P); - if (name.IsNull()) { - thenewnum ++; idents->SetValue(i,thenewnum); - sprintf(laligne," #%d %d",thenewnum,P->Value()); - } - else sprintf(laligne," %s %d",name->ToCString(),P->Value()); - WriteLine(laligne,'\n'); - } - - idents = thesess->ItemIdents(STANDARD_TYPE(TCollection_HAsciiString)); - nb = idents->Length(); - if (nb > 0) WriteLine ("!TEXTS",'\n'); - for (j = 1; j <= nb; j ++) { - i = idents->Value(j); - Handle(TCollection_HAsciiString) P = thesess->TextParam(i); - name = thesess->Name(P); - if (name.IsNull()) { - thenewnum ++; thenums->SetValue(i,thenewnum); - sprintf(laligne," #%d %s",thenewnum,P->ToCString()); - } - else sprintf(laligne," %s %s",name->ToCString(),P->ToCString()); - WriteLine(laligne,'\n'); - } - - idents = thesess->ItemIdents(STANDARD_TYPE(IFSelect_Selection)); - nb = idents->Length(); - if (nb > 0) WriteLine ("!SELECTIONS",'\n'); - for (j = 1; j <= nb; j ++) { - i = idents->Value(j); - Handle(IFSelect_Selection) P = thesess->Selection(i); - NewItem (i,P); -// .. Ecritures particulieres -// -> Traiter les principaux sous-types : Extract,AnyList,AnyType - DeclareAndCast(IFSelect_SelectExtract,sxt,P); - if (!sxt.IsNull()) { - sprintf(laligne," %c", (sxt->IsDirect() ? 'D' : 'R')); - WriteLine(laligne); - } - DeclareAndCast(IFSelect_SelectAnyList,sli,P); - if (!sli.IsNull()) { - SetOwn(Standard_False); - WriteLine(" LIST"); - SendItem(sli->Lower()); - SendItem(sli->Upper()); - SetOwn(Standard_True); - } -// .. Ecritures specifiques selon dumpers - WriteOwn(P); - WriteLine("",'\n'); - } - - SetOwn(Standard_False); - if (nb > 0) WriteLine ("!SOURCES",'\n'); - for (j = 1; j <= nb; j ++) { - i = idents->Value(j); - Handle(IFSelect_Selection) P = thesess->Selection(i); - Standard_Integer nbs = thesess->NbSources(P); - if (nbs == 0) continue; - name = thesess->Name(P); - if (name.IsNull()) sprintf(laligne," #%d %d",thenums->Value(i),nbs); - else sprintf(laligne," %s %d",name->ToCString(),nbs); - WriteLine(laligne); - for (Standard_Integer k = 1; k <= nbs; k ++) - SendItem (thesess->Source(P,k)); - WriteLine("",'\n'); - } - - idents = thesess->ItemIdents(STANDARD_TYPE(IFSelect_GeneralModifier)); - nb = idents->Length(); - if (nb > 0) WriteLine ("!MODIFIERS",'\n'); - for (j = 1; j <= nb; j ++) { -// Description de base des Modifiers, donc sans Selection ni Dispatch-Rank - i = idents->Value(j); - Handle(IFSelect_GeneralModifier) P = thesess->GeneralModifier(i); - NewItem (i,P); - SetOwn(Standard_True); -// .. Ecritures specifiques selon dumpers - WriteOwn(P); - WriteLine("",'\n'); - } - - idents = thesess->ItemIdents(STANDARD_TYPE(IFSelect_Transformer)); - nb = idents->Length(); - if (nb > 0) WriteLine ("!TRANSFORMERS",'\n'); - for (j = 1; j <= nb; j ++) { -// Description des Transformers - i = idents->Value(j); - Handle(IFSelect_Transformer) P = thesess->Transformer(i); - NewItem (i,P); - SetOwn(Standard_True); -// .. Ecritures specifiques selon dumpers - WriteOwn(P); - WriteLine("",'\n'); - } - - SetOwn(Standard_False); - idents = thesess->ItemIdents(STANDARD_TYPE(IFSelect_Dispatch)); - nb = idents->Length(); - if (nb > 0) WriteLine ("!DISPATCHES",'\n'); - for (j = 1; j <= nb; j ++) { - i = idents->Value(j); - Handle(IFSelect_Dispatch) P = thesess->Dispatch(i); - NewItem (i,P); -// .. Final Selection - SetOwn(Standard_False); - SendItem(P->FinalSelection()); - SetOwn(Standard_True); -// .. Ecritures specifiques selon dumpers - WriteOwn(P); - WriteLine("",'\n'); - } - - WriteLine ("!FILENAMING"); - SetOwn(Standard_False); - Handle(TCollection_HAsciiString) namingpart = thesess->FilePrefix(); - if (namingpart->IsEmpty()) namingpart.Nullify(); - if (namingpart.IsNull()) SendVoid(); - else SendText(namingpart->ToCString()); - namingpart = thesess->DefaultFileRoot(); - if (namingpart->IsEmpty()) namingpart.Nullify(); - if (namingpart.IsNull()) SendVoid(); - else SendText(namingpart->ToCString()); - namingpart = thesess->FileExtension(); - if (namingpart->IsEmpty()) namingpart.Nullify(); - if (namingpart.IsNull()) SendVoid(); - else SendText(namingpart->ToCString()); - WriteLine("",'\n'); - - for (j = 1; j <= nb; j ++) { - i = idents->Value(j); - Handle(IFSelect_Dispatch) P = thesess->Dispatch(i); - if (!P->HasRootName()) continue; - namingpart = P->RootName(); - SetOwn(Standard_False); - SendItem(P); - sprintf(laligne," %s",namingpart->ToCString()); - WriteLine(laligne,' '); - WriteLine("",'\n'); - } - -// Pour les Modifiers, ATTENTION car il faut respecter l ORDRE effectif -// Or il y a deux listes : Model Modifiers; File Modifiers -// Les Modifiers eux-memes ont deja ete ecrits -// Ici, on ecrit simplement leur utilisation dans l envoi final - for (Standard_Integer formod = 1; formod >= 0; formod --) { - idents = thesess->FinalModifierIdents((formod > 0)); // donnes dans l ordre d application - nb = idents->Length(); - if (nb == 0) continue; - if (formod > 0) WriteLine ("!MODELMODIFIERS",'\n'); - else WriteLine ("!FILEMODIFIERS",'\n'); - for (j = 1; j <= nb; j ++) { - i = idents->Value(j); - Handle(IFSelect_GeneralModifier) P = thesess->GeneralModifier(i); - SetOwn(Standard_False); - SendItem(P); - // .. Parametres Generaux (les specifiques ont deja ete envoyes) - SendItem(P->Selection()); - SendItem(P->Dispatch()); - WriteLine("",'\n'); - } - } - -// ... Conclusion - theline.Clear(); - return 0; -} - - Standard_Integer IFSelect_SessionFile::WriteEnd () -{ - WriteLine("!XSTEP END",'\n'); // sinon, cf sous-types de SessionFile ... - return 0; -} - - - void IFSelect_SessionFile::WriteLine - (const Standard_CString line, const Standard_Character follow) -{ - if (line[0] != '\0') thebuff.AssignCat (line); - if (follow == '\0') return; - if (follow != '\n') thebuff.AssignCat(follow); - else { - thelist.Append(thebuff); - thebuff.Clear(); - thenl ++; - } -} - - Standard_Boolean IFSelect_SessionFile::WriteOwn - (const Handle(Standard_Transient)& item) -{ - if (item.IsNull()) return Standard_False; - SetOwn(Standard_True); - Handle(IFSelect_SessionDumper) dumper = IFSelect_SessionDumper::First(); - while (!dumper.IsNull()) { - if (dumper->WriteOwn(*this,item)) break; - dumper = dumper->Next(); - } - SetOwn(Standard_False); - return (!dumper.IsNull()); // IsNull -> echec -} - - - -// ################################################################## -// ######## ReadSession : Lecture du contenu ######## - - Standard_Integer IFSelect_SessionFile::ReadSession () -{ - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - - thedone = Standard_True; -// ... Preparation Specifique - thenums.Nullify(); - thenames = new Dico_DictionaryOfInteger; -// .. Donnees generales, controle - if (!ReadLine()) return 1; - if (theline.Length() != 4) { sout<<"File Form Incorrect"<DynamicType(); - if (!theline.Value(1).IsEqual("!XSTEP") || - !theline.Value(2).IsEqual("SESSION") || - !theline.Value(4).IsEqual(sesstype->Name()) ) - { sout<<"Lineno."<SetErrorHandle(Standard_False); - else if (theline.Value(2).IsEqual("1")) - thesess->SetErrorHandle(Standard_True); - else { sout<<"Lineno."<SetValue ( atoi(theline.Value(2).ToCString()) ); - AddItem (par); - } - -// .. TextParams (ligne de garde deja lue) - rubr = (theline.Length() == 1 && theline.Value(1).IsEqual("!TEXTS")); - while (rubr) { - if (!ReadLine()) return 1; - if (theline.Value(1).Value(1) == '!') break; // liste suivante - if (theline.Length() != 2) - { sout<<"Lineno."< 0) break; - } - oneline.Remove (1,inc); - AddItem ( new TCollection_HAsciiString (oneline.ToCString()) ); - } - -// .. Selections (ligne de garde deja lue) - rubr = (theline.Length() == 1 && theline.Value(1).IsEqual("!SELECTIONS")); - while (rubr) { - if (!ReadLine()) return 1; - if (theline.Value(1).Value(1) == '!') break; // liste suivante - if (theline.Length() < 2) - { sout<<"Lineno."< 2) { - if (theline.Value(3).IsEqual("D")) direct = 1; - else if (theline.Value(3).IsEqual("R")) direct = -1; - if (direct != 0) firstown ++; - if (firstown+2 <= theline.Length()) { - if (theline.Value(firstown).IsEqual("LIST")) { - numlist = firstown; firstown += 3; - low = GetCasted(IFSelect_IntParam,ItemValue(numlist+1)); - up = GetCasted(IFSelect_IntParam,ItemValue(numlist+2)); - } - } - SetLastGeneral (firstown-1); - } - Handle(Standard_Transient) item; // a fournir ... - ReadOwn(item); - if (item.IsNull()) continue; - DeclareAndCast(IFSelect_SelectExtract,sxt,item); - if (!sxt.IsNull()) { - if (direct == 0) sout<<"Lineno."<SetDirect( (direct > 0) ); - } - DeclareAndCast(IFSelect_SelectAnyList,sli,item); - if (!sli.IsNull()) { - if (numlist == 0) sout<<"Lineno."<SetRange(low,up); - } - AddItem(item); - } - -// .. Sources - rubr = (theline.Length() == 1 && theline.Value(1).IsEqual("!SOURCES")); - while (rubr) { - if (!ReadLine()) return 1; - if (theline.Value(1).Value(1) == '!') break; // liste suivante - if (theline.Length() < 3) - { sout<<"Lineno."< 1) - sout<<"Lineno."<SetInput(source); - } - DeclareAndCast(IFSelect_SelectDeduct,sdt,sel); - if (!sdt.IsNull()) { - if (nbs > 1) - sout<<"Lineno."<SetInput(GetCasted(IFSelect_Selection,ItemValue(3))); - } - DeclareAndCast(IFSelect_SelectControl,sct,sel); - if (!sct.IsNull()) { - if (nbs != 2) - sout<<"Lineno."<SetMainInput (GetCasted(IFSelect_Selection,ItemValue(3))); - sct->SetSecondInput (GetCasted(IFSelect_Selection,ItemValue(4))); - } - DeclareAndCast(IFSelect_SelectCombine,sco,sel); - if (!sco.IsNull()) { - for (Standard_Integer j = 1; j <= nbs; j ++) - sco->Add(GetCasted(IFSelect_Selection,ItemValue(j+2))); - } - } - -// ... Modifiers en tout genre - rubr = (theline.Length() == 1 && theline.Value(1).IsEqual("!MODIFIERS")); - while (rubr) { - if (!ReadLine()) return 1; - if (theline.Value(1).Value(1) == '!') break; // liste suivante - if (theline.Length() < 2) - { sout<<"Lineno."<SetItemSelection(disp,input); - } - -// ... FileNaming (ligne de garde deja lue) -// .. Modifiers deja lus et charges - rubr = (theline.Length() == 4 && theline.Value(1).IsEqual("!FILENAMING")); - if (rubr) { - if (!IsVoid(2)) thesess->SetFilePrefix (TextValue(2).ToCString()); - if (!IsVoid(3)) thesess->SetDefaultFileRoot (TextValue(3).ToCString()); - if (!IsVoid(4)) thesess->SetFileExtension (TextValue(4).ToCString()); - } - while (rubr) { - if (!ReadLine()) return 1; - if (theline.Value(1).Value(1) == '!') break; // liste suivante - if (theline.Length() != 2) - { sout<<"Lineno."<SetFileRoot (disp,theline.Value(2).ToCString()); - } - -// ... Modifiers (ligne de garde deja lue) -// ... Attention, deux listes (MODELMODIFIERS et FILEMODIFIERS) - for (Standard_Integer formod = 1; formod >= 0; formod --) { - rubr = (theline.Length() == 1 && - ( (formod == 1 && theline.Value(1).IsEqual("!MODELMODIFIERS")) || - (formod == 0 && theline.Value(1).IsEqual("!FILEMODIFIERS")) ) ); -// if ( formod == 1 && ( theline.Length() != 1 || -// !theline.Value(1).IsEqual("!MODELMODIFIERS")) ) -// { sout<<"Lineno."<SetItemSelection (modif,input); - if (!disp.IsNull()) thesess->SetAppliedModifier (modif,disp); - else thesess->SetAppliedModifier (modif,thesess->ShareOut()); - } - } - -// ... Conclusion : voir ReadEnd (separe) - return 0; -} - - Standard_Integer IFSelect_SessionFile::ReadEnd () -{ - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - if ( theline.Length() != 2 || - !theline.Value(1).IsEqual("!XSTEP") || - !theline.Value(2).IsEqual("END")) - { sout<<"End of File Incorrect, lineno"<= thelist.Length()) return Standard_False; - thenl ++; - Standard_CString ligne = thelist.Value(thenl).ToCString(); -// Lignes vides ? - if (ligne[0] == '\0') return ReadLine(); - SplitLine (ligne); - return Standard_True; -} - - - void IFSelect_SessionFile::SplitLine (const Standard_CString line) -{ - char mot[80]; - theline.Clear(); - Standard_Integer nbc = 0; - Standard_Boolean word = (line[0] > ' '); - for (Standard_Integer i = 0; line[i] != '\0'; i ++) { - if (line[i] > ' ') { - if (!word) { nbc = 0; word = Standard_True; } - mot[nbc] = line[i]; nbc ++; - } else { - if (word) { - word = Standard_False; - mot[nbc] = '\0'; - theline.Append (TCollection_AsciiString(mot)); - } - if (line[i] == '\0' || line[i] == '\n') break; - } - } - thelastgen = 0; -} - - Standard_Boolean IFSelect_SessionFile::ReadOwn - (Handle(Standard_Transient)& item) -{ - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - - if (theline.Length() < 2) return Standard_False; - const TCollection_AsciiString& type = theline.Value(2); - if (thelastgen < 2) thelastgen = 2; // mini : ident+type d abord -// thelastgen = theline.Length(); -// for (Standard_Integer i = theline.Length(); i > 0; i --) { -// if (theline.Value(i).Value(1) == ':') thelastgen = i - 1; -// } - Handle(IFSelect_SessionDumper) dumper = IFSelect_SessionDumper::First(); - while (!dumper.IsNull()) { - if (dumper->ReadOwn(*this,type,item)) break; - dumper = dumper->Next(); - } - if (dumper.IsNull()) sout<<" -- Lineno."< echec -} - - - void IFSelect_SessionFile::AddItem - (const Handle(Standard_Transient)& item, const Standard_Boolean active) -{ - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - - const TCollection_AsciiString& name = theline.Value(1); - Standard_Integer id = 0; - if (!item.IsNull()) { - if (name.Value(1) == '#') id = thesess->AddItem(item,active); - else if (!thesess->NamedItem(name.ToCString()).IsNull()) id = - thesess->AddItem(item,active); - else id = thesess->AddNamedItem(name.ToCString(),item,active); - } - else sout<<"Lineno."<SetItem(name.ToCString(),id); -} - - Standard_Boolean IFSelect_SessionFile::IsDone () const - { return thedone; } - - Handle(IFSelect_WorkSession) IFSelect_SessionFile::WorkSession () const - { return thesess; } - -// ######## Actions Unitaires d ECRITURE ######## - - void IFSelect_SessionFile::NewItem - (const Standard_Integer ident, const Handle(Standard_Transient)& par) -{ - char laligne[100]; - if (!thesess->HasName(par)) { - thenewnum ++; thenums->SetValue(ident,thenewnum); - sprintf(laligne," #%d %s",thenewnum,par->DynamicType()->Name()); - } - else sprintf(laligne," %s %s",thesess->Name(par)->ToCString(), - par->DynamicType()->Name()); - WriteLine(laligne); -} - - void IFSelect_SessionFile::SetOwn (const Standard_Boolean mode) - { theownflag = mode; } - - void IFSelect_SessionFile::SendVoid () -{ -//// if (theownflag) WriteLine(" :$"); - WriteLine(" $"); -} - - void IFSelect_SessionFile::SendItem (const Handle(Standard_Transient)& par) -{ - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - - char laligne[100]; - Standard_Integer filenum = 0; - Standard_Integer id = thesess->ItemIdent(par); - if (id != 0) filenum = thenums->Value(id); - if (filenum == 0) { - if (!par.IsNull()) sout << "Lineno " << thenl << " -- Unknown Item : " - << " Type:" << par->DynamicType()->Name() << endl; //sout<Name(par)->ToCString()); - else sprintf(laligne," #%d",filenum); - WriteLine(laligne); -} - - void IFSelect_SessionFile::SendText (const Standard_CString text) -{ - char laligne[100]; -//// if (theownflag) sprintf(laligne," :%s",text); - sprintf(laligne," %s",text); - WriteLine(laligne); -} - - -// ######## Actions Unitaires de LECTURE ######## - - void IFSelect_SessionFile::SetLastGeneral (const Standard_Integer lastgen) - { thelastgen = lastgen; } - - Standard_Integer IFSelect_SessionFile::NbParams () const - { return theline.Length() - thelastgen; } - - - Standard_Boolean IFSelect_SessionFile::IsVoid - (const Standard_Integer num) const -{ - Standard_Integer nm = num + thelastgen; - if (nm <= 0 || nm > theline.Length()) return Standard_True; - const TCollection_AsciiString& term = theline.Value(nm); - return (term.IsEqual ("$") || term.IsEqual (":$") ); -} - - Standard_Boolean IFSelect_SessionFile::IsText - (const Standard_Integer num) const -{ - Standard_Integer nm = num + thelastgen; - if (nm <= 0 || nm > theline.Length()) return Standard_False; - const TCollection_AsciiString& term = theline.Value(nm); - if (term.Value(1) == ':') return Standard_False; - if (term.Value(1) == '#') return Standard_False; - if (term.IsEqual("$")) return Standard_False; - return Standard_True; -} - - const TCollection_AsciiString& IFSelect_SessionFile::ParamValue - (const Standard_Integer num) const - { return theline.Value(num+thelastgen); } - - - TCollection_AsciiString IFSelect_SessionFile::TextValue - (const Standard_Integer num) const -{ - Standard_Integer nm = num + thelastgen; - TCollection_AsciiString res; - if (nm <= 0 || nm > theline.Length()) return res; - res = theline.Value(nm); - if (res.Value( res.Length() ) == '"') res.Remove(res.Length()); - if (res.Value(1) == ':') res.Remove(1); - if (res.Value(1) == '"') res.Remove(1); - return res; -} - - Handle(Standard_Transient) IFSelect_SessionFile::ItemValue - (const Standard_Integer num) const -{ - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - - Handle(Standard_Transient) res; - Standard_Integer nm = num + thelastgen; - if (nm <= 0 || nm > theline.Length()) return res; - Standard_Integer id; - TCollection_AsciiString name = theline.Value(nm); - if (name.Value(1) == ':') name.Remove(1); - if (name.IsEqual("$")) return res; // item non-defini justement - if (!thenames->GetItem(name.ToCString(),id)) { - sout << " -- Item Unknown in File : " << name - << " lineno " << thenl << " param." << nm << endl; - id = 0; - } - return thesess->Item(id); -} - - - void IFSelect_SessionFile::Destroy () -{ } // agit si File non ferme, sinon ne fait rien diff --git a/src/IFSelect/IFSelect_SessionFile.hxx b/src/IFSelect/IFSelect_SessionFile.hxx deleted file mode 100644 index 180d88f32c..0000000000 --- a/src/IFSelect/IFSelect_SessionFile.hxx +++ /dev/null @@ -1,308 +0,0 @@ -// Created on: 1993-11-03 -// Created by: Christian CAILLET -// Copyright (c) 1993-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_SessionFile_HeaderFile -#define _IFSelect_SessionFile_HeaderFile - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -class IFSelect_WorkSession; -class Dico_DictionaryOfInteger; -class TCollection_AsciiString; -class Standard_Transient; - - -//! A SessionFile is intended to manage access between a -//! WorkSession and an Ascii Form, to be considered as a Dump. -//! It allows to write the File from the WorkSession, and later -//! read the File to the WorkSession, by keeping required -//! descriptions (such as dependances). -//! -//! The produced File is under an Ascii Form, then it may be -//! easily consulted. -//! It is possible to cumulate reading of several Files. But in -//! case of Names conflict, the newer Names are forgottens. -//! -//! The Dump supports the description of XSTEP functionnalities -//! (Sharing an Interface File, with Selections, Dispatches, -//! Modifiers ...) but does not refer to the Interface File -//! which is currently loaded. -//! -//! SessionFile works with a library of SessionDumper type objects -//! -//! The File is Produced as follows : -//! SessionFile produces all general Informations (such as Int and -//! Text Parameters, Types and Inputs of Selections, Dispatches, -//! Modifiers ...) and calls the SessionDumpers to produce all -//! the particular Data : creation arguments, parameters to be set -//! It is Read in the same terms : -//! SessionFile reads and interprets all general Informations, -//! and calls the SessionDumpers to recognize Types and for a -//! recognized Type create the corresponding Object with its -//! particular parameters as they were written. -//! The best way to work is to have one SessionDumper for each -//! consistent set of classes (e.g. a package). -class IFSelect_SessionFile -{ -public: - - DEFINE_STANDARD_ALLOC - - - //! Creates a SessionFile, ready to read Files in order to load - //! them into a given WorkSession. - //! The following Read Operations must then be called. - //! It is also possible to perform a Write, which produces a - //! complete File of all the content of the WorkSession. - Standard_EXPORT IFSelect_SessionFile(const Handle(IFSelect_WorkSession)& WS); - - //! Creates a SessionFile which Writes the content of a WorkSession - //! to a File (directly calls Write) - //! Then, IsDone aknowledges on the result of the Operation. - //! But such a SessionFile may not Read a File to a WorkSession. - Standard_EXPORT IFSelect_SessionFile(const Handle(IFSelect_WorkSession)& WS, const Standard_CString filename); - - //! Clears the lines recorded whatever for writing or for reading - Standard_EXPORT void ClearLines(); - - //! Returns the count of recorded lines - Standard_EXPORT Standard_Integer NbLines() const; - - //! Returns a line given its rank in the list of recorded lines - Standard_EXPORT const TCollection_AsciiString& Line (const Standard_Integer num) const; - - //! Adds a line to the list of recorded lines - Standard_EXPORT void AddLine (const Standard_CString line); - - //! Removes the last line. Can be called recursively. - //! Does nothing if the list is empty - Standard_EXPORT void RemoveLastLine(); - - //! Writes the recorded lines to a file named then clears - //! the list of lines. - //! Returns False (with no clearing) if the file could not be - //! created - Standard_EXPORT Standard_Boolean WriteFile (const Standard_CString name); - - //! Reads the recorded lines from a file named , after - //! having cleared the list (stops if RecognizeFile fails) - //! Returns False (with no clearing) if the file could not be read - Standard_EXPORT Standard_Boolean ReadFile (const Standard_CString name); - - //! Recognizes the header line. returns True if OK, False else - Standard_EXPORT Standard_Boolean RecognizeFile (const Standard_CString headerline); - - //! Performs a Write Operation from a WorkSession to a File - //! i.e. calls WriteSession then WriteEnd, and WriteFile - //! Returned Value is : 0 for OK, -1 File could not be created, - //! >0 Error during Write (see WriteSession) - //! IsDone can be called too (will return True for OK) - Standard_EXPORT Standard_Integer Write (const Standard_CString filename); - - //! Performs a Read Operation from a file to a WorkSession - //! i.e. calls ReadFile, then ReadSession and ReadEnd - //! Returned Value is : 0 for OK, -1 File could not be opened, - //! >0 Error during Read (see WriteSession) - //! IsDone can be called too (will return True for OK) - Standard_EXPORT Standard_Integer Read (const Standard_CString filename); - - //! Prepares the Write operation from a WorkSession (IFSelect) to - //! a File, i.e. fills the list of lines (the file itself remains - //! to be written; or NbLines/Line may be called) - //! Important Remark : this excludes the reading of the last line, - //! which is performed by WriteEnd - //! Returns 0 if OK, status > 0 in case of error - Standard_EXPORT Standard_Integer WriteSession(); - - //! Writes the trailing line. It is separate from WriteSession, - //! in order to allow to redefine WriteSession without touching - //! WriteEnd (WriteSession defines the body of the file) - //! WriteEnd fills the list of lines. Returns a status of error, - //! 0 if OK, >0 else - Standard_EXPORT Standard_Integer WriteEnd(); - - //! Writes a line to the File. If is given, it is added - //! at the following of the line. '\n' must be added for the end. - Standard_EXPORT void WriteLine (const Standard_CString line, const Standard_Character follow = 0); - - //! Writes the Parameters own to each type of Item. Uses the - //! Library of SessionDumpers - //! Returns True if Done, False if could not be treated - //! (hence it remains written with no Own Parameter) - Standard_EXPORT Standard_Boolean WriteOwn (const Handle(Standard_Transient)& item); - - //! Performs a Read Operation from a File to a WorkSession, i.e. - //! reads the list of line (which must have already been loaded, - //! by ReadFile or by calls to AddLine) - //! Important Remark : this excludes the reading of the last line, - //! which is performed by ReadEnd - //! Returns 0 for OK, >0 status for Read Error (not a suitable - //! File, or WorkSession given as Immutable at Creation Time) - //! IsDone can be called too (will return True for OK) - Standard_EXPORT Standard_Integer ReadSession(); - - //! Reads the end of a file (its last line). Returns 0 if OK, - //! status >0 in case of error (not a suitable end line). - Standard_EXPORT Standard_Integer ReadEnd(); - - //! Reads a Line and splits it into a set of alphanumeric items, - //! which can then be queried by NbParams/ParamValue ... - Standard_EXPORT Standard_Boolean ReadLine(); - - //! Internal routine which processes a line into words - //! and prepares its exploration - Standard_EXPORT void SplitLine (const Standard_CString line); - - //! Tries to Read an Item, by calling the Library of Dumpers - //! Sets the list of parameters of the line to be read from the - //! first own one - Standard_EXPORT Standard_Boolean ReadOwn (Handle(Standard_Transient)& item); - - //! Adds an Item to the WorkSession, taken as Name the first - //! item of the read Line. If this Name is not a Name but a Number - //! or if this Name is already recorded in the WorkSession, it - //! adds the Item but with no Name. Then the Name is recorded - //! in order to be used by the method ItemValue - //! commands to make active or not in the session - Standard_EXPORT void AddItem (const Handle(Standard_Transient)& item, const Standard_Boolean active = Standard_True); - - //! Returns True if the last Read or Write operation has been - //! corectly performed. ELse returns False. - Standard_EXPORT Standard_Boolean IsDone() const; - - //! Returns the WorkSession on which a SessionFile works. - //! Remark that it is returned as Immutable. - Standard_EXPORT Handle(IFSelect_WorkSession) WorkSession() const; - - //! At beginning of writing an Item, writes its basics : - //! - either its name in the session if it has one - //! - or its relative number of item in the file, else - //! (preceeded by a '_') - //! - then, its Dynamic Type (in the sense of cdl : pk_class) - //! This basic description can be followed by the parameters - //! which are used in the definition of the item. - Standard_EXPORT void NewItem (const Standard_Integer ident, const Handle(Standard_Transient)& par); - - //! Sets Parameters to be sent as Own if is True (their - //! Name or Number or Void Mark or Text Value is preceeded by a - //! Column sign ':') else they are sent normally - //! Hence, the Own Parameter are clearly identified in the File - Standard_EXPORT void SetOwn (const Standard_Boolean mode); - - //! During a Write action, commands to send a Void Parameter - //! i.e. a Parameter which is present but undefined - //! Its form will be the dollar sign : $ - Standard_EXPORT void SendVoid(); - - //! During a Write action, commands to send the identification of - //! a Parameter : if it is Null (undefined) it is send as Void ($) - //! if it is Named in the WorkSession, its Name is sent preceeded - //! by ':', else a relative Ident Number is sent preceeded by '#' - //! (relative to the present Write, i.e. starting at one, without - //! skip, and counted part from Named Items) - Standard_EXPORT void SendItem (const Handle(Standard_Transient)& par); - - //! During a Write action, commands to send a Text without - //! interpretation. It will be sent as well - Standard_EXPORT void SendText (const Standard_CString text); - - //! Sets the rank of Last General Parameter to a new value. It is - //! followed by the Fist Own Parameter of the item. - //! Used by SessionFile after reading general parameters. - Standard_EXPORT void SetLastGeneral (const Standard_Integer lastgen); - - //! During a Read operation, SessionFile processes sequencially - //! the Items to read. For each one, it gives access to the list - //! of its Parameters : they were defined by calls to - //! SendVoid/SendParam/SendText during Writing the File. - //! NbParams returns the count of Parameters for the line - //! currently read. - Standard_EXPORT Standard_Integer NbParams() const; - - //! Returns True if a Parameter, given its rank in the Own List - //! (see NbOwnParams), is Void. Returns also True if is - //! out of range (undefined parameters) - Standard_EXPORT Standard_Boolean IsVoid (const Standard_Integer num) const; - - //! Returns True if a Parameter, in the Own List (see NbOwnParams) - //! is a Text (between "..."). Else it is an Item (Parameter, - //! Selection, Dispatch ...), which can be Void. - Standard_EXPORT Standard_Boolean IsText (const Standard_Integer num) const; - - //! Returns a Parameter (alphanumeric item of a line) as it - //! has been read - Standard_EXPORT const TCollection_AsciiString& ParamValue (const Standard_Integer num) const; - - //! Returns the content of a Text Parameter (without the quotes). - //! Returns an empty string if the Parameter is not a Text. - Standard_EXPORT TCollection_AsciiString TextValue (const Standard_Integer num) const; - - //! Returns a Parameter as an Item. Returns a Null Handle if the - //! Parameter is a Text, or if it is defined as Void - Standard_EXPORT Handle(Standard_Transient) ItemValue (const Standard_Integer num) const; - - //! Specific Destructor (closes the File if not yet done) - Standard_EXPORT void Destroy(); -~IFSelect_SessionFile() -{ - Destroy(); -} - - - - -protected: - - - - Handle(IFSelect_WorkSession) thesess; - Handle(TColStd_HArray1OfInteger) thenums; - Handle(Dico_DictionaryOfInteger) thenames; - Standard_Integer thenl; - TColStd_SequenceOfAsciiString theline; - - -private: - - - - Standard_Boolean themode; - TColStd_SequenceOfAsciiString thelist; - TCollection_AsciiString thebuff; - Standard_Integer thelastgen; - Standard_Boolean thedone; - Standard_Boolean theownflag; - Standard_Integer thenewnum; - - -}; - - - - - - - -#endif // _IFSelect_SessionFile_HeaderFile diff --git a/src/IFSelect/IFSelect_SessionPilot.cxx b/src/IFSelect/IFSelect_SessionPilot.cxx deleted file mode 100644 index 41b0e0f900..0000000000 --- a/src/IFSelect/IFSelect_SessionPilot.cxx +++ /dev/null @@ -1,449 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// 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 -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SessionPilot,IFSelect_Activator) - -#define MAXWORDS 200 -#define MAXCARS 1000 - -static int initactor = 0; -static TCollection_AsciiString nulword; - -//#define DEBUG_TRACE - -// Nb Maxi de words : cf thewords et method SetCommandLine - - IFSelect_SessionPilot::IFSelect_SessionPilot (const Standard_CString prompt) - : theprompt (prompt) , thewords (0,MAXWORDS-1) , thewordeb (0,MAXWORDS-1) -{ - if (theprompt.Length() == 0) theprompt.AssignCat ("Test-XSTEP>"); - therecord = Standard_False; thenbwords = 0; - if (initactor) return; initactor = 1; - Add (1,"x"); - Add (1,"exit"); - Add (2,"?"); - Add (2,"xhelp"); - Add (3,"xcommand"); - Add (4,"xsource"); - Add (5,"xstep"); - Add (6,"xnew"); -} - - - void IFSelect_SessionPilot::SetCommandLine - (const TCollection_AsciiString& command) -{ - Standard_Integer lc = command.Length(); - if (lc > 200) cout<<" Commande TRES LONGUE : "<= MAXWORDS) { unarg[nc] = val; nc ++; continue; } - unarg[nc] = '\0'; - thewords(thenbwords).Clear(); thewords(thenbwords).AssignCat(unarg); -#ifdef DEBUG_TRACE - cout<<"thewords("< MAXCARS) { cout<<"Arg."< "< 0) { - unarg[nc] = '\0'; thewords(thenbwords).Clear(); - thewords(thenbwords).AssignCat(unarg); -#ifdef DEBUG_TRACE - cout<<"thewords("< thenbwords) return Standard_False; - Standard_Integer i; // svv Jan11 2000 : porting on DEC - for (i = num; i < thenbwords; i ++) { - thewords(i).Clear(); - thewords(i).AssignCat(thewords(i+1).ToCString()); - } - thewords(thenbwords).Clear(); - thenbwords --; -// Et refaire thecommand. Si num = 0, on supprime le debut (facile) - if (num == 0) { - thecommand.Remove(1,thewordeb(1)); - } else { -// Sinon, reconstituer, a partir des words - thecommand.Clear(); - for (i = 0; i < thenbwords; i ++) { - if (i > 0) thecommand.AssignCat(" "); - thecommand.AssignCat(thewords(i)); - } - } - - return Standard_True; -} - - IFSelect_ReturnStatus IFSelect_SessionPilot::RecordItem - (const Handle(Standard_Transient)& item) -{ - theobjrec = item; - return (item.IsNull() ? IFSelect_RetFail : IFSelect_RetDone); -} - -// ####################################################################### -// ######## CONTROLE D EXECUTION - - - IFSelect_ReturnStatus IFSelect_SessionPilot::ReadScript - (const Standard_CString file) -{ - FILE* fic; int lefic = 0; - if (file != NULL && file[0] != '\0') { - fic = OSD_OpenFile (file,"r"); - if (fic) lefic = 1; - else { cout<<" ... Script File "<Do(num,this); -// Prise en compte des commandes a resultat -// Ici, resultat non nomme; Resultat nomme par commande x (plus loin) - if (!theobjrec.IsNull()) { - thesession->RemoveItem(theobjrec); //// depannage ? - Standard_Integer addws = thesession->AddItem(theobjrec); - if (addws == 0) { cout<<"Could not add item to session, sorry"<Clear(); - if (NbWords() <= numword) counter->AddModel (thesession->Model()); - else { -// on demande un givelist - Handle(TColStd_HSequenceOfTransient) list = thesession->GiveList (CommandPart(numword)); - if (list.IsNull()) { - cout<<"Nothing selected from : "<AddWithGraph (list,thesession->Graph()); - } - counter->PrintList(Message::DefaultMessenger(),thesession->Model(),mode); - return IFSelect_RetVoid; -} - - Standard_Integer IFSelect_SessionPilot::Number - (const Standard_CString val) const -{ - Standard_Integer num = thesession->NumberFromLabel (val); - if (num < 0) cout<<" Label:"<"<<-num<<" ent.s, refus"<Length(); - cout << " -- Liste des Commands Disponibles --"<Value(i); - Standard_Integer loncom = uncom.Length(); - nbcom ++; - if (nbcom > MAXCOMPERLINE) { cout< 0) cout< liste la ou les commande debutant par " - <<" avec un help sur chacune"<Length(); - for (Standard_Integer i = 1; i <= nb; i ++) { - Handle(IFSelect_Activator) actor; Standard_Integer num; - if (IFSelect_Activator::Select - (list->Value(i).ToCString(),num,actor)) { - if (IFSelect_Activator::Mode (list->Value(i).ToCString()) == 1) - cout<<"[xsnew name] "; - cout << list->Value(i) << " : " << actor->Help(num) << endl; - } - } - if (nb == 0 && thenbwords > 1) cout<<" Command "<CommandLine()<Word(i) <Clear(); break; // **** command clear - case 'f' : { - if (argc < 3) { cout<<"Donner nom de fichier"<NbCommands(); - if (nb == 0) { cout<<"Aucune commande enregistree"<Command(i)<RecordMode()) cout<<" -- Record Mode Actif"<NbCommands(); - cout << "Nb Commandes enregistrees : " << nb << " :"<Command(i)<RecordMode(); - if (mode) cout << " -- Record Mode a present Inactif" <SetRecordMode(!mode); - break; - } - default : cout << "Option de controle de commande non comprise"<ReadScript - (TCollection_AsciiString(session->Word(1)).ToCString()); -// On recopie la string parce que Word(1) change tout le temps ! - } - - case 5 : { // **** XSTEP - if (argc < 2) { - cout<<"xstep : prefixe neutre pour toute commande xstep-draw"<NameIdent(thewords(0).ToCString()) > 0) -////// { cout<<"Command with name:"<Do(num,this); -// Prise en compte des commandes a resultat - if (!theobjrec.IsNull()) { - thesession->RemoveItem(theobjrec); //// depannage ? - Standard_Integer addws = - thesession->AddNamedItem(name.ToCString(),theobjrec); - theobjrec.Nullify(); - if (addws == 0) { cout<<"Could not add named item:"< : commandes debutant par "; - case 3 : return "controle de commande. command tout court pour help complet"; - case 4 : return "lit les commandes depuis un fichier"; - case 5 : return "prefixe neutre pour xstep-draw"; - case 6 : return "creation item : donner nom_item puis commande args"; - default : return ""; - } -} diff --git a/src/IFSelect/IFSelect_SessionPilot.hxx b/src/IFSelect/IFSelect_SessionPilot.hxx deleted file mode 100644 index ec85dba79b..0000000000 --- a/src/IFSelect/IFSelect_SessionPilot.hxx +++ /dev/null @@ -1,216 +0,0 @@ -// Created on: 1993-07-27 -// Created by: Christian CAILLET -// Copyright (c) 1993-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_SessionPilot_HeaderFile -#define _IFSelect_SessionPilot_HeaderFile - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -class IFSelect_WorkSession; -class IFSelect_SignCounter; - - -class IFSelect_SessionPilot; -DEFINE_STANDARD_HANDLE(IFSelect_SessionPilot, IFSelect_Activator) - -//! A SessionPilot is intended to make easier the use of a -//! WorkSession. It receives commands, under alphanumeric form, -//! then calls a library of Activators to interprete and run them. -//! -//! Then, WorkSession just records data required to work : -//! Rules for Selection, Dispatch ... ; File Data (InterfaceModel -//! and results of Evaluations and Transfer as required). -//! SessionPilot records and works with alphanumeric commands and -//! their results (under a very simple form). It calls a list of -//! Activators to perform the actions. -//! -//! A Command can have several forms : -//! - classic execution, to list, evaluate, or enrich the session -//! - command which creates a new item (a Selection for instance) -//! such a command should not add it to the session, but make it -//! recorded by the Pilot (method RecordItem). The Pilot will -//! add the item in the session, with no name -//! -> such a command may be called : -//! - directly, it will add an item with no name -//! - by command xset, in the following form : -//! xset name command ... calls the command and adds the item -//! to the session under the specified name (if not yet known) -//! -//! Thus, to a specific Norm or way of working, only Activators -//! change. A specific Initialisation can be done by starting -//! with a specific set of commands. -//! -//! In addition, SessionPilot is a sub-type of Activator, to -//! recognize some built-in commands : exit/x, help/?, control of -//! command line, and commands xstep xset ... See method Do -//! -//! At least, empty lines and comment lines (beginning by '#') -//! are skipped (comment lines are display if read from file) -class IFSelect_SessionPilot : public IFSelect_Activator -{ - public: - - //! Creates an empty SessionPilot, with a prompt which will be - //! displayed on querying commands. If not precised (""), this - //! prompt is set to "Test-XSTEP>" - Standard_EXPORT IFSelect_SessionPilot(const Standard_CString prompt = ""); - - //! Returns the WorkSession which is worked on - const Handle(IFSelect_WorkSession) & Session() const { return thesession; } - - //! Returns the Record Mode for Commands. Default is False. - Standard_Boolean RecordMode() const { return therecord; } - - //! Sets a WorkSession to be worked on - void SetSession (const Handle(IFSelect_WorkSession)& WS) { thesession = WS; } - - //! Changes the RecordMode. - void SetRecordMode (const Standard_Boolean mode) { therecord = mode; } - - //! Sets the value of the Command Line to be interpreted - //! Also prepares the interpretation (splitting by blanks) - Standard_EXPORT void SetCommandLine (const TCollection_AsciiString& command); - - //! Returns the Command Line to be interpreted - const TCollection_AsciiString& CommandLine() const { return thecommand; } - - //! Returns the part of the command line which begins at argument - //! between 0 and NbWords-1 (by default, all the line) - //! Empty string if out of range - Standard_EXPORT Standard_CString CommandPart (const Standard_Integer numarg = 0) const; - - //! Returns the count of words of the Command Line, separated by - //! blanks : 0 if empty, one if a command without args, else it - //! gives the count of args minus one. - //! Warning : limited to 10 (command title + 9 args) - Standard_Integer NbWords() const { return thenbwords; } - - //! Returns a word given its rank in the Command Line. Begins at 0 - //! which is the Command Title, 1 is the 1st arg., etc... - Standard_EXPORT const TCollection_AsciiString& Word (const Standard_Integer num) const; - - //! Returns a word given its rank, as a CString. - //! As for Word, begins at 0 (the command name), etc... - Standard_EXPORT Standard_CString Arg (const Standard_Integer num) const; - - //! Removes a word given its rank. Returns True if Done, False if - //! is out of range - Standard_EXPORT Standard_Boolean RemoveWord (const Standard_Integer num); - - //! Returns the count of recorded Commands - Standard_Integer NbCommands() const { return thecomlist.Length(); } - - //! Returns a recorded Command, given its rank (from 1) - const TCollection_AsciiString& Command (const Standard_Integer num) const { return thecomlist(num); } - - //! Allows to associate a Transient Value with the last execution - //! as a partial result - //! Returns RetDone if item is not Null, RetFail if item is Null - //! Remark : it is nullified for each Perform - Standard_EXPORT IFSelect_ReturnStatus RecordItem (const Handle(Standard_Transient)& item); - - //! Returns the Transient Object which was recorded with the - //! current Line Command. If none was, returns a Null Handle - const Handle(Standard_Transient) & RecordedItem() const { return theobjrec; } - - //! Clears the recorded informations (commands, objects) - void Clear() { thecomlist.Clear(); } - - //! Reads commands from a Script File, named . By default - //! (file = ""), reads from standard input with a prompt - //! Else (reading from a file), the read commands are displayed - //! onto standard output. Allows nested reads. Reading is stopped - //! either by command x or exit, or by reaching end of file - //! Return Value follows the rules of Do : RetEnd for normal end, - //! RetFail if script could not be opened - Standard_EXPORT IFSelect_ReturnStatus ReadScript (const Standard_CString file = ""); - - //! Executes the Command, itself (for built-in commands, which - //! have priority) or by using the list of Activators. - //! The value returned is : RetVoid if nothing done (void command) - //! RetDone if execution OK, RetEnd if END OF SESSION, RetError if - //! command unknown or incorrect, RetFail if error on execution - //! If execution is OK and RecordMode is set, this Command Line is - //! recorded to the list (see below). - Standard_EXPORT IFSelect_ReturnStatus Perform(); - - //! Sets the Command then tries to execute it. Return value : - //! same as for Perform - Standard_EXPORT IFSelect_ReturnStatus Execute (const TCollection_AsciiString& command); - - //! Executes a Counter in a general way - //! If is greater than count of command words, it counts - //! all the model. Else it considers the word as the - //! identifier of a Selection - //! gives the mode of printing results, default is - //! CountByItem - Standard_EXPORT IFSelect_ReturnStatus ExecuteCounter (const Handle(IFSelect_SignCounter)& counter, const Standard_Integer numword, const IFSelect_PrintCount mode = IFSelect_CountByItem); - - //! Interprets a string value as an entity number : - //! if it gives an integer, returns its value - //! else, considers it as ENtityLabel (preferably case sensitive) - //! in case of failure, returns 0 - Standard_EXPORT Standard_Integer Number (const Standard_CString val) const; - - //! Processes specific commands, which are : - //! x or exit for end of session - //! ? or help for help messages - //! xcommand to control command lines (Record Mode, List, Clear, - //! File Output ...) - //! xsource to execute a command file (no nesting allowed), - //! in case of error, source is stopped and keyword recovers - //! xstep is a simple prefix (useful in a wider environment, to - //! avoid conflicts on command names) - //! xset control commands which create items with names - Standard_EXPORT IFSelect_ReturnStatus Do (const Standard_Integer number, const Handle(IFSelect_SessionPilot)& session) Standard_OVERRIDE; - - //! Help for specific commands (apart from general command help) - Standard_EXPORT Standard_CString Help (const Standard_Integer number) const Standard_OVERRIDE; - - - - - DEFINE_STANDARD_RTTIEXT(IFSelect_SessionPilot,IFSelect_Activator) - -protected: - - - - -private: - - - Handle(IFSelect_WorkSession) thesession; - TCollection_AsciiString theprompt; - TCollection_AsciiString thecommand; - Standard_Integer thenbwords; - TColStd_Array1OfAsciiString thewords; - TColStd_Array1OfInteger thewordeb; - Standard_Boolean therecord; - Standard_Integer thenumrec; - Handle(Standard_Transient) theobjrec; - TColStd_SequenceOfAsciiString thecomlist; -}; - -#endif // _IFSelect_SessionPilot_HeaderFile diff --git a/src/IFSelect/IFSelect_ShareOut.cxx b/src/IFSelect/IFSelect_ShareOut.cxx deleted file mode 100644 index 43d92e592c..0000000000 --- a/src/IFSelect/IFSelect_ShareOut.cxx +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// 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 -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_ShareOut,MMgt_TShared) - -IFSelect_ShareOut::IFSelect_ShareOut () -{ - thedefrt = new TCollection_HAsciiString ("Default"); - thenbdefs = thelastrun = 0; -} - - - void IFSelect_ShareOut::Clear (const Standard_Boolean onlydisp) -{ - thedisps.Clear(); - ClearResult(!onlydisp); - if (onlydisp) return; - themodelmodifiers.Clear(); - thefilemodifiers.Clear(); -} - - Standard_Boolean IFSelect_ShareOut::RemoveItem - (const Handle(Standard_Transient)& item) -{ - DeclareAndCast(IFSelect_GeneralModifier,modifier,item); - if (!modifier.IsNull()) { - Standard_Boolean formodel = modifier->IsKind(STANDARD_TYPE(IFSelect_Modifier)); - Standard_Integer atnum = ModifierRank(modifier); - return RemoveModifier (formodel,atnum); - } - DeclareAndCast(IFSelect_Dispatch,disp,item); - if (!disp.IsNull()) { - Standard_Integer atnum = DispatchRank(disp); - return RemoveDispatch(atnum); - } - return Standard_False; -} - - - void IFSelect_ShareOut::ClearResult (const Standard_Boolean alsoname) -{ - thelastrun = 0; - if (alsoname) thenbdefs = 0; -} - - Standard_Integer IFSelect_ShareOut::LastRun () const - { return thelastrun; } - - void IFSelect_ShareOut::SetLastRun (const Standard_Integer lastrun) - { thelastrun = lastrun; } - -// ####################################################################### -// #### DISPATCHES (ENVOI DES FICHIERS) #### - - Standard_Integer IFSelect_ShareOut::NbDispatches () const - { return thedisps.Length(); } - - Standard_Integer IFSelect_ShareOut::DispatchRank - (const Handle(IFSelect_Dispatch)& disp) const -{ - if (disp.IsNull()) return 0; - for (Standard_Integer i = thedisps.Length(); i >= 1; i --) - if (disp == thedisps.Value(i)) return i; - return 0; -} - - const Handle(IFSelect_Dispatch)& IFSelect_ShareOut::Dispatch - (const Standard_Integer num) const -{ - return thedisps.Value(num); -} - - void IFSelect_ShareOut::AddDispatch - (const Handle(IFSelect_Dispatch)& disp) -{ - if (disp.IsNull()) return; - thedisps.Append(disp); -} - - - Standard_Boolean IFSelect_ShareOut::RemoveDispatch - (const Standard_Integer rank) -{ - if (rank <= thelastrun || rank > thedisps.Length()) return Standard_False; - thedisps.Remove(rank); - return Standard_True; -} - -// ########################################################################## -// #### MODIFIERS #### - - void IFSelect_ShareOut::AddModifier - (const Handle(IFSelect_GeneralModifier)& modifier, - const Standard_Integer atnum) -{ - Standard_Boolean formodel = modifier->IsKind(STANDARD_TYPE(IFSelect_Modifier)); - if (ModifierRank(modifier) == 0) AddModif (modifier,formodel,atnum); - Handle(IFSelect_Dispatch) nuldisp; - modifier->SetDispatch(nuldisp); -} - - void IFSelect_ShareOut::AddModifier - (const Handle(IFSelect_GeneralModifier)& modifier, - const Standard_Integer dispnum, const Standard_Integer atnum) -{ - Standard_Boolean formodel = modifier->IsKind(STANDARD_TYPE(IFSelect_Modifier)); - if (ModifierRank(modifier) == 0) AddModif (modifier,formodel,atnum); - Handle(IFSelect_Dispatch) disp = Dispatch(dispnum); - modifier->SetDispatch(disp); -} - - - void IFSelect_ShareOut::AddModif - (const Handle(IFSelect_GeneralModifier)& modifier, - const Standard_Boolean formodel, const Standard_Integer atnum) -{ - if (formodel) { - if (atnum > 0 && atnum <= themodelmodifiers.Length()) - themodelmodifiers.InsertBefore(atnum,modifier); - else themodelmodifiers.Append(modifier); - } else { - if (atnum > 0 && atnum <= thefilemodifiers.Length()) - thefilemodifiers.InsertBefore(atnum,modifier); - else thefilemodifiers.Append(modifier); - } -} - - Standard_Integer IFSelect_ShareOut::NbModifiers - (const Standard_Boolean formodel) const -{ - if (formodel) return themodelmodifiers.Length(); - else return thefilemodifiers.Length(); -} - - Handle(IFSelect_GeneralModifier) IFSelect_ShareOut::GeneralModifier - (const Standard_Boolean formodel, const Standard_Integer atnum) const -{ - if (formodel) return themodelmodifiers.Value(atnum); - else return thefilemodifiers.Value(atnum); -} - - Handle(IFSelect_Modifier) IFSelect_ShareOut::ModelModifier - (const Standard_Integer num) const -{ return Handle(IFSelect_Modifier)::DownCast(themodelmodifiers.Value(num)); } - - Standard_Integer IFSelect_ShareOut::ModifierRank - (const Handle(IFSelect_GeneralModifier)& modifier) const -{ - Standard_Integer i; - Standard_Boolean formodel = modifier->IsKind(STANDARD_TYPE(IFSelect_Modifier)); - if (formodel) { - for (i = themodelmodifiers.Length(); i >= 1; i --) - if (modifier == themodelmodifiers.Value(i)) return i; - } else { - for (i = thefilemodifiers.Length(); i >= 1; i --) - if (modifier == thefilemodifiers.Value(i)) return i; - } - return 0; -} - - - Standard_Boolean IFSelect_ShareOut::RemoveModifier - (const Standard_Boolean formodel, const Standard_Integer atnum) -{ - if (atnum <= 0) return Standard_False; - if (formodel) { - if (atnum > themodelmodifiers.Length()) return Standard_False; - themodelmodifiers.Remove(atnum); - } else { - if (atnum > thefilemodifiers.Length()) return Standard_False; - thefilemodifiers.Remove(atnum); - } - return Standard_True; -} - - -// ChangeModifierRank revient a une permutation circulaire : -// before est mis en after, ceux qui sont entre tournent - Standard_Boolean IFSelect_ShareOut::ChangeModifierRank - (const Standard_Boolean formodel, - const Standard_Integer before, const Standard_Integer after) -{ - Standard_Integer nb; - if (before <= 0 || after <= 0) return Standard_False; - if (before == after) return Standard_True; - if (formodel) { - nb = themodelmodifiers.Length(); - if (before > nb || after > nb) return Standard_False; - Handle(IFSelect_GeneralModifier) bef = themodelmodifiers.Value(before); - themodelmodifiers.Remove(before); - if (after == nb) themodelmodifiers.Append(bef); - else themodelmodifiers.InsertBefore(after,bef); - } else { - nb = thefilemodifiers.Length(); - if (before > nb || after > nb) return Standard_False; - Handle(IFSelect_GeneralModifier) bef = thefilemodifiers.Value(before); - thefilemodifiers.Remove(before); - if (after == nb) thefilemodifiers.Append(bef); - else thefilemodifiers.InsertBefore(after,bef); - } - return Standard_True; -} - -// ####################################################################### -// #### NOMINATION DES FICHIERS #### -// Rq : thenbdefs s applique tant que l on ne change pas les termes principaux - - Standard_Boolean IFSelect_ShareOut::SetRootName - (const Standard_Integer num, const Handle(TCollection_HAsciiString)& name) -{ - if (num < 1 || num > thedisps.Length()) return Standard_False; - if (RootNumber(name) != 0) return Standard_False; - Dispatch(num)->SetRootName (name); - return Standard_True; -} - - Standard_Boolean IFSelect_ShareOut::HasRootName - (const Standard_Integer num) const -{ - if (num < 1 || num > thedisps.Length()) return Standard_False; - return Dispatch(num)->HasRootName(); -} - - Handle(TCollection_HAsciiString) IFSelect_ShareOut::RootName - (const Standard_Integer num) const -{ - Handle(TCollection_HAsciiString) nulname; - if (num < 1 || num > thedisps.Length()) return nulname; - return Dispatch(num)->RootName(); -} - - Standard_Integer IFSelect_ShareOut::RootNumber - (const Handle(TCollection_HAsciiString)& name) const -{ - if (name.IsNull()) return 0; - if (!thedefrt.IsNull()) { - if (thedefrt->IsSameString(name)) return -1; - } - for (Standard_Integer i = 1; i <= thedisps.Length(); i ++) { - Handle(TCollection_HAsciiString) root = thedisps.Value(i)->RootName(); - if (root.IsNull()) continue; - if (root->IsSameString(name)) return i; - } - return 0; -} - - - void IFSelect_ShareOut::SetPrefix - (const Handle(TCollection_HAsciiString)& pref) - { thepref = pref; thenbdefs = 0; } - - Standard_Boolean IFSelect_ShareOut::SetDefaultRootName - (const Handle(TCollection_HAsciiString)& defrt) -{ - if (RootNumber(defrt) != 0) return Standard_False; - if (thedefrt.IsNull() || !thedefrt->IsSameString(defrt)) thenbdefs = 0; - thedefrt = defrt; - return Standard_True; -} - - void IFSelect_ShareOut::SetExtension - (const Handle(TCollection_HAsciiString)& ext) - { theext = ext; thenbdefs = 0; } - - Handle(TCollection_HAsciiString) IFSelect_ShareOut::Prefix () const -{ - if (thepref.IsNull()) return new TCollection_HAsciiString(""); - return thepref; -} - - Handle(TCollection_HAsciiString) IFSelect_ShareOut::DefaultRootName () const -{ - if (thedefrt.IsNull()) return new TCollection_HAsciiString(""); - return thedefrt; -} - - Handle(TCollection_HAsciiString) IFSelect_ShareOut::Extension () const -{ - if (theext.IsNull()) return new TCollection_HAsciiString(""); - return theext; -} - - - TCollection_AsciiString IFSelect_ShareOut::FileName - (const Standard_Integer dnum, const Standard_Integer pnum, - const Standard_Integer nbpack) -{ - Handle(TCollection_HAsciiString) rot = RootName(dnum); - Standard_Integer num = pnum; - Standard_Integer npac = nbpack; - Standard_Boolean sufnum = (npac > 1 || num > 1); - if (rot.IsNull()) { - rot = thedefrt; - thenbdefs ++; num = thenbdefs; - npac = 0; - sufnum = Standard_True; // numeroter sur noms par defaut, des le 1er sans 0 - } - - TCollection_AsciiString res; - if (!thepref.IsNull()) res.AssignCat (thepref->ToCString()); - if (!rot.IsNull()) res.AssignCat (rot->ToCString()); - -// Suffixe numerique - if (sufnum) { // sinon, pas de suffixe numerique -// Nom du PacketSuffix : _ suivi du numero -// Si nbpack non nul, alors on a un majorant et on peut preceder de zeros -// Ex.: nbpack = 50 (donc 2 chiffres), num = 3, cela donnera _03 -// idnum pas utilise : cette methode peut etre redefinie et utiliser idnum ... -// Si nbpack = 0 ou 1, num = 1 pas de suffixe, sinon suffixe "_num" tel quel -// MODIF du 3-NOV-1995 -> pour eviter toute confusion, num = 1 donne aussi _1 - Standard_Integer nbch = 0; - char format[10],suffixe[30]; format[1] = ' '; - if (npac >= num) { - Standard_Integer nbpa = 1; - while (nbpa <= npac) { nbpa *= 10; nbch ++; } - } - if (nbch > 1) { - sprintf(format,"_ %d.%dd",nbch,nbch); - format[1] = '%'; - } else if (npac >= num || num >= 1) { - sprintf(format,"_ d"); - format[1] = '%'; - } - if (format[1] == '%') { - sprintf (suffixe,format,num); - res.AssignCat (suffixe); - } - } - - if (!theext.IsNull()) res.AssignCat (theext->ToCString()); - return res; -} diff --git a/src/IFSelect/IFSelect_ShareOut.hxx b/src/IFSelect/IFSelect_ShareOut.hxx deleted file mode 100644 index 29807860ff..0000000000 --- a/src/IFSelect/IFSelect_ShareOut.hxx +++ /dev/null @@ -1,260 +0,0 @@ -// Created on: 1992-11-17 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_ShareOut_HeaderFile -#define _IFSelect_ShareOut_HeaderFile - -#include -#include - -#include -#include -#include -#include -#include -class TCollection_HAsciiString; -class Interface_InterfaceError; -class Standard_OutOfRange; -class Standard_Transient; -class IFSelect_Dispatch; -class IFSelect_GeneralModifier; -class IFSelect_Modifier; -class TCollection_AsciiString; - - -class IFSelect_ShareOut; -DEFINE_STANDARD_HANDLE(IFSelect_ShareOut, MMgt_TShared) - -//! This class gathers the informations required to produce one or -//! several file(s) from the content of an InterfaceModel (passing -//! through the creation of intermediate Models). -//! -//! It can correspond to a complete Divide up of a set of Entities -//! intended to be exhaustive and to limit duplications. Or to a -//! simple Extraction of some Entities, in order to work on them. -//! -//! A ShareOut is composed of a list of Dispatches. -//! To Each Dispatch in the ShareOut, is bound an Id. Number -//! This Id. Number allows to identify a Display inside the -//! ShareOut in a stable way (for instance, to attach file names) -//! -//! ShareOut can be seen as a "passive" description, activated -//! through a ShareOutResult, which gives the InterfaceModel on -//! which to work, as a unique source. Thus it is easy to change -//! it without coherence problems -//! -//! Services about it are provided by the class ShareOutResult -//! which is a service class : simulation (list of files and of -//! entities per file; "forgotten" entities; duplicated entities), -//! exploitation (generation of derivated Models, each of them -//! generating an output file) -class IFSelect_ShareOut : public MMgt_TShared -{ - -public: - - - //! Creates an empty ShareOut - Standard_EXPORT IFSelect_ShareOut(); - - //! Removes in one operation all the Dispatches with their Idents - //! Also clears all informations about Names, and all Results but - //! naming informations which are : - //! - kept if is True. - //! - cleared if is False (complete clearing) - //! If is True, that's all. Else, clears also Modifiers - Standard_EXPORT void Clear (const Standard_Boolean onlydisp); - - //! Clears all data produced (apart from Dispatches, etc...) - //! if is True, all is cleared. Else, informations - //! about produced Names are kept (to maintain unicity of naming - //! across clearings) - Standard_EXPORT void ClearResult (const Standard_Boolean alsoname); - - //! Removes an item, which can be, either a Dispatch (removed from - //! the list of Dispatches), or a GeneralModifier (removed from - //! the list of Model Modifiers or from the list of File Modifiers - //! according to its type). - //! Returns True if done, False if has not been found or if it is - //! neither a Dispatch, nor a Modifier. - Standard_EXPORT Standard_Boolean RemoveItem (const Handle(Standard_Transient)& item); - - //! Returns the rank of last run item (ClearResult resets it to 0) - Standard_EXPORT Standard_Integer LastRun() const; - - //! Records a new alue for the rank of last run item - Standard_EXPORT void SetLastRun (const Standard_Integer last); - - //! Returns the count of Dispatches - Standard_EXPORT Standard_Integer NbDispatches() const; - - //! Returns the Rank of a Dispatch, given its Value (Handle). - //! Returns 0 if the Dispatch is unknown in the ShareOut - Standard_EXPORT Standard_Integer DispatchRank (const Handle(IFSelect_Dispatch)& disp) const; - - //! Returns a Dispatch, given its rank in the list - Standard_EXPORT const Handle(IFSelect_Dispatch)& Dispatch (const Standard_Integer num) const; - - //! Adds a Dispatch to the list - Standard_EXPORT void AddDispatch (const Handle(IFSelect_Dispatch)& disp); - - //! Removes a Dispatch, given its rank in the list - //! Returns True if done, False if rank is not between - //! (LastRun + 1) and (NbDispatches) - Standard_EXPORT Standard_Boolean RemoveDispatch (const Standard_Integer rank); - - //! Sets a Modifier to be applied on all Dispatches to be run - //! If is a ModelModifier, adds it to the list of - //! Model Modifiers; else to the list of File Modifiers - //! By default (atnum = 0) at the end of the list, else at - //! Each Modifier is used, after each copy of a packet of Entities - //! into a Model : its criteria are checked and if they are OK, - //! the method Perform of this Modifier is run. - Standard_EXPORT void AddModifier (const Handle(IFSelect_GeneralModifier)& modifier, const Standard_Integer atnum); - - //! Sets a Modifier to be applied on the Dispatch - //! If is a ModelModifier, adds it to the list of - //! Model Modifiers; else to the list of File Modifiers - //! This is the same list as for all Dispatches, but the - //! Modifier is qualified to be applied to one Dispatch only - //! Then, refers to the entire list - //! By default (atnum = 0) at the end of the list, else at - //! Remark : if the Modifier was already in the list and if - //! = 0, the Modifier is not moved, but only qualified - //! for a Dispatch - Standard_EXPORT void AddModifier (const Handle(IFSelect_GeneralModifier)& modifier, const Standard_Integer dispnum, const Standard_Integer atnum); - - //! Adds a Modifier to the list of Modifiers : Model Modifiers if - //! is True, File Modifiers else (internal). - Standard_EXPORT void AddModif (const Handle(IFSelect_GeneralModifier)& modifier, const Standard_Boolean formodel, const Standard_Integer atnum = 0); - - //! Returns count of Modifiers (which apply to complete Models) : - //! Model Modifiers if is True, File Modifiers else - Standard_EXPORT Standard_Integer NbModifiers (const Standard_Boolean formodel) const; - - //! Returns a Modifier of the list, given its rank : - //! Model Modifiers if is True, File Modifiers else - Standard_EXPORT Handle(IFSelect_GeneralModifier) GeneralModifier (const Standard_Boolean formodel, const Standard_Integer num) const; - - //! Returns a Modifier of the list of Model Modifiers, duely casted - Standard_EXPORT Handle(IFSelect_Modifier) ModelModifier (const Standard_Integer num) const; - - //! Gives the rank of a Modifier in the list, 0 if not in the list - //! Model Modifiers if is kind of ModelModifer, - //! File Modifiers else - Standard_EXPORT Standard_Integer ModifierRank (const Handle(IFSelect_GeneralModifier)& modifier) const; - - //! Removes a Modifier, given it rank in the list : - //! Model Modifiers if is True, File Modifiers else - //! Returns True if done, False if is out of range - Standard_EXPORT Standard_Boolean RemoveModifier (const Standard_Boolean formodel, const Standard_Integer num); - - //! Changes the rank of a modifier in the list : - //! Model Modifiers if is True, File Modifiers else - //! from to - //! Returns True if done, False else (before or after out of range) - Standard_EXPORT Standard_Boolean ChangeModifierRank (const Standard_Boolean formodel, const Standard_Integer befor, const Standard_Integer after); - - //! Attaches a Root Name to a Dispatch given its rank, as an - //! HAsciiString (standard form). A Null Handle resets this name. - //! Returns True if OK, False if this Name is already attached, - //! for a Dispatch or for Default, or out of range - Standard_EXPORT Standard_Boolean SetRootName (const Standard_Integer num, const Handle(TCollection_HAsciiString)& name); - - //! Returns True if the Dispatch of rank has an attached - //! Root Name. False else, or if num is out of range - Standard_EXPORT Standard_Boolean HasRootName (const Standard_Integer num) const; - - //! Returns the Root bound to a Dispatch, given its rank - //! Returns a Null Handle if not defined - Standard_EXPORT Handle(TCollection_HAsciiString) RootName (const Standard_Integer num) const; - - //! Returns an integer value about a given root name : - //! - positive : it's the rank of the Dispatch which has this name - //! - null : this root name is unknown - //! - negative (-1) : this root name is the default root name - Standard_EXPORT Standard_Integer RootNumber (const Handle(TCollection_HAsciiString)& name) const; - - //! Defines or Changes the general Prefix (which is prepended to - //! complete file name generated). If this method is not call, - //! Prefix remains empty - Standard_EXPORT void SetPrefix (const Handle(TCollection_HAsciiString)& pref); - - //! Defines or Changes the Default Root Name to a new value (which - //! is used for dispatches which have no attached root name). - //! If this method is not called, DefaultRootName remains empty - //! Returns True if OK, False if this Name is already attached, - //! for a Dispatch or for Default - Standard_EXPORT Standard_Boolean SetDefaultRootName (const Handle(TCollection_HAsciiString)& defrt); - - //! Defines or Changes the general Extension (which is appended to - //! complete file name generated). If this method is not call, - //! Extension remains empty - Standard_EXPORT void SetExtension (const Handle(TCollection_HAsciiString)& ext); - - //! Returns the general Prefix. Can be empty. - Standard_EXPORT Handle(TCollection_HAsciiString) Prefix() const; - - //! Returns the Default Root Name. Can be empty. - Standard_EXPORT Handle(TCollection_HAsciiString) DefaultRootName() const; - - //! Returns the general Extension. Can be empty (not recommanded) - Standard_EXPORT Handle(TCollection_HAsciiString) Extension() const; - - //! Computes the complete file name for a Packet of a Dispatch, - //! given Dispatch Number (Rank), Packet Number, and Count of - //! Packets generated by this Dispatch (0 if unknown) - //! - //! File Name is made of following strings, concatenated : - //! General Prefix, Root Name for Dispatch, Packet Suffix, and - //! General Extension. If no Root Name is specified for a - //! Dispatch, DefaultRootName is considered (and pnum is not used, - //! but is incremented and used - //! Error if no Root is defined for this - Standard_EXPORT TCollection_AsciiString FileName (const Standard_Integer dnum, const Standard_Integer pnum, const Standard_Integer nbpack = 0); - - - - - DEFINE_STANDARD_RTTIEXT(IFSelect_ShareOut,MMgt_TShared) - -protected: - - - - -private: - - - IFSelect_TSeqOfDispatch thedisps; - IFSelect_SequenceOfGeneralModifier themodelmodifiers; - IFSelect_SequenceOfGeneralModifier thefilemodifiers; - Handle(TCollection_HAsciiString) thepref; - Handle(TCollection_HAsciiString) thedefrt; - Handle(TCollection_HAsciiString) theext; - Standard_Integer thenbdefs; - Standard_Integer thelastrun; - - -}; - - - - - - - -#endif // _IFSelect_ShareOut_HeaderFile diff --git a/src/IFSelect/IFSelect_ShareOutResult.cxx b/src/IFSelect/IFSelect_ShareOutResult.cxx deleted file mode 100644 index 6c33655683..0000000000 --- a/src/IFSelect/IFSelect_ShareOutResult.cxx +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// 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 - -IFSelect_ShareOutResult::IFSelect_ShareOutResult - (const Handle(IFSelect_ShareOut)& sho, - const Handle(Interface_InterfaceModel)& amodel) - : thegraph(amodel) , thedispres(amodel,Standard_False) -{ - theshareout = sho; - theeval = Standard_False; -// thedisplist = new TColStd_SequenceOfInteger(); -} - - IFSelect_ShareOutResult::IFSelect_ShareOutResult - (const Handle(IFSelect_ShareOut)& sho, const Interface_Graph& G) - : thegraph(G) , thedispres(G,Standard_False) -{ - theshareout = sho; - theeval = Standard_False; -// thedisplist = new TColStd_SequenceOfInteger(); -} - - IFSelect_ShareOutResult::IFSelect_ShareOutResult - (const Handle(IFSelect_Dispatch)& disp, - const Handle(Interface_InterfaceModel)& amodel) - : thegraph(amodel) , thedispres(amodel,Standard_False) -{ - thedispatch = disp; - theeval = Standard_False; -// thedisplist = new TColStd_SequenceOfInteger(); -} - - IFSelect_ShareOutResult::IFSelect_ShareOutResult - (const Handle(IFSelect_Dispatch)& disp, const Interface_Graph& G) - : thegraph(G) , thedispres(G,Standard_False) -{ - thedispatch = disp; - theeval = Standard_False; -// thedisplist = new TColStd_SequenceOfInteger(); -} - - - Handle(IFSelect_ShareOut) IFSelect_ShareOutResult::ShareOut () const - { return theshareout; } - - const Interface_Graph& IFSelect_ShareOutResult::Graph () const - { return thegraph; } - - void IFSelect_ShareOutResult::Reset () - { theeval = Standard_False; } - - void IFSelect_ShareOutResult::Evaluate () -{ - if (theeval) return; // deja fait. si pas OK, faire Reset avant - Prepare(); - theeval = Standard_True; -} - - - Handle(IFSelect_PacketList) IFSelect_ShareOutResult::Packets - (const Standard_Boolean complete) -{ - Evaluate(); - Handle(IFSelect_PacketList) list = new IFSelect_PacketList(thegraph.Model()); - Interface_EntityIterator iter; - for ( ; More(); Next()) { - list->AddPacket(); - if (complete) list->AddList (PacketContent().Content()); - else list->AddList (PacketRoot().Content()); - } - return list; -} - - Standard_Integer IFSelect_ShareOutResult::NbPackets () - { Evaluate(); return thedispres.NbParts(); } - - - void IFSelect_ShareOutResult::Prepare () -{ - thedisplist.Clear(); -// On alimente thedispres, thedisplist - thedispres.Reset(); - IFGraph_AllShared A(thegraph); - Handle(IFSelect_Dispatch) disp = thedispatch; - Standard_Integer nb = 1, first = 1; - if (!theshareout.IsNull()) { - nb = theshareout->NbDispatches(); - first = theshareout->LastRun() + 1; - } - Standard_Integer i; // svv Jan11 2000 : porting on DEC - for (i = first; i <= nb; i ++) { - if (!theshareout.IsNull()) disp = theshareout->Dispatch(i); - if (disp->FinalSelection().IsNull()) continue; // Dispatch neutralise - IFGraph_SubPartsIterator packs(thegraph,Standard_False); - disp->Packets(thegraph,packs); - for (packs.Start(); packs.More(); packs.Next()) { - Interface_EntityIterator iter = packs.Entities(); - if (iter.NbEntities() == 0) continue; - thedispres.AddPart(); - thedispres.GetFromIter(iter); // on enregistre ce paquet - A.ResetData(); - A.GetFromIter(iter); - thedisplist.Append(i); // n0 du dispatch producteur - } - } - thedispnum = thepacknum = 1; - thepackdisp = 1; // calcul sur 1er Dispatch - thenbindisp = 0; - for (i = thepacknum; i <= thedisplist.Length(); i ++) { - if (thedisplist.Value(i) != thedispnum) break; - thenbindisp ++; - } -} - - Standard_Boolean IFSelect_ShareOutResult::More () - { return thedispres.More(); } // thepacknum < thedisplist.Length()); - - void IFSelect_ShareOutResult::Next () -{ - thedispres.Next(); - thepacknum ++; - Standard_Integer dispnum; - if (thepacknum <= thedisplist.Length()) - dispnum = thedisplist.Value(thepacknum); - else { - thenbindisp = 0; -#if !defined No_Exception -// cout<<" ** ** IFSelect_ShareOutResult::Next, void dispatch ignored"<Dispatch(thedispnum); - } -} - - void IFSelect_ShareOutResult::NextDispatch () -{ - for (; thepacknum <= thedisplist.Length(); thepacknum ++) { - thedispres.Next(); - if (thedispnum != thedisplist.Value(thepacknum)) { - thedispnum = thedisplist.Value(thepacknum); -// Calcul donnees propres au Dispatch - thepackdisp = 1; - thenbindisp = 0; - for (Standard_Integer i = thepacknum; i <= thedisplist.Length(); i ++) { - if (thedisplist.Value(i) != thedispnum) break; - thenbindisp ++; - } - if (!theshareout.IsNull()) thedispatch = theshareout->Dispatch(thedispnum); - return; - } - } - thepacknum = thedisplist.Length() + 1; // no next dispatch ... - thedispnum = thepackdisp = thenbindisp = 0; -} - - Handle(IFSelect_Dispatch) IFSelect_ShareOutResult::Dispatch () const - { return thedispatch; } - - Standard_Integer IFSelect_ShareOutResult::DispatchRank () const - { return thedispnum; } - - void IFSelect_ShareOutResult::PacketsInDispatch - (Standard_Integer& numpack, Standard_Integer& nbpacks) const - { numpack = thepackdisp; nbpacks = thenbindisp; } - - Interface_EntityIterator IFSelect_ShareOutResult::PacketRoot () - { return thedispres.Entities(); } - - Interface_EntityIterator IFSelect_ShareOutResult::PacketContent () -{ - Interface_EntityIterator iter = thedispres.Entities(); - Interface_Graph G(thegraph); -// G.GetFromIter(thedispres.Entities(),0); - for (iter.Start(); iter.More(); iter.Next()) - G.GetFromEntity(iter.Value(),Standard_True); - Interface_GraphContent GC(G); - return GC.Result(); -} - - TCollection_AsciiString IFSelect_ShareOutResult::FileName () const -{ - Standard_Integer nd = DispatchRank(); - Standard_Integer np,nbp; - PacketsInDispatch(np,nbp); - return theshareout->FileName(nd,np,nbp); -} diff --git a/src/IFSelect/IFSelect_ShareOutResult.hxx b/src/IFSelect/IFSelect_ShareOutResult.hxx deleted file mode 100644 index 334873326d..0000000000 --- a/src/IFSelect/IFSelect_ShareOutResult.hxx +++ /dev/null @@ -1,188 +0,0 @@ -// Created on: 1992-11-17 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_ShareOutResult_HeaderFile -#define _IFSelect_ShareOutResult_HeaderFile - -#include -#include -#include - -#include -#include -#include -#include -#include -class IFSelect_ShareOut; -class IFSelect_Dispatch; -class Standard_NoSuchObject; -class Interface_InterfaceError; -class Interface_InterfaceModel; -class Interface_Graph; -class IFSelect_PacketList; -class Interface_EntityIterator; -class TCollection_AsciiString; - - -//! This class gives results computed from a ShareOut : simulation -//! before transfer, helps to list entities ... -//! Transfer itself will later be performed, either by a -//! TransferCopy to simply divide up a file, or a TransferDispatch -//! which can be parametred with more details -class IFSelect_ShareOutResult -{ -public: - - DEFINE_STANDARD_ALLOC - - - //! Creates a ShareOutResult from a ShareOut, to work on a Model - //! (without any more precision; uses Active Protocol) - Standard_EXPORT IFSelect_ShareOutResult(const Handle(IFSelect_ShareOut)& sho, const Handle(Interface_InterfaceModel)& mod); - - //! Creates a ShareOutResult from a ShareOut, to work on a Graph - //! already computed, which defines the Input Model and can - //! specialize some Entities - Standard_EXPORT IFSelect_ShareOutResult(const Handle(IFSelect_ShareOut)& sho, const Interface_Graph& G); - - //! Creates a ShareOutResult from a unique Dispatch, to work on - //! a Model. As if it was a ShareOut with only one Dispatch - //! (without any more precision; uses Active Protocol) - //! Allows to compute the effect of a single Dispatch - Standard_EXPORT IFSelect_ShareOutResult(const Handle(IFSelect_Dispatch)& disp, const Handle(Interface_InterfaceModel)& mod); - - //! Creates a ShareOutResult from a unique Dispatch, to work on - //! a Graph. As if it was a ShareOut with only one Dispatch - //! Allows to compute the effect of a single Dispatch - Standard_EXPORT IFSelect_ShareOutResult(const Handle(IFSelect_Dispatch)& disp, const Interface_Graph& G); - - //! Returns the ShareOut used to create the ShareOutResult - //! if creation from a Dispatch, returns a Null Handle - Standard_EXPORT Handle(IFSelect_ShareOut) ShareOut() const; - - //! Returns the Graph used to create theShareOutResult - Standard_EXPORT const Interface_Graph& Graph() const; - - //! Erases computed data, in order to command a new Evaluation - Standard_EXPORT void Reset(); - - //! Evaluates the result of a ShareOut : determines Entities to be - //! forgotten by the ShareOut, Entities to be transferred several - //! times (duplicated), prepares an iteration on the packets to be - //! produced - //! Called the first time anyone question is asked, or after a - //! call to Reset. Works by calling the method Prepare. - Standard_EXPORT void Evaluate(); - - //! Returns the list of recorded Packets, under two modes : - //! - = False, the strict definition of Packets, i.e. - //! for each one, the Root Entities, to be explicitely sent - //! - = True (Default), the completely evaluated list, - //! i.e. which really gives the destination of each entity : - //! this mode allows to evaluate duplications - //! Remark that to send packets, iteration remains preferable - //! (file names are managed) - Standard_EXPORT Handle(IFSelect_PacketList) Packets (const Standard_Boolean complete = Standard_True); - - //! Returns the total count of produced non empty packets - //! (in out : calls Evaluate as necessary) - Standard_EXPORT Standard_Integer NbPackets(); - - //! Prepares the iteration on the packets - //! This method is called by Evaluate, but can be called anytime - //! The iteration consists in taking each Dispatch of the ShareOut - //! beginning by the first one, compute its packets, then iterate - //! on these packets. Once all these packets are iterated, the - //! iteration passes to the next Dispatch, or stops. - //! For a creation from a unique Dispatch, same but with only - //! this Dispatch. - //! Each packet can be listed, or really transferred (producing - //! a derived Model, from which a file can be generated) - //! - //! Prepare sets the iteration to the first Dispatch, first Packet - Standard_EXPORT void Prepare(); - - //! Returns True if there is more packets in the current Dispatch, - //! else if there is more Dispatch in the ShareOut - Standard_EXPORT Standard_Boolean More(); - - //! Passes to the next Packet in the current Dispatch, or if there - //! is none, to the next Dispatch in the ShareOut - Standard_EXPORT void Next(); - - //! Passes to the next Dispatch, regardless about remaining packets - Standard_EXPORT void NextDispatch(); - - //! Returns the current Dispatch - Standard_EXPORT Handle(IFSelect_Dispatch) Dispatch() const; - - //! Returns the Rank of the current Dispatch in the ShareOut - //! Returns Zero if there is none (iteration finished) - Standard_EXPORT Standard_Integer DispatchRank() const; - - //! Returns Number (rank) of current Packet in current Dispatch, - //! and total count of Packets in current Dispatch, as arguments - Standard_EXPORT void PacketsInDispatch (Standard_Integer& numpack, Standard_Integer& nbpacks) const; - - //! Returns the list of Roots of the current Packet (never empty) - //! (i.e. the Entities to be themselves asked for transfer) - //! Error if there is none (iteration finished) - Standard_EXPORT Interface_EntityIterator PacketRoot(); - - //! Returns the complete content of the current Packet (i.e. - //! with shared entities, which will also be put in the file) - Standard_EXPORT Interface_EntityIterator PacketContent(); - - //! Returns the File Name which corresponds to current Packet - //! (computed by ShareOut) - //! If current Packet has no associated name (see ShareOut), - //! the returned value is Null - Standard_EXPORT TCollection_AsciiString FileName() const; - - - - -protected: - - - - Interface_Graph thegraph; - IFGraph_SubPartsIterator thedispres; - - -private: - - - - Handle(IFSelect_ShareOut) theshareout; - Handle(IFSelect_Dispatch) thedispatch; - Standard_Boolean theeval; - Standard_Integer thedispnum; - Standard_Integer thepacknum; - Standard_Integer thepackdisp; - Standard_Integer thenbindisp; - TColStd_SequenceOfInteger thedisplist; - - -}; - - - - - - - -#endif // _IFSelect_ShareOutResult_HeaderFile diff --git a/src/IFSelect/IFSelect_TSeqOfDispatch.hxx b/src/IFSelect/IFSelect_TSeqOfDispatch.hxx deleted file mode 100644 index 0ed8437517..0000000000 --- a/src/IFSelect/IFSelect_TSeqOfDispatch.hxx +++ /dev/null @@ -1,26 +0,0 @@ -// Created on: 1992-09-21 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef IFSelect_TSeqOfDispatch_HeaderFile -#define IFSelect_TSeqOfDispatch_HeaderFile - -#include -#include - -typedef NCollection_Sequence IFSelect_TSeqOfDispatch; - - -#endif diff --git a/src/IFSelect/IFSelect_TransformStandard.cxx b/src/IFSelect/IFSelect_TransformStandard.cxx deleted file mode 100644 index f130c589a7..0000000000 --- a/src/IFSelect/IFSelect_TransformStandard.cxx +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// 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 -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_TransformStandard,IFSelect_Transformer) - -IFSelect_TransformStandard::IFSelect_TransformStandard () - { thecopy = Standard_True; } - - void IFSelect_TransformStandard::SetCopyOption - (const Standard_Boolean option) - { thecopy = option; } - - Standard_Boolean IFSelect_TransformStandard::CopyOption () const - { return thecopy; } - - void IFSelect_TransformStandard::SetSelection - (const Handle(IFSelect_Selection)& sel) - { thesel = sel; } - - Handle(IFSelect_Selection) IFSelect_TransformStandard::Selection () const - { return thesel; } - - Standard_Integer IFSelect_TransformStandard::NbModifiers () const - { return themodifs.Length(); } - - Handle(IFSelect_Modifier) IFSelect_TransformStandard::Modifier - (const Standard_Integer num) const - { return GetCasted(IFSelect_Modifier,themodifs.Value(num)); } - - Standard_Integer IFSelect_TransformStandard::ModifierRank - (const Handle(IFSelect_Modifier)& modif) const -{ - for (Standard_Integer i = themodifs.Length(); i >= 1; i --) - if (modif == themodifs.Value(i)) return i; - return 0; -} - - Standard_Boolean IFSelect_TransformStandard::AddModifier - (const Handle(IFSelect_Modifier)& modif, - const Standard_Integer atnum) -{ - if (atnum < 0 || atnum > themodifs.Length()) return Standard_False; - if (atnum == 0) themodifs.Append(modif); - else themodifs.InsertBefore(atnum,modif); - return Standard_True; -} - - Standard_Boolean IFSelect_TransformStandard::RemoveModifier - (const Handle(IFSelect_Modifier)& modif) -{ - Standard_Integer num = ModifierRank(modif); - return RemoveModifier(num); -} - - - Standard_Boolean IFSelect_TransformStandard::RemoveModifier - (const Standard_Integer num) -{ - if (num <= 0 || num > themodifs.Length()) return Standard_False; - themodifs.Remove(num); - return Standard_True; -} - -// ################################################################# -// ######## ACTION ######## - - Standard_Boolean IFSelect_TransformStandard::Perform - (const Interface_Graph& G, const Handle(Interface_Protocol)& protocol, - Interface_CheckIterator& checks, - Handle(Interface_InterfaceModel)& newmod) -{ - Interface_CopyTool TC(G.Model(),protocol); - themap = TC.Control(); - Copy (G,TC,newmod); - return ApplyModifiers (G,protocol,TC,checks,newmod); -} - - void IFSelect_TransformStandard::Copy - (const Interface_Graph& G, Interface_CopyTool& TC, - Handle(Interface_InterfaceModel)& newmod) const -{ - if (CopyOption()) StandardCopy (G,TC,newmod); - else OnTheSpot (G,TC,newmod); -} - - void IFSelect_TransformStandard::StandardCopy - (const Interface_Graph& G, Interface_CopyTool& TC, - Handle(Interface_InterfaceModel)& newmod) const -{ - Handle(Interface_InterfaceModel) original = G.Model(); - newmod = original->NewEmptyModel(); - TC.Clear(); - Standard_Integer nb = G.Size(); - Handle(TColStd_HArray1OfInteger) remain = - new TColStd_HArray1OfInteger(0,nb+1); remain->Init(0); - for (Standard_Integer i = 1; i <= nb; i ++) { -// if (G.Status(i) == 0) TC.TransferEntity (original->Value(i)); - TC.TransferEntity (original->Value(i)); - } - TC.FillModel(newmod); -} - - void IFSelect_TransformStandard::OnTheSpot - (const Interface_Graph& G, Interface_CopyTool& TC, - Handle(Interface_InterfaceModel)& newmod) const -{ - Standard_Integer nb = G.Size(); - for (Standard_Integer i = 1; i <= nb; i ++) TC.Bind(G.Entity(i),G.Entity(i)); - newmod = G.Model(); -} - - - Standard_Boolean IFSelect_TransformStandard::ApplyModifiers - (const Interface_Graph& G, const Handle(Interface_Protocol)& protocol, - Interface_CopyTool& TC, Interface_CheckIterator& checks, - Handle(Interface_InterfaceModel)& newmod) const -{ - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - Standard_Boolean res = Standard_True; - Standard_Boolean chg = Standard_False; - Standard_Integer nb = NbModifiers(); - Handle(Interface_InterfaceModel) original = G.Model(); - - for (Standard_Integer i = 1; i <= nb; i ++) { - Handle(IFSelect_Modifier) unmod = Modifier(i); - if (unmod->MayChangeGraph()) chg = Standard_True; - -// Appliquer ce Modifier (nb : le Dispatch, on s en moque) -// D abord, la Selection - IFSelect_ContextModif ctx (G,TC); -// Ensuite, la Selection -// S il y en a une ici, elle a priorite. Sinon, chaque Modifier a la sienne - - Handle(IFSelect_Selection) sel = thesel; - if ( sel.IsNull()) sel = unmod->Selection(); - if (!sel.IsNull()) { - Interface_EntityIterator entiter = sel->UniqueResult(G); - ctx.Select (entiter); - } - if (ctx.IsForNone()) continue; - unmod->Perform (ctx,newmod,protocol,TC); - -// Report des Erreurs -// Faut-il les enregistrer dans newmod ? bonne question - Interface_CheckIterator checklist = ctx.CheckList(); - if (!checklist.IsEmpty(Standard_False)) { - checks.Merge(checklist); - sout<<"IFSelect_TransformStandard : Messages from Modifier n0 "<Search(entfrom,entto); -} - - - TCollection_AsciiString IFSelect_TransformStandard::Label () const -{ - char lab[30]; - TCollection_AsciiString labl(""); - if (CopyOption()) labl.AssignCat("Standard Copy"); - else labl.AssignCat("On the spot Edition"); - Standard_Integer nb = NbModifiers(); - if (nb == 0) sprintf(lab," (no Modifier)"); - if (nb == 1) sprintf(lab," - %s",Modifier(1)->Label().ToCString()); - if (nb > 1) sprintf(lab," - %d Modifiers",nb); - labl.AssignCat(lab); - return labl; -} diff --git a/src/IFSelect/IFSelect_TransformStandard.hxx b/src/IFSelect/IFSelect_TransformStandard.hxx deleted file mode 100644 index 3ca33d2e5b..0000000000 --- a/src/IFSelect/IFSelect_TransformStandard.hxx +++ /dev/null @@ -1,180 +0,0 @@ -// Created on: 1994-05-27 -// Created by: Christian CAILLET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_TransformStandard_HeaderFile -#define _IFSelect_TransformStandard_HeaderFile - -#include -#include - -#include -#include -#include -#include -class IFSelect_Selection; -class Interface_CopyControl; -class IFSelect_Modifier; -class Interface_Graph; -class Interface_Protocol; -class Interface_CheckIterator; -class Interface_InterfaceModel; -class Interface_CopyTool; -class Standard_Transient; -class TCollection_AsciiString; - - -class IFSelect_TransformStandard; -DEFINE_STANDARD_HANDLE(IFSelect_TransformStandard, IFSelect_Transformer) - -//! This class runs transformations made by Modifiers, as -//! the ModelCopier does when it produces files (the same set -//! of Modifiers can then be used, as to transform the starting -//! Model, as at file sending time). -//! -//! First, considering the resulting model, two options : -//! - modifications are made directly on the starting model -//! (OnTheSpot option), or -//! - data are copied by the standard service Copy, only the -//! remaining (not yet sent in a file) entities are copied -//! (StandardCopy option) -//! -//! If a Selection is set, it forces the list of Entities on which -//! the Modifiers are applied. Else, each Modifier is considered -//! its Selection. By default, it is for the whole Model -//! -//! Then, the Modifiers are sequentially applied -//! If at least one Modifier "May Change Graph", or if the option -//! StandardCopy is selected, the graph will be recomputed -//! (by the WorkSession, see method RunTransformer) -//! -//! Remark that a TransformStandard with option StandardCopy -//! and no Modifier at all has the effect of computing the -//! remaining data (those not yet sent in any output file). -//! Moreover, the Protocol is not changed -class IFSelect_TransformStandard : public IFSelect_Transformer -{ - -public: - - - //! Creates a TransformStandard, option StandardCopy, no Modifier - Standard_EXPORT IFSelect_TransformStandard(); - - //! Sets the Copy option to a new value : - //! - True for StandardCopy - False for OnTheSpot - Standard_EXPORT void SetCopyOption (const Standard_Boolean option); - - //! Returns the Copy option - Standard_EXPORT Standard_Boolean CopyOption() const; - - //! Sets a Selection (or unsets if Null) - //! This Selection then defines the list of entities on which the - //! Modifiers will be applied - //! If it is set, it has priority on Selections of Modifiers - //! Else, for each Modifier its Selection is evaluated - //! By default, all the Model is taken - Standard_EXPORT void SetSelection (const Handle(IFSelect_Selection)& sel); - - //! Returns the Selection, Null by default - Standard_EXPORT Handle(IFSelect_Selection) Selection() const; - - //! Returns the count of recorded Modifiers - Standard_EXPORT Standard_Integer NbModifiers() const; - - //! Returns a Modifier given its rank in the list - Standard_EXPORT Handle(IFSelect_Modifier) Modifier (const Standard_Integer num) const; - - //! Returns the rank of a Modifier in the list, 0 if unknown - Standard_EXPORT Standard_Integer ModifierRank (const Handle(IFSelect_Modifier)& modif) const; - - //! Adds a Modifier to the list : - //! - = 0 (default) : at the end of the list - //! - > 0 : at rank - //! Returns True if done, False if is out of range - Standard_EXPORT Standard_Boolean AddModifier (const Handle(IFSelect_Modifier)& modif, const Standard_Integer atnum = 0); - - //! Removes a Modifier from the list - //! Returns True if done, False if not in the list - Standard_EXPORT Standard_Boolean RemoveModifier (const Handle(IFSelect_Modifier)& modif); - - //! Removes a Modifier from the list, given its rank - //! Returns True if done, False if is out of range - Standard_EXPORT Standard_Boolean RemoveModifier (const Standard_Integer num); - - //! Performs the Standard Transformation, by calling Copy then - //! ApplyModifiers (which can return an error status) - Standard_EXPORT Standard_Boolean Perform (const Interface_Graph& G, const Handle(Interface_Protocol)& protocol, Interface_CheckIterator& checks, Handle(Interface_InterfaceModel)& newmod) Standard_OVERRIDE; - - //! This the first operation. It calls StandardCopy or OnTheSpot - //! according the option - Standard_EXPORT void Copy (const Interface_Graph& G, Interface_CopyTool& TC, Handle(Interface_InterfaceModel)& newmod) const; - - //! This is the standard action of Copy : its takes into account - //! only the remaining entities (noted by Graph Status positive) - //! and their proper dependances of course. Produces a new model. - Standard_EXPORT void StandardCopy (const Interface_Graph& G, Interface_CopyTool& TC, Handle(Interface_InterfaceModel)& newmod) const; - - //! This is the OnTheSpot action : each entity is bound with ... - //! itself. The produced model is the same as the starting one. - Standard_EXPORT void OnTheSpot (const Interface_Graph& G, Interface_CopyTool& TC, Handle(Interface_InterfaceModel)& newmod) const; - - //! Applies the modifiers sequencially. - //! For each one, prepares required data (if a Selection is - //! associated as a filter). - //! For the option OnTheSpot, it determines if the graph may be - //! changed and updates if required - //! If a Modifier causes an error (check "HasFailed"), - //! ApplyModifier stops : the following Modifiers are ignored - Standard_EXPORT Standard_Boolean ApplyModifiers (const Interface_Graph& G, const Handle(Interface_Protocol)& protocol, Interface_CopyTool& TC, Interface_CheckIterator& checks, Handle(Interface_InterfaceModel)& newmod) const; - - //! This methods allows to know what happened to a starting - //! entity after the last Perform. It reads result from the map - //! which was filled by Perform. - Standard_EXPORT Standard_Boolean Updated (const Handle(Standard_Transient)& entfrom, Handle(Standard_Transient)& entto) const Standard_OVERRIDE; - - //! Returns a text which defines the way a Transformer works : - //! "On the spot edition" or "Standard Copy" followed by - //! " Modifiers" - Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE; - - - - - DEFINE_STANDARD_RTTIEXT(IFSelect_TransformStandard,IFSelect_Transformer) - -protected: - - - - -private: - - - Standard_Boolean thecopy; - Handle(IFSelect_Selection) thesel; - IFSelect_SequenceOfGeneralModifier themodifs; - Handle(Interface_CopyControl) themap; - - -}; - - - - - - - -#endif // _IFSelect_TransformStandard_HeaderFile diff --git a/src/IFSelect/IFSelect_Transformer.cxx b/src/IFSelect/IFSelect_Transformer.cxx deleted file mode 100644 index 7811c3c5e4..0000000000 --- a/src/IFSelect/IFSelect_Transformer.cxx +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// 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 - -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Transformer,MMgt_TShared) - -Standard_Boolean IFSelect_Transformer::ChangeProtocol (Handle(Interface_Protocol)& ) const -{ - return Standard_False; // par defaut, protocole inchange -} diff --git a/src/IFSelect/IFSelect_Transformer.hxx b/src/IFSelect/IFSelect_Transformer.hxx deleted file mode 100644 index 8068f0335c..0000000000 --- a/src/IFSelect/IFSelect_Transformer.hxx +++ /dev/null @@ -1,123 +0,0 @@ -// Created on: 1994-05-27 -// Created by: Christian CAILLET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_Transformer_HeaderFile -#define _IFSelect_Transformer_HeaderFile - -#include -#include - -#include -#include -class Interface_Graph; -class Interface_Protocol; -class Interface_CheckIterator; -class Interface_InterfaceModel; -class Standard_Transient; -class TCollection_AsciiString; - - -class IFSelect_Transformer; -DEFINE_STANDARD_HANDLE(IFSelect_Transformer, MMgt_TShared) - -//! A Transformer defines the way an InterfaceModel is transformed -//! (without sending it to a file). -//! In order to work, each type of Transformer defines it method -//! Perform, it can be parametred as needed. -//! -//! It receives a Model (the data set) as input. It then can : -//! - edit this Model on the spot (i.e. alter its content : by -//! editing entities, or adding/replacing some ...) -//! - produce a copied Model, which detains the needed changes -//! (typically on the same type, but some or all entities beeing -//! rebuilt or converted; or converted from a protocol to -//! another one) -class IFSelect_Transformer : public MMgt_TShared -{ - -public: - - - //! Performs a Transformation (defined by each sub-class) : - //! gives the input data (especially the starting model) and - //! can be used for queries (by Selections, etc...) - //! allows to work with General Services as necessary - //! (it applies to input data) - //! If the change corresponds to a conversion to a new protocol, - //! see also the method ChangeProtocol - //! stores produced checks messages if any - //! gives the result of the transformation : - //! - if it is Null (i.e. has not been affected), the transformation - //! has been made on the spot, it is assumed to cause no change - //! to the graph of dependances - //! - if it equates the starting Model, it has been transformed on - //! the spot (possibiliy some entities were replaced inside it) - //! - if it is new, it corresponds to a new data set which replaces - //! the starting one - //! - //! is mutable to allow results for ChangeProtocol to be - //! memorized if needed, and to store informations useful for - //! the method Updated - //! - //! Returns True if Done, False if an Error occured : in this case, - //! if a new data set has been produced, the transformation - //! is ignored, else data may be corrupted. - Standard_EXPORT virtual Standard_Boolean Perform (const Interface_Graph& G, const Handle(Interface_Protocol)& protocol, Interface_CheckIterator& checks, Handle(Interface_InterfaceModel)& newmod) = 0; - - //! This methods allows to declare that the Protocol applied to - //! the new Model has changed. It applies to the last call to - //! Perform. - //! - //! Returns True if the Protocol has changed, False else. - //! The provided default keeps the starting Protocol. This method - //! should be redefined as required by the effect of Perform. - Standard_EXPORT virtual Standard_Boolean ChangeProtocol (Handle(Interface_Protocol)& newproto) const; - - //! This method allows to know what happened to a starting - //! entity after the last Perform. If (from starting - //! model) has one and only one known item which corresponds in - //! the new produced model, this method must return True and - //! fill the argument . Else, it returns False. - Standard_EXPORT virtual Standard_Boolean Updated (const Handle(Standard_Transient)& entfrom, Handle(Standard_Transient)& entto) const = 0; - - //! Returns a text which defines the way a Transformer works - //! (to identify the transformation it performs) - Standard_EXPORT virtual TCollection_AsciiString Label() const = 0; - - - - - DEFINE_STANDARD_RTTIEXT(IFSelect_Transformer,MMgt_TShared) - -protected: - - - - -private: - - - - -}; - - - - - - - -#endif // _IFSelect_Transformer_HeaderFile diff --git a/src/IFSelect/IFSelect_Vars.cxx b/src/IFSelect/IFSelect_Vars.cxx new file mode 100644 index 0000000000..d774f2a42c --- /dev/null +++ b/src/IFSelect/IFSelect_Vars.cxx @@ -0,0 +1,96 @@ +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// 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 + +IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Vars,MMgt_TShared) + +IFSelect_Vars::IFSelect_Vars () + { thevars = new Dico_DictionaryOfTransient; } + +void IFSelect_Vars::Set + (const Standard_CString name, + const Handle(Standard_Transient)& val) +{ + thevars->SetItem (name,val); +} + +Handle(Standard_Transient) IFSelect_Vars::Get ( Standard_CString& name) const +{ + Handle(Standard_Transient) val; + if (!thevars->GetItem (name,val)) val.Nullify(); + return val; +} + +Handle(Geom_Geometry) IFSelect_Vars::GetGeom ( Standard_CString& name) const +{ return GetCasted(Geom_Geometry,Get(name)); } + +Handle(Geom2d_Curve) IFSelect_Vars::GetCurve2d ( Standard_CString& name) const +{ return GetCasted(Geom2d_Curve,Get(name)); } + +Handle(Geom_Curve) IFSelect_Vars::GetCurve ( Standard_CString& name) const +{ return GetCasted(Geom_Curve,Get(name)); } + +Handle(Geom_Surface) IFSelect_Vars::GetSurface ( Standard_CString& name) const +{ return GetCasted(Geom_Surface,Get(name)); } + + +void IFSelect_Vars::SetPoint (const Standard_CString name, const gp_Pnt& val) +{ Set (name, new Geom_CartesianPoint(val)); } + +Standard_Boolean IFSelect_Vars::GetPoint (Standard_CString& name, gp_Pnt& pnt) const +{ + DeclareAndCast(Geom_CartesianPoint,val,Get(name)); + if (val.IsNull()) return Standard_False; + pnt = val->Pnt(); + return Standard_True; +} + + +void IFSelect_Vars::SetPoint2d (const Standard_CString name, const gp_Pnt2d& val) +{ Set (name, new Geom2d_CartesianPoint(val)); } + +Standard_Boolean IFSelect_Vars::GetPoint2d (Standard_CString& name, gp_Pnt2d& pnt) const +{ + DeclareAndCast(Geom2d_CartesianPoint,val,Get(name)); + if (val.IsNull()) return Standard_False; + pnt = val->Pnt2d(); + return Standard_True; +} + + +void IFSelect_Vars::SetShape (const Standard_CString name, const TopoDS_Shape& val) +{ Set (name, new TopoDS_HShape(val)); } + +TopoDS_Shape IFSelect_Vars::GetShape (Standard_CString& name) const +{ + TopoDS_Shape sh; + DeclareAndCast(TopoDS_HShape,val,Get(name)); + if (!val.IsNull()) sh = val->Shape(); + return sh; +} diff --git a/src/IFSelect/IFSelect_Vars.hxx b/src/IFSelect/IFSelect_Vars.hxx new file mode 100644 index 0000000000..809b158e15 --- /dev/null +++ b/src/IFSelect/IFSelect_Vars.hxx @@ -0,0 +1,87 @@ +// Created on: 1998-07-22 +// Created by: Christian CAILLET +// Copyright (c) 1998-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IFSelect_Vars_HeaderFile +#define _IFSelect_Vars_HeaderFile + +#include +#include + +#include +#include +#include +class Dico_DictionaryOfTransient; +class Standard_Transient; +class Geom_Geometry; +class Geom2d_Curve; +class Geom_Curve; +class Geom_Surface; +class gp_Pnt; +class gp_Pnt2d; +class TopoDS_Shape; + + +class IFSelect_Vars; +DEFINE_STANDARD_HANDLE(IFSelect_Vars, MMgt_TShared) + +//! Defines a receptacle for externally defined variables, each +//! one has a name +//! +//! I.E. a WorkSession for XSTEP is generally used inside a +//! context, which brings variables, especially shapes and +//! geometries. For instance DRAW or an application engine +//! +//! This class provides a common form for this. It also provides +//! a default implementation (locally recorded variables in a +//! dictionary), but which is aimed to be redefined +class IFSelect_Vars : public MMgt_TShared +{ + public: + + Standard_EXPORT IFSelect_Vars(); + + Standard_EXPORT virtual void Set (const Standard_CString name, const Handle(Standard_Transient)& val); + + Standard_EXPORT virtual Handle(Geom_Geometry) GetGeom (Standard_CString& name) const; + + Standard_EXPORT virtual Handle(Geom2d_Curve) GetCurve2d (Standard_CString& name) const; + + Standard_EXPORT virtual Handle(Geom_Curve) GetCurve (Standard_CString& name) const; + + Standard_EXPORT virtual Handle(Geom_Surface) GetSurface (Standard_CString& name) const; + + Standard_EXPORT virtual void SetPoint (const Standard_CString name, const gp_Pnt& val); + + Standard_EXPORT virtual void SetPoint2d (const Standard_CString name, const gp_Pnt2d& val); + + Standard_EXPORT virtual Standard_Boolean GetPoint (Standard_CString& name, gp_Pnt& pnt) const; + + Standard_EXPORT virtual Standard_Boolean GetPoint2d (Standard_CString& name, gp_Pnt2d& pnt) const; + + Standard_EXPORT virtual void SetShape (const Standard_CString name, const TopoDS_Shape& val); + + Standard_EXPORT virtual TopoDS_Shape GetShape (Standard_CString& name) const; + + DEFINE_STANDARD_RTTIEXT(IFSelect_Vars,MMgt_TShared) + + protected: + + Standard_EXPORT virtual Handle(Standard_Transient) Get (Standard_CString& name) const; + + Handle(Dico_DictionaryOfTransient) thevars; +}; + +#endif // _IFSelect_Vars_HeaderFile diff --git a/src/IFSelect/IFSelect_WorkLibrary.cxx b/src/IFSelect/IFSelect_WorkLibrary.cxx deleted file mode 100644 index 0ea50ddb83..0000000000 --- a/src/IFSelect/IFSelect_WorkLibrary.cxx +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// 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 - -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_WorkLibrary,Standard_Transient) - - Standard_Boolean IFSelect_WorkLibrary::CopyModel - (const Handle(Interface_InterfaceModel)& /*original*/, - const Handle(Interface_InterfaceModel)& newmodel, - const Interface_EntityIterator& list, - Interface_CopyTool& TC) const -{ - for (list.Start(); list.More(); list.Next()) - TC.TransferEntity (list.Value()); - - TC.FillModel(newmodel); - - return Standard_True; -} - - - void IFSelect_WorkLibrary::DumpEntity - (const Handle(Interface_InterfaceModel)& model, - const Handle(Interface_Protocol)& protocol, - const Handle(Standard_Transient)& entity, - const Handle(Message_Messenger)& S) const -{ - if (thelevhlp.IsNull()) DumpEntity (model,protocol,entity,S,0); - else DumpEntity (model,protocol,entity,S,thelevdef); -} - - - void IFSelect_WorkLibrary::SetDumpLevels - (const Standard_Integer def, const Standard_Integer max) -{ - thelevdef = def; - thelevhlp.Nullify(); - if (max >= 0) thelevhlp = new Interface_HArray1OfHAsciiString (0,max); -} - - void IFSelect_WorkLibrary::DumpLevels - (Standard_Integer& def, Standard_Integer& max) const -{ - def = thelevdef; - if (thelevhlp.IsNull()) { def = 0; max = -1; } - else max = thelevhlp->Upper(); -} - - void IFSelect_WorkLibrary::SetDumpHelp - (const Standard_Integer level, const Standard_CString help) -{ - if (thelevhlp.IsNull()) return; - if (level < 0 || level > thelevhlp->Upper()) return; - Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString (help); - thelevhlp->SetValue (level,str); -} - - Standard_CString IFSelect_WorkLibrary::DumpHelp - (const Standard_Integer level) const -{ - if (thelevhlp.IsNull()) return ""; - if (level < 0 || level > thelevhlp->Upper()) return ""; - Handle(TCollection_HAsciiString) str = thelevhlp->Value (level); - if (str.IsNull()) return ""; - return str->ToCString(); -} diff --git a/src/IFSelect/IFSelect_WorkLibrary.hxx b/src/IFSelect/IFSelect_WorkLibrary.hxx deleted file mode 100644 index 7ddc2f9f35..0000000000 --- a/src/IFSelect/IFSelect_WorkLibrary.hxx +++ /dev/null @@ -1,132 +0,0 @@ -// Created on: 1993-01-08 -// Created by: Christian CAILLET -// Copyright (c) 1993-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _IFSelect_WorkLibrary_HeaderFile -#define _IFSelect_WorkLibrary_HeaderFile - -#include -#include - -#include -#include -#include -#include -#include -class Interface_InterfaceModel; -class Interface_Protocol; -class IFSelect_ContextWrite; -class Interface_EntityIterator; -class Interface_CopyTool; -class Standard_Transient; -class Message_Messenger; - - -class IFSelect_WorkLibrary; -DEFINE_STANDARD_HANDLE(IFSelect_WorkLibrary, Standard_Transient) - -//! This class defines the (empty) frame which can be used to -//! enrich a XSTEP set with new capabilities -//! In particular, a specific WorkLibrary must give the way for -//! Reading a File into a Model, and Writing a Model to a File -//! Thus, it is possible to define several Work Libraries for each -//! norm, but recommanded to define one general class for each one : -//! this general class will define the Read and Write methods. -//! -//! Also a Dump service is provided, it can produce, according the -//! norm, either a parcel of a file for an entity, or any other -//! kind of informations relevant for the norm, -class IFSelect_WorkLibrary : public Standard_Transient -{ - public: - - //! Gives the way to Read a File and transfer it to a Model - //! is the resulting Model, which has to be created by this - //! method. In case of error, must be returned Null - //! Return value is a status with free values. - //! Simply, 0 is for "Execution OK" - //! The Protocol can be used to work (e.g. create the Model, read - //! and recognize the Entities) - Standard_EXPORT virtual Standard_Integer ReadFile (const Standard_CString name, Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol) const = 0; - - //! Gives the way to Write a File from a Model. - //! contains all necessary informations : the model, the - //! protocol, the file name, and the list of File Modifiers to be - //! applied, also with restricted list of selected entities for - //! each one, if required. - //! In return, it brings the produced check-list - //! - //! The WorkLibrary has to query to get then run the - //! ContextWrite by looping like this (example) : - //! for (numap = 1; numap <= ctx.NbModifiers(); numap ++) { - //! ctx.SetModifier (numap); - //! cast ctx.FileModifier() to specific type -> variable filemod - //! if (!filemod.IsNull()) filemod->Perform (ctx,writer); - //! filemod then works with ctx. It can, either act on the - //! model itself (for instance on its header), or iterate - //! on selected entities (Start/Next/More/Value) - //! it can call AddFail or AddWarning, as necessary - //! } - Standard_EXPORT virtual Standard_Boolean WriteFile (IFSelect_ContextWrite& ctx) const = 0; - - //! Performs the copy of entities from an original model to a new - //! one. It must also copy headers if any. Returns True when done. - //! The provided default works by copying the individual entities - //! designated in the list, by using the general service class - //! CopyTool. - //! It can be redefined for a norm which, either implements Copy - //! by another way (do not forget to Bind each copied result with - //! its original entity in TC) and returns True, or does not know - //! how to copy and returns False - Standard_EXPORT virtual Standard_Boolean CopyModel (const Handle(Interface_InterfaceModel)& original, const Handle(Interface_InterfaceModel)& newmodel, const Interface_EntityIterator& list, Interface_CopyTool& TC) const; - - //! Gives the way of dumping an entity under a form comprehensive - //! for each norm. helps to identify, number ... entities. - //! is to be interpreted for each norm (because of the - //! formats which can be very different) - Standard_EXPORT virtual void DumpEntity (const Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol, const Handle(Standard_Transient)& entity, const Handle(Message_Messenger)& S, const Standard_Integer level) const = 0; - - //! Calls deferred DumpEntity with the recorded default level - Standard_EXPORT void DumpEntity (const Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol, const Handle(Standard_Transient)& entity, const Handle(Message_Messenger)& S) const; - - //! Records a default level and a maximum value for level - //! level for DumpEntity can go between 0 and - //! default value will be - Standard_EXPORT void SetDumpLevels (const Standard_Integer def, const Standard_Integer max); - - //! Returns the recorded default and maximum dump levels - //! If none was recorded, max is returned negative, def as zero - Standard_EXPORT void DumpLevels (Standard_Integer& def, Standard_Integer& max) const; - - //! Records a short line of help for a level (0 - max) - Standard_EXPORT void SetDumpHelp (const Standard_Integer level, const Standard_CString help); - - //! Returns the help line recorded for , or an empty string - Standard_EXPORT Standard_CString DumpHelp (const Standard_Integer level) const; - - DEFINE_STANDARD_RTTIEXT(IFSelect_WorkLibrary,Standard_Transient) - - protected: - - //! Required to initialise fields - IFSelect_WorkLibrary() : thelevdef(0) {} - - private: - - Standard_Integer thelevdef; - Handle(Interface_HArray1OfHAsciiString) thelevhlp; -}; - -#endif // _IFSelect_WorkLibrary_HeaderFile diff --git a/src/IFSelect/IFSelect_WorkSession.cxx b/src/IFSelect/IFSelect_WorkSession.cxx index e5e8e29952..9a10aff6ed 100644 --- a/src/IFSelect/IFSelect_WorkSession.cxx +++ b/src/IFSelect/IFSelect_WorkSession.cxx @@ -11,155 +11,68 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -//#1 svv 10.01.00 : porting on DEC -//smh#14 17.03.2000 : FRA62479 Clearing of gtool +#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 -#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 -#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 +#include +#include -IMPLEMENT_STANDARD_RTTIEXT(IFSelect_WorkSession,MMgt_TShared) +IMPLEMENT_STANDARD_RTTIEXT(IFSelect_WorkSession,XSControl_WorkSession) -#define Flag_Incorrect 2 +#define Flag_Incorrect 2 //szv_c1: duplicated in XSControl_WorkSession // (Bit Map n0 2) - -static Standard_Boolean errhand; // pb : un seul a la fois, mais ca va si vite -static TCollection_AsciiString bufstr; - - -// ################################################################# +static Standard_Boolean errhand; //szv_c1: duplicated in XSControl_WorkSession //======================================================================= -//function : +//function : Constructor //purpose : //======================================================================= IFSelect_WorkSession::IFSelect_WorkSession () +: myNames(new Dico_DictionaryOfTransient), + myVars(new IFSelect_Vars) { - theshareout = new IFSelect_ShareOut; - theerrhand = errhand = Standard_True; - thenames = new Dico_DictionaryOfTransient; - thecopier = new IFSelect_ModelCopier; - thecopier->SetShareOut (theshareout); - thecheckdone = Standard_False; - thegtool = new Interface_GTool; - themodelstat = Standard_False; -} - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void IFSelect_WorkSession::SetErrorHandle (const Standard_Boolean toHandle) -{ - theerrhand = errhand = toHandle; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void IFSelect_WorkSession::SetProtocol - (const Handle(Interface_Protocol)& protocol) -{ - theprotocol = protocol; - Interface_Protocol::SetActive(protocol); - thegtool->SetProtocol (protocol); } //======================================================================= -//function : +//function : SetController //purpose : //======================================================================= -void IFSelect_WorkSession::SetSignType (const Handle(IFSelect_Signature)& signtype) +void IFSelect_WorkSession::SetController (const Handle(XSControl_Controller)& ctl) { - thegtool->SetSignType (signtype); - if (signtype.IsNull()) thenames->RemoveItem ("xst-sign-type"); - else thenames->SetItem ("xst-sign-type",signtype); -} + ClearItems(); - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(IFSelect_Signature) IFSelect_WorkSession::SignType () const -{ - return Handle(IFSelect_Signature)::DownCast (thegtool->SignType()); + XSControl_WorkSession::SetController(ctl); } @@ -168,12 +81,33 @@ Handle(IFSelect_Signature) IFSelect_WorkSession::SignType () const //purpose : //======================================================================= -void IFSelect_WorkSession::SetShareOut - (const Handle(IFSelect_ShareOut)& shareout) +void IFSelect_WorkSession::ClearData (const Standard_Integer mode) { - theshareout = shareout; - thecopier->SetShareOut (theshareout); -// ... faudrait ajouter les Params, Dispatches, etc... + switch (mode) { + case 4 : { +// MISE A JOUR des SelectPointed C-A-D on efface leur contenu +// AINSI que des editeurs (en fait, les EditForm) +// Des compteurs C-A-D on efface leur contenu (a reevaluer) + Handle(TColStd_HSequenceOfInteger) list = ItemIdents(STANDARD_TYPE(IFSelect_SelectPointed)); + Standard_Integer nb = list->Length(); + Standard_Integer i; // svv #1 + for (i = 1; i <= nb; i ++) { + DeclareAndCast(IFSelect_SelectPointed,sp,Item(list->Value(i))); + if (!sp.IsNull()) sp->Clear(); + } + list = ItemIdents(STANDARD_TYPE(IFSelect_SignatureList)); + nb = list->Length(); + for (i = 1; i <= nb; i ++) { + DeclareAndCast(IFSelect_SignatureList,sl,Item(list->Value(i))); + if (!sl.IsNull()) sl->Clear(); + DeclareAndCast(IFSelect_SignCounter,sc,sl); + if (!sc.IsNull()) sc->SetSelMode(-1); + } + myItems.Clear(); + break; + } + default : XSControl_WorkSession::ClearData(mode); + } } @@ -182,24 +116,11 @@ void IFSelect_WorkSession::SetShareOut //purpose : //======================================================================= -void IFSelect_WorkSession::SetModel - (const Handle(Interface_InterfaceModel)& model, - const Standard_Boolean clearpointed) +void IFSelect_WorkSession::SetSignType (const Handle(IFSelect_Signature)& signtype) { - if (myModel != model) - theloaded.Clear(); - myModel = model; - if (!thegtool.IsNull()) thegtool->ClearEntities(); //smh#14 FRA62479 - myModel->SetGTool (thegtool); - - thegraph.Nullify(); - ComputeGraph(); // fait qqchose si Protocol present. Sinon, ne fait rien - ClearData(3); // RAZ CheckList, a refaire - thecheckrun.Clear(); - -// MISE A JOUR des SelectPointed C-A-D on efface leur contenu - if (clearpointed) ClearData(4); - ClearData(0); + thegtool->SetSignType (signtype); + if (signtype.IsNull()) myNames->RemoveItem ("xst-sign-type"); + else myNames->SetItem ("xst-sign-type",signtype); } @@ -208,32 +129,9 @@ void IFSelect_WorkSession::SetModel //purpose : //======================================================================= -IFSelect_ReturnStatus IFSelect_WorkSession::ReadFile - (const Standard_CString filename) +Handle(IFSelect_Signature) IFSelect_WorkSession::SignType () const { - if (thelibrary.IsNull()) return IFSelect_RetVoid; - if (theprotocol.IsNull()) return IFSelect_RetVoid; - Handle(Interface_InterfaceModel) model; - IFSelect_ReturnStatus status = IFSelect_RetVoid; - try { - OCC_CATCH_SIGNALS - Standard_Integer stat = thelibrary->ReadFile (filename,model,theprotocol); - if (stat == 0) status = IFSelect_RetDone; - else if (stat < 0) status = IFSelect_RetError; - else status = IFSelect_RetFail; - } - catch(Standard_Failure) { - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - sout<<" **** Interruption ReadFile par Exception : ****\n"; - sout << Standard_Failure::Caught()->GetMessageString(); - sout<<"\n Abandon"<SignType()); } @@ -299,19 +197,6 @@ Standard_Integer IFSelect_WorkSession::NumberFromLabel } -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(TCollection_HAsciiString) IFSelect_WorkSession::EntityLabel (const Handle(Standard_Transient)& ent) const -{ - if (myModel.IsNull() || ent.IsNull()) return 0; - if (!myModel->Contains(ent)) return 0; - return myModel->StringLabel(ent); -} - - //======================================================================= //function : //purpose : @@ -345,9 +230,12 @@ Standard_Integer IFSelect_WorkSession::CategoryNumber (const Handle(Standard_Tra //purpose : //======================================================================= -Standard_CString IFSelect_WorkSession::CategoryName (const Handle(Standard_Transient)& ent) const +Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::Shareds (const Handle(Standard_Transient)& ent) { - return Interface_Category::Name (CategoryNumber (ent)); + Handle(TColStd_HSequenceOfTransient) list; + if (!ComputeGraph()) return list; + if (StartingNumber(ent) == 0) return list; + return thegraph->Graph().Shareds(ent).Content(); } @@ -356,9 +244,12 @@ Standard_CString IFSelect_WorkSession::CategoryName (const Handle(Standard_Trans //purpose : //======================================================================= -Standard_CString IFSelect_WorkSession::ValidityName (const Handle(Standard_Transient)& ent) const +Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::Sharings (const Handle(Standard_Transient)& ent) { - return ((StartingNumber(ent) == 0)? "" : IFSelect_SignValidity::CVal (ent,myModel)); + Handle(TColStd_HSequenceOfTransient) list; + if (!ComputeGraph()) return list; + if (StartingNumber(ent) == 0) return list; + return thegraph->Graph().Sharings(ent).Content(); } @@ -367,96 +258,45 @@ Standard_CString IFSelect_WorkSession::ValidityName (const Handle(Standard_Trans //purpose : //======================================================================= -void IFSelect_WorkSession::ClearData (const Standard_Integer mode) +Interface_CheckIterator IFSelect_WorkSession::CheckOne + (const Handle(Standard_Transient)& ent, + const Standard_Boolean complete) { - switch (mode) { - case 1 : { - theloaded.Clear(); - if (!myModel.IsNull()) { - myModel->Clear(); - myModel.Nullify(); - } - ClearData(2); ClearData(4); - thecheckrun.Clear(); - break; - } - case 2 : { thegraph.Nullify(); thecheckdone = Standard_False; thecheckana.Clear(); break; } - case 3 : { thecheckdone = Standard_False; break; } - case 4 : { -// MISE A JOUR des SelectPointed C-A-D on efface leur contenu -// AINSI que des editeurs (en fait, les EditForm) -// Des compteurs C-A-D on efface leur contenu (a reevaluer) - Handle(TColStd_HSequenceOfInteger) list = - ItemIdents(STANDARD_TYPE(IFSelect_SelectPointed)); - Standard_Integer nb = list->Length(); - Standard_Integer i; // svv #1 - for (i = 1; i <= nb; i ++) { - DeclareAndCast(IFSelect_SelectPointed,sp,Item(list->Value(i))); - if (!sp.IsNull()) sp->Clear(); - } - list = ItemIdents(STANDARD_TYPE(IFSelect_SignatureList)); - nb = list->Length(); - for (i = 1; i <= nb; i ++) { - DeclareAndCast(IFSelect_SignatureList,sl,Item(list->Value(i))); - if (!sl.IsNull()) sl->Clear(); - DeclareAndCast(IFSelect_SignCounter,sc,sl); - if (!sc.IsNull()) sc->SetSelMode(-1); - } - list = ItemIdents(STANDARD_TYPE(IFSelect_EditForm)); - nb = list->Length(); - Handle(Standard_Transient) nulent; - for (i = 1; i <= nb; i ++) { - DeclareAndCast(IFSelect_EditForm,edf,Item(list->Value(i))); - edf->ClearData (); - } - theitems.Clear(); - break; - } - default : break; + Interface_CheckIterator checks; + checks.SetModel(myModel); + if (!IsLoaded()) { + checks.CCheck(0)->AddFail("DATA NOT AVAILABLE FOR CHECK"); + return checks; } + Standard_Integer num = -1; + if (ent.IsNull() || ent == myModel) num = 0; + else num = myModel->Number(ent); + + Handle(Interface_Check) ach = myModel->Check (num,Standard_True); + if (complete) ach->GetMessages (myModel->Check (num,Standard_False)); + if (num > 0) ach->SetEntity(ent); + checks.Add (ach,num); + checks.SetName ("Data Check (One Entity)"); + return checks; } +// ##################################################################### +// .... LES VARIABLES .... + //======================================================================= //function : //purpose : //======================================================================= -Standard_Boolean IFSelect_WorkSession::ComputeGraph - (const Standard_Boolean enforce) +Standard_Boolean IFSelect_WorkSession::HasName (const Handle(Standard_Transient)& item) const { - if (theprotocol.IsNull()) return Standard_False; - if (myModel.IsNull()) return Standard_False; - if (enforce) thegraph.Nullify(); - if (!thegraph.IsNull()) { - if (myModel->NbEntities() == thegraph->Graph().Size()) return Standard_True; - thegraph.Nullify(); - } - if (myModel->NbEntities() == 0) return Standard_False; - // Il faut calculer le graphe pour de bon - thegraph = new Interface_HGraph (myModel,themodelstat); - Standard_Integer nb = myModel->NbEntities(); - if(themodelstat) - { - Standard_Integer i; // svv #1 - for (i = 1; i <= nb; i ++) thegraph->CGraph().SetStatus(i,0); - Interface_BitMap& bm = thegraph->CGraph().CBitMap(); - bm.AddFlag(); - bm.SetFlagName (Flag_Incorrect,"Incorrect"); - } - ComputeCheck(); - thecheckdone = Standard_True; - if(themodelstat) - { - // Calcul des categories, a present memorisees dans le modele - Interface_Category categ(thegtool); - Interface_ShareTool sht(thegraph); - Standard_Integer i =1; - for ( ; i <= nb; i ++) - myModel->SetCategoryNumber(i,categ.CatNum(myModel->Value(i),sht)); - } - - return Standard_True; + if (item.IsNull()) return Standard_False; + Standard_Integer id = myItems.FindIndex(item); + if (id == 0) return Standard_False; + Handle(Standard_Transient) att = myItems.FindFromIndex(id); + if (att.IsNull()) return Standard_False; + return att->IsKind(STANDARD_TYPE(TCollection_HAsciiString)); } @@ -465,10 +305,14 @@ Standard_Boolean IFSelect_WorkSession::ComputeGraph //purpose : //======================================================================= -Handle(Interface_HGraph) IFSelect_WorkSession::HGraph () +Handle(TCollection_HAsciiString) IFSelect_WorkSession::Name (const Handle(Standard_Transient)& item) const { - ComputeGraph(); - return thegraph; + Handle(TCollection_HAsciiString) res; + if (item.IsNull()) return res; + Standard_Integer id = myItems.FindIndex(item); + if (id == 0) return res; // Null + Handle(Standard_Transient) att = myItems.FindFromIndex(id); + return GetCasted(TCollection_HAsciiString,att); } @@ -477,12 +321,10 @@ Handle(Interface_HGraph) IFSelect_WorkSession::HGraph () //purpose : //======================================================================= -const Interface_Graph& IFSelect_WorkSession::Graph () +Standard_Integer IFSelect_WorkSession::AddItem + (const Handle(Standard_Transient)& item) { - ComputeGraph(); - if (thegraph.IsNull()) Standard_DomainError::Raise - ("IFSelect WorkSession : Graph not available"); - return thegraph->Graph(); + return AddNamedItem("",item); } @@ -491,28 +333,35 @@ const Interface_Graph& IFSelect_WorkSession::Graph () //purpose : //======================================================================= -Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::Shareds - (const Handle(Standard_Transient)& ent) +Standard_Integer IFSelect_WorkSession::AddNamedItem + (const Standard_CString name, const Handle(Standard_Transient)& item) { - Handle(TColStd_HSequenceOfTransient) list; - if (!ComputeGraph()) return list; - if (StartingNumber(ent) == 0) return list; - return thegraph->Graph().Shareds(ent).Content(); -} + if (item.IsNull()) return 0; + if (name[0] == '#' || name[0] == '!') return 0; +// #nnn : pas un nom mais un numero. !... : reserve (interdit pour un nom) +// nom deja pris : on ecrase l ancienne valeur + if (name[0] != '\0') { + Standard_Boolean deja; + Handle(Standard_Transient)& newitem = myNames->NewItem(name,deja); + newitem = item; + } -//======================================================================= -//function : -//purpose : -//======================================================================= + Standard_Integer id = myItems.FindIndex(item); + if (id > 0) { + Handle(Standard_Transient)& att = myItems.ChangeFromIndex(id); + if (name[0] != '\0') { + att = new TCollection_HAsciiString(name); + } + else if (att.IsNull()) att = item; + } + else { + if (name[0] != '\0') + id = myItems.Add(item,new TCollection_HAsciiString(name)); + else id = myItems.Add(item,item); + } -Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::Sharings - (const Handle(Standard_Transient)& ent) -{ - Handle(TColStd_HSequenceOfTransient) list; - if (!ComputeGraph()) return list; - if (StartingNumber(ent) == 0) return list; - return thegraph->Graph().Sharings(ent).Content(); + return id; } @@ -521,49 +370,49 @@ Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::Sharings //purpose : //======================================================================= -Standard_Boolean IFSelect_WorkSession::IsLoaded () const +Standard_Boolean IFSelect_WorkSession::RemoveItem (const Handle(Standard_Transient)& item) { - if (theprotocol.IsNull()) return Standard_False; - if (myModel.IsNull()) return Standard_False; - if (myModel->NbEntities() == 0) return Standard_False; - if (thegraph.IsNull()) return Standard_False; - if (myModel->NbEntities() == thegraph->Graph().Size()) return Standard_True; - return Standard_False; + if (item.IsNull()) return Standard_False; + Standard_Integer id = myItems.FindIndex(item); + if (id == 0) return Standard_False; + Handle(Standard_Transient)& att = myItems.ChangeFromIndex(id); + if (att.IsNull()) return Standard_False; // deja annulle + +// Marquer "Removed" dans la Map (on ne peut pas la vider) + if (att->IsKind(STANDARD_TYPE(TCollection_HAsciiString))) { + if (!myNames->RemoveItem + (GetCasted(TCollection_HAsciiString,att)->ToCString())) + return Standard_False; + } + att.Nullify(); // cf ChangeFromIndex + return Standard_True; } +// .. Recherche par label : recherche en liste(noms) ou iterative + + //======================================================================= //function : //purpose : //======================================================================= -Standard_Boolean IFSelect_WorkSession::ComputeCheck - (const Standard_Boolean enforce) +Standard_Integer IFSelect_WorkSession::NextIdentForLabel + (const Standard_CString label, const Standard_Integer id, + const Standard_Integer mode) const { - if (enforce) thecheckdone = Standard_False; - if (thecheckdone) return Standard_True; - if (!IsLoaded()) return Standard_False; - - Interface_Graph& CG = thegraph->CGraph(); - Interface_CheckTool cht(thegraph); - Interface_CheckIterator checklist = cht.VerifyCheckList(); - myModel->FillSemanticChecks(checklist,Standard_False); - if(themodelstat) - { - // Et on met a jour le Graphe (BitMap) ! Flag Incorrect (STX + SEM) - Interface_BitMap& BM = CG.CBitMap(); - BM.Init (Standard_False,Flag_Incorrect); - Standard_Integer num, nb = CG.Size(); - for (checklist.Start(); checklist.More(); checklist.Next()) { - const Handle(Interface_Check) chk = checklist.Value(); - if (!chk->HasFailed()) continue; - num = checklist.Number(); - if (num > 0 && num <= nb) BM.SetTrue (num,Flag_Incorrect); + Standard_Integer nb = MaxIdent(); + for (Standard_Integer i = id+1; i <= nb; i ++) { + Handle(TCollection_HAsciiString) lab = ItemLabel(i); + if (lab.IsNull()) continue; + switch (mode) { + case 0 : if (!strcmp(lab->ToCString(),label)) return i; break; // switch + case 1 : if (lab->Search(label) == 1 ) return i; break; + case 2 : if (lab->Search(label) > 0 ) return i; break; + default : break; // break du switch } - for (num = 1; num <= nb; num ++) - if (myModel->IsErrorEntity (num)) BM.SetTrue (num,Flag_Incorrect); } - return Standard_True; + return 0; // ici : pas trouve } @@ -572,61 +421,9 @@ Standard_Boolean IFSelect_WorkSession::ComputeCheck //purpose : //======================================================================= -Interface_CheckIterator IFSelect_WorkSession::ModelCheckList - (const Standard_Boolean complete) +Standard_Integer IFSelect_WorkSession::MaxIdent () const { - Interface_CheckIterator checks; - if (!IsLoaded()) { - checks.CCheck(0)->AddFail("DATA NOT AVAILABLE FOR CHECK"); - return checks; - } - Interface_CheckTool cht(Graph()); - checks = (complete ? cht.CompleteCheckList() : cht.AnalyseCheckList()); - checks.SetName - ((char*)(complete ? "Model Complete Check List" : "Model Syntactic Check List")); - return checks; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Interface_CheckIterator IFSelect_WorkSession::CheckOne - (const Handle(Standard_Transient)& ent, - const Standard_Boolean complete) -{ - Interface_CheckIterator checks; - checks.SetModel(myModel); - if (!IsLoaded()) { - checks.CCheck(0)->AddFail("DATA NOT AVAILABLE FOR CHECK"); - return checks; - } - Standard_Integer num = -1; - if (ent.IsNull() || ent == myModel) num = 0; - else num = myModel->Number(ent); - - Handle(Interface_Check) ach = myModel->Check (num,Standard_True); - if (complete) ach->GetMessages (myModel->Check (num,Standard_False)); - if (num > 0) ach->SetEntity(ent); - checks.Add (ach,num); - checks.SetName ("Data Check (One Entity)"); - return checks; -} - - -// ##################################################################### -// .... LES VARIABLES .... - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Integer IFSelect_WorkSession::MaxIdent () const -{ - return theitems.Extent(); + return myItems.Extent(); } @@ -640,8 +437,8 @@ Handle(Standard_Transient) IFSelect_WorkSession::Item { Handle(Standard_Transient) res; if (id <= 0 || id > MaxIdent()) return res; - if (theitems.FindFromIndex(id).IsNull()) return res; - return theitems.FindKey(id); + if (myItems.FindFromIndex(id).IsNull()) return res; + return myItems.FindKey(id); } @@ -654,9 +451,9 @@ Standard_Integer IFSelect_WorkSession::ItemIdent (const Handle(Standard_Transient)& item) const { if (item.IsNull()) return 0; - Standard_Integer id = theitems.FindIndex(item); + Standard_Integer id = myItems.FindIndex(item); if (id == 0) return 0; - if (theitems.FindFromIndex(id).IsNull()) return 0; + if (myItems.FindFromIndex(id).IsNull()) return 0; return id; } @@ -675,7 +472,7 @@ Handle(Standard_Transient) IFSelect_WorkSession::NamedItem Standard_Integer id = atoi( &name[1] ); return Item(id); } - if (!thenames->GetItem(name,res)) res.Nullify(); + if (!myNames->GetItem(name,res)) res.Nullify(); return res; } @@ -708,193 +505,11 @@ Standard_Integer IFSelect_WorkSession::NameIdent Standard_Integer id = atoi( &name[1] ); return id; } - if (!thenames->GetItem(name,res)) return 0; + if (!myNames->GetItem(name,res)) return 0; return ItemIdent(res); } -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::HasName - (const Handle(Standard_Transient)& item) const -{ - if (item.IsNull()) return Standard_False; - Standard_Integer id = theitems.FindIndex(item); - if (id == 0) return Standard_False; - Handle(Standard_Transient) att = theitems.FindFromIndex(id); - if (att.IsNull()) return Standard_False; - return att->IsKind(STANDARD_TYPE(TCollection_HAsciiString)); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(TCollection_HAsciiString) IFSelect_WorkSession::Name - (const Handle(Standard_Transient)& item) const -{ - Handle(TCollection_HAsciiString) res; - if (item.IsNull()) return res; - Standard_Integer id = theitems.FindIndex(item); - if (id == 0) return res; // Null - Handle(Standard_Transient) att = theitems.FindFromIndex(id); - return GetCasted(TCollection_HAsciiString,att); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Integer IFSelect_WorkSession::AddItem - (const Handle(Standard_Transient)& item, - const Standard_Boolean active) -{ - if (item.IsNull()) return 0; - Standard_Integer id = theitems.FindIndex(item); - if (id > 0) { - Handle(Standard_Transient)& att = theitems.ChangeFromIndex(id); - if (att.IsNull()) att = item; - } - else id = theitems.Add(item,item); - -// Cas particuliers : Dispatch,Modifier - if (active) SetActive(item,Standard_True); - return id; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Integer IFSelect_WorkSession::AddNamedItem - (const Standard_CString name, const Handle(Standard_Transient)& item, - const Standard_Boolean active) -{ - if (item.IsNull()) return 0; - if (name[0] == '#' || name[0] == '!') return 0; -// #nnn : pas un nom mais un numero. !... : reserve (interdit pour un nom) -// nom deja pris : on ecrase l ancienne valeur - if (name[0] != '\0') { - Standard_Boolean deja; - Handle(Standard_Transient)& newitem = thenames->NewItem(name,deja); -// if (deja & item != newitem) return 0; - newitem = item; - } - Standard_Integer id = theitems.FindIndex(item); - if (id > 0) { - Handle(Standard_Transient)& att = theitems.ChangeFromIndex(id); - if (att.IsNull()) att = item; - if (name[0] != '\0') { -// if (!att->IsKind(STANDARD_TYPE(TCollection_HAsciiString))) ecrasement admis ! - att = new TCollection_HAsciiString(name); - } - } - else if (name[0] != '\0') - id = theitems.Add(item,new TCollection_HAsciiString(name)); - else id = theitems.Add(item,item); - -// Cas particuliers : Dispatch,Modifier - if (active) SetActive(item,Standard_True); - return id; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::SetActive - (const Handle(Standard_Transient)& item, const Standard_Boolean mode) -{ - if (item->IsKind(STANDARD_TYPE(IFSelect_Dispatch))) { - DeclareAndCast(IFSelect_Dispatch,disp,item); - Standard_Integer num = theshareout->DispatchRank(disp); - if ( num > theshareout->NbDispatches()) return Standard_False; - if ( mode) { - if (num > 0) return Standard_False; - theshareout->AddDispatch (disp); - return Standard_True; - } else { - if (num <= theshareout->LastRun()) return Standard_False; - theshareout->RemoveDispatch(num); - SetFileRoot(disp,""); // si onlynamed : nettoie aussi ShareOut - return Standard_True; - } - } - - return Standard_False; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::RemoveNamedItem - (const Standard_CString name) -{ - Handle(Standard_Transient) item = NamedItem(name); - if (item.IsNull()) return Standard_False; - if (!RemoveItem(item)) return Standard_False; // qui se charge de tout - return Standard_True; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::RemoveName - (const Standard_CString name) -{ - Handle(Standard_Transient) item = NamedItem(name); - if (item.IsNull()) return Standard_False; - theitems.Add(item,item); // reste mais sans nom - return thenames->RemoveItem(name); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::RemoveItem - (const Handle(Standard_Transient)& item) -{ - if (item.IsNull()) return Standard_False; - Standard_Integer id = theitems.FindIndex(item); - if (id == 0) return Standard_False; - Handle(Standard_Transient)& att = theitems.ChangeFromIndex(id); - if (att.IsNull()) return Standard_False; // deja annulle - -// Cas particuliers : Dispatch,Modifier - theshareout->RemoveItem(item); - -// Marquer "Removed" dans la Map (on ne peut pas la vider) - if (att->IsKind(STANDARD_TYPE(TCollection_HAsciiString))) { - if (!thenames->RemoveItem - (GetCasted(TCollection_HAsciiString,att)->ToCString())) - return Standard_False; - } - att.Nullify(); // cf ChangeFromIndex -// id = theitems.Add(item,att); - return Standard_True; -} - - //======================================================================= //function : //purpose : @@ -902,9 +517,8 @@ Standard_Boolean IFSelect_WorkSession::RemoveItem void IFSelect_WorkSession::ClearItems () { - thenames->Clear(); - theitems.Clear(); - theshareout->Clear(Standard_False); + myNames->Clear(); + myItems.Clear(); } @@ -937,26 +551,6 @@ Handle(TCollection_HAsciiString) IFSelect_WorkSession::ItemLabel res->AssignCat(sel->Label().ToCString()); return res; } - DeclareAndCast(IFSelect_GeneralModifier,mod,var); - if (!mod.IsNull()) { - if (mod->IsKind(STANDARD_TYPE(IFSelect_Modifier))) - res = new TCollection_HAsciiString("ModelModifier:"); - else res = new TCollection_HAsciiString("FileModifier:"); - res->AssignCat(mod->Label().ToCString()); - return res; - } - DeclareAndCast(IFSelect_Dispatch,disp,var); - if (!disp.IsNull()) { - res = new TCollection_HAsciiString("Dispatch:"); - res->AssignCat(disp->Label().ToCString()); - return res; - } - DeclareAndCast(IFSelect_Transformer,tsf,var); - if (!tsf.IsNull()) { - res = new TCollection_HAsciiString("Transformer:"); - res->AssignCat(tsf->Label().ToCString()); - return res; - } DeclareAndCast(IFSelect_SignatureList,slc,var); if (!slc.IsNull()) { res = new TCollection_HAsciiString("Counter:"); @@ -969,18 +563,6 @@ Handle(TCollection_HAsciiString) IFSelect_WorkSession::ItemLabel res->AssignCat(sig->Name()); return res; } - DeclareAndCast(IFSelect_EditForm,edf,var); - if (!edf.IsNull()) { - res = new TCollection_HAsciiString("EditForm:"); - res->AssignCat(edf->Label()); - return res; - } - DeclareAndCast(IFSelect_Editor,edt,var); - if (!edt.IsNull()) { - res = new TCollection_HAsciiString("Editor:"); - res->AssignCat(edt->Label().ToCString()); - return res; - } res = new TCollection_HAsciiString("VariableType:"); res->AssignCat(var->DynamicType()->Name()); return res; @@ -992,123 +574,28 @@ Handle(TCollection_HAsciiString) IFSelect_WorkSession::ItemLabel //purpose : //======================================================================= -Handle(TColStd_HSequenceOfInteger) IFSelect_WorkSession::ItemIdents - (const Handle(Standard_Type)& type) const +Handle(TColStd_HSequenceOfInteger) IFSelect_WorkSession::ItemIdents (const Handle(Standard_Type)& type) const { Handle(TColStd_HSequenceOfInteger) list = new TColStd_HSequenceOfInteger(); - Standard_Integer nb = theitems.Extent(); + Standard_Integer nb = myItems.Extent(); for (Standard_Integer i = 1; i <= nb; i ++) { - if (theitems.FindKey(i)->IsKind(type)) list->Append(i); - } - return list; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(TColStd_HSequenceOfHAsciiString) IFSelect_WorkSession::ItemNames - (const Handle(Standard_Type)& type) const -{ - Handle(TColStd_HSequenceOfHAsciiString) list = - new TColStd_HSequenceOfHAsciiString(); - for (Dico_IteratorOfDictionaryOfTransient IT(thenames); IT.More(); IT.Next()){ - if (IT.Value()->IsKind(type)) list->Append - (new TCollection_HAsciiString(IT.Name().ToCString())); - } - return list; -} - - -// .. Recherche par label : recherche en liste(noms) ou iterative - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(TColStd_HSequenceOfHAsciiString) IFSelect_WorkSession::ItemNamesForLabel - (const Standard_CString label) const -{ - Handle(TColStd_HSequenceOfHAsciiString) list = - new TColStd_HSequenceOfHAsciiString(); - Standard_Integer i, nb = MaxIdent(); - for (i = 1; i <= nb; i ++) { - Handle(TCollection_HAsciiString) lab = ItemLabel(i); - Handle(Standard_Transient) item = Item(i); - if (lab.IsNull()) continue; - if (label[0] != '\0' && lab->Search(label) <= 0) continue; - - Handle(TCollection_HAsciiString) nom = Name(Item(i)); - if (nom.IsNull()) { nom = new TCollection_HAsciiString(i); nom->Insert(1,'#'); } - else nom = new TCollection_HAsciiString (nom); - list->Append (new TCollection_HAsciiString(lab)); + if (myItems.FindKey(i)->IsKind(type)) list->Append(i); } return list; } -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Integer IFSelect_WorkSession::NextIdentForLabel - (const Standard_CString label, const Standard_Integer id, - const Standard_Integer mode) const -{ - Standard_Integer nb = MaxIdent(); - for (Standard_Integer i = id+1; i <= nb; i ++) { - Handle(TCollection_HAsciiString) lab = ItemLabel(i); - if (lab.IsNull()) continue; - switch (mode) { - case 0 : if (!strcmp(lab->ToCString(),label)) return i; break; // switch - case 1 : if (lab->Search(label) == 1 ) return i; break; - case 2 : if (lab->Search(label) > 0 ) return i; break; - default : break; // break du switch - } - } - return 0; // ici : pas trouve -} - - // ################################################################# // .... Parametres (Int et Text) .... -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(Standard_Transient) IFSelect_WorkSession::NewParamFromStatic - (const Standard_CString statname, const Standard_CString name) -{ - Handle(Standard_Transient) param; - Handle(Interface_Static) stat = Interface_Static::Static(statname); - if (stat.IsNull()) return param; - if (stat->Type() == Interface_ParamInteger) { - Handle(IFSelect_IntParam) intpar = new IFSelect_IntParam; - intpar->SetStaticName (statname); - param = intpar; - } else { - param = stat->HStringValue(); - } - if (param.IsNull()) return param; - if ( AddNamedItem (name, param) == 0 ) param.Nullify(); - return param; -} - //======================================================================= //function : //purpose : //======================================================================= -Handle(IFSelect_IntParam) IFSelect_WorkSession::IntParam - (const Standard_Integer id) const +Handle(IFSelect_IntParam) IFSelect_WorkSession::IntParam (const Standard_Integer id) const { return Handle(IFSelect_IntParam)::DownCast(Item(id)); } @@ -1117,8 +604,7 @@ Handle(IFSelect_IntParam) IFSelect_WorkSession::IntParam //purpose : //======================================================================= -Standard_Integer IFSelect_WorkSession::IntValue - (const Handle(IFSelect_IntParam)& par) const +Standard_Integer IFSelect_WorkSession::IntValue (const Handle(IFSelect_IntParam)& par) const { if (!par.IsNull()) return par->Value(); else return 0; @@ -1130,22 +616,7 @@ Standard_Integer IFSelect_WorkSession::IntValue //purpose : //======================================================================= -Handle(IFSelect_IntParam) IFSelect_WorkSession::NewIntParam - (const Standard_CString name) -{ - Handle(IFSelect_IntParam) intpar = new IFSelect_IntParam; - if ( AddNamedItem (name, intpar) == 0 ) intpar.Nullify(); - return intpar; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::SetIntValue - (const Handle(IFSelect_IntParam)& par, const Standard_Integer val) +Standard_Boolean IFSelect_WorkSession::SetIntValue (const Handle(IFSelect_IntParam)& par, const Standard_Integer val) { if (ItemIdent(par) == 0) return Standard_False; par->SetValue(val); @@ -1158,8 +629,7 @@ Standard_Boolean IFSelect_WorkSession::SetIntValue //purpose : //======================================================================= -Handle(TCollection_HAsciiString) IFSelect_WorkSession::TextParam - (const Standard_Integer id) const +Handle(TCollection_HAsciiString) IFSelect_WorkSession::TextParam (const Standard_Integer id) const { return Handle(TCollection_HAsciiString)::DownCast(Item(id)); } @@ -1168,36 +638,26 @@ Handle(TCollection_HAsciiString) IFSelect_WorkSession::TextParam //purpose : //======================================================================= -TCollection_AsciiString IFSelect_WorkSession::TextValue - (const Handle(TCollection_HAsciiString)& par) const +TCollection_AsciiString IFSelect_WorkSession::TextValue (const Handle(TCollection_HAsciiString)& par) const { if (!par.IsNull()) return TCollection_AsciiString(par->ToCString()); else return TCollection_AsciiString(); } -Handle(TCollection_HAsciiString) IFSelect_WorkSession::NewTextParam - (const Standard_CString name) -{ - Handle(TCollection_HAsciiString) textpar = new TCollection_HAsciiString(""); - if ( AddNamedItem (name, textpar) == 0 ) textpar.Nullify(); - return textpar; -} - - //======================================================================= //function : //purpose : //======================================================================= -Standard_Boolean IFSelect_WorkSession::SetTextValue - (const Handle(TCollection_HAsciiString)& par, const Standard_CString val) +Standard_Boolean IFSelect_WorkSession::SetTextValue (const Handle(TCollection_HAsciiString)& par, const Standard_CString val) { if (ItemIdent(par) == 0) return Standard_False; par->Clear(); par->AssignCat(val); return Standard_True; } + // ######################################################################## // .... SIGNATURES .... @@ -1206,18 +666,17 @@ Standard_Boolean IFSelect_WorkSession::SetTextValue //purpose : //======================================================================= -Handle(IFSelect_Signature) IFSelect_WorkSession::Signature - (const Standard_Integer id) const +Handle(IFSelect_Signature) IFSelect_WorkSession::Signature (const Standard_Integer id) const { return GetCasted(IFSelect_Signature,Item(id)); } - Standard_CString IFSelect_WorkSession::SignValue - (const Handle(IFSelect_Signature)& sign, const Handle(Standard_Transient)& ent) const +Standard_CString IFSelect_WorkSession::SignValue (const Handle(IFSelect_Signature)& sign, const Handle(Standard_Transient)& ent) const { if (sign.IsNull() || myModel.IsNull()) return ""; if (StartingNumber(ent) == 0) return ""; return sign->Value (ent,myModel); } + // ######################################################################## // .... SELECTIONS & Cie .... @@ -1226,8 +685,7 @@ Handle(IFSelect_Signature) IFSelect_WorkSession::Signature //purpose : //======================================================================= -Handle(IFSelect_Selection) IFSelect_WorkSession::Selection - (const Standard_Integer id) const +Handle(IFSelect_Selection) IFSelect_WorkSession::Selection (const Standard_Integer id) const { return GetCasted(IFSelect_Selection,Item(id)); } @@ -1236,8 +694,7 @@ Handle(IFSelect_Selection) IFSelect_WorkSession::Selection //purpose : //======================================================================= -Interface_EntityIterator IFSelect_WorkSession::EvalSelection - (const Handle(IFSelect_Selection)& sel) const +Interface_EntityIterator IFSelect_WorkSession::EvalSelection (const Handle(IFSelect_Selection)& sel) const { Interface_EntityIterator iter; if (errhand) { @@ -1252,7 +709,7 @@ Interface_EntityIterator IFSelect_WorkSession::EvalSelection sout<GetMessageString(); sout<<"\n Abandon"<GetMessageString(); sout<<"\n Abandon"<SetFinalSelection(sel); - return Standard_True; - } - if (!modif.IsNull()) { - if (ItemIdent(modif) == 0) return Standard_False; - if (!sel.IsNull() && ItemIdent(sel) == 0) return Standard_False; -// Selection Nulle : Annuler Selection - modif->SetSelection(sel); - return Standard_True; - } - return Standard_False; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::ResetItemSelection - (const Handle(Standard_Transient)& item) -{ - Handle(IFSelect_Selection) nulsel; - return SetItemSelection (item,nulsel); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(IFSelect_Selection) IFSelect_WorkSession::ItemSelection - (const Handle(Standard_Transient)& item) const -{ - Handle(IFSelect_Selection) sel; - DeclareAndCast(IFSelect_Dispatch,disp,item); - DeclareAndCast(IFSelect_GeneralModifier,modif,item); - if (ItemIdent(disp) > 0) return disp->FinalSelection(); - if (ItemIdent(modif) > 0) return modif->Selection(); - return sel; // Nul ou inconnu -> Null -} - // ###################################################################### // .... Les COMPTEURS .... @@ -1414,1343 +799,50 @@ Handle(IFSelect_Selection) IFSelect_WorkSession::ItemSelection //purpose : //======================================================================= -Handle(IFSelect_SignCounter) IFSelect_WorkSession::SignCounter - (const Standard_Integer id) const -{ return GetCasted(IFSelect_SignCounter,Item(id)); } - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::ComputeCounter - (const Handle(IFSelect_SignCounter)& counter, const Standard_Boolean forced) -{ - if (counter.IsNull()) return Standard_False; - if (!ComputeGraph()) return Standard_False; - return counter->ComputeSelected (Graph(),forced); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::ComputeCounterFromList - (const Handle(IFSelect_SignCounter)& counter, - const Handle(TColStd_HSequenceOfTransient)& list, - const Standard_Boolean clear) -{ - if (counter.IsNull()) return Standard_False; - if (clear) counter->Clear(); - if (list.IsNull()) return ComputeCounter (counter,Standard_True); - counter->AddList (list,myModel); - return Standard_True; -} - -// ###################################################################### -// .... Les DISPATCHES .... - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(TColStd_HSequenceOfInteger) IFSelect_WorkSession::AppliedDispatches - () const -{ - Handle(TColStd_HSequenceOfInteger) list = new TColStd_HSequenceOfInteger(); - Standard_Integer nb = theshareout->NbDispatches(); - for (Standard_Integer i = 1; i <= nb; i ++) { - list->Append (ItemIdent(theshareout->Dispatch(i))); - } - return list; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void IFSelect_WorkSession::ClearShareOut (const Standard_Boolean onlydisp) -{ - theshareout->Clear(onlydisp); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(IFSelect_Dispatch) IFSelect_WorkSession::Dispatch - (const Standard_Integer id) const -{ - return GetCasted(IFSelect_Dispatch,Item(id)); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Integer IFSelect_WorkSession::DispatchRank - (const Handle(IFSelect_Dispatch)& disp) const -{ - if (ItemIdent(disp) == 0) return 0; - return theshareout->DispatchRank(disp); -} - -// ###################################################################### -// .... Les MODIFIERS .... - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void IFSelect_WorkSession::SetModelCopier (const Handle(IFSelect_ModelCopier)& copier) -{ - thecopier = copier; - thecopier->SetShareOut(theshareout); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Integer IFSelect_WorkSession::NbFinalModifiers (const Standard_Boolean formodel) const -{ - return theshareout->NbModifiers(formodel); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(TColStd_HSequenceOfInteger) IFSelect_WorkSession::FinalModifierIdents - (const Standard_Boolean formodel) const -{ -// return ItemIdents(STANDARD_TYPE(IFSelect_Modifier)); -// On donne la liste dans l ordre du ModelCopier, qui fait foi - Handle(TColStd_HSequenceOfInteger) list = new TColStd_HSequenceOfInteger(); - Standard_Integer nbm = theshareout->NbModifiers(formodel); - for (Standard_Integer i = 1; i <= nbm; i ++) - list->Append(ItemIdent(theshareout->GeneralModifier(formodel,i))); - return list; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(IFSelect_GeneralModifier) IFSelect_WorkSession::GeneralModifier (const Standard_Integer id) const -{ - return GetCasted(IFSelect_GeneralModifier,Item(id)); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(IFSelect_Modifier) IFSelect_WorkSession::ModelModifier (const Standard_Integer id) const -{ - return GetCasted(IFSelect_Modifier,Item(id)); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Integer IFSelect_WorkSession::ModifierRank (const Handle(IFSelect_GeneralModifier)& modif) const -{ - if (ItemIdent(modif) == 0) return 0; - return theshareout->ModifierRank(modif); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::ChangeModifierRank - (const Standard_Boolean formodel, - const Standard_Integer before, const Standard_Integer after) -{ - return theshareout->ChangeModifierRank(formodel,before,after); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void IFSelect_WorkSession::ClearFinalModifiers () -{ - Handle(TColStd_HSequenceOfInteger) list = FinalModifierIdents (Standard_True); - Standard_Integer nb = list->Length(); - Standard_Integer i; // svv #1 - for (i = 1; i <= nb; i ++) - RemoveItem(GeneralModifier(list->Value(i))); - list = FinalModifierIdents (Standard_False); - nb = list->Length(); - for (i = 1; i <= nb; i ++) - RemoveItem(GeneralModifier(list->Value(i))); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::SetAppliedModifier - (const Handle(IFSelect_GeneralModifier)& modif, - const Handle(Standard_Transient)& item) -{ - if (ItemIdent(modif) == 0) return Standard_False; - - if (item.IsNull()) return Standard_False; - if (item == theshareout) { - theshareout->AddModifier(modif,0); - return Standard_True; - } - if (item->IsKind(STANDARD_TYPE(IFSelect_Dispatch))) { - DeclareAndCast(IFSelect_Dispatch,disp,item); - theshareout->AddModifier(modif,0); - modif->SetDispatch(disp); - return Standard_True; - } - if (item->IsKind(STANDARD_TYPE(IFSelect_TransformStandard))) { - DeclareAndCast(IFSelect_TransformStandard,stf,item); - DeclareAndCast(IFSelect_Modifier,tmod,modif); - if (tmod.IsNull()) return Standard_False; - stf->AddModifier (tmod); - theshareout->RemoveItem(modif); - return Standard_True; - } - return Standard_False; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::ResetAppliedModifier - (const Handle(IFSelect_GeneralModifier)& modif) -{ - if (ItemIdent(modif) == 0) return Standard_False; - - return theshareout->RemoveItem(modif); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(Standard_Transient) IFSelect_WorkSession::UsesAppliedModifier - (const Handle(IFSelect_GeneralModifier)& modif) const -{ - Handle(Standard_Transient) res; - if (ItemIdent(modif) == 0) return res; - if (theshareout->ModifierRank(modif) == 0) return res; - res = modif->Dispatch(); - if (res.IsNull()) res = theshareout; - return res; -} - -// ################################################################# -// .... Transformer .... - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(IFSelect_Transformer) IFSelect_WorkSession::Transformer (const Standard_Integer id) const -{ - return GetCasted(IFSelect_Transformer,Item(id)); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Integer IFSelect_WorkSession::RunTransformer - (const Handle(IFSelect_Transformer)& transf) -{ - Standard_Integer effect = 0; - if (transf.IsNull() || !IsLoaded()) return effect; - Handle(Interface_InterfaceModel) newmod; // Null au depart - Interface_CheckIterator checks; - checks.SetName("X-STEP WorkSession : RunTransformer"); - Standard_Boolean res = transf->Perform - (thegraph->Graph(),theprotocol,checks,newmod); - - if (!checks.IsEmpty(Standard_False)) { - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - sout<<" ** RunTransformer has produced Check Messages : **"<Length(); - for (Standard_Integer i = 1; i <= nb; i ++) { - DeclareAndCast(IFSelect_SelectPointed,sp,Item(list->Value(i))); - sp->Update(transf); - } - if (newmod == myModel) { - effect = (res ? 2 : -2); - if (!res) return effect; - Handle(Interface_Protocol) newproto = theprotocol; - if (transf->ChangeProtocol(newproto)) - { effect = 4; theprotocol = newproto; thegtool->SetProtocol(newproto); } - return (ComputeGraph(Standard_True) ? 4 : -4); - } else { - effect = (res ? 3 : -3); - if (!res) return effect; - Handle(Interface_Protocol) newproto = theprotocol; - if (transf->ChangeProtocol(newproto)) - { effect = 5; theprotocol = newproto; thegtool->SetProtocol(newproto); } - theoldel = myModel; - SetModel(newmod,Standard_False); - } - return effect; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Integer IFSelect_WorkSession::RunModifier - (const Handle(IFSelect_Modifier)& modif, const Standard_Boolean copy) -{ - Handle(IFSelect_Selection) sel; // null - return RunModifierSelected (modif,sel,copy); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Integer IFSelect_WorkSession::RunModifierSelected - (const Handle(IFSelect_Modifier)& modif, - const Handle(IFSelect_Selection)& sel, const Standard_Boolean copy) -{ - if (ItemIdent(modif) == 0) return Standard_False; - Handle(IFSelect_TransformStandard) stf = new IFSelect_TransformStandard; - stf->SetCopyOption(copy); - stf->SetSelection (sel); - stf->AddModifier (modif); - return RunTransformer (stf); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(IFSelect_Transformer) IFSelect_WorkSession::NewTransformStandard - (const Standard_Boolean copy, const Standard_CString name) -{ - Handle(IFSelect_TransformStandard) stf = new IFSelect_TransformStandard; - stf->SetCopyOption(copy); - if (AddNamedItem (name, stf) == 0) stf.Nullify(); - return stf; -} - - -// Ceci est une action directe : pourrait etre fait par un Transformer ... -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::SetModelContent - (const Handle(IFSelect_Selection)& sel, const Standard_Boolean keep) -{ - if (sel.IsNull() || !IsLoaded()) return Standard_False; - Interface_EntityIterator list = sel->UniqueResult(thegraph->Graph()); - if (list.NbEntities() == 0) return Standard_False; - - Handle(Interface_InterfaceModel) newmod = myModel->NewEmptyModel(); - Interface_CopyTool TC(myModel,theprotocol); - Standard_Integer i, nb = myModel->NbEntities(); - if (keep) { - for (list.Start(); list.More(); list.Next()) - TC.TransferEntity (list.Value()); - } else { - Standard_Integer* flags = new Standard_Integer[nb+1]; - for (i = 0; i <= nb; i ++) flags[i] = 0; - for (list.Start(); list.More(); list.Next()) { - Standard_Integer num = myModel->Number(list.Value()); - if (num <= nb) flags[num] = 1; - } - for (i = 1; i <= nb; i ++) { - if (flags[i] == 0) TC.TransferEntity (myModel->Value(i)); - } - delete [] flags; - } - TC.FillModel(newmod); - if (newmod->NbEntities() == 0) return Standard_False; -// Mettre a jour (ne pas oublier SelectPointed) - theoldel = myModel; - SetModel(newmod,Standard_False); -// MISE A JOUR des SelectPointed - Handle(TColStd_HSequenceOfInteger) pts = - ItemIdents(STANDARD_TYPE(IFSelect_SelectPointed)); - nb = pts->Length(); - for (i = 1; i <= nb; i ++) { - DeclareAndCast(IFSelect_SelectPointed,sp,Item(pts->Value(i))); - sp->Update(TC.Control()); - } - return Standard_True; -} - - -// ################################################################# -// .... File Name .... - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(TCollection_HAsciiString) IFSelect_WorkSession::FilePrefix () const -{ - return theshareout->Prefix(); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(TCollection_HAsciiString) IFSelect_WorkSession::DefaultFileRoot () const -{ - return theshareout->DefaultRootName(); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(TCollection_HAsciiString) IFSelect_WorkSession::FileExtension () const -{ - return theshareout->Extension(); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(TCollection_HAsciiString) IFSelect_WorkSession::FileRoot - (const Handle(IFSelect_Dispatch)& disp) const -{ - return theshareout->RootName(theshareout->DispatchRank(disp)); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void IFSelect_WorkSession::SetFilePrefix (const Standard_CString name) -{ - theshareout->SetPrefix (new TCollection_HAsciiString(name)); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void IFSelect_WorkSession::SetFileExtension (const Standard_CString name) -{ - theshareout->SetExtension (new TCollection_HAsciiString(name)); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::SetDefaultFileRoot - (const Standard_CString name) -{ - Handle(TCollection_HAsciiString) defrt; - if (name[0] != '\0') defrt = new TCollection_HAsciiString(name); - return theshareout->SetDefaultRootName (defrt); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::SetFileRoot - (const Handle(IFSelect_Dispatch)& disp, const Standard_CString namefile) -{ - Standard_Integer id = ItemIdent(disp); - if (id == 0) return Standard_False; - Standard_Integer nd = theshareout->DispatchRank(disp); -/* if (theonlynamed) { - if (nd == 0 && namefile[0] != 0) - theshareout->AddDispatch(disp); - else if (nd != 0 && namefile[0] == 0) - theshareout->RemoveDispatch (nd); - } */ - if (nd == 0) return Standard_False; -// The order below prevented to change the root name on a given dispatch ! -// if (theshareout->HasRootName(nd)) return Standard_False; - Handle(TCollection_HAsciiString) filename; - if (namefile[0] != '\0') filename = new TCollection_HAsciiString (namefile); - return theshareout->SetRootName(nd,filename); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void IFSelect_WorkSession::ClearFile () -{ - thecopier->ClearResult(); - theshareout->ClearResult(Standard_True); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void IFSelect_WorkSession::EvaluateFile () -{ -////... - if (!IsLoaded()) return; - Interface_CheckIterator checks; - if (errhand) { - errhand = Standard_False; - try { - OCC_CATCH_SIGNALS - EvaluateFile(); // appel normal (donc, code pas duplique) - } - catch (Standard_Failure) { - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - sout<<" **** Interruption EvaluateFile par Exception : ****\n"; - sout<GetMessageString(); - sout<<"\n Abandon"<AddFail ("Exception Raised -> Abandon"); - } - errhand = theerrhand; - thecheckrun = checks; - return; - } - - IFSelect_ShareOutResult R(theshareout,thegraph->Graph()); - checks = thecopier->Copy (R,thelibrary,theprotocol); - if (!checks.IsEmpty(Standard_False)) { - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - sout<<" ** EvaluateFile has produced Check Messages : **"<SetRemaining (thegraph->CGraph()); - thecheckrun = checks; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Integer IFSelect_WorkSession::NbFiles () const -{ - return thecopier->NbFiles(); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(Interface_InterfaceModel) IFSelect_WorkSession::FileModel - (const Standard_Integer num) const -{ - Handle(Interface_InterfaceModel) mod; - if (num > 0 && num <= NbFiles()) mod = thecopier->FileModel(num); - return mod; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -TCollection_AsciiString IFSelect_WorkSession::FileName - (const Standard_Integer num) const -{ - TCollection_AsciiString name; - if (num > 0 && num <= NbFiles()) name = thecopier->FileName(num); - return name; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void IFSelect_WorkSession::BeginSentFiles (const Standard_Boolean record) -{ - thecopier->BeginSentFiles(theshareout,record); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(TColStd_HSequenceOfHAsciiString) IFSelect_WorkSession::SentFiles () const -{ - return thecopier->SentFiles(); -} - - -// ######################################################################### -// .... Action de Transfert proprement dite : la grande affaire ! .... - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::SendSplit () -{ -////... - Interface_CheckIterator checks; - - if (errhand) { - errhand = Standard_False; - try { - OCC_CATCH_SIGNALS - return SendSplit(); // appel normal (donc, code pas duplique) - } - catch (Standard_Failure) { - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - sout<<" **** Interruption SendSplit par Exception : ****\n"; - sout<GetMessageString(); - sout<<"\n Abandon"<AddFail ("Exception Raised -> Abandon"); - } - errhand = theerrhand; - thecheckrun = checks; - return Standard_False; - } - - if (thelibrary.IsNull()) { - checks.CCheck(0)->AddFail("WorkLibrary undefined"); - thecheckrun = checks; - return Standard_False; - } - if (!IsLoaded()) { - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - sout<< " *** Data for SendSplit not available ***"<AddFail("Data not available"); - thecheckrun = checks; - return Standard_False; - } - - if (NbFiles() > 0) checks = thecopier->SendCopied (thelibrary,theprotocol); - else { -// Decomposer - if (theshareout.IsNull()) return Standard_False; - Standard_Integer i, nbd = theshareout->NbDispatches(); - Standard_Integer nf = 0; - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - sout<<" SendSplit .. "; - for (i = 1; i <= nbd; i ++) { - Handle(IFSelect_Dispatch) disp = theshareout->Dispatch(i); - if (disp.IsNull()) continue; - IFGraph_SubPartsIterator packs(thegraph->Graph(),Standard_False); - disp->Packets (thegraph->Graph(),packs); - for (packs.Start(); packs.More(); packs.Next()) { - Interface_EntityIterator iter = packs.Entities(); - if (iter.NbEntities() == 0) continue; -// Ecrire une liste d entites - Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed; - sp->SetList (iter.Content()); - nf ++; - TCollection_AsciiString filnam (nf); - filnam.Insert (1,"_"); - Handle(TCollection_HAsciiString) filepart; - filepart = FileRoot(disp); - if (!filepart.IsNull()) filnam.Insert(1,filepart->ToCString()); - filepart = FilePrefix(); - if (!filepart.IsNull()) filnam.Insert(1,filepart->ToCString()); - filepart = FileExtension(); - if (!filepart.IsNull()) filnam.AssignCat (filepart->ToCString()); - IFSelect_ReturnStatus stat = SendSelected (filnam.ToCString(),sp); - if (stat != IFSelect_RetDone) cout<<"File "<Graph()); - return sho.Packets(); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Interface_EntityIterator IFSelect_WorkSession::SentList - (const Standard_Integer newcount) const -{ - Interface_EntityIterator iter; - if (!IsLoaded()) return iter; - const Interface_Graph& G = thegraph->Graph(); - Standard_Integer nb = G.Size(); - Standard_Integer i; - for ( i = 1; i <= nb; i ++) { - Standard_Integer stat = G.Status(i); - if ( (stat > 0 && newcount < 0) || stat == newcount) - iter.GetOneItem(G.Entity(i)); - } - return iter; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Integer IFSelect_WorkSession::MaxSendingCount () const -{ - Standard_Integer newcount = 0; - if (!IsLoaded()) return newcount; - const Interface_Graph& G = thegraph->Graph(); - Standard_Integer nb = G.Size(); - Standard_Integer i; - for (i = 1; i <= nb; i ++) { - Standard_Integer stat = G.Status(i); - if (stat > newcount) newcount = stat; - } - return newcount; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::SetRemaining - (const IFSelect_RemainMode mode) -{ - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - if (!IsLoaded()) return Standard_False; - if (mode == IFSelect_RemainForget) { - Standard_Integer nb = thegraph->Graph().Size(); - for (Standard_Integer i = 1; i <= nb; i ++) - thegraph->CGraph().SetStatus (i,0); - theoldel.Nullify(); - return Standard_True; - } else if (mode == IFSelect_RemainCompute) { - Handle(Interface_InterfaceModel) newmod; - Interface_CopyTool TC(myModel,theprotocol); - thecopier->CopiedRemaining (thegraph->Graph(),thelibrary,TC,newmod); - if (newmod.IsNull()) { - sout<<" No Remaining Data recorded"<SetRemaining (thegraph->CGraph()); - return Standard_False; - } else { - theoldel = myModel; - SetModel(newmod,Standard_False); -// MISE A JOUR des SelectPointed - Handle(TColStd_HSequenceOfInteger) list = - ItemIdents(STANDARD_TYPE(IFSelect_SelectPointed)); - Standard_Integer nb = list->Length(); - for (Standard_Integer i = 1; i <= nb; i ++) { - DeclareAndCast(IFSelect_SelectPointed,sp,Item(list->Value(i))); - sp->Update(TC.Control()); - } - return Standard_True; - } - } else if (mode == IFSelect_RemainDisplay) { - Standard_Integer ne = 0; - Standard_Integer nb = thegraph->Graph().Size(); - for (Standard_Integer i = 1; i <= nb; i ++) - { if (thegraph->Graph().Status(i) >= 0) ne ++; } - if (ne == 0) { - sout<<" - All entities are remaining, none yet sent"<NbDispatches(); - for (Standard_Integer i = nb; i > theshareout->LastRun(); i --) - theshareout->RemoveDispatch(i); -*/ - return Standard_True; - } else if (mode == IFSelect_RemainUndo) { - if (theoldel.IsNull()) return Standard_False; - SetModel(theoldel); theoldel.Nullify(); - return Standard_True; - } - else return Standard_False; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -IFSelect_ReturnStatus IFSelect_WorkSession::SendAll - (const Standard_CString filename, const Standard_Boolean computegraph) -{ -////... - Interface_CheckIterator checks; - if (!IsLoaded()) return IFSelect_RetVoid; - if (thelibrary.IsNull()) { - checks.CCheck(0)->AddFail("WorkLibrary undefined"); - thecheckrun = checks; - return IFSelect_RetError; - } - - if (errhand) { - errhand = Standard_False; - try { - OCC_CATCH_SIGNALS - ComputeGraph(computegraph); - checks = thecopier->SendAll(filename,thegraph->Graph(),thelibrary,theprotocol); - } - catch (Standard_Failure) { - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - sout<<" **** Interruption SendAll par Exception : ****\n"; - sout<GetMessageString(); - sout<<"\n Abandon"<AddFail ("Exception Raised -> Abandon"); - thecheckrun = checks; - return IFSelect_RetFail; - } - } - else checks = thecopier->SendAll(filename,thegraph->Graph(),thelibrary,theprotocol); - Handle(Interface_Check) aMainFail = checks.CCheck(0); - if (!aMainFail.IsNull() && aMainFail->HasFailed ()) - { - return IFSelect_RetStop; - } - if (theloaded.Length() == 0) theloaded.AssignCat(filename); - thecheckrun = checks; - if (checks.IsEmpty(Standard_True)) return IFSelect_RetDone; - return IFSelect_RetError; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -IFSelect_ReturnStatus IFSelect_WorkSession::SendSelected - (const Standard_CString filename, - const Handle(IFSelect_Selection)& sel, - const Standard_Boolean computegraph) -{ -////... - if (!IsLoaded()) return IFSelect_RetVoid; - Interface_CheckIterator checks; - if (thelibrary.IsNull()) { - checks.CCheck(0)->AddFail("WorkLibrary undefined"); - thecheckrun = checks; - return IFSelect_RetVoid; - } - - if (errhand) { - errhand = Standard_False; - try { - OCC_CATCH_SIGNALS - ComputeGraph(computegraph); - return SendSelected (filename,sel); // appel normal - } - catch (Standard_Failure) { - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - sout<<" **** Interruption SendSelected par Exception : ****\n"; - sout<GetMessageString(); - sout<<"\n Abandon"<AddFail ("Exception Raised -> Abandon"); - errhand = theerrhand; - thecheckrun = checks; - return IFSelect_RetFail; - } - } -// if (ItemIdent(sel) == 0) return 3; - Interface_EntityIterator iter = sel->UniqueResult(thegraph->Graph()); - if (iter.NbEntities() == 0) return IFSelect_RetVoid; - - checks = thecopier->SendSelected - (filename,thegraph->Graph(),thelibrary,theprotocol,iter); - thecopier->SetRemaining (thegraph->CGraph()); - thecheckrun = checks; - if (checks.IsEmpty(Standard_True)) return IFSelect_RetDone; - return IFSelect_RetError; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -IFSelect_ReturnStatus IFSelect_WorkSession::WriteFile - (const Standard_CString filename) -{ - if (WorkLibrary().IsNull()) return IFSelect_RetVoid; - ComputeGraph(Standard_True); - if (!IsLoaded()) return IFSelect_RetVoid; - return SendAll (filename); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -IFSelect_ReturnStatus IFSelect_WorkSession::WriteFile - (const Standard_CString filename, const Handle(IFSelect_Selection)& sel) -{ - if (WorkLibrary().IsNull() || sel.IsNull()) return IFSelect_RetVoid; - ComputeGraph(Standard_True); - if (!IsLoaded()) return IFSelect_RetVoid; - return SendSelected (filename,sel); -} - -// ################################################################ -// .... Actions particulieres sur les Selections .... - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Integer IFSelect_WorkSession::NbSources - (const Handle(IFSelect_Selection)& sel) const -{ - if (ItemIdent(sel) == 0) return 0; - if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectExtract)) || - sel->IsKind(STANDARD_TYPE(IFSelect_SelectDeduct)) ) return 1; - if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectControl)) ) return 2; - if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectCombine)) ) return - GetCasted(IFSelect_SelectCombine,sel)->NbInputs(); - return 0; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(IFSelect_Selection) IFSelect_WorkSession::Source - (const Handle(IFSelect_Selection)& sel, const Standard_Integer num) const -{ - Handle(IFSelect_Selection) sr; - if (ItemIdent(sel) == 0) return sr; - if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectExtract)) ) sr = - GetCasted(IFSelect_SelectExtract,sel)->Input(); - else if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectDeduct)) ) sr = - GetCasted(IFSelect_SelectDeduct,sel)->Input(); - else if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectControl)) ) { - if (num == 1) sr = GetCasted(IFSelect_SelectControl,sel)->MainInput(); - else if (num == 2) sr = GetCasted(IFSelect_SelectControl,sel)->SecondInput(); - } - else if (sel->IsKind(STANDARD_TYPE(IFSelect_SelectCombine)) ) sr = - GetCasted(IFSelect_SelectCombine,sel)->Input(num); - return sr; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::IsReversedSelectExtract - (const Handle(IFSelect_Selection)& sel) const -{ - if (ItemIdent(sel) == 0) return Standard_False; - DeclareAndCast(IFSelect_SelectExtract,sxt,sel); - if (sxt.IsNull()) return Standard_False; - return (!sxt->IsDirect()); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::ToggleSelectExtract - (const Handle(IFSelect_Selection)& sel) -{ - if (ItemIdent(sel) == 0) return Standard_False; - DeclareAndCast(IFSelect_SelectExtract,sxt,sel); - if (sxt.IsNull()) return Standard_False; - sxt->SetDirect(!sxt->IsDirect()); - return Standard_True; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::SetInputSelection - (const Handle(IFSelect_Selection)& sel, - const Handle(IFSelect_Selection)& inp) -{ - if (ItemIdent(sel) == 0) return Standard_False; - if (!inp.IsNull() && ItemIdent(inp) == 0) return Standard_False; - DeclareAndCast(IFSelect_SelectExtract,sxt,sel); - if (!sxt.IsNull()) { sxt->SetInput(inp); return Standard_True; } - DeclareAndCast(IFSelect_SelectDeduct,sdt,sel); - if (!sdt.IsNull()) { sdt->SetInput(inp); return Standard_True; } - return Standard_False; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::SetControl - (const Handle(IFSelect_Selection)& sel, - const Handle(IFSelect_Selection)& sc, - const Standard_Boolean formain) -{ - DeclareAndCast(IFSelect_SelectControl,dsel,sel); - if (ItemIdent(dsel) == 0) return Standard_False; - if (ItemIdent(sc) == 0) return Standard_False; - if (formain) dsel->SetMainInput (sc); - else dsel->SetSecondInput (sc); - return Standard_True; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Integer IFSelect_WorkSession::CombineAdd - (const Handle(IFSelect_Selection)& sel, - const Handle(IFSelect_Selection)& seladd, - const Standard_Integer atnum) -{ - DeclareAndCast(IFSelect_SelectCombine,csel,sel); - if (ItemIdent(csel) == 0) return 0; - if (ItemIdent(seladd) == 0) return 0; - csel->Add (seladd,atnum); - return csel->NbInputs(); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::CombineRemove - (const Handle(IFSelect_Selection)& selcomb, - const Handle(IFSelect_Selection)& selrem) -{ - DeclareAndCast(IFSelect_SelectCombine,csel,selcomb); - if (ItemIdent(csel) == 0) return Standard_False; - if (ItemIdent(selrem) == 0) return Standard_False; - Standard_Integer nb = csel->NbInputs(); - for (Standard_Integer i = nb; i > 0; i --) { - if (csel->Input(i) == selrem) { - csel->Remove(i); - return Standard_True; - } - } - return Standard_True; -} - - -// ########################################################################### -// .... Analyse d un CheckIterator par rapport a un graphe .... - -//======================================================================= -//function : -//purpose : -//======================================================================= - -static void IFSelect_QueryProp (Interface_IntList& list, - TCollection_AsciiString& ana, - const Standard_Integer num, const int quoi) -{ - list.SetNumber(num); - Standard_Integer i, nb = list.Length(); - for (i = 1; i <= nb; i ++) { - if (i > 1) list.SetNumber(num); // because recursive call + depth first - Standard_Integer n = list.Value(i); -// y a t il lieu de propager ? -// 1 W/place 2 F/place 3 Wprop 4Wprop+W/place 5Wprop+F/place -// 6 Fprop 7 Fprop+W/place 8 Fprop+F/place - char val = ana.Value(n); - switch (val) { - case ' ' : val = (quoi ? '3' : '6'); break; - case '1' : val = (quoi ? '4' : '7'); break; - case '2' : val = (quoi ? '5' : '8'); break; - case '3' : val = (quoi ? ' ' : '6'); break; - case '4' : val = (quoi ? ' ' : '7'); break; - case '5' : val = (quoi ? ' ' : '8'); break; - case '6' : val = ' '; break; - case '7' : val = ' '; break; - case '8' : val = ' '; break; - default : val = ' '; break; - } - if (val == ' ') continue; - ana.SetValue(n,val); - IFSelect_QueryProp (list,ana,n,quoi); - } -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void IFSelect_WorkSession::QueryCheckList (const Interface_CheckIterator& chl) -{ - if (!IsLoaded()) return; - Standard_Integer i,nb = myModel->NbEntities(); - thecheckana = TCollection_AsciiString (nb+1,' '); - for (chl.Start(); chl.More(); chl.Next()) { - Standard_Integer num = chl.Number(); - const Handle(Interface_Check) ach = chl.Value(); - if (ach->HasFailed()) thecheckana.SetValue(num,'2'); - else if (ach->HasWarnings()) thecheckana.SetValue(num,'1'); - } -// analyse selon le graphe ... codes : blc = rien -// 1 W/place 2 F/place 3 Wprop 4Wprop+W/place 5Wprop+F/place -// 6 Fprop 7 Fprop+W/place 8 Fprop+F/place - Interface_IntList list;// = thegraph->Graph().SharingNums(0); -// deux passes : d abord Warning, puis Fail - for (i = 1; i <= nb; i ++) { - char val = thecheckana.Value(i); - int quoi = -1; - if (val == '1' || val == '4' || val == '7') quoi = 0; - if (quoi >= 0) IFSelect_QueryProp (list,thecheckana,i,quoi); - } - for (i = 1; i <= nb; i ++) { - char val = thecheckana.Value(i); - int quoi = -1; - if (val == '2' || val == '5' || val == '8') quoi = 1; - if (quoi >= 0) IFSelect_QueryProp (list,thecheckana,i,quoi); - } -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Integer IFSelect_WorkSession::QueryCheckStatus - (const Handle(Standard_Transient)& ent) const -{ - if (!IsLoaded()) return -1; - Standard_Integer num = myModel->Number(ent); - if (num == 0) return -1; - if (thecheckana.Length() < num) return -1; - Standard_Character val = thecheckana.Value (num); -// codes : blc = rien -> 0 -// 1 W/place -> 1 2 F/place -> 2 -// 3 Wprop -> 10 4 Wprop+W/place -> 11 5 Wprop+F/place -> 12 -// 6 Fprop -> 20 7 Fprop+W/place -> 21 8 Fprop+F/place -> 22 - if (val == ' ') return 0; - if (val == '1') return 1; - if (val == '2') return 2; - if (val == '3') return 10; - if (val == '4') return 11; - if (val == '5') return 12; - if (val == '6') return 20; - if (val == '7') return 21; - if (val == '8') return 22; - return 0; -} +Handle(IFSelect_SignCounter) IFSelect_WorkSession::SignCounter (const Standard_Integer id) const +{ return GetCasted(IFSelect_SignCounter,Item(id)); } + +// ######################################################################### +// .... Action de Transfert proprement dite : la grande affaire ! .... //======================================================================= //function : //purpose : //======================================================================= -Standard_Integer IFSelect_WorkSession::QueryParent - (const Handle(Standard_Transient)& entdad, - const Handle(Standard_Transient)& entson) const +Interface_EntityIterator IFSelect_WorkSession::SentList + (const Standard_Integer newcount) const { - Standard_Integer ndad = StartingNumber(entdad); - Standard_Integer nson = StartingNumber(entson); - if (ndad < 1 || nson < 1) return -1; - if (ndad == nson) return 0; -// on va calculer : pour chaque pere immediat, de , status avec + 1 -// nb : pas protege contre les boucles ... - Handle(TColStd_HSequenceOfTransient) list = - thegraph->Graph().Sharings(entson).Content(); - if (list.IsNull()) return -1; - Standard_Integer i, nb = list->Length(); - for (i = 1; i <= nb; i ++) { - if (list->Value(i) == entdad) return 1; - Standard_Integer stat = QueryParent ( entdad,list->Value(i) ); - if (stat >= 0) return stat+1; + Interface_EntityIterator iter; + if (!IsLoaded()) return iter; + const Interface_Graph& G = thegraph->Graph(); + Standard_Integer nb = G.Size(); + Standard_Integer i; + for ( i = 1; i <= nb; i ++) { + Standard_Integer stat = G.Status(i); + if ( (stat > 0 && newcount < 0) || stat == newcount) + iter.GetOneItem(G.Entity(i)); } - return -1; // not yet implemented ... + return iter; } -// ########################################################################### -// .... Dumps et Evaluations, pas faciles a passer en arguments .... -// #### #### #### #### #### #### #### #### #### -// .... DumpShare .... +// ################################################################ +// .... Actions particulieres sur les Selections .... //======================================================================= //function : //purpose : //======================================================================= -void IFSelect_WorkSession::SetParams - (const NCollection_Vector& params, - const NCollection_Vector& uselist) +Standard_Boolean IFSelect_WorkSession::IsReversedSelectExtract + (const Handle(IFSelect_Selection)& sel) const { - Standard_Integer i, nbp = params.Length(), nbu = uselist.Length(); - Handle(IFSelect_ParamEditor) editor = new IFSelect_ParamEditor - (nbp+nbu+50,"Parameter Editor"); - for (i = params.Lower(); i <= params.Upper(); i ++) { - DeclareAndCast(Interface_TypedValue,val,params.Value(i)); - if (val.IsNull()) continue; - editor->AddValue(val); - } - AddNamedItem("xst-params-edit",editor); -// Les EditForm - Handle(IFSelect_EditForm) paramsall = editor->Form(Standard_False); - AddNamedItem("xst-params-all",paramsall); - -// On attaque les EditForms partielles - TColStd_SequenceOfInteger listgen,listload,listsend,listsplit,listread,listwrite; - for (i = uselist.Lower(); i <= uselist.Upper(); i ++) { - Standard_Integer use = uselist.Value(i); - switch (use) { - case 1 : listgen.Append(i); break; - case 2 : listread.Append(i); break; - case 3 : listsend.Append(i); break; - case 4 : listsplit.Append(i); break; - case 5 : listread.Append(i); break; - case 6 : listwrite.Append(i); break; - default : break; - } - } - Handle(IFSelect_EditForm) paramsgen = new IFSelect_EditForm - (editor,listgen ,Standard_False,Standard_True,"General Parameters"); - if (listgen.Length() > 0) AddNamedItem("xst-params-general",paramsgen); - Handle(IFSelect_EditForm) paramsload = new IFSelect_EditForm - (editor,listload,Standard_False,Standard_True,"Loading Parameters"); - if (listload.Length() > 0) AddNamedItem("xst-params-load", paramsload); - Handle(IFSelect_EditForm) paramssend = new IFSelect_EditForm - (editor,listsend,Standard_False,Standard_True,"Sending Parameters"); - if (listsend.Length() > 0) AddNamedItem("xst-params-send", paramssend); - Handle(IFSelect_EditForm) paramsplit = new IFSelect_EditForm - (editor,listsplit,Standard_False,Standard_True,"Split Parameters"); - if (listsplit.Length() > 0) AddNamedItem("xst-params-split", paramsplit); - Handle(IFSelect_EditForm) paramsread = new IFSelect_EditForm - (editor,listread,Standard_False,Standard_True,"Read(Transfer) Parameters"); - if (listread.Length() > 0) AddNamedItem("xst-params-read", paramsread); - Handle(IFSelect_EditForm) paramswrite = new IFSelect_EditForm - (editor,listwrite,Standard_False,Standard_True,"Write(Transfer) Parameters"); - if (listwrite.Length() > 0) AddNamedItem("xst-params-write", paramswrite); + if (ItemIdent(sel) == 0) return Standard_False; + DeclareAndCast(IFSelect_SelectExtract,sxt,sel); + if (sxt.IsNull()) return Standard_False; + return (!sxt->IsDirect()); } @@ -2759,63 +851,14 @@ void IFSelect_WorkSession::SetParams //purpose : //======================================================================= -void IFSelect_WorkSession::TraceStatics - (const Standard_Integer use, const Standard_Integer mode) const +Standard_Boolean IFSelect_WorkSession::ToggleSelectExtract + (const Handle(IFSelect_Selection)& sel) { - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - if (use > 0) { - if (mode == 0) sout<<"******************************************"< 0) - if (use == 5) { - TraceStatics (-2,mode); - if (mode == 0) sout<GetTraceLevel()<Prefix(); - if (!str.IsNull()) sout << "Prefix : "<ToCString()<DefaultRootName(); - if (!str.IsNull()) sout << "Default Root : "<ToCString()<Extension(); - if (!str.IsNull()) sout << "Extension : "<ToCString()< 0) { - if (mode == 0) sout<<"******************************************"<SetDirect(!sxt->IsDirect()); + return Standard_True; } @@ -2824,137 +867,80 @@ void IFSelect_WorkSession::TraceStatics //purpose : //======================================================================= -void IFSelect_WorkSession::DumpShare () const +Standard_Boolean IFSelect_WorkSession::SetInputSelection + (const Handle(IFSelect_Selection)& sel, + const Handle(IFSelect_Selection)& inp) { - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - sout<<" ********** Definition ShareOut (Complete) **********"<Prefix(); - if (!str.IsNull()) sout << "Prefix : " << str->ToCString() << endl; - else sout << "Prefix not Defined" << endl; - str = theshareout->DefaultRootName(); - if (!str.IsNull()) sout << "Default Root : " << str->ToCString() << endl; - else sout << "Default Root not Defined" << endl; - str = theshareout->Extension(); - if (!str.IsNull()) sout << "Extension : " << str->ToCString() << endl; - else sout << "Extension not defined" << endl; - - Standard_Integer lr = theshareout->LastRun(); - Standard_Integer nb = theshareout->NbDispatches(); - sout << "Nb Dispatches : " << nb <<" (Last Run : " << lr << ") : "<Dispatch(i); - sout << "Dispatch n0 " << i; - if (HasName(disp)) sout << " Name:"<< Name(disp)->ToCString(); - sout << " Label:" << disp->Label() << endl; - Handle(IFSelect_Selection) sel = disp->FinalSelection(); - if (sel.IsNull()) sout << " No Final Selection Defined" << endl; - else if (HasName(sel)) sout << " Final Selection : Name:" - << Name(sel)->ToCString() << " Label:" << sel->Label() << endl; - else sout << " Final Selection : " << sel->Label() << endl; - if (disp->HasRootName()) - sout<<" File Root Name : "<RootName()->ToCString()<NbModifiers(Standard_True); - if (nbm > 0) sout<< - " *** "<NbModifiers(Standard_False); - if (nbf > 0) sout<< - " *** "<SetInput(inp); return Standard_True; } + DeclareAndCast(IFSelect_SelectDeduct,sdt,sel); + if (!sdt.IsNull()) { sdt->SetInput(inp); return Standard_True; } + return Standard_False; } -// #### #### #### #### #### #### #### #### #### -// .... ListItems .... //======================================================================= //function : //purpose : //======================================================================= -void IFSelect_WorkSession::ListItems (const Standard_CString lab) const +Standard_Boolean IFSelect_WorkSession::SetControl + (const Handle(IFSelect_Selection)& sel, + const Handle(IFSelect_Selection)& sc, + const Standard_Boolean formain) { - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - sout<< " ********** Items in Session **********"< item supprime - if (!str.IsNull()) { if (label->Location(str,1,label->Length()) == 0) continue; } - sout<<"#"<ToCString()<<" - "; - else sout<<" - (no name) - "; - sout<DynamicType()->Name()<ToCString()<SetMainInput (sc); + else dsel->SetSecondInput (sc); + return Standard_True; } -// #### #### #### #### #### #### #### #### #### -// .... ListModifiers //======================================================================= //function : //purpose : //======================================================================= -void IFSelect_WorkSession::ListFinalModifiers - (const Standard_Boolean formodel) const +Standard_Integer IFSelect_WorkSession::CombineAdd + (const Handle(IFSelect_Selection)& sel, + const Handle(IFSelect_Selection)& seladd, + const Standard_Integer atnum) { - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - Standard_Integer nb = theshareout->NbModifiers(formodel); - sout<< " ********** Modifiers in Session "; - sout<<(formodel ? "(For Model)" : "(For File)"); - sout<<": "<GeneralModifier(formodel,i); - if (!modif.IsNull()) sout<<"Modifier n0."<Label(); - if (HasName(modif)) sout << " Named as : " << Name(modif)->ToCString(); - sout<Add (seladd,atnum); + return csel->NbInputs(); } -// #### #### #### #### #### #### #### #### #### -// .... DumpSelection .... //======================================================================= //function : //purpose : //======================================================================= -void IFSelect_WorkSession::DumpSelection - (const Handle(IFSelect_Selection)& sel) const +Standard_Boolean IFSelect_WorkSession::CombineRemove + (const Handle(IFSelect_Selection)& selcomb, + const Handle(IFSelect_Selection)& selrem) { - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - if (ItemIdent(sel) == 0) { - sout << "Selection : Unknown"<ToCString(); - sout <<" **********"<Label() << " . Input(s) : "<< endl; - Standard_Integer nb = 0; - IFSelect_SelectionIterator iter; sel->FillIterator(iter); - for (; iter.More(); iter.Next()) { - nb ++; - Handle(IFSelect_Selection) newsel = iter.Value(); - sout<<" -- "<Label()<NbInputs(); + for (Standard_Integer i = nb; i > 0; i --) { + if (csel->Input(i) == selrem) { + csel->Remove(i); + return Standard_True; + } } - sout << " Nb Inputs:"< 0) list = GiveListFromList (&selname[nb+1],list); + + if (list.IsNull()) list = SelectionResult (sel); + else list = SelectionResultFromList (sel,list); + + return list; +} + + +//======================================================================= +//function : +//purpose : +//======================================================================= + +Standard_Integer IFSelect_WorkSession::QueryParent + (const Handle(Standard_Transient)& entdad, + const Handle(Standard_Transient)& entson) const +{ + Standard_Integer ndad = StartingNumber(entdad); + Standard_Integer nson = StartingNumber(entson); + if (ndad < 1 || nson < 1) return -1; + if (ndad == nson) return 0; +// on va calculer : pour chaque pere immediat, de , status avec + 1 +// nb : pas protege contre les boucles ... + Handle(TColStd_HSequenceOfTransient) list = + thegraph->Graph().Sharings(entson).Content(); + if (list.IsNull()) return -1; + Standard_Integer i, nb = list->Length(); + for (i = 1; i <= nb; i ++) { + if (list->Value(i) == entdad) return 1; + Standard_Integer stat = QueryParent ( entdad,list->Value(i) ); + if (stat >= 0) return stat+1; + } + return -1; // not yet implemented ... +} + + +//======================================================================= +//function : +//purpose : +//======================================================================= + +void IFSelect_WorkSession::TraceStatics + (const Standard_Integer use, const Standard_Integer mode) const +{ + Handle(Message_Messenger) sout = Message::DefaultMessenger(); + if (use > 0) { + if (mode == 0) sout<<"******************************************"< 0) + if (use == 5) { + TraceStatics (-2,mode); + if (mode == 0) sout< 0) { + if (mode == 0) sout<<"******************************************"< 0) list = GiveListFromList (&selname[nb+1],list); +// #### #### #### #### #### #### #### #### #### +// .... ListItems .... - if (list.IsNull()) list = SelectionResult (sel); - else list = SelectionResultFromList (sel,list); +//======================================================================= +//function : +//purpose : +//======================================================================= - return list; +void IFSelect_WorkSession::ListItems (const Standard_CString lab) const +{ + Handle(Message_Messenger) sout = Message::DefaultMessenger(); + sout<< " ********** Items in Session **********"< item supprime + if (!str.IsNull()) { if (label->Location(str,1,label->Length()) == 0) continue; } + sout<<"#"<ToCString()<<" - "; + else sout<<" - (no name) - "; + sout<DynamicType()->Name()<ToCString()< 0 l1|l2 (l1+l2) - TColStd_MapOfTransient numap; - Standard_Integer i,n = l2->Length(); - for (i = n; i > 0; i --) { - Handle(Standard_Transient) ent = l2->Value(i); - if (ent.IsNull()) continue; - numap.Add (ent); - if (mode > 0) list->Append(ent); + Handle(Message_Messenger) sout = Message::DefaultMessenger(); + if (ItemIdent(sel) == 0) { + sout << "Selection : Unknown"<Length(); - for (i = n; i > 0; i --) { - Handle(Standard_Transient) ent = l1->Value(i); - if (ent.IsNull()) continue; - - if (numap.Contains(ent)) { -// dans l1 et dans l2 - if (mode == 0) list->Append(ent); - } else { -// dans l1 mais pas dans l2 - if (mode != 0) list->Append(ent); - } + sout << " ********** Selection"; + if (HasName(sel)) sout << " , Name : " << Name(sel)->ToCString(); + sout <<" **********"<Label() << " . Input(s) : "<< endl; + Standard_Integer nb = 0; + IFSelect_SelectionIterator iter; sel->FillIterator(iter); + for (; iter.More(); iter.Next()) { + nb ++; + Handle(IFSelect_Selection) newsel = iter.Value(); + sout<<" -- "<Label()<Reverse(); - return list; + sout << " Nb Inputs:"< what could be determined is listed"< what could be determined is listed"<Number(ent); - if (num == 0) { S<<" *** Entity to Dump not in the Model ***"<DumpEntity (myModel,theprotocol,ent,S,level); -} - -// .... DumpEntity .... - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void IFSelect_WorkSession::TraceDumpEntity - (const Handle(Standard_Transient)& ent, const Standard_Integer level) const -{ - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - DumpEntity (ent,level,sout); } // .... PrintEntityStatus .... @@ -3384,211 +1407,10 @@ void IFSelect_WorkSession::PrintCheckList } } -// .... PrintSignatureList .... - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void IFSelect_WorkSession::PrintSignatureList - (const Handle(IFSelect_SignatureList)& signlist, - const IFSelect_PrintCount mode) const -{ - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - if (signlist.IsNull()) return; - signlist->PrintList (sout,myModel,mode); -} - -// #### #### #### #### #### #### #### #### #### -// .... EvaluateSelection .... - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void IFSelect_WorkSession::EvaluateSelection - (const Handle(IFSelect_Selection)& sel) const -{ - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - if (errhand) { - errhand = Standard_False; - try { - OCC_CATCH_SIGNALS - EvaluateSelection(sel); // appel normal (->code unique) - } - catch (Standard_Failure) { - sout<<" **** Interruption EvaluateSelection par Exception **** Intitule\n"; - sout<GetMessageString(); - sout<<"\n Abandon"<Label()<code unique) - } - catch (Standard_Failure) { - sout<<" **** Interruption EvaluateDispatch par Exception **** Intitule\n"; - sout<GetMessageString(); - sout<<"\n Abandon"<NbDispatches() < numdisp || numdisp <= 0) - { sout<<"Dispatch : Unknown"<FinalSelection().IsNull()) - { sout<<"Dispatch : No Final Selection"<Label()<Graph()); - eval.Evaluate(); - Standard_Integer numpack = 0; - Handle(IFSelect_PacketList) evres = - eval.Packets (mode ? Standard_True : Standard_False); - Standard_Integer nbpack = evres->NbPackets(); - - sout<<"Nb Packets produced : "<Entities(numpack), (mode ? 2 : -1)); - } - -//// Interface_EntityIterator iterem = disp->Remainder(thegraph->Graph()); - if (mode == 0) return; - if (mode == 1 || mode == 3) { - sout<NbDuplicated(0,Standard_False) == 0) - sout<<" **** All the Model is taken into account ****"<Duplicated(0,Standard_False),2); - } - } - if (mode >= 2) { - sout<<" **** Entites in more than one packet ****"; - Standard_Integer max = evres->HighestDuplicationCount(); - if (max < 2) sout<<" : There are none"<NbDuplicated(newcount,Standard_False) == 0) continue; - sout<<" **** Entities put in "<Duplicated(newcount,Standard_False),2); - } - } - } -} - - -// #### #### #### #### #### #### #### #### #### -// .... EvaluateComplete .... - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void IFSelect_WorkSession::EvaluateComplete - (const Standard_Integer mode) const -{ - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - if (errhand) { - errhand = Standard_False; - try { - OCC_CATCH_SIGNALS - EvaluateComplete(mode); // appel normal (donc, code pas duplique) - } - catch (Standard_Failure) { - sout<<" **** Interruption EvaluateComplete par Exception : ****\n"; - sout<GetMessageString(); - sout<<"\n Abandon"<Graph()); - eval.Evaluate(); - sout<<"\n******** Evaluation ShareOutResult (Complete) ********\n"; - sout<<" **** List of Packets **** Count : "<NbPackets(); - - sout<<"Nb Packets produced : "<Entities(numpack), (mode ? 2: -1)); - } - if (mode == 0) return; - if (mode == 1 || mode == 3) { - sout<NbDuplicated(0,Standard_False) == 0) - sout<<" **** All the Model is taken into account ****"<Duplicated(0,Standard_False),2); - } - } - if (mode >= 2) { - sout<<" **** Entites in more than one packet ****"<HighestDuplicationCount(); - if (max < 2) sout<<" : There are none"<NbDuplicated(newcount,Standard_False) == 0) continue; - sout<<" **** Entities put in "<Duplicated(newcount,Standard_False),2); - } - } - } -} +// ########################################## +// ######### Fonctions complementaires +// ########################################## // #### #### #### #### #### #### #### #### #### // .... Routine Interne : ListEntities @@ -3656,3 +1478,104 @@ void IFSelect_WorkSession::ListEntities sout<<"\n Abandon"<Messenger(); + const Standard_Integer level = myReaderProcess->TraceLevel(); + + //c1:if (myGraph.IsNull()) myTP->SetModel(myModel); + //c1:else myTP->SetGraph(myGraph); + + Standard_Integer i,nb = list->Length(); + + // Pour le log-file + if (level > 0) { + sout<<"\n*******************************************************************\n"; + sout << "****** Transferring a list of "<Add (list->Value(i), myModel->TypeName(list->Value(i),Standard_False)); + sl->SetName ("Entities to Transfer"); + sl->PrintCount (sout); + sout<<"\n*******************************************************************\n"; + } + + Standard_Integer res = 0; + + for (i = 1; i <= nb; i ++) + { + const Handle(Standard_Transient) &ent = list->Value(i); + + if (level > 1) { + const Standard_Integer num = myModel->Number(ent); + Handle(TCollection_HAsciiString) lab = myModel->StringLabel(ent); + sout<<"\n*******************************************************************\n"; + sout << "****** Transferring one Entity ******"<ToCString() + <Length())<<"******\n"; + sout<<"****** Type : "<TypeName(ent,Standard_False) + << Interface_MSG::Blanks((Standard_Integer) (44 - strlen(myModel->TypeName(ent,Standard_False)))) + << "******"; + sout<<"\n*******************************************************************\n"; + } + + res += myReaderProcess->TransferOne(ent); + } + return res; +} + + +//======================================================================= +//function : +//purpose : +//======================================================================= + +Standard_CString IFSelect_WorkSession::CategoryName (const Handle(Standard_Transient)& ent) const +{ + return Interface_Category::Name (CategoryNumber (ent)); +} + + +//======================================================================= +//function : +//purpose : +//======================================================================= + +Standard_CString IFSelect_WorkSession::ValidityName (const Handle(Standard_Transient)& ent) const +{ + return ((StartingNumber(ent) == 0)? "" : IFSelect_SignValidity::CVal (ent,myModel)); +} + + +//======================================================================= +//function : +//purpose : +//======================================================================= + +Interface_CheckIterator IFSelect_WorkSession::ModelCheckList () +{ + Interface_CheckIterator checks; + if (!IsLoaded()) { + checks.CCheck(0)->AddFail("DATA NOT AVAILABLE FOR CHECK"); + return checks; + } + Interface_CheckTool cht(Graph()); + checks = cht.CompleteCheckList(); + checks.SetName("Model Complete Check List"); + return checks; +} diff --git a/src/IFSelect/IFSelect_WorkSession.hxx b/src/IFSelect/IFSelect_WorkSession.hxx index d9765b45c8..25382b5d71 100644 --- a/src/IFSelect/IFSelect_WorkSession.hxx +++ b/src/IFSelect/IFSelect_WorkSession.hxx @@ -1,6 +1,6 @@ -// Created on: 1992-12-15 +// Created on: 1995-06-01 // Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1995-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. @@ -17,117 +17,38 @@ #ifndef _IFSelect_WorkSession_HeaderFile #define _IFSelect_WorkSession_HeaderFile -#include -#include +#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -class IFSelect_ShareOut; -class IFSelect_WorkLibrary; -class Interface_Protocol; -class Interface_InterfaceModel; -class Interface_HGraph; -class Interface_GTool; class Dico_DictionaryOfTransient; -class IFSelect_ModelCopier; -class Standard_DomainError; -class IFSelect_Signature; -class Standard_Transient; -class TCollection_HAsciiString; -class Interface_Graph; -class Interface_CheckIterator; +class Message_Messenger; class IFSelect_IntParam; -class TCollection_AsciiString; class IFSelect_Selection; -class Interface_EntityIterator; -class IFSelect_SelectionIterator; +class IFSelect_Signature; class IFSelect_SignCounter; -class IFSelect_Dispatch; -class IFSelect_GeneralModifier; -class IFSelect_Modifier; -class IFSelect_Transformer; -class IFSelect_PacketList; -class Message_Messenger; -class IFSelect_SignatureList; +class IFSelect_Vars; - -class IFSelect_WorkSession; -DEFINE_STANDARD_HANDLE(IFSelect_WorkSession, MMgt_TShared) - -//! This class can be used to simply manage a process such as -//! splitting a file, extracting a set of Entities ... -//! It allows to manage different types of Variables : Integer or -//! Text Parameters, Selections, Dispatches, in addition to a -//! ShareOut. To each of these variables, a unique Integer -//! Identifier is attached. A Name can be attached too as desired. -class IFSelect_WorkSession : public MMgt_TShared +//! This WorkSession is used in Draw +class IFSelect_WorkSession : public XSControl_WorkSession { + public: -public: + //! Default constructor + Standard_EXPORT IFSelect_WorkSession (); + //! Selects a Norm defined by its Controller itself + Standard_EXPORT virtual void SetController (const Handle(XSControl_Controller)& theCtl) Standard_OVERRIDE; //szv_c1: made virtual - //! Creates a Work Session - //! It provides default, empty ShareOut and ModelCopier, which can - //! be replaced (if required, should be done just after creation). - Standard_EXPORT IFSelect_WorkSession(); - - //! Changes the Error Handler status (by default, it is not set) - Standard_EXPORT void SetErrorHandle (const Standard_Boolean toHandle); - - //! Returns the Error Handler status - Standard_Boolean ErrorHandle() const - { return theerrhand; } - - //! Returns the ShareOut defined at creation time - const Handle(IFSelect_ShareOut) & ShareOut() const - { return theshareout; } - - //! Sets a new ShareOut. Fills Items which its content - //! Warning : data from the former ShareOut are lost - Standard_EXPORT void SetShareOut (const Handle(IFSelect_ShareOut)& shareout); - - //! Set value of mode responsible for precence of selections after loading - //! If mode set to true that different selections will be accessible after loading - //! else selections will be not accessible after loading( for economy memory in applicatios) - void SetModeStat (const Standard_Boolean theMode) - { themodelstat = theMode; } - - //! Return value of mode defining of filling selection during loading - Standard_Boolean GetModeStat() const - { return themodelstat; } - - //! Sets a WorkLibrary, which will be used to Read and Write Files - void SetLibrary (const Handle(IFSelect_WorkLibrary) &theLib) - { thelibrary = theLib; } - - //! Returns the WorkLibrary. Null Handle if not yet set - //! should be C++ : return const & - const Handle(IFSelect_WorkLibrary) & WorkLibrary() const - { return thelibrary; } - - //! Sets a Protocol, which will be used to determine Graphs, to - //! Read and to Write Files - Standard_EXPORT void SetProtocol (const Handle(Interface_Protocol)& protocol); - - //! Returns the Protocol. Null Handle if not yet set - //! should be C++ : return const & - const Handle(Interface_Protocol) & Protocol() const - { return theprotocol; } + //! Clears recorded data (not the items) according mode : + //! 1 : all Data : Model, Graph, CheckList, + ClearData 4 + //! 2 : Graph and CheckList (they will then be recomputed later) + //! 3 : CheckList (it will be recomputed by ComputeCheck) + //! 4 : just content of SelectPointed and Counters + //! Plus 0 : does nothing but called by SetModel + //! ClearData is virtual, hence it can be redefined to clear + //! other data of a specialised Work Session + Standard_EXPORT virtual void ClearData (const Standard_Integer mode) Standard_OVERRIDE; //! Sets a specific Signature to be the SignType, i.e. the //! Signature which will determine TypeName from the Model @@ -138,39 +59,6 @@ public: //! Returns the current SignType Standard_EXPORT Handle(IFSelect_Signature) SignType() const; - //! Returns True is a Model has been set - Standard_Boolean HasModel() const - { return (!myModel.IsNull()); } - - //! Sets a Model as input : this will be the Model from which the - //! ShareOut will work - //! if is True (default) all SelectPointed items - //! are cleared, else they must be managed by the caller - //! Remark : SetModel clears the Graph, recomputes it if a - //! Protocol is set and if the Model is not empty, of course - Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& model, const Standard_Boolean clearpointed = Standard_True); - - //! Returns the Model of the Work Session (Null Handle if none) - //! should be C++ : return const & - const Handle(Interface_InterfaceModel) & Model () const - { return myModel; } - - //! Stores the filename used for read for setting the model - //! It is cleared by SetModel and ClearData(1) - void SetLoadedFile (const Standard_CString theFileName) - { theloaded = theFileName; } - - //! Returns the filename used to load current model - //! empty if unknown - Standard_CString LoadedFile() const - { return theloaded.ToCString(); } - - //! Reads a file with the WorkLibrary (sets Model and LoadedFile) - //! Returns a integer status which can be : - //! RetDone if OK, RetVoid if no Protocol not defined, - //! RetError for file not found, RetFail if fail during read - Standard_EXPORT IFSelect_ReturnStatus ReadFile (const Standard_CString filename); - //! Returns the count of Entities stored in the Model, or 0 Standard_EXPORT Standard_Integer NbStartingEntities() const; @@ -193,11 +81,6 @@ public: //! If just gives an integer value, returns it Standard_EXPORT Standard_Integer NumberFromLabel (const Standard_CString val, const Standard_Integer afternum = 0) const; - //! Returns the label for , as the Model does - //! If is not in the Model or if no Model is loaded, a Null - //! Handle is returned - Standard_EXPORT Handle(TCollection_HAsciiString) EntityLabel (const Handle(Standard_Transient)& ent) const; - //! Returns the Name of an Entity //! This Name is computed by the general service Name //! Returns a Null Handle if fails @@ -208,42 +91,6 @@ public: //! An unknown entity (number 0) gives a value -1 Standard_EXPORT Standard_Integer CategoryNumber (const Handle(Standard_Transient)& ent) const; - //! Returns the Category Name determined for an entity - //! it is computed by the class Category - //! Remark : an unknown entity gives an empty string - Standard_EXPORT Standard_CString CategoryName (const Handle(Standard_Transient)& ent) const; - - //! Returns the Validity Name determined for an entity - //! it is computed by the class SignValidity - //! Remark : an unknown entity gives an empty string - Standard_EXPORT Standard_CString ValidityName (const Handle(Standard_Transient)& ent) const; - - //! Clears recorded data (not the items) according mode : - //! 1 : all Data : Model, Graph, CheckList, + ClearData 4 - //! 2 : Graph and CheckList (they will then be recomputed later) - //! 3 : CheckList (it will be recomputed by ComputeCheck) - //! 4 : just content of SelectPointed and Counters - //! Plus 0 : does nothing but called by SetModel - //! ClearData is virtual, hence it can be redefined to clear - //! other data of a specialised Work Session - Standard_EXPORT virtual void ClearData (const Standard_Integer mode); - - //! Computes the Graph used for Selections, Displays ... - //! If a HGraph is already set, with same model as given by method - //! Model, does nothing. Else, computes a new Graph. - //! If is given True, computes a new Graph anyway. - //! Remark that a call to ClearGraph will cause ComputeGraph to - //! really compute a new Graph - //! Returns True if Graph is OK, False else (i.e. if no Protocol - //! is set, or if Model is absent or empty). - Standard_EXPORT Standard_Boolean ComputeGraph (const Standard_Boolean enforce = Standard_False); - - //! Returns the Computed Graph as HGraph (Null Handle if not set) - Standard_EXPORT Handle(Interface_HGraph) HGraph(); - - //! Returns the Computed Graph, for Read only - Standard_EXPORT const Interface_Graph& Graph(); - //! Returns the list of entities shared by (can be empty) //! Returns a null Handle if is unknown Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Shareds (const Handle(Standard_Transient)& ent); @@ -252,26 +99,6 @@ public: //! Returns a null Handle if is unknown Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Sharings (const Handle(Standard_Transient)& ent); - //! Returns True if a Model is defined and really loaded (not - //! empty), a Protocol is set and a Graph has been computed. - //! In this case, the WorkSession can start to work - Standard_EXPORT Standard_Boolean IsLoaded() const; - - //! Computes the CheckList for the Model currently loaded - //! It can then be used for displays, querries ... - //! Returns True if OK, False else (i.e. no Protocol set, or Model - //! absent). If is False, works only if not already done - //! or if a new Model has been loaded from last call. - //! Remark : computation is enforced by every call to - //! SetModel or RunTransformer - Standard_EXPORT Standard_Boolean ComputeCheck (const Standard_Boolean enforce = Standard_False); - - //! Returns the Check List for the Model currently loaded : - //! = True : complete (syntactic & semantic messages), - //! computed if not yet done - //! = False : only syntactic (check file form) - Standard_EXPORT Interface_CheckIterator ModelCheckList (const Standard_Boolean complete = Standard_True); - //! Returns a Check for a single entity, under the form of a //! CheckIterator (this gives only one form for the user) //! if is Null or equates the current Model, it gives the @@ -279,14 +106,49 @@ public: //! as for ModelCheckList Standard_EXPORT Interface_CheckIterator CheckOne (const Handle(Standard_Transient)& ent, const Standard_Boolean complete = Standard_True); - //! Returns the Check List produced by the last execution of - //! either : EvaluateFile(for Split), SendSplit, SendAll, - //! SendSelected, RunTransformer-RunModifier - //! Cleared by SetModel or ClearData(1) - //! The field is protected, hence a specialized WorkSession may - //! fill it - Interface_CheckIterator LastRunCheckList() const - { return thecheckrun; } + //! Returns True if an Item of the WorkSession has an attached Name + Standard_EXPORT Standard_Boolean HasName (const Handle(Standard_Transient)& item) const; + + //! Returns the Name attached to an Item as a Variable of this + //! WorkSession. If is Null or not recorded, returns an + //! empty string. + Standard_EXPORT Handle(TCollection_HAsciiString) Name (const Handle(Standard_Transient)& item) const; + + //! Adds an Item and returns its attached Ident. Does nothing + //! if is already recorded (and returns its attached Ident) + //! Remark : the determined Ident is used if is a Dispatch, + //! to fill the ShareOut + Standard_EXPORT Standard_Integer AddItem (const Handle(Standard_Transient)& item); + + //! Adds an Item with an attached Name. If the Name is already + //! known in the WorkSession, the older item losts it + //! Returns Ident if Done, 0 else, i.e. if is null + //! If is empty, works as AddItem (i.e. with no name) + //! If is already known but with no attached Name, this + //! method tries to attached a Name to it + Standard_EXPORT Standard_Integer AddNamedItem (const Standard_CString name, const Handle(Standard_Transient)& item); + + //! Removes an Item given its Ident. Returns False if is + //! attached to no Item in the WorkSession. For a Named Item, + //! also removes its Name. + Standard_EXPORT Standard_Boolean RemoveItem (const Handle(Standard_Transient)& item); + + //! For query by Label with possible iterations + //! Searches the Ident of which Item has a Label which matches a + //! given one, the search starts from an initial Ident. + //! Returns the first found Ident which follows , or ZERO + //! + //! The search must start with = 0, it returns the next Ident + //! which matches. To iterate, call again this method which this + //! returned value as . Once an Ident has been returned, the + //! Item can be obtained by the method Item + //! + //! precises the required matching mode : + //! - 0 (Default) :