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
t TKXDEIGES
t TKXDESTEP
t TKXSBase
+t TKXSSelect
t TKXmlXCAF
n BOPTest
n BRepTest
== 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
~~~~~
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.
~~~~~
Converts the specified shapes into IGES entities and puts them into the *InterfaceModel*.
-~~~~~
-Draw> writeall <filename.igs>
-~~~~~
-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
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.
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)*.
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.
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.
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.
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.
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)*.
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*.
~~~~~
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...
// 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
#include <IGESControl_Reader.hxx>
#include <IGESControl_Controller.hxx>
#include <IGESControl_Writer.hxx>
-#include <IFSelect_ReturnStatus.hxx>
+#include <Interface_ReturnStatus.hxx>
#include <Interface_Static.hxx>
//step I/E
#include <STEPControl_Reader.hxx>
{
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 );
IGESControl_Reader aReader;
int aStatus = aReader.ReadFile( aFileName );
- if ( aStatus == IFSelect_RetDone )
+ if ( aStatus == Interface_RetDone )
{
aReader.TransferRoots();
TopoDS_Shape aShape = aReader.OneShape();
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() )
{
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;
}
#include <IGESControl_Reader.hxx>
#include <IGESControl_Controller.hxx>
#include <IGESControl_Writer.hxx>
-#include <IFSelect_ReturnStatus.hxx>
+#include <Interface_ReturnStatus.hxx>
#include <Interface_Static.hxx>
//step I/E
#include <STEPControl_Reader.hxx>
bool ImportStep (char* theFileName)
{
STEPControl_Reader aReader;
- if (aReader.ReadFile (theFileName) != IFSelect_RetDone)
+ if (aReader.ReadFile (theFileName) != Interface_RetDone)
{
return false;
}
bool ImportIges (char* theFileName)
{
IGESControl_Reader aReader;
- if (aReader.ReadFile (theFileName) != IFSelect_RetDone)
+ if (aReader.ReadFile (theFileName) != Interface_RetDone)
{
return false;
}
}
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;
}
/// <summary>
//! 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());
return aShape;
}
- if (aReadStatus != IFSelect_RetDone)
+ if (aReadStatus != Interface_RetDone)
{
Message::DefaultMessenger()->Send ("Error: IGES reader, bad file format", Message_Fail);
return aShape;
//! 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());
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();
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);
}
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);
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;
}
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
// 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));
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);
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;
}
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 */ )
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;
#endif // _MSC_VER >= 1000
#include <Storage_Error.hxx>
-#include <IFSelect_ReturnStatus.hxx>
+#include <Interface_ReturnStatus.hxx>
#include <STEPControl_StepModelType.hxx>
#include <Quantity_HArray1OfColor.hxx>
#include <TColStd_HArray1OfReal.hxx>
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,
IGESControl_Reader Reader;
int status = Reader.ReadFile(aFilePath.ToCString() );
- if ( status == IFSelect_RetDone )
+ if ( status == Interface_RetDone )
{
aSequence = new TopTools_HSequenceOfShape();
Reader.TransferRoots();
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;
if ( type < 0 )
return false;
- IFSelect_ReturnStatus status;
+ Interface_ReturnStatus status;
if ( type == STEPControl_FacetedBrep && !checkFacetedBrep( shapes ) )
{
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;
}
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 )
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;
}
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:
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();
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:
-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
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
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
+++ /dev/null
-// 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 <Dico_DictionaryOfInteger.hxx>
-#include <Dico_IteratorOfDictionaryOfInteger.hxx>
-#include <IFSelect_Activator.hxx>
-#include <IFSelect_SessionPilot.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_DomainError.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-#include <TColStd_SequenceOfInteger.hxx>
-#include <TColStd_SequenceOfTransient.hxx>
-
-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 "<<command<<" first defined remains ****"<<endl;
-// Standard_DomainError::Raise("IFSelect_Activator : Add");
-#endif
- }
- num = thenums.Length() + 1;
- thenums.Append(number);
- theacts.Append(actor);
- themodes.Append(mode);
-}
-
- void IFSelect_Activator::Add
- (const Standard_Integer number, const Standard_CString command) const
- { Adding (this,number,command,0); }
-
- void IFSelect_Activator::AddSet
- (const Standard_Integer number, const Standard_CString command) const
- { Adding (this,number,command,1); }
-
- void IFSelect_Activator::Remove (const Standard_CString command)
- { thedico->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(); }
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <MMgt_TShared.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_CString.hxx>
-#include <Standard_Boolean.hxx>
-#include <TColStd_HSequenceOfAsciiString.hxx>
-#include <IFSelect_ReturnStatus.hxx>
-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
- //! <mode> 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.
- //! <mode> : -1 (D) for all commands if <commands> 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. <number> 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
+++ /dev/null
-// 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 <IFSelect_AppliedModifiers.hxx>
-#include <IFSelect_GeneralModifier.hxx>
-#include <Standard_Type.hxx>
-
-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); }
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SequenceOfGeneralModifier.hxx>
-#include <Interface_IntList.hxx>
-#include <Standard_Integer.hxx>
-#include <MMgt_TShared.hxx>
-#include <Standard_Boolean.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-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 <nbmax>
- //! modifiers, on a model of <nbent> 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 <num> :
- //! 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 <entcount>
- //! Returns True if OK, False if <num> 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 <nument> itself, to give all the entities of the file
- //! Returns 0 if <nument> 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, <entcount> 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
+++ /dev/null
-// 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 <IFSelect_BasicDumper.hxx>
-#include <IFSelect_DispGlobal.hxx>
-#include <IFSelect_DispPerCount.hxx>
-#include <IFSelect_DispPerOne.hxx>
-#include <IFSelect_IntParam.hxx>
-#include <IFSelect_Modifier.hxx>
-#include <IFSelect_SelectDiff.hxx>
-#include <IFSelect_SelectEntityNumber.hxx>
-#include <IFSelect_SelectErrorEntities.hxx>
-#include <IFSelect_SelectIncorrectEntities.hxx>
-#include <IFSelect_SelectIntersection.hxx>
-#include <IFSelect_SelectModelEntities.hxx>
-#include <IFSelect_SelectModelRoots.hxx>
-#include <IFSelect_SelectPointed.hxx>
-#include <IFSelect_SelectRange.hxx>
-#include <IFSelect_SelectRootComps.hxx>
-#include <IFSelect_SelectRoots.hxx>
-#include <IFSelect_SelectShared.hxx>
-#include <IFSelect_SelectSharing.hxx>
-#include <IFSelect_SelectUnion.hxx>
-#include <IFSelect_SelectUnknownEntities.hxx>
-#include <IFSelect_SessionFile.hxx>
-#include <IFSelect_ShareOut.hxx>
-#include <IFSelect_TransformStandard.hxx>
-#include <IFSelect_WorkSession.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_BasicDumper,IFSelect_SessionDumper)
-
-//#include <IFSelect_SelectTextType.hxx>
-#define FIRSTCHAR 1
-// Param litteral "own" sous la forme :"<val>" -> first = 3
-// A present, forme simplifiee : <val> 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;
-}
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SessionDumper.hxx>
-#include <Standard_Boolean.hxx>
-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 <item> 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 <item> 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
+++ /dev/null
-// 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 <IFSelect_ContextModif.hxx>
-#include <IFSelect_GeneralModifier.hxx>
-#include <IFSelect_Selection.hxx>
-#include <Interface_Check.hxx>
-#include <Interface_CheckIterator.hxx>
-#include <Interface_CopyControl.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Protocol.hxx>
-#include <Message.hxx>
-#include <Message_Messenger.hxx>
-#include <Standard_NoSuchObject.hxx>
-#include <Standard_Transient.hxx>
-
-//=======================================================================
-//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:"<<sel->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 ("<<nb<<" Entities)"<<endl;
- else sout<<" Entities,Total:"<<nb<<" Concerned:"<<ne<<endl;
-}
-
-
-//=======================================================================
-//function : Trace
-//purpose :
-//=======================================================================
-
-void IFSelect_ContextModif::Trace (const Standard_CString mess)
-{
-// Trace courante
- if (thecurr <= 0) return;
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (ValueOriginal() == ValueResult())
- sout<<"-- ContextModif. Entity n0 "<<thecurr<<endl;
- else
- sout<<"-- ContextModif. Entity in Original, n0 "<<thecurr<<" in Result, n0 "
- <<thecurt<<endl;
- if (mess[0] != '\0') sout<<"-- Message:"<<mess<<endl;
-}
-
-
-//=======================================================================
-//function : AddCheck
-//purpose :
-//=======================================================================
-
-void IFSelect_ContextModif::AddCheck(const Handle(Interface_Check)& check)
-{
- if (check->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;
-}
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Interface_Graph.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <Interface_CheckIterator.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_CString.hxx>
-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 <res>. 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
- //! <mess> 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 <start> 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 <start> 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
+++ /dev/null
-// 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 <IFSelect_AppliedModifiers.hxx>
-#include <IFSelect_ContextWrite.hxx>
-#include <IFSelect_GeneralModifier.hxx>
-#include <Interface_Check.hxx>
-#include <Interface_CheckIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_HGraph.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Protocol.hxx>
-#include <Standard_NoSuchObject.hxx>
-#include <Standard_Transient.hxx>
-
-//=======================================================================
-//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;
-}
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <Interface_CheckIterator.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_CString.hxx>
-#include <Standard_Boolean.hxx>
-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 <numod>
- //! Then, it prepares the list of entities to consider, if any
- //! Returns False if <numod> 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 <start> 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 <start> 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
+++ /dev/null
-// 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 <IFGraph_SubPartsIterator.hxx>
-#include <IFSelect_DispGlobal.hxx>
-#include <IFSelect_Selection.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-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));
-}
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Dispatch.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-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
+++ /dev/null
-// 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 <IFGraph_SCRoots.hxx>
-#include <IFGraph_SubPartsIterator.hxx>
-#include <IFSelect_DispPerCount.hxx>
-#include <IFSelect_IntParam.hxx>
-#include <IFSelect_Selection.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceError.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-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 <count> racines
-// Donc, il faut iterer sur les Parts de roots et les prendre par <count>
-
- 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());
- }
-}
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Dispatch.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Boolean.hxx>
-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 <count> Input Entities"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
- //! Returns True, maximum count is given as <nbent>
- 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 <Count> 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
+++ /dev/null
-// 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 <IFGraph_SCRoots.hxx>
-#include <IFGraph_SubPartsIterator.hxx>
-#include <IFSelect_DispPerFiles.hxx>
-#include <IFSelect_IntParam.hxx>
-#include <IFSelect_Selection.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceError.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-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 <count> racines
-// Donc, il faut iterer sur les Parts de roots et les prendre par <count>
- 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());
- }
-}
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Dispatch.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Boolean.hxx>
-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 <count> 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 <Count> 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
+++ /dev/null
-// 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 <IFGraph_SCRoots.hxx>
-#include <IFGraph_SubPartsIterator.hxx>
-#include <IFSelect_DispPerOne.hxx>
-#include <IFSelect_Selection.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-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);
-}
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Dispatch.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-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 <nbent>
- 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
+++ /dev/null
-// 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 <IFGraph_SubPartsIterator.hxx>
-#include <IFSelect_DispPerSignature.hxx>
-#include <IFSelect_Selection.hxx>
-#include <IFSelect_SignCounter.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceError.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-#include <TColStd_HSequenceOfHAsciiString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-
-#include <stdio.h>
-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);
- }
-}
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Dispatch.hxx>
-#include <Standard_CString.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-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 <name>"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
- //! Returns True, maximum count is given as <nbent>
- 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
+++ /dev/null
-// 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 <IFGraph_Compare.hxx>
-#include <IFGraph_SubPartsIterator.hxx>
-#include <IFSelect_Dispatch.hxx>
-#include <IFSelect_Selection.hxx>
-#include <IFSelect_SelectionIterator.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceError.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-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
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <MMgt_TShared.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-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 : <nbent>.
- //! If answer is False, no limited maximum is expected for account
- //! If answer is True, expected maximum is given in argument <max>
- //! 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 <pack>.
- //! 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
+++ /dev/null
-// 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 <IFSelect_EditForm.hxx>
-#include <IFSelect_Editor.hxx>
-#include <IFSelect_ListEditor.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_MSG.hxx>
-#include <Interface_TypedValue.hxx>
-#include <Message.hxx>
-#include <Message_Messenger.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_HAsciiString.hxx>
-#include <TColStd_HSequenceOfHAsciiString.hxx>
-
-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 : "<<Label()<<endl;
- if (IsComplete()) S<<"Complete, "<<nbv<<" Values"<<endl;
- else {
- S<<"Extraction on "<<nbv<<" Values : (extracted<-editor)"<<endl;
- for (iv = 1; iv <= nbv; iv ++) S<<" "<<iv<<"<-"<<NumberFromRank(iv);
- S<<endl;
- }
- S<<"*****"<<endl;
-}
-
-
-static void PrintList
- (const Handle(TColStd_HSequenceOfHAsciiString)& list,
- const Handle(Message_Messenger)& S, const Standard_Boolean alsolist)
-{
- if (list.IsNull()) { S<<"(NULL LIST)"<<endl; return; }
-
- Standard_Integer i,nb = list->Length();
- S<<"(List : "<<nb<<" Items)"<<endl;
- if (!alsolist) return;
-
- for (i = 1; i <= nb; i ++) {
- Handle(TCollection_HAsciiString) str = list->Value(i);
- S<<" ["<<i<<"] "<< (str.IsNull() ? "(NULL)" : str->ToCString())<<endl;
- }
-}
-
- void IFSelect_EditForm::PrintValues
- (const Handle(Message_Messenger)& S, const Standard_Integer what,
- const Standard_Boolean names, const Standard_Boolean alsolist) const
-{
- Standard_Integer iv, nbv = NbValues(Standard_True);
- S<< "****************************************************"<<endl;
- S<<"***** "<<Label()<<Interface_MSG::Blanks(Label(),40)<<"*****"<<endl;
- S<<"***** *****"<<endl;
- if (!theloaded)
- S<<"***** Values are NOT loaded *****"<<endl;
-
- else {
-// Donnees sur lesquelles on a travaille
- if (themodel.IsNull()) {
- if (theent.IsNull()) S<<"***** No loaded data";
- else S<<"***** No loaded Model. Loaded object : type "<<theent->DynamicType()->Name();
- } else {
- if (theent.IsNull()) S<<"***** No loaded entity";
- else { S<<"***** Loaded entity : "; themodel->PrintLabel (theent,S); }
- }
- }
- S<<endl<<"****************************************************"<<endl<<endl;
-
-// Affichage des valeurs
- Standard_Boolean nams = names;
- Standard_Integer maxnam = theeditor->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"<<endl;
- else S<<" N0 Name Value"<<endl;
-
- for (iv = 1; iv <= nbv; iv ++) {
- Standard_Integer jv = NumberFromRank(iv);
- Standard_CString name = theeditor->Name(jv,!nams);
-
-// Original ou Final
- if (what != 0) {
- Handle(TCollection_HAsciiString) str;
- if (IsModified(jv)) S<<"* ";
- else S<<" ";
- S <<Interface_MSG::Blanks(iv,3)<<iv<<" "
- <<name<<Interface_MSG::Blanks(name,maxnam)<<" ";
-
- if (theeditor->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()) <<endl;
-
-// Modified only
- } else {
- if (!IsModified(jv)) continue;
- nbmod ++;
- if (theeditor->IsList(jv)) {
- Handle(TColStd_HSequenceOfHAsciiString) list= OriginalList (jv);
- S <<Interface_MSG::Blanks(iv,3)<<iv<<" "
- <<name<<Interface_MSG::Blanks(name,maxnam)<<" ORIG:";
- PrintList (list,S,alsolist);
-
- list = EditedList (jv);
- S<<Interface_MSG::Blanks("",maxnam+5)<<"MOD :";
- PrintList (list,S,alsolist);
-
- continue;
- }
-
- Handle(TCollection_HAsciiString) str = OriginalValue (jv);
- S <<Interface_MSG::Blanks(iv,3)<<iv<<" "
- <<name<<Interface_MSG::Blanks(name,maxnam)<<" ORIG:"
- << (str.IsNull() ? "(NULL)" : str->ToCString()) <<endl;
- str = EditedValue (jv);
- S<<Interface_MSG::Blanks("",maxnam+4)<<" MOD :"<< (str.IsNull() ? "(NULL)" : str->ToCString()) <<endl;
- }
- }
- if (what == 0) S<<"On "<<nbv<<" Values, "<<nbmod<<" Modified"<<endl;
-}
-
-
- Standard_Boolean IFSelect_EditForm::Apply ()
-{
- Standard_Boolean stat = ApplyData(theent,themodel);
- if (stat && !thekeepst) ClearEdit();
- return stat;
-}
-
-
- Standard_Boolean IFSelect_EditForm::Recognize () const
- { return theeditor->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 ();
-}
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Boolean.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-#include <TColStd_Array1OfTransient.hxx>
-#include <Standard_Integer.hxx>
-#include <MMgt_TShared.hxx>
-#include <Standard_CString.hxx>
-#include <TColStd_SequenceOfInteger.hxx>
-#include <TColStd_HSequenceOfHAsciiString.hxx>
-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 <num>) 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 <nums>
- //! 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
- //! <editable> 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
- //! <editable> 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 <rank> 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 <number> 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 <ent> and/or <model> 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 <model> 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 <ent> and <model> 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 <num> 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
- //! <num> 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
- //! <num> 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)
- //! <num> 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 <num> of the EditForm, if
- //! it is a single parameter (for a list, just returns False)
- //! Null means to Remove it
- //! <enforce> 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 <num>
- //! 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 <num> 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 <num> 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
- //! <names> True : prints Long Names; False : prints Short Names
- //! <what> < 0 : prints Original Values (+ flag Modified)
- //! <what> > 0 : prints Final Values (+flag Modified)
- //! <what> = 0 : prints Modified Values (Original + Edited)
- //! <alsolist> False (D) : lists are printed only as their count
- //! <alsolist> 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
+++ /dev/null
-// 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
+++ /dev/null
-// 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 <Dico_DictionaryOfInteger.hxx>
-#include <IFSelect_EditForm.hxx>
-#include <IFSelect_Editor.hxx>
-#include <IFSelect_ListEditor.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_MSG.hxx>
-#include <Interface_TypedValue.hxx>
-#include <Message_Messenger.hxx>
-#include <Standard_OutOfRange.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-#include <string.h>
-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 : "<<Label()<<endl;
- S<<"**** Nb Values = "<<nb<<" **** Names / Labels"<<endl;
- S<<" Num ";
- if (themaxsh > 0) S<<"Short"<<Interface_MSG::Blanks("Short",themaxsh)<<" ";
- S<<"Complete"<<Interface_MSG::Blanks("Complete",themaxco)<<" Label"<<endl;
-
- for (i = 1; i <= nb; i ++) {
- Handle(Interface_TypedValue) tv = TypedValue(i);
- if (tv.IsNull()) continue;
- S<<Interface_MSG::Blanks(i,3)<<i<<" ";
- if (themaxsh > 0) {
- const TCollection_AsciiString& sho = theshorts(i);
- S<<sho<<Interface_MSG::Blanks(sho.ToCString(),themaxsh)<<" ";
- }
- S<<tv->Name()<<Interface_MSG::Blanks(tv->Name(),themaxco)<<" "<<tv->Label()<<endl;
- }
-}
-
- void IFSelect_Editor::PrintDefs
- (const Handle(Message_Messenger)& S, const Standard_Boolean labels) const
-{
- Standard_Integer i, nb = NbValues();
- S<<"**** Editor : "<<Label()<<endl;
- S<<"**** Nb Values = "<<nb<<" **** "<<(labels ? "Labels" : "Names")<<" / Definitions"<<endl;
- S<<" Num ";
- if (labels) S<<"Label"<<Interface_MSG::Blanks("Label",themaxla);
- else {
- if (themaxsh > 0) S<<"Short"<<Interface_MSG::Blanks("Short",themaxsh+1);
- S<<"Complete"<<Interface_MSG::Blanks("Complete",themaxco);
- }
- S<<" Edit Mode & Definition"<<endl;
-
- for (i = 1; i <= nb; i ++) {
- Handle(Interface_TypedValue) tv = TypedValue(i);
- if (tv.IsNull()) continue;
- S<<" "<<Interface_MSG::Blanks(i,3)<<i<<" ";
- if (labels) S<<tv->Label()<<Interface_MSG::Blanks(tv->Label(),themaxla);
- else {
- if (themaxsh > 0) {
- const TCollection_AsciiString& sho = theshorts(i);
- S<<sho<<Interface_MSG::Blanks(sho.ToCString(),themaxsh)<<" ";
- }
- S<<tv->Name()<<Interface_MSG::Blanks(tv->Name(),themaxco);
- }
-
- S<<" ";
- Standard_Integer maxls = MaxList (i);
- if (maxls == 0) S<<" (List) ";
- else if (maxls > 0) S<<" (List <= "<<maxls<<" Items) ";
- else S<<" ";
- IFSelect_EditValue edm = EditMode (i);
- switch (edm) {
- case IFSelect_Optional : S<<"Optional "; break;
- case IFSelect_Editable : S<<"Editable "; break;
- case IFSelect_EditProtected : S<<"Protected"; break;
- case IFSelect_EditComputed : S<<"Computed "; break;
- case IFSelect_EditRead : S<<"ReadOnly "; break;
- case IFSelect_EditDynamic : S<<"Dynamic "; break;
- default : S<<"?????????"; break;
- }
-
- S<<" "<<tv->Definition()<<endl;
- }
-}
-
-
- Standard_Integer IFSelect_Editor::MaxNameLength
- (const Standard_Integer what) const
-{
- if (what == -1) return themaxsh;
- if (what == 0) return themaxco;
- if (what == 1) return themaxla;
- return 0;
-}
-
-
- Standard_Integer IFSelect_Editor::NameNumber
- (const Standard_CString name) const
-{
- Standard_Integer res;
- if (thenames->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; }
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Integer.hxx>
-#include <TColStd_Array1OfTransient.hxx>
-#include <TColStd_Array1OfAsciiString.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-#include <MMgt_TShared.hxx>
-#include <Standard_CString.hxx>
-#include <IFSelect_EditValue.hxx>
-#include <Standard_Boolean.hxx>
-#include <TColStd_HSequenceOfHAsciiString.hxx>
-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 <max> 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 :
- //! <what> = -1 : length of short names
- //! <what> = 0 : length of complete names
- //! <what> = 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 <num> 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: <ent> may be Null, this means all <model> is concerned
- //! Also <model> may be Null, if no context applies for <ent>
- //! And both <ent> and <model> 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)
- //! <num> is the rank of the parameter for the EDITOR itself
- //! <enforce> 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: <ent> may be Null, this means all <model> is concerned
- //! Also <model> may be Null, if no context applies for <ent>
- //! And both <ent> and <model> 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
+++ /dev/null
-// 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 <IFSelect_Dispatch.hxx>
-#include <IFSelect_GeneralModifier.hxx>
-#include <IFSelect_Selection.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-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; }
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Boolean.hxx>
-#include <MMgt_TShared.hxx>
-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 <disp> 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 <disp>
- //! is to be treated (apart from the Selection criterium)
- //! If Dispatch(me) is Null, returns True. Else, checks <disp>
- 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")
- //! <maychangegraph> 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
+++ /dev/null
-// 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 <IFSelect_ListEditor.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_TypedValue.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-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); }
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Integer.hxx>
-#include <TColStd_HSequenceOfHAsciiString.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-#include <MMgt_TShared.hxx>
-#include <Standard_Boolean.hxx>
-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 <def>, and <max> describes max length :
- //! 0 (D) means no limit
- //! value > 0 means : no more the <max> 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 <num> (in edited list)
- //! <val> may be a Null Handle, then the value will be cleared but
- //! not removed
- //! Returns True when done. False if <num> is out of range or if
- //! <val> 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 <num>, if positive
- //! Returns True when done. False if MaxLength may be overpassed
- //! or if <val> 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 <howmany>
- //! Remove from rank <num> included. By default, from the end
- //! Returns True when done, False (and does not work) if case of
- //! out of range of if <howmany> 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
+++ /dev/null
-// 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 <IFSelect_AppliedModifiers.hxx>
-#include <IFSelect_ContextModif.hxx>
-#include <IFSelect_ContextWrite.hxx>
-#include <IFSelect_GeneralModifier.hxx>
-#include <IFSelect_ModelCopier.hxx>
-#include <IFSelect_Modifier.hxx>
-#include <IFSelect_Selection.hxx>
-#include <IFSelect_ShareOut.hxx>
-#include <IFSelect_ShareOutResult.hxx>
-#include <IFSelect_WorkLibrary.hxx>
-#include <Interface_Check.hxx>
-#include <Interface_CheckIterator.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_GeneralLib.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Protocol.hxx>
-#include <Message.hxx>
-#include <Message_Messenger.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-
-#include <stdio.h>
-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"<<endl;
- const Interface_Graph& G = eval.Graph();
- Interface_CheckIterator checks;
- theshareout = eval.ShareOut();
- theremain = new TColStd_HArray1OfInteger(0,G.Size()); theremain->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"<<endl;
- Standard_Integer nb = NbFiles();
- Interface_CheckIterator checks;
- if (nb > 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."<<i<<", Check Messages : **"<<endl;
-// checks.Print (sout,Standard_False);
-// }
- if (!res) {
- char mess[100]; sprintf(mess,"Split Send (WriteFile) abandon on file n0.%d",i);
- checks.CCheck(0)->AddFail (mess);
- Message::DefaultMessenger() <<
- " ** Sending File n0."<<i<<" has failed, abandon **"<<endl;
- return checks;
- }
- AddSentFile (FileName(i).ToCString());
- }
- ClearResult();
- }
- checks.SetName ("X-STEP WorkSession : Split Send (Copy+Write)");
- return checks;
-}
-
-
-// .... Send a 4 arguments : Calcul du Transfert et Envoi sur Fichier
-
- Interface_CheckIterator IFSelect_ModelCopier::Send
- (IFSelect_ShareOutResult& eval,
- const Handle(IFSelect_WorkLibrary)& WL,
- const Handle(Interface_Protocol)& protocol)
-{
- Interface_CopyTool TC (eval.Graph().Model(), protocol);
- return Sending (eval,WL,protocol,TC);
-}
-
- Interface_CheckIterator IFSelect_ModelCopier::Sending
- (IFSelect_ShareOutResult& eval,
- const Handle(IFSelect_WorkLibrary)& WL,
- const Handle(Interface_Protocol)& protocol,
- Interface_CopyTool& TC)
-{
- const Interface_Graph& G = eval.Graph();
- Interface_CheckIterator checks;
- Standard_Integer i = 0;
- Message::DefaultMessenger() <<
- "** WorkSession : Copying then sending split data"<<endl;
- theshareout = eval.ShareOut();
- theremain = new TColStd_HArray1OfInteger(0,G.Size()); theremain->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 "<<filename<<", Check Messages : **"<<endl;
-// checks.Print (sout,model,Standard_False);
-// }
- if (!res) {
- char mess[100]; sprintf(mess,"Split Send (WriteFile) abandon on file n0.%d",i);
- checks.CCheck(0)->AddFail (mess);
- Message::DefaultMessenger() <<
- " ** Sending File "<<filename<<" has failed, abandon **"<<endl;
- checks.SetName ("X-STEP WorkSession : Split Send (only Write)");
- return checks;
- }
- AddSentFile (filename.ToCString());
- }
- theshareout->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"<<endl;
- Handle(Interface_InterfaceModel) model = G.Model();
- if (model.IsNull() || protocol.IsNull() || WL.IsNull()) return checks;
-
- Interface_CopyTool TC (model, protocol);
- Standard_Integer i, nb = model->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 : **"<<endl;
-// checks.Print (sout,model,Standard_False);
-// }
- return checks;
-}
-
-
-// .... SendSelected : Donnees a tranferer dans G, filtrees par iter,
-// aucun split, envoi sur fichier
-
- Interface_CheckIterator IFSelect_ModelCopier::SendSelected
- (const Standard_CString filename, const Interface_Graph& G,
- const Handle(IFSelect_WorkLibrary)& WL,
- const Handle(Interface_Protocol)& protocol,
- const Interface_EntityIterator& list)
-{
- Interface_CheckIterator checks;
- checks.SetName ("X-STEP WorkSession : Send Selected");
- Message::DefaultMessenger() <<
- "** WorkSession : Sending selected data"<<endl;
- Handle(Interface_InterfaceModel) original = G.Model();
- if (original.IsNull() || protocol.IsNull() || WL.IsNull()) return checks;
- Handle(Interface_InterfaceModel) newmod = original->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 : **"<<endl;
-// checks.Print (sout,original,Standard_False);
-// }
- return checks;
-}
-
-
-// ##########################################################################
-// ######## UN TRANSFERT UNITAIRE (avec Modifications) ########
-
- void IFSelect_ModelCopier::CopiedModel
- (const Interface_Graph& G,
- const Handle(IFSelect_WorkLibrary)& WL,
- const Handle(Interface_Protocol)& protocol,
- const Interface_EntityIterator& tocopy,
- 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
-{
-// ... Premiere partie "standard" : remplissage du modele ...
-// On cree le Modele, on le remplit avec les Entites, et avec le Header depart
-
-// ATTENTION : dispnum = 0 signifie prendre modele original, ne rien copier
-// et aussi : pas de Dispatch (envoi en bloc)
-
- applied.Nullify();
- Handle(Interface_InterfaceModel) original = G.Model();
- if (dispnum > 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 "<<numod<<", Dispatch Rank "<<dispnum<<endl;
-// checks.Print(sout,newmod,Standard_False);
-// }
- }
-
-// ... Puis les File Modifiers : en fait, on les enregistre ...
- nbmod = 0;
- if (!theshareout.IsNull()) nbmod = theshareout->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"<<endl;
- Standard_Integer ne = 0;
- for (i = 1; i <= nb; i ++) {
- if (theremain->Value(i) == 0) {
- if (ne == 0) cout << " Refractaires : ";
- ne ++; cout << " " << i;
- }
- }
- if (ne > 0) cout << " -- " << ne << " Entities" << endl;
- else cout<<" -- Remaining data complete"<<endl;
-#endif
- }
-}
-
- Standard_Boolean IFSelect_ModelCopier::SetRemaining
- (Interface_Graph& CG) const
-{
- Standard_Integer nb = CG.Size();
- if (theremain.IsNull()) return (nb == 0);
- if (nb != theremain->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; }
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SequenceOfInterfaceModel.hxx>
-#include <TColStd_SequenceOfAsciiString.hxx>
-#include <IFSelect_SequenceOfAppliedModifiers.hxx>
-#include <TColStd_HArray1OfInteger.hxx>
-#include <TColStd_HSequenceOfHAsciiString.hxx>
-#include <MMgt_TShared.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_CString.hxx>
-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 <filename> 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 <num> out of range or if
- //! the new <filename> 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 <num>)
- //! Returns True if Done, False else : if <num> 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 <G>) 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
- //! <G>, the part is defined in <iter>.
- //! 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 <newmod>
- //! <newmod> is a Null Handle if this list is empty
- //! <WL> performs the copy by using <TC>
- //! <TC> is assumed to have been defined with the starting model
- //! same as defined by <G>.
- 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 <num>
- 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
- //! <sho> : the default file numbering is cleared
- //! If <record> is False, clears the list and stops recording
- //! If <record> 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 <WL> 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 :
- //! <G> is the graph which defines the starting entities, it
- //! contains the original InterfaceModel
- //! <WL> performs the copy by using <TC>
- //! <protocol> is the used protocol (can be usefull for Modifiers)
- //! <topcopy> is the list of Entities which are the Roots of the
- //! packet to be copied
- //! <filename> is the name of the file which will receive it
- //! <dispid> is the Identifier of the Dispatch which have produced
- //! this packet, <numod> is the rank of the packet for this
- //! Dispatch
- //! <TC> is a CopyTool, which performs the copy
- //!
- //! Returned values (as arguments) are :
- //! <newmod> is the result of the copy, as a new InterfaceModel on
- //! which Model Modifiers have already been applied (if there are)
- //! <applied> determines the File Modifiers which remain to be
- //! applied (when the file itself will be output) : for each File
- //! Modifier recorded in <me>, <applied>'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 <model> if this Modifier
- //! concerns particularly these entities (which are the results
- //! of copying the result of its input selection)
- //! <checks> 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
+++ /dev/null
-// 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 <IFSelect_ModelModifier.ixx>
-#include <Interface_Check.hxx>
-
-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); }
+++ /dev/null
-// 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 <IFSelect_ContextModif.hxx>
-#include <IFSelect_EditForm.hxx>
-#include <IFSelect_ModifEditForm.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Protocol.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-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;
-}
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Modifier.hxx>
-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
+++ /dev/null
-// 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 <IFSelect_ContextModif.hxx>
-#include <IFSelect_ModifReorder.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Protocol.hxx>
-#include <Interface_ShareTool.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-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");
-}
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Boolean.hxx>
-#include <IFSelect_Modifier.hxx>
-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 <rootlast> 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 <rootlast> 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
+++ /dev/null
-// 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 <IFSelect_ContextModif.hxx>
-#include <IFSelect_Modifier.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Protocol.hxx>
-#include <Standard_Type.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Modifier,IFSelect_GeneralModifier)
-
-IFSelect_Modifier::IFSelect_Modifier (const Standard_Boolean grf)
- : IFSelect_GeneralModifier (grf) { }
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_GeneralModifier.hxx>
-#include <Standard_Boolean.hxx>
-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.
- //!
- //! <ctx> detains informations about original data and selection.
- //! The result of copying, on which modifications are to be done,
- //! is <target>.
- //! <TC> 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
- //! <maychangegraph>
- Standard_EXPORT IFSelect_Modifier(const Standard_Boolean maychangegraph);
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_Modifier_HeaderFile
+++ /dev/null
-// 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 <IFSelect_PacketList.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_InterfaceError.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-
-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;
-}
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TColStd_Array1OfInteger.hxx>
-#include <Interface_IntList.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Boolean.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <MMgt_TShared.hxx>
-#include <Standard_CString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-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 <numpack> 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 :
- //! <count> times, if <andmore> is False, or
- //! <count> or more times, if <andmore> 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 :
- //! <count> times, if <andmore> is False, or
- //! <count> or more times, if <andmore> 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
+++ /dev/null
-// 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 <IFSelect_EditForm.hxx>
-#include <IFSelect_ParamEditor.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Static.hxx>
-#include <Interface_TypedValue.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-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;
-}
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <IFSelect_Editor.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_CString.hxx>
-#include <Standard_Boolean.hxx>
-#include <TColStd_HSequenceOfHAsciiString.hxx>
-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 <list>
- //! Null Handle if <list> 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
+++ /dev/null
-// 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
+++ /dev/null
-// 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
+++ /dev/null
-// 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
#include <IFSelect_SelectPointed.hxx>
-#include <IFSelect_Transformer.hxx>
#include <Interface_CopyControl.hxx>
#include <Interface_EntityIterator.hxx>
#include <Interface_Graph.hxx>
}
}
- 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
class Interface_InterfaceError;
class Standard_Transient;
class Interface_CopyControl;
-class IFSelect_Transformer;
class Interface_EntityIterator;
class Interface_Graph;
class TCollection_AsciiString;
//! 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).
+++ /dev/null
-// 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 <IFSelect_AppliedModifiers.hxx>
-#include <NCollection_Sequence.hxx>
-
-typedef NCollection_Sequence<Handle(IFSelect_AppliedModifiers)> IFSelect_SequenceOfAppliedModifiers;
-
-
-#endif
+++ /dev/null
-// 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 <IFSelect_GeneralModifier.hxx>
-#include <NCollection_Sequence.hxx>
-
-typedef NCollection_Sequence<Handle(IFSelect_GeneralModifier)> IFSelect_SequenceOfGeneralModifier;
-
-
-#endif
+++ /dev/null
-// 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 <IFSelect_BasicDumper.hxx>
-#include <IFSelect_SessionDumper.hxx>
-#include <IFSelect_SessionFile.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-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; }
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <MMgt_TShared.hxx>
-#include <Standard_Boolean.hxx>
-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 <type>) 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 <item>),
- //! 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
+++ /dev/null
-// 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 <Dico_DictionaryOfInteger.hxx>
-#include <IFSelect_BasicDumper.hxx>
-#include <IFSelect_Dispatch.hxx>
-#include <IFSelect_GeneralModifier.hxx>
-#include <IFSelect_IntParam.hxx>
-#include <IFSelect_Modifier.hxx>
-#include <IFSelect_SelectAnyList.hxx>
-#include <IFSelect_SelectAnyType.hxx>
-#include <IFSelect_SelectCombine.hxx>
-#include <IFSelect_SelectControl.hxx>
-#include <IFSelect_SelectDeduct.hxx>
-#include <IFSelect_SelectExtract.hxx>
-#include <IFSelect_Selection.hxx>
-#include <IFSelect_SessionDumper.hxx>
-#include <IFSelect_SessionFile.hxx>
-#include <IFSelect_ShareOut.hxx>
-#include <IFSelect_Transformer.hxx>
-#include <IFSelect_WorkSession.hxx>
-#include <Interface_Macros.hxx>
-#include <Message.hxx>
-#include <Message_Messenger.hxx>
-#include <OSD_OpenFile.hxx>
-#include <Standard_Transient.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-
-#include <stdio.h>
-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"<<endl; return Standard_False; }
- Handle(Standard_Type) sesstype = thesess->DynamicType();
- if (!theline.Value(1).IsEqual("!XSTEP") ||
- !theline.Value(2).IsEqual("SESSION") ||
- !theline.Value(4).IsEqual(sesstype->Name()) )
- { sout<<"Lineno."<<thenl<<" : File Header Description Incorrect"<<endl; return Standard_False; }
-// Value(3) definit la VERSION du format de fichier
- return Standard_True;
-}
-
-
- Standard_Integer IFSelect_SessionFile::Write
- (const Standard_CString filename)
-{
- thenewnum = 0;
- Standard_Integer stat = WriteSession();
- if (stat != 0) return stat;
- stat = WriteEnd();
- if (stat != 0) return stat;
- return (WriteFile(filename) ? 0 : -1);
-}
-
- Standard_Integer IFSelect_SessionFile::Read
- (const Standard_CString filename)
-{
- if (!ReadFile(filename)) return -1;
- thenewnum = 0;
- Standard_Integer stat = ReadSession();
- if (stat != 0) return stat;
- stat = ReadEnd();
- return stat;
-}
-
-
-// ##################################################################
-// ######## WriteSession : Ecriture du contenu ########
-
- Standard_Integer IFSelect_SessionFile::WriteSession ()
-{
- char laligne[200];
- thedone = Standard_True;
-// ... Preparation Specifique
- thenames.Nullify();
- Standard_Integer nbidents = thesess->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"<<endl; return 1; }
- Handle(Standard_Type) sesstype = thesess->DynamicType();
- if (!theline.Value(1).IsEqual("!XSTEP") ||
- !theline.Value(2).IsEqual("SESSION") ||
- !theline.Value(4).IsEqual(sesstype->Name()) )
- { sout<<"Lineno."<<thenl<<" : File Header Description Incorrect"<<endl; return 1; }
-// Value(3) definit la VERSION du format de fichier
- if (!ReadLine()) return 1;
-
-// .. Parametres Generaux
- Standard_Integer rubr =
- (theline.Length() == 1 && theline.Value(1).IsEqual("!GENERALS"));
- while (rubr) {
- if (!ReadLine()) return 1;
- if (theline.Length() == 0) continue;
- const TCollection_AsciiString& ungen = theline.Value(1);
- if (ungen.Value(1) == '!') break; // fin des generaux
- if (ungen.IsEqual("ErrorHandle")) {
- if (theline.Length() != 2)
- { sout<<"Lineno."<<thenl<<" : ErrorHandle Description Incorrect"<<endl; continue; }
- if (theline.Value(2).IsEqual("0"))
- thesess->SetErrorHandle(Standard_False);
- else if (theline.Value(2).IsEqual("1"))
- thesess->SetErrorHandle(Standard_True);
- else { sout<<"Lineno."<<thenl<<" : ErrorHandle Incorrect : "<<theline.Value(2)<<endl; continue; }
- continue;
- }
- else sout<<"Lineno."<<thenl<<" : Unknown General Parameter : "<<ungen<<" , ignored"<<endl;
- }
-
-// .. IntParams
-// deja fait if (!ReadLine()) return 1;
- rubr = (theline.Length() == 1 && theline.Value(1).IsEqual("!INTEGERS"));
- while (rubr) {
- if (!ReadLine()) return 1;
- if (theline.Value(1).Value(1) == '!') break; // liste suivante
- if (theline.Length() != 2)
- { sout<<"Lineno."<<thenl<<" : An Integer Parameter is badly defined"<<endl; continue; }
- Handle(IFSelect_IntParam) par = new IFSelect_IntParam;
- par->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."<<thenl<<" : A Text Parameter is badly defined"<<endl; continue; }
-// Attention, un texte peut contenir des blancs ... repartir de line(thenl)
- TCollection_AsciiString oneline = thelist.Value(thenl);
- Standard_Integer iw = 0, inc = 0;
- for (Standard_Integer ic = 1; ic <= oneline.Length(); ic ++) {
- char unc = oneline.Value(1);
- inc = ic;
- if (unc == ' ') iw = 1;
- else if (iw > 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."<<thenl<<" : A Selection is badly defined"<<endl; continue; }
-// .. Analyse de certains cas generaux
- Handle(IFSelect_IntParam) low,up;
- Standard_Integer firstown = 3;
- Standard_Integer direct = 0;
- Standard_Integer numlist = 0;
- if (theline.Length() > 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."<<thenl<<" : A SelectExtract is badly defined"<<endl;
- else sxt->SetDirect( (direct > 0) );
- }
- DeclareAndCast(IFSelect_SelectAnyList,sli,item);
- if (!sli.IsNull()) {
- if (numlist == 0) sout<<"Lineno."<<thenl<<" : A SelectAnyList is badly defined"<<endl;
- else sli->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."<<thenl<<" : A Selection Source List is badly defined"<<endl; continue; }
- DeclareAndCast(IFSelect_Selection,sel,ItemValue(1));
- if (sel.IsNull())
- { sout<<"Lineno."<<thenl<<" : A Source List is not for a Selection"<<endl; continue; }
- Standard_Integer nbs = atoi(theline.Value(2).ToCString());
-// .. Differents cas reconnus
- DeclareAndCast(IFSelect_SelectExtract,sxt,sel);
- if (!sxt.IsNull()) {
- if (nbs > 1)
- sout<<"Lineno."<<thenl<<" : SelectExtract, more than one source, followings ignored"<<endl;
- DeclareAndCast(IFSelect_Selection,source,ItemValue(3));
- sxt->SetInput(source);
- }
- DeclareAndCast(IFSelect_SelectDeduct,sdt,sel);
- if (!sdt.IsNull()) {
- if (nbs > 1)
- sout<<"Lineno."<<thenl<<" : SelectDeduct, more than one source, followings ignored"<<endl;
- sdt->SetInput(GetCasted(IFSelect_Selection,ItemValue(3)));
- }
- DeclareAndCast(IFSelect_SelectControl,sct,sel);
- if (!sct.IsNull()) {
- if (nbs != 2)
- sout<<"Lineno."<<thenl<<" : SelectControl, not two sources, followings ignored"<<endl;
- sct->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."<<thenl<<" : A Modifier is badly defined"<<endl; continue; }
- Handle(Standard_Transient) item; // a fournir ...
- ReadOwn(item);
- if (item.IsNull()) continue;
- DeclareAndCast(IFSelect_GeneralModifier,modif,item);
- if (modif.IsNull())
- { sout<<"Lineno."<<thenl<<" : A Modifier has not been Recognized"<<endl; continue; }
- AddItem(modif,Standard_False); // active plus tard
- }
-
-// ... Transformers
- rubr = (theline.Length() == 1 && theline.Value(1).IsEqual("!TRANSFORMERS"));
- while (rubr) {
- if (!ReadLine()) return 1;
- if (theline.Value(1).Value(1) == '!') break; // liste suivante
- if (theline.Length() < 2)
- { sout<<"Lineno."<<thenl<<" : A Transformer is badly defined"<<endl; continue; }
- Handle(Standard_Transient) item; // a fournir ...
- ReadOwn(item);
- if (item.IsNull()) continue;
- DeclareAndCast(IFSelect_Transformer,trf,item);
- if (trf.IsNull())
- { sout<<"Lineno."<<thenl<<" : A Transformer has not been Recognized"<<endl; continue; }
- AddItem(trf,Standard_False); // active plus tard
- }
-
-// ... Dispatches (ligne de garde deja lue)
- rubr = (theline.Length() == 1 && theline.Value(1).IsEqual("!DISPATCHES"));
- while (rubr) {
- if (!ReadLine()) return 1;
- if (theline.Value(1).Value(1) == '!') break; // liste suivante
- if (theline.Length() < 3)
- { sout<<"Lineno."<<thenl<<" : A Dispatch is badly defined"<<endl; continue; }
- DeclareAndCast(IFSelect_Selection,input,ItemValue(3));
- SetLastGeneral(3);
- Handle(Standard_Transient) item; // a fournir ...
- ReadOwn(item);
- if (item.IsNull()) continue;
- DeclareAndCast(IFSelect_Dispatch,disp,item);
- if (disp.IsNull())
- { sout<<"Lineno."<<thenl<<" : A Dispatch has not been Recognized"<<endl; continue; }
- AddItem(disp);
- thesess->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."<<thenl<<" : A File Root is badly defined"<<endl; continue; }
- DeclareAndCast(IFSelect_Dispatch,disp,ItemValue(1));
- thesess->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."<<thenl<<" : Model Modifier List Incorrect"<<endl; return 1; }
-// if ( formod == 0 && ( theline.Length() != 1 ||
-// !theline.Value(1).IsEqual("!FILEMODIFIERS")) )
-// { sout<<"Lineno."<<thenl<<" : File Modifier List Incorrect"<<endl; return 1; }
- while (rubr) {
- if (!ReadLine()) return 1;
- if (theline.Value(1).Value(1) == '!') break; // liste suivante
- if (theline.Length() < 3)
- { sout<<"Lineno."<<thenl<<" : A General Modifier is badly defined"<<endl; continue; }
- DeclareAndCast(IFSelect_GeneralModifier,modif,ItemValue(1));
- DeclareAndCast(IFSelect_Selection,input,ItemValue(2));
- DeclareAndCast(IFSelect_Dispatch,disp,ItemValue(3));
- if (modif.IsNull())
- { sout<<"Lineno."<<thenl<<" : A General Modifier has not been Recognized"<<endl; continue; }
- thesess->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"<<thenl<<endl; return 1; }
- return 0;
-}
-
-
- Standard_Boolean IFSelect_SessionFile::ReadLine ()
-{
- if (thenl >= 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."<<thenl<<" : an Item could not be read"<<endl;
- return (!dumper.IsNull()); // IsNull -> 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."<<thenl<<" -- Name : "<<name
- <<" : Item could not be defined" << endl;
- thenames->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<<Handle par
- SendVoid();
- thedone = Standard_False;
- return;
- }
-//// if (theownflag) WriteLine(" :");
-//// else WriteLine(" ");
- if (filenum < 0) sprintf(laligne," :%s",thesess->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
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Standard_Boolean.hxx>
-#include <TColStd_HArray1OfInteger.hxx>
-#include <TColStd_SequenceOfAsciiString.hxx>
-#include <Standard_Integer.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <Standard_CString.hxx>
-#include <Standard_Character.hxx>
-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 <name> 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 <name>, 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 <follow> 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 <item> 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
- //! <active> commands to make <item> 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 <mode> 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 <num> 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
+++ /dev/null
-// 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 <IFSelect_Activator.hxx>
-#include <IFSelect_Selection.hxx>
-#include <IFSelect_SessionPilot.hxx>
-#include <IFSelect_SignCounter.hxx>
-#include <IFSelect_WorkSession.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Message.hxx>
-#include <Message_Messenger.hxx>
-#include <OSD_OpenFile.hxx>
-#include <Standard_Stream.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_HSequenceOfAsciiString.hxx>
-
-#include <stdio.h>
-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 : "<<lc<<" caracteres :"<<endl
- <<command.ToCString()<<endl;
- thecommand = command;
- if (thecommand.Value(lc) <= ' ') { thecommand.Remove(lc); lc --; }
- thenbwords = 0;
- Standard_Integer i, nc = 0;
- char unarg[MAXCARS];
- for (i = 1; i <= lc; i ++) {
- char val = command.Value(i);
- if (val <= ' ') {
- if (nc == 0) continue;
- if (thenbwords >= MAXWORDS) { unarg[nc] = val; nc ++; continue; }
- unarg[nc] = '\0';
- thewords(thenbwords).Clear(); thewords(thenbwords).AssignCat(unarg);
-#ifdef DEBUG_TRACE
- cout<<"thewords("<<thenbwords<<") ="<<unarg<<endl;
-#endif
- thenbwords ++; nc = 0;
- continue;
- }
- if (nc == 0) thewordeb.SetValue (thenbwords,i);
- if (nc > MAXCARS) { cout<<"Arg."<<thenbwords<<" > "<<MAXCARS<<" car.s, tronque"<<endl; continue; }
- unarg[nc] = val; nc ++;
- }
- if (nc > 0) {
- unarg[nc] = '\0'; thewords(thenbwords).Clear();
- thewords(thenbwords).AssignCat(unarg);
-#ifdef DEBUG_TRACE
- cout<<"thewords("<<thenbwords<<")="<<unarg<<endl<<" .. Fin avec thenbwords="<<thenbwords+1<<endl;
-#endif
- thenbwords ++;
- }
- thenumrec = 0;
- theobjrec.Nullify();
-}
-
- Standard_CString IFSelect_SessionPilot::CommandPart
- (const Standard_Integer numarg) const
-{
- if (numarg <= 0) return thecommand.ToCString();
- if (numarg >= thenbwords) return "";
- return &(thecommand.ToCString())[thewordeb(numarg)-1];
-}
-
- const TCollection_AsciiString& IFSelect_SessionPilot::Word
- (const Standard_Integer num) const
- { if (num < thenbwords) return thewords(num); return nulword; }
-
- Standard_CString IFSelect_SessionPilot::Arg
- (const Standard_Integer num) const
- { return Word(num).ToCString(); }
-
- Standard_Boolean IFSelect_SessionPilot::RemoveWord
- (const Standard_Integer num)
-{
- if (num < 0 || num > 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 "<<file<<" not found"<<endl; return IFSelect_RetFail; }
- cout << " ... Reading Script File " << file << endl;
- }
- else fic = stdin;
- IFSelect_ReturnStatus stat = IFSelect_RetVoid;
-
- for (;;) {
- char ligne[100];
- if (!lefic) std::cout << theprompt.ToCString();
- ligne[0] = '\0';
- if (fgets(ligne,100,fic) == NULL
- || feof(fic) != 0)
- {
- break;
- }
- if (ligne[0] == '\0') continue;
-// On interprete cette commande
- TCollection_AsciiString command(ligne);
- if (lefic) cout<<file<<":"<<command; // le return est dans la ligne ... !
- stat = Execute(command);
- if (stat == IFSelect_RetStop) break;
- if ((stat == IFSelect_RetError || stat == IFSelect_RetFail) && lefic)
- { cout << " ... Error in Script File, abandon"<<endl; break; }
- }
- if (!lefic) return IFSelect_RetStop;
- fclose(fic);
- cout<<"End of Reading Script File " << file << endl;
- if (stat == IFSelect_RetError || stat == IFSelect_RetFail) return stat;
- return IFSelect_RetVoid; // fin fichier : depiler
-}
-
-
-// On boucle sur la lecture jusqu a une commande de fin ou un EOF
-
- IFSelect_ReturnStatus IFSelect_SessionPilot::Perform ()
-{
- IFSelect_ReturnStatus stat = IFSelect_RetVoid;
- if (thenbwords == 0) return stat;
- if (thewords(0).Value(1) == '#') return stat; // commentaire
-
- theobjrec.Nullify();
-// Est-ce un nom ?
-
-// Commande pour un Acteur
- Handle(IFSelect_Activator) actor; Standard_Integer num;
- if (IFSelect_Activator::Select(thewords(0).ToCString(),num,actor)) {
- stat = actor->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"<<endl; return IFSelect_RetFail; }
- }
-
- if (stat == IFSelect_RetVoid || stat == IFSelect_RetDone) {
- if (therecord) thecomlist.Append(thecommand);
- }
- else if (stat == IFSelect_RetError) cout<<"Error in Command : "<<thecommand<<endl;
- else if (stat == IFSelect_RetFail) cout << "Execution Failure for : " <<thecommand<<endl;
- return stat;
- }
- cout << " Command : " << thewords(0) << " unknown" << endl;
- return IFSelect_RetError; // pas reconnu donc incorrect
-}
-
- IFSelect_ReturnStatus IFSelect_SessionPilot::Execute
- (const TCollection_AsciiString& command)
-{
- SetCommandLine(command);
- return Perform();
-}
-
- IFSelect_ReturnStatus IFSelect_SessionPilot::ExecuteCounter
- (const Handle(IFSelect_SignCounter)& counter, const Standard_Integer numword,
- const IFSelect_PrintCount mode)
-{
- if (counter.IsNull()) return IFSelect_RetError;
- counter->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 : "<<CommandPart(numword)<<endl;
- return IFSelect_RetError;
- }
- counter->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:"<<val<<" ->"<<-num<<" ent.s, refus"<<endl;
- return num;
-}
-
-
-// #########################################################################
-// ######## ACTIONS SPECIFIQUES DU PILOTE
-
-#define MAXCOMPERLINE 5
-#define LENGTHFORCOM 15
-
- IFSelect_ReturnStatus IFSelect_SessionPilot::Do
- (const Standard_Integer number,
- const Handle(IFSelect_SessionPilot)& session)
-{
-// Commandes Propres : x, exit, undo, redo, ?, help
- IFSelect_ReturnStatus stat = IFSelect_RetVoid;
- Standard_Integer argc = NbWords();
- const Standard_CString arg1 = Word(1).ToCString();
- Standard_Integer modhelp = -1;
- switch (number) {
- case -1 : // **** HELP-XSNEW
- modhelp = 1;
- cout<<" -- Commands candidate for xsnew --"<<endl;
-// HELP : soit complet (par defaut) soit limite a xsnew
- case 0 : { // **** HELP
- Handle(TColStd_HSequenceOfAsciiString) list;
-// Help complet : on donne la liste des commandes, sans plus (deja pas mal)
- if (thenbwords <= 1) {
- list = IFSelect_Activator::Commands(modhelp);
- Standard_Integer nbcom = 0;
- Standard_Integer nb = list->Length();
- cout << " -- Liste des Commands Disponibles --"<<endl;
- for (Standard_Integer i = 1; i <= nb; i ++) {
- const TCollection_AsciiString& uncom = list->Value(i);
- Standard_Integer loncom = uncom.Length();
- nbcom ++;
- if (nbcom > MAXCOMPERLINE) { cout<<endl; nbcom = 1; }
- cout<<" "<<uncom;
- if (nbcom == MAXCOMPERLINE) continue;
- for (Standard_Integer j = loncom; j < LENGTHFORCOM; j ++) cout<<" ";
- }
- if (nbcom > 0) cout<<endl;
- cout<<"\nhelp * liste toutes les commandes avec un help sur chacune\n"
- <<"help <com> liste la ou les commande debutant par <com>"
- <<" avec un help sur chacune"<<endl;
-
-// Un Help particulier
- } else {
- if (thewords(1).IsEqual("*")) list = IFSelect_Activator::Commands(modhelp);
-
- else list = IFSelect_Activator::Commands(modhelp,thewords(1).ToCString());
-
- Standard_Integer nb = list->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 "<<Word(1)<<" unknown. "
- << " help (without command) lists all the commands" << endl;
- }
- return IFSelect_RetVoid;
- }
- case 1 : return IFSelect_RetStop; // **** Fin de session
- case 2 : { // **** HELP
- return Do(0,this);
- }
- case 3 : { // **** COMMAND
- if (argc < 2) { cout << "Donner une option :\n"
- <<"a : analyse une ligne r : toggle record mode\n"
- <<"l : list recorded c : clear f nom : sauver dans fichier de nom"
- << endl; return IFSelect_RetVoid; }
- switch (arg1[0]) {
- case 'a' : { // **** command analyse
- cout<<"Command n0 " << number <<" : "<< session->CommandLine()<<endl;
- cout<<"Nb Words : " << argc-2 << " :\n";
- for (Standard_Integer i = 2; i < argc; i ++) {
- cout << " Word." << i-1 << " : " << session->Word(i) <<endl;
- }
- break;
- }
- case 'c' : session->Clear(); break; // **** command clear
- case 'f' : {
- if (argc < 3) { cout<<"Donner nom de fichier"<<endl; return IFSelect_RetError; }
- Standard_Integer nb = session->NbCommands();
- if (nb == 0) { cout<<"Aucune commande enregistree"<<endl; break; }
- cout << "Nb Commandes enregistrees : " << nb <<endl;
- ofstream fout(Word(2).ToCString(),ios::out);
- for (Standard_Integer i = 1; i <= nb; i ++)
- fout<<session->Command(i)<<endl;
- break;
- }
- case 'l' : { // **** command list
- if (session->RecordMode()) cout<<" -- Record Mode Actif"<<endl;
- else cout<<" -- Record Mode Inactif"<<endl;
- Standard_Integer nb = session->NbCommands();
- cout << "Nb Commandes enregistrees : " << nb << " :"<<endl;
- for (Standard_Integer i = 1; i <= nb; i ++) {
- cout<<" "<<i<<" "<<session->Command(i)<<endl;
- }
- break;
- }
- case 'r' : { // **** command record
- Standard_Boolean mode = session->RecordMode();
- if (mode) cout << " -- Record Mode a present Inactif" <<endl;
- else cout << " -- Record Mode a present Actif" <<endl;
- session->SetRecordMode(!mode);
- break;
- }
- default : cout << "Option de controle de commande non comprise"<<endl;
- }
- return IFSelect_RetVoid;
- }
-
- case 4 : { // **** FILE
- if (argc < 2) { cout<<"Donner nom de fichier"<<endl; return IFSelect_RetError; }
- return session->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"<<endl
- <<"xstep command args equivaut a command args"<<endl;
- return Do(2,this);
- } else {
- RemoveWord(0);
- return Perform();
- }
- }
- case 6 : { // **** XSNEW(variable)
- if (argc < 3) {
- cout<<"xsnew nomvar command [args] creates an item"<<endl
- <<" nomvar : name of item (must be a new name) in the session"<<endl;
- return Do (-1,this);
- } else {
-
- theobjrec.Nullify();
- TCollection_AsciiString name = Word(1);
-// Le nom ne doit pas etre deja pris !
- if (thesession.IsNull()) { cout<<"Command with a Name and no Session defined !"<<endl; return IFSelect_RetFail; }
-////// if (thesession->NameIdent(thewords(0).ToCString()) > 0)
-////// { cout<<"Command with name:"<<thewords(0)<<", already taken"<<endl; return IFSelect_RetFail; }
- RemoveWord(0); RemoveWord(0);
-
-// Commande pour un Acteur
- Handle(IFSelect_Activator) actor; Standard_Integer num;
- if (IFSelect_Activator::Select(thewords(0).ToCString(),num,actor)) {
- theobjrec.Nullify();
- stat = actor->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:"<<name<<", sorry"<<endl; return IFSelect_RetFail; }
- }
- else cout<<"Remark : xsnew with name:"<<name<<" and no result"<<endl;
-
- return stat;
- }
- cout << " Command : " << thewords(0) << " unknown" << endl;
- return IFSelect_RetError; // pas reconnu donc incorrect
- }
- }
- default : return IFSelect_RetError;
- }
-}
-
-
-
- Standard_CString IFSelect_SessionPilot::Help
- (const Standard_Integer number) const
-{
- switch (number) {
- case 1 : return "exit ou x : Fin de session";
- case 2 : return "Liste les commandes. ? <titre> : commandes debutant par <titre>";
- 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 "";
- }
-}
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_Array1OfAsciiString.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-#include <TColStd_SequenceOfAsciiString.hxx>
-#include <IFSelect_Activator.hxx>
-#include <IFSelect_ReturnStatus.hxx>
-#include <IFSelect_PrintCount.hxx>
-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
- //! <numarg> 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
- //! <num> 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 <file>. 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 <numword> is greater than count of command words, it counts
- //! all the model. Else it considers the word <numword> as the
- //! identifier of a Selection
- //! <mode> 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
+++ /dev/null
-// 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 <IFSelect_Dispatch.hxx>
-#include <IFSelect_GeneralModifier.hxx>
-#include <IFSelect_Modifier.hxx>
-#include <IFSelect_ShareOut.hxx>
-#include <Interface_InterfaceError.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_OutOfRange.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-#include <stdio.h>
-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 <num>
-// 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;
-}
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_TSeqOfDispatch.hxx>
-#include <IFSelect_SequenceOfGeneralModifier.hxx>
-#include <Standard_Integer.hxx>
-#include <MMgt_TShared.hxx>
-#include <Standard_Boolean.hxx>
-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 <onlydisp> is True.
- //! - cleared if <onlydisp> is False (complete clearing)
- //! If <onlydisp> 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 <alsoname> 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 <modifier> 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 <atnum>
- //! 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 <dispnum>
- //! If <modifier> 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, <atnum> refers to the entire list
- //! By default (atnum = 0) at the end of the list, else at <atnum>
- //! Remark : if the Modifier was already in the list and if
- //! <atnum> = 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
- //! <formodel> 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 <formodel> 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 <formodel> 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 <modifier> 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 <formodel> is True, File Modifiers else
- //! Returns True if done, False if <num> 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 <formodel> is True, File Modifiers else
- //! from <before> to <after>
- //! 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 <num> out of range
- Standard_EXPORT Standard_Boolean SetRootName (const Standard_Integer num, const Handle(TCollection_HAsciiString)& name);
-
- //! Returns True if the Dispatch of rank <num> 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 <thenbdefs> is incremented and used
- //! Error if no Root is defined for this <idnum>
- 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
+++ /dev/null
-// 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 <IFGraph_AllShared.hxx>
-#include <IFSelect_Dispatch.hxx>
-#include <IFSelect_PacketList.hxx>
-#include <IFSelect_ShareOut.hxx>
-#include <IFSelect_ShareOutResult.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_GraphContent.hxx>
-#include <Interface_InterfaceError.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_NoSuchObject.hxx>
-#include <TCollection_AsciiString.hxx>
-
-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"<<endl;
-#endif
- return;
- }
- if (thedispnum == dispnum) thepackdisp ++;
- else {
- thedispnum = dispnum;
- 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);
- }
-}
-
- 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);
-}
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-#include <TColStd_SequenceOfInteger.hxx>
-#include <Interface_Graph.hxx>
-#include <IFGraph_SubPartsIterator.hxx>
-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 :
- //! - <complete> = False, the strict definition of Packets, i.e.
- //! for each one, the Root Entities, to be explicitely sent
- //! - <complete> = 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
+++ /dev/null
-// 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 <IFSelect_Dispatch.hxx>
-#include <NCollection_Sequence.hxx>
-
-typedef NCollection_Sequence<Handle(IFSelect_Dispatch)> IFSelect_TSeqOfDispatch;
-
-
-#endif
+++ /dev/null
-// 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 <IFSelect_ContextModif.hxx>
-#include <IFSelect_Modifier.hxx>
-#include <IFSelect_Selection.hxx>
-#include <IFSelect_TransformStandard.hxx>
-#include <Interface_CheckIterator.hxx>
-#include <Interface_CopyControl.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Interface_Protocol.hxx>
-#include <Message.hxx>
-#include <Message_Messenger.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_HArray1OfInteger.hxx>
-
-#include <stdio.h>
-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 "<<i<<" of "<<nb<<endl;
- checklist.Print(sout,newmod,Standard_False);
- }
- if (!checklist.IsEmpty(Standard_True)) {
- sout<<" -- Abandon TransformStandard --"<<endl;
- res = Standard_False; break;
- }
- }
-
-// Modele pas modifie et Graphe pas modifie : le dire
- if (newmod == original && !chg) newmod.Nullify();
- return res;
-}
-
- Standard_Boolean IFSelect_TransformStandard::Updated
- (const Handle(Standard_Transient)& entfrom,
- Handle(Standard_Transient)& entto) const
-{
- if (themap.IsNull()) return Standard_False;
- return themap->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;
-}
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Boolean.hxx>
-#include <IFSelect_SequenceOfGeneralModifier.hxx>
-#include <IFSelect_Transformer.hxx>
-#include <Standard_Integer.hxx>
-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 :
- //! - <atnum> = 0 (default) : at the end of the list
- //! - <atnum> > 0 : at rank <atnum>
- //! Returns True if done, False if <atnum> 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 <modif> 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 <num> 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 <newmod> 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
- //! "<nn> 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
+++ /dev/null
-// 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 <IFSelect_Transformer.hxx>
-#include <Interface_CheckIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Protocol.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Transformer,MMgt_TShared)
-
-Standard_Boolean IFSelect_Transformer::ChangeProtocol (Handle(Interface_Protocol)& ) const
-{
- return Standard_False; // par defaut, protocole inchange
-}
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <MMgt_TShared.hxx>
-#include <Standard_Boolean.hxx>
-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) :
- //! <G> gives the input data (especially the starting model) and
- //! can be used for queries (by Selections, etc...)
- //! <protocol> 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
- //! <checks> stores produced checks messages if any
- //! <newmod> 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
- //!
- //! <me> 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 <entfrom> (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 <entto>. 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
--- /dev/null
+// 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 <Dico_DictionaryOfTransient.hxx>
+#include <Geom2d_CartesianPoint.hxx>
+#include <Geom2d_Curve.hxx>
+#include <Geom_CartesianPoint.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom_Geometry.hxx>
+#include <Geom_Surface.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Pnt2d.hxx>
+#include <Interface_Macros.hxx>
+#include <Standard_Transient.hxx>
+#include <Standard_Type.hxx>
+#include <TopoDS_HShape.hxx>
+#include <TopoDS_Shape.hxx>
+#include <IFSelect_Vars.hxx>
+
+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;
+}
--- /dev/null
+// 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 <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <MMgt_TShared.hxx>
+#include <Standard_CString.hxx>
+#include <Standard_Boolean.hxx>
+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
+++ /dev/null
-// 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 <IFSelect_ContextWrite.hxx>
-#include <IFSelect_WorkLibrary.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Protocol.hxx>
-#include <Message.hxx>
-#include <Message_Messenger.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-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();
-}
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Integer.hxx>
-#include <Interface_HArray1OfHAsciiString.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_CString.hxx>
-#include <Standard_Boolean.hxx>
-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
- //! <mod> is the resulting Model, which has to be created by this
- //! method. In case of error, <mod> 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.
- //! <ctx> 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 <applied> 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. <model> helps to identify, number ... entities.
- //! <level> 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 <max>
- //! default value will be <def>
- 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 <level>, 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
// 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 <IFSelect_WorkSession.hxx>
+#include <Standard_ErrorHandler.hxx>
+#include <Standard_Failure.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+#include <TColStd_MapOfInteger.hxx>
#include <Dico_DictionaryOfTransient.hxx>
-#include <Dico_IteratorOfDictionaryOfInteger.hxx>
-#include <Dico_IteratorOfDictionaryOfTransient.hxx>
-#include <IFGraph_SubPartsIterator.hxx>
+#include <Message_Messenger.hxx>
+#include <Interface_Macros.hxx>
+#include <Interface_GTool.hxx>
+#include <Interface_HGraph.hxx>
+#include <Interface_MSG.hxx>
+#include <Interface_Category.hxx>
+#include <Interface_CheckIterator.hxx>
+#include <Interface_CheckTool.hxx>
+#include <Interface_ShareFlags.hxx>
+#include <Interface_EntityIterator.hxx>
+#include <Interface_GeneralModule.hxx>
#include <IFSelect_CheckCounter.hxx>
-#include <IFSelect_Dispatch.hxx>
-#include <IFSelect_EditForm.hxx>
-#include <IFSelect_Editor.hxx>
-#include <IFSelect_GeneralModifier.hxx>
#include <IFSelect_IntParam.hxx>
-#include <IFSelect_ModelCopier.hxx>
-#include <IFSelect_Modifier.hxx>
-#include <IFSelect_PacketList.hxx>
-#include <IFSelect_ParamEditor.hxx>
-#include <IFSelect_SelectCombine.hxx>
-#include <IFSelect_SelectControl.hxx>
-#include <IFSelect_SelectDeduct.hxx>
-#include <IFSelect_SelectDiff.hxx>
-#include <IFSelect_SelectEntityNumber.hxx>
-#include <IFSelect_SelectExtract.hxx>
-#include <IFSelect_SelectIntersection.hxx>
-#include <IFSelect_Selection.hxx>
-#include <IFSelect_SelectionIterator.hxx>
-#include <IFSelect_SelectModelEntities.hxx>
-#include <IFSelect_SelectModelRoots.hxx>
#include <IFSelect_SelectPointed.hxx>
-#include <IFSelect_SelectSignature.hxx>
-#include <IFSelect_SelectUnion.hxx>
-#include <IFSelect_ShareOut.hxx>
-#include <IFSelect_ShareOutResult.hxx>
+#include <IFSelect_SelectionIterator.hxx>
#include <IFSelect_Signature.hxx>
-#include <IFSelect_SignatureList.hxx>
#include <IFSelect_SignCounter.hxx>
#include <IFSelect_SignValidity.hxx>
-#include <IFSelect_Transformer.hxx>
-#include <IFSelect_TransformStandard.hxx>
-#include <IFSelect_WorkLibrary.hxx>
-#include <IFSelect_WorkSession.hxx>
-#include <Interface_Category.hxx>
-#include <Interface_Check.hxx>
-#include <Interface_CheckIterator.hxx>
-#include <Interface_CheckTool.hxx>
-#include <Interface_CopyControl.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_GeneralLib.hxx>
-#include <Interface_GeneralModule.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_GTool.hxx>
-#include <Interface_HGraph.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Interface_MSG.hxx>
-#include <Interface_Protocol.hxx>
-#include <Interface_ReportEntity.hxx>
-#include <Interface_ShareFlags.hxx>
-#include <Interface_ShareTool.hxx>
-#include <Interface_Static.hxx>
-#include <Message.hxx>
-#include <Message_Messenger.hxx>
-#include <OSD_Path.hxx>
-#include <Standard_DomainError.hxx>
-#include <Standard_ErrorHandler.hxx>
-#include <Standard_Failure.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-#include <TColStd_MapOfInteger.hxx>
+#include <IFSelect_SelectCombine.hxx>
+#include <IFSelect_SelectControl.hxx>
+#include <IFSelect_SelectSignature.hxx>
+#include <IFSelect_SelectModelEntities.hxx>
+#include <IFSelect_Vars.hxx>
+#include <XSControl_Controller.hxx>
-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);
}
//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);
+ }
}
//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);
}
//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"<<endl;
- status = IFSelect_RetFail;
- }
- if (status != IFSelect_RetDone) return status;
- if (model.IsNull()) return IFSelect_RetVoid;
- SetModel (model);
- SetLoadedFile (filename);
- return status;
+ return Handle(IFSelect_Signature)::DownCast (thegtool->SignType());
}
}
-//=======================================================================
-//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 :
//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();
}
//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();
}
//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));
}
//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);
}
//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);
}
//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;
}
//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
}
//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();
}
{
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);
}
(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;
}
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;
}
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 :
void IFSelect_WorkSession::ClearItems ()
{
- thenames->Clear();
- theitems.Clear();
- theshareout->Clear(Standard_False);
+ myNames->Clear();
+ myItems.Clear();
}
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:");
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;
//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)); }
//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;
//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);
//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)); }
//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 ....
//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 ....
//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)); }
//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) {
sout<<Standard_Failure::Caught()->GetMessageString();
sout<<"\n Abandon"<<endl;
}
- errhand = theerrhand;
+ errhand = Standard_True;
return iter;
}
//purpose :
//=======================================================================
-IFSelect_SelectionIterator IFSelect_WorkSession::Sources
- (const Handle(IFSelect_Selection)& sel) const
-{
- return IFSelect_SelectionIterator (sel);
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::SelectionResult
- (const Handle(IFSelect_Selection)& sel) const
+Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::SelectionResult (const Handle(IFSelect_Selection)& sel) const
{
Handle(TColStd_HSequenceOfTransient) res;
if (errhand) {
sout<<Standard_Failure::Caught()->GetMessageString();
sout<<"\n Abandon"<<endl;
}
- errhand = theerrhand;
+ errhand = Standard_True;
return res;
}
return res;
}
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Standard_Boolean IFSelect_WorkSession::SetItemSelection
- (const Handle(Standard_Transient)& item,
- const Handle(IFSelect_Selection)& sel)
-{
- DeclareAndCast(IFSelect_Dispatch,disp,item);
- DeclareAndCast(IFSelect_GeneralModifier,modif,item);
- if (!disp.IsNull()) {
- if (ItemIdent(disp) == 0) return Standard_False;
-// Selection Nulle : Annuler FinalSelection
- if (!sel.IsNull() && ItemIdent(sel) == 0) return Standard_False;
- disp->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 ....
//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 : **"<<endl;
- checks.Print (sout,myModel,Standard_False);
- }
- thecheckdone = Standard_False;
- thecheckrun = checks;
-
- if (newmod.IsNull()) return (res ? 1 : -1);
-// 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(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<<Standard_Failure::Caught()->GetMessageString();
- sout<<"\n Abandon"<<endl;
- checks.CCheck(0)->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 : **"<<endl;
- checks.Print (sout,myModel,Standard_False);
- }
- thecopier->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<<Standard_Failure::Caught()->GetMessageString();
- sout<<"\n Abandon"<<endl;
- checks.CCheck(0)->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 ***"<<endl;
- checks.CCheck(0)->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 "<<filnam<<" failed"<<endl;
- }
- }
- sout<<" .. Files Written : "<<nf<<endl;
- }
- thecheckrun = checks;
- return Standard_True;
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Handle(IFSelect_PacketList) IFSelect_WorkSession::EvalSplit () const
-{
- Handle(IFSelect_PacketList) pks;
- if (!IsLoaded()) return pks;
- IFSelect_ShareOutResult sho (ShareOut(), thegraph->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"<<endl; return Standard_False;
- } else if (newmod == myModel) {
- sout<<" Remaining causes all original data to be kept"<<endl;
- thecopier->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"<<endl; return Standard_True;
- }
- Interface_EntityIterator iter = SentList(0);
- nb = iter.NbEntities();
- if (nb == 0) {
- sout<<" - No recorded remaining entities"<<endl; return Standard_True;
- }
- sout <<" -- Recorded Remaining (not yet sent) Entities --"<<endl;
- ListEntities(iter,2);
- sout << " -- Maximum Sending Count (i.e. duplication in files) "<<
- MaxSendingCount() << endl;
-
-/*
- sout<< " - Now, dispatches are deactivated"<<endl;
- nb = theshareout->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<<Standard_Failure::Caught()->GetMessageString();
- sout<<"\n Abandon"<<endl;
- errhand = theerrhand;
- checks.CCheck(0)->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<<Standard_Failure::Caught()->GetMessageString();
- sout<<"\n Abandon"<<endl;
- checks.CCheck(0)->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 <son>, status avec <dad> + 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<Handle(Standard_Transient)>& params,
- const NCollection_Vector<Standard_Integer>& 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());
}
//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<<"******************************************"<<endl;
- if (use == 1) {
- if (mode == 0) sout<<"***** General Parameters *****"<<endl;
- } else if (use == 2) {
- if (mode == 0) sout<<"***** Load File *****"<<endl;
- } else if (use == 3) {
- if (mode == 0) sout<<"***** Write File *****"<<endl;
- } else if (use == 4) {
- if (mode == 0) sout<<"***** Split File *****"<<endl;
- } else if (use == 5) {
- if (mode == 0) sout<<"***** Transfer (Read) *****"<<endl;
- } else if (use == 6) {
- if (mode == 0) sout<<"***** Transfer (Write) *****"<<endl;
- }
- if (mode == 0) sout<<"******************************************"<<endl<<endl;
- }
-
-// Echainements particuliers (use > 0)
- if (use == 5) {
- TraceStatics (-2,mode);
- if (mode == 0) sout<<endl;
- } else if (use == 4 || use == 6) {
- TraceStatics (-3,mode);
- if (mode == 0) sout<<endl;
- }
-
-// Valeurs particulieres
- if (use == 1 || use == -1) { // General : trace
- if (mode == 0) {
-// sout << "Trace Level : "<<Message_PrinterOStream::Default()->GetTraceLevel()<<endl;
- }
- } else if (use == 4 || use == -4) { // Split : Prefix & cie
- if (mode == 0) {
- Handle(TCollection_HAsciiString) str = theshareout->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;
- }
- }
-
-// LISTER LES STATICS
-// Passer par les ParamEditor ...
-
-// Fin
- if (use > 0) {
- if (mode == 0) sout<<"******************************************"<<endl<<endl;
- }
+ 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;
}
//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) **********"<<endl;
-
- Handle(TCollection_HAsciiString) str = theshareout->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 << ") : "<<endl;
- for (Standard_Integer i = 1; i <= nb; i ++) {
- Handle(IFSelect_Dispatch) disp = theshareout->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 : "<<disp->RootName()->ToCString()<<endl;
- else sout<<" No specific file root name (see Default Root)"<<endl;
- }
- Standard_Integer nbm = theshareout->NbModifiers(Standard_True);
- if (nbm > 0) sout<<
- " *** "<<nbm<<" active Model Modifiers : see ListModifiers ***"<<endl;
- Standard_Integer nbf = theshareout->NbModifiers(Standard_False);
- if (nbf > 0) sout<<
- " *** "<<nbf<<" active File Modifiers : see ListModifiers ***"<<endl;
- if (nbm+nbf == 0) sout<<" *** No active Modifiers ***"<<endl;
+ 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;
}
-// #### #### #### #### #### #### #### #### ####
-// .... 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 **********"<<endl;
- Standard_Integer nb = MaxIdent();
- Handle(TCollection_HAsciiString) str;
- if (lab[0] != '\0') str = new TCollection_HAsciiString (lab);
- for (Standard_Integer i = 1; i <= nb; i ++) {
- const Handle(Standard_Transient)& var = theitems.FindKey(i);
- Handle(TCollection_HAsciiString) label = ItemLabel(i);
- if (label.IsNull()) continue; // -> item supprime
- if (!str.IsNull()) { if (label->Location(str,1,label->Length()) == 0) continue; }
- sout<<"#"<<i;
- if (HasName(var)) sout<<" - Named : "<<Name(var)->ToCString()<<" - ";
- else sout<<" - (no name) - ";
- sout<<var->DynamicType()->Name()<<endl<<" "<<label->ToCString()<<endl;
- }
+ 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;
}
-// #### #### #### #### #### #### #### #### ####
-// .... 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<<": "<<nb<<" **********"<<endl;
- for (Standard_Integer i = 1; i <= nb; i ++) {
- Handle(IFSelect_GeneralModifier) modif =
- theshareout->GeneralModifier(formodel,i);
- if (!modif.IsNull()) sout<<"Modifier n0."<<i<<" : "<<modif->Label();
- if (HasName(modif)) sout << " Named as : " << Name(modif)->ToCString();
- sout<<endl;
- }
+ DeclareAndCast(IFSelect_SelectCombine,csel,sel);
+ if (ItemIdent(csel) == 0) return 0;
+ if (ItemIdent(seladd) == 0) return 0;
+ csel->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"<<endl; //sout<<Handle
- return;
- }
- sout << " ********** Selection";
- if (HasName(sel)) sout << " , Name : " << Name(sel)->ToCString();
- sout <<" **********"<<endl;
- sout<< "Label : " << sel->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<<" -- "<<newsel->Label()<<endl;
+ 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;
+ }
}
- sout << " Nb Inputs:"<<nb<<endl;
+ return Standard_True;
}
-// ##########################################
-// ######### Fonctions complementaires
-// ##########################################
-
-// #### #### #### #### #### #### #### #### ####
-// .... DumpModel ....
-
//=======================================================================
//function :
//purpose :
//purpose :
//=======================================================================
-Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveList
- (const Handle(Standard_Transient)& obj) const
+Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveList (const Handle(Standard_Transient)& obj) const
{
// Deja une liste
DeclareAndCast(TColStd_HSequenceOfTransient,list,obj);
//purpose :
//=======================================================================
-Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveList
- (const Standard_CString first, const Standard_CString second) const
+Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveList (const Standard_CString first, const Standard_CString second) const
{
Handle(TColStd_HSequenceOfTransient) list;
if (!first || first[0] == '\0') return list;
//purpose :
//=======================================================================
-Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveListFromList
- (const Standard_CString selname, const Handle(Standard_Transient)& ent) const
+Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveListFromList (const Standard_CString selname, const Handle(Standard_Transient)& ent) const
{
Handle(TColStd_HSequenceOfTransient) list;
Standard_Integer num;
// if (selname[n] == ')') { nivp --; if (nivp <= 0) nf = n; }
if (selname[n] == ' ') { nb = n; nomsel[n] = '\0'; break; }
}
- if (nomsel[0] == '\0') return list;
+ if (nomsel[0] == '\0') return list;
+
+ Handle(IFSelect_Selection) sel = GiveSelection (nomsel);
+ if (sel.IsNull()) {
+ cout<<"Neither Entity Number/Label nor Selection :"<<nomsel<<endl;
+ return list;
+ }
+
+ if (nb > 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 <son>, status avec <dad> + 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<<"******************************************"<<endl;
+ if (use == 1) {
+ if (mode == 0) sout<<"***** General Parameters *****"<<endl;
+ } else if (use == 2) {
+ if (mode == 0) sout<<"***** Load File *****"<<endl;
+ } else if (use == 3) {
+ if (mode == 0) sout<<"***** Write File *****"<<endl;
+ } else if (use == 4) {
+ if (mode == 0) sout<<"***** Split File *****"<<endl;
+ } else if (use == 5) {
+ if (mode == 0) sout<<"***** Transfer (Read) *****"<<endl;
+ } else if (use == 6) {
+ if (mode == 0) sout<<"***** Transfer (Write) *****"<<endl;
+ }
+ if (mode == 0) sout<<"******************************************"<<endl<<endl;
+ }
+
+// Echainements particuliers (use > 0)
+ if (use == 5) {
+ TraceStatics (-2,mode);
+ if (mode == 0) sout<<endl;
+ } else if (use == 4 || use == 6) {
+ TraceStatics (-3,mode);
+ if (mode == 0) sout<<endl;
+ }
- Handle(IFSelect_Selection) sel = GiveSelection (nomsel);
- if (sel.IsNull()) {
- cout<<"Neither Entity Number/Label nor Selection :"<<nomsel<<endl;
- return list;
+// Fin
+ if (use > 0) {
+ if (mode == 0) sout<<"******************************************"<<endl<<endl;
}
+}
- if (nb > 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 **********"<<endl;
+ Standard_Integer nb = MaxIdent();
+ Handle(TCollection_HAsciiString) str;
+ if (lab[0] != '\0') str = new TCollection_HAsciiString (lab);
+ for (Standard_Integer i = 1; i <= nb; i ++) {
+ const Handle(Standard_Transient)& var = myItems.FindKey(i);
+ Handle(TCollection_HAsciiString) label = ItemLabel(i);
+ if (label.IsNull()) continue; // -> item supprime
+ if (!str.IsNull()) { if (label->Location(str,1,label->Length()) == 0) continue; }
+ sout<<"#"<<i;
+ if (HasName(var)) sout<<" - Named : "<<Name(var)->ToCString()<<" - ";
+ else sout<<" - (no name) - ";
+ sout<<var->DynamicType()->Name()<<endl<<" "<<label->ToCString()<<endl;
+ }
}
+// #### #### #### #### #### #### #### #### ####
+// .... DumpSelection ....
//=======================================================================
//function :
//purpose :
//=======================================================================
-Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveListCombined
- (const Handle(TColStd_HSequenceOfTransient)& l1,
- const Handle(TColStd_HSequenceOfTransient)& l2,
- const Standard_Integer mode) const
+void IFSelect_WorkSession::DumpSelection (const Handle(IFSelect_Selection)& sel) const
{
- Handle(TColStd_HSequenceOfTransient) list;
- if (l1.IsNull() || l2.IsNull()) return list;
-
-// mode < 0 l1-l2 = 0 l1&l2 > 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"<<endl; //sout<<Handle
+ return;
}
-
-// ents de l1 pas deja dans l2
- n = l1->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 <<" **********"<<endl;
+ sout<< "Label : " << sel->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<<" -- "<<newsel->Label()<<endl;
}
-
- list->Reverse();
- return list;
+ sout << " Nb Inputs:"<<nb<<endl;
}
-
//=======================================================================
//function :
//purpose :
//=======================================================================
-void IFSelect_WorkSession::DumpModel
- (const Standard_Integer level, const Handle(Message_Messenger)& S)
+void IFSelect_WorkSession::DumpModel (const Standard_Integer level, const Handle(Message_Messenger)& S)
{
if (!IsLoaded())
{ S<< " *** Data for List not available ***"<<endl; return; }
else S << " ******** Check Model (Complete) ********"<<endl;
Interface_CheckTool CT (Graph());
Interface_CheckIterator C;
- if (theerrhand) {
+ {
try {
OCC_CATCH_SIGNALS
- if (level == 3) C = CT.CheckList();
- else C = CT.CompleteCheckList();
+ if (level == 3) C = CT.CheckList();
+ else C = CT.CompleteCheckList();
}
catch (Standard_Failure) {
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- sout<<" **** Interruption DumpModel (Check) par Exception ****\n";
- S<<" ** ** Exception Raised during Check ! ** **\n";
- S<<" --> what could be determined is listed"<<endl;
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ sout<<" **** Interruption DumpModel (Check) par Exception ****\n";
+ S<<" ** ** Exception Raised during Check ! ** **\n";
+ S<<" --> what could be determined is listed"<<endl;
}
}
- else if (level == 3) C = CT.CheckList();
- else C = CT.CompleteCheckList();
// Check List : si vide (pas demandee), naturellement passee
try {
//purpose :
//=======================================================================
-void IFSelect_WorkSession::TraceDumpModel
- (const Standard_Integer mode)
+void IFSelect_WorkSession::TraceDumpModel (const Standard_Integer mode)
{
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ const Handle(Message_Messenger) &sout = Message::DefaultMessenger();
DumpModel (mode,sout);
-// if (mode <= 4) { DumpModel (mode,sout); return; }
-
-// else if (mode <= 7) PrintCheckList (ModelCheckList(),Standard_False, mode-5);
-// else if (mode <=10) PrintCheckList (ModelCheckList(),Standard_True , mode-8);
-}
-
-// .... DumpEntity ....
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-void IFSelect_WorkSession::DumpEntity
- (const Handle(Standard_Transient)& ent, const Standard_Integer level,
- const Handle(Message_Messenger)& S) const
-{
- if (!IsLoaded())
- { S<< " *** Data for List not available ***"<<endl; return; }
- Standard_Integer num = myModel->Number(ent);
- if (num == 0) { S<<" *** Entity to Dump not in the Model ***"<<endl; return; }
- if (thelibrary.IsNull()) { S<<" *** WorkLibrary not defined ***"<<endl; return; }
- S << " ******** Dumping Entity n0 "<<num
- <<" level:"<<level<<" ********"<<endl;
- thelibrary->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 ....
}
}
-// .... 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<<Standard_Failure::Caught()->GetMessageString();
- sout<<"\n Abandon"<<endl;
- }
- errhand = theerrhand;
- return;
- }
-
- if (!IsLoaded())
- { sout<< " *** Data for Evaluation not available ***"<<endl; return; }
- if (ItemIdent(sel) == 0)
- { sout << " Selection : Unknown"<<endl; return; } //sout<<Handle
- Interface_EntityIterator iter = EvalSelection (sel);
- ListEntities (iter,1);
- sout << "**** (Unique) RootResult, Selection : "
- <<sel->Label()<<endl;
-}
-
-
-// #### #### #### #### #### #### #### #### ####
-// .... EvaluateDispatch ....
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-void IFSelect_WorkSession::EvaluateDispatch
- (const Handle(IFSelect_Dispatch)& disp, const Standard_Integer mode) const
-{
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (errhand) {
- errhand = Standard_False;
- try {
- OCC_CATCH_SIGNALS
- EvaluateDispatch(disp,mode); // appel normal (->code unique)
- }
- catch (Standard_Failure) {
- sout<<" **** Interruption EvaluateDispatch par Exception **** Intitule\n";
- sout<<Standard_Failure::Caught()->GetMessageString();
- sout<<"\n Abandon"<<endl;
- }
- errhand = theerrhand;
- return;
- }
-
- Standard_Integer numdisp = DispatchRank(disp);
- if (!IsLoaded())
- { sout<< " *** Data for List not available ***"<<endl; return; }
- if (theshareout->NbDispatches() < numdisp || numdisp <= 0)
- { sout<<"Dispatch : Unknown"<<endl; return; } //sout<<Handle
- if (disp->FinalSelection().IsNull())
- { sout<<"Dispatch : No Final Selection"<<endl; return; }//sout<<Handle
- sout<<" --- Dispatch Label : "<<disp->Label()<<endl;
-
- IFSelect_ShareOutResult eval(disp,thegraph->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 : "<<nbpack<<" :"<<endl;
- for (numpack = 1; numpack <= nbpack; numpack ++) {
- sout<<"\n **** Packet n0 : "<<numpack<<" ****"<<endl;
- if (!mode) cout<<"Root Entities :"<<endl;
- ListEntities (evres->Entities(numpack), (mode ? 2 : -1));
- }
-
-//// Interface_EntityIterator iterem = disp->Remainder(thegraph->Graph());
- if (mode == 0) return;
- if (mode == 1 || mode == 3) {
- sout<<endl;
- if (evres->NbDuplicated(0,Standard_False) == 0)
- sout<<" **** All the Model is taken into account ****"<<endl;
- else {
- sout<<" **** Starting Entities not taken by this Dispatch ****"<<endl;
- ListEntities (evres->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"<<endl;
- else {
- Standard_Integer newcount;
- sout<<endl;
- for (newcount = 2; newcount <= max; newcount ++) {
- if (evres->NbDuplicated(newcount,Standard_False) == 0) continue;
- sout<<" **** Entities put in "<<newcount<<" packets ****"<<endl;
- ListEntities (evres->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<<Standard_Failure::Caught()->GetMessageString();
- sout<<"\n Abandon"<<endl;
- }
- errhand = theerrhand;
- return;
- }
-
- if (!IsLoaded())
- { sout<< " *** Data for List not available ***"<<endl; return; }
- IFSelect_ShareOutResult eval(theshareout,thegraph->Graph());
- eval.Evaluate();
- sout<<"\n******** Evaluation ShareOutResult (Complete) ********\n";
- sout<<" **** List of Packets **** Count : "<<eval.NbPackets()<<endl;
- if (mode == 0) sout << " ** (for each one : Root Entities) **"<<endl;
- else sout << " ** (for each one : Evaluated Content) **"<<endl;
-
- Standard_Integer numpack = 0;
- Handle(IFSelect_PacketList) evres =
- eval.Packets (mode ? Standard_True : Standard_False);
- Standard_Integer nbpack = evres->NbPackets();
-
- sout<<"Nb Packets produced : "<<nbpack<<" :"<<endl;
- for (numpack = 1; numpack <= nbpack; numpack ++) {
- sout<<"\n **** Packet n0 : "<<numpack<<" ****"<<endl;
- if (!mode) cout<<"Root Entities :"<<endl;
- ListEntities (evres->Entities(numpack), (mode ? 2: -1));
- }
- if (mode == 0) return;
- if (mode == 1 || mode == 3) {
- sout<<endl;
- if (evres->NbDuplicated(0,Standard_False) == 0)
- sout<<" **** All the Model is taken into account ****"<<endl;
- else {
- sout<<" **** Starting Entities Forgotten ****"<<endl;
- ListEntities (evres->Duplicated(0,Standard_False),2);
- }
- }
- if (mode >= 2) {
- sout<<" **** Entites in more than one packet ****"<<endl;
- Standard_Integer max = evres->HighestDuplicationCount();
- if (max < 2) sout<<" : There are none"<<endl;
- else {
- Standard_Integer newcount;
- sout<<endl;
- for (newcount = 2; newcount <= max; newcount ++) {
- if (evres->NbDuplicated(newcount,Standard_False) == 0) continue;
- sout<<" **** Entities put in "<<newcount<<" packets ****"<<endl;
- ListEntities (evres->Duplicated(newcount,Standard_False),2);
- }
- }
- }
-}
+// ##########################################
+// ######### Fonctions complementaires
+// ##########################################
// #### #### #### #### #### #### #### #### ####
// .... Routine Interne : ListEntities
sout<<"\n Abandon"<<endl;
}
}
+
+
+//=======================================================================
+//function : TransferList
+//purpose :
+//=======================================================================
+
+Standard_Integer IFSelect_WorkSession::TransferList (const Handle(TColStd_HSequenceOfTransient)& list)
+{
+ if (myModel.IsNull()) return 0;
+
+ //c1:if (myTP.IsNull()) { if (!BeginTransfer()) return 0; }
+
+ const Handle(Message_Messenger) &sout = myReaderProcess->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 "<<Interface_MSG::Blanks(nb,5)<<" Entities ******"<<endl;
+ sout<<"\n*******************************************************************\n";
+
+ Handle(IFSelect_SignatureList) sl = new IFSelect_SignatureList;
+ for (i = 1; i <= nb; i ++)
+ sl->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 ******"<<endl;
+ if (!lab.IsNull())
+ sout<<"****** N0 in file : "<<Interface_MSG::Blanks(num,5)<<num
+ <<" Ident : "<<lab->ToCString()
+ <<Interface_MSG::Blanks(14 - lab->Length())<<"******\n";
+ sout<<"****** Type : "<<myModel->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;
+}
-// 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.
#ifndef _IFSelect_WorkSession_HeaderFile
#define _IFSelect_WorkSession_HeaderFile
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
+#include <XSControl_WorkSession.hxx>
-#include <Standard_Boolean.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <Interface_CheckIterator.hxx>
#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
-#include <MMgt_TShared.hxx>
-#include <NCollection_Vector.hxx>
-#include <Standard_CString.hxx>
-#include <IFSelect_ReturnStatus.hxx>
-#include <Standard_Integer.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-#include <Standard_Type.hxx>
-#include <TColStd_HSequenceOfHAsciiString.hxx>
-#include <IFSelect_RemainMode.hxx>
-#include <TColStd_SequenceOfTransient.hxx>
-#include <TColStd_SequenceOfInteger.hxx>
#include <IFSelect_PrintCount.hxx>
-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
//! 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 <clearpointed> 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;
//! If <val> 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 <ent>, as the Model does
- //! If <ent> 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
//! 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 <enforce> 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 <ent> (can be empty)
//! Returns a null Handle if <ent> is unknown
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Shareds (const Handle(Standard_Transient)& ent);
//! Returns a null Handle if <ent> 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 <enforce> 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 :
- //! <complete> = True : complete (syntactic & semantic messages),
- //! computed if not yet done
- //! <complete> = 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 <ent> is Null or equates the current Model, it gives the
//! <complete> 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 <item> 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 <item> is already recorded (and returns its attached Ident)
+ //! Remark : the determined Ident is used if <item> 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 <item> is null
+ //! If <name> is empty, works as AddItem (i.e. with no name)
+ //! If <item> 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 <id> 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 <id>, or ZERO
+ //!
+ //! The search must start with <id> = 0, it returns the next Ident
+ //! which matches. To iterate, call again this method which this
+ //! returned value as <id>. Once an Ident has been returned, the
+ //! Item can be obtained by the method Item
+ //!
+ //! <mode> precises the required matching mode :
+ //! - 0 (Default) : <label> must match exactly with the Item Label
+ //! - 1 : <label> must match the exact beginning (the end is free)
+ //! - 2 : <label> must be at least once wherever in the Item Label
+ //! - other values are ignored
+ Standard_EXPORT Standard_Integer NextIdentForLabel (const Standard_CString label, const Standard_Integer id, const Standard_Integer mode = 0) const;
//! Returns the Maximum Value for an Item Identifier. It can be
//! greater to the count of known Items, because some can have
//! Returns the Ident attached to a Name, 0 if name not recorded
Standard_EXPORT Standard_Integer NameIdent (const Standard_CString name) const;
- //! 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 <item> 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 <item> is already recorded (and returns its attached Ident)
- //! <active> if True commands call to SetActive (see below)
- //! Remark : the determined Ident is used if <item> is a Dispatch,
- //! to fill the ShareOut
- Standard_EXPORT Standard_Integer AddItem (const Handle(Standard_Transient)& item, const Standard_Boolean active = Standard_True);
-
- //! 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 <item> is null
- //! If <name> is empty, works as AddItem (i.e. with no name)
- //! If <item> is already known but with no attached Name, this
- //! method tries to attached a Name to it
- //! <active> if True commands call to SetActive (see below)
- Standard_EXPORT Standard_Integer AddNamedItem (const Standard_CString name, const Handle(Standard_Transient)& item, const Standard_Boolean active = Standard_True);
-
- //! Following the type of <item> :
- //! - Dispatch : Adds or Removes it in the ShareOut & FileNaming
- //! - GeneralModifier : Adds or Removes it for final sending
- //! (i.e. in the ModelCopier)
- //! Returns True if it did something, False else (state unchanged)
- Standard_EXPORT Standard_Boolean SetActive (const Handle(Standard_Transient)& item, const Standard_Boolean mode);
-
- //! Removes an Item from the Session, given its Name
- //! Returns True if Done, False else (Name not recorded)
- //! (Applies only on Item which are Named)
- Standard_EXPORT Standard_Boolean RemoveNamedItem (const Standard_CString name);
-
- //! Removes a Name without removing the Item
- //! Returns True if Done, False else (Name not recorded)
- Standard_EXPORT Standard_Boolean RemoveName (const Standard_CString name);
-
- //! Removes an Item given its Ident. Returns False if <id> 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);
-
//! Clears all the recorded Items : Selections, Dispatches,
//! Modifiers, and Strings & IntParams, with their Idents & Names.
//! Remark that if a Model has been loaded, it is not cleared.
- Standard_EXPORT void ClearItems();
+ Standard_EXPORT void ClearItems ();
//! Returns a Label which illustrates the content of an Item,
//! given its Ident. This Label is :
//! Idents which are suitable in the WorkSession
Standard_EXPORT Handle(TColStd_HSequenceOfInteger) ItemIdents (const Handle(Standard_Type)& type) const;
- //! Fills a Sequence with the list of the Names attached to Items
- //! of which Type complies with (IsKind) <type> (alphabetic order)
- //! Remark : <type> = TYPE(Standard_Transient) gives all the Names
- Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) ItemNames (const Handle(Standard_Type)& type) const;
-
- //! Fills a Sequence with the NAMES of the control items, of which
- //! the label matches <label> (contain it) : see NextIdentForLabel
- //! Search mode is fixed to "contained"
- //! If <label> is empty, returns all Names
- Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) ItemNamesForLabel (const Standard_CString label) const;
-
- //! 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 <id>, or ZERO
- //!
- //! The search must start with <id> = 0, it returns the next Ident
- //! which matches. To iterate, call again this method which this
- //! returned value as <id>. Once an Ident has been returned, the
- //! Item can be obtained by the method Item
- //!
- //! <mode> precises the required matching mode :
- //! - 0 (Default) : <label> must match exactly with the Item Label
- //! - 1 : <label> must match the exact beginning (the end is free)
- //! - 2 : <label> must be at least once wherever in the Item Label
- //! - other values are ignored
- Standard_EXPORT Standard_Integer NextIdentForLabel (const Standard_CString label, const Standard_Integer id, const Standard_Integer mode = 0) const;
-
- //! Creates a parameter as being bound to a Static
- //! If the Static is Integer, this creates an IntParam bound to
- //! it by its name. Else this creates a String which is the value
- //! of the Static.
- //! Returns a null handle if <statname> is unknown as a Static
- Standard_EXPORT Handle(Standard_Transient) NewParamFromStatic (const Standard_CString statname, const Standard_CString name = "");
-
//! Returns an IntParam, given its Ident in the Session
//! Null result if <id> is not suitable for an IntParam
//! (undefined, or defined for another kind of variable)
//! Returns Integer Value of an IntParam
Standard_EXPORT Standard_Integer IntValue (const Handle(IFSelect_IntParam)& it) const;
- //! Creates a new IntParam. A Name can be set (Optional)
- //! Returns the created IntParam, or a Null Handle in case of
- //! Failure (see AddItem/AddNamedItem)
- Standard_EXPORT Handle(IFSelect_IntParam) NewIntParam (const Standard_CString name = "");
-
//! Changes the Integer Value of an IntParam
//! Returns True if Done, False if <it> is not in the WorkSession
Standard_EXPORT Standard_Boolean SetIntValue (const Handle(IFSelect_IntParam)& it, const Standard_Integer val);
//! or an empty string if <it> is not in the WorkSession
Standard_EXPORT TCollection_AsciiString TextValue (const Handle(TCollection_HAsciiString)& par) const;
- //! Creates a new (empty) TextParam. A Name can be set (Optional)
- //! Returns the created TextParam (as an HAsciiString), or a Null
- //! Handle in case of Failure (see AddItem/AddNamedItem)
- Standard_EXPORT Handle(TCollection_HAsciiString) NewTextParam (const Standard_CString name = "");
-
//! Changes the Text Value of a TextParam (an HAsciiString)
//! Returns True if Done, False if <it> is not in the WorkSession
Standard_EXPORT Standard_Boolean SetTextValue (const Handle(TCollection_HAsciiString)& par, const Standard_CString val);
//! Returned Result remains empty if no input Model has been set
Standard_EXPORT Interface_EntityIterator EvalSelection (const Handle(IFSelect_Selection)& sel) const;
- //! Returns the Selections which are source of Selection, given
- //! its rank in the List of Selections (see SelectionIterator)
- //! Returned value is empty if <num> is out of range or if
- //! <sel> is not in the WorkSession
- Standard_EXPORT IFSelect_SelectionIterator Sources (const Handle(IFSelect_Selection)& sel) const;
-
//! Returns the result of a Selection, computed by EvalSelection
//! (see above) under the form of a HSequence (hence, it can be
//! used by a frontal-engine logic). It can be empty
//! and all the chain of deductions is applied
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) SelectionResultFromList (const Handle(IFSelect_Selection)& sel, const Handle(TColStd_HSequenceOfTransient)& list) const;
- //! Sets a Selection as input for an item, according its type :
- //! if <item> is a Dispatch : as Final Selection
- //! if <item> is a GeneralModifier (i.e. any kind of Modifier) :
- //! as Selection used to filter entities to modify
- //! <sel> Null causes this Selection to be nullified
- //! Returns False if <item> is not of a suitable type, or
- //! <item> or <sel> is not in the WorkSession
- Standard_EXPORT Standard_Boolean SetItemSelection (const Handle(Standard_Transient)& item, const Handle(IFSelect_Selection)& sel);
-
- //! Resets input Selection which was set by SetItemSelection
- //! Same conditions as for SetItemSelection
- //! Returns True if done, False if <item> is not in the WorkSession
- Standard_EXPORT Standard_Boolean ResetItemSelection (const Handle(Standard_Transient)& item);
-
- //! Returns the Selection of a Dispatch or a GeneralModifier.
- //! Returns a Null Handle if none is defined or <item> not good type
- Standard_EXPORT Handle(IFSelect_Selection) ItemSelection (const Handle(Standard_Transient)& item) const;
-
//! Returns a SignCounter from its ident in the Session
//! Null result if <id> is not suitable for a SignCounter
//! (undefined, or defined for another kind of variable)
Standard_EXPORT Handle(IFSelect_SignCounter) SignCounter (const Standard_Integer id) const;
- //! Computes the content of a SignCounter when it is defined with
- //! a Selection, then returns True
- //! Returns False if the SignCounter is not defined with a
- //! Selection, or if its Selection Mode is inhibited
- //! <forced> to work around optimisations
- Standard_EXPORT Standard_Boolean ComputeCounter (const Handle(IFSelect_SignCounter)& counter, const Standard_Boolean forced = Standard_False);
-
- //! Computes the content of a SignCounter from an input list
- //! If <list> is Null, uses internal definition of the Counter :
- //! a Selection, else the whole Model (recomputation forced)
- //! If <clear> is True (D), starts from scratch
- //! Else, cumulates computations
- Standard_EXPORT Standard_Boolean ComputeCounterFromList (const Handle(IFSelect_SignCounter)& counter, const Handle(TColStd_HSequenceOfTransient)& list, const Standard_Boolean clear = Standard_True);
-
- //! Returns the ordered list of dispatches stored by the ShareOut
- Standard_EXPORT Handle(TColStd_HSequenceOfInteger) AppliedDispatches() const;
-
- //! Clears the list of Dispatches recorded by the ShareOut
- //! if <only> disp is True, tha's all. Else, clears also the lists
- //! of Modifiers recorded by the ShareOut
- Standard_EXPORT void ClearShareOut (const Standard_Boolean onlydisp);
-
- //! Returns a Dispatch, given its Ident in the Session
- //! Null result if <id> is not suitable for a Dispatch
- //! (undefined, or defined for another kind of variable)
- Standard_EXPORT Handle(IFSelect_Dispatch) Dispatch (const Standard_Integer id) const;
-
- //! Returns the rank of a Dispatch in the ShareOut, or 0 if <disp>
- //! is not in the ShareOut or not in the WorkSession
- Standard_EXPORT Standard_Integer DispatchRank (const Handle(IFSelect_Dispatch)& disp) const;
-
- //! Gives access to the complete ModelCopier
- const Handle(IFSelect_ModelCopier) & ModelCopier() const
- { return thecopier; }
-
- //! Sets a new ModelCopier. Fills Items which its content
- Standard_EXPORT void SetModelCopier (const Handle(IFSelect_ModelCopier)& copier);
-
- //! Returns the count of Modifiers applied to final sending
- //! Model Modifiers if <formodel> is True, File Modifiers else
- //! (i.e. Modifiers which apply once the Models have been filled)
- Standard_EXPORT Standard_Integer NbFinalModifiers (const Standard_Boolean formodel) const;
-
- //! Fills a Sequence with a list of Idents, those attached to
- //! the Modifiers applied to final sending.
- //! Model Modifiers if <formodel> is True, File Modifiers else
- //! This list is given in the order in which they will be applied
- //! (which takes into account the Changes to Modifier Ranks)
- Standard_EXPORT Handle(TColStd_HSequenceOfInteger) FinalModifierIdents (const Standard_Boolean formodel) const;
-
- //! Returns a Modifier, given its Ident in the Session
- //! Null result if <id> is not suitable for a Modifier
- //! (undefined, or defined for another kind of variable)
- Standard_EXPORT Handle(IFSelect_GeneralModifier) GeneralModifier (const Standard_Integer id) const;
-
- //! Returns a Model Modifier, given its Ident in the Session,
- //! i.e. typed as a Modifier (not simply a GeneralModifier)
- //! Null result if <id> is not suitable for a Modifier
- //! (undefined, or defined for another kind of variable)
- Standard_EXPORT Handle(IFSelect_Modifier) ModelModifier (const Standard_Integer id) const;
-
- //! Returns the Rank of a Modifier given its Ident. Model or File
- //! Modifier according its type (ModelModifier or not)
- //! Remember that Modifiers are applied sequencially following
- //! their Rank : first Model Modifiers then File Modifiers
- //! Rank is given by rank of call to AddItem and can be
- //! changed by ChangeModifierRank
- Standard_EXPORT Standard_Integer ModifierRank (const Handle(IFSelect_GeneralModifier)& item) const;
-
- //! Changes the Rank of a Modifier in the Session :
- //! Model Modifiers if <formodel> is True, File Modifiers else
- //! the Modifier n0 <before> is put to n0 <after>
- //! Return True if Done, False if <before> or <after> out of range
- Standard_EXPORT Standard_Boolean ChangeModifierRank (const Standard_Boolean formodel, const Standard_Integer before, const Standard_Integer after);
-
- //! Removes all the Modifiers active in the ModelCopier : they
- //! become inactive and they are removed from the Session
- Standard_EXPORT void ClearFinalModifiers();
-
- //! Sets a GeneralModifier to be applied to an item :
- //! - item = ShareOut : applies for final sending (all dispatches)
- //! - item is a Dispatch : applies for this dispatch only
- //! Returns True if done, False if <modif> or <item> not in <me>
- Standard_EXPORT Standard_Boolean SetAppliedModifier (const Handle(IFSelect_GeneralModifier)& modif, const Handle(Standard_Transient)& item);
-
- //! Resets a GeneralModifier to be applied
- //! Returns True if done, False if <modif> was not applied
- Standard_EXPORT Standard_Boolean ResetAppliedModifier (const Handle(IFSelect_GeneralModifier)& modif);
-
- //! Returns the item on which a GeneralModifier is applied :
- //! the ShareOut, or a given Dispatch
- //! Returns a Null Handle if <modif> is not applied
- Standard_EXPORT Handle(Standard_Transient) UsesAppliedModifier (const Handle(IFSelect_GeneralModifier)& modif) const;
-
- //! Returns a Transformer, given its Ident in the Session
- //! Null result if <id> is not suitable for a Transformer
- //! (undefined, or defined for another kind of variable)
- Standard_EXPORT Handle(IFSelect_Transformer) Transformer (const Standard_Integer id) const;
-
- //! Runs a Transformer on starting Model, which can then be edited
- //! or replaced by a new one. The Protocol can also be changed.
- //! Fills LastRunCheckList
- //!
- //! Returned status is 0 if nothing done (<transf> or model
- //! undefined), positive if OK, negative else :
- //! 0 : Nothing done
- //! 1 : OK, edition on the spot with no change to the graph
- //! of dependances (purely local)
- //! 2 : OK, model edited on the spot (graph recomputed, may
- //! have changed), protocol unchanged
- //! 3 : OK, new model produced, same protocol
- //! 4 : OK, model edited on the spot (graph recomputed),
- //! but protocol has changed
- //! 5 : OK, new model produced, protocol has changed
- //! -1 : Error on the spot (slight changes), data may be corrupted
- //! (remark : corruption should not be profound)
- //! -2 : Error on edition the spot, data may be corrupted
- //! (checking them is recommanded)
- //! -3 : Error with a new data set, transformation ignored
- //! -4 : OK as 4, but graph of dependances count not be recomputed
- //! (the former one is kept) : check the protocol
- Standard_EXPORT Standard_Integer RunTransformer (const Handle(IFSelect_Transformer)& transf);
-
- //! Runs a Modifier on Starting Model. It can modify entities, or
- //! add new ones. But the Model or the Protocol is unchanged.
- //! The Modifier is applied on each entity of the Model. See also
- //! RunModifierSelected
- //! Fills LastRunCheckList
- //!
- //! <copy> : if True, a new data set is produced which brings
- //! the modifications (Model + its Entities)
- //! if False, data are modified on the spot
- //!
- //! It works through a TransformStandard defined with <modif>
- //! Returned status as RunTransformer : 0 nothing done, >0 OK,
- //! <0 problem, but only between -3 and 3 (protocol unchanged)
- //! Remark : <copy> True will give <effect> = 3 or -3
- Standard_EXPORT Standard_Integer RunModifier (const Handle(IFSelect_Modifier)& modif, const Standard_Boolean copy);
-
- //! Acts as RunModifier, but the Modifier is applied on the list
- //! determined by a Selection, rather than on the whole Model
- //! If the selection is a null handle, the whole model is taken
- Standard_EXPORT Standard_Integer RunModifierSelected (const Handle(IFSelect_Modifier)& modif, const Handle(IFSelect_Selection)& sel, const Standard_Boolean copy);
-
- //! Creates and returns a TransformStandard, empty, with its
- //! Copy Option (True = Copy, False = On the Spot) and an
- //! optional name.
- //! To a TransformStandard, the method SetAppliedModifier applies
- Standard_EXPORT Handle(IFSelect_Transformer) NewTransformStandard (const Standard_Boolean copy, const Standard_CString name = "");
-
- //! Defines a new content from the former one
- //! If <keep> is True, it is given by entities selected by
- //! Selection <sel> (and all shared entities)
- //! Else, it is given by all the former content but entities
- //! selected by the Selection <sel> (and properly shared ones)
- //! Returns True if done. Returns False if the selected list
- //! (from <sel>) is empty, hence nothing is done
- Standard_EXPORT Standard_Boolean SetModelContent (const Handle(IFSelect_Selection)& sel, const Standard_Boolean keep);
-
- //! Returns the defined File Prefix. Null Handle if not defined
- Standard_EXPORT Handle(TCollection_HAsciiString) FilePrefix() const;
-
- //! Returns the defined Default File Root. It is used for
- //! Dispatches which have no specific root attached.
- //! Null Handle if not defined
- Standard_EXPORT Handle(TCollection_HAsciiString) DefaultFileRoot() const;
-
- //! Returns the defined File Extension. Null Handle if not defined
- Standard_EXPORT Handle(TCollection_HAsciiString) FileExtension() const;
-
- //! Returns the File Root defined for a Dispatch. Null if no
- //! Root Name is defined for it (hence, no File will be produced)
- Standard_EXPORT Handle(TCollection_HAsciiString) FileRoot (const Handle(IFSelect_Dispatch)& disp) const;
-
- //! Defines a File Prefix
- Standard_EXPORT void SetFilePrefix (const Standard_CString name);
-
- //! Defines a Default File Root Name. Clears it is <name> = ""
- //! Returns True if OK, False if <name> already set for a Dispatch
- Standard_EXPORT Standard_Boolean SetDefaultFileRoot (const Standard_CString name);
-
- //! Defines a File Extension
- Standard_EXPORT void SetFileExtension (const Standard_CString name);
-
- //! Defines a Root for a Dispatch
- //! If <name> is empty, clears Root Name
- //! This has as effect to inhibit the production of File by <disp>
- //! Returns False if <disp> is not in the WorkSession or if a
- //! root name is already defined for it
- Standard_EXPORT Standard_Boolean SetFileRoot (const Handle(IFSelect_Dispatch)& disp, const Standard_CString name);
-
- //! Erases all stored data from the File Evaluation
- //! (i.e. ALL former naming informations are lost)
- Standard_EXPORT void ClearFile();
-
- //! Performs and stores a File Evaluation. The Results are a List
- //! of produced Models and a List of names (Strings), in parallel
- //! Fills LastRunCheckList
- Standard_EXPORT void EvaluateFile();
-
- //! Returns the count of produced Models
- Standard_EXPORT Standard_Integer NbFiles() const;
-
- //! Returns a Model, given its rank in the Evaluation List
- Standard_EXPORT Handle(Interface_InterfaceModel) FileModel (const Standard_Integer num) const;
-
- //! Returns the name of a file corresponding to a produced Model,
- //! given its rank in the Evaluation List
- Standard_EXPORT TCollection_AsciiString FileName (const Standard_Integer num) const;
-
- //! Commands file sending to clear the list of already sent files,
- //! commands to record a new one if <record> is True
- //! This list is managed by the ModelCopier when SendSplit is called
- //! It allows a global exploitation of the set of sent files
- Standard_EXPORT void BeginSentFiles (const Standard_Boolean record);
-
- //! Returns the list of recorded sent files, or a Null Handle is
- //! recording has not been enabled
- Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) SentFiles() const;
-
- //! Performs creation of derived files from the input Model
- //! Takes its data (sub-models and names), from result EvaluateFile
- //! if active, else by dynamic Evaluation (not stored)
- //! After SendSplit, result of EvaluateFile is Cleared
- //! Fills LastRunCheckList
- //!
- //! Works with the WorkLibrary which acts on specific type of Model
- //! and can work with File Modifiers (managed by the Model Copier)
- //! and a ModelCopier, which can work with Model Modifiers
- //! Returns False if, either WorkLibrary has failed on at least
- //! one sub-file, or the Work Session is badly conditionned
- //! (no Model defined, or FileNaming not in phase with ShareOut)
- Standard_EXPORT Standard_Boolean SendSplit();
-
- //! Returns an Evaluation of the whole ShareOut definition : i.e.
- //! how the entities of the starting model are forecast to be sent
- //! to various files : list of packets according the dispatches,
- //! effective lists of roots for each packet (which determine the
- //! content of the corresponding file); plus evaluation of which
- //! entities are : forgotten (sent into no file), duplicated (sent
- //! into more than one file), sent into a given file.
- //! See the class PacketList for more details.
- Standard_EXPORT Handle(IFSelect_PacketList) EvalSplit() const;
-
//! Returns the list of Entities sent in files, accourding the
//! count of files each one has been sent (these counts are reset
- //! by SetModel or SetRemaining(Forget) ) stored in Graph Status
+ //! by SetModel ) stored in Graph Status
//! <count> = -1 (default) is for ENtities sent at least once
//! <count> = 0 is for the Remaining List (entities not yet sent)
//! <count> = 1 is for entities sent in one and only one file
//! Graph Status is 0 for Remaining Entity, <count> for Sent into
//! <count> files
//! This status is set to 0 (not yet sent) for all by SetModel
- //! and by SetRemaining(mode=Forget,Display)
Standard_EXPORT Interface_EntityIterator SentList (const Standard_Integer count = -1) const;
- //! Returns the greater count of different files in which any of
- //! the starting entities could be sent.
- //! Before any file output, this count is 0.
- //! Ideal count is 1. More than 1 means that duplications occur.
- Standard_EXPORT Standard_Integer MaxSendingCount() const;
-
- //! Processes Remaining data (after having sent files), mode :
- //! Forget : forget remaining info (i.e. clear all "Sent" status)
- //! Compute : compute and keep remaining (does nothing if :
- //! remaining is empty or if no files has been sent)
- //! Display : display entities recorded as remaining
- //! Undo : restore former state of data (after Remaining(1) )
- //! Returns True if OK, False else (i.e. mode = 2 and Remaining
- //! List is either empty or takes all the entities, or mode = 3
- //! and no former computation of remaining data was done)
- Standard_EXPORT Standard_Boolean SetRemaining (const IFSelect_RemainMode mode);
-
- //! Sends the starting Model into one file, without splitting,
- //! managing remaining data or anything else.
- //! <computegraph> true commands the Graph to be recomputed before
- //! sending : required when a Model is filled in several steps
- //!
- //! The Model and File Modifiers recorded to be applied on sending
- //! files are.
- //! Returns a status of execution :
- //! Done if OK,
- //! Void if no data available,
- //! Error if errors occured (work library is not defined), errors
- //! during translation
- //! Fail if exception during translation is raised
- //! Stop if no disk space or disk, file is write protected
- //! Fills LastRunCheckList
- Standard_EXPORT IFSelect_ReturnStatus SendAll (const Standard_CString filename, const Standard_Boolean computegraph = Standard_False);
-
- //! Sends a part of the starting Model into one file, without
- //! splitting. But remaining data are managed.
- //! <computegraph> true commands the Graph to be recomputed before
- //! sending : required when a Model is filled in several steps
- //!
- //! The Model and File Modifiers recorded to be applied on sending
- //! files are.
- //! Returns a status : Done if OK, Fail if error during send,
- //! Error : WorkLibrary not defined, Void : selection list empty
- //! Fills LastRunCheckList
- Standard_EXPORT IFSelect_ReturnStatus SendSelected (const Standard_CString filename, const Handle(IFSelect_Selection)& sel, const Standard_Boolean computegraph = Standard_False);
-
- //! Writes the current Interface Model globally to a File, and
- //! returns a write status which can be :
- //! Done OK, Fail file could not be written, Error no norm is selected
- //! Remark : It is a simple, one-file writing, other operations are
- //! available (such as splitting ...) which calls SendAll
- Standard_EXPORT IFSelect_ReturnStatus WriteFile (const Standard_CString filename);
-
- //! Writes a sub-part of the current Interface Model to a File,
- //! as defined by a Selection <sel>, recomputes the Graph, and
- //! returns a write status which can be :
- //! Done OK, Fail file could not be written, Error no norm is selected
- //! Remark : It is a simple, one-file writing, other operations are
- //! available (such as splitting ...) which calls SendSelected
- Standard_EXPORT IFSelect_ReturnStatus WriteFile (const Standard_CString filename, const Handle(IFSelect_Selection)& sel);
-
- //! Returns the count of Input Selections known for a Selection,
- //! or 0 if <sel> not in the WorkSession. This count is one for a
- //! SelectDeduct / SelectExtract kind, two for SelectControl kind,
- //! variable for a SelectCombine (Union/Intersection), zero else
- Standard_EXPORT Standard_Integer NbSources (const Handle(IFSelect_Selection)& sel) const;
-
- //! Returns the <num>th Input Selection of a Selection
- //! (see NbSources).
- //! Returns a Null Handle if <sel> is not in the WorkSession or if
- //! <num> is out of the range <1-NbSources>
- //! To obtain more details, see the method Sources
- Standard_EXPORT Handle(IFSelect_Selection) Source (const Handle(IFSelect_Selection)& sel, const Standard_Integer num = 1) const;
-
//! Returns True if <sel> a Reversed SelectExtract, False else
Standard_EXPORT Standard_Boolean IsReversedSelectExtract (const Handle(IFSelect_Selection)& sel) const;
//! GiveList
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GiveListFromList (const Standard_CString selname, const Handle(Standard_Transient)& ent) const;
- //! Combines two lists and returns the result, according to mode :
- //! <mode> < 0 : entities in <l1> AND NOT in <l2>
- //! <mode> = 0 : entities in <l1> AND in <l2>
- //! <mode> > 0 : entities in <l1> OR in <l2>
- Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GiveListCombined (const Handle(TColStd_HSequenceOfTransient)& l1, const Handle(TColStd_HSequenceOfTransient)& l2, const Standard_Integer mode) const;
-
- //! Loads data from a check iterator to query status on it
- Standard_EXPORT void QueryCheckList (const Interface_CheckIterator& chl);
-
- //! Determines check status for an entity regarding last call to
- //! QueryCheckList :
- //! -1 : <ent> unknown in the model, ignored
- //! 0 : no check at all, immediate or inherited thru Graph
- //! 1 : immediate warning (no fail), no inherited check
- //! 2 : immediate fail, no inherited check
- //! +10 : idem but some inherited warning (no fail)
- //! +20 : idem but some inherited fail
- Standard_EXPORT Standard_Integer QueryCheckStatus (const Handle(Standard_Transient)& ent) const;
-
//! Determines if <entdad> is parent of <entson> (in the graph),
//! returns : -1 if no; 0 if <entdad> = <entson>
//! 1 if immediate parent, > 1 if parent, gives count of steps
Standard_EXPORT Standard_Integer QueryParent (const Handle(Standard_Transient)& entdad, const Handle(Standard_Transient)& entson) const;
- //! Sets a list of Parameters, i.e. TypedValue, to be handled
- //! through an Editor
- //! The two lists are parallel, if <params> is longer than <uses>,
- //! surnumeral parameters are for general use
- //!
- //! EditForms are created to handle these parameters (list, edit)
- //! on the basis of a ParamEditor xst-params-edit
- //!
- //! A use number dispatches the parameter to a given EditForm
- //! EditForms are defined as follows
- //! Name Use Means
- //! xst-params all All Parameters (complete list)
- //! xst-params-general 1 Generals
- //! xst-params-load 2 LoadFile (no Transfer)
- //! xst-params-send 3 SendFile (Write, no Transfer)
- //! xst-params-split 4 Split
- //! xst-param-read 5 Transfer on Reading
- //! xst-param-write 6 Transfer on Writing
- Standard_EXPORT void SetParams (const NCollection_Vector<Handle(Standard_Transient)>& params, const NCollection_Vector<Standard_Integer>& uselist);
-
//! Traces the Statics attached to a given use number
//! If <use> is given positive (normal), the trace is embedded
//! with a header and a trailer
//! Remark : use numbers 4 and 6 command use -3 to be traced
Standard_EXPORT void TraceStatics (const Standard_Integer use, const Standard_Integer mode = 0) const;
- //! Dumps contents of the ShareOut (on "cout")
- Standard_EXPORT void DumpShare() const;
-
//! Lists the Labels of all Items of the WorkSession
//! If <label> is defined, lists labels which contain it
Standard_EXPORT void ListItems (const Standard_CString label = "") const;
- //! Lists the Modifiers of the session (for each one, displays
- //! its Label). Listing is done following Ranks (Modifiers are
- //! invoked following their ranks)
- //! Model Modifiers if <formodel> is True, File Modifiers else
- Standard_EXPORT void ListFinalModifiers (const Standard_Boolean formodel) const;
-
//! Lists a Selection and its Sources (see SelectionIterator),
//! given its rank in the list
Standard_EXPORT void DumpSelection (const Handle(IFSelect_Selection)& sel) const;
//! defined Default Trace File (default is standard output)
Standard_EXPORT void TraceDumpModel (const Standard_Integer mode);
- //! Dumps a starting entity according to the current norm.
- //! To do this, it calls DumpEntity from WorkLibrary.
- //! <level> is to be interpreted for each norm : see specific
- //! classes of WorkLibrary for it. Generally, 0 if for very basic
- //! (only type ...), greater values give more and more details.
- Standard_EXPORT void DumpEntity (const Handle(Standard_Transient)& ent, const Standard_Integer level, const Handle(Message_Messenger)& S) const;
-
//! Prints main informations about an entity : its number, type,
//! validity (and checks if any), category, shareds and sharings..
//! mutable because it can recompute checks as necessary
Standard_EXPORT void PrintEntityStatus (const Handle(Standard_Transient)& ent, const Handle(Message_Messenger)& S);
- //! Dumps an entity from the current Model as inherited DumpEntity
- //! on currently defined Default Trace File
- //! (<level> interpreted according to the Norm, see WorkLibrary)
- Standard_EXPORT void TraceDumpEntity (const Handle(Standard_Transient)& ent, const Standard_Integer level) const;
-
//! Prints a CheckIterator to the current Trace File, controlled
//! with the current Model
//! complete or fails only, according to <failsonly>
//! 3 : as 2 but with labels of entities
Standard_EXPORT void PrintCheckList (const Interface_CheckIterator& checklist, const Standard_Boolean failsonly, const IFSelect_PrintCount mode) const;
- //! Prints a SignatureList to the current Trace File, controlled
- //! with the current Model
- //! <mode> defines the mode of printing (see SignatureList)
- Standard_EXPORT void PrintSignatureList (const Handle(IFSelect_SignatureList)& signlist, const IFSelect_PrintCount mode) const;
-
- //! Displays the list of Entities selected by a Selection (i.e.
- //! the result of EvalSelection).
- Standard_EXPORT void EvaluateSelection (const Handle(IFSelect_Selection)& sel) const;
-
- //! Displays the result of applying a Dispatch on the input Model
- //! (also shows Remainder if there is)
- //! <mode> = 0 (default), displays nothing else
- //! <mode> = 1 : displays also duplicated entities (because of
- //! this dispatch)
- //! <mode> = 2 : displays the entities of the starting Model
- //! which are not taken by this dispatch (forgotten entities)
- //! <mode> = 3 : displays both duplicated and forgotten entities
- //! Remark : EvaluateComplete displays these data evaluated for
- //! for all the dispatches, if there are several
- Standard_EXPORT void EvaluateDispatch (const Handle(IFSelect_Dispatch)& disp, const Standard_Integer mode = 0) const;
-
- //! Displays the effect of applying the ShareOut on the input
- //! Model.
- //! <mode> = 0 (default) : displays only roots for each packet,
- //! <mode> = 1 : displays all entities for each packet, plus
- //! duplicated entities
- //! <mode> = 2 : same as <mode> = 1, plus displays forgotten
- //! entities (which are in no packet at all)
- Standard_EXPORT void EvaluateComplete (const Standard_Integer mode = 0) const;
-
//! Internal method which displays an EntityIterator
//! <mode> 0 gives short display (only entity numbers)
//! 1 gives a more complete trace (1 line per Entity)
//! (can be used each time a trace has to be output from a list)
//! 2 gives a form suitable for givelist : (n1,n2,n3...)
Standard_EXPORT void ListEntities (const Interface_EntityIterator& iter, const Standard_Integer mode) const;
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_WorkSession,MMgt_TShared)
-
- protected:
-
- Handle(Interface_HGraph) thegraph;
- Interface_CheckIterator thecheckrun;
- TColStd_IndexedDataMapOfTransientTransient theitems;
- Handle(Dico_DictionaryOfTransient) thenames;
+
+ //! Commands the transfer on reading for a list of entities to
+ //! data for Imagine, using the selected Actor for Read
+ //! Returns count of transferred entities, ok or with fails (0/1)
+ //! The results are recorded by RecordResult
+ Standard_EXPORT Standard_Integer TransferList (const Handle(TColStd_HSequenceOfTransient)& theList);
+
+ const Handle(IFSelect_Vars) & Vars () const { return myVars; }
+
+ void SetVars (const Handle(IFSelect_Vars)& theVars) { myVars = theVars; }
+
+ DEFINE_STANDARD_RTTIEXT(IFSelect_WorkSession,XSControl_WorkSession)
private:
+
+ //! 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;
+
+ //! Returns the Check List for the Model currently loaded,
+ //! (syntactic & semantic messages), computed if not yet done
+ Standard_EXPORT Interface_CheckIterator ModelCheckList ();
- Standard_Boolean theerrhand;
- Handle(IFSelect_ShareOut) theshareout;
- Handle(IFSelect_WorkLibrary) thelibrary;
- Handle(Interface_Protocol) theprotocol;
- Handle(Interface_InterfaceModel) myModel;
- TCollection_AsciiString theloaded;
- Handle(Interface_GTool) thegtool;
- Standard_Boolean thecheckdone;
- Interface_CheckIterator thechecklist;
- TCollection_AsciiString thecheckana;
- Handle(IFSelect_ModelCopier) thecopier;
- Handle(Interface_InterfaceModel) theoldel;
- Standard_Boolean themodelstat;
+ TColStd_IndexedDataMapOfTransientTransient myItems;
+ Handle(Dico_DictionaryOfTransient) myNames;
+ Handle(IFSelect_Vars) myVars;
};
#endif // _IFSelect_WorkSession_HeaderFile
#include <XCAFDoc_LayerTool.hxx>
#include <XCAFDoc_ShapeMapTool.hxx>
#include <XCAFDoc_ShapeTool.hxx>
-#include <XSControl_TransferReader.hxx>
#include <XSControl_WorkSession.hxx>
//=======================================================================
// added by skl 13.10.2003
const Handle(Interface_InterfaceModel) &Model = WS()->Model();
- const Handle(XSControl_TransferReader) &TR = WS()->TransferReader();
- const Handle(Transfer_TransientProcess) &TP = TR->TransientProcess();
+ const Handle(Transfer_TransientProcess) &TP = WS()->ReaderProcess();
Standard_Boolean IsCTool = Standard_True;
Handle(XCAFDoc_ColorTool) CTool = XCAFDoc_DocumentTool::ColorTool(doc->Main());
if(CTool.IsNull()) IsCTool = Standard_False;
Standard_Boolean IGESCAFControl_Reader::Perform (const Standard_CString filename,
Handle(TDocStd_Document) &doc)
{
- if ( ReadFile ( filename ) != IFSelect_RetDone ) return Standard_False;
+ if ( ReadFile ( filename ) != Interface_RetDone ) return Standard_False;
return Transfer ( doc );
}
//purpose :
//=======================================================================
-IGESCAFControl_Writer::IGESCAFControl_Writer () :
- myColorMode( Standard_True ),
- myNameMode ( Standard_True ),
- myLayerMode( Standard_True )
-{
-}
-
-//=======================================================================
-//function : IGESCAFControl_Writer
-//purpose :
-//=======================================================================
-
-IGESCAFControl_Writer::IGESCAFControl_Writer (const Handle(XSControl_WorkSession)& WS,
- const Standard_Boolean /*scratch*/ )
+IGESCAFControl_Writer::IGESCAFControl_Writer (const Handle(XSControl_WorkSession)& WS)
+: myColorMode( Standard_True ),
+ myNameMode ( Standard_True ),
+ myLayerMode( Standard_True )
{
// this code does things in a wrong way, it should be vice-versa
WS->SetModel ( Model() );
- WS->SetMapWriter ( TransferProcess() );
- myColorMode = Standard_True;
- myNameMode = Standard_True;
- myLayerMode = Standard_True;
-
-// SetWS (WS,scratch); // this should be the only required command here
+ WS->SetWriterProcess ( TransferProcess() );
}
//=======================================================================
WriteNames( labels );
// refresh graph
-// WS()->ComputeGraph ( Standard_True );
ComputeModel();
return Standard_True;
}
-
-//=======================================================================
-//function : Perform
-//purpose :
-//=======================================================================
-
-Standard_Boolean IGESCAFControl_Writer::Perform (const Handle(TDocStd_Document) &doc,
- const Standard_CString filename)
-{
- if ( ! Transfer ( doc ) ) return Standard_False;
- return Write ( filename ) == IFSelect_RetDone;
-}
-
+
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
-Standard_Boolean IGESCAFControl_Writer::Perform (const Handle(TDocStd_Document) &doc,
- const TCollection_AsciiString &filename)
+Standard_Boolean IGESCAFControl_Writer::Perform (const Handle(TDocStd_Document) &doc, const TCollection_AsciiString &filename)
{
- if ( ! Transfer ( doc ) ) return Standard_False;
- return Write ( filename.ToCString() ) == IFSelect_RetDone;
+ return Perform ( doc, filename.ToCString() );
}
//=======================================================================
return Standard_True;
}
-
-//=======================================================================
-//function : SetColorMode
-//purpose :
-//=======================================================================
-
-void IGESCAFControl_Writer::SetColorMode (const Standard_Boolean colormode)
-{
- myColorMode = colormode;
-}
-
-//=======================================================================
-//function : GetColorMode
-//purpose :
-//=======================================================================
-
-Standard_Boolean IGESCAFControl_Writer::GetColorMode () const
-{
- return myColorMode;
-}
-
-//=======================================================================
-//function : SetNameMode
-//purpose :
-//=======================================================================
-
-void IGESCAFControl_Writer::SetNameMode (const Standard_Boolean namemode)
-{
- myNameMode = namemode;
-}
-
-//=======================================================================
-//function : GetNameMode
-//purpose :
-//=======================================================================
-
-Standard_Boolean IGESCAFControl_Writer::GetNameMode () const
-{
- return myNameMode;
-}
-
-//=======================================================================
-//function : SetLayerMode
-//purpose :
-//=======================================================================
-
-void IGESCAFControl_Writer::SetLayerMode (const Standard_Boolean layermode)
-{
- myLayerMode = layermode;
-}
-
-//=======================================================================
-//function : GetLayerMode
-//purpose :
-//=======================================================================
-
-Standard_Boolean IGESCAFControl_Writer::GetLayerMode () const
-{
- return myLayerMode;
-}
//! Standard_Boolean namemode = writer.GetNameMode();
class IGESCAFControl_Writer : public IGESControl_Writer
{
-public:
+ public:
DEFINE_STANDARD_ALLOC
-
//! Creates a writer with an empty
//! IGES model and sets ColorMode, LayerMode and NameMode to Standard_True.
- Standard_EXPORT IGESCAFControl_Writer();
+ IGESCAFControl_Writer()
+ : myColorMode( Standard_True ),
+ myNameMode ( Standard_True ),
+ myLayerMode( Standard_True )
+ {}
//! Creates a reader tool and attaches it to an already existing Session
- //! Clears the session if it was not yet set for IGES
- Standard_EXPORT IGESCAFControl_Writer(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
+ Standard_EXPORT IGESCAFControl_Writer(const Handle(XSControl_WorkSession)& WS);
//! Transfers a document to a IGES model
//! Returns True if translation is OK
//! Transfers a document and writes it to a IGES file
//! Returns True if translation is OK
- Standard_EXPORT Standard_Boolean Perform (const Handle(TDocStd_Document)& doc, const Standard_CString filename);
-
+ Standard_Boolean Perform (const Handle(TDocStd_Document)& doc, const Standard_CString filename)
+ { return ( Transfer( doc )? Write( filename ) : Standard_False ); }
+
//! Set ColorMode for indicate write Colors or not.
- Standard_EXPORT void SetColorMode (const Standard_Boolean colormode);
-
- Standard_EXPORT Standard_Boolean GetColorMode() const;
-
+ void SetColorMode (const Standard_Boolean colormode) { myColorMode = colormode; }
+
+ Standard_Boolean GetColorMode() const { return myColorMode; }
+
//! Set NameMode for indicate write Name or not.
- Standard_EXPORT void SetNameMode (const Standard_Boolean namemode);
-
- Standard_EXPORT Standard_Boolean GetNameMode() const;
-
- //! Set LayerMode for indicate write Layers or not.
- Standard_EXPORT void SetLayerMode (const Standard_Boolean layermode);
-
- Standard_EXPORT Standard_Boolean GetLayerMode() const;
+ void SetNameMode (const Standard_Boolean namemode) { myNameMode = namemode; }
+ Standard_Boolean GetNameMode() const { return myNameMode; }
+ //! Set LayerMode for indicate write Layers or not.
+ void SetLayerMode (const Standard_Boolean layermode) { myLayerMode = layermode; }
+ Standard_Boolean GetLayerMode() const { return myLayerMode; }
-protected:
+ protected:
//! Reads colors from DECAF document and assigns them
//! to corresponding IGES entities
//! to IGES entity
Standard_EXPORT Standard_Boolean WriteNames (const TDF_LabelSequence& labels);
-
-
-
-private:
-
+ private:
//! Recursively iterates on subshapes and assigns colors
//! to faces and edges (if set)
Standard_EXPORT void MakeColors (const TopoDS_Shape& S, const XCAFPrs_DataMapOfShapeStyle& settings, XCAFPrs_DataMapOfStyleTransient& colors, TopTools_MapOfShape& Map, const XCAFPrs_Style& inherit);
-
Standard_Boolean myColorMode;
Standard_Boolean myNameMode;
Standard_Boolean myLayerMode;
-
-
};
-
-
-
-
-
-
#endif // _IGESCAFControl_Writer_HeaderFile
IGESControl_AlgoContainer.hxx
IGESControl_Controller.cxx
IGESControl_Controller.hxx
-IGESControl_FloatFormat.cxx
-IGESControl_FloatFormat.hxx
IGESControl_IGESBoundary.cxx
IGESControl_IGESBoundary.hxx
IGESControl_Reader.cxx
IGESControl_Reader.hxx
-IGESControl_Reader.lxx
IGESControl_ToolContainer.cxx
IGESControl_ToolContainer.hxx
-IGESControl_WorkLibrary.cxx
-IGESControl_WorkLibrary.hxx
IGESControl_Writer.cxx
IGESControl_Writer.hxx
"write.iges.sequence", info,
TP->GetProgress() );
- Handle(Transfer_FinderProcess) FP = Handle(Transfer_FinderProcess)::DownCast(TP);
+ Handle(Transfer_FinderProcess) FP = Handle(Transfer_FinderProcess)::DownCast(TP);
BRepToIGES_BREntity BR0; BR0.SetModel(modl); BR0.SetTransferProcess(FP);
BRepToIGESBRep_Entity BR1; BR1.SetModel(modl); BR1.SetTransferProcess(FP);
return NULL;
}
+
+Standard_Boolean IGESControl_ActorWrite::TransferModeBounds (Standard_Integer& theMin, Standard_Integer& theMax) const
+{
+ theMin = 0, theMax = 1;
+ return Standard_True;
+}
+
+Standard_CString IGESControl_ActorWrite::TransferModeHelp (const Standard_Integer theMode) const
+{
+ switch (theMode) {
+ case 0: return "Faces";
+ case 1: return "BRep";
+ default: break;
+ }
+ return "";
+}
IGESControl_ActorWrite() {}
- //! Recognizes a ShapeMapper
- Standard_EXPORT Standard_Boolean Recognize (const Handle(Standard_Transient)& start) Standard_OVERRIDE;
+ //! Recognizes a source entity
+ Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Standard_Transient)& theSource) Standard_OVERRIDE;
- //! Transfers Shape to IGES Entities
- //!
- //! ModeTrans may be : 0 -> groups of Faces
- //! or 1 -> BRep
- Standard_EXPORT Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_Process)& FP) Standard_OVERRIDE;
+ //! Transfers a source entity to IGES Entities
+ Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& theSource, const Handle(Transfer_Process)& FP) Standard_OVERRIDE;
+
+ //! Provides transfer mode bounds
+ Standard_EXPORT virtual Standard_Boolean TransferModeBounds (Standard_Integer& theMin, Standard_Integer& theMax) const Standard_OVERRIDE;
+
+ //! Returns the help string recorded for a given transfer mode
+ Standard_EXPORT virtual Standard_CString TransferModeHelp (const Standard_Integer theMode) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(IGESControl_ActorWrite,Transfer_ActorOfFinderProcess)
};
//#58 rln 28.12.98 changing default values for Global Section
//sln 14.01.2002 OCC51 : verifying whether entry model of method ActorRead is IGESDatat_IGESModel
+#include <Standard_Mutex.hxx>
+#include <OSD_OpenFile.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TopoDS_Shape.hxx>
+#include <XSAlgo.hxx>
+#include <Message_Messenger.hxx>
+#include <Interface_Macros.hxx>
+#include <Interface_Static.hxx>
+#include <Interface_CheckIterator.hxx>
+#include <Interface_ReportEntity.hxx>
+#include <IGESAppli.hxx>
+#include <IGESAppli_Protocol.hxx>
#include <IGESControl_AlgoContainer.hxx>
#include <IGESControl_Controller.hxx>
#include <IGESData.hxx>
+#include <IGESData_IGESEntity.hxx>
#include <IGESData_IGESModel.hxx>
+#include <IGESData_IGESDumper.hxx>
+#include <IGESData_IGESWriter.hxx>
#include <IGESData_Protocol.hxx>
#include <IGESData_FileProtocol.hxx>
-#include <IGESControl_WorkLibrary.hxx>
-#include <IGESAppli.hxx>
-#include <IGESAppli_Protocol.hxx>
+#include <IGESDefs.hxx>
+#include <IGESFile_Read.hxx>
#include <IGESSolid.hxx>
#include <IGESSolid_Protocol.hxx>
#include <IGESToBRep.hxx>
#include <IGESToBRep_Actor.hxx>
#include <IGESControl_ActorWrite.hxx>
-#include <Interface_Macros.hxx>
-#include <Interface_Static.hxx>
-#include <TCollection_HAsciiString.hxx>
-#include <TopoDS_Shape.hxx>
-#include <XSAlgo.hxx>
-#include <XSControl_WorkSession.hxx>
IMPLEMENT_STANDARD_RTTIEXT(IGESControl_Controller,XSControl_Controller)
+class IGESControl_FloatFormat
+{
+ Standard_Boolean thezerosup;
+ TCollection_AsciiString themainform;
+ TCollection_AsciiString theformrange;
+ Standard_Real therangemin;
+ Standard_Real therangemax;
+ public:
+ IGESControl_FloatFormat ()
+ : thezerosup (Standard_True), therangemin (0.1), therangemax (1000.)
+ {
+ const Standard_Integer digits = 12;
+ char format[20];
+ const char pourcent = '%';
+ const char point = '.';
+ Sprintf(format, "%c%d%c%dE",pourcent,digits+2,point,digits);
+ themainform.AssignCat (format);
+ Sprintf(format, "%c%d%c%df",pourcent,digits+2,point,digits);
+ theformrange.AssignCat (format);
+ }
+ //! Sets the Floatting Formats of IGESWriter to the recorded parameters
+ void Perform (IGESData_IGESWriter& writer) const
+ {
+ writer.FloatWriter().SetFormat (themainform.ToCString());
+ writer.FloatWriter().SetZeroSuppress (thezerosup);
+ if (theformrange.Length() > 0) writer.FloatWriter().SetFormatForRange
+ (theformrange.ToCString(), therangemin, therangemax);
+ }
+ //! Returns specific Label : for instance,
+ //! "Float Format [ZeroSuppress] %E [, in range R1-R2 %f]"
+ TCollection_AsciiString Label () const
+ {
+ TCollection_AsciiString lab("Float Format ");
+ if (thezerosup) lab.AssignCat(" ZeroSup ");
+ lab.AssignCat (themainform);
+ if (theformrange.Length() > 0) {
+ char mess[30];
+ lab.AssignCat (", in range ");
+ Standard_Integer convlen = Interface_FloatWriter::Convert
+ (therangemin,mess,Standard_True,therangemin/2.,therangemax*2.,"%f","%f");
+ mess[convlen] = ' '; mess[convlen+1] = '\0';
+ lab.AssignCat(mess);
+ convlen = Interface_FloatWriter::Convert
+ (therangemax,mess,Standard_True,therangemin/2.,therangemax*2.,"%f","%f");
+ mess[convlen] = ':'; mess[convlen+1] = '\0';
+ lab.AssignCat(mess);
+ lab.AssignCat(theformrange.ToCString());
+ }
+ return lab;
+ }
+};
+static const IGESControl_FloatFormat gFloatFormat;
+
//=======================================================================
-//function : IGESControl_Controller
+//function : Constructor
//purpose :
//=======================================================================
IGESControl_Controller::IGESControl_Controller (const Standard_Boolean mod)
-: XSControl_Controller ((Standard_CString ) (mod ? "FNES" : "IGES") , (Standard_CString ) (mod ? "fnes" : "iges") ),
- themode (mod)
+: XSControl_Controller ((Standard_CString ) (mod ? "FNES" : "IGES")),
+ themodefnes (mod)
{
- static Standard_Boolean init = Standard_False;
- if (!init) {
- init = Standard_True;
- IGESSolid::Init();
- IGESAppli::Init();
- }
+ SetDumpLevels (4,6);
+ SetDumpHelp (0,"Only DNum");
+ SetDumpHelp (1,"DNum, IGES Type & Form");
+ SetDumpHelp (2,"Main Directory Informations");
+ SetDumpHelp (3,"Complete Directory Part");
+ SetDumpHelp (4,"Directory + Fields (except list contents)");
+ SetDumpHelp (5,"Complete (with list contents)");
+ SetDumpHelp (6,"Complete + Transformed data");
+
+ myAdaptorProtocol = DefineProtocol();
+
+ Handle(IGESToBRep_Actor) anactiges = new IGESToBRep_Actor;
+ anactiges->SetContinuity(0);
+ myAdaptorRead = anactiges;
// -- STATICS
TraceStatic ("write.iges.header.company",2);
TraceStatic ("write.iges.unit",6);
TraceStatic ("write.iges.brep.mode",6);
+}
- myAdaptorLibrary = new IGESControl_WorkLibrary(themode);
- myAdaptorProtocol = DefineProtocol();
+//=======================================================================
+//function : ReadFile
+//purpose :
+//=======================================================================
- Handle(IGESToBRep_Actor) anactiges = new IGESToBRep_Actor;
- anactiges->SetContinuity(0);
- myAdaptorRead = anactiges;
+Standard_Integer IGESControl_Controller::ReadFile (const Standard_CString theFileName, Handle(Interface_InterfaceModel)& theModel) const
+{
+ DeclareAndCast(IGESData_Protocol,prot,myAdaptorProtocol);
- myAdaptorWrite = new IGESControl_ActorWrite;
+ Handle(IGESData_IGESModel) igesmod = new IGESData_IGESModel;
+ char* pname=(char*) theFileName;
+ Standard_Integer status = IGESFile_Read (pname,igesmod,prot);
- SetModeWrite (0,1);
- SetModeWriteHelp (0,"Faces");
- SetModeWriteHelp (1,"BRep");
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (status < 0) sout<<"File not found : "<<theFileName<<endl;
+ if (status > 0) sout<<"Error when reading file : "<<theFileName<<endl;
+ if (status == 0) theModel = igesmod;
+ else theModel.Nullify();
+ return status;
}
+//=======================================================================
+//function : WriteFile
+//purpose :
+//=======================================================================
+
+Standard_Boolean IGESControl_Controller::WriteFile (const Standard_CString theFileName, const Handle(Interface_InterfaceModel)& theModel, Interface_CheckIterator& theChecks) const
+{
+// Preparation
+ DeclareAndCast(IGESData_IGESModel,igesmod,theModel);
+ DeclareAndCast(IGESData_Protocol,prot,myAdaptorProtocol);
+ if (igesmod.IsNull() || prot.IsNull()) return Standard_False;
+
+ ofstream fout;
+ OSD_OpenStream(fout,theFileName,ios::out );
+
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (!fout) {
+ theChecks.CCheck(0)->AddFail("IGES File could not be created");
+ sout<<" - IGES File could not be created : " << theFileName << endl;
+ return 0;
+ }
+ sout<<" IGES File Name : "<<theFileName;
+
+ IGESData_IGESWriter VW(igesmod);
+ sout<<"("<<igesmod->NbEntities()<<" ents) ";
+
+// File Modifiers
+ gFloatFormat.Perform(VW);
+// (impressions de mise au point)
+ sout << " .. FileMod.1 "<< gFloatFormat.Label();
+ sout << " (all model)";
+
+// Envoi
+ VW.SendModel(prot);
+ sout<<" Write ";
+ if (themodefnes) VW.WriteMode() = 10;
+ Standard_Boolean status = VW.Print(fout);
+ sout<<" Done"<<endl;
+
+ errno = 0;
+ fout.close();
+ status = fout.good() && status && !errno;
+ if(errno)
+ sout << strerror(errno) << endl;
+
+ return status;
+}
+
+//=======================================================================
+//function : DumpEntity
+//purpose :
+//=======================================================================
+
+void IGESControl_Controller::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
+{
+ DeclareAndCast(IGESData_IGESModel,igesmod,model);
+ DeclareAndCast(IGESData_Protocol,igespro,protocol);
+ DeclareAndCast(IGESData_IGESEntity,igesent,entity);
+ if (igesmod.IsNull() || igespro.IsNull() || igesent.IsNull()) return;
+ Standard_Integer num = igesmod->Number(igesent);
+ if (num == 0) return;
+
+ S<<" --- Entity "<<num;
+ Standard_Boolean iserr = model->IsRedefinedContent(num);
+ Handle(Standard_Transient) con;
+ if (iserr) con = model->ReportEntity(num)->Content();
+ if (entity.IsNull()) { S<<" Null"<<endl; return ; }
+
+// On attaque le dump : d abord cas de l Erreur
+ if (iserr) {
+ S << " ERRONEOUS, Content, Type cdl : ";
+ if (!con.IsNull()) S << con->DynamicType()->Name();
+ else S << "(undefined)" << endl;
+ igesent = GetCasted(IGESData_IGESEntity,con);
+ con.Nullify();
+ Handle(Interface_Check) check = model->ReportEntity(num)->Check();
+ Interface_CheckIterator chlist;
+ chlist.Add (check,num);
+ chlist.Print (S,igesmod,Standard_False);
+ if (igesent.IsNull()) return;
+ }
+ else S << " Type cdl : " << igesent->DynamicType()->Name();
+
+ IGESData_IGESDumper dump(igesmod,igespro);
+ try {
+ OCC_CATCH_SIGNALS
+ dump.Dump(igesent,S,level,(level-1)/3);
+ }
+ catch (Standard_Failure) {
+ S << " ** Dump Interrupt **" << endl;
+ }
+}
//=======================================================================
//function : NewModel
if (!anactiges.IsNull()) {
// sln 14.01.2002 OCC51 : verifying whether entry model is IGESDatat_IGESModel,
// if this condition is false new model is created
- Handle(Interface_InterfaceModel) aModel = (model->IsKind(STANDARD_TYPE(IGESData_IGESModel))? model : NewModel());
+ Handle(Interface_InterfaceModel) aModel = model;
+ if (model.IsNull() || !model->IsKind(STANDARD_TYPE(IGESData_IGESModel)))
+ aModel = NewModel();
anactiges->SetModel(GetCasted(IGESData_IGESModel,aModel));
anactiges->SetContinuity(Interface_Static::IVal("read.iges.bspline.continuity"));
}
return myAdaptorRead;
}
+
+//=======================================================================
+//function : NewActorWrite
+//purpose :
+//=======================================================================
+
+Handle(Transfer_ActorOfFinderProcess) IGESControl_Controller::NewActorWrite () const
+{
+ return new IGESControl_ActorWrite;
+}
//=======================================================================
//function : Init
void IGESControl_Controller::Init ()
{
- static Standard_Boolean inic = Standard_False;
- if (!inic) {
- inic = Standard_True;
- Handle(IGESControl_Controller) ADIGES = new IGESControl_Controller(Standard_False);
- ADIGES->AutoRecord();
- XSAlgo::Init();
- IGESToBRep::Init();
- IGESToBRep::SetAlgoContainer (new IGESControl_AlgoContainer());
+ static Standard_Mutex gInitMutex;
+ static volatile bool gInitDone = false;
+ if (!gInitDone)
+ {
+ gInitMutex.Lock();
+ if (!gInitDone)
+ {
+ IGESSolid::Init();
+ IGESAppli::Init();
+ IGESDefs::Init();
+
+ Handle(IGESControl_Controller) aController = new IGESControl_Controller(Standard_False);
+ aController->AutoRecord();
+
+ XSAlgo::Init();
+ IGESToBRep::Init();
+ IGESToBRep::SetAlgoContainer (new IGESControl_AlgoContainer());
+
+ gInitDone = true;
+ }
+ gInitMutex.Unlock();
}
}
#ifndef _IGESControl_Controller_HeaderFile
#define _IGESControl_Controller_HeaderFile
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
#include <XSControl_Controller.hxx>
-class TopoDS_Shape;
-class Transfer_FinderProcess;
-class XSControl_WorkSession;
class IGESData_Protocol;
-
-class IGESControl_Controller;
-DEFINE_STANDARD_HANDLE(IGESControl_Controller, XSControl_Controller)
-
//! Controller for IGES-5.1
class IGESControl_Controller : public XSControl_Controller
{
public:
+ //! Reads a IGES File and returns a IGES Model (into <mod>),
+ //! or lets <mod> "Null" in case of Error
+ //! Returns 0 if OK, 1 if Read Error, -1 if File not opened
+ Standard_EXPORT virtual Standard_Integer ReadFile (const Standard_CString theFileName, Handle(Interface_InterfaceModel)& theModel) const Standard_OVERRIDE;
+
+ //! Writes a File from a IGES Model (brought by <ctx>)
+ //! Returns False (and writes no file) if <ctx> is not for IGES
+ Standard_EXPORT virtual Standard_Boolean WriteFile (const Standard_CString theFileName, const Handle(Interface_InterfaceModel)& theModel, Interface_CheckIterator& theChecks) const Standard_OVERRIDE;
+
+ //! Dumps an IGES Entity with an IGES Dumper. <level> is the one used by IGESDumper.
+ 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 Standard_OVERRIDE;
+
//! Creates a new empty Model ready to receive data of the Norm.
//! It is taken from IGES Template Model
- Standard_EXPORT Handle(Interface_InterfaceModel) NewModel() const Standard_OVERRIDE;
+ Standard_EXPORT virtual Handle(Interface_InterfaceModel) NewModel() const Standard_OVERRIDE;
//! Returns the Actor for Read attached to the pair (norm,appli)
//! It is an Actor from IGESToBRep, adapted from an IGESModel :
//! Unit, tolerances
- Standard_EXPORT Handle(Transfer_ActorOfTransientProcess) ActorRead (const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
+ Standard_EXPORT virtual Handle(Transfer_ActorOfTransientProcess) ActorRead (const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
+
+ //! Returns the Actor for Write attached to the pair (norm,appli)
+ Standard_EXPORT virtual Handle(Transfer_ActorOfFinderProcess) NewActorWrite() const Standard_OVERRIDE;
//! Standard Initialisation. It creates a Controller for IGES and
//! records it to various names, available to select it later
//! If <modefnes> is True, sets it to internal FNES format
Standard_EXPORT IGESControl_Controller(const Standard_Boolean modefnes = Standard_False);
- Standard_Boolean themode;
+ Standard_Boolean themodefnes;
};
#endif // _IGESControl_Controller_HeaderFile
+++ /dev/null
-// 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 <IGESControl_FloatFormat.hxx>
-#include <IGESData_IGESWriter.hxx>
-#include <Interface_FloatWriter.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IGESControl_FloatFormat,IFSelect_GeneralModifier)
-
-IGESControl_FloatFormat::IGESControl_FloatFormat ()
-: IFSelect_GeneralModifier (Standard_False),
- thezerosup (Standard_True) , themainform ("%E") ,
- theformrange ("%f") , therangemin (0.1) , therangemax (1000.)
-{}
-
-void IGESControl_FloatFormat::SetDefault (const Standard_Integer digits)
-{
- themainform.Clear();
- theformrange.Clear();
- if (digits <= 0) {
- themainform.AssignCat ("%E");
- theformrange.AssignCat ("%f");
- } else {
- char format[20];
- char pourcent = '%'; char point = '.';
- Sprintf(format, "%c%d%c%dE",pourcent,digits+2,point,digits);
- themainform.AssignCat (format);
- Sprintf(format, "%c%d%c%df",pourcent,digits+2,point,digits);
- theformrange.AssignCat (format);
- }
- therangemin = 0.1; therangemax = 1000.;
- thezerosup = Standard_True;
-}
-
-void IGESControl_FloatFormat::SetFormat (const Standard_CString format)
-{ themainform.Clear(); themainform.AssignCat(format); }
-
-void IGESControl_FloatFormat::SetFormatForRange
- (const Standard_CString form, const Standard_Real R1, const Standard_Real R2)
-{
- theformrange.Clear(); theformrange.AssignCat(form);
- therangemin = R1; therangemax = R2;
-}
-
-void IGESControl_FloatFormat::Format
- (Standard_Boolean& zerosup, TCollection_AsciiString& mainform,
- Standard_Boolean& hasrange, TCollection_AsciiString& formrange,
- Standard_Real& rangemin, Standard_Real& rangemax) const
-{
- zerosup = thezerosup;
- mainform = themainform;
- hasrange = (theformrange.Length() > 0);
- formrange = theformrange;
- rangemin = therangemin;
- rangemax = therangemax;
-}
-
-void IGESControl_FloatFormat::Perform (IGESData_IGESWriter& writer) const
-{
- writer.FloatWriter().SetFormat (themainform.ToCString());
- writer.FloatWriter().SetZeroSuppress (thezerosup);
- if (theformrange.Length() > 0) writer.FloatWriter().SetFormatForRange
- (theformrange.ToCString(), therangemin, therangemax);
-}
-
-TCollection_AsciiString IGESControl_FloatFormat::Label () const
-{
- TCollection_AsciiString lab("Float Format ");
- if (thezerosup) lab.AssignCat(" ZeroSup ");
- lab.AssignCat (themainform);
- if (theformrange.Length() > 0) {
- char mess[30];
-// Sprintf(mess,", in range %f %f %s",
-// therangemin,therangemax,theformrange.ToCString());
-// lab.AssignCat(mess);
-// ... FloatFormat a droit aussi a un beau format pour son propre compte ...
- lab.AssignCat (", in range ");
- Standard_Integer convlen = Interface_FloatWriter::Convert
- (therangemin,mess,Standard_True,therangemin/2.,therangemax*2.,"%f","%f");
- mess[convlen] = ' '; mess[convlen+1] = '\0';
- lab.AssignCat(mess);
- convlen = Interface_FloatWriter::Convert
- (therangemax,mess,Standard_True,therangemin/2.,therangemax*2.,"%f","%f");
- mess[convlen] = ':'; mess[convlen+1] = '\0';
- lab.AssignCat(mess);
- lab.AssignCat(theformrange.ToCString());
- }
- return lab;
-}
+++ /dev/null
-// Created on: 1994-06-01
-// 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 _IGESControl_FloatFormat_HeaderFile
-#define _IGESControl_FloatFormat_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <IFSelect_GeneralModifier.hxx>
-class IGESData_IGESWriter;
-
-class IGESControl_FloatFormat;
-DEFINE_STANDARD_HANDLE(IGESControl_FloatFormat, IFSelect_GeneralModifier)
-
-//! This class gives control out format for floatting values :
-//! ZeroSuppress or no, Main Format, Format in Range (for values
-//! around 1.), as IGESWriter allows to manage it.
-//! Formats are given under C-printf form
-class IGESControl_FloatFormat : public IFSelect_GeneralModifier
-{
- public:
-
- //! Creates a new FloatFormat, with standard options :
- //! ZeroSuppress, Main Format = %E,
- //! Format between 0.001 and 1000. = %f
- Standard_EXPORT IGESControl_FloatFormat();
-
- //! Sets FloatFormat to default value (see Create) but if <digits>
- //! is given positive, it commands Formats (main and range) to
- //! ensure <digits> significant digits to be displayed
- Standard_EXPORT void SetDefault (const Standard_Integer digits = 0);
-
- //! Sets ZeroSuppress mode to a new value
- void SetZeroSuppress (const Standard_Boolean mode) { thezerosup = mode; }
-
- //! Sets Main Format to a new value
- //! Remark : SetFormat, SetZeroSuppress and SetFormatForRange are
- //! independant
- Standard_EXPORT void SetFormat (const Standard_CString format = "%E");
-
- //! Sets Format for Range to a new value with its range of
- //! application.
- //! To cancel it, give format as "" (empty string)
- //! Remark that if the condition (0. < Rmin < Rmax) is not
- //! verified, this secondary format will be ignored.
- //! Moreover, this secondary format is intended to be used in a
- //! range around 1.
- Standard_EXPORT void SetFormatForRange (const Standard_CString format = "%f", const Standard_Real Rmin = 0.1, const Standard_Real Rmax = 1000.0);
-
- //! Returns all recorded parameters :
- //! zerosup : ZeroSuppress status
- //! mainform : Main Format (which applies out of the range, or
- //! for every real if no range is set)
- //! hasrange : True if a FormatInRange is set, False else
- //! (following parameters do not apply if it is False)
- //! forminrange : Secondary Format (it applies inside the range)
- //! rangemin, rangemax : the range in which the secondary format
- //! applies
- Standard_EXPORT void Format (Standard_Boolean& zerosup, TCollection_AsciiString& mainform, Standard_Boolean& hasrange, TCollection_AsciiString& forminrange, Standard_Real& rangemin, Standard_Real& rangemax) const;
-
- //! Sets the Floatting Formats of IGESWriter to the recorded
- //! parameters
- Standard_EXPORT void Perform (IGESData_IGESWriter& writer) const;
-
- //! Returns specific Label : for instance,
- //! "Float Format [ZeroSuppress] %E [, in range R1-R2 %f]"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
- DEFINE_STANDARD_RTTIEXT(IGESControl_FloatFormat,IFSelect_GeneralModifier)
-
- private:
-
- Standard_Boolean thezerosup;
- TCollection_AsciiString themainform;
- TCollection_AsciiString theformrange;
- Standard_Real therangemin;
- Standard_Real therangemax;
-};
-
-#endif // _IGESControl_FloatFormat_HeaderFile
//gka 06.01.99 S3767
//abv 10.04.99 S4136: eliminate using BRepAPI::Precision()
-#include <BRepLib.hxx>
-#include <Dico_DictionaryOfInteger.hxx>
-#include <Dico_DictionaryOfTransient.hxx>
-#include <Dico_IteratorOfDictionaryOfInteger.hxx>
-#include <Dico_IteratorOfDictionaryOfTransient.hxx>
-#include <IFSelect_CheckCounter.hxx>
#include <IGESControl_Controller.hxx>
#include <IGESControl_Reader.hxx>
#include <IGESData_FileProtocol.hxx>
#include <IGESData_IGESEntity.hxx>
#include <IGESData_IGESModel.hxx>
-#include <IGESToBRep_Actor.hxx>
-#include <Interface_Check.hxx>
-#include <Interface_CheckIterator.hxx>
#include <Interface_InterfaceModel.hxx>
#include <Interface_Macros.hxx>
#include <Interface_ShareFlags.hxx>
#include <Interface_Static.hxx>
#include <Message_Messenger.hxx>
-#include <Message_Msg.hxx>
-#include <OSD_Timer.hxx>
-#include <ShapeExtend_Explorer.hxx>
-#include <ShapeFix_ShapeTolerance.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
#include <TopoDS_Shape.hxx>
-#include <Transfer_ActorOfTransientProcess.hxx>
#include <Transfer_Binder.hxx>
#include <Transfer_TransientProcess.hxx>
#include <TransferBRep.hxx>
-#include <XSControl_Controller.hxx>
-#include <XSControl_TransferReader.hxx>
#include <XSControl_WorkSession.hxx>
-#include <stdio.h>
-// S3767 dce 18/01/1999
-// add of stdio.h for NT compilation
//=======================================================================
//function : IGESControl_Reader
//purpose :
//=======================================================================
IGESControl_Reader::IGESControl_Reader ()
+: myReadOnlyVisible(Standard_False)
{
IGESControl_Controller::Init();
- SetWS (new XSControl_WorkSession);
+ SetWS(new XSControl_WorkSession);
SetNorm("IGES");
- theReadOnlyVisible = Standard_False;
}
//purpose :
//=======================================================================
-IGESControl_Reader::IGESControl_Reader
- (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch)
+IGESControl_Reader::IGESControl_Reader (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch)
+: myReadOnlyVisible(Standard_False)
{
IGESControl_Controller::Init();
- SetWS (WS,scratch);
- SetNorm ("IGES");
- theReadOnlyVisible = Standard_False;
+ SetWS(WS,scratch);
+ SetNorm("IGES");
}
//purpose :
//=======================================================================
-Standard_Integer IGESControl_Reader::NbRootsForTransfer()
+Standard_Integer IGESControl_Reader::NbRootsForTransfer()
{
if (therootsta) return theroots.Length();
therootsta = Standard_True;
Handle(IGESData_IGESModel) model = IGESModel();
if (model.IsNull()) return 0;
- Handle(XSControl_WorkSession) session = WS();
- Handle(Interface_Protocol) protocol = session->Protocol();
- Handle(XSControl_Controller) controller = session->NormAdaptor();
+ const Handle(XSControl_WorkSession) &session = WS();
+ const Handle(XSControl_Controller) &controller = session->NormAdaptor();
+ const Handle(Interface_Protocol) &protocol = controller->Protocol();
Handle(Transfer_ActorOfTransientProcess) actor = controller->ActorRead(model);
Interface_ShareFlags SH (model,protocol);
// sln 11.06.2002 OCC448
- Interface_Static::SetIVal("read.iges.onlyvisible",theReadOnlyVisible);
+ Interface_Static::SetIVal("read.iges.onlyvisible",myReadOnlyVisible);
Standard_Integer nb = model->NbEntities();
for (Standard_Integer i = 1; i <= nb; i ++) {
Handle(IGESData_IGESEntity) ent = model->Entity(i);
if ( SH.IsShared(ent) || ! actor->Recognize (ent) ) continue;
// on ajoute un traitement pour ne prendre que les entites visibles
- if ( ! theReadOnlyVisible || ent->BlankStatus() == 0 ) {
+ if ( ! myReadOnlyVisible || ent->BlankStatus() == 0 ) {
theroots.Append(ent);
}
}
return theroots.Length();
}
-
-// #### Reliquat de methodes a reprendre ####
-
-//=======================================================================
-// Function : PrintTransferInfo
-// Purpose : Print statistics information on transfer using MoniTool message management
-// Created : 18/01/98 DCE for S3767
-// Modified :
-//=======================================================================
-
-void IGESControl_Reader::PrintTransferInfo
- (const IFSelect_PrintFail failsonly, const IFSelect_PrintCount mode) const
-{
- Standard_Integer nbWarn = 0, nbFail= 0, nbEntities =0, nbRoots = 0, nbResults = 0;
- const Handle(Transfer_TransientProcess) &TP = WS()->TransferReader()->TransientProcess();
- Handle(Message_Messenger) TF = TP->Messenger();
- const Handle(Interface_InterfaceModel) &model = TP->Model();
- if (! model.IsNull()) {
- nbEntities = model->NbEntities();
- nbRoots = TP->NbRoots();
- Transfer_TransientProcess::Iterator iterTrans = TP->RootResult(Standard_True);
- Handle(Dico_DictionaryOfInteger) dicoCountResult = new Dico_DictionaryOfInteger;
- Handle(Dico_DictionaryOfInteger) dicoCountMapping = new Dico_DictionaryOfInteger;
- for (iterTrans.Start(); iterTrans.More() ; iterTrans.Next() ) {
- nbResults++;
- // Init for dicoCountResult for IFSelect_ResultCount
- if ( mode == IFSelect_ResultCount ) {
- char mess[300];
- const Handle(Transfer_Binder) aBinder = iterTrans.Value();
- sprintf(mess,"\t%s",aBinder->ResultTypeName());
- Standard_Boolean deja;
- Standard_Integer& nb = dicoCountResult->NewItem(mess,deja);
- if (!deja) nb = 0;
- nb ++;
- }
- // Init for dicoCountMapping for IFSelect_Mapping
- else if ( mode == IFSelect_Mapping ) {
- char mess[300];
- const Handle(Transfer_Binder) aBinder = iterTrans.Value();
- DeclareAndCast(IGESData_IGESEntity,igesEnt,iterTrans.SourceObject());
-
- sprintf(mess,"%d\t%d\t%s\t%s", igesEnt->TypeNumber(), igesEnt->FormNumber(),
- "%d", aBinder->ResultTypeName());
- //cout << mess << endl;
- Standard_Boolean deja;
- Standard_Integer& nb = dicoCountMapping->NewItem(mess,deja);
- if (!deja) nb = 0;
- nb ++;
- }
- }
-
- Interface_CheckIterator checkIterator = TP->CheckList(Standard_False);
- Handle(Dico_DictionaryOfInteger) dicoCount = new Dico_DictionaryOfInteger;
- Handle(Dico_DictionaryOfTransient) dicoList = new Dico_DictionaryOfTransient;
- // Init the dicoCount dicoList and nbWarn ,nb Fail.
- for(checkIterator.Start(); checkIterator.More(); checkIterator.Next() ) {
- char mess[300];
- const Handle(Interface_Check) aCheck = checkIterator.Value();
- Handle(Standard_Transient) ent = model->Value(checkIterator.Number());
- DeclareAndCast(IGESData_IGESEntity,igesEnt,ent);
- Standard_Integer type = igesEnt->TypeNumber(), form = igesEnt->FormNumber();
- Standard_Integer nw = aCheck->NbWarnings(), nf = aCheck->NbFails(), i;
- for(i = 1; (failsonly==IFSelect_FailAndWarn) && (i<= nw); i++) {
- sprintf(mess,"\t W\t%d\t%d\t%s",type,form,aCheck->CWarning(i));
- Standard_Boolean deja;
- Standard_Integer& nb = dicoCount->NewItem(mess,deja);
- if (!deja) nb = 0;
- nb ++;
- Handle(Standard_Transient)& anitem = dicoList->NewItem(mess,deja);
- DeclareAndCast(TColStd_HSequenceOfInteger,alist,anitem);
- if (!deja) { alist = new TColStd_HSequenceOfInteger(); anitem = alist; }
- alist->Append(model->Number(igesEnt)*2-1);
- }
- for(i = 1; i<= nf; i++) {
- sprintf(mess,"\t F\t%d\t%d\t%s",type,form,aCheck->CFail(i));
- // TF << mess << endl;
- Standard_Boolean deja;
- Standard_Integer& nb = dicoCount->NewItem(mess,deja);
- if (!deja) nb = 0;
- nb ++;
- Handle(Standard_Transient)& anitem = dicoList->NewItem(mess,deja);
- DeclareAndCast(TColStd_HSequenceOfInteger,alist,anitem);
- if (!deja) { alist = new TColStd_HSequenceOfInteger(); anitem = alist; }
- alist->Append(model->Number(igesEnt)*2-1);
- }
- nbWarn += nw;
- nbFail += nf;
- }
- Message_Msg msg3000("IGES_3000"); // *************************
- TF->Send (msg3000, Message_Info); //smh#14
-
- switch (mode) {
- case IFSelect_GeneralInfo : {
- Message_Msg msg3005("IGES_3005");TF->Send(msg3005, Message_Info);
- Message_Msg msg3010("IGES_3010");msg3010.Arg(nbEntities);TF->Send(msg3010, Message_Info);
- Message_Msg msg3011("IGES_3011");msg3011.Arg(nbRoots);TF->Send(msg3011, Message_Info);
- Message_Msg msg3015("IGES_3015");msg3015.Arg(nbResults);TF->Send(msg3015, Message_Info);
- Message_Msg msg3020("IGES_3020");msg3020.Arg(nbWarn);TF->Send(msg3020, Message_Info);
- Message_Msg msg3025("IGES_3025");msg3025.Arg(nbFail);TF->Send(msg3025, Message_Info);
- break;
- }
- case IFSelect_CountByItem :
- case IFSelect_ListByItem : {
- Message_Msg msg3030("IGES_3030");
- TF->Send(msg3030, Message_Info);
- Dico_IteratorOfDictionaryOfInteger dicoCountIter(dicoCount);
- Dico_IteratorOfDictionaryOfTransient dicoListIter(dicoList);
- for(dicoCountIter.Start(),dicoListIter.Start();
- dicoCountIter.More() && dicoListIter.More();
- dicoCountIter.Next(),dicoListIter.Next()) {
- TF << dicoCountIter.Value() << dicoCountIter.Name() << endl;
- if (mode == IFSelect_ListByItem) {
- DeclareAndCast(TColStd_HSequenceOfInteger, entityList, dicoListIter.Value());
- Standard_Integer length = entityList->Length();
- Message_Msg msg3035("IGES_3035");
- TF->Send(msg3035, Message_Info);
- char line[80];
- sprintf(line,"\t\t\t");
- TF << line ;
- Standard_Integer nbInLine =0;
- for(Standard_Integer i = 1; i <= length ; i++ ) {
- // IDT_Out << (entityList->Value(i)) << " ";
- sprintf(line,"\t %d", entityList->Value(i));
- TF << line ;
- if (++nbInLine == 6) {
- nbInLine = 0;
- sprintf(line,"\n\t\t\t");
- TF << line ;
- }
- }
- TF << endl ;
- }
- }
- break;
- }
- case IFSelect_ResultCount : {
- Message_Msg msg3040("IGES_3040");TF->Send(msg3040, Message_Info);
- Message_Msg msg3011("IGES_3011");msg3011.Arg(nbRoots);TF->Send(msg3011, Message_Info);
- Message_Msg msg3015("IGES_3015");msg3015.Arg(nbResults);TF->Send(msg3015, Message_Info);
- Message_Msg msg3045("IGES_3045");TF->Send(msg3045, Message_Info);
- Dico_IteratorOfDictionaryOfInteger dicoCountIter(dicoCountResult);
- for(dicoCountIter.Start(); dicoCountIter.More(); dicoCountIter.Next()) {
- TF << dicoCountIter.Value() << dicoCountIter.Name() << endl;
- }
- break;
- }
- case IFSelect_Mapping : {
- Message_Msg msg3040("IGES_3050");TF->Send(msg3040, Message_Info);
- Message_Msg msg3011("IGES_3011");msg3011.Arg(nbRoots);TF->Send(msg3011, Message_Info);
- Message_Msg msg3015("IGES_3015");msg3015.Arg(nbResults);TF->Send(msg3015, Message_Info);
- Message_Msg msg3045("IGES_3055");TF->Send(msg3045, Message_Info);
- // Add failed entities in dicoCountMapping
- if (nbRoots!=nbResults) {
- for( Standard_Integer i = 1; i <= nbRoots ; i++) {
- DeclareAndCast(IGESData_IGESEntity, root, TP->Root(i));
- if (!TP->IsBound(root)) {
- char mess[300];
-
- sprintf(mess,"%d\t%d \t%s\t%s", root->TypeNumber(), root->FormNumber(),
- "%d", "Failed");
- //cout << mess << endl;
- Standard_Boolean deja;
- Standard_Integer& nb = dicoCountMapping->NewItem(mess,deja);
- if (!deja) nb = 0;
- nb ++;
- }
- }
- }
- Dico_IteratorOfDictionaryOfInteger dicoCountIter(dicoCountMapping);
- for(dicoCountIter.Start(); dicoCountIter.More(); dicoCountIter.Next()) {
- char mess[80];
- sprintf(mess, dicoCountIter.Name().ToCString() , dicoCountIter.Value());
- TF << mess << endl; //dicoCountIter.Value() << dicoCountIter.Name() << endl;
- }
- break;
- }
- default: break;
- }
- }
-}
#include <Standard_Boolean.hxx>
#include <XSControl_Reader.hxx>
#include <Standard_Integer.hxx>
-#include <IFSelect_PrintFail.hxx>
-#include <IFSelect_PrintCount.hxx>
class XSControl_WorkSession;
class IGESData_IGESModel;
//! reader.IsDone()
//! reader.NbShapes() and reader.Shape(num); or reader.OneShape();
//! To print the results of transfer use method:
-//! reader.PrintTransferInfo(failwarn,mode); where printfail is equal to the
-//! value of enumeration IFSelect_PrintFail, mode see above.
+//! reader.PrintTransferInfo(mode);
//! Gets correspondence between an IGES entity and a result shape obtained therefrom.
//! reader.TransientProcess();
//! TopoDS_Shape shape =
//! TransferBRep::ShapeResult(reader.TransientProcess(),ent);
class IGESControl_Reader : public XSControl_Reader
{
-public:
+ public:
DEFINE_STANDARD_ALLOC
-
//! Creates a Reader from scratch
Standard_EXPORT IGESControl_Reader();
//! Creates a Reader from an already existing Session
Standard_EXPORT IGESControl_Reader(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
- //! Set the transion of ALL Roots (if theReadOnlyVisible is False)
- //! or of Visible Roots (if theReadOnlyVisible is True)
- void SetReadVisible (const Standard_Boolean ReadRoot);
-
- Standard_Boolean GetReadVisible() const;
+ //! Set the transion of ALL Roots (if myReadOnlyVisible is False)
+ //! or of Visible Roots (if myReadOnlyVisible is True)
+ void SetReadVisible (const Standard_Boolean ReadRoot) { myReadOnlyVisible = ReadRoot; }
+ Standard_Boolean GetReadVisible() const { return myReadOnlyVisible; }
+
//! Returns the model as a IGESModel.
//! It can then be consulted (header, product)
Standard_EXPORT Handle(IGESData_IGESModel) IGESModel() const;
//! Determines the list of root entities from Model which are candidate for
//! a transfer to a Shape (type of entities is PRODUCT)
- //! <theReadOnlyVisible> is taken into account to define roots
+ //! <myReadOnlyVisible> is taken into account to define roots
Standard_EXPORT virtual Standard_Integer NbRootsForTransfer() Standard_OVERRIDE;
-
- //! Prints Statistics and check list for Transfer
- Standard_EXPORT void PrintTransferInfo (const IFSelect_PrintFail failwarn, const IFSelect_PrintCount mode) const;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
- Standard_Boolean theReadOnlyVisible;
+ private:
+ Standard_Boolean myReadOnlyVisible;
};
-
-#include <IGESControl_Reader.lxx>
-
-
-
-
-
#endif // _IGESControl_Reader_HeaderFile
+++ /dev/null
-// 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.
-
-//=======================================================================
-//function : SetReadVisible
-//purpose :
-//=======================================================================
-
-inline void IGESControl_Reader::SetReadVisible (const Standard_Boolean ReadRoot)
-{
- theReadOnlyVisible = ReadRoot;
-}
-
-
-//=======================================================================
-//function : GetReadVisible
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean IGESControl_Reader::GetReadVisible ()const
-{
- return theReadOnlyVisible;
-}
+++ /dev/null
-// 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 <IFSelect_ContextWrite.hxx>
-#include <IFSelect_GeneralModifier.hxx>
-#include <IGESAppli.hxx>
-#include <IGESData_IGESDumper.hxx>
-#include <IGESData_IGESEntity.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESData_IGESWriter.hxx>
-#include <IGESData_Protocol.hxx>
-#include <IGESDefs.hxx>
-#include <IGESFile_Read.hxx>
-#include <IGESControl_FloatFormat.hxx>
-#include <IGESControl_WorkLibrary.hxx>
-#include <IGESSolid.hxx>
-#include <Interface_Check.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Interface_ReportEntity.hxx>
-#include <Message.hxx>
-#include <Message_Messenger.hxx>
-#include <OSD_OpenFile.hxx>
-#include <Standard_ErrorHandler.hxx>
-#include <Standard_Stream.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-
-#include <errno.h>
-IMPLEMENT_STANDARD_RTTIEXT(IGESControl_WorkLibrary,IFSelect_WorkLibrary)
-
-IGESControl_WorkLibrary::IGESControl_WorkLibrary (const Standard_Boolean modefnes)
-: themodefnes (modefnes)
-{
- IGESSolid::Init();
- IGESAppli::Init();
- IGESDefs::Init();
-
- SetDumpLevels (4,6);
- SetDumpHelp (0,"Only DNum");
- SetDumpHelp (1,"DNum, IGES Type & Form");
- SetDumpHelp (2,"Main Directory Informations");
- SetDumpHelp (3,"Complete Directory Part");
- SetDumpHelp (4,"Directory + Fields (except list contents)");
- SetDumpHelp (5,"Complete (with list contents)");
- SetDumpHelp (6,"Complete + Transformed data");
-}
-
-Standard_Integer IGESControl_WorkLibrary::ReadFile
- (const Standard_CString name,
- Handle(Interface_InterfaceModel)& model,
- const Handle(Interface_Protocol)& protocol) const
-{
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- Handle(IGESData_IGESModel) igesmod = new IGESData_IGESModel;
- DeclareAndCast(IGESData_Protocol,prot,protocol);
-
- char* pname=(char*) name;
- Standard_Integer status = IGESFile_Read (pname,igesmod,prot);
-
- if (status < 0) sout<<"File not found : "<<name<<endl;
- if (status > 0) sout<<"Error when reading file : "<<name<<endl;
- if (status == 0) model = igesmod;
- else model.Nullify();
- return status;
-}
-
-Standard_Boolean IGESControl_WorkLibrary::WriteFile
- (IFSelect_ContextWrite& ctx) const
-{
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
-// Preparation
- DeclareAndCast(IGESData_IGESModel,igesmod,ctx.Model());
- DeclareAndCast(IGESData_Protocol,prot,ctx.Protocol());
-
- if (igesmod.IsNull() || prot.IsNull()) return Standard_False;
- ofstream fout;
- OSD_OpenStream(fout,ctx.FileName(),ios::out );
- if (!fout) {
- ctx.CCheck(0)->AddFail("IGES File could not be created");
- sout<<" - IGES File could not be created : " << ctx.FileName() << endl; return 0;
- }
- sout<<" IGES File Name : "<<ctx.FileName();
- IGESData_IGESWriter VW(igesmod);
- sout<<"("<<igesmod->NbEntities()<<" ents) ";
-
-// File Modifiers
- Standard_Integer nbmod = ctx.NbModifiers();
- for (Standard_Integer numod = 1; numod <= nbmod; numod ++) {
- ctx.SetModifier (numod);
- DeclareAndCast(IGESControl_FloatFormat,filemod,ctx.FileModifier());
- if (!filemod.IsNull()) filemod->Perform(VW);
-// (impressions de mise au point)
- sout << " .. FileMod." << numod <<" "<< filemod->Label();
- if (ctx.IsForAll()) sout << " (all model)";
- else sout << " (" << ctx.NbEntities() << " entities)";
- }
-
-// Envoi
- VW.SendModel(prot);
- sout<<" Write ";
- if (themodefnes) VW.WriteMode() = 10;
- Standard_Boolean status = VW.Print(fout); sout<<" Done"<<endl;
-
- errno = 0;
- fout.close();
- status = fout.good() && status && !errno;
- if(errno)
- sout << strerror(errno) << endl;
-
- return status;
-}
-
-void IGESControl_WorkLibrary::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
-{
- DeclareAndCast(IGESData_IGESModel,igesmod,model);
- DeclareAndCast(IGESData_Protocol,igespro,protocol);
- DeclareAndCast(IGESData_IGESEntity,igesent,entity);
- if (igesmod.IsNull() || igespro.IsNull() || igesent.IsNull()) return;
- Standard_Integer num = igesmod->Number(igesent);
- if (num == 0) return;
-
- S<<" --- Entity "<<num;
- Standard_Boolean iserr = model->IsRedefinedContent(num);
- Handle(Standard_Transient) con;
- if (iserr) con = model->ReportEntity(num)->Content();
- if (entity.IsNull()) { S<<" Null"<<endl; return ; }
-
-// On attaque le dump : d abord cas de l Erreur
- if (iserr) {
- S << " ERRONEOUS, Content, Type cdl : ";
- if (!con.IsNull()) S << con->DynamicType()->Name();
- else S << "(undefined)" << endl;
- igesent = GetCasted(IGESData_IGESEntity,con);
- con.Nullify();
- Handle(Interface_Check) check = model->ReportEntity(num)->Check();
- Interface_CheckIterator chlist;
- chlist.Add (check,num);
- chlist.Print (S,igesmod,Standard_False);
- if (igesent.IsNull()) return;
- }
- else S << " Type cdl : " << igesent->DynamicType()->Name();
-
- IGESData_IGESDumper dump(igesmod,igespro);
- try {
- OCC_CATCH_SIGNALS
- dump.Dump(igesent,S,level,(level-1)/3);
- }
- catch (Standard_Failure) {
- S << " ** Dump Interrupt **" << endl;
- }
-}
+++ /dev/null
-// Created on: 1994-06-03
-// 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 _IGESControl_WorkLibrary_HeaderFile
-#define _IGESControl_WorkLibrary_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_WorkLibrary.hxx>
-class Interface_InterfaceModel;
-class Interface_Protocol;
-class IFSelect_ContextWrite;
-class Message_Messenger;
-
-
-class IGESControl_WorkLibrary;
-DEFINE_STANDARD_HANDLE(IGESControl_WorkLibrary, IFSelect_WorkLibrary)
-
-//! Performs Read and Write an IGES File with an IGES Model
-class IGESControl_WorkLibrary : public IFSelect_WorkLibrary
-{
- public:
-
- //! Creates a IGES WorkLibrary
- //! If <modefnes> is given as True, it will work for FNES
- Standard_EXPORT IGESControl_WorkLibrary(const Standard_Boolean modefnes = Standard_False);
-
- //! Reads a IGES File and returns a IGES Model (into <mod>),
- //! or lets <mod> "Null" in case of Error
- //! Returns 0 if OK, 1 if Read Error, -1 if File not opened
- Standard_EXPORT Standard_Integer ReadFile (const Standard_CString name, Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol) const Standard_OVERRIDE;
-
- //! Writes a File from a IGES Model (brought by <ctx>)
- //! Returns False (and writes no file) if <ctx> is not for IGES
- Standard_EXPORT Standard_Boolean WriteFile (IFSelect_ContextWrite& ctx) const Standard_OVERRIDE;
-
- //! Dumps an IGES Entity with an IGES Dumper. <level> is the one
- //! used by IGESDumper.
- 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 Standard_Integer level) const Standard_OVERRIDE;
-
- DEFINE_STANDARD_RTTIEXT(IGESControl_WorkLibrary,IFSelect_WorkLibrary)
-
- private:
-
- Standard_Boolean themodefnes;
-};
-
-#endif // _IGESControl_WorkLibrary_HeaderFile
Standard_EXPORT IGESControl_Writer(const Handle(IGESData_IGESModel)& model, const Standard_Integer modecr = 0);
//! Returns the IGES model to be written in output.
- const Handle(IGESData_IGESModel) & Model() const
- { return myModel; }
+ const Handle(IGESData_IGESModel) & Model() const { return myModel; }
- const Handle(Transfer_FinderProcess) & TransferProcess() const
- { return myTP; }
+ const Handle(Transfer_FinderProcess) & TransferProcess() const { return myTP; }
//! Returns/Sets the TransferProcess : it contains final results
//! and if some, check messages
- void SetTransferProcess (const Handle(Transfer_FinderProcess)& TP)
- { myTP = TP; }
+ void SetTransferProcess (const Handle(Transfer_FinderProcess)& TP) { myTP = TP; }
//! Translates a Shape to IGES Entities and adds them to the model
//! Returns True if done, False if Shape not suitable for IGES or null
Interface_Static::Init ("XSTEP","read.iges.bspline.continuity",'&',"imin 0");
Interface_Static::Init ("XSTEP","read.iges.bspline.continuity",'&',"imax 2");
- //#58 rln Interface_Static::Init ("XSTEP","write.iges.header.product" ,'t',"");
Interface_Static::Init ("XSTEP","write.iges.header.receiver",'t',"");//58 rln Unknown
Interface_Static::Init ("XSTEP","write.iges.header.author" ,'t',process.UserName().ToCString());
Interface_Static::Init ("XSTEP","write.iges.header.company" ,'t',"");//58 rln Matra Datavision
-IGESSelect_AddGroup.cxx
-IGESSelect_AddGroup.hxx
-IGESSelect_AutoCorrect.cxx
-IGESSelect_AutoCorrect.hxx
-IGESSelect_ChangeLevelList.cxx
-IGESSelect_ChangeLevelList.hxx
-IGESSelect_ChangeLevelNumber.cxx
-IGESSelect_ChangeLevelNumber.hxx
-IGESSelect_ComputeStatus.cxx
-IGESSelect_ComputeStatus.hxx
IGESSelect_CounterOfLevelNumber.cxx
IGESSelect_CounterOfLevelNumber.hxx
-IGESSelect_DispPerDrawing.cxx
-IGESSelect_DispPerDrawing.hxx
-IGESSelect_DispPerSingleView.cxx
-IGESSelect_DispPerSingleView.hxx
-IGESSelect_Dumper.cxx
-IGESSelect_Dumper.hxx
-IGESSelect_EditDirPart.cxx
-IGESSelect_EditDirPart.hxx
-IGESSelect_EditHeader.cxx
-IGESSelect_EditHeader.hxx
IGESSelect_IGESName.cxx
IGESSelect_IGESName.hxx
IGESSelect_IGESTypeForm.cxx
IGESSelect_IGESTypeForm.hxx
-IGESSelect_ModelModifier.hxx
-IGESSelect_ModelModifier_0.cxx
-IGESSelect_RebuildDrawings.cxx
-IGESSelect_RebuildDrawings.hxx
-IGESSelect_RebuildGroups.cxx
-IGESSelect_RebuildGroups.hxx
-IGESSelect_RemoveCurves.cxx
-IGESSelect_RemoveCurves.hxx
IGESSelect_SelectBasicGeom.cxx
IGESSelect_SelectBasicGeom.hxx
IGESSelect_SelectBypassGroup.cxx
IGESSelect_SelectBypassGroup.hxx
IGESSelect_SelectBypassSubfigure.cxx
IGESSelect_SelectBypassSubfigure.hxx
-IGESSelect_SelectDrawingFrom.cxx
-IGESSelect_SelectDrawingFrom.hxx
IGESSelect_SelectFaces.cxx
IGESSelect_SelectFaces.hxx
IGESSelect_SelectFromDrawing.cxx
IGESSelect_SelectName.hxx
IGESSelect_SelectPCurves.cxx
IGESSelect_SelectPCurves.hxx
-IGESSelect_SelectSingleViewFrom.cxx
-IGESSelect_SelectSingleViewFrom.hxx
IGESSelect_SelectSubordinate.cxx
IGESSelect_SelectSubordinate.hxx
IGESSelect_SelectVisibleStatus.cxx
IGESSelect_SelectVisibleStatus.hxx
-IGESSelect_SetGlobalParameter.cxx
-IGESSelect_SetGlobalParameter.hxx
-IGESSelect_SetLabel.cxx
-IGESSelect_SetLabel.hxx
-IGESSelect_SetVersion5.cxx
-IGESSelect_SetVersion5.hxx
IGESSelect_SignColor.cxx
IGESSelect_SignColor.hxx
IGESSelect_SignLevelNumber.cxx
IGESSelect_SignLevelNumber.hxx
IGESSelect_SignStatus.cxx
IGESSelect_SignStatus.hxx
-IGESSelect_SplineToBSpline.cxx
-IGESSelect_SplineToBSpline.hxx
-IGESSelect_UpdateCreationDate.cxx
-IGESSelect_UpdateCreationDate.hxx
-IGESSelect_UpdateFileName.cxx
-IGESSelect_UpdateFileName.hxx
-IGESSelect_UpdateLastChange.cxx
-IGESSelect_UpdateLastChange.hxx
-IGESSelect_ViewSorter.cxx
-IGESSelect_ViewSorter.hxx
+++ /dev/null
-// 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 <IFSelect_ContextModif.hxx>
-#include <IGESBasic_Group.hxx>
-#include <IGESData_HArray1OfIGESEntity.hxx>
-#include <IGESData_IGESEntity.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESSelect_AddGroup.hxx>
-#include <Interface_Check.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_AddGroup,IGESSelect_ModelModifier)
-
-IGESSelect_AddGroup::IGESSelect_AddGroup ()
- : IGESSelect_ModelModifier (Standard_True) { }
-
-void IGESSelect_AddGroup::Performing (IFSelect_ContextModif& ctx,
- const Handle(IGESData_IGESModel)& target,
- Interface_CopyTool& /*TC*/) const
-{
- if (ctx.IsForAll()) {
- ctx.CCheck(0)->AddFail ("Add Group : Selection required not defined");
- return;
- }
- Interface_EntityIterator list = ctx.SelectedResult();
- Standard_Integer i = 0 , nb = list.NbEntities();
- if (nb == 0) {
- ctx.CCheck(0)->AddWarning ("Add Group : No entity selected");
- return;
- }
- if (nb == 1) {
- ctx.CCheck(0)->AddWarning ("Add Group : ONE entity selected");
- return;
- }
- Handle(IGESData_HArray1OfIGESEntity) arr =
- new IGESData_HArray1OfIGESEntity(1,nb);
- for (ctx.Start(); ctx.More(); ctx.Next()) {
- DeclareAndCast(IGESData_IGESEntity,ent,ctx.ValueResult());
- i ++;
- arr->SetValue(i,ent);
- }
- Handle(IGESBasic_Group) gr = new IGESBasic_Group;
- gr->Init (arr);
- target->AddEntity(gr);
-}
-
-
- TCollection_AsciiString IGESSelect_AddGroup::Label () const
- { return TCollection_AsciiString ("Add Group"); }
+++ /dev/null
-// Created on: 1995-03-02
-// Created by: Christian CAILLET
-// Copyright (c) 1995-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 _IGESSelect_AddGroup_HeaderFile
-#define _IGESSelect_AddGroup_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IGESSelect_ModelModifier.hxx>
-class IFSelect_ContextModif;
-class IGESData_IGESModel;
-class Interface_CopyTool;
-class TCollection_AsciiString;
-
-
-class IGESSelect_AddGroup;
-DEFINE_STANDARD_HANDLE(IGESSelect_AddGroup, IGESSelect_ModelModifier)
-
-//! Adds a Group to contain the entities designated by the
-//! Selection. If no Selection is given, nothing is done
-class IGESSelect_AddGroup : public IGESSelect_ModelModifier
-{
-
-public:
-
-
- //! Creates an AddGroup
- Standard_EXPORT IGESSelect_AddGroup();
-
- //! Specific action : Adds a new group
- Standard_EXPORT void Performing (IFSelect_ContextModif& ctx, const Handle(IGESData_IGESModel)& target, Interface_CopyTool& TC) const Standard_OVERRIDE;
-
- //! Returns a text which is
- //! "Add Group"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_AddGroup,IGESSelect_ModelModifier)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_AddGroup_HeaderFile
+++ /dev/null
-// 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 <IFSelect_ContextModif.hxx>
-#include <IGESData_BasicEditor.hxx>
-#include <IGESData_IGESEntity.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESData_Protocol.hxx>
-#include <IGESSelect_AutoCorrect.hxx>
-#include <Interface_Check.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_AutoCorrect,IGESSelect_ModelModifier)
-
-IGESSelect_AutoCorrect::IGESSelect_AutoCorrect ()
- : IGESSelect_ModelModifier (Standard_False) { }
-
- void IGESSelect_AutoCorrect::Performing
- (IFSelect_ContextModif& ctx,
- const Handle(IGESData_IGESModel)& target,
- Interface_CopyTool& ) const
-{
- DeclareAndCast(IGESData_Protocol,protocol,ctx.Protocol());
- if (protocol.IsNull()) {
- ctx.CCheck()->AddFail("IGES Auto Correct, not called with Protocol");
- return;
- }
-
- IGESData_BasicEditor corrector (target,protocol);
- for (ctx.Start(); ctx.More(); ctx.Next()) {
- DeclareAndCast(IGESData_IGESEntity,ent,ctx.ValueResult());
- Standard_Boolean done = corrector.AutoCorrect (ent);
- if (done) ctx.Trace();
- }
-}
-
-
- TCollection_AsciiString IGESSelect_AutoCorrect::Label () const
-{
- return TCollection_AsciiString ("Auto-Correction of IGES Entities");
-}
+++ /dev/null
-// Created on: 1994-06-01
-// 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 _IGESSelect_AutoCorrect_HeaderFile
-#define _IGESSelect_AutoCorrect_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IGESSelect_ModelModifier.hxx>
-class IFSelect_ContextModif;
-class IGESData_IGESModel;
-class Interface_CopyTool;
-class TCollection_AsciiString;
-
-
-class IGESSelect_AutoCorrect;
-DEFINE_STANDARD_HANDLE(IGESSelect_AutoCorrect, IGESSelect_ModelModifier)
-
-//! Does the absolutely effective corrections on IGES Entity.
-//! That is to say : regarding the norm in details, some values
-//! have mandatory values, or set of values with constraints.
-//! When such values/constraints are univoque, they can be forced.
-//! Also nullifies items of Directory Part, Associativities, and
-//! Properties, which are not (or not longer) in <target> Model.
-//!
-//! Works by calling a BasicEditor from IGESData
-//! Works with the specific IGES Services : DirChecker which
-//! allows to correct data in "Directory Part" of Entities (such
-//! as required values for status, or references to be null), and
-//! the specific IGES service OwnCorrect, which is specialised for
-//! each type of entity.
-//!
-//! Remark : this does not comprise the computation of use flag or
-//! subordinate status according references, which is made by
-//! the ModelModifier class ComputeStatus.
-//!
-//! The Input Selection, when present, designates the entities to
-//! be corrected. If it is not present, all the entities of the
-//! model are corrected.
-class IGESSelect_AutoCorrect : public IGESSelect_ModelModifier
-{
-
-public:
-
-
- //! Creates an AutoCorrect.
- Standard_EXPORT IGESSelect_AutoCorrect();
-
- //! Specific action : corrects entities when it is absolutely
- //! obvious, i.e. non equivoque (by DirChecker and specific
- //! service OwnCorrect) : works with a protocol.
- Standard_EXPORT void Performing (IFSelect_ContextModif& ctx, const Handle(IGESData_IGESModel)& target, Interface_CopyTool& TC) const Standard_OVERRIDE;
-
- //! Returns a text which is
- //! "Auto-correction of IGES Entities"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_AutoCorrect,IGESSelect_ModelModifier)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_AutoCorrect_HeaderFile
+++ /dev/null
-// Created on: 1994-08-25
-// 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 <IFSelect_ContextModif.hxx>
-#include <IFSelect_IntParam.hxx>
-#include <IGESData_IGESEntity.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESData_LevelListEntity.hxx>
-#include <IGESSelect_ChangeLevelList.hxx>
-#include <Interface_Check.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_ChangeLevelList,IGESSelect_ModelModifier)
-
-IGESSelect_ChangeLevelList::IGESSelect_ChangeLevelList ()
- : IGESSelect_ModelModifier (Standard_True) { }
-
- Standard_Boolean IGESSelect_ChangeLevelList::HasOldNumber () const
- { return (!theold.IsNull()); }
-
- Handle(IFSelect_IntParam) IGESSelect_ChangeLevelList::OldNumber () const
- { return theold; }
-
- void IGESSelect_ChangeLevelList::SetOldNumber
- (const Handle(IFSelect_IntParam)& param)
- { theold = param; }
-
- Standard_Boolean IGESSelect_ChangeLevelList::HasNewNumber () const
- { return (!thenew.IsNull()); }
-
- Handle(IFSelect_IntParam) IGESSelect_ChangeLevelList::NewNumber () const
- { return thenew; }
-
- void IGESSelect_ChangeLevelList::SetNewNumber
- (const Handle(IFSelect_IntParam)& param)
- { thenew = param; }
-
-
- void IGESSelect_ChangeLevelList::Performing
- (IFSelect_ContextModif& ctx,
- const Handle(IGESData_IGESModel)& ,
- Interface_CopyTool& ) const
-{
- Standard_Integer oldl = 0;
- Standard_Boolean yaold = HasOldNumber();
- if (yaold) oldl = theold->Value();
- Standard_Boolean yanew = HasOldNumber();
- Standard_Integer newl = 0;
- if (yanew) newl = thenew->Value();
- if (oldl < 0) ctx.CCheck()->AddFail("ChangeLevelList : OldNumber negative");
- if (newl < 0) ctx.CCheck()->AddFail("ChangeLevelList : NewNumber negative");
- if (oldl < 0 || newl < 0) return;
-
- Handle(IGESData_LevelListEntity) nulist;
- for (ctx.Start(); ctx.More(); ctx.Next()) {
- DeclareAndCast(IGESData_IGESEntity,ent,ctx.ValueResult());
- if (ent.IsNull()) continue;
- if (ent->DefLevel() != IGESData_DefSeveral) continue;
- if (yaold && ent->Level() != oldl) continue;
- if (!yanew) {
- Handle(IGESData_LevelListEntity) list = ent->LevelList();
- if (list.IsNull()) continue;
- newl = (list->NbLevelNumbers() > 0 ? list->LevelNumber(1) : 0);
- if (newl < 0) newl = 0;
- }
- ent->InitLevel(nulist,newl);
- ctx.Trace();
- }
-}
-
- TCollection_AsciiString IGESSelect_ChangeLevelList::Label () const
-{
- char labl[100];
- Standard_Integer oldl = 0;
- Standard_Boolean yaold = HasOldNumber();
- if (yaold) oldl = theold->Value();
- Standard_Boolean yanew = HasOldNumber();
- Standard_Integer newl = 0;
- if (yanew) newl = thenew->Value();
-
- if (yaold) sprintf(labl,"Changes Level Lists containing %d", oldl);
- else sprintf(labl,"Changes all Level Lists in D.E. %d", oldl);
- TCollection_AsciiString label(labl);
- if (yanew) sprintf(labl," to Number %d",newl);
- else sprintf(labl," to Number = first value in List");
- label.AssignCat(labl);
- return label;
-}
+++ /dev/null
-// Created on: 1994-08-25
-// 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 _IGESSelect_ChangeLevelList_HeaderFile
-#define _IGESSelect_ChangeLevelList_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IGESSelect_ModelModifier.hxx>
-#include <Standard_Boolean.hxx>
-class IFSelect_IntParam;
-class IFSelect_ContextModif;
-class IGESData_IGESModel;
-class Interface_CopyTool;
-class TCollection_AsciiString;
-
-
-class IGESSelect_ChangeLevelList;
-DEFINE_STANDARD_HANDLE(IGESSelect_ChangeLevelList, IGESSelect_ModelModifier)
-
-//! Changes Level List (in directory part) to a new single value
-//! Only entities attached to a LevelListEntity are considered
-//! If OldNumber is defined, only entities whose LevelList
-//! contains its Value are processed. Else all LevelLists are.
-//!
-//! Remark : this concerns the Directory Part only. The Level List
-//! Entities themselves (their content) are not affected.
-//!
-//! If NewNumber is defined (positive or zero), it gives the new
-//! value for Level Number. Else, the first value of the LevelList
-//! is set as new LevelNumber
-class IGESSelect_ChangeLevelList : public IGESSelect_ModelModifier
-{
-
-public:
-
-
- //! Creates a ChangeLevelList, not yet defined
- //! (see SetOldNumber and SetNewNumber)
- Standard_EXPORT IGESSelect_ChangeLevelList();
-
- //! Returns True if OldNumber is defined : then, only entities
- //! which have a LevelList which contains the value are processed.
- //! Else, all entities attached to a LevelList are.
- Standard_EXPORT Standard_Boolean HasOldNumber() const;
-
- //! Returns the parameter for OldNumber. If not defined (Null
- //! Handle), it will be interpreted as "all level lists"
- Standard_EXPORT Handle(IFSelect_IntParam) OldNumber() const;
-
- //! Sets a parameter for OldNumber
- Standard_EXPORT void SetOldNumber (const Handle(IFSelect_IntParam)& param);
-
- //! Returns True if NewNumber is defined : then, it gives the new
- //! value for Level Number. Else, the first value of the LevelList
- //! is used as new Level Number.
- Standard_EXPORT Standard_Boolean HasNewNumber() const;
-
- //! Returns the parameter for NewNumber. If not defined (Null
- //! Handle), it will be interpreted as "new value 0"
- Standard_EXPORT Handle(IFSelect_IntParam) NewNumber() const;
-
- //! Sets a parameter for NewNumber
- Standard_EXPORT void SetNewNumber (const Handle(IFSelect_IntParam)& param);
-
- //! Specific action : considers selected target entities :
- //! If OldNumber is not defined, all entities attached to a
- //! Level List
- //! If OldNumber is defined (value not negative), entities with a
- //! Level List which contains this value
- //! Attaches all these entities to value given by NewNumber, or
- //! the first value of the Level List
- Standard_EXPORT void Performing (IFSelect_ContextModif& ctx, const Handle(IGESData_IGESModel)& target, Interface_CopyTool& TC) const Standard_OVERRIDE;
-
- //! Returns a text which begins by
- //! "Changes Level Lists containing <old>", or
- //! "Changes all Level Lists in D.E.", and ends by
- //! " to Number <new>" or " to Number = first value in List"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_ChangeLevelList,IGESSelect_ModelModifier)
-
-protected:
-
-
-
-
-private:
-
-
- Handle(IFSelect_IntParam) theold;
- Handle(IFSelect_IntParam) thenew;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_ChangeLevelList_HeaderFile
+++ /dev/null
-// Created on: 1994-08-25
-// 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 <IFSelect_ContextModif.hxx>
-#include <IFSelect_IntParam.hxx>
-#include <IGESData_IGESEntity.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESData_LevelListEntity.hxx>
-#include <IGESSelect_ChangeLevelNumber.hxx>
-#include <Interface_Check.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_ChangeLevelNumber,IGESSelect_ModelModifier)
-
-IGESSelect_ChangeLevelNumber::IGESSelect_ChangeLevelNumber ()
- : IGESSelect_ModelModifier (Standard_False) { }
-
- Standard_Boolean IGESSelect_ChangeLevelNumber::HasOldNumber () const
- { return (!theold.IsNull()); }
-
- Handle(IFSelect_IntParam) IGESSelect_ChangeLevelNumber::OldNumber () const
- { return theold; }
-
- void IGESSelect_ChangeLevelNumber::SetOldNumber
- (const Handle(IFSelect_IntParam)& param)
- { theold = param; }
-
- Handle(IFSelect_IntParam) IGESSelect_ChangeLevelNumber::NewNumber () const
- { return thenew; }
-
- void IGESSelect_ChangeLevelNumber::SetNewNumber
- (const Handle(IFSelect_IntParam)& param)
- { thenew = param; }
-
-
- void IGESSelect_ChangeLevelNumber::Performing
- (IFSelect_ContextModif& ctx,
- const Handle(IGESData_IGESModel)& ,
- Interface_CopyTool& ) const
-{
- Standard_Integer oldl = 0;
- Standard_Boolean yaold = HasOldNumber();
- if (yaold) oldl = theold->Value();
- Standard_Integer newl = 0;
- if (!thenew.IsNull()) newl = thenew->Value();
- if (oldl < 0) ctx.CCheck()->AddFail("ChangeLevelNumber : OldNumber negative");
- if (newl < 0) ctx.CCheck()->AddFail("ChangeLevelNumber : NewNumber negative");
- if (oldl < 0 || newl < 0) return;
-
- Handle(IGESData_LevelListEntity) nulist;
- for (ctx.Start(); ctx.More(); ctx.Next()) {
- DeclareAndCast(IGESData_IGESEntity,ent,ctx.ValueResult());
- if (ent.IsNull()) continue;
- if (ent->DefLevel() == IGESData_DefSeveral) continue;
- if (yaold && ent->Level() != oldl) continue;
- ent->InitLevel(nulist,newl);
- ctx.Trace();
- }
-}
-
- TCollection_AsciiString IGESSelect_ChangeLevelNumber::Label () const
-{
- char labl[100];
- Standard_Integer oldl = 0;
- Standard_Boolean yaold = HasOldNumber();
- if (yaold) oldl = theold->Value();
- Standard_Integer newl = 0;
- if (!thenew.IsNull()) newl = thenew->Value();
-
- if (yaold) sprintf(labl,"Changes Level Number %d to %d",oldl,newl);
- else sprintf(labl,"Changes all Level Numbers positive and zero to %d",
- newl);
- return TCollection_AsciiString(labl);
-}
+++ /dev/null
-// Created on: 1994-08-25
-// 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 _IGESSelect_ChangeLevelNumber_HeaderFile
-#define _IGESSelect_ChangeLevelNumber_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IGESSelect_ModelModifier.hxx>
-#include <Standard_Boolean.hxx>
-class IFSelect_IntParam;
-class IFSelect_ContextModif;
-class IGESData_IGESModel;
-class Interface_CopyTool;
-class TCollection_AsciiString;
-
-
-class IGESSelect_ChangeLevelNumber;
-DEFINE_STANDARD_HANDLE(IGESSelect_ChangeLevelNumber, IGESSelect_ModelModifier)
-
-//! Changes Level Number (as null or single) to a new single value
-//! Entities attached to a LevelListEntity are ignored
-//! Entities considered can be, either all Entities but those
-//! attached to a LevelListEntity, or Entities attached to a
-//! specific Level Number (0 for not defined).
-//!
-//! Remark : this concerns the Directory Part only. The Level List
-//! Entities themselves (their content) are not affected.
-class IGESSelect_ChangeLevelNumber : public IGESSelect_ModelModifier
-{
-
-public:
-
-
- //! Creates a ChangeLevelNumber, not yet defined
- //! (see SetOldNumber and SetNewNumber)
- Standard_EXPORT IGESSelect_ChangeLevelNumber();
-
- //! Returns True if OldNumber is defined : then, only entities
- //! attached to the value of OldNumber will be considered. Else,
- //! all entities but those attached to a Level List will be.
- Standard_EXPORT Standard_Boolean HasOldNumber() const;
-
- //! Returns the parameter for OldNumber. If not defined (Null
- //! Handle), it will be interpreted as "all level numbers"
- Standard_EXPORT Handle(IFSelect_IntParam) OldNumber() const;
-
- //! Sets a parameter for OldNumber
- Standard_EXPORT void SetOldNumber (const Handle(IFSelect_IntParam)& param);
-
- //! Returns the parameter for NewNumber. If not defined (Null
- //! Handle), it will be interpreted as "new value 0"
- Standard_EXPORT Handle(IFSelect_IntParam) NewNumber() const;
-
- //! Sets a parameter for NewNumber
- Standard_EXPORT void SetNewNumber (const Handle(IFSelect_IntParam)& param);
-
- //! Specific action : considers selected target entities :
- //! If OldNumber is not defined, all entities but those attached
- //! to a Level List
- //! If OldNumber is defined (value not negative), entities with a
- //! defined Level Number (can be zero)
- //! Attaches all these entities to value given by NewNumber, or
- //! zero if not defined
- Standard_EXPORT void Performing (IFSelect_ContextModif& ctx, const Handle(IGESData_IGESModel)& target, Interface_CopyTool& TC) const Standard_OVERRIDE;
-
- //! Returns a text which is
- //! "Changes Level Number <old> to <new>" , or
- //! "Changes all Levels Numbers positive and zero to <new>"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_ChangeLevelNumber,IGESSelect_ModelModifier)
-
-protected:
-
-
-
-
-private:
-
-
- Handle(IFSelect_IntParam) theold;
- Handle(IFSelect_IntParam) thenew;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_ChangeLevelNumber_HeaderFile
+++ /dev/null
-// 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 <IFSelect_ContextModif.hxx>
-#include <IGESData_BasicEditor.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESData_Protocol.hxx>
-#include <IGESSelect_ComputeStatus.hxx>
-#include <Interface_Check.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_ComputeStatus,IGESSelect_ModelModifier)
-
-IGESSelect_ComputeStatus::IGESSelect_ComputeStatus ()
- : IGESSelect_ModelModifier (Standard_False) { }
-
- void IGESSelect_ComputeStatus::Performing
- (IFSelect_ContextModif& ctx,
- const Handle(IGESData_IGESModel)& target,
- Interface_CopyTool& ) const
-{
- DeclareAndCast(IGESData_Protocol,protocol,ctx.Protocol());
- if (protocol.IsNull()) {
- ctx.CCheck()->AddFail("IGES Compute Status, Protocol incorrect");
- return;
- }
-
- IGESData_BasicEditor corrector (target,protocol);
- corrector.ComputeStatus();
-}
-
-
- TCollection_AsciiString IGESSelect_ComputeStatus::Label () const
-{
- return TCollection_AsciiString ("Compute Status of IGES Entities (Directory Part)");
-}
+++ /dev/null
-// Created on: 1994-06-01
-// 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 _IGESSelect_ComputeStatus_HeaderFile
-#define _IGESSelect_ComputeStatus_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IGESSelect_ModelModifier.hxx>
-class IFSelect_ContextModif;
-class IGESData_IGESModel;
-class Interface_CopyTool;
-class TCollection_AsciiString;
-
-
-class IGESSelect_ComputeStatus;
-DEFINE_STANDARD_HANDLE(IGESSelect_ComputeStatus, IGESSelect_ModelModifier)
-
-//! Computes Status of IGES Entities for a whole IGESModel.
-//! This concerns SubordinateStatus and UseFlag, which must have
-//! some definite values according the way they are referenced.
-//! (see definitions of Logical use, Physical use, etc...)
-//!
-//! Works by calling a BasicEditor from IGESData. Works on the
-//! whole produced (target) model, because computation is global.
-class IGESSelect_ComputeStatus : public IGESSelect_ModelModifier
-{
-
-public:
-
-
- //! Creates an ComputeStatus, which uses the system Date
- Standard_EXPORT IGESSelect_ComputeStatus();
-
- //! Specific action : it first evaluates the required values for
- //! Subordinate Status and Use Flag (in Directory Part of each
- //! IGES Entity). Then it corrects them, for the whole target.
- //! Works with a Protocol. Implementation uses BasicEditor
- Standard_EXPORT void Performing (IFSelect_ContextModif& ctx, const Handle(IGESData_IGESModel)& target, Interface_CopyTool& TC) const Standard_OVERRIDE;
-
- //! Returns a text which is
- //! "Compute Subordinate Status and Use Flag"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_ComputeStatus,IGESSelect_ModelModifier)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_ComputeStatus_HeaderFile
+++ /dev/null
-// 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 <IFGraph_SubPartsIterator.hxx>
-#include <IFSelect_PacketList.hxx>
-#include <IFSelect_Selection.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESSelect_DispPerDrawing.hxx>
-#include <IGESSelect_ViewSorter.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_DispPerDrawing,IFSelect_Dispatch)
-
-IGESSelect_DispPerDrawing::IGESSelect_DispPerDrawing ()
- { thesorter = new IGESSelect_ViewSorter; }
-
- TCollection_AsciiString IGESSelect_DispPerDrawing::Label () const
-{
- return TCollection_AsciiString("One File per Drawing");
-}
-
-
- void IGESSelect_DispPerDrawing::Packets
- (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const
-{
- if (FinalSelection().IsNull()) return;
- Interface_EntityIterator list = FinalSelection()->UniqueResult(G);
- thesorter->SetModel (GetCasted(IGESData_IGESModel,G.Model()));
- thesorter->Clear();
- thesorter->AddList (list.Content());
- thesorter->SortDrawings(G);
- Handle(IFSelect_PacketList) sets = thesorter->Sets(Standard_True);
-
- packs.SetLoad();
- Standard_Integer nb = sets->NbPackets();
- for (Standard_Integer i = 1; i <= nb; i ++) {
- packs.AddPart();
- packs.GetFromIter (sets->Entities(i));
- }
-}
-
-
- Standard_Boolean IGESSelect_DispPerDrawing::CanHaveRemainder () const
- { return Standard_True; }
-
- Interface_EntityIterator IGESSelect_DispPerDrawing::Remainder
- (const Interface_Graph& G) const
-{
- if (thesorter->NbEntities() == 0) {
- Interface_EntityIterator list;
- if (FinalSelection().IsNull()) return list;
- list = FinalSelection()->UniqueResult(G);
- thesorter->Clear();
- thesorter->AddList (list.Content());
- thesorter->SortDrawings(G);
- }
- return thesorter->Sets(Standard_True)->Duplicated (0,Standard_False);
-}
+++ /dev/null
-// Created on: 1994-05-31
-// 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 _IGESSelect_DispPerDrawing_HeaderFile
-#define _IGESSelect_DispPerDrawing_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Dispatch.hxx>
-#include <Standard_Boolean.hxx>
-class IGESSelect_ViewSorter;
-class TCollection_AsciiString;
-class Interface_Graph;
-class IFGraph_SubPartsIterator;
-class Interface_EntityIterator;
-
-
-class IGESSelect_DispPerDrawing;
-DEFINE_STANDARD_HANDLE(IGESSelect_DispPerDrawing, IFSelect_Dispatch)
-
-//! This type of dispatch defines sets of entities attached to
-//! distinct drawings. This information is taken from attached
-//! views which appear in the Directory Part. Also Drawing Frames
-//! are considered when Drawings are part of input list.
-//!
-//! Remaining data concern entities not attached to a drawing.
-class IGESSelect_DispPerDrawing : public IFSelect_Dispatch
-{
-
-public:
-
-
- //! Creates a DispPerDrawing
- Standard_EXPORT IGESSelect_DispPerDrawing();
-
- //! Returns as Label, "One File per Drawing"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
- //! Computes the list of produced Packets. Packets are computed
- //! by a ViewSorter (SortDrawings with also frames).
- Standard_EXPORT void Packets (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const Standard_OVERRIDE;
-
- //! Returns True, because of entities attached to no view.
- Standard_EXPORT virtual Standard_Boolean CanHaveRemainder() const Standard_OVERRIDE;
-
- //! Returns Remainder which is a set of Entities.
- //! It is supposed to be called once Packets has been called.
- Standard_EXPORT virtual Interface_EntityIterator Remainder (const Interface_Graph& G) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_DispPerDrawing,IFSelect_Dispatch)
-
-protected:
-
-
-
-
-private:
-
-
- Handle(IGESSelect_ViewSorter) thesorter;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_DispPerDrawing_HeaderFile
+++ /dev/null
-// 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 <IFGraph_SubPartsIterator.hxx>
-#include <IFSelect_PacketList.hxx>
-#include <IFSelect_Selection.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESSelect_DispPerSingleView.hxx>
-#include <IGESSelect_ViewSorter.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_DispPerSingleView,IFSelect_Dispatch)
-
-IGESSelect_DispPerSingleView::IGESSelect_DispPerSingleView ()
- { thesorter = new IGESSelect_ViewSorter; }
-
- TCollection_AsciiString IGESSelect_DispPerSingleView::Label () const
-{
- return TCollection_AsciiString("One File per single View or Drawing Frame");
-}
-
-
- void IGESSelect_DispPerSingleView::Packets
- (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const
-{
- if (FinalSelection().IsNull()) return;
- Interface_EntityIterator list = FinalSelection()->UniqueResult(G);
- thesorter->SetModel (GetCasted(IGESData_IGESModel,G.Model()));
- thesorter->Clear();
- thesorter->AddList (list.Content());
- thesorter->SortSingleViews(Standard_True);
- Handle(IFSelect_PacketList) sets = thesorter->Sets(Standard_True);
-
- packs.SetLoad();
- Standard_Integer nb = sets->NbPackets();
- for (Standard_Integer i = 1; i <= nb; i ++) {
- packs.AddPart();
- packs.GetFromIter (sets->Entities(i));
- }
-}
-
-
- Standard_Boolean IGESSelect_DispPerSingleView::CanHaveRemainder () const
- { return Standard_True; }
-
- Interface_EntityIterator IGESSelect_DispPerSingleView::Remainder
- (const Interface_Graph& G) const
-{
- if (thesorter->NbEntities() == 0) {
- Interface_EntityIterator list;
- if (FinalSelection().IsNull()) return list;
- list = FinalSelection()->UniqueResult(G);
- thesorter->Clear();
- thesorter->Add (list.Content());
- thesorter->SortSingleViews(Standard_True);
- }
- return thesorter->Sets(Standard_True)->Duplicated (0,Standard_False);
-}
+++ /dev/null
-// Created on: 1994-05-31
-// 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 _IGESSelect_DispPerSingleView_HeaderFile
-#define _IGESSelect_DispPerSingleView_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Dispatch.hxx>
-#include <Standard_Boolean.hxx>
-class IGESSelect_ViewSorter;
-class TCollection_AsciiString;
-class Interface_Graph;
-class IFGraph_SubPartsIterator;
-class Interface_EntityIterator;
-
-
-class IGESSelect_DispPerSingleView;
-DEFINE_STANDARD_HANDLE(IGESSelect_DispPerSingleView, IFSelect_Dispatch)
-
-//! This type of dispatch defines sets of entities attached to
-//! distinct single views. This information appears in the
-//! Directory Part. Drawings are taken into account too,
-//! because of their frames (proper lists of annotations)
-//!
-//! Remaining data concern entities not attached to a single view.
-class IGESSelect_DispPerSingleView : public IFSelect_Dispatch
-{
-
-public:
-
-
- //! Creates a DispPerSingleView
- Standard_EXPORT IGESSelect_DispPerSingleView();
-
- //! Returns as Label, "One File per single View or Drawing Frame"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
- //! Computes the list of produced Packets. Packets are computed
- //! by a ViewSorter (SortSingleViews with also frames).
- Standard_EXPORT void Packets (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const Standard_OVERRIDE;
-
- //! Returns True, because of entities attached to no view.
- Standard_EXPORT virtual Standard_Boolean CanHaveRemainder() const Standard_OVERRIDE;
-
- //! Returns Remainder which is a set of Entities.
- //! It is supposed to be called once Packets has been called.
- Standard_EXPORT virtual Interface_EntityIterator Remainder (const Interface_Graph& G) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_DispPerSingleView,IFSelect_Dispatch)
-
-protected:
-
-
-
-
-private:
-
-
- Handle(IGESSelect_ViewSorter) thesorter;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_DispPerSingleView_HeaderFile
+++ /dev/null
-// 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 <IFSelect_IntParam.hxx>
-#include <IFSelect_SessionFile.hxx>
-#include <IGESSelect_AutoCorrect.hxx>
-#include <IGESSelect_ChangeLevelList.hxx>
-#include <IGESSelect_ChangeLevelNumber.hxx>
-#include <IGESSelect_ComputeStatus.hxx>
-#include <IGESSelect_DispPerDrawing.hxx>
-#include <IGESSelect_DispPerSingleView.hxx>
-#include <IGESSelect_Dumper.hxx>
-#include <IGESControl_FloatFormat.hxx>
-#include <IGESSelect_RebuildDrawings.hxx>
-#include <IGESSelect_RebuildGroups.hxx>
-#include <IGESSelect_SelectBypassGroup.hxx>
-#include <IGESSelect_SelectDrawingFrom.hxx>
-#include <IGESSelect_SelectFromDrawing.hxx>
-#include <IGESSelect_SelectFromSingleView.hxx>
-#include <IGESSelect_SelectLevelNumber.hxx>
-#include <IGESSelect_SelectName.hxx>
-#include <IGESSelect_SelectSingleViewFrom.hxx>
-#include <IGESSelect_SelectVisibleStatus.hxx>
-#include <IGESSelect_SetGlobalParameter.hxx>
-#include <IGESSelect_SetVersion5.hxx>
-#include <IGESSelect_SplineToBSpline.hxx>
-#include <IGESSelect_UpdateCreationDate.hxx>
-#include <IGESSelect_UpdateLastChange.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_Dumper,IFSelect_SessionDumper)
-
- Standard_Boolean IGESSelect_Dumper::WriteOwn
- (IFSelect_SessionFile& file, const Handle(Standard_Transient)& item) const
-{
- if (item.IsNull()) return Standard_False;
- Handle(Standard_Type) type = item->DynamicType();
- if (type == STANDARD_TYPE(IGESSelect_DispPerSingleView)) return Standard_True;
- if (type == STANDARD_TYPE(IGESSelect_DispPerDrawing)) return Standard_True;
-/* if (type == STANDARD_TYPE(IGESSelect_SelectIGESTypeForm)) {
- DeclareAndCast(IGESSelect_SelectIGESTypeForm,sf,item);
- Standard_Boolean exact = sf->IsExact();
- TCollection_AsciiString text = sf->SignatureText(); // attention, 1-2 term
- if (exact) file.SendText("exact");
- else file.SendText("contains");
- file.SendText(text.ToCString());
- return Standard_True;
- } */
- if (type == STANDARD_TYPE(IGESSelect_SelectVisibleStatus)) return Standard_True;
- if (type == STANDARD_TYPE(IGESSelect_SelectLevelNumber)) {
- DeclareAndCast(IGESSelect_SelectLevelNumber,sl,item);
- Handle(IFSelect_IntParam) lev = sl->LevelNumber();
- file.SendItem(lev);
- return Standard_True;
- }
- if (type == STANDARD_TYPE(IGESSelect_SelectName)) {
- DeclareAndCast(IGESSelect_SelectName,sn,item);
- Handle(TCollection_HAsciiString) name = sn->Name();
- file.SendItem(name);
- return Standard_True;
- }
- if (type == STANDARD_TYPE(IGESSelect_SelectFromSingleView)) return Standard_True;
- if (type == STANDARD_TYPE(IGESSelect_SelectFromDrawing)) return Standard_True;
- if (type == STANDARD_TYPE(IGESSelect_SelectSingleViewFrom)) return Standard_True;
- if (type == STANDARD_TYPE(IGESSelect_SelectDrawingFrom)) return Standard_True;
- if (type == STANDARD_TYPE(IGESSelect_SelectBypassGroup)) return Standard_True;
-
- if (type == STANDARD_TYPE(IGESControl_FloatFormat)) {
- DeclareAndCast(IGESControl_FloatFormat,ff,item);
- Standard_Boolean zerosup, hasrange;
- Standard_Real rangemin, rangemax;
- TCollection_AsciiString mainform,forminrange;
- ff->Format (zerosup,mainform,hasrange,forminrange,rangemin,rangemax);
- file.SendText((char*)(zerosup ? "zerosup" : "nozerosup"));
- file.SendText(mainform.ToCString());
- if (hasrange) {
- char flotrange[20];
- file.SendText(forminrange.ToCString());
- Sprintf(flotrange,"%f",rangemin);
- file.SendText(flotrange);
- Sprintf(flotrange,"%f",rangemax);
- file.SendText(flotrange);
- }
- return Standard_True;
- }
-
- if (type == STANDARD_TYPE(IGESSelect_UpdateCreationDate)) return Standard_True;
- if (type == STANDARD_TYPE(IGESSelect_UpdateLastChange)) return Standard_True;
- if (type == STANDARD_TYPE(IGESSelect_SetVersion5)) return Standard_True;
- if (type == STANDARD_TYPE(IGESSelect_SetGlobalParameter)) {
- DeclareAndCast(IGESSelect_SetGlobalParameter,sp,item);
- Standard_Integer np = sp->GlobalNumber();
- Handle(TCollection_HAsciiString) val = sp->Value();
- char intext[10];
- sprintf(intext,"%d",np);
- file.SendText(intext);
- file.SendItem(val);
- return Standard_True;
- }
- if (type == STANDARD_TYPE(IGESSelect_AutoCorrect)) return Standard_True;
- if (type == STANDARD_TYPE(IGESSelect_ComputeStatus)) return Standard_True;
- if (type == STANDARD_TYPE(IGESSelect_RebuildDrawings)) return Standard_True;
- if (type == STANDARD_TYPE(IGESSelect_RebuildGroups)) return Standard_True;
- if (type == STANDARD_TYPE(IGESSelect_ChangeLevelList)) {
- DeclareAndCast(IGESSelect_ChangeLevelList,cl,item);
- file.SendItem(cl->OldNumber());
- file.SendItem(cl->NewNumber());
- return Standard_True;
- }
- if (type == STANDARD_TYPE(IGESSelect_ChangeLevelNumber)) {
- DeclareAndCast(IGESSelect_ChangeLevelNumber,cl,item);
- file.SendItem(cl->OldNumber());
- file.SendItem(cl->NewNumber());
- return Standard_True;
- }
-
- if (type == STANDARD_TYPE(IGESSelect_SplineToBSpline)) {
- Standard_Boolean tryc2 =
- GetCasted(IGESSelect_SplineToBSpline,item)->OptionTryC2();
- file.SendText((char*)(tryc2 ? "TryC2" : "Normal"));
- return Standard_True;
- }
- return Standard_False;
-}
-
-
- Standard_Boolean IGESSelect_Dumper::ReadOwn
- (IFSelect_SessionFile& file, const TCollection_AsciiString& type,
- Handle(Standard_Transient)& item) const
-{
- if (type.IsEqual("IGESSelect_DispPerSingleView"))
- { item = new IGESSelect_DispPerSingleView; return Standard_True; }
- if (type.IsEqual("IGESSelect_DispPerDrawing"))
- { item = new IGESSelect_DispPerDrawing; return Standard_True; }
-
- if (type.IsEqual("IGESSelect_SelectIGESTypeForm")) {
- if (file.NbParams() < 2) return Standard_False;
- //Standard_Boolean exact; //szv#4:S4163:12Mar99 not needed
- const TCollection_AsciiString exname = file.ParamValue(1);
- if (exname.Length() < 1) return Standard_False;
- if (exname.Value(1) == 'e') {} //szv#4:S4163:12Mar99 `exact = Standard_True` not needed
- else if (exname.Value(1) == 'c') {} //szv#4:S4163:12Mar99 `exact = Standard_False` not needed
- else return Standard_False;
- // Attention, 2 termes possibles pour la signature
- char sig[40];
- if (file.NbParams() == 2) sprintf(sig,"%s",file.ParamValue(2).ToCString());
- else sprintf(sig,"%s %s",file.ParamValue(2).ToCString(),file.ParamValue(3).ToCString());
-// item = new IGESSelect_SelectIGESTypeForm(sig,exact);
-// return Standard_True;
- }
- if (type.IsEqual("IGESSelect_SelectVisibleStatus"))
- { item = new IGESSelect_SelectVisibleStatus; return Standard_True; }
-
- if (type.IsEqual("IGESSelect_SelectLevelNumber")) {
- if (file.NbParams() < 1) return Standard_False;
- Handle(IGESSelect_SelectLevelNumber) sl = new IGESSelect_SelectLevelNumber;
- DeclareAndCast(IFSelect_IntParam,lev,file.ItemValue(1));
- sl->SetLevelNumber(lev);
- item = sl;
- return Standard_True;
- }
- if (type.IsEqual("IGESSelect_SelectName")) {
- if (file.NbParams() < 1) return Standard_False;
- Handle(IGESSelect_SelectName) sn = new IGESSelect_SelectName;
- Handle(TCollection_HAsciiString) name = sn->Name();
- item = sn;
- return Standard_True;
- }
- if (type.IsEqual("IGESSelect_SelectFromSingleView"))
- { item = new IGESSelect_SelectFromSingleView; return Standard_True; }
- if (type.IsEqual("IGESSelect_SelectFromDrawing"))
- { item = new IGESSelect_SelectFromDrawing; return Standard_True; }
- if (type.IsEqual("IGESSelect_SelectSingleViewFrom"))
- { item = new IGESSelect_SelectSingleViewFrom; return Standard_True; }
- if (type.IsEqual("IGESSelect_SelectDrawingFrom"))
- { item = new IGESSelect_SelectDrawingFrom; return Standard_True; }
- if (type.IsEqual("IGESSelect_SelectBypassGroup"))
- { item = new IGESSelect_SelectBypassGroup; return Standard_True; }
-
- if (type.IsEqual("IGESControl_FloatFormat")) {
- if (file.NbParams() < 2) return Standard_False;
- Handle(IGESControl_FloatFormat) ff = new IGESControl_FloatFormat;
- Standard_Boolean zerosup;
- const TCollection_AsciiString zsup = file.ParamValue(1);
- if (zsup.Length() < 1) return Standard_False;
- if (zsup.Value(1) == 'z') zerosup = Standard_True;
- else if (zsup.Value(1) == 'n') zerosup = Standard_False;
- else return Standard_False;
- ff->SetFormat(file.ParamValue(2).ToCString());
- ff->SetZeroSuppress(zerosup);
- if (file.NbParams() >= 5) {
- //char flotrange[20]; //szv#4:S4163:12Mar99 unused
- Standard_Real rangemin, rangemax;
- rangemin = Atof (file.ParamValue(4).ToCString());
- rangemax = Atof (file.ParamValue(5).ToCString());
- ff->SetFormatForRange (file.ParamValue(3).ToCString(),rangemin,rangemax);
- }
- item = ff;
- return Standard_True;
- }
-
- if (type.IsEqual("IGESSelect_UpdateCreationDate"))
- { item = new IGESSelect_UpdateCreationDate; return Standard_True; }
- if (type.IsEqual("IGESSelect_UpdateLastChange"))
- { item = new IGESSelect_UpdateLastChange; return Standard_True; }
- if (type.IsEqual("IGESSelect_SetVersion5"))
- { item = new IGESSelect_SetVersion5; return Standard_True; }
- if (type.IsEqual("IGESSelect_SetGlobalParameter")) {
- if (file.NbParams() < 2) return Standard_False;
- Standard_Integer np = atoi(file.ParamValue(1).ToCString());
- DeclareAndCast(TCollection_HAsciiString,val,file.ItemValue(2));
- Handle(IGESSelect_SetGlobalParameter) sp =
- new IGESSelect_SetGlobalParameter(np);
- sp->SetValue(val);
- item = sp;
- return Standard_True;
- }
-
- if (type.IsEqual("IGESSelect_AutoCorrect"))
- { item = new IGESSelect_AutoCorrect; return Standard_True; }
- if (type.IsEqual("IGESSelect_ComputeStatus"))
- { item = new IGESSelect_ComputeStatus; return Standard_True; }
- if (type.IsEqual("IGESSelect_RebuildDrawings"))
- { item = new IGESSelect_RebuildDrawings; return Standard_True; }
- if (type.IsEqual("IGESSelect_RebuildGroups"))
- { item = new IGESSelect_RebuildGroups; return Standard_True; }
-
- if (type.IsEqual("IGESSelect_ChangeLevelList")) {
- if (file.NbParams() < 2) return Standard_False;
- Handle(IGESSelect_ChangeLevelList) cl = new IGESSelect_ChangeLevelList;
- DeclareAndCast(IFSelect_IntParam,oldpar,file.ItemValue(1));
- DeclareAndCast(IFSelect_IntParam,newpar,file.ItemValue(2));
- cl->SetOldNumber(oldpar);
- cl->SetNewNumber(newpar);
- item = cl;
- return Standard_True;
- }
- if (type.IsEqual("IGESSelect_ChangeLevelNumber")) {
- if (file.NbParams() < 2) return Standard_False;
- Handle(IGESSelect_ChangeLevelNumber) cl = new IGESSelect_ChangeLevelNumber;
- DeclareAndCast(IFSelect_IntParam,oldpar,file.ItemValue(1));
- DeclareAndCast(IFSelect_IntParam,newpar,file.ItemValue(2));
- cl->SetOldNumber(oldpar);
- cl->SetNewNumber(newpar);
- item = cl;
- return Standard_True;
- }
-
- if (type.IsEqual("IGESSelect_SplineToBSpline")) {
- if (file.NbParams() < 1) return Standard_False;
- Standard_Boolean tryc2;
- const TCollection_AsciiString tc2 = file.ParamValue(1);
- if (tc2.Length() < 1) return Standard_False;
- if (tc2.Value(1) == 'T') tryc2 = Standard_True;
- else if (tc2.Value(1) == 'N') tryc2 = Standard_False;
- else return Standard_False;
- item = new IGESSelect_SplineToBSpline(tryc2);
- return Standard_True;
- }
- return Standard_False;
-}
+++ /dev/null
-// Created on: 1994-06-03
-// 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 _IGESSelect_Dumper_HeaderFile
-#define _IGESSelect_Dumper_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SessionDumper.hxx>
-class IFSelect_SessionFile;
-class TCollection_AsciiString;
-
-class IGESSelect_Dumper;
-DEFINE_STANDARD_HANDLE(IGESSelect_Dumper, IFSelect_SessionDumper)
-
-//! Dumper from IGESSelect takes into account, for SessionFile, the
-//! classes defined in the package IGESSelect : Selections,
-//! Dispatches, Modifiers
-class IGESSelect_Dumper : public IFSelect_SessionDumper
-{
- public:
-
- //! Creates a Dumper and puts it into the Library of Dumper
- IGESSelect_Dumper() {}
-
- //! Write the Own Parameters of Types defined in package IGESSelect
- //! Returns True if <item> 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
- //! IGESSelect. Returns True if done and <item> 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(IGESSelect_Dumper,IFSelect_SessionDumper)
-};
-
-#endif // _IGESSelect_Dumper_HeaderFile
+++ /dev/null
-// 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 <IFSelect_EditForm.hxx>
-#include <IGESData_ColorEntity.hxx>
-#include <IGESData_IGESEntity.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESData_LabelDisplayEntity.hxx>
-#include <IGESData_LevelListEntity.hxx>
-#include <IGESData_LineFontEntity.hxx>
-#include <IGESData_TransfEntity.hxx>
-#include <IGESData_ViewKindEntity.hxx>
-#include <IGESSelect_EditDirPart.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Interface_Static.hxx>
-#include <Interface_TypedValue.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_EditDirPart,IFSelect_Editor)
-
-static Handle(Interface_TypedValue) NewDefType(const Standard_CString name)
-{
- Handle(Interface_TypedValue) deftype = new Interface_TypedValue(name,Interface_ParamEnum);
- deftype->StartEnum(0);
- deftype->AddEnumValue("Void",0);
- deftype->AddEnumValue("Value",1);
- deftype->AddEnumValue("Entity",2);
- return deftype;
-}
-
-static Handle(Interface_TypedValue) NewDefList(const Standard_CString name)
-{
- Handle(Interface_TypedValue) deftype = new Interface_TypedValue(name,Interface_ParamEnum);
- deftype->StartEnum(0);
- deftype->AddEnumValue("None",0);
- deftype->AddEnumValue("One",1);
- deftype->AddEnumValue("List",2);
- return deftype;
-}
-
- IGESSelect_EditDirPart::IGESSelect_EditDirPart ()
- : IFSelect_Editor (23)
-{
- //Standard_Integer i,nb; //szv#4:S4163:12Mar99 unused
- // Definition
- Handle(Interface_TypedValue) typenum = new Interface_TypedValue("Type Number",Interface_ParamInteger);
- SetValue (1,typenum,"D1:Type",IFSelect_EditRead);
- Handle(Interface_TypedValue) formnum = new Interface_TypedValue("Form Number",Interface_ParamInteger);
- SetValue (2,formnum,"D15:Form",IFSelect_EditRead);
-
- Handle(Interface_TypedValue) stru = new Interface_TypedValue("Structure",Interface_ParamIdent);
- SetValue (3,stru,"D3:Struct",IFSelect_Optional);
-
- Handle(Interface_TypedValue) lftype = NewDefType("Line Font Pattern");
- SetValue (4,lftype,"D4:LineFont",IFSelect_EditDynamic);
- Handle(Interface_TypedValue) lfval = new Interface_TypedValue("Line Font Number",Interface_ParamInteger);
- lfval->SetIntegerLimit (Standard_False,0);
- SetValue (5,lfval, "N4:LineFont",IFSelect_Optional);
- Handle(Interface_TypedValue) lfent = new Interface_TypedValue("Line Font Entity",Interface_ParamIdent);
- SetValue (6,lfent, "E4:LineFont",IFSelect_Optional);
-
- Handle(Interface_TypedValue) levlist = NewDefList("Level");
- SetValue (7,levlist,"D5:Level",IFSelect_EditDynamic);
- Handle(Interface_TypedValue) leval = new Interface_TypedValue("Level Number",Interface_ParamInteger);
- leval->SetIntegerLimit (Standard_False,0);
- SetValue (8,leval,"N5:Level",IFSelect_Optional);
- Handle(Interface_TypedValue) levent = new Interface_TypedValue("Level List Entity",Interface_ParamIdent);
- SetValue (9,levent,"L5:Level",IFSelect_Optional);
-
- Handle(Interface_TypedValue) viewlist = NewDefList("View");
- SetValue (10,viewlist,"D6:View",IFSelect_EditDynamic);
- Handle(Interface_TypedValue) viewent = new Interface_TypedValue("View Entity",Interface_ParamIdent);
- SetValue (11,viewent,"E6:View",IFSelect_Optional);
-
- Handle(Interface_TypedValue) transf = new Interface_TypedValue("Transformation",Interface_ParamIdent);
- SetValue (12,transf,"D7:Transf",IFSelect_Optional);
-
- Handle(Interface_TypedValue) labdisp = new Interface_TypedValue("Label Display Associativity",Interface_ParamIdent);
- SetValue (13,labdisp,"D8:LabelDisp",IFSelect_Optional);
-
- Handle(Interface_TypedValue) blank = new Interface_TypedValue("Blank Status",Interface_ParamInteger);
- blank->SetIntegerLimit (Standard_False,0);
- blank->SetIntegerLimit (Standard_True ,1);
- SetValue (14,blank,"D9-1:Blank");
- Handle(Interface_TypedValue) subord = new Interface_TypedValue("Subordinate Status",Interface_ParamInteger);
- subord->SetIntegerLimit (Standard_False,0);
- subord->SetIntegerLimit (Standard_True ,3);
- SetValue (15,subord,"D9-2:Subordinate",IFSelect_EditProtected);
- Handle(Interface_TypedValue) useflg = new Interface_TypedValue("Use Flag",Interface_ParamInteger);
- useflg->SetIntegerLimit (Standard_False,0);
- useflg->SetIntegerLimit (Standard_True ,6);
- SetValue (16,useflg,"D9-3:UseFlag");
- Handle(Interface_TypedValue) hier = new Interface_TypedValue("Hierarchy",Interface_ParamInteger);
- hier->SetIntegerLimit (Standard_False,0);
- hier->SetIntegerLimit (Standard_True ,2);
- SetValue (17,hier,"D9-4:Hierarchy",IFSelect_EditProtected);
-
- Handle(Interface_TypedValue) lwnum = new Interface_TypedValue("Line Weight Number",Interface_ParamInteger);
- lwnum->SetIntegerLimit (Standard_False,0);
- SetValue (18,lwnum,"D12:LineWeight");
-
- Handle(Interface_TypedValue) coltype = NewDefType("Color");
- SetValue (19,coltype,"D13:Color",IFSelect_EditDynamic);
- Handle(Interface_TypedValue) colval = new Interface_TypedValue("Color Number",Interface_ParamInteger);
- colval->SetIntegerLimit (Standard_False,0);
- SetValue (20,colval, "N13:Color",IFSelect_Optional);
- Handle(Interface_TypedValue) colent = new Interface_TypedValue("Color Entity",Interface_ParamIdent);
- SetValue (21,colent, "E13:Color",IFSelect_Optional);
-
- Handle(Interface_TypedValue) entlab = new Interface_TypedValue("Entity Label");
- SetValue (22,entlab,"D18:Label");
- Handle(Interface_TypedValue) sublab = new Interface_TypedValue("Subscript Number",Interface_ParamInteger);
- SetValue (23,sublab,"D19:Subscript",IFSelect_Optional);
-
-}
-
- TCollection_AsciiString IGESSelect_EditDirPart::Label () const
- { return TCollection_AsciiString ("IGES Header"); }
-
- Standard_Boolean IGESSelect_EditDirPart::Recognize
- (const Handle(IFSelect_EditForm)& /*form*/) const
-{ return Standard_True; } // ??
-
- Handle(TCollection_HAsciiString) IGESSelect_EditDirPart::StringValue
- (const Handle(IFSelect_EditForm)& /*form*/, const Standard_Integer num) const
-{
-// Default Values
- return TypedValue(num)->HStringValue();
-}
-
-
-Handle(TCollection_HAsciiString) DefTypeName (const IGESData_DefType& deftype)
-{
- switch (deftype) {
- case IGESData_DefVoid : return new TCollection_HAsciiString("Void");
- case IGESData_DefValue : return new TCollection_HAsciiString("Value");
- case IGESData_DefReference : return new TCollection_HAsciiString("Entity");
- default : break;
- }
- return new TCollection_HAsciiString("???");
-}
-
-Handle(TCollection_HAsciiString) DefListName (const IGESData_DefList& deflist)
-{
- switch (deflist) {
- case IGESData_DefNone : return new TCollection_HAsciiString("None");
- case IGESData_DefOne : return new TCollection_HAsciiString("One");
- case IGESData_DefSeveral : return new TCollection_HAsciiString("List");
- default : break;
- }
- return new TCollection_HAsciiString("???");
-}
-
-
- Standard_Boolean IGESSelect_EditDirPart::Load
- (const Handle(IFSelect_EditForm)& form,
- const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& model) const
-{
- Handle(IGESData_IGESModel) modl =
- Handle(IGESData_IGESModel)::DownCast(model);
- if (modl.IsNull()) return Standard_False;
- Handle(IGESData_IGESEntity) iges =
- Handle(IGESData_IGESEntity)::DownCast(ent);
- if (iges.IsNull()) return Standard_False;
-
- form->LoadValue (1 ,new TCollection_HAsciiString(iges->TypeNumber()));
- form->LoadValue (2 ,new TCollection_HAsciiString(iges->FormNumber()));
- if (iges->HasStructure()) form->LoadValue (3 ,modl->StringLabel(iges->Structure()) );
-
- form->LoadValue (4 ,DefTypeName (iges->DefLineFont()) );
- form->LoadValue (5 ,new TCollection_HAsciiString(iges->RankLineFont()) );
- if (iges->DefLineFont() == IGESData_DefReference)
- form->LoadValue (6 ,modl->StringLabel(iges->LineFont()) );
-
- form->LoadValue (7 ,DefListName (iges->DefLevel()) );
- form->LoadValue (8 ,new TCollection_HAsciiString (iges->Level()) );
- if (iges->DefLevel() == IGESData_DefSeveral)
- form->LoadValue (9 ,modl->StringLabel(iges->LevelList()) );
-
- form->LoadValue (10 ,DefListName (iges->DefView()) );
- if (iges->DefView() != IGESData_DefNone)
- form->LoadValue (11 ,modl->StringLabel(iges->View()) );
-
- if (iges->HasTransf()) form->LoadValue (12 ,modl->StringLabel(iges->Transf()) );
- if (iges->HasLabelDisplay()) form->LoadValue (13 ,modl->StringLabel(iges->LabelDisplay()) );
-
- form->LoadValue (14 ,new TCollection_HAsciiString(iges->BlankStatus()) );
- form->LoadValue (15 ,new TCollection_HAsciiString(iges->SubordinateStatus()) );
- form->LoadValue (16 ,new TCollection_HAsciiString(iges->UseFlag()) );
- form->LoadValue (17 ,new TCollection_HAsciiString(iges->HierarchyStatus()) );
-
- form->LoadValue (18 ,new TCollection_HAsciiString(iges->LineWeightNumber()) );
-
- form->LoadValue (19 ,DefTypeName (iges->DefColor()) );
- form->LoadValue (20 ,new TCollection_HAsciiString(iges->RankColor()) );
- if (iges->DefColor() == IGESData_DefReference)
- form->LoadValue (21 ,modl->StringLabel(iges->Color()) );
-
- form->LoadValue (22 ,iges->ShortLabel());
- if (iges->HasSubScriptNumber()) form->LoadValue (23 ,new TCollection_HAsciiString(iges->SubScriptNumber()) );
-
- return Standard_True;
-}
-
- Standard_Boolean IGESSelect_EditDirPart::Update
- (const Handle(IFSelect_EditForm)& form,
- const Standard_Integer num,
- const Handle(TCollection_HAsciiString)& val,
- const Standard_Boolean /*enforce*/) const
-{
- Handle(TCollection_HAsciiString) nulstr;
- Handle(IGESData_IGESModel) modl =
- Handle(IGESData_IGESModel)::DownCast(form->Model());
-
-// LineFont
- if (num == 5) {
- if (val.IsNull()) form->Touch (4,DefTypeName(IGESData_DefVoid));
- else form->Touch (4,DefTypeName(IGESData_DefValue));
- }
- if (num == 6) {
- if (val.IsNull()) form->Touch (4,DefTypeName(IGESData_DefVoid));
- else form->Touch (4,DefTypeName(IGESData_DefReference));
- }
-
-// Level
- if (num == 8) {
- if (val.IsNull()) form->Touch (7,DefListName(IGESData_DefNone));
- else form->Touch (7,DefListName(IGESData_DefOne));
- }
- if (num == 9) {
- if (val.IsNull()) form->Touch (7,DefListName(IGESData_DefNone));
- else form->Touch (7,DefListName(IGESData_DefSeveral));
- }
-
-// View
- if (num == 11) {
- if (val.IsNull()) form->Touch (10,DefListName(IGESData_DefNone));
- else form->Touch (10,DefListName(IGESData_DefOne));
- }
-
-// Color
- if (num == 20) {
- if (val.IsNull()) form->Touch (19,DefTypeName(IGESData_DefVoid));
- else form->Touch (19,DefTypeName(IGESData_DefValue));
- }
- if (num == 21) {
- if (val.IsNull()) form->Touch (19,DefTypeName(IGESData_DefVoid));
- else form->Touch (19,DefTypeName(IGESData_DefReference));
- }
-
- return Standard_True;
-}
-
- Standard_Boolean IGESSelect_EditDirPart::Apply
- (const Handle(IFSelect_EditForm)& form,
- const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& model) const
-{
- Handle(IGESData_IGESModel) modl =
- Handle(IGESData_IGESModel)::DownCast(model);
- if (modl.IsNull()) return Standard_False;
- Handle(IGESData_IGESEntity) iges =
- Handle(IGESData_IGESEntity)::DownCast(ent);
- if (iges.IsNull()) return Standard_False;
- Handle(IGESData_IGESEntity) sub;
- Handle(IGESData_LineFontEntity) lfent;
- Handle(IGESData_LevelListEntity) levlist;
- Handle(IGESData_ViewKindEntity) view;
- Handle(IGESData_TransfEntity) transf;
- Handle(IGESData_LabelDisplayEntity) labdisp;
- Handle(IGESData_ColorEntity) color;
-
- Handle(TCollection_HAsciiString) str;
- Standard_Integer num;
-
- if (form->IsModified (3)) {
- str = form->EditedValue(3);
- sub.Nullify();
- num = 0;
- if (!str.IsNull()) num = modl->NextNumberForLabel (str->ToCString());
- else num = -1;
- if (num > 0) sub = modl->Entity(num);
- if (num != 0) iges->InitDirFieldEntity (3,sub);
- }
-
- if (form->IsModified(5)) {
- str = form->EditedValue(5);
- lfent.Nullify();
- if (str.IsNull()) num = 0;
- else num = str->IntegerValue();
- iges->InitLineFont (lfent,num);
- }
- if (form->IsModified(6)) {
- str = form->EditedValue(6);
- lfent.Nullify();
- num = 0;
- if (str.IsNull()) num = -1;
- else num = modl->NextNumberForLabel (str->ToCString());
- if (num > 0) lfent = GetCasted(IGESData_LineFontEntity,modl->Entity(num));
- if (num < 0 || !lfent.IsNull()) iges->InitLineFont (lfent,0);
- }
-
- if (form->IsModified(8)) {
- str = form->EditedValue(8);
- levlist.Nullify();
- if (str.IsNull()) num = 0;
- else num = str->IntegerValue();
- iges->InitLevel (levlist,num);
- }
- if (form->IsModified(9)) {
- str = form->EditedValue(9);
- levlist.Nullify();
- num = 0;
- if (str.IsNull()) num = -1;
- else num = modl->NextNumberForLabel (str->ToCString());
- if (num > 0) levlist = GetCasted(IGESData_LevelListEntity,modl->Entity(num));
- if (num < 0 || !levlist.IsNull()) iges->InitLevel (levlist,0);
- }
-
- if (form->IsModified(11)) {
- str = form->EditedValue(11);
- view.Nullify();
- num = 0;
- if (!str.IsNull()) num = modl->NextNumberForLabel (str->ToCString());
- else num = -1;
- if (num > 0) view = GetCasted(IGESData_ViewKindEntity,modl->Entity(num));
- if (num != 0 || !view.IsNull()) iges->InitView (view);
- }
-
- if (form->IsModified(12)) {
- str = form->EditedValue(12);
- transf.Nullify();
- num = 0;
- if (!str.IsNull()) num = modl->NextNumberForLabel (str->ToCString());
- else num = -1;
- if (num > 0) transf = GetCasted(IGESData_TransfEntity,modl->Entity(num));
- if (num != 0 || !transf.IsNull()) iges->InitTransf (transf);
- }
-
- if (form->IsModified(13)) {
- str = form->EditedValue(13);
- labdisp.Nullify();
- num = 0;
- if (!str.IsNull()) num = modl->NextNumberForLabel (str->ToCString());
- else num = -1;
- if (num > 0) labdisp = GetCasted(IGESData_LabelDisplayEntity,modl->Entity(num));
- if (num != 0 || !labdisp.IsNull()) iges->InitDirFieldEntity (8,labdisp);
- }
-
- if (form->IsModified(14) || form->IsModified(15) ||
- form->IsModified(16) || form->IsModified(17)) {
- Standard_Integer n1,n2,n3,n4;
- n1 = iges->BlankStatus();
- n2 = iges->SubordinateStatus();
- n3 = iges->UseFlag();
- n4 = iges->HierarchyStatus();
- if (form->IsModified(14)) n1 = form->EditedValue(14)->IntegerValue();
- if (form->IsModified(15)) n2 = form->EditedValue(15)->IntegerValue();
- if (form->IsModified(16)) n3 = form->EditedValue(16)->IntegerValue();
- if (form->IsModified(17)) n4 = form->EditedValue(17)->IntegerValue();
- iges->InitStatus (n1,n2,n3,n4);
- }
-
- if (form->IsModified(18)) {
- str = form->EditedValue(18);
- num = 0;
- if (!str.IsNull()) num = str->IntegerValue();
- iges->InitMisc (iges->Structure(),iges->LabelDisplay(),num);
- }
-
- if (form->IsModified(20)) {
- str = form->EditedValue(20);
- color.Nullify();
- if (str.IsNull()) num = 0;
- else num = str->IntegerValue();
- iges->InitColor (color,num);
- }
- if (form->IsModified(21)) {
- str = form->EditedValue(21);
- color.Nullify();
- num = 0;
- if (str.IsNull()) num = -1;
- else num = modl->NextNumberForLabel (str->ToCString());
- if (num > 0) color = GetCasted(IGESData_ColorEntity,modl->Entity(num));
- if (num < 0 || !color.IsNull()) iges->InitColor (color,0);
- }
-
- if (form->IsModified(22) || form->IsModified(23)) {
- num = -1;
- if (iges->HasSubScriptNumber()) num = iges->SubScriptNumber();
- if (form->IsModified(23)) {
- str = form->EditedValue(23);
- if (str.IsNull()) num = -1;
- else num = str->IntegerValue();
- }
- str = iges->ShortLabel();
- if (form->IsModified(22)) str = form->EditedValue(22);
- iges->SetLabel (str,num);
- }
-
- return Standard_True;
-}
+++ /dev/null
-// Created on: 1998-09-07
-// 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 _IGESSelect_EditDirPart_HeaderFile
-#define _IGESSelect_EditDirPart_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Editor.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-class TCollection_AsciiString;
-class IFSelect_EditForm;
-class TCollection_HAsciiString;
-class Standard_Transient;
-class Interface_InterfaceModel;
-
-
-class IGESSelect_EditDirPart;
-DEFINE_STANDARD_HANDLE(IGESSelect_EditDirPart, IFSelect_Editor)
-
-//! This class is aimed to display and edit the Directory Part of
-//! an IGESEntity
-class IGESSelect_EditDirPart : public IFSelect_Editor
-{
-
-public:
-
-
- Standard_EXPORT IGESSelect_EditDirPart();
-
- 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 virtual Standard_Boolean Update (const Handle(IFSelect_EditForm)& form, const Standard_Integer num, const Handle(TCollection_HAsciiString)& newval, const Standard_Boolean enforce) 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;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_EditDirPart,IFSelect_Editor)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_EditDirPart_HeaderFile
+++ /dev/null
-// 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 <IFSelect_EditForm.hxx>
-#include <IGESData_BasicEditor.hxx>
-#include <IGESData_GlobalSection.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESData_Protocol.hxx>
-#include <IGESSelect_EditHeader.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Static.hxx>
-#include <Interface_TypedValue.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_EditHeader,IFSelect_Editor)
-
-static Standard_Boolean IsTimeStamp
- (const Handle(TCollection_HAsciiString)& val)
-{
- if (val.IsNull()) return Standard_False;
-// La date peut etre sur 13 ou 15 caracteres (15 : bonjour l an 2000!)
-// forme [YY]YYMMDD.HHMMSS
- Standard_Integer lng = val->Length();
- if (lng != 13 && lng != 15) return Standard_False;
- lng -= 13; // devient 0 ou 2 (offset siecle)
-
-// Cas du siecle present :
- if (lng == 2) {
- char uncar = val->Value(1);
- if (uncar != '1' && uncar != '2') return Standard_False;
- uncar = val->Value(2);
- if (uncar < '0' || uncar > '9') return Standard_False;
- }
-
-// On y va
- char dizmois = val->Value(lng+3);
- char dizjour = val->Value(lng+5);
- char dizheur = val->Value(lng+8);
- for (Standard_Integer i = 1; i <= 13; i ++) {
- char uncar = val->Value(i+lng);
- switch (i) {
- case 1 :
- case 2 : if (uncar < '0' || uncar > '9') return Standard_False; break;
- case 3 : if (uncar != '0' && uncar != '1') return Standard_False; break;
- case 4 : if (uncar < '0' || uncar > '9') return Standard_False;
- if (dizmois == '1' && (uncar < '0' || uncar > '2')) return Standard_False;
- break;
- case 5 : if (uncar < '0' || uncar > '3') return Standard_False; break;
- case 6 : if (uncar < '0' || uncar > '9') return Standard_False;
- if (dizjour == '3' && (uncar != '0' && uncar != '1')) return Standard_False;
- break;
- case 7 : if (uncar != '.') return Standard_False; break;
- case 8 : if (uncar < '0' || uncar > '2') return Standard_False; break;
- case 9 : if (uncar < '0' || uncar > '9') return Standard_False;
- if (dizheur == '2' && (uncar < '0' || uncar > '3')) return Standard_False; //szv#4:S4163:12Mar99 extra break
- break;
- case 10 : if (uncar < '0' || uncar > '5') return Standard_False; break;
- case 11 : if (uncar < '0' || uncar > '9') return Standard_False; break;
- case 12 : if (uncar < '0' || uncar > '5') return Standard_False; break;
- case 13 : if (uncar < '0' || uncar > '9') return Standard_False; break;
- default : break;
- }
- }
- return Standard_True;
-}
-
-
- IGESSelect_EditHeader::IGESSelect_EditHeader ()
- : IFSelect_Editor (30)
-{
- Standard_Integer i,nb;
-// Definition
- Handle(Interface_TypedValue) start = new Interface_TypedValue("Start Section");
- start->SetMaxLength(72);
- SetValue (1,start,"Start");
- SetList (1);
-
- Handle(Interface_TypedValue) sep = new Interface_TypedValue("Parameter Delimiter");
- sep->SetMaxLength(1);
- SetValue (2,sep,"G1:Separator",IFSelect_Optional);
- Handle(Interface_TypedValue) endmark = new Interface_TypedValue("Record Delimiter");
- endmark->SetMaxLength(1);
- SetValue (3,endmark,"G2:EndMark",IFSelect_Optional);
-
- Handle(Interface_TypedValue) sendname = new Interface_TypedValue("Sender Product Id");
- SetValue (4,sendname,"G3:SendName",IFSelect_Optional);
-
- Handle(Interface_TypedValue) filename = new Interface_TypedValue("File Name");
- SetValue (5,filename,"G4:FileName");
-
- Handle(Interface_TypedValue) systid = new Interface_TypedValue("Native System Id");
- SetValue (6,systid,"G5:SystemId");
-
- Handle(Interface_TypedValue) version = new Interface_TypedValue("Preprocessor Version");
- SetValue (7,version,"G6:Version");
-
- Handle(Interface_TypedValue) intbits = new Interface_TypedValue("Integer Binary Bits",Interface_ParamInteger);
- SetValue (8,intbits,"G7:IntBits");
- Handle(Interface_TypedValue) pow10s = new Interface_TypedValue("Single Precision Magnitude",Interface_ParamInteger);
- SetValue (9,pow10s,"G8:SingleMag");
- Handle(Interface_TypedValue) dig10s = new Interface_TypedValue("Single Precision Significance",Interface_ParamInteger);
- SetValue (10,dig10s,"G9:SingDigits");
- Handle(Interface_TypedValue) pow10d = new Interface_TypedValue("Double Precision Magnitude",Interface_ParamInteger);
- SetValue (11,pow10d,"G10:DoubleMag");
- Handle(Interface_TypedValue) dig10d = new Interface_TypedValue("Double Precision Significance",Interface_ParamInteger);
- SetValue (12,dig10d,"G11:DoubDigits");
-
- Handle(Interface_TypedValue) recname = new Interface_TypedValue("Receiver Product Id");
- SetValue (13,recname,"G12:Receiver",IFSelect_Optional);
-
- Handle(Interface_TypedValue) scale = new Interface_TypedValue("Model Space Scale",Interface_ParamReal);
- SetValue (14,scale,"G13:Scale",IFSelect_Optional);
-
- Handle(Interface_TypedValue) unitflag = new Interface_TypedValue("Units Flag",Interface_ParamInteger);
- unitflag->SetIntegerLimit(Standard_False,1);
- unitflag->SetIntegerLimit(Standard_True,11);
- SetValue (15,unitflag,"G14:UnitFlag",IFSelect_Optional);
-// On prend a la source ... Mieux vaudrait "recopier" les definitions ...
- Handle(Interface_TypedValue) unitname = new Interface_TypedValue("Units Name",Interface_ParamEnum);
- unitname->StartEnum (1);
- for (i = 1; i <= 11; i ++)
- unitname->AddEnumValue (IGESData_BasicEditor::UnitFlagName(i),i);
-// similaire a Interface_Static::Static("XSTEP.iges.unit");
- SetValue (16,unitname,"G15:UnitName",IFSelect_Optional);
- Handle(Interface_TypedValue) unitval = new Interface_TypedValue("Computed Unit Value",Interface_ParamReal);
- SetValue (17,unitval,"V15:UnitValue",IFSelect_EditDynamic);
-
- Handle(Interface_TypedValue) linwgr = new Interface_TypedValue("Max Line Weight Gradation",Interface_ParamInteger);
- SetValue (18,linwgr,"G16:LineWGrad",IFSelect_Optional);
- Handle(Interface_TypedValue) maxlw = new Interface_TypedValue("Width of Max Line Weight",Interface_ParamReal);
- SetValue (19,maxlw,"G17:MaxLineW");
-
- Handle(Interface_TypedValue) filedate = new Interface_TypedValue("Date of File Creation");
- filedate->SetSatisfies (IsTimeStamp,"IsIGESDate");
- SetValue (20,filedate,"G18:FileDate");
-
- Handle(Interface_TypedValue) resol = new Interface_TypedValue("Max Resolution",Interface_ParamReal);
- SetValue (21,resol,"G19:Resolution");
- Handle(Interface_TypedValue) coord = new Interface_TypedValue("Max Coordinates",Interface_ParamReal);
- SetValue (22,coord,"G20:MaxCoord",IFSelect_Optional);
-
- Handle(Interface_TypedValue) author = new Interface_TypedValue("Name of Author");
- SetValue (23,author,"G21:Author");
- Handle(Interface_TypedValue) company = new Interface_TypedValue("Author Organization");
- SetValue (24,company,"G22:Company");
-
- Handle(Interface_TypedValue) igesvers = new Interface_TypedValue("Version Flag",Interface_ParamInteger);
- nb = IGESData_BasicEditor::IGESVersionMax();
- igesvers->SetIntegerLimit(Standard_False,1);
- igesvers->SetIntegerLimit(Standard_True,nb);
- SetValue (25,igesvers,"G23:IGESVersion");
- Handle(Interface_TypedValue) versname = new Interface_TypedValue("IGES Version Name",Interface_ParamEnum);
- versname->StartEnum (0);
- for (i = 0; i <= IGESData_BasicEditor::IGESVersionMax(); i ++)
- versname->AddEnumValue (IGESData_BasicEditor::IGESVersionName(i),i);
- SetValue (26,versname,"V23:VersionName");
-
- Handle(Interface_TypedValue) draft = new Interface_TypedValue("Drafting Standard Flag",Interface_ParamInteger);
- nb = IGESData_BasicEditor::DraftingMax();
- draft->SetIntegerLimit(Standard_False,0);
- draft->SetIntegerLimit(Standard_True,nb);
- SetValue (27,draft,"G24:Drafting");
- Handle(Interface_TypedValue) draftname = new Interface_TypedValue("Drafting Standard Name",Interface_ParamEnum);
- draftname->StartEnum (0);
- for (i = 0; i <= nb; i ++)
- draftname->AddEnumValue (IGESData_BasicEditor::DraftingName(i),i);
- SetValue (28,draftname,"V24:DraftingName");
-
- Handle(Interface_TypedValue) changedate = new Interface_TypedValue("Date of Creation/Change");
- changedate->SetSatisfies (IsTimeStamp,"IsIGESDate");
- SetValue (29,changedate,"G25:ChangeDate",IFSelect_Optional);
-
- Handle(Interface_TypedValue) proto = new Interface_TypedValue("Application Protocol/Subset Id");
- SetValue (30,proto,"G26:Protocol",IFSelect_Optional);
-
-}
-
- TCollection_AsciiString IGESSelect_EditHeader::Label () const
- { return TCollection_AsciiString ("IGES Header"); }
-
- Standard_Boolean IGESSelect_EditHeader::Recognize
- (const Handle(IFSelect_EditForm)& /*form*/) const
-{ return Standard_True; } // ??
-
- Handle(TCollection_HAsciiString) IGESSelect_EditHeader::StringValue
- (const Handle(IFSelect_EditForm)& /*form*/, const Standard_Integer num) const
-{
-// Default Values
- return TypedValue(num)->HStringValue();
-}
-
- Standard_Boolean IGESSelect_EditHeader::Load
- (const Handle(IFSelect_EditForm)& form,
- const Handle(Standard_Transient)& /*ent*/,
- const Handle(Interface_InterfaceModel)& model) const
-{
- Handle(IGESData_IGESModel) modl =
- Handle(IGESData_IGESModel)::DownCast(model);
- if (modl.IsNull()) return Standard_False;
-
- IGESData_GlobalSection GS = modl->GlobalSection();
-
- form->LoadList (1 ,modl->StartSection());
- form->LoadValue (2 ,new TCollection_HAsciiString(GS.Separator()) );
- form->LoadValue (3 ,new TCollection_HAsciiString(GS.EndMark()) );
- form->LoadValue (4 ,GS.SendName());
- form->LoadValue (5 ,GS.FileName());
- form->LoadValue (6 ,GS.SystemId());
- form->LoadValue (7 ,GS.InterfaceVersion());
-
- form->LoadValue (8 ,new TCollection_HAsciiString(GS.IntegerBits()) );
- form->LoadValue (9 ,new TCollection_HAsciiString(GS.MaxPower10Single()) );
- form->LoadValue (10 ,new TCollection_HAsciiString(GS.MaxDigitsSingle()) );
- form->LoadValue (11 ,new TCollection_HAsciiString(GS.MaxPower10Double()) );
- form->LoadValue (12 ,new TCollection_HAsciiString(GS.MaxDigitsDouble()) );
-
- form->LoadValue (13 ,GS.ReceiveName());
- form->LoadValue (14 ,new TCollection_HAsciiString(GS.Scale()) );
-
- form->LoadValue (15 ,new TCollection_HAsciiString(GS.UnitFlag()) );
- form->LoadValue (16 ,GS.UnitName());
- form->LoadValue (17 ,new TCollection_HAsciiString(GS.UnitValue()) );
- form->LoadValue (18 ,new TCollection_HAsciiString(GS.LineWeightGrad()) );
- form->LoadValue (19 ,new TCollection_HAsciiString(GS.MaxLineWeight()) );
-
- form->LoadValue (20 ,GS.Date());
- form->LoadValue (21 ,new TCollection_HAsciiString(GS.Resolution()) );
- if (GS.HasMaxCoord()) form->LoadValue (22 ,new TCollection_HAsciiString(GS.MaxCoord()) );
-
- form->LoadValue (23 ,GS.AuthorName());
- form->LoadValue (24 ,GS.CompanyName());
- form->LoadValue (25 ,new TCollection_HAsciiString(GS.IGESVersion()) );
- form->LoadValue (26 ,new TCollection_HAsciiString
- (IGESData_BasicEditor::IGESVersionName(GS.IGESVersion()) ));
- form->LoadValue (27 ,new TCollection_HAsciiString(GS.DraftingStandard()) );
- form->LoadValue (28 ,new TCollection_HAsciiString
- (IGESData_BasicEditor::DraftingName(GS.DraftingStandard()) ));
- form->LoadValue (29 ,GS.LastChangeDate());
- form->LoadValue (30 ,GS.ApplicationProtocol());
-
- return Standard_True;
-}
-
- Standard_Boolean IGESSelect_EditHeader::Update
- (const Handle(IFSelect_EditForm)& form,
- const Standard_Integer num,
- const Handle(TCollection_HAsciiString)& val,
- const Standard_Boolean enforce) const
-{
- if (num == 15) {
- if (!enforce) return Standard_False; // quand meme ...
-// Unit Flag : mettre a jour UnitName et UnitValue
- Standard_Integer unitflag = val->IntegerValue();
- Standard_CString unitname = IGESData_BasicEditor::UnitFlagName (unitflag);
- if (unitname[0] == '\0') return Standard_False;
- form->Touch (16,new TCollection_HAsciiString (unitname));
- form->Touch (17,new TCollection_HAsciiString
- (IGESData_BasicEditor::UnitFlagValue(unitflag)) );
- }
- if (num == 16) {
- if (!enforce) return Standard_False; // quand meme ...
-// Unit Name : mettre a jour UnitFlag et UnitValue
- Standard_Integer unitflag = IGESData_BasicEditor::UnitNameFlag
- (val->ToCString());
- if (unitflag == 0) return Standard_False; // pas bon
- form->Touch (15,new TCollection_HAsciiString (unitflag));
- form->Touch (17,new TCollection_HAsciiString
- (IGESData_BasicEditor::UnitFlagValue(unitflag)) );
- }
-
- if (num == 25) {
-// Unit Version : mettre a jour son nom
- Standard_Integer version = 3; // par defaut ...
- if (!val.IsNull()) version = atoi(val->ToCString());
- Standard_CString versname = IGESData_BasicEditor::IGESVersionName(version);
- if (versname[0] == '\0') return Standard_False;
- form->Touch (26,new TCollection_HAsciiString (versname));
- }
- if (num == 27) {
-// Drafting : mettre a jour son nom
- Standard_Integer draft = 0;
- if (!val.IsNull()) draft = atoi(val->ToCString());
- Standard_CString draftname = IGESData_BasicEditor::IGESVersionName(draft);
- if (draftname[0] == '\0') return Standard_False;
- form->Touch (28,new TCollection_HAsciiString (draftname));
- }
- return Standard_True;
-}
-
- Standard_Boolean IGESSelect_EditHeader::Apply
- (const Handle(IFSelect_EditForm)& form,
- const Handle(Standard_Transient)& /*ent*/,
- const Handle(Interface_InterfaceModel)& model) const
-{
- Handle(IGESData_IGESModel) modl =
- Handle(IGESData_IGESModel)::DownCast(model);
- if (modl.IsNull()) return Standard_False;
-
- IGESData_GlobalSection GS = modl->GlobalSection();
-
- Handle(TCollection_HAsciiString) str;
-
- if (form->IsModified(1)) modl->SetStartSection (form->EditedList(1));
- if (form->IsModified(2)) {
- str = form->EditedValue(2);
- if (!str.IsNull() && str->Length() >= 1) GS.SetSeparator (str->Value(1));
- }
- if (form->IsModified(3)) {
- str = form->EditedValue(3);
- if (!str.IsNull() && str->Length() >= 1) GS.SetEndMark (str->Value(1));
- }
- if (form->IsModified(4)) GS.SetSendName (form->EditedValue(4));
- if (form->IsModified(5)) GS.SetFileName (form->EditedValue(5));
- if (form->IsModified(6)) GS.SetSystemId (form->EditedValue(6));
- if (form->IsModified(7)) GS.SetInterfaceVersion (form->EditedValue(7));
-
- if (form->IsModified(8)) GS.SetIntegerBits (form->EditedValue(8)->IntegerValue());
- if (form->IsModified(9)) GS.SetMaxPower10Single (form->EditedValue(9)->IntegerValue());
- if (form->IsModified(10)) GS.SetMaxDigitsSingle (form->EditedValue(10)->IntegerValue());
- if (form->IsModified(11)) GS.SetMaxPower10Double (form->EditedValue(11)->IntegerValue());
- if (form->IsModified(12)) GS.SetMaxDigitsDouble (form->EditedValue(12)->IntegerValue());
-
- if (form->IsModified(13)) GS.SetReceiveName (form->EditedValue(13));
- if (form->IsModified(14)) GS.SetScale (form->EditedValue(14)->RealValue());
- if (form->IsModified(15)) GS.SetUnitFlag (form->EditedValue(15)->IntegerValue());
- if (form->IsModified(16)) GS.SetUnitName (form->EditedValue(16));
-
- if (form->IsModified(18)) GS.SetLineWeightGrad (form->EditedValue(18)->IntegerValue());
- if (form->IsModified(19)) GS.SetMaxLineWeight (form->EditedValue(19)->RealValue());
-
- if (form->IsModified(20)) GS.SetDate (form->EditedValue(20));
- if (form->IsModified(21)) GS.SetResolution (form->EditedValue(21)->RealValue());
- if (form->IsModified(22)) {
- str = form->EditedValue(22);
- if (str.IsNull()) GS.SetMaxCoord();
- else GS.SetMaxCoord (str->RealValue());
- }
-
- if (form->IsModified(23)) GS.SetAuthorName (form->EditedValue(23));
- if (form->IsModified(24)) GS.SetCompanyName (form->EditedValue(24));
- if (form->IsModified(25)) GS.SetIGESVersion (form->EditedValue(25)->IntegerValue());
- if (form->IsModified(27)) GS.SetDraftingStandard (form->EditedValue(27)->IntegerValue());
- if (form->IsModified(29)) GS.SetLastChangeDate (form->EditedValue(29));
- if (form->IsModified(30)) GS.SetApplicationProtocol (form->EditedValue(30));
-
- modl->SetGlobalSection (GS);
-
-// Pour l unite
- if (form->IsModified(15) || form->IsModified(16)) {
- IGESData_BasicEditor bed
- (modl,Handle(IGESData_Protocol)::DownCast(modl->Protocol()) );
- if (bed.SetUnitValue (GS.UnitValue()) ) return Standard_False;
- bed.ApplyUnit (Standard_True);
- }
-
- return Standard_True;
-}
+++ /dev/null
-// Created on: 1998-07-31
-// 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 _IGESSelect_EditHeader_HeaderFile
-#define _IGESSelect_EditHeader_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Editor.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-class TCollection_AsciiString;
-class IFSelect_EditForm;
-class TCollection_HAsciiString;
-class Standard_Transient;
-class Interface_InterfaceModel;
-
-
-class IGESSelect_EditHeader;
-DEFINE_STANDARD_HANDLE(IGESSelect_EditHeader, IFSelect_Editor)
-
-//! This class is aimed to display and edit the Header of an
-//! IGES Model : Start Section and Global Section
-class IGESSelect_EditHeader : public IFSelect_Editor
-{
-
-public:
-
-
- Standard_EXPORT IGESSelect_EditHeader();
-
- 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 virtual Standard_Boolean Update (const Handle(IFSelect_EditForm)& form, const Standard_Integer num, const Handle(TCollection_HAsciiString)& newval, const Standard_Boolean enforce) 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;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_EditHeader,IFSelect_Editor)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_EditHeader_HeaderFile
+++ /dev/null
-// Created on: 1994-05-31
-// 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 _IGESSelect_ModelModifier_HeaderFile
-#define _IGESSelect_ModelModifier_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Modifier.hxx>
-#include <Standard_Boolean.hxx>
-class IGESData_IGESModel;
-class IGESData_Protocol;
-class IFSelect_ContextModif;
-class Interface_InterfaceModel;
-class Interface_Protocol;
-class Interface_CopyTool;
-
-
-class IGESSelect_ModelModifier;
-DEFINE_STANDARD_HANDLE(IGESSelect_ModelModifier, IFSelect_Modifier)
-
-
-class IGESSelect_ModelModifier : public IFSelect_Modifier
-{
-
-public:
-
-
- //! The inherited Perform does the required cast (and refuses to
- //! go further if cast has failed) then calls the instantiated
- //! Performing
- Standard_EXPORT void Perform (IFSelect_ContextModif& ctx, const Handle(Interface_InterfaceModel)& target, const Handle(Interface_Protocol)& protocol, Interface_CopyTool& TC) const Standard_OVERRIDE;
-
- //! Specific Perform with Protocol. It is defined to let the
- //! Protocol unused and to call Performing without Protocol
- //! (most current case). It can be redefined if specific action
- //! requires Protocol.
- Standard_EXPORT virtual void PerformProtocol (IFSelect_ContextModif& ctx, const Handle(IGESData_IGESModel)& target, const Handle(IGESData_Protocol)& proto, Interface_CopyTool& TC) const;
-
- //! Specific Perform, without Protocol. If Performing with
- //! Protocol is redefined, Performing without Protocol must
- //! though be defined to do nothing (not called, but demanded
- //! by the linker)
- Standard_EXPORT virtual void Performing (IFSelect_ContextModif& ctx, const Handle(IGESData_IGESModel)& target, Interface_CopyTool& TC) const = 0;
-
-
-
-
- DEFINE_STANDARD_RTTI_INLINE(IGESSelect_ModelModifier,IFSelect_Modifier)
-
-protected:
-
-
- //! Calls inherited Initialize, transmits to it the information
- //! <maychangegraph>
- Standard_EXPORT IGESSelect_ModelModifier(const Standard_Boolean maychangegraph);
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_ModelModifier_HeaderFile
+++ /dev/null
-// Created on: 1994-05-31
-// 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 <IGESSelect_ModelModifier.hxx>
-
-#include <Standard_Type.hxx>
-
-#include <IGESData_IGESModel.hxx>
-#include <IGESData_Protocol.hxx>
-#include <IFSelect_ContextModif.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Protocol.hxx>
-#include <Interface_CopyTool.hxx>
-
-
-
-
-
-
-
-
-
-
-#define Handle_Model Handle(IGESData_IGESModel)
-#define Model IGESData_IGESModel
-#define Model_hxx <IGESData_IGESModel.hxx>
-#define Handle_Proto Handle(IGESData_Protocol)
-#define Proto IGESData_Protocol
-#define Proto_hxx <IGESData_Protocol.hxx>
-#define IFSelect_ModelModifier IGESSelect_ModelModifier
-#define IFSelect_ModelModifier_hxx <IGESSelect_ModelModifier.hxx>
-#define Handle_IFSelect_ModelModifier Handle(IGESSelect_ModelModifier)
-#include <IFSelect_ModelModifier.gxx>
-
+++ /dev/null
-// 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 <gp_Pnt2d.hxx>
-#include <gp_XY.hxx>
-#include <IFSelect_ContextModif.hxx>
-#include <IFSelect_PacketList.hxx>
-#include <IGESData_HArray1OfIGESEntity.hxx>
-#include <IGESData_IGESEntity.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESData_ViewKindEntity.hxx>
-#include <IGESDraw_Drawing.hxx>
-#include <IGESDraw_DrawingWithRotation.hxx>
-#include <IGESDraw_HArray1OfViewKindEntity.hxx>
-#include <IGESSelect_RebuildDrawings.hxx>
-#include <IGESSelect_ViewSorter.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Type.hxx>
-#include <TColgp_HArray1OfXY.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-#include <TColStd_HArray1OfReal.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_RebuildDrawings,IGESSelect_ModelModifier)
-
-#define PourDrawing 404
-
-
-IGESSelect_RebuildDrawings::IGESSelect_RebuildDrawings ()
- : IGESSelect_ModelModifier (Standard_True) { }
-
-
- void IGESSelect_RebuildDrawings::Performing
- (IFSelect_ContextModif& ctx,
- const Handle(IGESData_IGESModel)& target,
- Interface_CopyTool& TC) const
-{
-// On reconstruit les drawings qui peuvent l etre
-// Pour chaque drawing de l original, on regarde les composants transferes
-// (evt filtres par <ctx>). Pour cela, on s aide d un ViewSorter
-// Pour chaque drawing dont au moins un element a ete transfere :
-// - On passe le Drawing lui-meme, avec ses views, mais pas ses annotations
-// (c-a-d on le reconstruit)
-// - On reconnecte les views aux entites (cf Directory Part)
-
- DeclareAndCast(IGESData_IGESModel,original,ctx.OriginalModel());
- Standard_Integer nbo = original->NbEntities();
- TColStd_Array1OfInteger pris(0,nbo); pris.Init(0);
-
-// Entites a prendre en compte pour la reconstruction
-// NB : Les drawings deja transferes ne sont bien sur pas reconstruits !
- Handle(IGESSelect_ViewSorter) sorter = new IGESSelect_ViewSorter;
- sorter->SetModel(original);
- sorter->Add(original);
- for (ctx.Start(); ctx.More(); ctx.Next()) {
- pris.SetValue (original->Number(ctx.ValueOriginal()),1);
- }
- sorter->SortDrawings(ctx.OriginalGraph());
- Handle(IFSelect_PacketList) sets = sorter->Sets(Standard_True);
-// Regarder, pour chaque paquet, si au moins un element a ete copie
- Standard_Integer nbs = sets->NbPackets();
- for (Standard_Integer is = 1; is <= nbs; is ++) {
- Interface_EntityIterator setl = sets->Entities(is);
- Interface_EntityIterator newset;
- for (setl.Start(); setl.More(); setl.Next()) {
- Handle(Standard_Transient) newent;
- if (TC.Search(setl.Value(),newent)) newset.AddItem(newent);
- }
- if (newset.NbEntities() == 0) continue;
-// On en tient un : le transferer (le reconstruire)
- Handle(IGESData_IGESEntity) item = sorter->SetItem(is,Standard_True);
- if (item->TypeNumber() != PourDrawing) continue;
- if (item->IsKind(STANDARD_TYPE(IGESDraw_Drawing))) {
- DeclareAndCast(IGESDraw_Drawing,draw,item);
- Standard_Integer nbv = draw->NbViews();
- Handle(IGESDraw_HArray1OfViewKindEntity) views;
- if (nbv > 0) views = new IGESDraw_HArray1OfViewKindEntity (1,nbv);
-// Passer ses vues : toutes
-// Aussi les positions des vues
- Handle(TColgp_HArray1OfXY) origs;
- if (nbv > 0) origs = new TColgp_HArray1OfXY (1,nbv);
- for (Standard_Integer iv = 1; iv <= nbv; iv ++) {
- DeclareAndCast(IGESData_ViewKindEntity,aview,
- TC.Transferred(draw->ViewItem(iv)));
- views->SetValue(iv,aview);
- target->AddEntity(aview);
- origs->SetValue(iv,draw->ViewOrigin(iv).XY());
- }
-// Frame : passer ce qui a ete transfere
- Handle(IGESData_HArray1OfIGESEntity) frame;
- Standard_Integer nba = draw->NbAnnotations();
- Interface_EntityIterator framelist;
- Standard_Integer ia; // svv Jan11 2000 : porting on DEC
- for (ia = 1; ia <= nba; ia ++) {
- Handle(Standard_Transient) annot;
- if (TC.Search(draw->Annotation(ia),annot)) framelist.GetOneItem(annot);
- }
- nba = framelist.NbEntities(); ia = 0;
- if (nba > 0) frame = new IGESData_HArray1OfIGESEntity (1,nba);
- for (framelist.Start(); framelist.More(); framelist.Next()) {
- ia ++; frame->SetValue(ia,GetCasted(IGESData_IGESEntity,framelist.Value()));
- }
-// Cayest, fabriquer le nouveau Drawing et l ajouter
- Handle(IGESDraw_Drawing) newdraw = new IGESDraw_Drawing;
- newdraw->Init (views,origs,frame);
-// Reste le nom, + autres ? drawing unit, ...
-
-// Drawing With Rotation : quasiment identique
- } else if (item->IsKind(STANDARD_TYPE(IGESDraw_DrawingWithRotation))) {
- DeclareAndCast(IGESDraw_DrawingWithRotation,draw,item);
- Standard_Integer nbv = draw->NbViews();
- Handle(IGESDraw_HArray1OfViewKindEntity) views;
- if (nbv > 0) views = new IGESDraw_HArray1OfViewKindEntity (1,nbv);
-// Passer ses vues : toutes
-// Aussi les positions des vues .. et les rotations
- Handle(TColgp_HArray1OfXY) origs;
- if (nbv > 0) origs = new TColgp_HArray1OfXY (1,nbv);
- Handle(TColStd_HArray1OfReal) rots;
- if (nbv > 0) { rots = new TColStd_HArray1OfReal (1,nbv); rots->Init(0.0); }
-
- for (Standard_Integer iv = 1; iv <= nbv; iv ++) {
- DeclareAndCast(IGESData_ViewKindEntity,aview,
- TC.Transferred(draw->ViewItem(iv)));
- views->SetValue(iv,aview);
- target->AddEntity(aview);
- rots->SetValue(iv,draw->OrientationAngle(iv));
- origs->SetValue(iv,draw->ViewOrigin(iv).XY());
- }
-// Frame : passer ce qui a ete transfere
- Handle(IGESData_HArray1OfIGESEntity) frame;
- Standard_Integer nba = draw->NbAnnotations();
- Interface_EntityIterator framelist;
- Standard_Integer ia; // svv Jan11 2000 : porting on DEC
- for (ia = 1; ia <= nba; ia ++) {
- Handle(Standard_Transient) annot;
- if (TC.Search(draw->Annotation(ia),annot)) framelist.GetOneItem(annot);
- }
- nba = framelist.NbEntities(); ia = 0;
- if (nba > 0) frame = new IGESData_HArray1OfIGESEntity (1,nba);
- for (framelist.Start(); framelist.More(); framelist.Next()) {
- ia ++; frame->SetValue(ia,GetCasted(IGESData_IGESEntity,framelist.Value()));
- }
-// Cayest, fabriquer le nouveau DrawingWithRotation et l ajouter
- Handle(IGESDraw_DrawingWithRotation) newdraw = new IGESDraw_DrawingWithRotation;
- newdraw->Init (views,origs,rots,frame);
-// Reste le nom, + autres ? drawing unit, ...
- }
-
-// Il faut encore mettre a jour les Views notees en Directory Part
-// Pour cela, considerer <setl>, pour chaque terme, regarder View()
-// si View() transfere, mettre a jour ...
- for (setl.Start(); setl.More(); setl.Next()) {
- DeclareAndCast(IGESData_IGESEntity,ent,setl.Value());
- Handle(IGESData_ViewKindEntity) vieworig = ent->View();
- if (vieworig.IsNull()) continue;
- Handle(Standard_Transient) aView;
- if (!TC.Search(vieworig,aView)) continue;
- Handle(IGESData_ViewKindEntity) viewnew =
- Handle(IGESData_ViewKindEntity)::DownCast (aView);
- if (! viewnew.IsNull())
- ent->InitView(viewnew);
- }
- }
-
-}
-
- TCollection_AsciiString IGESSelect_RebuildDrawings::Label () const
-{ return TCollection_AsciiString("Rebuild Drawings (with empty views)"); }
+++ /dev/null
-// Created on: 1994-06-01
-// 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 _IGESSelect_RebuildDrawings_HeaderFile
-#define _IGESSelect_RebuildDrawings_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IGESSelect_ModelModifier.hxx>
-class IFSelect_ContextModif;
-class IGESData_IGESModel;
-class Interface_CopyTool;
-class TCollection_AsciiString;
-
-
-class IGESSelect_RebuildDrawings;
-DEFINE_STANDARD_HANDLE(IGESSelect_RebuildDrawings, IGESSelect_ModelModifier)
-
-//! Rebuilds Drawings which were bypassed to produce new models.
-//! If a set of entities, all put into a same IGESModel, were
-//! attached to a same Drawing in the starting Model, this Modifier
-//! rebuilds the original Drawing, but only with the transferred
-//! entities. This includes that all its views are kept too, but
-//! empty; and annotations are not kept. Drawing Name is renewed.
-//!
-//! If the Input Selection is present, tries to rebuild Drawings
-//! only for the selected entities. Else, tries to rebuild
-//! Drawings for all the transferred entities.
-class IGESSelect_RebuildDrawings : public IGESSelect_ModelModifier
-{
-
-public:
-
-
- //! Creates an RebuildDrawings, which uses the system Date
- Standard_EXPORT IGESSelect_RebuildDrawings();
-
- //! Specific action : Rebuilds the original Drawings
- Standard_EXPORT void Performing (IFSelect_ContextModif& ctx, const Handle(IGESData_IGESModel)& target, Interface_CopyTool& TC) const Standard_OVERRIDE;
-
- //! Returns a text which is
- //! "Rebuild Drawings"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_RebuildDrawings,IGESSelect_ModelModifier)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_RebuildDrawings_HeaderFile
+++ /dev/null
-// 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 <IFSelect_ContextModif.hxx>
-#include <IGESBasic_Group.hxx>
-#include <IGESBasic_GroupWithoutBackP.hxx>
-#include <IGESBasic_OrderedGroup.hxx>
-#include <IGESBasic_OrderedGroupWithoutBackP.hxx>
-#include <IGESData_HArray1OfIGESEntity.hxx>
-#include <IGESData_IGESEntity.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESSelect_RebuildGroups.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_RebuildGroups,IGESSelect_ModelModifier)
-
-IGESSelect_RebuildGroups::IGESSelect_RebuildGroups ()
- : IGESSelect_ModelModifier (Standard_True) { }
-
- void IGESSelect_RebuildGroups::Performing
- (IFSelect_ContextModif& ctx,
- const Handle(IGESData_IGESModel)& target,
- Interface_CopyTool& TC) const
-{
-// On reconstruit les groupes qui peuvent l etre
-// Pour chaque groupe de l original, on regarde les composants transferes
-// (evt filtres par <ctx>)
-// Ensuite, silyena plus d une, on refait un nouveau groupe
- DeclareAndCast(IGESData_IGESModel,original,ctx.OriginalModel());
- Standard_Integer nbo = original->NbEntities();
-
-// Entites a prendre en compte pour la reconstruction
-// NB : Les groupes deja transferes ne sont bien sur pas reconstruits !
- TColStd_Array1OfInteger pris(0,nbo); pris.Init(0);
- for (ctx.Start(); ctx.More(); ctx.Next()) {
- pris.SetValue (original->Number(ctx.ValueOriginal()),1);
- }
-
- for (Standard_Integer i = 1; i <= nbo; i ++) {
- Handle(IGESData_IGESEntity) ent = original->Entity(i);
- if (ent->TypeNumber() != 402) continue;
- Standard_Integer casenum = 0;
- Handle(Standard_Transient) newent;
- Interface_EntityIterator newlist;
- if (TC.Search(ent,newent)) continue; // deja passe
- if (ent->IsKind(STANDARD_TYPE(IGESBasic_Group))) {
- DeclareAndCast(IGESBasic_Group,g,ent);
- casenum = 1;
- Standard_Integer nbg = g->NbEntities();
- for (Standard_Integer ig = 1; ig <= nbg; ig ++) {
- if (TC.Search(g->Value(i),newent)) newlist.GetOneItem(newent);
- }
- }
- if (ent->IsKind(STANDARD_TYPE(IGESBasic_GroupWithoutBackP))) {
- DeclareAndCast(IGESBasic_GroupWithoutBackP,g,ent);
- casenum = 2;
- Standard_Integer nbg = g->NbEntities();
- for (Standard_Integer ig = 1; ig <= nbg; ig ++) {
- if (TC.Search(g->Value(i),newent)) newlist.GetOneItem(newent);
- }
- }
- if (ent->IsKind(STANDARD_TYPE(IGESBasic_OrderedGroup))) {
- DeclareAndCast(IGESBasic_OrderedGroup,g,ent);
- casenum = 3;
- Standard_Integer nbg = g->NbEntities();
- for (Standard_Integer ig = 1; ig <= nbg; ig ++) {
- if (TC.Search(g->Value(i),newent)) newlist.GetOneItem(newent);
- }
- }
- if (ent->IsKind(STANDARD_TYPE(IGESBasic_OrderedGroupWithoutBackP))) {
- DeclareAndCast(IGESBasic_OrderedGroupWithoutBackP,g,ent);
- casenum = 4;
- Standard_Integer nbg = g->NbEntities();
- for (Standard_Integer ig = 1; ig <= nbg; ig ++) {
- if (TC.Search(g->Value(i),newent)) newlist.GetOneItem(newent);
- }
- }
-// A present, reconstruire sil le faut
- if (newlist.NbEntities() <= 1) continue; // 0 ou 1 : rien a refaire
- Handle(IGESData_HArray1OfIGESEntity) tab =
- new IGESData_HArray1OfIGESEntity(1,newlist.NbEntities());
- Standard_Integer ng = 0;
- for (newlist.Start(); newlist.More(); newlist.Next()) {
- ng ++; tab->SetValue(ng,GetCasted(IGESData_IGESEntity,newlist.Value()));
- }
- switch (casenum) {
- case 1 : {
- Handle(IGESBasic_Group) g = new IGESBasic_Group;
- g->Init(tab);
- target->AddEntity(g);
-
-// Q : faut-il transferer le nom silyena un ?
- }
- break;
- case 2 : {
- Handle(IGESBasic_GroupWithoutBackP) g = new IGESBasic_GroupWithoutBackP;
- g->Init(tab);
- target->AddEntity(g);
- }
- break;
- case 3 : {
- Handle(IGESBasic_OrderedGroup) g = new IGESBasic_OrderedGroup;
- g->Init(tab);
- target->AddEntity(g);
- }
- break;
- case 4 : {
- Handle(IGESBasic_OrderedGroupWithoutBackP) g =
- new IGESBasic_OrderedGroupWithoutBackP;
- g->Init(tab);
- target->AddEntity(g);
- }
- break;
- default : break;
- }
- }
-}
-
- TCollection_AsciiString IGESSelect_RebuildGroups::Label () const
-{ return TCollection_AsciiString("Rebuild Groups"); }
+++ /dev/null
-// Created on: 1994-06-01
-// 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 _IGESSelect_RebuildGroups_HeaderFile
-#define _IGESSelect_RebuildGroups_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IGESSelect_ModelModifier.hxx>
-class IFSelect_ContextModif;
-class IGESData_IGESModel;
-class Interface_CopyTool;
-class TCollection_AsciiString;
-
-
-class IGESSelect_RebuildGroups;
-DEFINE_STANDARD_HANDLE(IGESSelect_RebuildGroups, IGESSelect_ModelModifier)
-
-//! Rebuilds Groups which were bypassed to produce new models.
-//! If a set of entities, all put into a same IGESModel, were
-//! part of a same Group in the starting Model, this Modifier
-//! rebuilds the original group, but only with the transferred
-//! entities. The distinctions (Ordered or not, "WhithoutBackP"
-//! or not) are renewed, also the name of the group.
-//!
-//! If the Input Selection is present, tries to rebuild groups
-//! only for the selected entities. Else, tries to rebuild
-//! groups for all the transferred entities.
-class IGESSelect_RebuildGroups : public IGESSelect_ModelModifier
-{
-
-public:
-
-
- //! Creates an RebuildGroups, which uses the system Date
- Standard_EXPORT IGESSelect_RebuildGroups();
-
- //! Specific action : Rebuilds the original groups
- Standard_EXPORT void Performing (IFSelect_ContextModif& ctx, const Handle(IGESData_IGESModel)& target, Interface_CopyTool& TC) const Standard_OVERRIDE;
-
- //! Returns a text which is
- //! "Rebuild Groups"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_RebuildGroups,IGESSelect_ModelModifier)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_RebuildGroups_HeaderFile
+++ /dev/null
-// 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 <IFSelect_ContextModif.hxx>
-#include <IGESBasic_HArray1OfHArray1OfIGESEntity.hxx>
-#include <IGESData_HArray1OfIGESEntity.hxx>
-#include <IGESData_IGESEntity.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESGeom_Boundary.hxx>
-#include <IGESGeom_BoundedSurface.hxx>
-#include <IGESGeom_CurveOnSurface.hxx>
-#include <IGESGeom_TrimmedSurface.hxx>
-#include <IGESSelect_RemoveCurves.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_HArray1OfInteger.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_RemoveCurves,IGESSelect_ModelModifier)
-
-IGESSelect_RemoveCurves::IGESSelect_RemoveCurves (const Standard_Boolean UV)
- : IGESSelect_ModelModifier (Standard_True) , theUV (UV) { }
-
-static Standard_Boolean Edit
- (const Handle(Standard_Transient)& ent, const Standard_Boolean UV)
-{
- Standard_Boolean res = Standard_False;
- DeclareAndCast(IGESGeom_TrimmedSurface,trsu,ent);
- if (!trsu.IsNull()) {
- res = Edit (trsu->OuterContour(),UV);
- Standard_Integer i,nb = trsu->NbInnerContours();
- for (i = 1; i <= nb; i ++) {
- res = res | Edit (trsu->InnerContour(i),UV);
- }
- return res;
- }
-
- DeclareAndCast(IGESGeom_BoundedSurface,bnsu,ent);
- if (!bnsu.IsNull()) {
- Standard_Integer i,nb = bnsu->NbBoundaries();
- for (i = 1; i <= nb; i ++) {
- res = res | Edit (bnsu->Boundary(i),UV);
- }
- return res;
- }
-
- DeclareAndCast(IGESGeom_CurveOnSurface,cons,ent);
- if (!cons.IsNull()) {
- Handle(IGESData_IGESEntity) cuv,c3d;
- cuv = cons->CurveUV();
- c3d = cons->Curve3D();
- Standard_Integer pref = cons->PreferenceMode();
- if (UV && !c3d.IsNull()) {
- if (cuv.IsNull() || c3d.IsNull()) return Standard_False; // rien a faire
- cuv.Nullify();
- if (pref == 1) pref = 0;
- if (pref == 3) pref = 2;
- } else if (!cuv.IsNull()) {
- if (cuv.IsNull() || c3d.IsNull()) return Standard_False; // rien a faire
- c3d.Nullify();
- if (pref == 2) pref = 0;
- if (pref == 3) pref = 1;
- }
- cons->Init ( cons->CreationMode(), cons->Surface(), cuv, c3d, pref );
- return Standard_True;
- }
-
- DeclareAndCast(IGESGeom_Boundary,bndy,ent);
- if (!bndy.IsNull()) {
- Standard_Integer i, nb = bndy->NbModelSpaceCurves();
- if (nb == 0) return Standard_False;
- Handle(IGESData_HArray1OfIGESEntity) arc3d = new IGESData_HArray1OfIGESEntity(1,nb);
- Handle(IGESBasic_HArray1OfHArray1OfIGESEntity) arcuv = new IGESBasic_HArray1OfHArray1OfIGESEntity (1,nb);
- Handle(TColStd_HArray1OfInteger) sens = new TColStd_HArray1OfInteger(1,nb);
- for (i = 1; i <= nb; i ++) {
- sens->SetValue (i,bndy->Sense(i));
- Handle(IGESData_HArray1OfIGESEntity) cuv = bndy->ParameterCurves(i);
- Handle(IGESData_IGESEntity) c3d = bndy->ModelSpaceCurve (i);
- if (UV) {
- if (cuv.IsNull() || c3d.IsNull()) continue; // rien a faire
- cuv.Nullify();
- arcuv->SetValue (i,cuv);
- } else {
- if (cuv.IsNull() || c3d.IsNull()) continue; // rien a faire
- c3d.Nullify();
- arc3d->SetValue (i,c3d);
- res = Standard_True;
- }
- }
-// Y a-t-il eu de la retouche ?
- Standard_Integer pref = bndy->PreferenceType();
- if (UV) {
- if (pref == 2) pref = 0;
- if (pref == 3) pref = 1;
- } else {
- if (pref == 1) pref = 0;
- if (pref == 3) pref = 2;
- }
- if (res) bndy->Init (bndy->BoundaryType(),pref,bndy->Surface(),arc3d,sens,arcuv);
- return res;
- }
-
- return Standard_False;
-}
-
-
-void IGESSelect_RemoveCurves::Performing (IFSelect_ContextModif& ctx,
- const Handle(IGESData_IGESModel)& /*target*/,
- Interface_CopyTool& /*TC*/) const
-{
- for (ctx.Start(); ctx.More(); ctx.Next()) {
- if (Edit (ctx.ValueResult(),theUV) ) ctx.Trace ();
- }
-}
-
- TCollection_AsciiString IGESSelect_RemoveCurves::Label () const
-{
- if (theUV) return TCollection_AsciiString ("Remove Curves UV on Face");
- else return TCollection_AsciiString ("Remove Curves 3D on Face");
-}
+++ /dev/null
-// Created on: 1999-02-24
-// Created by: Christian CAILLET
-// Copyright (c) 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 _IGESSelect_RemoveCurves_HeaderFile
-#define _IGESSelect_RemoveCurves_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Boolean.hxx>
-#include <IGESSelect_ModelModifier.hxx>
-class IFSelect_ContextModif;
-class IGESData_IGESModel;
-class Interface_CopyTool;
-class TCollection_AsciiString;
-
-
-class IGESSelect_RemoveCurves;
-DEFINE_STANDARD_HANDLE(IGESSelect_RemoveCurves, IGESSelect_ModelModifier)
-
-//! Removes Curves UV or 3D (not both !) from Faces, those
-//! designated by the Selection. No Selection means all the file
-class IGESSelect_RemoveCurves : public IGESSelect_ModelModifier
-{
-
-public:
-
-
- //! Creates a RemoveCurves from Faces (141/142/143/144)
- //! UV True : Removes UV Curves (pcurves)
- //! UV False : Removes 3D Curves
- Standard_EXPORT IGESSelect_RemoveCurves(const Standard_Boolean UV);
-
- //! Specific action : Removes the Curves
- Standard_EXPORT void Performing (IFSelect_ContextModif& ctx, const Handle(IGESData_IGESModel)& target, Interface_CopyTool& TC) const Standard_OVERRIDE;
-
- //! Returns a text which is
- //! "Remove Curves UV on Face" or "Remove Curves 3D on Face"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_RemoveCurves,IGESSelect_ModelModifier)
-
-protected:
-
-
-
-
-private:
-
-
- Standard_Boolean theUV;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_RemoveCurves_HeaderFile
+++ /dev/null
-// 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 <IGESData_IGESEntity.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESSelect_SelectDrawingFrom.hxx>
-#include <IGESSelect_ViewSorter.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceError.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_SelectDrawingFrom,IFSelect_SelectDeduct)
-
-IGESSelect_SelectDrawingFrom::IGESSelect_SelectDrawingFrom () { }
-
-
- Standard_Boolean IGESSelect_SelectDrawingFrom::HasUniqueResult () const
- { return Standard_True; }
-
- Interface_EntityIterator IGESSelect_SelectDrawingFrom::RootResult
- (const Interface_Graph& G) const
-{
- Handle(IGESSelect_ViewSorter) sorter = new IGESSelect_ViewSorter;
- sorter->SetModel (GetCasted(IGESData_IGESModel,G.Model()));
- sorter->Clear();
- sorter->AddList (InputResult(G).Content());
- sorter->SortDrawings(G);
- Interface_EntityIterator list;
- Standard_Integer nb = sorter->NbSets(Standard_True);
- for (Standard_Integer i = 1; i <= nb; i ++)
- list.GetOneItem(sorter->SetItem(i,Standard_True));
- return list;
-}
-
- TCollection_AsciiString IGESSelect_SelectDrawingFrom::Label () const
- { return TCollection_AsciiString ("Drawings attached"); }
+++ /dev/null
-// Created on: 1994-06-01
-// 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 _IGESSelect_SelectDrawingFrom_HeaderFile
-#define _IGESSelect_SelectDrawingFrom_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectDeduct.hxx>
-#include <Standard_Boolean.hxx>
-class Interface_InterfaceError;
-class Interface_EntityIterator;
-class Interface_Graph;
-class TCollection_AsciiString;
-
-
-class IGESSelect_SelectDrawingFrom;
-DEFINE_STANDARD_HANDLE(IGESSelect_SelectDrawingFrom, IFSelect_SelectDeduct)
-
-//! This selection gets the Drawings attached to its input IGES
-//! entities. They are read through thr Single Views, referenced
-//! in Directory Parts of the entities
-class IGESSelect_SelectDrawingFrom : public IFSelect_SelectDeduct
-{
-
-public:
-
-
- //! Creates a SelectDrawingFrom
- Standard_EXPORT IGESSelect_SelectDrawingFrom();
-
- //! Selects the Drawings attached (through Single Views in
- //! Directory Part) to input entities
- Standard_EXPORT Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! Returns the label, with is "Drawings attached"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_SelectDrawingFrom,IFSelect_SelectDeduct)
-
-protected:
-
-
- //! Returns True, because selection works with a ViewSorter which
- //! gives a unique result
- Standard_EXPORT virtual Standard_Boolean HasUniqueResult() const Standard_OVERRIDE;
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_SelectDrawingFrom_HeaderFile
+++ /dev/null
-// 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 <IGESData_IGESEntity.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESSelect_SelectSingleViewFrom.hxx>
-#include <IGESSelect_ViewSorter.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceError.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_SelectSingleViewFrom,IFSelect_SelectDeduct)
-
-IGESSelect_SelectSingleViewFrom::IGESSelect_SelectSingleViewFrom () { }
-
- Standard_Boolean IGESSelect_SelectSingleViewFrom::HasUniqueResult () const
- { return Standard_True; }
-
- Interface_EntityIterator IGESSelect_SelectSingleViewFrom::RootResult
- (const Interface_Graph& G) const
-{
- Handle(IGESSelect_ViewSorter) sorter = new IGESSelect_ViewSorter;
- sorter->SetModel (GetCasted(IGESData_IGESModel,G.Model()));
- sorter->Clear();
- sorter->AddList (InputResult(G).Content());
- sorter->SortSingleViews(Standard_True);
- Interface_EntityIterator list;
- Standard_Integer nb = sorter->NbSets(Standard_True);
- for (Standard_Integer i = 1; i <= nb; i ++)
- list.GetOneItem(sorter->SetItem(i,Standard_True));
- return list;
-}
-
-
- TCollection_AsciiString IGESSelect_SelectSingleViewFrom::Label () const
- { return TCollection_AsciiString ("Single Views attached"); }
+++ /dev/null
-// Created on: 1994-06-01
-// 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 _IGESSelect_SelectSingleViewFrom_HeaderFile
-#define _IGESSelect_SelectSingleViewFrom_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectDeduct.hxx>
-#include <Standard_Boolean.hxx>
-class Interface_InterfaceError;
-class Interface_EntityIterator;
-class Interface_Graph;
-class TCollection_AsciiString;
-
-
-class IGESSelect_SelectSingleViewFrom;
-DEFINE_STANDARD_HANDLE(IGESSelect_SelectSingleViewFrom, IFSelect_SelectDeduct)
-
-//! This selection gets the Single Views attached to its input
-//! IGES entities. Single Views themselves or Drawings as passed
-//! as such (Drawings, for their Annotations)
-class IGESSelect_SelectSingleViewFrom : public IFSelect_SelectDeduct
-{
-
-public:
-
-
- //! Creates a SelectSingleViewFrom
- Standard_EXPORT IGESSelect_SelectSingleViewFrom();
-
- //! Selects the Single Views attached (in Directory Part) to
- //! input entities
- Standard_EXPORT Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! Returns the label, with is "Single Views attached"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_SelectSingleViewFrom,IFSelect_SelectDeduct)
-
-protected:
-
-
- //! Returns True, because selection works with a ViewSorter which
- //! gives a unique result
- Standard_EXPORT virtual Standard_Boolean HasUniqueResult() const Standard_OVERRIDE;
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_SelectSingleViewFrom_HeaderFile
+++ /dev/null
-// 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 <IFSelect_ContextModif.hxx>
-#include <IGESData_GlobalSection.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESSelect_SetGlobalParameter.hxx>
-#include <Interface_Check.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Interface_FileParameter.hxx>
-#include <Interface_ParamSet.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_SetGlobalParameter,IGESSelect_ModelModifier)
-
-IGESSelect_SetGlobalParameter::IGESSelect_SetGlobalParameter
- (const Standard_Integer numpar)
- : IGESSelect_ModelModifier (Standard_False)
- { thenum = numpar; }
-
- Standard_Integer IGESSelect_SetGlobalParameter::GlobalNumber () const
- { return thenum; }
-
- void IGESSelect_SetGlobalParameter::SetValue
- (const Handle(TCollection_HAsciiString)& text)
- { theval = text; }
-
- Handle(TCollection_HAsciiString) IGESSelect_SetGlobalParameter::Value
- () const
- { return theval; }
-
-
- void IGESSelect_SetGlobalParameter::Performing
- (IFSelect_ContextModif& ctx,
- const Handle(IGESData_IGESModel)& target,
- Interface_CopyTool& ) const
-{
- if (theval.IsNull()) {
- ctx.CCheck()->AddWarning("Set IGES Global Parameter, no value defined, ignored");
- return;
- }
- IGESData_GlobalSection GS = target->GlobalSection();
- Handle(Interface_ParamSet) oldset = GS.Params();
- if (thenum <= 0 || thenum > oldset->NbParams()) {
- char mess[80];
- sprintf(mess,"Set IGES Global Parameter : Number %d incorrect",thenum);
- ctx.CCheck()->AddFail(mess);
- return;
- }
- Interface_FileParameter& FP = oldset->ChangeParam (thenum);
- FP.Init (theval->ToCString(),FP.ParamType());
- Handle(Interface_Check) check = new Interface_Check;
- GS.Init (oldset,check);
- ctx.AddCheck(check);
- if (!check->HasFailed()) target->SetGlobalSection(GS);
-}
-
- TCollection_AsciiString IGESSelect_SetGlobalParameter::Label () const
-{
- char mess[80];
- if (theval.IsNull()) sprintf(mess,"Set IGES Global Parameter (undefined)");
- else sprintf(mess,"Set IGES Global Parameter Number %d to %s",
- thenum,theval->ToCString());
- return TCollection_AsciiString (mess);
-}
+++ /dev/null
-// Created on: 1994-06-01
-// Created by: Modelistation
-// 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 _IGESSelect_SetGlobalParameter_HeaderFile
-#define _IGESSelect_SetGlobalParameter_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Integer.hxx>
-#include <IGESSelect_ModelModifier.hxx>
-class TCollection_HAsciiString;
-class IFSelect_ContextModif;
-class IGESData_IGESModel;
-class Interface_CopyTool;
-class TCollection_AsciiString;
-
-
-class IGESSelect_SetGlobalParameter;
-DEFINE_STANDARD_HANDLE(IGESSelect_SetGlobalParameter, IGESSelect_ModelModifier)
-
-//! Sets a Global (Header) Parameter to a new value, directly given
-//! Controls the form of the parameter (Integer, Real, String
-//! with such or such form), but not the consistence of the new
-//! value regarding the rest of the file.
-//!
-//! The new value is given under the form of a HAsciiString, even
-//! for Integer or Real values. For String values, Hollerith forms
-//! are accepted but not mandatory
-//! Warning : a Null (not set) value is not accepted. For an empty string,
-//! give a Text Parameter which is empty
-class IGESSelect_SetGlobalParameter : public IGESSelect_ModelModifier
-{
-
-public:
-
-
- //! Creates an SetGlobalParameter, to be applied on Global
- //! Parameter <numpar>
- Standard_EXPORT IGESSelect_SetGlobalParameter(const Standard_Integer numpar);
-
- //! Returns the global parameter number to which this modifiers
- //! applies
- Standard_EXPORT Standard_Integer GlobalNumber() const;
-
- //! Sets a Text Parameter for the new value
- Standard_EXPORT void SetValue (const Handle(TCollection_HAsciiString)& text);
-
- //! Returns the value to set to the global parameter (Text Param)
- Standard_EXPORT Handle(TCollection_HAsciiString) Value() const;
-
- //! Specific action : only <target> is used : the form of the new
- //! value is checked regarding the parameter number (given at
- //! creation time).
- Standard_EXPORT void Performing (IFSelect_ContextModif& ctx, const Handle(IGESData_IGESModel)& target, Interface_CopyTool& TC) const Standard_OVERRIDE;
-
- //! Returns a text which is
- //! "Sets Global Parameter <numpar> to <new value>"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_SetGlobalParameter,IGESSelect_ModelModifier)
-
-protected:
-
-
-
-
-private:
-
-
- Standard_Integer thenum;
- Handle(TCollection_HAsciiString) theval;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_SetGlobalParameter_HeaderFile
+++ /dev/null
-// 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 <IFSelect_ContextModif.hxx>
-#include <IGESData_IGESEntity.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESSelect_SetLabel.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_SetLabel,IGESSelect_ModelModifier)
-
-IGESSelect_SetLabel::IGESSelect_SetLabel
- (const Standard_Integer mode, const Standard_Boolean enforce)
- : IGESSelect_ModelModifier (Standard_False) ,
- themode (mode) , theforce (enforce) { }
-
- void IGESSelect_SetLabel::Performing(IFSelect_ContextModif& ctx,
- const Handle(IGESData_IGESModel)& target,
- Interface_CopyTool& /*TC*/) const
-{
- Handle(TCollection_HAsciiString) lab;
- for (ctx.Start(); ctx.More(); ctx.Next()) {
- DeclareAndCast(IGESData_IGESEntity,iges,ctx.ValueResult());
- if (iges.IsNull()) continue;
- if (themode == 0) { iges->SetLabel(lab); continue; }
-
-// mode = 1 : mettre DEnnn , nnn est le DE Number
- lab = iges->ShortLabel();
- if (theforce) lab.Nullify();
- if (!lab.IsNull()) {
- if (lab->Length() > 2) {
- if (lab->Value(1) == 'D' && lab->Value(2) == 'E' &&
- atoi( &(lab->ToCString())[2] ) > 0)
- lab.Nullify();
- }
- }
-// Si lab nul : le recalculer
- if (lab.IsNull()) {
- lab = new TCollection_HAsciiString(target->Number(iges)*2-1);
- lab->Insert (1,"DE");
- }
- iges->SetLabel(lab);
- }
-}
-
- TCollection_AsciiString IGESSelect_SetLabel::Label () const
-{
- TCollection_AsciiString lab;
- if (themode == 0) lab.AssignCat ("Clear Short Label");
- if (themode == 1) lab.AssignCat ("Set Short Label to DE Number");
- if (theforce) lab.AssignCat (" (enforced)");
- return lab;
-}
+++ /dev/null
-// Created on: 1999-02-26
-// Created by: Christian CAILLET
-// Copyright (c) 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 _IGESSelect_SetLabel_HeaderFile
-#define _IGESSelect_SetLabel_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Integer.hxx>
-#include <Standard_Boolean.hxx>
-#include <IGESSelect_ModelModifier.hxx>
-class IFSelect_ContextModif;
-class IGESData_IGESModel;
-class Interface_CopyTool;
-class TCollection_AsciiString;
-
-
-class IGESSelect_SetLabel;
-DEFINE_STANDARD_HANDLE(IGESSelect_SetLabel, IGESSelect_ModelModifier)
-
-//! Sets/Clears Short Label of Entities, those designated by the
-//! Selection. No Selection means all the file
-//!
-//! May enforce, else it sets only if no label is yet set
-//! Mode : 0 to clear (always enforced)
-//! 1 to set label to DE number (changes it if already set)
-class IGESSelect_SetLabel : public IGESSelect_ModelModifier
-{
-
-public:
-
-
- //! Creates a SetLabel for IGESEntity
- //! Mode : see Purpose of the class
- Standard_EXPORT IGESSelect_SetLabel(const Standard_Integer mode, const Standard_Boolean enforce);
-
- //! Specific action : Sets or Clears the Label
- Standard_EXPORT void Performing (IFSelect_ContextModif& ctx, const Handle(IGESData_IGESModel)& target, Interface_CopyTool& TC) const Standard_OVERRIDE;
-
- //! Returns a text which is
- //! "Clear Short Label" or "Set Label to DE"
- //! With possible additional information " (enforced)"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_SetLabel,IGESSelect_ModelModifier)
-
-protected:
-
-
-
-
-private:
-
-
- Standard_Integer themode;
- Standard_Boolean theforce;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_SetLabel_HeaderFile
+++ /dev/null
-// 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 <IFSelect_ContextModif.hxx>
-#include <IGESData_GlobalSection.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESSelect_SetVersion5.hxx>
-#include <Interface_Check.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_SetVersion5,IGESSelect_ModelModifier)
-
-IGESSelect_SetVersion5::IGESSelect_SetVersion5 ()
- : IGESSelect_ModelModifier (Standard_False) { }
-
- void IGESSelect_SetVersion5::Performing
- (IFSelect_ContextModif& ctx,
- const Handle(IGESData_IGESModel)& target,
- Interface_CopyTool& ) const
-{
- IGESData_GlobalSection GS = target->GlobalSection();
- if (GS.IGESVersion() >= 9) return;
- GS.SetIGESVersion(9);
- GS.SetLastChangeDate ();
- target->SetGlobalSection(GS);
- Handle(Interface_Check) check = new Interface_Check;
- target->VerifyCheck(check);
- if (check->HasFailed()) ctx.CCheck()->GetMessages(check);
-}
-
-
- TCollection_AsciiString IGESSelect_SetVersion5::Label () const
-{ return TCollection_AsciiString ("Update IGES Version in Global Section to 5.1"); }
+++ /dev/null
-// Created on: 1994-06-01
-// 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 _IGESSelect_SetVersion5_HeaderFile
-#define _IGESSelect_SetVersion5_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IGESSelect_ModelModifier.hxx>
-class IFSelect_ContextModif;
-class IGESData_IGESModel;
-class Interface_CopyTool;
-class TCollection_AsciiString;
-
-
-class IGESSelect_SetVersion5;
-DEFINE_STANDARD_HANDLE(IGESSelect_SetVersion5, IGESSelect_ModelModifier)
-
-//! Sets IGES Version (coded in global parameter 23) to be at least
-//! IGES 5.1 . If it is older, it is set to IGES 5.1, and
-//! LastChangeDate (new Global n0 25) is added (current time)
-//! Else, it does nothing (i.e. changes neither IGES Version nor
-//! LastChangeDate)
-class IGESSelect_SetVersion5 : public IGESSelect_ModelModifier
-{
-
-public:
-
-
- //! Creates an SetVersion5, which uses the system Date for Last
- //! Change Date
- Standard_EXPORT IGESSelect_SetVersion5();
-
- //! Specific action : only <target> is used : IGES Version (coded)
- //! is upgraded to 5.1 if it is older, and it this case the new
- //! global parameter 25 (LastChangeDate) is set to current time
- Standard_EXPORT void Performing (IFSelect_ContextModif& ctx, const Handle(IGESData_IGESModel)& target, Interface_CopyTool& TC) const Standard_OVERRIDE;
-
- //! Returns a text which is
- //! "Update IGES Version to 5.1"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_SetVersion5,IGESSelect_ModelModifier)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_SetVersion5_HeaderFile
+++ /dev/null
-// 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 <IGESData_IGESEntity.hxx>
-#include <IGESSelect_SplineToBSpline.hxx>
-#include <Interface_Check.hxx>
-#include <Interface_CheckIterator.hxx>
-#include <Interface_CopyControl.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Interface_Protocol.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_SplineToBSpline,IFSelect_Transformer)
-
-IGESSelect_SplineToBSpline::IGESSelect_SplineToBSpline
- (const Standard_Boolean tryC2)
-{
- thetryc2 = tryC2; thefound = Standard_False;
-}
-
-Standard_Boolean IGESSelect_SplineToBSpline::OptionTryC2 () const
-{
- return thetryc2;
-}
-
-
-Standard_Boolean IGESSelect_SplineToBSpline::Perform
- (const Interface_Graph& G, const Handle(Interface_Protocol)&,
- Interface_CheckIterator& checks,
- Handle(Interface_InterfaceModel)& newmod)
-{
- Standard_Integer nbe = G.Size();
- thefound = Standard_False;
- themap.Nullify();
- for (Standard_Integer i = 1; i <= nbe; i ++) {
- DeclareAndCast(IGESData_IGESEntity,ent,G.Entity(i));
- if (ent.IsNull()) continue;
- Standard_Integer it = ent->TypeNumber();
- if (it == 112 || it == 126) {
- thefound = Standard_True;
-#ifdef OCCT_DEBUG
- cout<<"IGESSelect_SplineToBSpline : n0."<<i
- << (it == 112 ? ", Curve" : ", Surface")<<" to convert"<<endl;
-#endif
- }
- }
- newmod.Nullify();
- if (!thefound) return Standard_True;
-
-// Il faudrait convertir ...
- checks.CCheck(0)->AddFail("IGESSelect_SplineToBSpline : not yet implemented");
- return Standard_False;
-}
-
-
-Standard_Boolean IGESSelect_SplineToBSpline::Updated
- (const Handle(Standard_Transient)& entfrom,
- Handle(Standard_Transient)& entto) const
-{
- if (!thefound) {
- entto = entfrom;
- return Standard_True;
- }
- if (themap.IsNull()) return Standard_False;
- return themap->Search(entfrom,entto);
-}
-
-
-TCollection_AsciiString IGESSelect_SplineToBSpline::Label () const
-{
- if (thetryc2) return TCollection_AsciiString
- ("Convert Spline Forms to BSpline, trying to recover C1-C2 continuity");
- else return TCollection_AsciiString ("Convert Spline Forms to BSpline");
-}
+++ /dev/null
-// Created on: 1994-06-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 _IGESSelect_SplineToBSpline_HeaderFile
-#define _IGESSelect_SplineToBSpline_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Boolean.hxx>
-#include <IFSelect_Transformer.hxx>
-class Interface_CopyControl;
-class Interface_Graph;
-class Interface_Protocol;
-class Interface_CheckIterator;
-class Interface_InterfaceModel;
-class Standard_Transient;
-class TCollection_AsciiString;
-
-
-class IGESSelect_SplineToBSpline;
-DEFINE_STANDARD_HANDLE(IGESSelect_SplineToBSpline, IFSelect_Transformer)
-
-//! This type of Transformer allows to convert Spline Curves (IGES
-//! type 112) and Surfaces (IGES Type 126) to BSpline Curves (IGES
-//! type 114) and Surfac (IGES Type 128). All other entities are
-//! rebuilt as identical but on the basis of this conversion.
-//!
-//! It also gives an option to, either convert as such (i.e. each
-//! starting part of the spline becomes a segment of the bspline,
-//! with continuity C0 between segments), or try to increase
-//! continuity as far as possible to C1 or to C2.
-//!
-//! It does nothing if the starting model contains no Spline
-//! Curve (IGES Type 112) or Surface (IGES Type 126). Else,
-//! converting and rebuilding implies copying of entities.
-class IGESSelect_SplineToBSpline : public IFSelect_Transformer
-{
-
-public:
-
-
- //! Creates a Transformer SplineToBSpline. If <tryC2> is True,
- //! it will in addition try to upgrade continuity up to C2.
- Standard_EXPORT IGESSelect_SplineToBSpline(const Standard_Boolean tryC2);
-
- //! Returns the option TryC2 given at creation time
- Standard_EXPORT Standard_Boolean OptionTryC2() const;
-
- //! Performs the transformation, if there is at least one Spline
- //! Curve (112) or Surface (126). Does nothing if there is none.
- Standard_EXPORT Standard_Boolean Perform (const Interface_Graph& G, const Handle(Interface_Protocol)& protocol, Interface_CheckIterator& checks, Handle(Interface_InterfaceModel)& newmod) Standard_OVERRIDE;
-
- //! Returns the transformed entities.
- //! If original data contained no Spline Curve or Surface,
- //! the result is identity : <entto> = <entfrom>
- //! Else, the copied counterpart is returned : for a Spline Curve
- //! or Surface, it is a converted BSpline Curve or Surface. Else,
- //! it is the result of general service Copy (rebuilt as necessary
- //! by BSPlines replacing Splines).
- 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 :
- //! "Conversion Spline to BSpline" and as opted,
- //! " trying to upgrade continuity"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_SplineToBSpline,IFSelect_Transformer)
-
-protected:
-
-
-
-
-private:
-
-
- Standard_Boolean thetryc2;
- Standard_Boolean thefound;
- Handle(Interface_CopyControl) themap;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_SplineToBSpline_HeaderFile
+++ /dev/null
-// 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.
-
-//#65 rln 12.02.99 S4151 (explicitly force YYMMDD.HHMMSS before Y2000 and YYYYMMDD.HHMMSS after Y2000)
-
-#include <IFSelect_ContextModif.hxx>
-#include <IGESData_GlobalSection.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESSelect_UpdateCreationDate.hxx>
-#include <Interface_Check.hxx>
-#include <Interface_CopyTool.hxx>
-#include <OSD_Process.hxx>
-#include <Quantity_Date.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_UpdateCreationDate,IGESSelect_ModelModifier)
-
-IGESSelect_UpdateCreationDate::IGESSelect_UpdateCreationDate ()
- : IGESSelect_ModelModifier (Standard_False) { }
-
- void IGESSelect_UpdateCreationDate::Performing
- (IFSelect_ContextModif& ctx,
- const Handle(IGESData_IGESModel)& target,
- Interface_CopyTool& ) const
-{
- Standard_Integer jour,mois,annee,heure,minute,seconde,millisec,microsec;
- OSD_Process system;
- Quantity_Date ladate = system.SystemDate();
- ladate.Values (mois,jour,annee,heure,minute,seconde,millisec,microsec);
-
- IGESData_GlobalSection GS = target->GlobalSection();
- if (annee < 2000)
- //#65 rln 12.02.99 S4151 (explicitly force YYMMDD.HHMMSS before Y2000)
- GS.SetDate (IGESData_GlobalSection::NewDateString
- (annee,mois,jour,heure,minute,seconde,0));
- else
- //#65 rln 12.02.99 S4151 (explicitly force YYYYMMDD.HHMMSS after Y2000)
- GS.SetDate (IGESData_GlobalSection::NewDateString
- (annee,mois,jour,heure,minute,seconde, -1));
- target->SetGlobalSection(GS);
- Handle(Interface_Check) check = new Interface_Check;
- target->VerifyCheck(check);
- ctx.AddCheck(check);
-}
-
-
- TCollection_AsciiString IGESSelect_UpdateCreationDate::Label () const
-{ return TCollection_AsciiString ("Update Creation Date in IGES Global Section"); }
+++ /dev/null
-// Created on: 1994-06-01
-// 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 _IGESSelect_UpdateCreationDate_HeaderFile
-#define _IGESSelect_UpdateCreationDate_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IGESSelect_ModelModifier.hxx>
-class IFSelect_ContextModif;
-class IGESData_IGESModel;
-class Interface_CopyTool;
-class TCollection_AsciiString;
-
-
-class IGESSelect_UpdateCreationDate;
-DEFINE_STANDARD_HANDLE(IGESSelect_UpdateCreationDate, IGESSelect_ModelModifier)
-
-//! Allows to Change the Creation Date indication in the Header
-//! (Global Section) of IGES File. It is taken from the operating
-//! system (time of application of the Modifier).
-//! The Selection of the Modifier is not used : it simply acts as
-//! a criterium to select IGES Files to touch up
-class IGESSelect_UpdateCreationDate : public IGESSelect_ModelModifier
-{
-
-public:
-
-
- //! Creates an UpdateCreationDate, which uses the system Date
- Standard_EXPORT IGESSelect_UpdateCreationDate();
-
- //! Specific action : only <target> is used : the system Date
- //! is set to Global Section Item n0 18.
- Standard_EXPORT void Performing (IFSelect_ContextModif& ctx, const Handle(IGESData_IGESModel)& target, Interface_CopyTool& TC) const Standard_OVERRIDE;
-
- //! Returns a text which is
- //! "Update IGES Header Creation Date"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_UpdateCreationDate,IGESSelect_ModelModifier)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_UpdateCreationDate_HeaderFile
+++ /dev/null
-// 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 <IFSelect_ContextModif.hxx>
-#include <IGESData_GlobalSection.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESSelect_UpdateFileName.hxx>
-#include <Interface_Check.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_UpdateFileName,IGESSelect_ModelModifier)
-
-IGESSelect_UpdateFileName::IGESSelect_UpdateFileName ()
- : IGESSelect_ModelModifier (Standard_False) { }
-
-void IGESSelect_UpdateFileName::Performing (IFSelect_ContextModif& ctx,
- const Handle(IGESData_IGESModel)& target,
- Interface_CopyTool& /*TC*/) const
-{
- if (!ctx.HasFileName()) {
- ctx.CCheck(0)->AddWarning("New File Name unknown, former one is kept");
- return;
- }
- IGESData_GlobalSection GS = target->GlobalSection();
- GS.SetFileName (new TCollection_HAsciiString (ctx.FileName()) );
- target->SetGlobalSection(GS);
- Handle(Interface_Check) check = new Interface_Check;
- target->VerifyCheck(check);
- ctx.AddCheck(check);
-}
-
- TCollection_AsciiString IGESSelect_UpdateFileName::Label () const
-{ return TCollection_AsciiString("Updates IGES File Name to new current one"); }
+++ /dev/null
-// Created on: 1995-02-23
-// Created by: Christian CAILLET
-// Copyright (c) 1995-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 _IGESSelect_UpdateFileName_HeaderFile
-#define _IGESSelect_UpdateFileName_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IGESSelect_ModelModifier.hxx>
-class IFSelect_ContextModif;
-class IGESData_IGESModel;
-class Interface_CopyTool;
-class TCollection_AsciiString;
-
-
-class IGESSelect_UpdateFileName;
-DEFINE_STANDARD_HANDLE(IGESSelect_UpdateFileName, IGESSelect_ModelModifier)
-
-//! Sets the File Name in Header to be the actual name of the file
-//! If new file name is unknown, the former one is kept
-//! Remark : this works well only when it is Applied and send time
-//! If it is run immediately, new file name is unknown and nothing
-//! is done
-//! The Selection of the Modifier is not used : it simply acts as
-//! a criterium to select IGES Files to touch up
-class IGESSelect_UpdateFileName : public IGESSelect_ModelModifier
-{
-
-public:
-
-
- //! Creates an UpdateFileName, which uses the system Date
- Standard_EXPORT IGESSelect_UpdateFileName();
-
- //! Specific action : only <target> is used : the system Date
- //! is set to Global Section Item n0 18.
- Standard_EXPORT void Performing (IFSelect_ContextModif& ctx, const Handle(IGESData_IGESModel)& target, Interface_CopyTool& TC) const Standard_OVERRIDE;
-
- //! Returns a text which is
- //! "Updates IGES File Name to new current one"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_UpdateFileName,IGESSelect_ModelModifier)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_UpdateFileName_HeaderFile
+++ /dev/null
-// 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.
-
-//#65 rln 12.02.99 S4151 (explicitly force YYMMDD.HHMMSS before Y2000 and YYYYMMDD.HHMMSS after Y2000)
-
-#include <IFSelect_ContextModif.hxx>
-#include <IGESData_GlobalSection.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESSelect_UpdateLastChange.hxx>
-#include <Interface_Check.hxx>
-#include <Interface_CopyTool.hxx>
-#include <OSD_Process.hxx>
-#include <Quantity_Date.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_UpdateLastChange,IGESSelect_ModelModifier)
-
-IGESSelect_UpdateLastChange::IGESSelect_UpdateLastChange ()
- : IGESSelect_ModelModifier (Standard_False) { }
-
- void IGESSelect_UpdateLastChange::Performing
- (IFSelect_ContextModif& ctx,
- const Handle(IGESData_IGESModel)& target,
- Interface_CopyTool& ) const
-{
- Standard_Integer jour,mois,annee,heure,minute,seconde,millisec,microsec;
- OSD_Process system;
- Quantity_Date ladate = system.SystemDate();
- ladate.Values (mois,jour,annee,heure,minute,seconde,millisec,microsec);
-
- IGESData_GlobalSection GS = target->GlobalSection();
- if (GS.IGESVersion() < 9) GS.SetIGESVersion(9);
- if (annee < 2000)
- //#65 rln 12.02.99 S4151 (explicitly force YYMMDD.HHMMSS before Y2000)
- GS.SetDate (IGESData_GlobalSection::NewDateString
- (annee,mois,jour,heure,minute,seconde,0));
- else
- //#65 rln 12.02.99 S4151 (explicitly force YYYYMMDD.HHMMSS after Y2000)
- GS.SetDate (IGESData_GlobalSection::NewDateString
- (annee,mois,jour,heure,minute,seconde, -1));
- target->SetGlobalSection(GS);
- Handle(Interface_Check) check = new Interface_Check;
- target->VerifyCheck(check);
- ctx.AddCheck(check);
-}
-
-
- TCollection_AsciiString IGESSelect_UpdateLastChange::Label () const
-{ return TCollection_AsciiString ("Update Last Change Date in IGES Global Section"); }
+++ /dev/null
-// Created on: 1994-06-01
-// 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 _IGESSelect_UpdateLastChange_HeaderFile
-#define _IGESSelect_UpdateLastChange_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IGESSelect_ModelModifier.hxx>
-class IFSelect_ContextModif;
-class IGESData_IGESModel;
-class Interface_CopyTool;
-class TCollection_AsciiString;
-
-
-class IGESSelect_UpdateLastChange;
-DEFINE_STANDARD_HANDLE(IGESSelect_UpdateLastChange, IGESSelect_ModelModifier)
-
-//! Allows to Change the Last Change Date indication in the Header
-//! (Global Section) of IGES File. It is taken from the operating
-//! system (time of application of the Modifier).
-//! The Selection of the Modifier is not used : it simply acts as
-//! a criterium to select IGES Files to touch up.
-//! Remark : IGES Models noted as version before IGES 5.1 are in
-//! addition changed to 5.1
-class IGESSelect_UpdateLastChange : public IGESSelect_ModelModifier
-{
-
-public:
-
-
- //! Creates an UpdateLastChange, which uses the system Date
- Standard_EXPORT IGESSelect_UpdateLastChange();
-
- //! Specific action : only <target> is used : the system Date
- //! is set to Global Section Item n0 25. Also sets IGES Version
- //! (Item n0 23) to IGES5 if it was older.
- Standard_EXPORT void Performing (IFSelect_ContextModif& ctx, const Handle(IGESData_IGESModel)& target, Interface_CopyTool& TC) const Standard_OVERRIDE;
-
- //! Returns a text which is
- //! "Update IGES Header Last Change Date"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_UpdateLastChange,IGESSelect_ModelModifier)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_UpdateLastChange_HeaderFile
+++ /dev/null
-// 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 <IFSelect_PacketList.hxx>
-#include <IGESData_IGESEntity.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESData_ViewKindEntity.hxx>
-#include <IGESSelect_ViewSorter.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_ViewSorter,MMgt_TShared)
-
-#define PourDrawing 404
-
-
-IGESSelect_ViewSorter::IGESSelect_ViewSorter () { }
-
- void IGESSelect_ViewSorter::SetModel
- (const Handle(IGESData_IGESModel)& model) { themodel = model; }
-
-
- void IGESSelect_ViewSorter::Clear ()
-{
- Standard_Integer nb = themodel->NbEntities();
- if (nb < 100) nb = 100;
- themap.Clear(); themap.ReSize (nb);
- theitems.Clear(); theitems.ReSize (nb);
- thefinals.Clear(); thefinals.ReSize (nb);
- theinditem.Clear(); theindfin.Clear(); // seq//
-}
-
-
- Standard_Boolean IGESSelect_ViewSorter::Add
- (const Handle(Standard_Transient)& ent)
-{
- DeclareAndCast(IGESData_IGESEntity,igesent,ent);
- if (!igesent.IsNull()) return AddEntity (igesent);
- DeclareAndCast(TColStd_HSequenceOfTransient,list,ent);
- if (!list.IsNull()) { AddList (list); return Standard_True; }
- DeclareAndCast(Interface_InterfaceModel,model,ent);
- if (!model.IsNull()) { AddModel (model); return Standard_True; }
- return Standard_False;
-}
-
- Standard_Boolean IGESSelect_ViewSorter::AddEntity
- (const Handle(IGESData_IGESEntity)& igesent)
-{
-// Reception, controle de type et de map
- if (igesent.IsNull()) return Standard_False;
- if (themap.FindIndex(igesent)) return Standard_False;
- themap.Add(igesent);
-// Recuperation de la vue (attention au cas du Drawing)
- Handle(IGESData_IGESEntity) view;
- if (igesent->TypeNumber() == PourDrawing) view = igesent; // DRAWING
- else {
- if (igesent->IsKind(STANDARD_TYPE(IGESData_ViewKindEntity))) view = igesent; // VIEW
- else view = igesent->View();
-/*
- DeclareAndCast(IGESData_ViewKindEntity,trueview,view);
- if (!trueview.IsNull())
- if (trueview->IsSingle()) view.Nullify(); // Multiple -> Nulle
-*/
- }
-// On enregistre
- Standard_Integer viewindex = 0; // 0 sera pour remain
- if (!view.IsNull()) {
- viewindex = theitems.FindIndex(view);
- if (viewindex <= 0) viewindex = theitems.Add(view);
- }
- theinditem.Append(viewindex);
- theindfin.Append(0);
- return Standard_True;
-}
-
-
- void IGESSelect_ViewSorter::AddList
- (const Handle(TColStd_HSequenceOfTransient)& list)
-{
- Standard_Integer nb = list->Length();
- for (Standard_Integer i = 1; i <= nb; i ++) Add (list->Value(i));
-}
-
- void IGESSelect_ViewSorter::AddModel
- (const Handle(Interface_InterfaceModel)& model)
-{
- DeclareAndCast(IGESData_IGESModel,igesmod,model);
- if (igesmod.IsNull()) return;
- Standard_Integer nb = igesmod->NbEntities();
- for (Standard_Integer i = 1; i <= nb; i ++) AddEntity (igesmod->Entity(i));
-}
-
- Standard_Integer IGESSelect_ViewSorter::NbEntities () const
- { return themap.Extent(); }
-
-// ..... Attention .....
-
- void IGESSelect_ViewSorter::SortSingleViews
- (const Standard_Boolean alsoframes)
-{
-// Du tas initial, on ecarte : les vues nulles, et selon alsoframe les drawings
-// Vues nulles : cf theremain (remain initial reconduit)
-
-// Remarque : le filtre IsSingle a ete applique par Add
- thefinals.Clear();
- Standard_Integer nb = theinditem.Length();
- //Standard_Integer numit = 0; //szv#4:S4163:12Mar99 not needed
- for (Standard_Integer i = 1; i <= nb; i ++) {
- Standard_Integer numitem = theinditem.Value(i);
- Standard_Integer finalindex = 0; // 0 sera pour remain
- if (numitem > 0) {
- //numit = numitem; //szv#4:S4163:12Mar99 not needed
- DeclareAndCast(IGESData_IGESEntity,item,theitems.FindKey(numitem));
- Standard_Boolean ok = Standard_False;
- if (alsoframes) ok = (item->TypeNumber() == PourDrawing);
- if (!ok) {
- DeclareAndCast(IGESData_ViewKindEntity,view,item);
- if (!view.IsNull()) ok = view->IsSingle();
- }
- if (ok) {
- finalindex = thefinals.FindIndex(item);
- if (finalindex <= 0) finalindex = thefinals.Add(item);
- }
- }
- theindfin.SetValue(i,finalindex);
- }
-}
-
-
- void IGESSelect_ViewSorter::SortDrawings (const Interface_Graph& G)
-{
-// Pour chaque item (vue ou drawing), drawing contenant, silya (sinon tant pis)
-
- thefinals.Clear();
- Standard_Integer nb = theinditem.Length();
- //Standard_Integer numit = 0; //szv#4:S4163:12Mar99 not needed
- for (Standard_Integer i = 1; i <= nb; i ++) {
- Standard_Integer numitem = theinditem.Value(i);
- Standard_Integer finalindex = 0; // 0 sera pour remain
- if (numitem > 0) {
- //numit = numitem; //szv#4:S4163:12Mar99 not needed
- DeclareAndCast(IGESData_IGESEntity,item,theitems.FindKey(numitem));
- if (item.IsNull()) continue;
-// Si cest un Drawing, il definit le Set. Sinon, chercher Drawing contenant
- Handle(Standard_Transient) drawing;
- if (item->TypeNumber() == PourDrawing) drawing = item;
- else {
- Interface_EntityIterator list = G.Sharings(item);
- for (list.Start(); list.More(); list.Next()) {
- DeclareAndCast(IGESData_IGESEntity,draw,list.Value());
- if (draw.IsNull()) continue;
- if (draw->TypeNumber() == PourDrawing) drawing = draw;
- }
- }
- if (!drawing.IsNull()) {
- finalindex = thefinals.FindIndex(drawing);
- if (finalindex <= 0) finalindex = thefinals.Add(drawing);
- }
- }
- theindfin.SetValue(i,finalindex);
- }
-}
-
-// .... Queries ....
-
- Standard_Integer IGESSelect_ViewSorter::NbSets
- (const Standard_Boolean final) const
-{
- if (final) return thefinals.Extent();
- else return theitems.Extent();
-}
-
- Handle(IGESData_IGESEntity) IGESSelect_ViewSorter::SetItem
- (const Standard_Integer num, const Standard_Boolean final) const
-{
- if (final) return GetCasted(IGESData_IGESEntity,thefinals.FindKey(num));
- else return GetCasted(IGESData_IGESEntity,theitems.FindKey(num));
-}
-
- Handle(IFSelect_PacketList) IGESSelect_ViewSorter::Sets
- (const Standard_Boolean final) const
-{
- Handle(IFSelect_PacketList) list = new IFSelect_PacketList(themodel);
- Standard_Integer i, nb;
- nb = (final ? theindfin.Length() : theinditem.Length());
- Standard_Integer nbs = NbSets(final);
- for (Standard_Integer num = 1; num <= nbs; num ++) {
- list->AddPacket();
- if (final) {
-// Attention a l unicite
- for (i = 1; i <= nb; i ++) {
- if (theindfin.Value(i) != num) continue;
- list->Add (themap.FindKey(i));
- }
- } else {
- for (i = 1; i <= nb; i ++) {
- if (theinditem.Value(i) != num) continue;
- list->Add (themap.FindKey(i));
- }
- }
- }
- return list;
-}
+++ /dev/null
-// Created on: 1994-05-31
-// 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 _IGESSelect_ViewSorter_HeaderFile
-#define _IGESSelect_ViewSorter_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TColStd_IndexedMapOfTransient.hxx>
-#include <TColStd_SequenceOfInteger.hxx>
-#include <MMgt_TShared.hxx>
-#include <Standard_Boolean.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <Standard_Integer.hxx>
-class IGESData_IGESModel;
-class Standard_Transient;
-class IGESData_IGESEntity;
-class Interface_InterfaceModel;
-class Interface_Graph;
-class IFSelect_PacketList;
-
-
-class IGESSelect_ViewSorter;
-DEFINE_STANDARD_HANDLE(IGESSelect_ViewSorter, MMgt_TShared)
-
-//! Sorts IGES Entities on the views and drawings.
-//! In a first step, it splits a set of entities according the
-//! different views they are attached to.
-//! Then, packets according single views (+ drawing frames), or
-//! according drawings (which refer to the views) can be determined
-//!
-//! It is a TShared, hence it can be a workomg field of a non-
-//! mutable object (a Dispatch for instance)
-class IGESSelect_ViewSorter : public MMgt_TShared
-{
-
-public:
-
-
- //! Creates a ViewSorter, empty. SetModel remains to be called
- Standard_EXPORT IGESSelect_ViewSorter();
-
- //! Sets the Model (for PacketList)
- Standard_EXPORT void SetModel (const Handle(IGESData_IGESModel)& model);
-
- //! Clears recorded data
- Standard_EXPORT void Clear();
-
- //! Adds an item according its type : AddEntity,AddList,AddModel
- Standard_EXPORT Standard_Boolean Add (const Handle(Standard_Transient)& ent);
-
- //! Adds an IGES entity. Records the view it is attached to.
- //! Records directly <ent> if it is a ViewKindEntity or a Drawing
- //! Returns True if added, False if already in the map
- Standard_EXPORT Standard_Boolean AddEntity (const Handle(IGESData_IGESEntity)& igesent);
-
- //! Adds a list of entities by adding each of the items
- Standard_EXPORT void AddList (const Handle(TColStd_HSequenceOfTransient)& list);
-
- //! Adds all the entities contained in a Model
- Standard_EXPORT void AddModel (const Handle(Interface_InterfaceModel)& model);
-
- //! Returns the count of already recorded
- Standard_EXPORT Standard_Integer NbEntities() const;
-
- //! Prepares the result to keep only sets attached to Single Views
- //! If <alsoframes> is given True, it keeps also the Drawings as
- //! specific sets, in order to get their frames.
- //! Entities attached to no single view are put in Remaining List.
- //!
- //! Result can then be read by the methods NbSets,SetItem,SetList,
- //! RemainingList(final = True)
- Standard_EXPORT void SortSingleViews (const Standard_Boolean alsoframes);
-
- //! Prepares the result to the sets attached to Drawings :
- //! All the single views referenced by a Drawing become bound to
- //! the set for this Drawing
- //!
- //! Entities or Views which correspond to no Drawing are put into
- //! the Remaining List.
- //!
- //! Result can then be read by the methods NbSets,SetItem,SetList,
- //! RemainingList(final = True)
- Standard_EXPORT void SortDrawings (const Interface_Graph& G);
-
- //! Returns the count of sets recorded, one per distinct item.
- //! The Remaining List is not counted.
- //! If <final> is False, the sets are attached to distinct views
- //! determined by the method Add.
- //! If <final> is True, they are the sets determined by the last
- //! call to, either SortSingleViews, or SortDrawings.
- //!
- //! Warning : Drawings directly recorded are also counted as sets, because
- //! of their Frame (which is made of Annotations)
- Standard_EXPORT Standard_Integer NbSets (const Standard_Boolean final) const;
-
- //! Returns the Item which is attached to a set of entities
- //! For <final> and definition of sets, see method NbSets.
- //! This item can be a kind of View or a Drawing
- Standard_EXPORT Handle(IGESData_IGESEntity) SetItem (const Standard_Integer num, const Standard_Boolean final) const;
-
- //! Returns the complete content of the determined Sets, which
- //! include Duplicated and Remaining (duplication 0) lists
- //! For <final> and definition of sets, see method NbSets.
- Standard_EXPORT Handle(IFSelect_PacketList) Sets (const Standard_Boolean final) const;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_ViewSorter,MMgt_TShared)
-
-protected:
-
-
-
-
-private:
-
-
- Handle(IGESData_IGESModel) themodel;
- TColStd_IndexedMapOfTransient themap;
- TColStd_IndexedMapOfTransient theitems;
- TColStd_IndexedMapOfTransient thefinals;
- TColStd_SequenceOfInteger theinditem;
- TColStd_SequenceOfInteger theindfin;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_ViewSorter_HeaderFile
Standard_Boolean IGESToBRep_Actor::Recognize (const Handle(Standard_Transient)& start)
{
- DeclareAndCast(IGESData_IGESModel,mymodel,themodel);
DeclareAndCast(IGESData_IGESEntity,ent,start);
if (ent.IsNull()) return Standard_False;
// Cas reconnus
- Standard_Integer typnum = ent->TypeNumber();
- Standard_Integer fornum = ent->FormNumber();
+ const Standard_Integer typnum = ent->TypeNumber();
+ const Standard_Integer fornum = ent->FormNumber();
if (IGESToBRep::IsCurveAndSurface(ent) ||
((typnum == 402 && (fornum == 1 || fornum == 7 ||
fornum == 14 || fornum == 15)) ||
return Standard_False;
}
-//=======================================================================
-//function : EncodeRegul
-//purpose : INTERNAL to encode regularity on edges
-//=======================================================================
-
-static Standard_Boolean EncodeRegul (const TopoDS_Shape& sh)
-{
- Standard_Real tolang = Interface_Static::RVal("read.encoderegularity.angle");
- if (sh.IsNull()) return Standard_True;
- if (tolang <= 0) return Standard_True;
- try {
- OCC_CATCH_SIGNALS
- BRepLib::EncodeRegularity (sh,tolang);
- }
- catch(Standard_Failure) {
- return Standard_False;
- }
- return Standard_True;
-}
-
-//=======================================================================
-//function : TrimTolerances
-//purpose : Trims tolerances of the shape according to static parameters
-//
-//=======================================================================
-
-static void TrimTolerances (const TopoDS_Shape& shape, const Standard_Real tol)
-{
- if( Interface_Static::IVal("read.maxprecision.mode")==1) {
- ShapeFix_ShapeTolerance SFST;
- SFST.LimitTolerance (shape, 0, Max(tol,Interface_Static::RVal ("read.maxprecision.val")));
- }
-}
-
//=======================================================================
//function : Transferring
//purpose :
ShapeExtend_Explorer SBE;
if (SBE.ShapeType(shape,Standard_True) != TopAbs_SHAPE) {
if (!shape.IsNull()) {
- EncodeRegul (shape);
- TrimTolerances (shape, UsedTolerance());
+ // Encode regularity on edges
+ const Standard_Real tolang = Interface_Static::RVal("read.encoderegularity.angle");
+ if (tolang > 0.)
+ {
+ try {
+ OCC_CATCH_SIGNALS
+ BRepLib::EncodeRegularity (shape,tolang);
+ }
+ catch(Standard_Failure) {}
+ }
+ // Trim tolerances of the shape according to static parameters
+ if( Interface_Static::IVal("read.maxprecision.mode")==1) {
+ ShapeFix_ShapeTolerance SFST;
+ SFST.LimitTolerance (shape, 0, Max(theeps,Interface_Static::RVal ("read.maxprecision.val")));
+ }
}
}
return Standard_True;
}
-//=======================================================================
-//function : UsedTolerance
-//purpose : Returns the used tolerance (input)
-//=======================================================================
-
-Standard_Real IGESToBRep_Reader::UsedTolerance () const
-{ return theActor->UsedTolerance(); }
-
//=======================================================================
//function : Shape
//purpose : Returns a Shape given its rank
//! Returns True if the LAST Transfer/TransferRoots was a success
Standard_Boolean IsDone() const { return theDone; }
-
- //! Returns the Tolerance which has been actually used, converted
- //! in millimeters
- //! (either that from File or that from Session, according the mode)
- Standard_EXPORT Standard_Real UsedTolerance() const;
//! Returns the number of shapes produced by the translation.
Standard_Integer NbShapes() const { return theShapes.Length(); }
Interface_Recognizer.gxx
Interface_ReportEntity.cxx
Interface_ReportEntity.hxx
+Interface_ReturnStatus.hxx
Interface_SequenceOfCheck.hxx
Interface_ShareFlags.cxx
Interface_ShareFlags.hxx
Standard_Integer Interface_EntityIterator::NbEntities () const
{
- return thelist.IsNull()? 0 : thelist->Length();
+ if (thelist.IsNull()) return 0;
+ if (thecurr == 0) Start();
+ return thelist->Length();
}
Standard_Integer Interface_EntityIterator::NbTyped (const Handle(Standard_Type)& atype) const
--- /dev/null
+// 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 _Interface_ReturnStatus_HeaderFile
+#define _Interface_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 Interface_ReturnStatus
+{
+Interface_RetVoid,
+Interface_RetDone,
+Interface_RetError,
+Interface_RetFail,
+Interface_RetStop
+};
+
+#endif // _Interface_ReturnStatus_HeaderFile
;# Liste des toolkits WOK sous forme de full path
;#
proc DataExchange:toolkits { } {
- return [list TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES \
+ return [list TKXSBase TKXSSelect TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES \
TKXCAF TKXDEIGES TKXDESTEP \
TKSTL TKVRML TKXmlXCAF TKBinXCAF]
}
#include <STEPCAFControl_Writer.hxx>
#include <STEPControl_StepModelType.hxx>
#include <Interface_Static.hxx>
-#include <IFSelect_ReturnStatus.hxx>
+#include <Interface_ReturnStatus.hxx>
#include <Standard_Failure.hxx>
#include <TColgp_HArray1OfPnt2d.hxx>
#include <Geom2dAPI_Interpolate.hxx>
return 0;
}
+#include <TColStd_HSequenceOfTransient.hxx>
+#include <Message_ProgressSentry.hxx>
#include <Interface_Macros.hxx>
-#include <IGESControl_Controller.hxx>
-#include <XSDRAW.hxx>
#include <Draw_ProgressIndicator.hxx>
-#include <XSControl_WorkSession.hxx>
#include <Transfer_TransientProcess.hxx>
+#include <IFSelect_WorkSession.hxx>
+#include <XSDRAW.hxx>
#include <XSDRAW_Commands.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <Message_ProgressSentry.hxx>
-#include <XSControl_TransferReader.hxx>
+#include <IGESControl_Controller.hxx>
static Standard_Integer OCC18612igesbrep (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
progress->SetScale ( 0, 100, 1 );
progress->Show();
-
- IGESControl_Reader Reader (XSDRAW::Session(),Standard_False);
+
+ const Handle(IFSelect_WorkSession) &WS = XSDRAW::Session();
+
+ IGESControl_Reader Reader (WS,Standard_False);
if (ctl.IsNull())
ctl=Handle(IGESControl_Controller)::DownCast(XSDRAW::Controller());
if (modfic) di<<" File IGES to read : "<<fnom.ToCString()<<"\n";
else di<<" Model taken from the session : "<<fnom.ToCString()<<"\n";
di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom.ToCString()<<"\n";
- IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
+ Interface_ReturnStatus readstat = Interface_RetVoid;
#ifdef CHRONOMESURE
OSD_Timer Chr; Chr.Reset();
// *New*
if (modfic) readstat = Reader.ReadFile (fnom.ToCString());
- else if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
+ else if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = Interface_RetDone;
progress->EndScope();
progress->Show();
- if (readstat != IFSelect_RetDone) {
+ if (readstat != Interface_RetDone) {
if (modfic) di<<"Could not read file "<<fnom.ToCString()<<" , abandon\n";
else di<<"No model loaded\n";
return 1;
di << "All Geometry Transfer\n";
di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)\n";
di<<" To modify : command param read.iges.bspline.continuity\n";
- Handle(XSControl_WorkSession) thesession = Reader.WS();
- thesession->TransferReader()->Context().Nullify();
- XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
+ XSDRAW::SetTransferProcess (WS->ReaderProcess());
progress->NewScope ( 80, "Translation" );
progress->Show();
- thesession->TransferReader()->TransientProcess()->SetProgress ( progress );
+ WS->ReaderProcess()->SetProgress ( progress );
if (modepri == 1) Reader.SetReadVisible (Standard_True);
Reader.TransferRoots();
- thesession->TransferReader()->TransientProcess()->SetProgress ( 0 );
+ WS->ReaderProcess()->SetProgress ( 0 );
progress->EndScope();
progress->Show();
// result in only one shape for all the roots
cout << " give the number of the Entity : " << flush;
nent = XSDRAW::GetEntityNumber();
- if (!Reader.TransferOne (nent)) di<<"Transfer entity n0 "<<nent<<" : no result\n";
+ if (!Reader.TransferEntity (WS->StartingEntity(nent))) di<<"Transfer entity n0 "<<nent<<" : no result\n";
else {
nbs = Reader.NbShapes();
char shname[30]; Sprintf (shname,"%s_%d",rnom.ToCString(),nent);
di << "All Geometry Transfer\n";
di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)\n";
di<<" To modify : command param read.iges.bspline.continuity\n";
- Handle(XSControl_WorkSession) thesession = Reader.WS();
- thesession->TransferReader()->Context().Nullify();
- XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
+ XSDRAW::SetTransferProcess (WS->ReaderProcess());
progress->NewScope ( 80, "Translation" );
progress->Show();
- thesession->TransferReader()->TransientProcess()->SetProgress ( progress );
+ WS->ReaderProcess()->SetProgress ( progress );
Reader.SetReadVisible (Standard_True);
Reader.TransferRoots();
- thesession->TransferReader()->TransientProcess()->SetProgress ( 0 );
+ WS->ReaderProcess()->SetProgress ( 0 );
progress->EndScope();
progress->Show();
}
if (answer == 1 || answer == 2) {
Standard_Integer nbt = 0;
- Handle(XSControl_WorkSession) thesession = Reader.WS();
- XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
+ XSDRAW::SetTransferProcess (WS->ReaderProcess());
progress->NewScope ( 80, "Translation" );
progress->Show();
- thesession->TransferReader()->TransientProcess()->SetProgress ( progress );
+ WS->ReaderProcess()->SetProgress ( progress );
Message_ProgressSentry PSentry ( progress, "Root", 0, nbl, 1 );
for (Standard_Integer ill = 1; ill <= nbl && PSentry.More(); ill ++, PSentry.Next()) {
nent = Reader.Model()->Number(list->Value(ill));
if (nent == 0) continue;
- if (!Reader.TransferOne(nent)) di<<"Transfer entity n0 "<<nent<<" : no result\n";
+ if (!Reader.TransferEntity (WS->StartingEntity(nent))) di<<"Transfer entity n0 "<<nent<<" : no result\n";
else {
nbs = Reader.NbShapes();
char shname[30]; Sprintf (shname,"%s_%d",rnom.ToCString(),nbs);
nbt++;
}
}
- thesession->TransferReader()->TransientProcess()->SetProgress ( 0 );
+ WS->ReaderProcess()->SetProgress ( 0 );
progress->EndScope();
progress->Show();
di<<"Nb Shapes successfully produced : "<<nbt<<"\n";
// *New*
//In order to clear memory after IGES reading you could add the following code
- const Handle(XSControl_TransferReader) &TR = Reader.WS()->TransferReader();
- const Handle(Transfer_TransientProcess) &TP = TR->TransientProcess();
- TP->Clear();
- TR->Clear(2);
- Reader.WS()->Model()->Clear();
+ WS->ReaderProcess()->Clear();
+ WS->Model()->Clear();
Standard_Integer i =1;
- for( ; i <= 7; i++)
- Reader.WS()->ClearData(i);
+ for( ; i <= 6; i++)
+ WS->ClearData(i);
// *New*
return 0;
// commercial license or contractual agreement.
+#include <Standard_Mutex.hxx>
#include <Interface_Static.hxx>
#include <STEPCAFControl_ActorWrite.hxx>
#include <STEPCAFControl_Controller.hxx>
-#include <XSAlgo.hxx>
IMPLEMENT_STANDARD_RTTIEXT(STEPCAFControl_Controller,STEPControl_Controller)
//=======================================================================
-//function : STEPCAFControl_Controller
+//function : NewActorWrite
//purpose :
//=======================================================================
-STEPCAFControl_Controller::STEPCAFControl_Controller ()
+Handle(Transfer_ActorOfFinderProcess) STEPCAFControl_Controller::NewActorWrite() const
{
- myAdaptorWrite = new STEPCAFControl_ActorWrite;
+ return new STEPCAFControl_ActorWrite;
}
//=======================================================================
void STEPCAFControl_Controller::Init ()
{
- static Standard_Boolean inic = Standard_False;
- if (inic) return;
- inic = Standard_True;
- // self-registering
- Handle(STEPCAFControl_Controller) STEPCTL = new STEPCAFControl_Controller;
- // do XSAlgo::Init, cause it does not called before.
- XSAlgo::Init();
- // do something to avoid warnings...
- STEPCTL->AutoRecord();
+ static Standard_Mutex gInitMutex;
+ static volatile bool gInitDone = false;
+ if (!gInitDone)
+ {
+ gInitMutex.Lock();
+ if (!gInitDone)
+ {
+ STEPControl_Controller::Init();
- //-----------------------------------------------------------
- // Few variables for advanced control of translation process
- //-----------------------------------------------------------
+ //-----------------------------------------------------------
+ // Few variables for advanced control of translation process
+ //-----------------------------------------------------------
- // Indicates whether to write sub-shape names to 'Name' attributes of
- // STEP Representation Items
- Interface_Static::Init ("stepcaf", "write.stepcaf.subshapes.name", 'e', "");
- Interface_Static::Init ("stepcaf", "write.stepcaf.subshapes.name", '&', "enum 0");
- Interface_Static::Init ("stepcaf", "write.stepcaf.subshapes.name", '&', "eval Off"); // 0
- Interface_Static::Init ("stepcaf", "write.stepcaf.subshapes.name", '&', "eval On"); // 1
- Interface_Static::SetIVal("write.stepcaf.subshapes.name", 0); // Disabled by default
+ // Indicates whether to write sub-shape names to 'Name' attributes of
+ // STEP Representation Items
+ Interface_Static::Init ("stepcaf", "write.stepcaf.subshapes.name", 'e', "");
+ Interface_Static::Init ("stepcaf", "write.stepcaf.subshapes.name", '&', "enum 0");
+ Interface_Static::Init ("stepcaf", "write.stepcaf.subshapes.name", '&', "eval Off"); // 0
+ Interface_Static::Init ("stepcaf", "write.stepcaf.subshapes.name", '&', "eval On"); // 1
+ Interface_Static::SetIVal("write.stepcaf.subshapes.name", 0); // Disabled by default
- // Indicates whether to read sub-shape names from 'Name' attributes of
- // STEP Representation Items
- Interface_Static::Init ("stepcaf", "read.stepcaf.subshapes.name", 'e', "");
- Interface_Static::Init ("stepcaf", "read.stepcaf.subshapes.name", '&', "enum 0");
- Interface_Static::Init ("stepcaf", "read.stepcaf.subshapes.name", '&', "eval Off"); // 0
- Interface_Static::Init ("stepcaf", "read.stepcaf.subshapes.name", '&', "eval On"); // 1
- Interface_Static::SetIVal("read.stepcaf.subshapes.name", 0); // Disabled by default
+ // Indicates whether to read sub-shape names from 'Name' attributes of
+ // STEP Representation Items
+ Interface_Static::Init ("stepcaf", "read.stepcaf.subshapes.name", 'e', "");
+ Interface_Static::Init ("stepcaf", "read.stepcaf.subshapes.name", '&', "enum 0");
+ Interface_Static::Init ("stepcaf", "read.stepcaf.subshapes.name", '&', "eval Off"); // 0
+ Interface_Static::Init ("stepcaf", "read.stepcaf.subshapes.name", '&', "eval On"); // 1
+ Interface_Static::SetIVal("read.stepcaf.subshapes.name", 0); // Disabled by default
+
+ Handle(STEPCAFControl_Controller) aController = new STEPCAFControl_Controller;
+ aController->AutoRecord();
+
+ gInitDone = true;
+ }
+ gInitMutex.Unlock();
+ }
}
#ifndef _STEPCAFControl_Controller_HeaderFile
#define _STEPCAFControl_Controller_HeaderFile
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
#include <STEPControl_Controller.hxx>
-
-class STEPCAFControl_Controller;
-DEFINE_STANDARD_HANDLE(STEPCAFControl_Controller, STEPControl_Controller)
-
//! Extends Controller from STEPControl in order to provide
//! ActorWrite adapted for writing assemblies from DECAF
//! Note that ActorRead from STEPControl is used for reading
class STEPCAFControl_Controller : public STEPControl_Controller
{
public:
+
+ //! Returns the Actor for Write attached to the pair (norm,appli)
+ Standard_EXPORT virtual Handle(Transfer_ActorOfFinderProcess) NewActorWrite() const Standard_OVERRIDE;
//! Standard Initialisation. It creates a Controller for STEP-XCAF
//! and records it to various names, available to select it later
protected:
//! Initializes the use of STEP Norm (the first time)
- Standard_EXPORT STEPCAFControl_Controller();
+ STEPCAFControl_Controller() {}
};
#endif // _STEPCAFControl_Controller_HeaderFile
//purpose :
//=======================================================================
STEPCAFControl_ExternFile::STEPCAFControl_ExternFile ()
- : myLoadStatus(IFSelect_RetVoid), myTransferStatus(Standard_False),
- myWriteStatus(IFSelect_RetVoid)
+ : myLoadStatus(Interface_RetVoid), myTransferStatus(Standard_False),
+ myWriteStatus(Interface_RetVoid)
{
}
#include <Standard.hxx>
#include <Standard_Type.hxx>
-#include <IFSelect_ReturnStatus.hxx>
+#include <Interface_ReturnStatus.hxx>
#include <Standard_Boolean.hxx>
#include <TDF_Label.hxx>
#include <MMgt_TShared.hxx>
Handle(XSControl_WorkSession) GetWS() const;
- void SetLoadStatus (const IFSelect_ReturnStatus stat);
+ void SetLoadStatus (const Interface_ReturnStatus stat);
- IFSelect_ReturnStatus GetLoadStatus() const;
+ Interface_ReturnStatus GetLoadStatus() const;
void SetTransferStatus (const Standard_Boolean isok);
Standard_Boolean GetTransferStatus() const;
- void SetWriteStatus (const IFSelect_ReturnStatus stat);
+ void SetWriteStatus (const Interface_ReturnStatus stat);
- IFSelect_ReturnStatus GetWriteStatus() const;
+ Interface_ReturnStatus GetWriteStatus() const;
void SetName (const Handle(TCollection_HAsciiString)& name);
Handle(XSControl_WorkSession) myWS;
- IFSelect_ReturnStatus myLoadStatus;
+ Interface_ReturnStatus myLoadStatus;
Standard_Boolean myTransferStatus;
- IFSelect_ReturnStatus myWriteStatus;
+ Interface_ReturnStatus myWriteStatus;
Handle(TCollection_HAsciiString) myName;
TDF_Label myLabel;
//purpose :
//=======================================================================
-inline void STEPCAFControl_ExternFile::SetLoadStatus (const IFSelect_ReturnStatus stat)
+inline void STEPCAFControl_ExternFile::SetLoadStatus (const Interface_ReturnStatus stat)
{
myLoadStatus = stat;
}
//purpose :
//=======================================================================
-inline IFSelect_ReturnStatus STEPCAFControl_ExternFile::GetLoadStatus () const
+inline Interface_ReturnStatus STEPCAFControl_ExternFile::GetLoadStatus () const
{
return myLoadStatus;
}
//purpose :
//=======================================================================
-inline void STEPCAFControl_ExternFile::SetWriteStatus (const IFSelect_ReturnStatus stat)
+inline void STEPCAFControl_ExternFile::SetWriteStatus (const Interface_ReturnStatus stat)
{
myWriteStatus = stat;
}
//purpose :
//=======================================================================
-inline IFSelect_ReturnStatus STEPCAFControl_ExternFile::GetWriteStatus () const
+inline Interface_ReturnStatus STEPCAFControl_ExternFile::GetWriteStatus () const
{
return myWriteStatus;
}
#include <XCAFDimTolObjects_DimensionObject.hxx>
#include <XCAFDimTolObjects_GeomToleranceObject.hxx>
#include <XCAFDimTolObjects_DatumObject.hxx>
-#include <XSControl_TransferReader.hxx>
#include <XSControl_WorkSession.hxx>
#include <StepAP242_DraughtingModelItemAssociation.hxx>
#include <StepAP242_GeometricItemSpecificUsage.hxx>
//purpose :
//=======================================================================
-IFSelect_ReturnStatus STEPCAFControl_Reader::ReadFile (const Standard_CString filename)
+Interface_ReturnStatus STEPCAFControl_Reader::ReadFile (const Standard_CString filename)
{
return myReader.ReadFile ( filename );
}
Standard_Boolean STEPCAFControl_Reader::Perform (const Standard_CString filename,
Handle(TDocStd_Document) &doc)
{
- if ( ReadFile ( filename ) != IFSelect_RetDone ) return Standard_False;
+ if ( ReadFile ( filename ) != Interface_RetDone ) return Standard_False;
return Transfer ( doc );
}
Standard_Boolean STEPCAFControl_Reader::Perform (const TCollection_AsciiString &filename,
Handle(TDocStd_Document) &doc)
{
- if ( ReadFile ( filename.ToCString() ) != IFSelect_RetDone ) return Standard_False;
+ if ( ReadFile ( filename.ToCString() ) != Interface_RetDone ) return Standard_False;
return Transfer ( doc );
}
STEPCAFControl_DataMapOfShapePD ShapePDMap;
STEPCAFControl_DataMapOfPDExternFile PDFileMap;
Handle(Interface_InterfaceModel) Model = reader.Model();
- const Handle(Transfer_TransientProcess) &TP = reader.WS()->TransferReader()->TransientProcess();
+ const Handle(Transfer_TransientProcess) &TP = reader.WS()->ReaderProcess();
Standard_Integer nb = Model->NbEntities();
Handle(TColStd_HSequenceOfTransient) SeqPDS = new TColStd_HSequenceOfTransient;
// create new WorkSession and Reader
Handle(XSControl_WorkSession) newWS = new XSControl_WorkSession;
- newWS->SelectNorm ( "STEP" );
+ newWS->SelectNorm("STEP");
STEPControl_Reader sr ( newWS, Standard_False );
// start to fill the resulting ExternFile structure
EF->SetLoadStatus ( sr.ReadFile ( fullname ) );
// transfer in single-result mode
- if ( EF->GetLoadStatus() == IFSelect_RetDone ) {
+ if ( EF->GetLoadStatus() == Interface_RetDone ) {
TDF_LabelSequence labels;
EF->SetTransferStatus ( Transfer ( sr, 0, doc, labels, Standard_True ) );
if ( labels.Length() >0 ) EF->SetLabel ( labels.Value(1) );
{
// get starting data
const Handle(Interface_InterfaceModel) &Model = WS->Model();
- const Handle(XSControl_TransferReader) &TR = WS->TransferReader();
- const Handle(Transfer_TransientProcess) &TP = TR->TransientProcess();
+ const Handle(Transfer_TransientProcess) &TP = WS->ReaderProcess();
Handle(XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool( Doc->Main() );
if ( STool.IsNull() ) return Standard_False;
STEPConstruct_Tool Tool ( WS );
const XCAFDoc_DataMapOfShapeLabel &ShapeLabelMap) const
{
// get starting data
- const Handle(XSControl_TransferReader) &TR = WS->TransferReader();
- const Handle(Transfer_TransientProcess) &TP = TR->TransientProcess();
+ const Handle(Transfer_TransientProcess) &TP = WS->ReaderProcess();
Handle(XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool( Doc->Main() );
if ( STool.IsNull() ) return Standard_False;
Handle(TDocStd_Document)& Doc) const
{
const Handle(Interface_InterfaceModel) &Model = WS->Model();
- const Handle(XSControl_TransferReader) &TR = WS->TransferReader();
- const Handle(Transfer_TransientProcess) &TP = TR->TransientProcess();
+ const Handle(Transfer_TransientProcess) &TP = WS->ReaderProcess();
Handle(XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool( Doc->Main() );
if ( STool.IsNull() ) return Standard_False;
Handle(XCAFDoc_LayerTool) LTool = XCAFDoc_DocumentTool::LayerTool( Doc->Main() );
Handle(StepRepr_NextAssemblyUsageOccurrence) NUNAUO = subSHUO->NextUsage();
if (NUNAUO.IsNull())
return Standard_False;
-// Handle(Interface_InterfaceModel) Model = WS->Model();
-// Handle(XSControl_TransferReader) TR = WS->TransferReader();
-// Handle(Transfer_TransientProcess) TP = TR->TransientProcess();
-// Handle(Transfer_Binder) binder = TP->Find(NUNAUO);
-// if ( binder.IsNull() || ! binder->HasResult() )
-// return Standard_False;
-// TopoDS_Shape NUSh = TransferBRep::ShapeResult ( TP, binder );
// get label of NAUO next level
TDF_Label NULab;
STEPConstruct_Tool Tool( WS );
#endif
return aMainLabel;
}
-// Handle(Interface_InterfaceModel) Model = WS->Model();
-// Handle(XSControl_TransferReader) TR = WS->TransferReader();
-// Handle(Transfer_TransientProcess) TP = TR->TransientProcess();
-// TopoDS_Shape UUSh, NUSh;
-// Handle(Transfer_Binder) binder = TP->Find(UUNAUO);
-// if ( binder.IsNull() || ! binder->HasResult() )
-// return aMainLabel;
-// UUSh = TransferBRep::ShapeResult ( TP, binder );
-// binder = TP->Find(NUNAUO);
-// if ( binder.IsNull() || ! binder->HasResult() )
-// return aMainLabel;
-// NUSh = TransferBRep::ShapeResult ( TP, binder );
// get first labels for first SHUO attribute
TDF_Label UULab, NULab;
//purpose : read annotation plane and position for given GDT
// (Dimension, Geometric_Tolerance, Datum_Feature or Placed_Datum_Target_Feature)
//=======================================================================
-void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
+void readAnnotation(const Handle(Transfer_TransientProcess)& theTP,
const Handle(Standard_Transient) theGDT,
const Handle(Standard_Transient)& theDimObject)
{
Handle(TCollection_HAsciiString) aPresentName;
TopoDS_Compound aResAnnotation;
- Handle(Transfer_TransientProcess) aTP = theTR->TransientProcess();
- const Interface_Graph& aGraph = aTP->HGraph()->Graph();
+ const Interface_Graph& aGraph = theTP->HGraph()->Graph();
// find the proper DraughtingModelItemAssociation
Interface_EntityIterator subs = aGraph.Sharings(theGDT);
Handle(StepAP242_DraughtingModelItemAssociation) aDMIA;
if(!anACO.IsNull())
{
Handle(StepRepr_RepresentationItem) aCurveItem = anACO->Item();
- anAnnotationShape = STEPConstruct::FindShape (aTP,aCurveItem);
+ anAnnotationShape = STEPConstruct::FindShape (theTP,aCurveItem);
if( anAnnotationShape.IsNull())
{
- Handle(Transfer_Binder) binder = theTR->Actor()->Transferring(aCurveItem, aTP);
+ Handle(Transfer_Binder) binder = theTP->GetActor()->Transferring(aCurveItem, theTP);
if ( ! binder.IsNull() && binder->HasResult() ) {
- anAnnotationShape = TransferBRep::ShapeResult ( aTP, binder );
+ anAnnotationShape = TransferBRep::ShapeResult ( theTP, binder );
}
}
}
//function : readConnectionPoints
//purpose : read connection points for given dimension
//=======================================================================
-void readConnectionPoints(const Handle(XSControl_TransferReader)& theTR,
+void readConnectionPoints(const Handle(Transfer_TransientProcess)& theTP,
const Handle(Standard_Transient) theGDT,
const Handle(XCAFDimTolObjects_DimensionObject)& theDimObject)
{
- Handle(Transfer_TransientProcess) aTP = theTR->TransientProcess();
- const Interface_Graph& aGraph = aTP->HGraph()->Graph();
+ const Interface_Graph& aGraph = theTP->HGraph()->Graph();
//calculate units
Standard_Real aFact = 1;
{
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool( theDoc->Main() );
Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool( theDoc->Main() );
- const Handle(XSControl_TransferReader) &aTR = theWS->TransferReader();
- const Handle(Transfer_TransientProcess) &aTP = aTR->TransientProcess();
+ const Handle(Transfer_TransientProcess) &aTP = theWS->ReaderProcess();
const Interface_Graph& aGraph = aTP->HGraph()->Graph();
Handle(XCAFDoc_Datum) aDat;
TDF_Label aShL;
aDGTTool->SetDatumToGeomTol(aDatL, theGDTL);
}
if(!aDatObj.IsNull()) {
- readAnnotation(aTR, aSAR->RelatingShapeAspect(), aDatObj);
+ readAnnotation(aTP, aSAR->RelatingShapeAspect(), aDatObj);
aDat->SetObject(aDatObj);
}
}
{
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool( theDoc->Main() );
Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool( theDoc->Main() );
- const Handle(XSControl_TransferReader) &aTR = theWS->TransferReader();
- const Handle(Transfer_TransientProcess) &aTP = aTR->TransientProcess();
+ const Handle(Transfer_TransientProcess) &aTP = theWS->ReaderProcess();
const Interface_Graph& aGraph = aTP->HGraph()->Graph();
Interface_EntityIterator anIter = aGraph.Shareds(theEnt);
const Handle(XSControl_WorkSession)& theWS,
NCollection_Sequence<Handle(StepRepr_ShapeAspect)>& theSAs)
{
- Handle(XSControl_TransferReader) aTR = theWS->TransferReader();
- Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess();
+ const Handle(Transfer_TransientProcess) &aTP = theWS->ReaderProcess();
const Interface_Graph& aGraph = aTP->HGraph()->Graph();
// Retrieve Shape_Aspect, connected to Representation_Item from Derived_Shape_Aspect
if (theSA->IsKind(STANDARD_TYPE(StepRepr_DerivedShapeAspect))) {
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool( theDoc->Main() );
Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool( theDoc->Main() );
- const Handle(XSControl_TransferReader) &aTR = theWS->TransferReader();
- const Handle(Transfer_TransientProcess) &aTP = aTR->TransientProcess();
+ const Handle(Transfer_TransientProcess) &aTP = theWS->ReaderProcess();
const Interface_Graph& aGraph = aTP->HGraph()->Graph();
Standard_Boolean isAllAround = Standard_False;
Standard_Boolean isAllOver = Standard_False;
{
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool( theDoc->Main() );
Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool( theDoc->Main() );
- const Handle(XSControl_TransferReader) &aTR = theWS->TransferReader();
- const Handle(Transfer_TransientProcess) &aTP = aTR->TransientProcess();
+ const Handle(Transfer_TransientProcess) &aTP = theWS->ReaderProcess();
const Interface_Graph& aGraph = aTP->HGraph()->Graph();
Handle(XCAFDimTolObjects_DimensionObject) aDimObj;
if(!theEnt->IsKind(STANDARD_TYPE(StepShape_DimensionalSize)) &&
if(aDimL.FindAttribute(XCAFDoc_Dimension::GetID(),aDim))
{
- readAnnotation(aTR, theEnt, aDimObj);
- readConnectionPoints(aTR, theEnt, aDimObj);
+ readAnnotation(aTP, theEnt, aDimObj);
+ readConnectionPoints(aTP, theEnt, aDimObj);
aDim->SetObject(aDimObj);
}
}
{
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool( theDoc->Main() );
Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool( theDoc->Main() );
- const Handle(XSControl_TransferReader) &aTR = theWS->TransferReader();
- const Handle(Transfer_TransientProcess) &aTP = aTR->TransientProcess();
+ const Handle(Transfer_TransientProcess) &aTP = theWS->ReaderProcess();
const Interface_Graph& aGraph = aTP->HGraph()->Graph();
Handle(XCAFDoc_GeomTolerance) aGTol;
if(!theTolL.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGTol))
aTolObj->SetMaxValueModifier(aVal);
}
- readAnnotation(aTR, theEnt, aTolObj);
+ readAnnotation(aTP, theEnt, aTolObj);
aGTol->SetObject(aTolObj);
}
Handle(TDocStd_Document)& Doc,
const Handle(TColStd_HSequenceOfTransient) &SeqPDS) const
{
- const Handle(XSControl_TransferReader) &TR = WS->TransferReader();
- const Handle(Transfer_TransientProcess) &TP = TR->TransientProcess();
+ const Handle(Transfer_TransientProcess) &TP = WS->ReaderProcess();
Handle(XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool( Doc->Main() );
Handle(XCAFDoc_MaterialTool) MatTool = XCAFDoc_DocumentTool::MaterialTool( Doc->Main() );
if(MatTool.IsNull()) return Standard_False;
const XCAFDoc_DataMapOfShapeLabel& ShapeLabelMap,
const STEPCAFControl_DataMapOfShapePD& ShapePDMap) const
{
- const Handle(Transfer_TransientProcess)& TP = Reader().WS()->TransferReader()->TransientProcess();
+ const Handle(Transfer_TransientProcess)& TP = Reader().WS()->ReaderProcess();
NCollection_DataMap<TopoDS_Shape, Handle(TCollection_HAsciiString)> ShapeNameMap;
TColStd_MapOfTransient aRepItems;
#include <STEPControl_Reader.hxx>
#include <Standard_Boolean.hxx>
-#include <IFSelect_ReturnStatus.hxx>
+#include <Interface_ReturnStatus.hxx>
#include <Standard_CString.hxx>
#include <Standard_Integer.hxx>
#include <TDF_LabelSequence.hxx>
//! Loads a file and returns the read status
//! Provided for use like single-file reader
- Standard_EXPORT IFSelect_ReturnStatus ReadFile (const Standard_CString filename);
+ Standard_EXPORT Interface_ReturnStatus ReadFile (const Standard_CString filename);
//! Returns number of roots recognized for transfer
//! Shortcut for Reader().NbRootsForTransfer()
#include <TopoDS_Shape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
-#include <Transfer_ActorOfFinderProcess.hxx>
#include <Transfer_Binder.hxx>
#include <Transfer_FinderProcess.hxx>
#include <Transfer_TransientListBinder.hxx>
#include <XCAFPrs_DataMapOfShapeStyle.hxx>
#include <XCAFPrs_DataMapOfStyleShape.hxx>
#include <XCAFPrs_Style.hxx>
-#include <XSControl_TransferWriter.hxx>
#include <XSControl_WorkSession.hxx>
static NCollection_Vector<Handle(StepVisual_AnnotationPlane)> gdtAnnotationPlanes;
//purpose :
//=======================================================================
-STEPCAFControl_Writer::STEPCAFControl_Writer () :
- myColorMode( Standard_True ),
- myNameMode ( Standard_True ),
- myLayerMode( Standard_True ),
- myPropsMode( Standard_True ),
- mySHUOMode ( Standard_True ),
- myDGTMode ( Standard_True ),
- myMatMode ( Standard_True )
+STEPCAFControl_Writer::STEPCAFControl_Writer ()
+: myFiles (new STEPCAFControl_DictionaryOfExternFile),
+ myColorMode( Standard_True ),
+ myNameMode ( Standard_True ),
+ myLayerMode( Standard_True ),
+ myPropsMode( Standard_True ),
+ mySHUOMode ( Standard_True ),
+ myDGTMode ( Standard_True ),
+ myMatMode ( Standard_True )
{
STEPCAFControl_Controller::Init();
- Handle(XSControl_WorkSession) WS = new XSControl_WorkSession;
- Init ( WS );
+ //szv_c1: re-select norm to apply the new controller
+ myWriter.WS()->SelectNorm("STEP");
}
//purpose :
//=======================================================================
-STEPCAFControl_Writer::STEPCAFControl_Writer (const Handle(XSControl_WorkSession)& WS,
- const Standard_Boolean scratch)
+STEPCAFControl_Writer::STEPCAFControl_Writer (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch)
+: myWriter (WS, scratch),
+ myFiles (new STEPCAFControl_DictionaryOfExternFile),
+ myColorMode( Standard_True ),
+ myNameMode ( Standard_True ),
+ myLayerMode( Standard_True ),
+ myPropsMode( Standard_True ),
+ mySHUOMode ( Standard_True ),
+ myDGTMode ( Standard_True ),
+ myMatMode ( Standard_True )
{
STEPCAFControl_Controller::Init();
- Init ( WS, scratch );
- myColorMode = Standard_True;
- myNameMode = Standard_True;
- myLayerMode = Standard_True;
- myPropsMode = Standard_True;
- mySHUOMode = Standard_True;
+ //szv_c1: re-select norm to apply the new controller
+ myWriter.WS()->SelectNorm("STEP");
}
//purpose :
//=======================================================================
-void STEPCAFControl_Writer::Init (const Handle(XSControl_WorkSession)& WS,
- const Standard_Boolean scratch)
+void STEPCAFControl_Writer::Init (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch)
{
- WS->SelectNorm ( "STEP" );
myWriter.SetWS (WS,scratch);
myFiles = new STEPCAFControl_DictionaryOfExternFile;
myLabEF.Clear();
//purpose :
//=======================================================================
-IFSelect_ReturnStatus STEPCAFControl_Writer::Write (const Standard_CString filename)
+Interface_ReturnStatus STEPCAFControl_Writer::Write (const Standard_CString filename)
{
- IFSelect_ReturnStatus status = myWriter.Write ( filename );
+ Interface_ReturnStatus status = myWriter.Write ( filename );
// get directory name of the main file
OSD_Path mainfile ( filename );
STEPCAFControl_IteratorOfDictionaryOfExternFile it ( myFiles );
for ( ; it.More(); it.Next() ) {
Handle(STEPCAFControl_ExternFile) EF = it.Value();
- if ( EF->GetWriteStatus() != IFSelect_RetVoid ) continue;
+ if ( EF->GetWriteStatus() != Interface_RetVoid ) continue;
// construct extern file name
TCollection_AsciiString fname = OSD_Path::AbsolutePath ( dpath, EF->GetName()->String() );
#ifdef OCCT_DEBUG
cout << "Writing external file: " << fname.ToCString() << endl;
#endif
-
- EF->SetWriteStatus ( EF->GetWS()->SendAll ( fname.ToCString() ) );
+
+ XSControl_Writer aWriter( EF->GetWS() );
+ EF->SetWriteStatus ( aWriter.WriteFile( fname.ToCString() ) );
}
return status;
return Transfer ( myWriter, labels, mode, multi );
}
-//=======================================================================
-//function : Transfer
-//purpose :
-//=======================================================================
-
-Standard_Boolean STEPCAFControl_Writer::Transfer( const TDF_LabelSequence& labels,
- const STEPControl_StepModelType mode,
- const Standard_CString multi )
-{
- return Transfer( myWriter, labels, mode, multi );
-}
-
-//=======================================================================
-//function : Perform
-//purpose :
-//=======================================================================
-
-Standard_Boolean STEPCAFControl_Writer::Perform (const Handle(TDocStd_Document) &doc,
- const Standard_CString filename)
-{
- if ( ! Transfer ( doc ) ) return Standard_False;
- return Write ( filename ) == IFSelect_RetDone;
-}
-
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
-Standard_Boolean STEPCAFControl_Writer::Perform (const Handle(TDocStd_Document) &doc,
- const TCollection_AsciiString &filename)
+Standard_Boolean STEPCAFControl_Writer::Perform (const Handle(TDocStd_Document) &doc, const TCollection_AsciiString &filename)
{
- if ( ! Transfer ( doc ) ) return Standard_False;
- return Write ( filename.ToCString() ) == IFSelect_RetDone;
-}
-
-
-//=======================================================================
-//function : ExternFiles
-//purpose :
-//=======================================================================
-
-const Handle(STEPCAFControl_DictionaryOfExternFile) &STEPCAFControl_Writer::ExternFiles () const
-{
- return myFiles;
+ return Perform( doc, filename.ToCString() );
}
//purpose :
//=======================================================================
-Standard_Boolean STEPCAFControl_Writer::ExternFile (const TDF_Label &L,
- Handle(STEPCAFControl_ExternFile) &ef) const
+Standard_Boolean STEPCAFControl_Writer::ExternFile (const TDF_Label &L, Handle(STEPCAFControl_ExternFile) &ef) const
{
ef.Nullify();
if ( ! myLabEF.IsBound ( L ) ) return Standard_False;
//purpose :
//=======================================================================
-Standard_Boolean STEPCAFControl_Writer::ExternFile (const Standard_CString name,
- Handle(STEPCAFControl_ExternFile) &ef) const
+Standard_Boolean STEPCAFControl_Writer::ExternFile (const Standard_CString name, Handle(STEPCAFControl_ExternFile) &ef) const
{
ef.Nullify();
if ( ! myFiles.IsNull() || ! myFiles->HasItem ( name ) )
}
-//=======================================================================
-//function : Writer
-//purpose :
-//=======================================================================
-
-STEPControl_Writer &STEPCAFControl_Writer::ChangeWriter ()
-{
- return myWriter;
-}
-
-
-//=======================================================================
-//function : Writer
-//purpose :
-//=======================================================================
-
-const STEPControl_Writer &STEPCAFControl_Writer::Writer () const
-{
- return myWriter;
-}
-
-
//=======================================================================
//function : Transfer
//purpose :
//=======================================================================
Standard_Boolean STEPCAFControl_Writer::Transfer (STEPControl_Writer &writer,
- const TDF_LabelSequence &labels,
- const STEPControl_StepModelType mode,
- const Standard_CString multi,
+ const TDF_LabelSequence &labels,
+ const STEPControl_StepModelType mode,
+ const Standard_CString multi,
const Standard_Boolean isExternFile)
{
if ( labels.Length() <=0 ) return Standard_False;
- Handle(STEPCAFControl_ActorWrite) Actor =
- Handle(STEPCAFControl_ActorWrite)::DownCast ( writer.WS()->NormAdaptor()->ActorWrite() );
+ Handle(STEPCAFControl_ActorWrite) anActor =
+ Handle(STEPCAFControl_ActorWrite)::DownCast( writer.WS()->WriterProcess()->GetActor() ); //szv_c1:
// translate free top-level shapes of the DECAF document
Standard_Integer ap = Interface_Static::IVal ("write.step.schema");
// write shape either as a whole, or as multifile (with extern refs)
if ( ! multi ) {
- Actor->SetStdMode ( Standard_False );
+ anActor->SetStdMode ( Standard_False );
TDF_LabelSequence comp;
myLabels.Bind ( ref, refS );
sublabels.Append ( ref );
if ( XCAFDoc_ShapeTool::IsAssembly ( ref ) )
- Actor->RegisterAssembly ( refS );
+ anActor->RegisterAssembly ( refS );
}
}
myLabels.Bind ( L, shape );
sublabels.Append ( L );
if ( XCAFDoc_ShapeTool::IsAssembly ( L ) )
- Actor->RegisterAssembly ( shape );
+ anActor->RegisterAssembly ( shape );
writer.Transfer(shape,mode,Standard_False);
- Actor->SetStdMode ( Standard_True ); // restore default behaviour
+ anActor->SetStdMode ( Standard_True ); // restore default behaviour
}
else {
// translate final solids
TopoDS_Shape Sass = TransferExternFiles ( L, mode, sublabels, multi );
// translate main assembly structure
-/*
- if ( ap == 3 ) { // if AP203, switch to AP214
- Interface_Static::SetCVal ("write.step.schema", "AP214DIS");
- Handle(StepData_StepModel) model =
- Handle(StepData_StepModel)::DownCast ( writer.WS()->Model() );
- if ( model->HasHeaderEntity(STANDARD_TYPE(HeaderSection_FileSchema)) ) {
- Handle(HeaderSection_FileSchema) fs =
- Handle(HeaderSection_FileSchema)::DownCast ( model->HeaderEntity(STANDARD_TYPE(HeaderSection_FileSchema)) );
- Handle(TCollection_HAsciiString) str = fs->SchemaIdentifiersValue ( 1 );
- Handle(TCollection_HAsciiString) ap214 = new TCollection_HAsciiString ( "AUTOMOTIVE_DESIGN" );
- if ( str->Search ( ap214 ) <0 ) {
- str->Clear();
- str->AssignCat ( ap214 );
- }
- }
- }
-*/
Standard_Integer assemblymode = Interface_Static::IVal ("write.step.assembly");
Interface_Static::SetCVal ("write.step.assembly", "On");
writer.Transfer ( Sass, STEPControl_AsIs );
}
}
- writer.WS()->ComputeGraph(Standard_True );// added by skl 03.11.2003 since we use
+ writer.WS()->ComputeGraph(Standard_True); // added by skl 03.11.2003 since we use
// writer.Transfer() wihtout compute graph
// write names
}
// write validation props
-// if ( multi && ap ==3 ) {
-// Interface_Static::SetCVal ("write.step.schema", "AP214DIS");
-// }
if ( GetPropsMode() )
WriteValProps ( writer.WS(), sublabels, multi );
if (Interface_Static::IVal("write.stepcaf.subshapes.name") != 0)
{
- const Handle(XSControl_TransferWriter) &TW = this->ChangeWriter().WS()->TransferWriter();
- const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess();
+ const Handle(Transfer_FinderProcess) &FP = myWriter.WS()->WriterProcess();
for ( int i = 1; i <= labels.Length(); i++ )
{
labels.Append ( L );
// prepare for transfer
Handle(XSControl_WorkSession) newWS = new XSControl_WorkSession;
- newWS->SelectNorm ( "STEP" );
+ newWS->SelectNorm("STEP");
STEPControl_Writer sw ( newWS, Standard_True );
TDF_LabelSequence Lseq;
Lseq.Append ( L );
{
if ( labels.Length() <=0 ) return Standard_False;
- const Handle(XSControl_TransferWriter) &TW = WS->TransferWriter();
- const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess();
+ const Handle(Transfer_FinderProcess) &FP = WS->WriterProcess();
STEPConstruct_ExternRefs EFTool ( WS );
Standard_Integer schema = Interface_Static::IVal("write.step.schema");
for ( Standard_Integer k=1; k <= labels.Length(); k++ ) {
}
else {
// create SDR and add to model.
- const Handle(XSControl_TransferWriter) &TW = WS->TransferWriter();
- const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess();
+ const Handle(Transfer_FinderProcess) &FP = WS->WriterProcess();
Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper ( FP, S );
Handle(StepShape_ContextDependentShapeRepresentation) CDSR;
if ( FP->FindTypedTransient(mapper,
if ( labels.Length() <=0 ) return Standard_False;
// get working data
- const Handle(XSControl_TransferWriter) &TW = WS->TransferWriter();
- const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess();
+ const Handle(Transfer_FinderProcess) &FP = WS->WriterProcess();
// Iterate on requested shapes
for ( Standard_Integer i=1; i <= labels.Length(); i++ ) {
// get working data
const Handle(Interface_InterfaceModel) &Model = WS->Model();
- const Handle(XSControl_TransferWriter) &TW = WS->TransferWriter();
- const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess();
+ const Handle(Transfer_FinderProcess) &FP = WS->WriterProcess();
Handle(XCAFDoc_LayerTool) LTool = XCAFDoc_DocumentTool::LayerTool( labels(1) );
if (LTool.IsNull() ) return Standard_False;
if ( theShape.IsNull() )
return Standard_False;
// get CDSR
- const Handle(XSControl_TransferWriter) &TW = WS->TransferWriter();
- const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess();
+ const Handle(Transfer_FinderProcess) &FP = WS->WriterProcess();
Handle(StepShape_ContextDependentShapeRepresentation) CDSR;
Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper ( FP, theShape );
if (!FP->FindTypedTransient(mapper,
Handle(StepVisual_StyledItem) override; //null styled item
// find the repr item of the shape
- const Handle(XSControl_TransferWriter) &TW = WS->TransferWriter();
- const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess();
+ const Handle(Transfer_FinderProcess) &FP = WS->WriterProcess();
Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper ( FP, Sh );
Handle(StepShape_ContextDependentShapeRepresentation) CDSR;
FP->FindTypedTransient(mapper,
{
// Get working data
const Handle(Interface_InterfaceModel) &Model = WS->Model();
- const Handle(XSControl_TransferWriter) &TW = WS->TransferWriter();
- const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess();
+ const Handle(Transfer_FinderProcess) &FP = WS->WriterProcess();
const Handle(Interface_HGraph) aHGraph = WS->HGraph();
if (aHGraph.IsNull())
return NULL;
{
// Get working data
const Handle(Interface_InterfaceModel) &Model = WS->Model();
- const Handle(XSControl_TransferWriter) &TW = WS->TransferWriter();
- const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess();
+ const Handle(Transfer_FinderProcess) &FP = WS->WriterProcess();
const Handle(Interface_HGraph) aHGraph = WS->HGraph();
if (aHGraph.IsNull())
return NULL;
// get working data
const Handle(Interface_InterfaceModel) &Model = WS->Model();
- const Handle(XSControl_TransferWriter) &TW = WS->TransferWriter();
- const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess();
+ const Handle(Transfer_FinderProcess) &FP = WS->WriterProcess();
const Handle(Interface_HGraph) aHGraph = WS->HGraph();
if(aHGraph.IsNull())
// get working data
const Handle(Interface_InterfaceModel) &Model = WS->Model();
- const Handle(XSControl_TransferWriter) &TW = WS->TransferWriter();
- const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess();
+ const Handle(Transfer_FinderProcess) &FP = WS->WriterProcess();
const Handle(Interface_HGraph) aHGraph = WS->HGraph();
if(aHGraph.IsNull())
return Standard_True;
}
-
-
-//=======================================================================
-//function : SetColorMode
-//purpose :
-//=======================================================================
-
-void STEPCAFControl_Writer::SetColorMode (const Standard_Boolean colormode)
-{
- myColorMode = colormode;
-}
-
-
-//=======================================================================
-//function : GetColorMode
-//purpose :
-//=======================================================================
-
-Standard_Boolean STEPCAFControl_Writer::GetColorMode () const
-{
- return myColorMode;
-}
-
-
-//=======================================================================
-//function : SetNameMode
-//purpose :
-//=======================================================================
-
-void STEPCAFControl_Writer::SetNameMode (const Standard_Boolean namemode)
-{
- myNameMode = namemode;
-}
-
-
-//=======================================================================
-//function : GetNameMode
-//purpose :
-//=======================================================================
-
-Standard_Boolean STEPCAFControl_Writer::GetNameMode () const
-{
- return myNameMode;
-}
-
-
-//=======================================================================
-//function : SetLayerMode
-//purpose :
-//=======================================================================
-
-void STEPCAFControl_Writer::SetLayerMode (const Standard_Boolean layermode)
-{
- myLayerMode = layermode;
-}
-
-
-//=======================================================================
-//function : GetLayerMode
-//purpose :
-//=======================================================================
-
-Standard_Boolean STEPCAFControl_Writer::GetLayerMode () const
-{
- return myLayerMode;
-}
-
-
-//=======================================================================
-//function : SetPropsMode
-//purpose :
-//=======================================================================
-
-void STEPCAFControl_Writer::SetPropsMode (const Standard_Boolean propsmode)
-{
- myPropsMode = propsmode;
-}
-
-
-//=======================================================================
-//function : GetPropsMode
-//purpose :
-//=======================================================================
-
-Standard_Boolean STEPCAFControl_Writer::GetPropsMode () const
-{
- return myPropsMode;
-}
-
-
-//=======================================================================
-//function : SetSHUOMode
-//purpose :
-//=======================================================================
-
-void STEPCAFControl_Writer::SetSHUOMode (const Standard_Boolean mode)
-{
- mySHUOMode = mode;
-}
-
-
-//=======================================================================
-//function : GetSHUOMode
-//purpose :
-//=======================================================================
-
-Standard_Boolean STEPCAFControl_Writer::GetSHUOMode () const
-{
- return mySHUOMode;
-}
-
-
-//=======================================================================
-//function : SetDimTolMode
-//purpose :
-//=======================================================================
-
-void STEPCAFControl_Writer::SetDimTolMode(const Standard_Boolean dimtolmode)
-{
- myDGTMode = dimtolmode;
-}
-
-
-//=======================================================================
-//function : GetDimTolMode
-//purpose :
-//=======================================================================
-
-Standard_Boolean STEPCAFControl_Writer::GetDimTolMode() const
-{
- return myDGTMode;
-}
-
-
-//=======================================================================
-//function : SetMaterialMode
-//purpose :
-//=======================================================================
-
-void STEPCAFControl_Writer::SetMaterialMode(const Standard_Boolean matmode)
-{
- myMatMode = matmode;
-}
-
-
-//=======================================================================
-//function : GetMaterialMode
-//purpose :
-//=======================================================================
-
-Standard_Boolean STEPCAFControl_Writer::GetMaterialMode() const
-{
- return myMatMode;
-}
#include <STEPControl_Writer.hxx>
#include <STEPCAFControl_DataMapOfLabelShape.hxx>
#include <STEPCAFControl_DataMapOfLabelExternFile.hxx>
-#include <Standard_Boolean.hxx>
#include <MoniTool_DataMapOfShapeTransient.hxx>
-#include <IFSelect_ReturnStatus.hxx>
+#include <Interface_ReturnStatus.hxx>
#include <Standard_CString.hxx>
#include <STEPControl_StepModelType.hxx>
#include <TDF_LabelSequence.hxx>
class TDF_Label;
class TCollection_AsciiString;
class STEPCAFControl_ExternFile;
-class STEPControl_Writer;
class TopoDS_Shape;
//! Provides a tool to write DECAF document to the
//! Also supports multifile writing
class STEPCAFControl_Writer
{
-public:
+ public:
DEFINE_STANDARD_ALLOC
-
//! Creates a writer with an empty
//! STEP model and sets ColorMode, LayerMode, NameMode and
//! PropsMode to Standard_True.
//! filename will be a name of root file, all other files
//! have names of corresponding parts
//! Provided for use like single-file writer
- Standard_EXPORT IFSelect_ReturnStatus Write (const Standard_CString filename);
+ Standard_EXPORT Interface_ReturnStatus Write (const Standard_CString filename);
//! Transfers a document (or single label) to a STEP model
//! The mode of translation of shape is AsIs
//! Transfers a document and writes it to a STEP file
//! Returns True if translation is OK
- Standard_EXPORT Standard_Boolean Perform (const Handle(TDocStd_Document)& doc, const Standard_CString filename);
+ Standard_Boolean Perform (const Handle(TDocStd_Document)& doc, const Standard_CString filename)
+ { return ( Transfer( doc ) ? ( Write( filename ) == Interface_RetDone ) : Standard_False ); }
//! Returns data on external files
//! Returns Null handle if no external files are read
- Standard_EXPORT const Handle(STEPCAFControl_DictionaryOfExternFile)& ExternFiles() const;
+ const Handle(STEPCAFControl_DictionaryOfExternFile)& ExternFiles() const { return myFiles; }
//! Returns data on external file by its original label
//! Returns False if no external file with given name is read
Standard_EXPORT Standard_Boolean ExternFile (const Standard_CString name, Handle(STEPCAFControl_ExternFile)& ef) const;
//! Returns basic reader for root file
- Standard_EXPORT STEPControl_Writer& ChangeWriter();
+ STEPControl_Writer& ChangeWriter() { return myWriter; }
//! Returns basic reader as const
- Standard_EXPORT const STEPControl_Writer& Writer() const;
+ const STEPControl_Writer& Writer() const { return myWriter; }
//! Set ColorMode for indicate write Colors or not.
- Standard_EXPORT void SetColorMode (const Standard_Boolean colormode);
+ void SetColorMode (const Standard_Boolean colormode) { myColorMode = colormode; }
- Standard_EXPORT Standard_Boolean GetColorMode() const;
+ Standard_Boolean GetColorMode() const { return myColorMode; }
//! Set NameMode for indicate write Name or not.
- Standard_EXPORT void SetNameMode (const Standard_Boolean namemode);
+ void SetNameMode (const Standard_Boolean namemode) { myNameMode = namemode; }
- Standard_EXPORT Standard_Boolean GetNameMode() const;
+ Standard_Boolean GetNameMode() const { return myNameMode; }
//! Set LayerMode for indicate write Layers or not.
- Standard_EXPORT void SetLayerMode (const Standard_Boolean layermode);
+ void SetLayerMode (const Standard_Boolean layermode) { myLayerMode = layermode; }
- Standard_EXPORT Standard_Boolean GetLayerMode() const;
+ Standard_Boolean GetLayerMode() const { return myLayerMode; }
//! PropsMode for indicate write Validation properties or not.
- Standard_EXPORT void SetPropsMode (const Standard_Boolean propsmode);
+ void SetPropsMode (const Standard_Boolean propsmode) { myPropsMode = propsmode; }
- Standard_EXPORT Standard_Boolean GetPropsMode() const;
+ Standard_Boolean GetPropsMode() const { return myPropsMode; }
//! Set SHUO mode for indicate write SHUO or not.
- Standard_EXPORT void SetSHUOMode (const Standard_Boolean shuomode);
+ void SetSHUOMode (const Standard_Boolean shuomode) { mySHUOMode = shuomode; }
- Standard_EXPORT Standard_Boolean GetSHUOMode() const;
+ Standard_Boolean GetSHUOMode() const { return mySHUOMode; }
//! Set dimtolmode for indicate write D>s or not.
- Standard_EXPORT void SetDimTolMode (const Standard_Boolean dimtolmode);
+ void SetDimTolMode (const Standard_Boolean dimtolmode) { myDGTMode = dimtolmode; }
- Standard_EXPORT Standard_Boolean GetDimTolMode() const;
+ Standard_Boolean GetDimTolMode() const { return myDGTMode; }
//! Set dimtolmode for indicate write D>s or not.
- Standard_EXPORT void SetMaterialMode (const Standard_Boolean matmode);
+ void SetMaterialMode (const Standard_Boolean matmode) { myMatMode = matmode; }
- Standard_EXPORT Standard_Boolean GetMaterialMode() const;
-
-
+ Standard_Boolean GetMaterialMode() const { return myMatMode; }
+ protected:
-protected:
//! Mehod to writing sequence of root assemblies or part of the file specified by use by one label
- Standard_EXPORT Standard_Boolean Transfer (const TDF_LabelSequence& L, const STEPControl_StepModelType mode = STEPControl_AsIs, const Standard_CString multi = 0);
+ Standard_Boolean Transfer (const TDF_LabelSequence& L, const STEPControl_StepModelType mode = STEPControl_AsIs, const Standard_CString multi = 0)
+ { return Transfer( myWriter, L, mode, multi ); }
//! Transfers labels to a STEP model
//! Returns True if translation is OK
//! Write SHUO assigned to specified component, to STEP model
Standard_EXPORT Standard_Boolean WriteSHUOs (const Handle(XSControl_WorkSession)& WS, const TDF_LabelSequence& labels);
-
-
-private:
-
-
+ private:
STEPControl_Writer myWriter;
Handle(STEPCAFControl_DictionaryOfExternFile) myFiles;
MoniTool_DataMapOfShapeTransient myMapCompMDGPR;
Standard_Boolean myDGTMode;
Standard_Boolean myMatMode;
-
-
};
-
-
-
#endif // _STEPCAFControl_Writer_HeaderFile
STEPConstruct_Styles.hxx
STEPConstruct_Tool.cxx
STEPConstruct_Tool.hxx
-STEPConstruct_Tool.lxx
STEPConstruct_UnitContext.cxx
STEPConstruct_UnitContext.hxx
STEPConstruct_ValidationProps.cxx
ProdDefSh->SetDefinition(CDf);
}
-// Interface_EntityIterator subs1 = Graph().Shareds(ProdDefSh);
-// for (subs1.Start(); subs1.More(); subs1.Next()) {
-
-// Handle(Standard_Transient) sub1 = subs1.Value();
-// if (!sub1->IsKind(STANDARD_TYPE(StepBasic_ProductDefinition))) continue;
-// Handle(StepBasic_ProductDefinition) ProdDef =
-// Handle(StepBasic_ProductDefinition)::DownCast ( sub1 );
-// numProdDef = Model()->Number(ProdDef);
Standard_Integer numProdDef = Model()->Number(PD);
// Interface_EntityIterator subs2 = Graph().Sharings(ProdDef);
#include <STEPConstruct_Tool.hxx>
#include <Transfer_FinderProcess.hxx>
#include <Transfer_TransientProcess.hxx>
-#include <XSControl_TransferReader.hxx>
-#include <XSControl_TransferWriter.hxx>
-#include <XSControl_WorkSession.hxx>
-
-//=======================================================================
-//function : STEPConstruct_Tool
-//purpose :
-//=======================================================================
-STEPConstruct_Tool::STEPConstruct_Tool ()
-{
-}
-
-//=======================================================================
-//function : STEPConstruct_Tool
-//purpose :
-//=======================================================================
-
-STEPConstruct_Tool::STEPConstruct_Tool (const Handle(XSControl_WorkSession) &WS)
-{
- SetWS ( WS );
-}
//=======================================================================
//function : Init
myHGraph = myWS->HGraph();
// collect data on reading process
- const Handle(XSControl_TransferReader) &TR = WS->TransferReader();
- if ( ! TR.IsNull() ) myTransientProcess = TR->TransientProcess();
+ myTransientProcess = myWS->ReaderProcess();
// collect data on writing process
- const Handle(XSControl_TransferWriter) &TW = myWS->TransferWriter();
- if ( ! TW.IsNull() ) myFinderProcess = TW->FinderProcess();
+ myFinderProcess = myWS->WriterProcess();
return ! myTransientProcess.IsNull() && ! myFinderProcess.IsNull();
}
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
-#include <Standard_Boolean.hxx>
-class XSControl_WorkSession;
-class Transfer_FinderProcess;
+#include <Interface_HGraph.hxx>
+#include <XSControl_WorkSession.hxx>
+#include <Transfer_FinderProcess.hxx>
class Transfer_TransientProcess;
-class Interface_HGraph;
class Interface_InterfaceModel;
class Interface_Graph;
//! this (and derived) tool multiple times
class STEPConstruct_Tool
{
-public:
+ public:
DEFINE_STANDARD_ALLOC
-
//! Creates an empty tool
- Standard_EXPORT STEPConstruct_Tool();
+ STEPConstruct_Tool() {}
//! Creates a tool and loads it with worksession
- Standard_EXPORT STEPConstruct_Tool(const Handle(XSControl_WorkSession)& WS);
+ STEPConstruct_Tool(const Handle(XSControl_WorkSession)& WS) { SetWS ( WS ); }
//! Returns currently loaded WorkSession
- const Handle(XSControl_WorkSession)& WS() const;
-
+ //const Handle(XSControl_WorkSession)& WS() const { return myWS; }
+
//! Returns current model (Null if not loaded)
- Handle(Interface_InterfaceModel) Model() const;
-
- //! Returns current graph (recomputing if necessary)
- const Interface_Graph& Graph (const Standard_Boolean recompute = Standard_False) const;
-
- //! Returns TransientProcess (reading; Null if not loaded)
- const Handle(Transfer_TransientProcess)& TransientProcess() const;
-
- //! Returns FinderProcess (writing; Null if not loaded)
- const Handle(Transfer_FinderProcess)& FinderProcess() const;
+ const Handle(Interface_InterfaceModel)& Model() const { return myWS->Model(); }
+ //! Returns current graph (recomputing if necessary)
+ const Interface_Graph& Graph (const Standard_Boolean recompute = Standard_False) const
+ {
+ // Note: myWS->Graph() recomputes graph each time!
+ return recompute ? myWS->Graph() : myHGraph->Graph();
+ }
+ //! Returns TransientProcess (reading; Null if not loaded)
+ const Handle(Transfer_TransientProcess)& TransientProcess() const { return myTransientProcess; }
+ //! Returns FinderProcess (writing; Null if not loaded)
+ const Handle(Transfer_FinderProcess)& FinderProcess() const { return myFinderProcess; }
-protected:
+ protected:
-
//! Load worksession; returns True if succeeded
//! Returns False if either FinderProcess of TransientProcess
//! cannot be obtained or are Null
Standard_EXPORT Standard_Boolean SetWS (const Handle(XSControl_WorkSession)& WS);
+ Handle(XSControl_WorkSession) myWS;
+ private:
-
-private:
-
-
-
- Handle(XSControl_WorkSession) myWS;
Handle(Transfer_FinderProcess) myFinderProcess;
Handle(Transfer_TransientProcess) myTransientProcess;
Handle(Interface_HGraph) myHGraph;
-
-
};
-
-#include <STEPConstruct_Tool.lxx>
-
-
-
-
-
#endif // _STEPConstruct_Tool_HeaderFile
+++ /dev/null
-// Created on: 2000-09-29
-// Created by: data exchange team
-// Copyright (c) 2000-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 <Interface_InterfaceModel.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_HGraph.hxx>
-#include <Transfer_TransientProcess.hxx>
-#include <Transfer_FinderProcess.hxx>
-#include <XSControl_WorkSession.hxx>
-
-//=======================================================================
-//function : WS
-//purpose :
-//=======================================================================
-
-inline const Handle(XSControl_WorkSession) &STEPConstruct_Tool::WS() const
-{
- return myWS;
-}
-
-//=======================================================================
-//function : Model
-//purpose :
-//=======================================================================
-
-inline Handle(Interface_InterfaceModel) STEPConstruct_Tool::Model() const
-{
- return myWS->Model();
-}
-
-//=======================================================================
-//function : Graph
-//purpose :
-//=======================================================================
-
-inline const Interface_Graph &STEPConstruct_Tool::Graph (const Standard_Boolean recompute) const
-{
- // Note: myWS->Graph() recomputes graph each time!
- return recompute ? myWS->Graph() : myHGraph->Graph();
-}
-
-//=======================================================================
-//function : TransientProcess
-//purpose :
-//=======================================================================
-
-inline const Handle(Transfer_TransientProcess) &STEPConstruct_Tool::TransientProcess() const
-{
- return myTransientProcess;
-}
-
-//=======================================================================
-//function : FinderProcess
-//purpose :
-//=======================================================================
-
-inline const Handle(Transfer_FinderProcess) &STEPConstruct_Tool::FinderProcess() const
-{
- return myFinderProcess;
-}
#include <TopoDS_Shape.hxx>
#include <Transfer_Binder.hxx>
#include <Transfer_SimpleBinderOfTransient.hxx>
+#include <Transfer_TransientProcess.hxx>
#include <TransferBRep.hxx>
#include <TransferBRep_ShapeMapper.hxx>
#include <XSControl_WorkSession.hxx>
// if requested, try to find instance of assembly
if ( instance ) {
-/*
- Handle(StepRepr_NextAssemblyUsageOccurrence) NAUO;
- Standard_Boolean found = myAssemblyPD.IsNull()?
- FinderProcess()->FindTypedTransient (mapper,STANDARD_TYPE(StepRepr_NextAssemblyUsageOccurrence), NAUO) :
- STEPConstruct::FindNAUO (binder,myAssemblyPD,NAUO);
- if ( found ) {
- //skl find CDSR using NAUO:
- Handle(StepShape_ContextDependentShapeRepresentation) CDSR
- Interface_EntityIterator subs1 = graph.Sharings(NAUO);
- for (subs1.Start(); subs1.More(); subs1.Next()) {
- Handle(StepRepr_ProductDefinitionShape) PDS =
- Handle(StepRepr_ProductDefinitionShape)::DownCast(subs1.Value());
- if(PDS.IsNull()) continue;
- //IsPDS=Standard_True;
- Interface_EntityIterator subs2 = graph.Sharings(PDS);
- for (subs2.Start(); CDSR.IsNull() && subs2.More(); subs2.Next()) {
- CDSR = Handle(StepShape_ContextDependentShapeRepresentation)::DownCast(subs2.Value());
- }
- }
- if(!CDSR.IsNull()) {
- target.SetValue ( CDSR->RepresentedProductRelation() );
- Context = CDSR->RepresentationRelation()->Rep2()->ContextOfItems();
- }
-#ifdef OCCT_DEBUG
- else cout << "INSTANCE: CDRS from NAUO NOT found" << endl;
-#endif
- }
-#ifdef OCCT_DEBUG
- else cout << "INSTANCE: NAUO NOT found" << endl;
-#endif
-*/
}
// for Compounds, search for SDR
STEPControl_ActorWrite.hxx
STEPControl_Controller.cxx
STEPControl_Controller.hxx
-STEPControl_FloatFormat.cxx
-STEPControl_FloatFormat.hxx
STEPControl_Reader.cxx
STEPControl_Reader.hxx
STEPControl_StepModelType.hxx
-STEPControl_WorkLibrary.cxx
-STEPControl_WorkLibrary.hxx
STEPControl_Writer.cxx
STEPControl_Writer.hxx
myContext.NextIndex();
return resprod;
}
+
+//=======================================================================
+//function : TransferModeBounds
+//purpose :
+//=======================================================================
+
+Standard_Boolean STEPControl_ActorWrite::TransferModeBounds (Standard_Integer& theMin, Standard_Integer& theMax) const
+{
+ theMin = 0, theMax = 4;
+ return Standard_True;
+}
+
+//=======================================================================
+//function : TransferModeBounds
+//purpose :
+//=======================================================================
+
+Standard_CString STEPControl_ActorWrite::TransferModeHelp (const Standard_Integer theMode) const
+{
+ switch (theMode) {
+ case 0: return "As Is";
+ case 1: return "Faceted Brep";
+ case 2: return "Shell Based";
+ case 3: return "Manifold Solid";
+ case 4: return "Wireframe";
+ default: break;
+ }
+ return "";
+}
//==========================================
SetMode(STEPControl_ShellBasedSurfaceModel);
}
- Standard_EXPORT Standard_Boolean Recognize (const Handle(Standard_Transient)& start) Standard_OVERRIDE;
+ //! Recognizes a source entity
+ Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Standard_Transient)& start) Standard_OVERRIDE;
- Standard_EXPORT Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_Process)& FP) Standard_OVERRIDE;
+ //! Transfers a source entity to IGES Entities
+ Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_Process)& FP) Standard_OVERRIDE;
+
+ //! Transfer mode bounds
+ Standard_EXPORT virtual Standard_Boolean TransferModeBounds (Standard_Integer& theMin, Standard_Integer& theMax) const Standard_OVERRIDE;
+
+ //! Returns the help string recorded for a given transfer mode
+ Standard_EXPORT virtual Standard_CString TransferModeHelp (const Standard_Integer theMode) const Standard_OVERRIDE;
Standard_EXPORT Handle(Transfer_Binder) TransferSubShape (const Handle(Transfer_Finder)& start, const Handle(StepShape_ShapeDefinitionRepresentation)& SDR, Handle(StepGeom_Axis2Placement3d)& AX1, const Handle(Transfer_FinderProcess)& FP, const Handle(TopTools_HSequenceOfShape)& shapeGroup = NULL, const Standard_Boolean isManifold = Standard_True);
//:j4 gka 16.03.99 S4134
// gka 05.04.99 S4136: parameters definitions changed
+#include <Standard_Mutex.hxx>
+#include <Standard_Version.hxx>
+#include <OSD_OpenFile.hxx>
+#include <Message_Messenger.hxx>
#include <Interface_Macros.hxx>
#include <Interface_Static.hxx>
+#include <Interface_CheckIterator.hxx>
+#include <Interface_ReportEntity.hxx>
+#include <XSAlgo.hxx>
+#include <RWStepAP214.hxx>
+#include <StepFile_Read.hxx>
+#include <StepData_StepDumper.hxx>
+#include <StepData_StepWriter.hxx>
#include <StepAP214.hxx>
#include <StepAP214_Protocol.hxx>
-#include <RWStepAP214.hxx>
-#include <Standard_Version.hxx>
#include <STEPControl_ActorRead.hxx>
#include <STEPControl_ActorWrite.hxx>
#include <STEPControl_Controller.hxx>
#include <StepData_StepModel.hxx>
-#include <STEPControl_WorkLibrary.hxx>
-#include <TopoDS_Shape.hxx>
-#include <XSAlgo.hxx>
-#include <XSControl_WorkSession.hxx>
#include <APIHeaderSection_MakeHeader.hxx>
IMPLEMENT_STANDARD_RTTIEXT(STEPControl_Controller,XSControl_Controller)
-// Pour NewModel et Write : definition de produit (temporaire ...)
-STEPControl_Controller::STEPControl_Controller ()
-: XSControl_Controller ("STEP", "step")
+/*class STEPControl_FloatFormat
{
- static Standard_Boolean init = Standard_False;
- if (!init) {
- RWStepAP214::Init();
-
- Interface_Static::Init ("step","write.step.product.name",'t',"Open CASCADE STEP translator " OCC_VERSION_STRING);
- Interface_Static::Init ("step","write.step.assembly",'e',"");
- Interface_Static::Init ("step","write.step.assembly",'&',"enum 0");
- Interface_Static::Init ("step","write.step.assembly",'&',"eval Off");
- Interface_Static::Init ("step","write.step.assembly",'&',"eval On");
- Interface_Static::Init ("step","write.step.assembly",'&',"eval Auto");
- Interface_Static::SetCVal("write.step.assembly","Auto");
-
- Interface_Static::Init("step","step.angleunit.mode", 'e',"");
- Interface_Static::Init("step","step.angleunit.mode", '&',"enum 0");
- Interface_Static::Init("step","step.angleunit.mode", '&',"eval File");
- Interface_Static::Init("step","step.angleunit.mode", '&',"eval Rad");
- Interface_Static::Init("step","step.angleunit.mode", '&',"eval Deg");
- Interface_Static::SetCVal("step.angleunit.mode","File");
-
- Interface_Static::Init("step","write.step.schema", 'e',"");
- Interface_Static::Init("step","write.step.schema",'&',"enum 1");
- Interface_Static::Init("step","write.step.schema",'&',"eval AP214CD");
- Interface_Static::Init("step","write.step.schema",'&',"eval AP214DIS");
- Interface_Static::Init("step","write.step.schema",'&',"eval AP203");
- Interface_Static::Init("step","write.step.schema",'&',"eval AP214IS");
- Interface_Static::Init("step","write.step.schema",'&',"eval AP242DIS");
- Interface_Static::SetCVal("write.step.schema","AP214IS");
-
- // Type of Product Definition for reading
- // Note: the numbers should be consistent with function FindShapeReprType()
- // in STEPControl_ActorRead.cxx
- Interface_Static::Init("step","read.step.shape.repr",'e',"");
- Interface_Static::Init("step","read.step.shape.repr",'&',"enum 1");
- Interface_Static::Init("step","read.step.shape.repr",'&',"eval All"); // 1
- Interface_Static::Init("step","read.step.shape.repr",'&',"eval ABSR"); // 2
- Interface_Static::Init("step","read.step.shape.repr",'&',"eval MSSR"); // 3
- Interface_Static::Init("step","read.step.shape.repr",'&',"eval GBSSR"); // 4
- Interface_Static::Init("step","read.step.shape.repr",'&',"eval FBSR"); // 5
- Interface_Static::Init("step","read.step.shape.repr",'&',"eval EBWSR"); // 6
- Interface_Static::Init("step","read.step.shape.repr",'&',"eval GBWSR"); // 7
- Interface_Static::SetCVal("read.step.shape.repr","All");
-
- // Mode for reading shapes attached to main SDR by SRR
- // (hybrid model representation in AP203 since 1998)
- Interface_Static::Init("step","read.step.shape.relationship",'e',"");
- Interface_Static::Init("step","read.step.shape.relationship",'&',"enum 0");
- Interface_Static::Init("step","read.step.shape.relationship",'&',"eval OFF");
- Interface_Static::Init("step","read.step.shape.relationship",'&',"eval ON");
- Interface_Static::SetCVal("read.step.shape.relationship","ON");
-
- // Mode for reading shapes attached to Product by ShapeAspect
- // (hybrid model representation in AP203 before 1998)
- Interface_Static::Init("step","read.step.shape.aspect",'e',"");
- Interface_Static::Init("step","read.step.shape.aspect",'&',"enum 0");
- Interface_Static::Init("step","read.step.shape.aspect",'&',"eval OFF");
- Interface_Static::Init("step","read.step.shape.aspect",'&',"eval ON");
- Interface_Static::SetCVal("read.step.shape.aspect","ON");
-
- // Mode for reading SDR and ShapeRepr if it is necessary
- Interface_Static::Init("step","read.step.product.mode",'e',"");
- Interface_Static::Init("step","read.step.product.mode",'&',"enum 0");
- Interface_Static::Init("step","read.step.product.mode",'&',"eval OFF");
- Interface_Static::Init("step","read.step.product.mode",'&',"eval ON");
- Interface_Static::SetCVal("read.step.product.mode","ON");
-
- // Order of reading ShapeDefinitionRepresentation in ProductDefinition
- Interface_Static::Init("step","read.step.product.context",'e',"");
- Interface_Static::Init("step","read.step.product.context",'&',"enum 1");
- Interface_Static::Init("step","read.step.product.context",'&',"eval all"); // 1
- Interface_Static::Init("step","read.step.product.context",'&',"eval design"); // 2
- Interface_Static::Init("step","read.step.product.context",'&',"eval analysis");// 3
- Interface_Static::SetCVal("read.step.product.context","all");
-
- // What we try to read in ProductDefinition
- Interface_Static::Init("step","read.step.assembly.level",'e',"");
- Interface_Static::Init("step","read.step.assembly.level",'&',"enum 1");
- Interface_Static::Init("step","read.step.assembly.level",'&',"eval all"); // 1
- Interface_Static::Init("step","read.step.assembly.level",'&',"eval assembly"); // 2
- Interface_Static::Init("step","read.step.assembly.level",'&',"eval structure");// 3
- Interface_Static::Init("step","read.step.assembly.level",'&',"eval shape"); // 4
- Interface_Static::SetCVal("read.step.assembly.level","all");
-
- // unit: supposed to be cascade unit (target unit for reading)
- Interface_Static::Init("step","write.step.unit", 'e',"");
- Interface_Static::Init("step","write.step.unit",'&',"enum 1");
- Interface_Static::Init("step","write.step.unit",'&',"eval INCH"); // 1
- Interface_Static::Init("step","write.step.unit",'&',"eval MM"); // 2
- Interface_Static::Init("step","write.step.unit",'&',"eval ??"); // 3
- Interface_Static::Init("step","write.step.unit",'&',"eval FT"); // 4
- Interface_Static::Init("step","write.step.unit",'&',"eval MI"); // 5
- Interface_Static::Init("step","write.step.unit",'&',"eval M"); // 6
- Interface_Static::Init("step","write.step.unit",'&',"eval KM"); // 7
- Interface_Static::Init("step","write.step.unit",'&',"eval MIL"); // 8
- Interface_Static::Init("step","write.step.unit",'&',"eval UM"); // 9
- Interface_Static::Init("step","write.step.unit",'&',"eval CM"); //10
- Interface_Static::Init("step","write.step.unit",'&',"eval UIN"); //11
- Interface_Static::SetCVal ("write.step.unit","MM");
-
- // Non-manifold topology reading: OFF by default (ssv; 26.11.2010)
- Interface_Static::Init ("step","read.step.nonmanifold",'e',"");
- Interface_Static::Init ("step","read.step.nonmanifold",'&',"enum 0");
- Interface_Static::Init ("step","read.step.nonmanifold",'&',"eval Off");
- Interface_Static::Init ("step","read.step.nonmanifold",'&',"eval On");
- Interface_Static::SetIVal("read.step.nonmanifold",0);
-
- // Non-manifold topology writing: OFF by default (ssv; 26.11.2010)
- Interface_Static::Init ("step","write.step.nonmanifold",'e',"");
- Interface_Static::Init ("step","write.step.nonmanifold",'&',"enum 0");
- Interface_Static::Init ("step","write.step.nonmanifold",'&',"eval Off");
- Interface_Static::Init ("step","write.step.nonmanifold",'&',"eval On");
- Interface_Static::SetIVal("write.step.nonmanifold",0);
-
- // I-Deas-like STEP processing: OFF by default (ssv; 22.11.2010)
- Interface_Static::Init ("step","read.step.ideas",'e',"");
- Interface_Static::Init ("step","read.step.ideas",'&',"enum 0");
- Interface_Static::Init ("step","read.step.ideas",'&',"eval Off");
- Interface_Static::Init ("step","read.step.ideas",'&',"eval On");
- Interface_Static::SetIVal("read.step.ideas",0);
-
- //Parameter to write all free vertices in one SDR (name and style of vertex are lost) (default)
- //or each vertex in its own SDR (name and style of vertex are exported). (ika; 21.07.2014)
- Interface_Static::Init ("step","write.step.vertex.mode",'e',"");
- Interface_Static::Init ("step","write.step.vertex.mode",'&',"enum 0");
- Interface_Static::Init ("step","write.step.vertex.mode",'&',"eval One Compound");
- Interface_Static::Init ("step","write.step.vertex.mode",'&',"eval Single Vertex");
- Interface_Static::SetIVal("write.step.vertex.mode",0);
-
- // abv 15.11.00: ShapeProcessing
- Interface_Static::Init ("XSTEP","write.step.resource.name",'t',"STEP");
- Interface_Static::Init ("XSTEP","read.step.resource.name",'t',"STEP");
- Interface_Static::Init ("XSTEP","write.step.sequence",'t',"ToSTEP");
- Interface_Static::Init ("XSTEP","read.step.sequence",'t',"FromSTEP");
-
- // ika 28.07.16: Paremeter to read all top level solids and shells,
- // should be used only in case of invalid shape_representation without links to shapes.
- Interface_Static::Init("step", "read.step.all.shapes", 'e', "");
- Interface_Static::Init("step", "read.step.all.shapes", '&', "enum 0");
- Interface_Static::Init("step", "read.step.all.shapes", '&', "eval Off");
- Interface_Static::Init("step", "read.step.all.shapes", '&', "eval On");
- Interface_Static::SetIVal("read.step.all.shapes", 0);
-
- init = Standard_True;
+ Standard_Boolean thezerosup;
+ TCollection_AsciiString themainform;
+ TCollection_AsciiString theformrange;
+ Standard_Real therangemin;
+ Standard_Real therangemax;
+ public:
+ STEPControl_FloatFormat ()
+ : thezerosup (Standard_True) , themainform ("%E") ,
+ theformrange ("%f") , therangemin (0.1) , therangemax (1000.)
+ {}
+ //! Sets the Floatting Formats of StepWriter to the recorded parameters
+ void Perform (StepData_StepWriter& writer) const
+ {
+ writer.FloatWriter().SetFormat (themainform.ToCString());
+ writer.FloatWriter().SetZeroSuppress (thezerosup);
+ if (theformrange.Length() > 0) writer.FloatWriter().SetFormatForRange (theformrange.ToCString(), therangemin, therangemax);
}
+ //! Returns specific Label : for instance,
+ //! "Float Format [ZeroSuppress] %E [, in range R1-R2 %f]"
+ TCollection_AsciiString Label () const
+ {
+ TCollection_AsciiString lab("Float Format ");
+ if (thezerosup) lab.AssignCat(" ZeroSuppress");
+ lab.AssignCat (themainform);
+ if (theformrange.Length() > 0) {
+ char mess[30];
+ Sprintf(mess,", in range %f %f %s",
+ therangemin,therangemax,theformrange.ToCString());
+ lab.AssignCat(mess);
+ }
+ return lab;
+ }
+};
+static const STEPControl_FloatFormat gFloatFormat;*/
- Handle(STEPControl_ActorWrite) ActWrite = new STEPControl_ActorWrite;
- ActWrite->SetGroupMode (Interface_Static::IVal("write.step.assembly"));
- myAdaptorWrite = ActWrite;
+//=======================================================================
+//function : Constructor
+//purpose :
+//=======================================================================
+
+STEPControl_Controller::STEPControl_Controller ()
+: XSControl_Controller ("STEP")
+{
+ SetDumpLevels (1,2);
+ SetDumpHelp (0,"#id + Step Type");
+ SetDumpHelp (1,"Entity as in file");
+ SetDumpHelp (2,"Entity + shareds (level 1) as in file");
- Handle(STEPControl_WorkLibrary) swl = new STEPControl_WorkLibrary;
- swl->SetDumpLabel(1);
- myAdaptorLibrary = swl;
myAdaptorProtocol = StepAP214::Protocol();
myAdaptorRead = new STEPControl_ActorRead; // par ex pour Recognize
- SetModeWrite (0,4);
- SetModeWriteHelp (0,"As Is");
- SetModeWriteHelp (1,"Faceted Brep");
- SetModeWriteHelp (2,"Shell Based");
- SetModeWriteHelp (3,"Manifold Solid");
- SetModeWriteHelp (4,"Wireframe");
TraceStatic ("read.surfacecurve.mode",5);
}
-Handle(Interface_InterfaceModel) STEPControl_Controller::NewModel () const
+//=======================================================================
+//function : ReadFile
+//purpose :
+//=======================================================================
+
+Standard_Integer STEPControl_Controller::ReadFile (const Standard_CString theFileName, Handle(Interface_InterfaceModel)& theModel) const
+{
+ DeclareAndCast(StepData_Protocol,stepro,myAdaptorProtocol);
+ if (stepro.IsNull()) return 1;
+
+ Handle(StepData_StepModel) stepmodel = new StepData_StepModel;
+ theModel = stepmodel;
+
+ StepFile_ReadTrace (0);
+ char *pName=(char *)theFileName;
+ return StepFile_Read (pName,stepmodel,stepro);
+}
+
+//=======================================================================
+//function : WriteFile
+//purpose :
+//=======================================================================
+
+Standard_Boolean STEPControl_Controller::WriteFile (const Standard_CString theFileName, const Handle(Interface_InterfaceModel)& theModel, Interface_CheckIterator& theChecks) const
+{
+ // Preparation
+ DeclareAndCast(StepData_StepModel,stepmodel,theModel);
+ DeclareAndCast(StepData_Protocol,stepro,myAdaptorProtocol);
+ if (stepmodel.IsNull() || stepro.IsNull()) return Standard_False;
+
+ ofstream fout;
+ OSD_OpenStream(fout,theFileName,ios::out|ios::trunc);
+
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (!fout || !fout.rdbuf()->is_open()) {
+ theChecks.CCheck(0)->AddFail("Step File could not be created");
+ sout<<" Step File could not be created : " << theFileName << endl;
+ return 0;
+ }
+ sout << " Step File Name : "<<theFileName;
+
+ StepData_StepWriter SW(stepmodel);
+ sout<<"("<<stepmodel->NbEntities()<<" ents) ";
+
+// File Modifiers
+ //gFloatFormat.Perform(SW);
+// (impressions de mise au point)
+ //sout << " .. FileMod.1 " << gFloatFormat.Label();
+ //sout << " (all model)";
+
+// Envoi
+ SW.SendModel(stepro);
+ Interface_CheckIterator chl = SW.CheckList();
+ for (chl.Start(); chl.More(); chl.Next())
+ theChecks.CCheck(chl.Number())->GetMessages(chl.Value());
+ sout<<" Write ";
+ Standard_Boolean isGood = SW.Print(fout);
+ sout<<" Done"<<endl;
+
+ errno = 0;
+ fout.close();
+ isGood = fout.good() && isGood && !errno;
+ if(errno)
+ sout << strerror(errno) << endl;
+ return isGood;
+}
+
+//=======================================================================
+//function : DumpEntity
+//purpose :
+//=======================================================================
+
+void STEPControl_Controller::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
+{
+ Standard_Integer nument = model->Number(entity);
+ if (nument <= 0 || nument > model->NbEntities()) return;
+ Standard_Boolean iserr = model->IsRedefinedContent(nument);
+ Handle(Standard_Transient) ent, con; ent = entity;
+ S<<" --- (STEP) Entity "; model->Print(entity,S);
+ if (iserr) con = model->ReportEntity(nument)->Content();
+ if (entity.IsNull()) { S<<" Null"<<endl; return; }
+
+// On attaque le dump : d abord cas de l Erreur
+ S << " Type cdl : " << entity->DynamicType()->Name() << endl;
+ if (iserr)
+ S<<" *** NOT WELL LOADED : CONTENT FROM FILE ***"<<endl;
+ else if (model->IsUnknownEntity(nument))
+ S<<" *** UNKNOWN TYPE ***"<<endl;
+
+ StepData_StepDumper dump(GetCasted(StepData_StepModel,model),
+ GetCasted(StepData_Protocol,protocol),1);
+ dump.Dump(S,ent,level);
+}
+
+//=======================================================================
+//function : NewModel
+//purpose :
+//=======================================================================
+
+Handle(Interface_InterfaceModel) STEPControl_Controller::NewModel () const
{
APIHeaderSection_MakeHeader head;
return head.NewModel(StepAP214::Protocol());
}
+
+//=======================================================================
+//function : NewActorWrite
+//purpose :
+//=======================================================================
-// #### PROVISOIRE ??? ####
-
-IFSelect_ReturnStatus STEPControl_Controller::TransferWriteShape
- (const TopoDS_Shape& shape,
- const Handle(Transfer_FinderProcess)& FP,
- const Handle(Interface_InterfaceModel)& model,
- const Standard_Integer modeshape) const
+Handle(Transfer_ActorOfFinderProcess) STEPControl_Controller::NewActorWrite() const
{
- if (modeshape < 0 || modeshape > 4) return IFSelect_RetError;
- Handle(STEPControl_ActorWrite) ActWrite =
- Handle(STEPControl_ActorWrite)::DownCast(myAdaptorWrite);
-// A PRESENT ON PASSE PAR LE PROFILE
- if (!ActWrite.IsNull())
- ActWrite->SetGroupMode (Interface_Static::IVal("write.step.assembly"));
-
- return XSControl_Controller::TransferWriteShape (shape,FP,model,modeshape);
+ return new STEPControl_ActorWrite;
}
//=======================================================================
void STEPControl_Controller::Init ()
{
- static Standard_Boolean inic = Standard_False;
- if (!inic) {
- inic = Standard_True;
- Handle(STEPControl_Controller) STEPCTL = new STEPControl_Controller;
- STEPCTL->AutoRecord(); // avec les noms donnes a la construction
- XSAlgo::Init();
+ static Standard_Mutex gInitMutex;
+ static volatile bool gInitDone = false;
+ if (!gInitDone)
+ {
+ gInitMutex.Lock();
+ if (!gInitDone)
+ {
+ RWStepAP214::Init();
+
+ Interface_Static::Init ("step","write.step.product.name",'t',"Open CASCADE STEP translator " OCC_VERSION_STRING);
+ Interface_Static::Init ("step","write.step.assembly",'e',"");
+ Interface_Static::Init ("step","write.step.assembly",'&',"enum 0");
+ Interface_Static::Init ("step","write.step.assembly",'&',"eval Off");
+ Interface_Static::Init ("step","write.step.assembly",'&',"eval On");
+ Interface_Static::Init ("step","write.step.assembly",'&',"eval Auto");
+ Interface_Static::SetCVal("write.step.assembly","Auto");
+
+ Interface_Static::Init("step","step.angleunit.mode", 'e',"");
+ Interface_Static::Init("step","step.angleunit.mode", '&',"enum 0");
+ Interface_Static::Init("step","step.angleunit.mode", '&',"eval File");
+ Interface_Static::Init("step","step.angleunit.mode", '&',"eval Rad");
+ Interface_Static::Init("step","step.angleunit.mode", '&',"eval Deg");
+ Interface_Static::SetCVal("step.angleunit.mode","File");
+
+ Interface_Static::Init("step","write.step.schema", 'e',"");
+ Interface_Static::Init("step","write.step.schema",'&',"enum 1");
+ Interface_Static::Init("step","write.step.schema",'&',"eval AP214CD");
+ Interface_Static::Init("step","write.step.schema",'&',"eval AP214DIS");
+ Interface_Static::Init("step","write.step.schema",'&',"eval AP203");
+ Interface_Static::Init("step","write.step.schema",'&',"eval AP214IS");
+ Interface_Static::Init("step","write.step.schema",'&',"eval AP242DIS");
+ Interface_Static::SetCVal("write.step.schema","AP214IS");
+
+ // Type of Product Definition for reading
+ // Note: the numbers should be consistent with function FindShapeReprType()
+ // in STEPControl_ActorRead.cxx
+ Interface_Static::Init("step","read.step.shape.repr",'e',"");
+ Interface_Static::Init("step","read.step.shape.repr",'&',"enum 1");
+ Interface_Static::Init("step","read.step.shape.repr",'&',"eval All"); // 1
+ Interface_Static::Init("step","read.step.shape.repr",'&',"eval ABSR"); // 2
+ Interface_Static::Init("step","read.step.shape.repr",'&',"eval MSSR"); // 3
+ Interface_Static::Init("step","read.step.shape.repr",'&',"eval GBSSR"); // 4
+ Interface_Static::Init("step","read.step.shape.repr",'&',"eval FBSR"); // 5
+ Interface_Static::Init("step","read.step.shape.repr",'&',"eval EBWSR"); // 6
+ Interface_Static::Init("step","read.step.shape.repr",'&',"eval GBWSR"); // 7
+ Interface_Static::SetCVal("read.step.shape.repr","All");
+
+ // Mode for reading shapes attached to main SDR by SRR
+ // (hybrid model representation in AP203 since 1998)
+ Interface_Static::Init("step","read.step.shape.relationship",'e',"");
+ Interface_Static::Init("step","read.step.shape.relationship",'&',"enum 0");
+ Interface_Static::Init("step","read.step.shape.relationship",'&',"eval OFF");
+ Interface_Static::Init("step","read.step.shape.relationship",'&',"eval ON");
+ Interface_Static::SetCVal("read.step.shape.relationship","ON");
+
+ // Mode for reading shapes attached to Product by ShapeAspect
+ // (hybrid model representation in AP203 before 1998)
+ Interface_Static::Init("step","read.step.shape.aspect",'e',"");
+ Interface_Static::Init("step","read.step.shape.aspect",'&',"enum 0");
+ Interface_Static::Init("step","read.step.shape.aspect",'&',"eval OFF");
+ Interface_Static::Init("step","read.step.shape.aspect",'&',"eval ON");
+ Interface_Static::SetCVal("read.step.shape.aspect","ON");
+
+ // Mode for reading SDR and ShapeRepr if it is necessary
+ Interface_Static::Init("step","read.step.product.mode",'e',"");
+ Interface_Static::Init("step","read.step.product.mode",'&',"enum 0");
+ Interface_Static::Init("step","read.step.product.mode",'&',"eval OFF");
+ Interface_Static::Init("step","read.step.product.mode",'&',"eval ON");
+ Interface_Static::SetCVal("read.step.product.mode","ON");
+
+ // Order of reading ShapeDefinitionRepresentation in ProductDefinition
+ Interface_Static::Init("step","read.step.product.context",'e',"");
+ Interface_Static::Init("step","read.step.product.context",'&',"enum 1");
+ Interface_Static::Init("step","read.step.product.context",'&',"eval all"); // 1
+ Interface_Static::Init("step","read.step.product.context",'&',"eval design"); // 2
+ Interface_Static::Init("step","read.step.product.context",'&',"eval analysis");// 3
+ Interface_Static::SetCVal("read.step.product.context","all");
+
+ // What we try to read in ProductDefinition
+ Interface_Static::Init("step","read.step.assembly.level",'e',"");
+ Interface_Static::Init("step","read.step.assembly.level",'&',"enum 1");
+ Interface_Static::Init("step","read.step.assembly.level",'&',"eval all"); // 1
+ Interface_Static::Init("step","read.step.assembly.level",'&',"eval assembly"); // 2
+ Interface_Static::Init("step","read.step.assembly.level",'&',"eval structure");// 3
+ Interface_Static::Init("step","read.step.assembly.level",'&',"eval shape"); // 4
+ Interface_Static::SetCVal("read.step.assembly.level","all");
+
+ // unit: supposed to be cascade unit (target unit for reading)
+ Interface_Static::Init("step","write.step.unit", 'e',"");
+ Interface_Static::Init("step","write.step.unit",'&',"enum 1");
+ Interface_Static::Init("step","write.step.unit",'&',"eval INCH"); // 1
+ Interface_Static::Init("step","write.step.unit",'&',"eval MM"); // 2
+ Interface_Static::Init("step","write.step.unit",'&',"eval ??"); // 3
+ Interface_Static::Init("step","write.step.unit",'&',"eval FT"); // 4
+ Interface_Static::Init("step","write.step.unit",'&',"eval MI"); // 5
+ Interface_Static::Init("step","write.step.unit",'&',"eval M"); // 6
+ Interface_Static::Init("step","write.step.unit",'&',"eval KM"); // 7
+ Interface_Static::Init("step","write.step.unit",'&',"eval MIL"); // 8
+ Interface_Static::Init("step","write.step.unit",'&',"eval UM"); // 9
+ Interface_Static::Init("step","write.step.unit",'&',"eval CM"); //10
+ Interface_Static::Init("step","write.step.unit",'&',"eval UIN"); //11
+ Interface_Static::SetCVal ("write.step.unit","MM");
+
+ // Non-manifold topology reading: OFF by default (ssv; 26.11.2010)
+ Interface_Static::Init ("step","read.step.nonmanifold",'e',"");
+ Interface_Static::Init ("step","read.step.nonmanifold",'&',"enum 0");
+ Interface_Static::Init ("step","read.step.nonmanifold",'&',"eval Off");
+ Interface_Static::Init ("step","read.step.nonmanifold",'&',"eval On");
+ Interface_Static::SetIVal("read.step.nonmanifold",0);
+
+ // Non-manifold topology writing: OFF by default (ssv; 26.11.2010)
+ Interface_Static::Init ("step","write.step.nonmanifold",'e',"");
+ Interface_Static::Init ("step","write.step.nonmanifold",'&',"enum 0");
+ Interface_Static::Init ("step","write.step.nonmanifold",'&',"eval Off");
+ Interface_Static::Init ("step","write.step.nonmanifold",'&',"eval On");
+ Interface_Static::SetIVal("write.step.nonmanifold",0);
+
+ // I-Deas-like STEP processing: OFF by default (ssv; 22.11.2010)
+ Interface_Static::Init ("step","read.step.ideas",'e',"");
+ Interface_Static::Init ("step","read.step.ideas",'&',"enum 0");
+ Interface_Static::Init ("step","read.step.ideas",'&',"eval Off");
+ Interface_Static::Init ("step","read.step.ideas",'&',"eval On");
+ Interface_Static::SetIVal("read.step.ideas",0);
+
+ //Parameter to write all free vertices in one SDR (name and style of vertex are lost) (default)
+ //or each vertex in its own SDR (name and style of vertex are exported). (ika; 21.07.2014)
+ Interface_Static::Init ("step","write.step.vertex.mode",'e',"");
+ Interface_Static::Init ("step","write.step.vertex.mode",'&',"enum 0");
+ Interface_Static::Init ("step","write.step.vertex.mode",'&',"eval One Compound");
+ Interface_Static::Init ("step","write.step.vertex.mode",'&',"eval Single Vertex");
+ Interface_Static::SetIVal("write.step.vertex.mode",0);
+
+ // abv 15.11.00: ShapeProcessing
+ Interface_Static::Init ("XSTEP","write.step.resource.name",'t',"STEP");
+ Interface_Static::Init ("XSTEP","read.step.resource.name",'t',"STEP");
+ Interface_Static::Init ("XSTEP","write.step.sequence",'t',"ToSTEP");
+ Interface_Static::Init ("XSTEP","read.step.sequence",'t',"FromSTEP");
+
+ // ika 28.07.16: Paremeter to read all top level solids and shells,
+ // should be used only in case of invalid shape_representation without links to shapes.
+ Interface_Static::Init("step", "read.step.all.shapes", 'e', "");
+ Interface_Static::Init("step", "read.step.all.shapes", '&', "enum 0");
+ Interface_Static::Init("step", "read.step.all.shapes", '&', "eval Off");
+ Interface_Static::Init("step", "read.step.all.shapes", '&', "eval On");
+ Interface_Static::SetIVal("read.step.all.shapes", 0);
+
+ XSAlgo::Init();
+
+ Handle(STEPControl_Controller) aController = new STEPControl_Controller;
+ aController->AutoRecord();
+
+ gInitDone = true;
+ }
+ gInitMutex.Unlock();
}
}
#ifndef _STEPControl_Controller_HeaderFile
#define _STEPControl_Controller_HeaderFile
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
#include <XSControl_Controller.hxx>
-#include <IFSelect_ReturnStatus.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Boolean.hxx>
-class Interface_InterfaceModel;
-class Transfer_ActorOfTransientProcess;
-class XSControl_WorkSession;
-class TopoDS_Shape;
-class Transfer_FinderProcess;
-
-
-class STEPControl_Controller;
-DEFINE_STANDARD_HANDLE(STEPControl_Controller, XSControl_Controller)
//! defines basic controller for STEP processor
class STEPControl_Controller : public XSControl_Controller
{
public:
+ //! Reads a STEP File and returns a STEP Model (into <mod>),
+ //! or lets <mod> "Null" in case of Error
+ //! Returns 0 if OK, 1 if Read Error, -1 if File not opened
+ Standard_EXPORT virtual Standard_Integer ReadFile (const Standard_CString theFileName, Handle(Interface_InterfaceModel)& theModel) const Standard_OVERRIDE;
+
+ //! Writes a File from a STEP Model
+ //! Returns False (and writes no file) if <ctx> does not bring a
+ //! STEP Model
+ Standard_EXPORT virtual Standard_Boolean WriteFile (const Standard_CString theFileName, const Handle(Interface_InterfaceModel)& theModel, Interface_CheckIterator& theChecks) const Standard_OVERRIDE;
+
+ //! Dumps an entity under STEP form, i.e. as a part of a Step file
+ //! Works with a StepDumper.
+ //! Level 0 just displays type; level 1 displays the entity itself
+ //! and level 2 displays the entity plus its shared ones (one
+ //! sub-level : immediately shared entities)
+ 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 Standard_OVERRIDE;
+
//! Creates a new empty Model ready to receive data of the Norm.
//! It is taken from STEP Template Model
Standard_EXPORT virtual Handle(Interface_InterfaceModel) NewModel() const Standard_OVERRIDE;
- //! Takes one Shape and transfers it to the InterfaceModel
- //! (already created by NewModel for instance)
- //! <modeshape> is to be interpreted by each kind of XstepAdaptor
- //! Returns a status : 0 OK 1 No result 2 Fail -1 bad modeshape
- //! -2 bad model (requires a StepModel)
- //! modeshape : 1 Facetted BRep, 2 Shell, 3 Manifold Solid
- Standard_EXPORT virtual IFSelect_ReturnStatus TransferWriteShape (const TopoDS_Shape& shape, const Handle(Transfer_FinderProcess)& FP, const Handle(Interface_InterfaceModel)& model, const Standard_Integer modetrans = 0) const Standard_OVERRIDE;
+ //! Returns the Actor for Write attached to the pair (norm,appli)
+ Standard_EXPORT virtual Handle(Transfer_ActorOfFinderProcess) NewActorWrite() const Standard_OVERRIDE;
//! Standard Initialisation. It creates a Controller for STEP
//! and records it to various names, available to select it later
protected:
- //! Initializes the use of STEP Norm (the first time) and
- //! returns a Controller
+ //! Initializes the use of STEP Norm (the first time)
Standard_EXPORT STEPControl_Controller();
};
+++ /dev/null
-// 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 <STEPControl_FloatFormat.hxx>
-#include <StepData_StepWriter.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(STEPControl_FloatFormat,IFSelect_GeneralModifier)
-
-STEPControl_FloatFormat::STEPControl_FloatFormat ()
-: IFSelect_GeneralModifier (Standard_False),
- thezerosup (Standard_True) , themainform ("%E") ,
- theformrange ("%f") , therangemin (0.1) , therangemax (1000.)
-{}
-
-
-void STEPControl_FloatFormat::SetDefault (const Standard_Integer digits)
-{
- themainform.Clear();
- theformrange.Clear();
- if (digits <= 0) {
- themainform.AssignCat ("%E");
- theformrange.AssignCat ("%f");
- } else {
- char format[20];
- char pourcent = '%'; char point = '.';
- Sprintf(format, "%c%d%c%dE",pourcent,digits+2,point,digits);
- themainform.AssignCat (format);
- Sprintf(format, "%c%d%c%df",pourcent,digits+2,point,digits);
- theformrange.AssignCat (format);
- }
- therangemin = 0.1; therangemax = 1000.;
- thezerosup = Standard_True;
-}
-
-
-void STEPControl_FloatFormat::SetFormat (const Standard_CString format)
-{ themainform.Clear(); themainform.AssignCat(format); }
-
-
-void STEPControl_FloatFormat::SetFormatForRange
- (const Standard_CString form, const Standard_Real R1, const Standard_Real R2)
-{
- theformrange.Clear(); theformrange.AssignCat(form);
- therangemin = R1; therangemax = R2;
-}
-
-
-void STEPControl_FloatFormat::Format
- (Standard_Boolean& zerosup, TCollection_AsciiString& mainform,
- Standard_Boolean& hasrange, TCollection_AsciiString& formrange,
- Standard_Real& rangemin, Standard_Real& rangemax) const
-{
- zerosup = thezerosup;
- mainform = themainform;
- hasrange = (theformrange.Length() > 0);
- formrange = theformrange;
- rangemin = therangemin;
- rangemax = therangemax;
-}
-
-
-void STEPControl_FloatFormat::Perform (StepData_StepWriter& writer) const
-{
- writer.FloatWriter().SetFormat (themainform.ToCString());
- writer.FloatWriter().SetZeroSuppress (thezerosup);
- if (theformrange.Length() > 0) writer.FloatWriter().SetFormatForRange
- (theformrange.ToCString(), therangemin, therangemax);
-}
-
-
-TCollection_AsciiString STEPControl_FloatFormat::Label () const
-{
- TCollection_AsciiString lab("Float Format ");
- if (thezerosup) lab.AssignCat(" ZeroSuppress");
- lab.AssignCat (themainform);
- if (theformrange.Length() > 0) {
- char mess[30];
- Sprintf(mess,", in range %f %f %s",
- therangemin,therangemax,theformrange.ToCString());
- lab.AssignCat(mess);
- }
- return lab;
-}
+++ /dev/null
-// Created on: 1994-06-01
-// 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 _STEPControl_FloatFormat_HeaderFile
-#define _STEPControl_FloatFormat_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <IFSelect_GeneralModifier.hxx>
-class StepData_StepWriter;
-
-class STEPControl_FloatFormat;
-DEFINE_STANDARD_HANDLE(STEPControl_FloatFormat, IFSelect_GeneralModifier)
-
-//! This class gives control out format for floatting values :
-//! ZeroSuppress or no, Main Format, Format in Range (for values
-//! around 1.), as StepWriter allows to manage it.
-//! Formats are given under C-printf form
-class STEPControl_FloatFormat : public IFSelect_GeneralModifier
-{
- public:
-
- //! Creates a new FloatFormat, with standard options :
- //! ZeroSuppress, Main Format = %E,
- //! Format between 0.001 and 1000. = %f
- Standard_EXPORT STEPControl_FloatFormat();
-
- //! Sets FloatFormat to default value (see Create) but if <digits>
- //! is given positive, it commands Formats (main and range) to
- //! ensure <digits> significant digits to be displayed
- Standard_EXPORT void SetDefault (const Standard_Integer digits = 0);
-
- //! Sets ZeroSuppress mode to a new value
- void SetZeroSuppress (const Standard_Boolean mode) { thezerosup = mode; }
-
- //! Sets Main Format to a new value
- //! Remark : SetFormat, SetZeroSuppress and SetFormatForRange are
- //! independant
- Standard_EXPORT void SetFormat (const Standard_CString format = "%E");
-
- //! Sets Format for Range to a new value with its range of
- //! application.
- //! To cancel it, give format as "" (empty string)
- //! Remark that if the condition (0. < Rmin < Rmax) is not
- //! verified, this secondary format will be ignored.
- //! Moreover, this secondary format is intended to be used in a
- //! range around 1.
- Standard_EXPORT void SetFormatForRange (const Standard_CString format = "%f", const Standard_Real Rmin = 0.1, const Standard_Real Rmax = 1000.0);
-
- //! Returns all recorded parameters :
- //! zerosup : ZeroSuppress status
- //! mainform : Main Format (which applies out of the range, or
- //! for every real if no range is set)
- //! hasrange : True if a FormatInRange is set, False else
- //! (following parameters do not apply if it is False)
- //! forminrange : Secondary Format (it applies inside the range)
- //! rangemin, rangemax : the range in which the secondary format
- //! applies
- Standard_EXPORT void Format (Standard_Boolean& zerosup, TCollection_AsciiString& mainform, Standard_Boolean& hasrange, TCollection_AsciiString& forminrange, Standard_Real& rangemin, Standard_Real& rangemax) const;
-
- //! Sets the Floatting Formats of StepWriter to the recorded
- //! parameters
- Standard_EXPORT void Perform (StepData_StepWriter& writer) const;
-
- //! Returns specific Label : for instance,
- //! "Float Format [ZeroSuppress] %E [, in range R1-R2 %f]"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
- DEFINE_STANDARD_RTTIEXT(STEPControl_FloatFormat,IFSelect_GeneralModifier)
-
- private:
-
- Standard_Boolean thezerosup;
- TCollection_AsciiString themainform;
- TCollection_AsciiString theformrange;
- Standard_Real therangemin;
- Standard_Real therangemax;
-};
-
-#endif // _STEPControl_FloatFormat_HeaderFile
#include <TColStd_SequenceOfAsciiString.hxx>
#include <Transfer_TransientProcess.hxx>
#include <XSControl_Controller.hxx>
-#include <XSControl_TransferReader.hxx>
#include <XSControl_WorkSession.hxx>
//=======================================================================
STEPControl_Reader::STEPControl_Reader ()
{
STEPControl_Controller::Init();
- SetNorm ("STEP");
+ SetNorm("STEP");
}
//=======================================================================
//purpose :
//=======================================================================
-STEPControl_Reader::STEPControl_Reader
- (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch)
+STEPControl_Reader::STEPControl_Reader (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch)
{
STEPControl_Controller::Init();
- SetWS (WS,scratch);
- SetNorm ("STEP");
+ SetWS(WS,scratch);
+ SetNorm("STEP");
}
//=======================================================================
Interface_EntityIterator aShareds = WS()->Graph().Sharings(ent);
if (!aShareds.More()) {
theroots.Append(ent);
- WS()->TransferReader()->TransientProcess()->RootsForTransfer().Append(ent);
+ WS()->ReaderProcess()->RootsForTransfer().Append(ent);
}
}
if (ent->IsKind(STANDARD_TYPE(StepShape_ShellBasedSurfaceModel))) {
Interface_EntityIterator aShareds = WS()->Graph().Sharings(ent);
if (!aShareds.More()) {
theroots.Append(ent);
- WS()->TransferReader()->TransientProcess()->RootsForTransfer().Append(ent);
+ WS()->ReaderProcess()->RootsForTransfer().Append(ent);
}
}
}
//}
if (IsRoot) {
theroots.Append(ent);
- WS()->TransferReader()->TransientProcess()->RootsForTransfer().Append(ent);
+ WS()->ReaderProcess()->RootsForTransfer().Append(ent);
}
}
TCollection_AsciiString aProdMode = Interface_Static::CVal("read.step.product.mode");
}
if(IsRoot) {
theroots.Append(ent);
- WS()->TransferReader()->TransientProcess()->RootsForTransfer().Append(ent);
+ WS()->ReaderProcess()->RootsForTransfer().Append(ent);
}
}
if(ent->IsKind(STANDARD_TYPE(StepShape_ShapeRepresentation))) {
}
if(IsRoot) {
theroots.Append(ent);
- WS()->TransferReader()->TransientProcess()->RootsForTransfer().Append(ent);
+ WS()->ReaderProcess()->RootsForTransfer().Append(ent);
}
}
}
}
-
return theroots.Length();
}
//! shape obtained from it.
//! Handle(XSControl_WorkSession)
//! WS = reader.WS();
-//! if ( WS->TransferReader()->HasResult(ent) )
-//! TopoDS_Shape shape = WS->TransferReader()->ShapeResult(ent);
+//! if ( WS->ReaderProcess()->HasResult(ent) )
+//! TopoDS_Shape shape = WS->ReaderProcess()->ShapeResult(ent);
class STEPControl_Reader : public XSControl_Reader
{
public:
+++ /dev/null
-// 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 <IFSelect_ContextWrite.hxx>
-#include <IFSelect_GeneralModifier.hxx>
-#include <Interface_Check.hxx>
-#include <Interface_CheckIterator.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Interface_ParamType.hxx>
-#include <Interface_Protocol.hxx>
-#include <Interface_ReportEntity.hxx>
-#include <Interface_UndefinedContent.hxx>
-#include <Message.hxx>
-#include <Message_Messenger.hxx>
-#include <OSD_OpenFile.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <StepData_Protocol.hxx>
-#include <StepData_StepDumper.hxx>
-#include <StepData_StepModel.hxx>
-#include <StepData_StepWriter.hxx>
-#include <StepData_UndefinedEntity.hxx>
-#include <StepFile_Read.hxx>
-#include <STEPControl_FloatFormat.hxx>
-#include <STEPControl_WorkLibrary.hxx>
-#include <TCollection_HAsciiString.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-
-#include <errno.h>
-#include <sys/stat.h>
-IMPLEMENT_STANDARD_RTTIEXT(STEPControl_WorkLibrary,IFSelect_WorkLibrary)
-
-STEPControl_WorkLibrary::STEPControl_WorkLibrary
- (const Standard_Boolean copymode)
- : thecopymode (copymode) , thelabmode (0)
-{
- SetDumpLevels (1,2);
- SetDumpHelp (0,"#id + Step Type");
- SetDumpHelp (1,"Entity as in file");
- SetDumpHelp (2,"Entity + shareds (level 1) as in file");
-}
-// rq : les init sont faits par ailleurs, pas de souci a se faire
-
-
-Standard_Integer STEPControl_WorkLibrary::ReadFile
- (const Standard_CString name,
- Handle(Interface_InterfaceModel)& model,
- const Handle(Interface_Protocol)& protocol) const
-{
- long status = 1;
- DeclareAndCast(StepData_Protocol,stepro,protocol);
- if (stepro.IsNull()) return 1;
- Handle(StepData_StepModel) stepmodel = new StepData_StepModel;
- model = stepmodel;
- StepFile_ReadTrace (0);
- char *pName=(char *)name;
- status = StepFile_Read (pName,stepmodel,stepro);
- return status;
-}
-
-
-Standard_Boolean STEPControl_WorkLibrary::WriteFile
- (IFSelect_ContextWrite& ctx) const
-{
-// Preparation
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- DeclareAndCast(StepData_StepModel,stepmodel,ctx.Model());
- DeclareAndCast(StepData_Protocol,stepro,ctx.Protocol());
- if (stepmodel.IsNull() || stepro.IsNull()) return Standard_False;
-
- ofstream fout;
- OSD_OpenStream(fout,ctx.FileName(),ios::out|ios::trunc);
-
- if (!fout || !fout.rdbuf()->is_open()) {
- ctx.CCheck(0)->AddFail("Step File could not be created");
- sout<<" Step File could not be created : " << ctx.FileName() << endl; return 0;
- }
- sout << " Step File Name : "<<ctx.FileName();
- StepData_StepWriter SW(stepmodel);
- sout<<"("<<stepmodel->NbEntities()<<" ents) ";
-
-// File Modifiers
- Standard_Integer nbmod = ctx.NbModifiers();
- for (Standard_Integer numod = 1; numod <= nbmod; numod ++) {
- ctx.SetModifier (numod);
- DeclareAndCast(STEPControl_FloatFormat,filemod,ctx.FileModifier());
- if (!filemod.IsNull()) filemod->Perform(SW);
-// (impressions de mise au point)
- sout << " .. FileMod." << numod << filemod->Label();
- if (ctx.IsForAll()) sout << " (all model)";
- else sout << " (" << ctx.NbEntities() << " entities)";
- }
-
-// Envoi
- SW.SendModel(stepro);
- Interface_CheckIterator chl = SW.CheckList();
- for (chl.Start(); chl.More(); chl.Next())
- ctx.CCheck(chl.Number())->GetMessages(chl.Value());
- sout<<" Write ";
- Standard_Boolean isGood = SW.Print(fout);
- sout<<" Done"<<endl;
-
- errno = 0;
- fout.close();
- isGood = fout.good() && isGood && !errno;
- if(errno)
- sout << strerror(errno) << endl;
- return isGood;
-}
-
-
-Standard_Boolean STEPControl_WorkLibrary::CopyModel
- (const Handle(Interface_InterfaceModel)& original,
- const Handle(Interface_InterfaceModel)& newmodel,
- const Interface_EntityIterator& list,
- Interface_CopyTool& TC) const
-{
- if (thecopymode) return
- IFSelect_WorkLibrary::CopyModel (original,newmodel,list,TC);
- return thecopymode;
-}
-
-
-void STEPControl_WorkLibrary::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
-{
- Standard_Integer nument = model->Number(entity);
- if (nument <= 0 || nument > model->NbEntities()) return;
- Standard_Boolean iserr = model->IsRedefinedContent(nument);
- Handle(Standard_Transient) ent, con; ent = entity;
- S<<" --- (STEP) Entity "; model->Print(entity,S);
- if (iserr) con = model->ReportEntity(nument)->Content();
- if (entity.IsNull()) { S<<" Null"<<endl; return; }
-
-// On attaque le dump : d abord cas de l Erreur
- S << " Type cdl : " << entity->DynamicType()->Name() << endl;
- if (iserr)
- S<<" *** NOT WELL LOADED : CONTENT FROM FILE ***"<<endl;
- else if (model->IsUnknownEntity(nument))
- S<<" *** UNKNOWN TYPE ***"<<endl;
-
- StepData_StepDumper dump(GetCasted(StepData_StepModel,model),
- GetCasted(StepData_Protocol,protocol),thelabmode);
- dump.Dump(S,ent,level);
-}
+++ /dev/null
-// Created on: 1994-09-14
-// 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 _STEPControl_WorkLibrary_HeaderFile
-#define _STEPControl_WorkLibrary_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-#include <IFSelect_WorkLibrary.hxx>
-#include <Standard_CString.hxx>
-class Interface_InterfaceModel;
-class Interface_Protocol;
-class IFSelect_ContextWrite;
-class Interface_EntityIterator;
-class Interface_CopyTool;
-class Standard_Transient;
-class Message_Messenger;
-
-
-class STEPControl_WorkLibrary;
-DEFINE_STANDARD_HANDLE(STEPControl_WorkLibrary, IFSelect_WorkLibrary)
-
-//! Performs Read and Write a STEP File with a STEP Model
-//! Following the protocols, Copy may be implemented or not
-class STEPControl_WorkLibrary : public IFSelect_WorkLibrary
-{
- public:
-
- //! Creates a STEP WorkLibrary
- //! <copymode> precises whether Copy is implemented or not
- Standard_EXPORT STEPControl_WorkLibrary(const Standard_Boolean copymode = Standard_True);
-
- //! Selects a mode to dump entities
- //! 0 (D) : prints numbers, then displays table number/label
- //! 1 : prints labels, then displays table label/number
- //! 2 : prints labels onky
- void SetDumpLabel (const Standard_Integer mode) { thelabmode = mode; }
-
- //! Reads a STEP File and returns a STEP Model (into <mod>),
- //! or lets <mod> "Null" in case of Error
- //! Returns 0 if OK, 1 if Read Error, -1 if File not opened
- Standard_EXPORT Standard_Integer ReadFile (const Standard_CString name, Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol) const Standard_OVERRIDE;
-
- //! Writes a File from a STEP Model
- //! Returns False (and writes no file) if <ctx> does not bring a
- //! STEP Model
- Standard_EXPORT Standard_Boolean WriteFile (IFSelect_ContextWrite& ctx) const Standard_OVERRIDE;
-
- //! Performs the copy of entities from an original model to a new
- //! one. Works according <copymode> :
- //! if True, standard copy is run
- //! else nothing is done and returned value is 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 Standard_OVERRIDE;
-
- //! Dumps an entity under STEP form, i.e. as a part of a Step file
- //! Works with a StepDumper.
- //! Level 0 just displays type; level 1 displays the entity itself
- //! and level 2 displays the entity plus its shared ones (one
- //! sub-level : immediately shared entities)
- 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 Standard_Integer level) const Standard_OVERRIDE;
-
- DEFINE_STANDARD_RTTIEXT(STEPControl_WorkLibrary,IFSelect_WorkLibrary)
-
- private:
-
- Standard_Boolean thecopymode;
- Standard_Integer thelabmode;
-};
-
-#endif // _STEPControl_WorkLibrary_HeaderFile
#include <Interface_InterfaceModel.hxx>
#include <Interface_Macros.hxx>
+#include <Interface_Static.hxx>
#include <Message_ProgressIndicator.hxx>
#include <STEPControl_ActorWrite.hxx>
#include <STEPControl_Controller.hxx>
//=======================================================================
STEPControl_Writer::STEPControl_Writer ()
+: XSControl_Writer(new XSControl_WorkSession)
{
STEPControl_Controller::Init();
- SetWS (new XSControl_WorkSession);
+ myWS->SelectNorm("STEP");
+ myWS->NewModel();
}
//purpose :
//=======================================================================
-STEPControl_Writer::STEPControl_Writer (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch)
+STEPControl_Writer::STEPControl_Writer (const Handle(XSControl_WorkSession)& theWS, const Standard_Boolean FromScratch)
+: XSControl_Writer(theWS)
{
STEPControl_Controller::Init();
- SetWS (WS,scratch);
+ myWS->InitTransferReader(0);
+ myWS->SelectNorm("STEP");
+ Handle(StepData_StepModel) model = Model(FromScratch);
}
void STEPControl_Writer::SetWS(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch)
{
- thesession = WS;
- thesession->SelectNorm("STEP");
- thesession->InitTransferReader(0);
- Handle(StepData_StepModel) model = Model (scratch);
+ myWS = WS;
+ myWS->InitTransferReader(0);
+ myWS->SelectNorm("STEP");
+ Handle(StepData_StepModel) model = Model(scratch);
}
//purpose :
//=======================================================================
-Handle(StepData_StepModel) STEPControl_Writer::Model (const Standard_Boolean newone)
+Handle(StepData_StepModel) STEPControl_Writer::Model (const Standard_Boolean newone) const
{
- DeclareAndCast(StepData_StepModel,model,thesession->Model());
+ DeclareAndCast(StepData_StepModel,model,myWS->Model());
if (newone || model.IsNull())
- model = GetCasted(StepData_StepModel,thesession->NewModel());
+ model = GetCasted(StepData_StepModel,myWS->NewModel());
return model;
}
-//=======================================================================
-//function : SetTolerance
-//purpose :
-//=======================================================================
-
-void STEPControl_Writer::SetTolerance (const Standard_Real Tol)
-{
- DeclareAndCast(STEPControl_ActorWrite,act,WS()->NormAdaptor()->ActorWrite());
- if (!act.IsNull()) act->SetTolerance (Tol);
-}
-
-
//=======================================================================
//function : Transfer
//purpose :
//=======================================================================
-IFSelect_ReturnStatus STEPControl_Writer::Transfer
- (const TopoDS_Shape& sh, const STEPControl_StepModelType mode,
- const Standard_Boolean compgraph)
+Interface_ReturnStatus STEPControl_Writer::Transfer (const TopoDS_Shape& theShape, const STEPControl_StepModelType theMode, const Standard_Boolean theCompGraph)
{
Standard_Integer mws = -1;
- switch (mode) {
+ switch (theMode)
+ {
case STEPControl_AsIs : mws = 0; break;
case STEPControl_FacetedBrep : mws = 1; break;
case STEPControl_ShellBasedSurfaceModel : mws = 2; break;
case STEPControl_ManifoldSolidBrep : mws = 3; break;
case STEPControl_GeometricCurveSet : mws = 4; break;
- default : break;
+ default : return Interface_RetError;
}
- if (mws < 0) return IFSelect_RetError; // cas non reconnu
- thesession->TransferWriter()->SetTransferMode (mws);
+
+ const Handle(Transfer_FinderProcess) &aWP = myWS->WriterProcess();
// for progress indicator.
- Handle(Message_ProgressIndicator) progress = WS()->TransferWriter()->FinderProcess()->GetProgress();
- if ( ! progress.IsNull() ) {
+ const Handle(Message_ProgressIndicator) &progress = aWP->GetProgress();
+ if ( !progress.IsNull() )
+ {
Standard_Integer nbfaces=0;
- for( TopExp_Explorer exp(sh, TopAbs_FACE); exp.More(); exp.Next()) nbfaces++;
+ for( TopExp_Explorer exp(theShape, TopAbs_FACE); exp.More(); exp.Next()) nbfaces++;
progress->SetScale ( "Face", 0, nbfaces, 1 );
progress->Show();
}
- return thesession->TransferWriteShape(sh,compgraph);
-}
+ Handle(STEPControl_ActorWrite) anActor = Handle(STEPControl_ActorWrite)::DownCast(aWP->GetActor());
+ if (anActor.IsNull())
+ {
+ const Handle(XSControl_Controller) &aController = myWS->NormAdaptor();
+ if (aController.IsNull()) return Interface_RetError;
+ anActor = Handle(STEPControl_ActorWrite)::DownCast(aController->NewActorWrite());
+ aWP->SetActor(anActor);
+ }
-//=======================================================================
-//function : Write
-//purpose :
-//=======================================================================
+ anActor->SetTolerance(myTolerance);
-IFSelect_ReturnStatus STEPControl_Writer::Write (const Standard_CString filename)
-{
- return thesession->SendAll(filename);
+ anActor->SetTransferMode(mws);
+
+ anActor->SetGroupMode(Interface_Static::IVal("write.step.assembly"));
+
+ return XSControl_Writer::TransferShape(theShape,theCompGraph);
}
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
-#include <IFSelect_ReturnStatus.hxx>
+#include <XSControl_Writer.hxx>
#include <STEPControl_StepModelType.hxx>
-#include <Standard_CString.hxx>
-class XSControl_WorkSession;
class StepData_StepModel;
-class TopoDS_Shape;
//! This class creates and writes
//! STEP files from Open CASCADE models. A STEP file can be
//! written to an existing STEP file or to a new one.
//! Translation can be performed in one or several operations. Each
//! translation operation outputs a distinct root entity in the STEP file.
-class STEPControl_Writer
+class STEPControl_Writer : protected XSControl_Writer
{
public:
//! Creates a Writer from scratch
Standard_EXPORT STEPControl_Writer();
- //! Creates a Writer from an already existing Session
- //! If <scratch> is True (D), clears already recorded data
- Standard_EXPORT STEPControl_Writer(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
-
- //! Sets a length-measure value that
- //! will be written to uncertainty-measure-with-unit
- //! when the next shape is translated.
- Standard_EXPORT void SetTolerance (const Standard_Real Tol);
+ //! Creates a Writer from an already existing Process
+ //! If <FromScratch> is True, clears already recorded data
+ Standard_EXPORT STEPControl_Writer(const Handle(XSControl_WorkSession)& theWS, const Standard_Boolean FromScratch = Standard_True);
+ //! Sets a length-measure value that will be written
+ //! to uncertainty-measure-with-unit when the next shape is translated.
+ void SetTolerance (const Standard_Real theTolerance) { myTolerance = theTolerance; }
+
//! Unsets the tolerance formerly forced by SetTolerance
- void UnsetTolerance() { SetTolerance (-1.); }
+ void UnsetTolerance() { myTolerance = -1.; }
//! Sets a specific session to <me>
Standard_EXPORT void SetWS (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
//! Returns the session used in <me>
- const Handle(XSControl_WorkSession) & WS() const { return thesession; }
+ const Handle(XSControl_WorkSession) & WS() const { return XSControl_Writer::WS(); }
- //! Returns the produced model. Produces a new one if not yet done
- //! or if <newone> is True
- //! This method allows for instance to edit product or header
- //! data before writing.
- Standard_EXPORT Handle(StepData_StepModel) Model (const Standard_Boolean newone = Standard_False);
+ //! Returns the source model.
+ //! Produces a new one if not yet done or if <newone> is True.
+ //! This method allows for instance to edit product or header data before writing.
+ Standard_EXPORT Handle(StepData_StepModel) Model (const Standard_Boolean newone = Standard_False) const;
//! Translates shape sh to a STEP
//! entity. mode defines the STEP entity type to be output:
//! shell_based_surface_model entity.
//! - STEPControlStd_GeometricCurveSet translates a shape into a STEP
//! geometric_curve_set entity.
- Standard_EXPORT IFSelect_ReturnStatus Transfer (const TopoDS_Shape& sh, const STEPControl_StepModelType mode, const Standard_Boolean compgraph = Standard_True);
+ Standard_EXPORT Interface_ReturnStatus Transfer (const TopoDS_Shape& theShape, const STEPControl_StepModelType theMode, const Standard_Boolean theCompGraph = Standard_True);
//! Writes a STEP model in the file identified by filename.
- Standard_EXPORT IFSelect_ReturnStatus Write (const Standard_CString filename);
+ Interface_ReturnStatus Write (const Standard_CString filename) { return XSControl_Writer::WriteFile(filename); }
- private:
+ protected:
- Handle(XSControl_WorkSession) thesession;
+ Standard_Real myTolerance;
};
#endif // _STEPControl_Writer_HeaderFile
+++ /dev/null
-STEPEdit_EditContext.cxx
-STEPEdit_EditContext.hxx
-STEPEdit_EditSDR.cxx
-STEPEdit_EditSDR.hxx
+++ /dev/null
-// 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 <IFSelect_EditForm.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_TypedValue.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <StepBasic_ApplicationProtocolDefinition.hxx>
-#include <STEPConstruct_ContextTool.hxx>
-#include <StepData_StepModel.hxx>
-#include <STEPEdit_EditContext.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(STEPEdit_EditContext,IFSelect_Editor)
-
-STEPEdit_EditContext::STEPEdit_EditContext ()
-: IFSelect_Editor (5)
-{
- Handle(Interface_TypedValue) ac_val = new Interface_TypedValue("Application Context",Interface_ParamIdent);
- SetValue(1,ac_val,"AC",IFSelect_EditRead);
-
- Handle(Interface_TypedValue) ac_status = new Interface_TypedValue("AppliContext_Status");
- SetValue(2,ac_status,"AC_Status");
- Handle(Interface_TypedValue) ac_sche = new Interface_TypedValue("AppliContext_Schema");
- SetValue(3,ac_sche,"AC_Schema");
- Handle(Interface_TypedValue) ac_year = new Interface_TypedValue("AppliContext_Year",Interface_ParamInteger);
- SetValue(4,ac_year,"AC_Year");
- Handle(Interface_TypedValue) ac_name = new Interface_TypedValue("AppliContext_Name");
- SetValue(5,ac_name,"AC_Name");
-
-// Handle(Interface_TypedValue) prpc_val = new Interface_TypedValue("Product Related Product Category",Interface_ParamIdent);
-// SetValue(6,ac_val,"PRPC",IFSelect_EditRead);
-
-// Handle(Interface_TypedValue) prpc_name = new Interface_TypedValue("PRPC_Name");
-// SetValue(7,prpc_name,"PRPC_Name");
-// Handle(Interface_TypedValue) prpc_descr = new Interface_TypedValue("PRPC_Description");
-// SetValue(8,prpc_descr,"PRPC_Descr");
-}
-
-TCollection_AsciiString STEPEdit_EditContext::Label () const
-{ return TCollection_AsciiString ("STEP : Product Definition Context"); }
-
-Standard_Boolean STEPEdit_EditContext::Recognize
-(const Handle(IFSelect_EditForm)& /*form*/) const
-{
-// il faut 17 parametres
- return Standard_True;
-}
-
-Handle(TCollection_HAsciiString) STEPEdit_EditContext::StringValue
-(const Handle(IFSelect_EditForm)& /*form*/, const Standard_Integer num) const
-{
- Handle(TCollection_HAsciiString) str;
- switch (num) {
- case 2 : return new TCollection_HAsciiString("DIS");
- case 3 : return new TCollection_HAsciiString("automotive_design");
- case 4 : return new TCollection_HAsciiString("1998");
- case 5 : return new TCollection_HAsciiString("EUCLID");
- case 7 : return new TCollection_HAsciiString("Undefined Category");
- case 8 : return new TCollection_HAsciiString("Undefined Description");
- default : break;
- }
- return str;
-}
-
-Standard_Boolean STEPEdit_EditContext::Load
-(const Handle(IFSelect_EditForm)& form,
- const Handle(Standard_Transient)& /*ent*/,
- const Handle(Interface_InterfaceModel)& model) const
-{
- Handle(StepData_StepModel) modl =
- Handle(StepData_StepModel)::DownCast(model);
- if (modl.IsNull()) return Standard_False;
-
- STEPConstruct_ContextTool ctx (modl);
-
- form->LoadValue (1, modl->StringLabel(ctx.GetAPD()) );
-
- form->LoadValue (2, ctx.GetACstatus());
- form->LoadValue (3, ctx.GetACschemaName());
- form->LoadValue (4, new TCollection_HAsciiString(ctx.GetACyear()) );
- form->LoadValue (5, ctx.GetACname());
-
-// form->LoadValue (6, modl->StringLabel(ctx.GetPRPC()) );
-
-// form->LoadValue (7, ctx.GetPRPCName());
-// form->LoadValue (8, ctx.GetPRPCDescription());
-
- return Standard_True;
-}
-
-Standard_Boolean STEPEdit_EditContext::Apply
-(const Handle(IFSelect_EditForm)& form,
- const Handle(Standard_Transient)& /*ent*/,
- const Handle(Interface_InterfaceModel)& model) const
-{
- Handle(StepData_StepModel) modl =
- Handle(StepData_StepModel)::DownCast(model);
- if (modl.IsNull()) return Standard_False;
-
- STEPConstruct_ContextTool ctx (modl);
-
- ctx.AddAPD(); // on ne sait jamais
-// ctx.AddPRPC();
-
- if (form->IsModified(2)) ctx.SetACstatus (form->EditedValue(2));
- if (form->IsModified(3)) ctx.SetACschemaName (form->EditedValue(3));
- if (form->IsModified(4)) ctx.SetACyear(form->EditedValue(4)->IntegerValue());
- if (form->IsModified(5)) ctx.SetACname (form->EditedValue(5));
-
-// if (form->IsModified(7)) ctx.SetPRPCName (form->EditedValue(7));
-// if (form->IsModified(8)) ctx.SetPRPCDescription (form->EditedValue(8));
-
- return Standard_True;
-}
+++ /dev/null
-// Created on: 1998-07-29
-// 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 _STEPEdit_EditContext_HeaderFile
-#define _STEPEdit_EditContext_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Editor.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-class TCollection_AsciiString;
-class IFSelect_EditForm;
-class TCollection_HAsciiString;
-class Standard_Transient;
-class Interface_InterfaceModel;
-
-
-class STEPEdit_EditContext;
-DEFINE_STANDARD_HANDLE(STEPEdit_EditContext, IFSelect_Editor)
-
-//! EditContext is an Editor fit for
-//! Product Definition Context (one per Model) , i.e. :
-//! - ProductDefinition
-//! - ApplicationProtocolDefinition
-//! - ProductRelatedProductCategory
-class STEPEdit_EditContext : public IFSelect_Editor
-{
-
-public:
-
-
- Standard_EXPORT STEPEdit_EditContext();
-
- 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 Apply (const Handle(IFSelect_EditForm)& form, const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) 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;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(STEPEdit_EditContext,IFSelect_Editor)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _STEPEdit_EditContext_HeaderFile
+++ /dev/null
-// 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 <IFSelect_EditForm.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_TypedValue.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <STEPConstruct_Part.hxx>
-#include <StepData_StepModel.hxx>
-#include <STEPEdit_EditSDR.hxx>
-#include <StepShape_ShapeDefinitionRepresentation.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(STEPEdit_EditSDR,IFSelect_Editor)
-
-STEPEdit_EditSDR::STEPEdit_EditSDR ()
-: IFSelect_Editor (11)
-{
- Handle(Interface_TypedValue) pdc_name = new Interface_TypedValue("PDC_Name");
- SetValue (1,pdc_name,"PDC_Name");
- Handle(Interface_TypedValue) pdc_lfs = new Interface_TypedValue("PDC_LifeCycleStage");
- SetValue(2,pdc_lfs,"PDC_Stage");
- Handle(Interface_TypedValue) pdc_descr = new Interface_TypedValue("PDC_Description");
- SetValue(3,pdc_descr,"PDC_Descr");
-
- Handle(Interface_TypedValue) pv_vid = new Interface_TypedValue("P_Version_Id");
- SetValue(4,pv_vid,"PV_Id");
- Handle(Interface_TypedValue) pv_descr = new Interface_TypedValue("P_Version_Description");
- SetValue(5,pv_descr,"PV_Descr");
-
- Handle(Interface_TypedValue) pid = new Interface_TypedValue("Product_Id");
- SetValue(6,pid,"P_Id");
- Handle(Interface_TypedValue) pname = new Interface_TypedValue("Product_Name");
- SetValue(7,pname,"P_Name");
- Handle(Interface_TypedValue) pdescr = new Interface_TypedValue("Product_Description");
- SetValue(8,pdescr,"P_Descr");
-
- Handle(Interface_TypedValue) pc_name = new Interface_TypedValue("P_Context_Name");
- SetValue(9,pc_name,"PC_Name");
- Handle(Interface_TypedValue) pc_disc = new Interface_TypedValue("P_Context_Discipline");
- SetValue(10,pc_disc,"PC_Disc");
-
- Handle(Interface_TypedValue) ac_ap = new Interface_TypedValue("Application");
- SetValue(11,ac_ap,"Appli");
-
-
-// ?? :
-//Handle(TCollection_HAsciiString) StepPDR_SDRtool::PDSname() const
-//Handle(TCollection_HAsciiString) StepPDR_SDRtool::PDSdescription() const
-//Handle(TCollection_HAsciiString) StepPDR_SDRtool::PDdescription() const
-
-}
-
-TCollection_AsciiString STEPEdit_EditSDR::Label () const
-{ return TCollection_AsciiString ("STEP : Product Data (SDR)"); }
-
-Standard_Boolean STEPEdit_EditSDR::Recognize
-(const Handle(IFSelect_EditForm)& /*form*/) const
-{
-// il faut 10 parametres
- return Standard_True;
-}
-
-Handle(TCollection_HAsciiString) STEPEdit_EditSDR::StringValue
-(const Handle(IFSelect_EditForm)& /*form*/, const Standard_Integer num) const
-{
- Handle(TCollection_HAsciiString) str;
- switch (num) {
- case 1 : return new TCollection_HAsciiString("as proposed");
- case 2 : return new TCollection_HAsciiString("First_Design");
- case 3 : return new TCollection_HAsciiString("void");
- case 4 : return new TCollection_HAsciiString("ID");
- case 5 : return new TCollection_HAsciiString("void");
- case 8 : return new TCollection_HAsciiString("void");
- case 9 : return new TCollection_HAsciiString("Mechanical");
- case 10 : return new TCollection_HAsciiString("Assembly");
- case 11 : return new TCollection_HAsciiString("EUCLID");
- default : break;
- }
- return str;
-}
-
-Standard_Boolean STEPEdit_EditSDR::Load
-(const Handle(IFSelect_EditForm)& form,
- const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& model) const
-{
- Handle(StepShape_ShapeDefinitionRepresentation) sdr =
- Handle(StepShape_ShapeDefinitionRepresentation)::DownCast (ent);
- Handle(StepData_StepModel) modl =
- Handle(StepData_StepModel)::DownCast(model);
- if (sdr.IsNull() || modl.IsNull()) return Standard_False;
-
- STEPConstruct_Part ctx;
- ctx.ReadSDR (sdr);
-
- form->LoadValue (1, ctx.PDCname());
- form->LoadValue (2, ctx.PDCstage());
- form->LoadValue (3, ctx.PDdescription());
-
- form->LoadValue (4, ctx.PDFid());
- form->LoadValue (5, ctx.PDFdescription());
-
- form->LoadValue (6, ctx.Pid());
- form->LoadValue (7, ctx.Pname());
- form->LoadValue (8, ctx.Pdescription());
-
- form->LoadValue (9, ctx.PCname());
- form->LoadValue (10, ctx.PCdisciplineType());
-
- form->LoadValue (11, ctx.ACapplication());
-
- return Standard_True;
-}
-
-Standard_Boolean STEPEdit_EditSDR::Apply
-(const Handle(IFSelect_EditForm)& form,
- const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& model) const
-{
- Handle(StepShape_ShapeDefinitionRepresentation) sdr =
- Handle(StepShape_ShapeDefinitionRepresentation)::DownCast (ent);
- Handle(StepData_StepModel) modl =
- Handle(StepData_StepModel)::DownCast(model);
- if (sdr.IsNull() || modl.IsNull()) return Standard_False;
-
- STEPConstruct_Part ctx;
- ctx.ReadSDR (sdr);
-
- if (form->IsModified(1)) ctx.SetPDCname (form->EditedValue(1));
- if (form->IsModified(2)) ctx.SetPDCstage (form->EditedValue(2));
- if (form->IsModified(3)) ctx.SetPDdescription (form->EditedValue(3));
-
- if (form->IsModified(4)) ctx.SetPDFid (form->EditedValue(4));
- if (form->IsModified(5)) ctx.SetPDFdescription (form->EditedValue(5));
-
- if (form->IsModified(6)) ctx.SetPid (form->EditedValue(6));
- if (form->IsModified(7)) ctx.SetPname (form->EditedValue(7));
- if (form->IsModified(8)) ctx.SetPdescription (form->EditedValue(8));
-
- if (form->IsModified(9)) ctx.SetPCname (form->EditedValue(9));
- if (form->IsModified(10)) ctx.SetPCdisciplineType (form->EditedValue(10));
-
- if (form->IsModified(11)) ctx.SetACapplication (form->EditedValue(11));
-
- return Standard_True;
-}
+++ /dev/null
-// Created on: 1998-07-29
-// Created by: Administrateur Atelier XSTEP
-// 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 _STEPEdit_EditSDR_HeaderFile
-#define _STEPEdit_EditSDR_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Editor.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-class TCollection_AsciiString;
-class IFSelect_EditForm;
-class TCollection_HAsciiString;
-class Standard_Transient;
-class Interface_InterfaceModel;
-
-
-class STEPEdit_EditSDR;
-DEFINE_STANDARD_HANDLE(STEPEdit_EditSDR, IFSelect_Editor)
-
-//! EditSDR is an Editor fit for a Shape Definition Representation
-//! which designates a Product Definition
-class STEPEdit_EditSDR : public IFSelect_Editor
-{
-
-public:
-
-
- Standard_EXPORT STEPEdit_EditSDR();
-
- 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 Apply (const Handle(IFSelect_EditForm)& form, const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) 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;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(STEPEdit_EditSDR,IFSelect_Editor)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _STEPEdit_EditSDR_HeaderFile
#include <STEPSelections_SelectForTransfer.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <Transfer_TransientProcess.hxx>
-#include <XSControl_TransferReader.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(STEPSelections_SelectForTransfer,XSControl_SelectForTransfer)
-
-//=======================================================================
-//function : STEPSelections_SelectForTransfer
-//purpose :
-//=======================================================================
-STEPSelections_SelectForTransfer::STEPSelections_SelectForTransfer()
-{
-
-}
-//=======================================================================
-//function : STEPSelections_SelectForTransfer
-//purpose :
-//=======================================================================
-
-STEPSelections_SelectForTransfer::STEPSelections_SelectForTransfer(const Handle(XSControl_TransferReader)& TR)
-{
- SetReader(TR);
-}
+IMPLEMENT_STANDARD_RTTIEXT(STEPSelections_SelectForTransfer,XSSelect_SelectForTransfer)
//=======================================================================
//function : RootResult
Interface_EntityIterator STEPSelections_SelectForTransfer::RootResult(const Interface_Graph& /*G*/) const
{
Interface_EntityIterator iter;
- TColStd_SequenceOfTransient &roots = Reader()->TransientProcess()->RootsForTransfer();
+ TColStd_SequenceOfTransient &roots = theTP->RootsForTransfer();
const Standard_Integer nb = roots.Length();
for(Standard_Integer i = 1; i <= nb ; i++)
iter.GetOneItem(roots.Value(i));
#include <Standard.hxx>
#include <Standard_Type.hxx>
-#include <XSControl_SelectForTransfer.hxx>
-class XSControl_TransferReader;
+#include <XSSelect_SelectForTransfer.hxx>
class Interface_EntityIterator;
class Interface_Graph;
class STEPSelections_SelectForTransfer;
-DEFINE_STANDARD_HANDLE(STEPSelections_SelectForTransfer, XSControl_SelectForTransfer)
+DEFINE_STANDARD_HANDLE(STEPSelections_SelectForTransfer, XSSelect_SelectForTransfer)
-class STEPSelections_SelectForTransfer : public XSControl_SelectForTransfer
+class STEPSelections_SelectForTransfer : public XSSelect_SelectForTransfer
{
+ public:
-public:
-
-
- Standard_EXPORT STEPSelections_SelectForTransfer();
-
- Standard_EXPORT STEPSelections_SelectForTransfer(const Handle(XSControl_TransferReader)& TR);
+ STEPSelections_SelectForTransfer(const Handle(Transfer_TransientProcess)& TP) : XSSelect_SelectForTransfer(TP) {}
Standard_EXPORT virtual Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
-
-
- DEFINE_STANDARD_RTTIEXT(STEPSelections_SelectForTransfer,XSControl_SelectForTransfer)
-
-protected:
-
-
-
-
-private:
-
-
-
-
+ DEFINE_STANDARD_RTTIEXT(STEPSelections_SelectForTransfer,XSSelect_SelectForTransfer)
};
-
-
-
-
-
-
#endif // _STEPSelections_SelectForTransfer_HeaderFile
}
-//=======================================================================
-//function : CreateAnalysStructure
-//purpose :
-//=======================================================================
-
-Standard_Boolean StepAP209_Construct::CreateAnalysStructure (const Handle(StepBasic_Product) &Prod) const
-{
- if(Prod.IsNull()) return Standard_False;
- Interface_EntityIterator subs = Graph().Sharings(Prod);
- Handle(StepBasic_ProductDefinitionFormation) PDF;
- for (subs.Start(); subs.More() && PDF.IsNull() ; subs.Next()) {
- PDF = Handle(StepBasic_ProductDefinitionFormation)::DownCast(subs.Value());
- if(PDF.IsNull()) continue;
- }
- if(PDF.IsNull()) return Standard_False;
- //if( IsDesing(PDF) || IsAnalys(PDF) ) return Standard_False;
-
- // find nominal_design_shape:
- Handle(StepShape_ShapeRepresentation) SR;
- Handle(StepBasic_ProductDefinition) PD;
- subs = Graph().Sharings(PDF);
- for (subs.Start(); subs.More() && SR.IsNull() ; subs.Next()) {
- PD = Handle(StepBasic_ProductDefinition)::DownCast(subs.Value());
- if(PD.IsNull()) continue;
- Interface_EntityIterator subs2 = Graph().Sharings(PD);
- for (subs2.Start(); subs2.More() && SR.IsNull() ; subs2.Next()) {
- Handle(StepRepr_ProductDefinitionShape) PDS =
- Handle(StepRepr_ProductDefinitionShape)::DownCast(subs2.Value());
- if(PDS.IsNull()) continue;
- Interface_EntityIterator subs3 = Graph().Sharings(PDS);
- for (subs3.Start(); subs3.More() && SR.IsNull() ; subs3.Next()) {
- Handle(StepShape_ShapeDefinitionRepresentation) SDR =
- Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(subs3.Value());
- if(SDR.IsNull()) continue;
- SR = Handle(StepShape_ShapeRepresentation)::DownCast(SDR->UsedRepresentation());
- }
- }
- }
- if(SR.IsNull()) return Standard_False; // no nominal_design_shape
-
- // create structure:
- ReplaceCcDesingToApplied();
- Handle(StepData_StepModel) smodel = Handle(StepData_StepModel)::DownCast(Model());
-
- // replace existing contexts for using AP209
- Handle(StepBasic_ProductContext) OldProdCtx = Prod->FrameOfReferenceValue(1);
- if(!OldProdCtx.IsNull()) {
- Handle(StepBasic_ProductContext) ProdCtx = new StepBasic_ProductContext;
- ProdCtx->Init(OldProdCtx->Name(),
- OldProdCtx->FrameOfReference(),
- OldProdCtx->DisciplineType());
- smodel->ReplaceEntity(smodel->Number(OldProdCtx),ProdCtx);
- smodel->SetIdentLabel(ProdCtx, smodel->Number(ProdCtx));
- Handle(StepBasic_HArray1OfProductContext) HAPC = Prod->FrameOfReference();
- HAPC->SetValue(1,ProdCtx);
- Prod->SetFrameOfReference(HAPC);
- }
- Handle(StepBasic_ProductDefinitionContext) OldPDCtx = PD->FrameOfReference();
- if(!OldPDCtx.IsNull()) {
- Handle(StepBasic_ProductDefinitionContext) PDCtx = new StepBasic_ProductDefinitionContext;
- PDCtx->Init(OldPDCtx->Name(),
- OldPDCtx->FrameOfReference(),
- OldPDCtx->LifeCycleStage());
- smodel->ReplaceEntity(smodel->Number(OldPDCtx),PDCtx);
- smodel->SetIdentLabel(PDCtx, smodel->Number(PDCtx));
- PD->SetFrameOfReference(PDCtx);
- }
-
- // add idealized_analys_shape:
- Handle(StepShape_ShapeRepresentation) AnaSR = new StepShape_ShapeRepresentation;
- Handle(StepRepr_RepresentationItem) RI = new StepRepr_RepresentationItem;
- RI = SR->ItemsValue(1);
- smodel->AddWithRefs(RI); // add new representation_item
- smodel->SetIdentLabel(RI, smodel->Number(RI));
- Handle(StepRepr_HArray1OfRepresentationItem) ARI = new StepRepr_HArray1OfRepresentationItem(1,1);
- ARI->SetValue(1,RI);
- AnaSR->Init(new TCollection_HAsciiString("idealized_analysis_shape"),
- ARI, SR->ContextOfItems());
- smodel->AddWithRefs(AnaSR); // add idealized_analys_shape
- smodel->SetIdentLabel(AnaSR, smodel->Number(AnaSR));
-
- // add product:
- Handle(StepBasic_Product) AnaProd = new StepBasic_Product;
- AnaProd->Init(new TCollection_HAsciiString(""), new TCollection_HAsciiString("analysis"),
- new TCollection_HAsciiString("analysis product"), Prod->FrameOfReference());
- smodel->AddWithRefs(AnaProd);
- smodel->SetIdentLabel(AnaProd, smodel->Number(AnaProd));
-
- // add product_definition_formation:
- Handle(StepBasic_ProductDefinitionFormation) AnaPDF =
- new StepBasic_ProductDefinitionFormation;
- AnaPDF->Init(new TCollection_HAsciiString(""),
- new TCollection_HAsciiString("analysis version"), AnaProd);
- smodel->AddWithRefs(AnaPDF);
- smodel->SetIdentLabel(AnaPDF, smodel->Number(AnaPDF));
-
- // add product_definition_formation_relationship:
- Handle(StepBasic_ProductDefinitionFormationRelationship) PDFR =
- new StepBasic_ProductDefinitionFormationRelationship;
- PDFR->Init(new TCollection_HAsciiString(""),
- new TCollection_HAsciiString("analysis design version relationship"),
- new TCollection_HAsciiString(""), PDF, AnaPDF);
- smodel->AddWithRefs(PDFR);
- smodel->SetIdentLabel(PDFR, smodel->Number(PDFR));
-
- // add product_definition:
- Handle(StepBasic_ProductDefinition) AnaPD = new StepBasic_ProductDefinition;
- Handle(StepBasic_ProductDefinitionContext) AnaPDC =
- new StepBasic_ProductDefinitionContext;
- Handle(StepBasic_ApplicationContext) AC = Prod->FrameOfReferenceValue(1)->FrameOfReference();
- AnaPDC->Init(new TCollection_HAsciiString("analysis"), AC,
- new TCollection_HAsciiString("analysis") );
- smodel->AddWithRefs(AnaPDC); // add new product_definition_context
- smodel->SetIdentLabel(AnaPDC, smodel->Number(AnaPDC));
- AnaPD->Init(new TCollection_HAsciiString("analysis"),
- new TCollection_HAsciiString("analysis discipline product definition"),
- AnaPDF, AnaPDC);
- smodel->AddWithRefs(AnaPD); // add new product_definition
- smodel->SetIdentLabel(AnaPD, smodel->Number(AnaPD));
-
- // add product_definition_shape:
- Handle(StepRepr_ProductDefinitionShape) AnaPDS = new StepRepr_ProductDefinitionShape;
- StepRepr_CharacterizedDefinition ChDef;
- ChDef.SetValue(AnaPD);
- AnaPDS->Init(new TCollection_HAsciiString(""), Standard_True,
- new TCollection_HAsciiString("analysis shape"), ChDef);
- smodel->AddWithRefs(AnaPDS);
- smodel->SetIdentLabel(AnaPDS, smodel->Number(AnaPDS));
-
- // add shape_definition_representation:
- Handle(StepShape_ShapeDefinitionRepresentation) AnaSDR = new StepShape_ShapeDefinitionRepresentation;
- StepRepr_RepresentedDefinition RepDef;
- RepDef.SetValue(AnaPDS);
- AnaSDR->Init(RepDef, AnaSR);
- smodel->AddWithRefs(AnaSDR);
- smodel->SetIdentLabel(AnaSDR, smodel->Number(AnaSDR));
-
- // add shape_representation_relationship:
- Handle(StepRepr_ShapeRepresentationRelationship) SRR =
- new StepRepr_ShapeRepresentationRelationship;
- SRR->Init(new TCollection_HAsciiString("basis"), new TCollection_HAsciiString(""), AnaSR, SR);
- smodel->AddWithRefs(SRR);
- smodel->SetIdentLabel(SRR, smodel->Number(SRR));
-
- CreateAddingEntities(AnaPD);
-
-
- WS()->ComputeGraph(Standard_True);
- WS()->ComputeCheck(Standard_True);
-
- return Standard_True;
-}
-
-
-//=======================================================================
-//function : CreateFeaStructure
-//purpose :
-//=======================================================================
-
-Standard_Boolean StepAP209_Construct::CreateFeaStructure (const Handle(StepBasic_Product) &Prod) const
-{
- if(Prod.IsNull()) {
-#ifdef OCCT_DEBUG
- cout<<"Prod.IsNull()"<<endl;
-#endif
- return Standard_False;
- }
- Handle(StepShape_ShapeRepresentation) AnaSR = IdealShape(Prod);
- if(AnaSR.IsNull()) {
-#ifdef OCCT_DEBUG
- cout<<"AnaSR.IsNull()"<<endl;
-#endif
- return Standard_False;
- }
- Handle(StepRepr_ProductDefinitionShape) AnaPDS;
- Interface_EntityIterator subs = Graph().Sharings(AnaSR);
- for (subs.Start(); subs.More() && AnaPDS.IsNull(); subs.Next()) {
- Handle(StepShape_ShapeDefinitionRepresentation) SDR =
- Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(subs.Value());
- if ( SDR.IsNull() ) continue;
- AnaPDS = Handle(StepRepr_ProductDefinitionShape)::DownCast(SDR->Definition().Value());
- }
-
- //Handle(Interface_InterfaceModel) model = Model();
- Handle(StepData_StepModel) smodel = Handle(StepData_StepModel)::DownCast(Model());
-
- // add fea_model_definition
- Handle(StepFEA_FeaModelDefinition) FMD = new StepFEA_FeaModelDefinition;
- FMD->Init(new TCollection_HAsciiString("FEA_MODEL"),
- new TCollection_HAsciiString("FEA_MODEL"), AnaPDS, StepData_LFalse);
- smodel->AddWithRefs(FMD);
- smodel->SetIdentLabel(FMD, smodel->Number(FMD));
-
- // add fea_axis2_placement_3d
- Handle(StepFEA_FeaAxis2Placement3d) FA2P3D = new StepFEA_FeaAxis2Placement3d;
- Handle(StepGeom_CartesianPoint) SGCP = new StepGeom_CartesianPoint;
- SGCP->Init3D(new TCollection_HAsciiString(""), 0., 0., 0.);
- Handle(TColStd_HArray1OfReal) ArrTmp = new TColStd_HArray1OfReal(1,3);
- ArrTmp->SetValue(1,0.);
- ArrTmp->SetValue(2,0.);
- ArrTmp->SetValue(3,1.);
- Handle(StepGeom_Direction) SGD1 = new StepGeom_Direction;
- SGD1->Init(new TCollection_HAsciiString(""), ArrTmp);
- ArrTmp->SetValue(1,1.);
- ArrTmp->SetValue(2,0.);
- ArrTmp->SetValue(3,0.);
- Handle(StepGeom_Direction) SGD2 = new StepGeom_Direction;
- SGD2->Init(new TCollection_HAsciiString(""), ArrTmp);
- FA2P3D->Init(new TCollection_HAsciiString("FEA_BASIC_COORD_SYSTEM"),
- SGCP, Standard_True, SGD1, Standard_True, SGD2, StepFEA_Cartesian,
- new TCollection_HAsciiString("FEA_BASIC_COORD_SYSTEM"));
- smodel->AddWithRefs(FA2P3D);
- smodel->SetIdentLabel(FA2P3D, smodel->Number(FA2P3D));
-
- // create context for fea_model
- Handle(StepShape_ShapeRepresentation) NS = NominShape(Prod);
- Handle(StepRepr_RepresentationContext) RC = NS->ContextOfItems();
- Handle(StepGeom_GeometricRepresentationContext) GeoCtx;
- Handle(StepBasic_HArray1OfNamedUnit) OldHANU;
- if(RC->IsKind(STANDARD_TYPE(StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx))) {
- Handle(StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx) GeoUnitCtxNS =
- Handle(StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx)::DownCast(RC);
- GeoCtx = GeoUnitCtxNS->GeometricRepresentationContext();
- OldHANU = GeoUnitCtxNS->GlobalUnitAssignedContext()->Units();
- }
- if(RC->IsKind(STANDARD_TYPE(StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext))) {
- Handle(StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext) GeoUnitCtxNS =
- Handle(StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext)::DownCast(RC);
- GeoCtx = GeoUnitCtxNS->GeometricRepresentationContext();
- OldHANU = GeoUnitCtxNS->GlobalUnitAssignedContext()->Units();
- }
- Handle(StepBasic_HArray1OfNamedUnit) NewHANU = new StepBasic_HArray1OfNamedUnit(1,OldHANU->Length()+3);
- for(Standard_Integer i=1; i<=OldHANU->Length(); i++)
- NewHANU->SetValue(i,OldHANU->Value(i));
- // create SiUnitAndTimeUnit
- Handle(StepBasic_SiUnitAndTimeUnit) SUTU = new StepBasic_SiUnitAndTimeUnit;
- SUTU->Init(Standard_False,StepBasic_spExa,StepBasic_sunSecond);
- smodel->AddWithRefs(SUTU);
- smodel->SetIdentLabel(SUTU, smodel->Number(SUTU));
- NewHANU->SetValue(OldHANU->Length()+1,SUTU);
- //create SiUnitAndMassUnit
- Handle(StepBasic_SiUnitAndMassUnit) SUMU = new StepBasic_SiUnitAndMassUnit;
- SUMU->Init(Standard_True,StepBasic_spKilo,StepBasic_sunGram);
- smodel->AddWithRefs(SUMU);
- smodel->SetIdentLabel(SUMU, smodel->Number(SUMU));
- NewHANU->SetValue(OldHANU->Length()+2,SUMU);
- // create SiUnitAndThermodynamicTemperatureUnit
- Handle(StepBasic_SiUnitAndThermodynamicTemperatureUnit) SUTTU =
- new StepBasic_SiUnitAndThermodynamicTemperatureUnit;
- SUTTU->Init(Standard_False,StepBasic_spExa,StepBasic_sunDegreeCelsius);
- smodel->AddWithRefs(SUTTU);
- smodel->SetIdentLabel(SUTTU, smodel->Number(SUTTU));
- NewHANU->SetValue(OldHANU->Length()+3,SUTTU);
-
- Handle(StepRepr_GlobalUnitAssignedContext) NewUnitCtx = new StepRepr_GlobalUnitAssignedContext;
- NewUnitCtx->Init(new TCollection_HAsciiString(""), new TCollection_HAsciiString(""),NewHANU);
- Handle(StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext) NewGeoCtx =
- new StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext;
- NewGeoCtx->Init(new TCollection_HAsciiString("REP_CONTEXT_FEA"),
- new TCollection_HAsciiString("3D"), GeoCtx, NewUnitCtx);
- smodel->AddWithRefs(NewGeoCtx);
- smodel->SetIdentLabel(NewGeoCtx, smodel->Number(NewGeoCtx));
-
- // create fea_model_3d
- Handle(StepFEA_FeaModel3d) FM = new StepFEA_FeaModel3d;
- FM->SetName(new TCollection_HAsciiString("FEA_MODEL"));
- Handle(StepRepr_HArray1OfRepresentationItem) HARI =
- new StepRepr_HArray1OfRepresentationItem(1,1);
- HARI->SetValue(1,FA2P3D);
- Handle(TColStd_HArray1OfAsciiString) HAAS = new TColStd_HArray1OfAsciiString(1,1);
- HAAS->SetValue(1,"FEA_SOLVER");
- FM->Init(new TCollection_HAsciiString("FEA_MODEL"), HARI,
- NewGeoCtx, new TCollection_HAsciiString(""),
- HAAS, new TCollection_HAsciiString("ANALYSIS_MODEL"),
- new TCollection_HAsciiString("LINEAR_STATIC"));
- smodel->AddWithRefs(FM);
- smodel->SetIdentLabel(FM, smodel->Number(FM));
-
- // add structural_response_property
- Handle(StepRepr_StructuralResponseProperty) SRP =
- new StepRepr_StructuralResponseProperty;
- StepRepr_CharacterizedDefinition ChDef2;
- ChDef2.SetValue(FMD);
- SRP->Init(new TCollection_HAsciiString("STRUCT_RESP_PROP"), Standard_True,
- new TCollection_HAsciiString("STRUCTURAL_RESPONSE_PROPERTY"),ChDef2);
- smodel->AddWithRefs(SRP);
- smodel->SetIdentLabel(SRP, smodel->Number(SRP));
-
- // add structural_response_property_definition_representation
- Handle(StepRepr_StructuralResponsePropertyDefinitionRepresentation) SRPDR =
- new StepRepr_StructuralResponsePropertyDefinitionRepresentation;
- StepRepr_RepresentedDefinition RepDef2;
- RepDef2.SetValue(SRP);
- SRPDR->Init(RepDef2,FM);
- smodel->AddWithRefs(SRPDR);
- smodel->SetIdentLabel(SRPDR, smodel->Number(SRPDR));
-
- WS()->ComputeGraph(Standard_True);
- WS()->ComputeCheck(Standard_True);
-
- return Standard_True;
-}
-
-
//=======================================================================
//function : ReplaceCcDesingToApplied
//purpose : Put into model entities Applied... for AP209 instead of
Standard_EXPORT Handle(StepShape_ShapeRepresentation) GetShReprForElem (const Handle(StepFEA_ElementRepresentation)& ElemRepr) const;
- //! Create empty structure for idealized_analysis_shape
- Standard_EXPORT Standard_Boolean CreateAnalysStructure (const Handle(StepBasic_Product)& Prod) const;
-
- //! Create fea structure
- Standard_EXPORT Standard_Boolean CreateFeaStructure (const Handle(StepBasic_Product)& Prod) const;
-
//! Put into model entities Applied... for AP209 instead of
//! entities CcDesing... from AP203.
Standard_EXPORT Standard_Boolean ReplaceCcDesingToApplied() const;
Interface
Transfer
IFGraph
-IFSelect
TransferBRep
XSControl
StepData
TKernel
TKService
TKXSBase
+TKXSSelect
TKMeshVS
TKG3d
TKViewerTest
-IGESSelect
-StepSelect
-STEPEdit
-STEPSelections
XSDRAW
XSDRAWIGES
XSDRAWSTEP
--- /dev/null
+project(TKXSSelect)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
--- /dev/null
+TKBRep
+TKernel
+TKMath
+TKG2d
+TKG3d
+TKTopAlgo
+TKGeomBase
+TKShHealing
+TKXSBase
+TKIGES
+TKSTEP
--- /dev/null
+EXTERNLIB
+PACKAGES
--- /dev/null
+IFSelect
+XSSelect
+IGESSelect
+StepSelect
+STEPSelections
#include <Transfer_FinderProcess.hxx>
+#include <Standard_Failure.hxx>
+#include <Standard_ErrorHandler.hxx>
+#include <Message_Messenger.hxx>
+#include <Interface_CheckIterator.hxx>
+#include <Interface_InterfaceModel.hxx>
+#include <Interface_HGraph.hxx>
+#include <XSControl_WorkSession.hxx>
+
IMPLEMENT_STANDARD_RTTIEXT(Transfer_FinderProcess,Transfer_Process)
+
+
+//=======================================================================
+//function : PrintTransferStatus
+//purpose :
+//=======================================================================
+
+Standard_Boolean Transfer_FinderProcess::PrintTransferStatus(const Standard_Integer theNum,
+ const Handle(Message_Messenger)& theMessenger) const
+{
+ Handle(Transfer_Binder) binder;
+ Handle(Standard_Transient) finder;
+ Handle(Standard_Transient) aDestination;
+
+ if (theNum == 0 ) return Standard_False;
+
+ Standard_Integer ne=0, nr=0, max = NbMapped(), maxr = NbRoots();
+ if (theNum > 0) {
+ if (theNum > max) return Standard_False;
+ ne = theNum;
+ finder = Mapped(ne);
+ nr = RootIndex(finder);
+ } else if (theNum < 0) {
+ nr = -theNum;
+ if (nr > maxr) return Standard_False;
+ finder = Root(nr);
+ ne = MapIndex(finder);
+ }
+ aDestination = FindTransient(finder);
+
+ theMessenger<<"Transfer Write item n0."<<ne<<" of "<<max;
+ if (nr > 0) theMessenger<<" ** Transfer Root n0."<<nr<<endl;
+ theMessenger<<" -> Type "<<finder->DynamicType()->Name()<<endl;
+
+ StartTrace (binder,finder,0,0); // pb sout/S
+
+ if (!aDestination.IsNull()) {
+ theMessenger<<" ** Transient result, type "<<aDestination->DynamicType()->Name();
+ const Handle(Interface_InterfaceModel) &model = Model();
+ if (!model.IsNull())
+ { theMessenger<<" In output Model, Entity "; model->Print(aDestination,theMessenger); }
+ theMessenger<<endl;
+ }
+
+ // *** CHECK ***
+ if (!binder.IsNull()) {
+ const Handle(Interface_Check) ch = binder->Check();
+ Standard_Integer i, nbw = ch->NbWarnings(), nbf = ch->NbFails();
+ if (nbw > 0) {
+ theMessenger<<" - Warnings : "<<nbw<<" :\n";
+ for (i = 1; i <= nbw; i ++) theMessenger<<ch->CWarning(i)<<endl;
+ }
+ if (nbf > 0) {
+ theMessenger<<" - Fails : "<<nbf<<" :\n";
+ for (i = 1; i <= nbf; i ++) theMessenger<<ch->CFail(i)<<endl;
+ }
+ }
+ return Standard_True;
+}
+
+
+//=======================================================================
+//function : ClearBinders
+//purpose :
+//=======================================================================
+
+void Transfer_FinderProcess::ClearBinders ()
+{
+ //Due to big number of chains of binders it is necessary to
+ //collect head binders of each chain in the sequence
+ TColStd_SequenceOfTransient aSeqBnd;
+ TColStd_SequenceOfTransient aSeqShapes;
+ Standard_Integer i;
+ for (i = 1; i <= NbMapped(); i++) {
+ Handle(Transfer_Binder) bnd = MapItem ( i );
+ if(!bnd.IsNull())
+ aSeqBnd.Append(bnd);
+ const Handle(Standard_Transient) &ash = Mapped(i);
+ aSeqShapes.Append(ash);
+ }
+ //removing finder process containing result of translation.
+ Clear();
+ //szv_x1:myWS->ClearData(1);
+ //szv_x1:myWS->ClearData(5);
+
+ //removing each chain of binders
+ while(aSeqBnd.Length() >0) {
+ Handle(Transfer_Binder) aBnd = Handle(Transfer_Binder)::DownCast(aSeqBnd.Value(1));
+ Handle(Standard_Transient) ash = aSeqShapes.Value(1);
+ aSeqBnd.Remove(1);
+ aSeqShapes.Remove(1);
+ ash.Nullify();
+ while(!aBnd.IsNull()) {
+ Handle(Transfer_Binder) aBndNext = aBnd->NextResult();
+ aBnd.Nullify();
+ aBnd = aBndNext;
+ }
+ }
+}
#define _Transfer_FinderProcess_HeaderFile
#include <Transfer_Process.hxx>
+#include <Interface_ReturnStatus.hxx>
+class Message_Messenger;
+class XSControl_WorkSession;
class Transfer_FinderProcess : public Transfer_Process
{
public:
- //! Sets FinderProcess at initial state, with an initial size
+ //! Constructor, with initial size
Transfer_FinderProcess(const Standard_Integer nb = 10000)
: Transfer_Process (nb)
{}
+ //! Destructor
+ virtual ~Transfer_FinderProcess ()
+ { ClearBinders(); }
+
+ //! Prints the transfer status of a transferred item, as beeing the Mapped n0 <num>
+ //! Returns True when done, False else (i.e. num out of range)
+ Standard_EXPORT virtual Standard_Boolean PrintTransferStatus (const Standard_Integer theNum, const Handle(Message_Messenger)& theMessenger) const Standard_OVERRIDE;
+
DEFINE_STANDARD_RTTIEXT(Transfer_FinderProcess,Transfer_Process)
+
+ protected:
+
+ //! Clears binders
+ Standard_EXPORT void ClearBinders();
};
#endif // _Transfer_FinderProcess_HeaderFile
Standard_Integer i, nb = NbMapped();
Standard_Integer j,unb = 0;
for (i = 1; i <= nb; i ++) {
- if (themap(i).IsNull()) unb ++;
+ if (myMap(i).IsNull()) unb ++;
}
if (unb == 0) return;
j = newmap.Add (ent,bnd);
unbs.SetValue (i,j);
}
- themap.Assign (newmap);
+ myMap.Assign (newmap);
// Update the map of roots
TColStd_IndexedMapOfInteger aNewRoots;
Handle(Transfer_Binder) Transfer_Process::Find (const Handle(Standard_Transient) &start) const
{
if (thelastobj == start && theindex > 0) return thelastbnd;
- const Standard_Integer index = themap.FindIndex (start);
- return (index > 0)? themap.FindFromIndex(index) : NULL;
+ const Standard_Integer index = myMap.FindIndex (start);
+ return (index > 0)? myMap.FindFromIndex(index) : NULL;
}
Standard_Boolean Transfer_Process::IsBound (const Handle(Standard_Transient) &start) const
// On admet VoidBinder : alors on reprend son Check
if (former->DynamicType() == STANDARD_TYPE(Transfer_VoidBinder)) {
binder->Merge(former);
- themap(theindex) = binder; // Substitution
+ myMap(theindex) = binder; // Substitution
}
else if (former->Status() == Transfer_StatusUsed) {
StartTrace (former,start,thelevel,4);
}
}
if (theindex == 0 || thelastbnd.IsNull()) {
- if (theindex == 0) theindex = themap.Add(start,binder); // Nouveau
- else themap(theindex) = binder; // idem en fait
+ if (theindex == 0) theindex = myMap.Add(start,binder); // Nouveau
+ else myMap(theindex) = binder; // idem en fait
thelastbnd = binder;
}
else {
thelastbnd = binder;
- themap(theindex) = binder;
+ myMap(theindex) = binder;
}
}
if (theindex == 0) return Standard_False;
if (former.IsNull()) return Standard_False;
if (former->DynamicType() == STANDARD_TYPE(Transfer_VoidBinder)) return Standard_True;
- themap(theindex) = thelastbnd;
+ myMap(theindex) = thelastbnd;
if(theroots.Contains(theindex)) {
TColStd_IndexedMapOfInteger aNewRoots;
for(Standard_Integer i = 1; i <= theroots.Extent(); i++)
//! if a Starting Entity has not been recognized at all.
thelevel++; // si decremente et == 0, transfert racine
- Handle(Actor) actor = theactor;
- // On balaie les Next jusqu a avoir un Resultat
- while (!actor.IsNull()) {
- if (actor->Recognize (theSource)) binder = actor->Transferring(theSource,this);
- else binder.Nullify();
- if (!binder.IsNull()) break;
- actor = actor->Next();
- }
+ if (!myActor.IsNull() && myActor->Recognize(theSource))
+ binder = myActor->Transferring(theSource,this);
if (!binder.IsNull()) {
// Gestion du niveau racine (.. a regarder de pres ..)
return thelastbnd;
}
-void Transfer_Process::StartTrace (const Handle(Transfer_Binder)& binder, const Handle(Standard_Transient) &start, const Standard_Integer level, const Standard_Integer mode) const
+void Transfer_Process::StartTrace (const Handle(Transfer_Binder)& theBinder, const Handle(Standard_Transient) &theSource, const Standard_Integer theLevel, const Standard_Integer theMode) const
{
- // ### Fail (Roots:50) -- Start start->DynamicType()
- // ### Fail (Roots:50) -- Start id:#label.. Type:start->DynamicType()
+ // ### Fail (Roots:50) -- Start theSource->DynamicType()
+ // ### Fail (Roots:50) -- Start id:#label.. Type:theSource->DynamicType()
if (thetrace > 3) { // Internal to be switch when searching bug (trace >= 4)
- if (mode == 1) themessenger << " ### Fail";
- if (mode == 2) themessenger << " ### Warning";
- if (mode == 3) themessenger << " ### New Root n0 " << theroots.Extent();
- if (mode == 4) themessenger << " ### Exception";
- if (mode == 5) themessenger << " ### Substitution";
- if (mode == 6) themessenger << " ### Information";
- if (level > 1)
+ if (theMode == 1) themessenger << " ### Fail";
+ if (theMode == 2) themessenger << " ### Warning";
+ if (theMode == 3) themessenger << " ### New Root n0 " << theroots.Extent();
+ if (theMode == 4) themessenger << " ### Exception";
+ if (theMode == 5) themessenger << " ### Substitution";
+ if (theMode == 6) themessenger << " ### Information";
+ if (theLevel > 1)
themessenger << " (nested)"; // " at nesting Level:"<<level;
- if (mode >= 0 && mode != 3)
+ if (theMode >= 0 && theMode != 3)
themessenger << " at " << theroots.Extent() << " Roots";
}
- if (!start.IsNull()) PrintTrace (start,themessenger);
- if (!binder.IsNull()) {
- Handle(Transfer_Binder) bnd = binder;
+ PrintTrace (theSource,themessenger);
+
+ if (!theBinder.IsNull()) {
+ Handle(Transfer_Binder) bnd = theBinder;
Standard_Boolean hasres = Standard_False;
while (!bnd.IsNull()) {
if (bnd->Status() != Transfer_StatusVoid) {
- // --- Result Type: binder->ResultType() --- Binder : binder->DynamicType();
- if (!hasres)
- themessenger << "\n --- Result Type : ";
- else
- themessenger << " , ";
+ themessenger << (hasres? " , " : "\n --- Result Type : ");
themessenger << bnd->ResultTypeName();
hasres = Standard_True;
}
bnd = bnd->NextResult();
}
- if (!hasres && mode > 2) {
+ if (!hasres && theMode > 2) {
themessenger << "\n --- No Result recorded";
}
}
S<<"\n*******************************************************************\n";
S << "******** Basic Statistics ********"<<endl;
- if (themodel.IsNull())
+ if (myModel.IsNull())
S<<"**** Model unknown"<<endl;
else
- S<<"**** Nb Entities : "<<themodel->NbEntities()<<endl;
+ S<<"**** Nb Entities : "<<myModel->NbEntities()<<endl;
Standard_Integer nbr = 0, nbe = 0, nbw = 0;
Standard_Integer i, max = NbMapped(), nbroots = NbRoots();
//! "mutable" allows the Actor to record intermediate
//! information, in addition to those of TransferProcess
Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& /*start*/, const Handle(Transfer_Process)& /*TP*/) { return NULL; }
-
- //! Defines a Next Actor : it can then be asked to work if
- //! <me> produces no result for a given type of Object.
- //! If Next is already set and is not "Last", calls
- //! SetNext on it. If Next defined and "Last", the new
- //! actor is added before it in the list
- Standard_EXPORT void SetNext (const Handle(Actor)& next)
- {
- if (thenext == next) return;
- if (thenext.IsNull()) thenext = next;
- else thenext->SetNext(next);
- }
- //! Returns the Actor defined as Next, or a Null Handle
- const Handle(Actor) & Next() const { return thenext; }
+ //! Returns min and max values for transfer mode
+ //! Returns True if bounds are set, False else (i.e., always the same mode)
+ Standard_EXPORT virtual Standard_Boolean TransferModeBounds (Standard_Integer& /*theMin*/, Standard_Integer& /*theMax*/) const { return Standard_False; }
+
+ //! Returns the help string recorded for a given transfer mode
+ //! Empty string if help not defined or not within bounds or if values are free
+ Standard_EXPORT virtual Standard_CString TransferModeHelp (const Standard_Integer /*theMode*/) const { return ""; }
//! Set a specific transfer mode
void SetTransferMode (const Standard_Integer theMode) { themodetrans = theMode; }
protected:
- Handle(Actor) thenext;
Standard_Integer themodetrans;
};
thelevel(0), therootl(0),
therootm(Standard_False),
theindex(0),
- themap(nb)
+ myMap(nb)
{}
//! Sets TransferProcess at initial state. Gives an Initial size
thelevel(0), therootl(0),
therootm(Standard_False),
theindex(0),
- themap(nb)
+ myMap(nb)
{}
//! Sets an InterfaceModel, which can be used during transfer
//! for instance if a context must be managed, it is in the Model
- void SetModel (const Handle(Interface_InterfaceModel)& model) { themodel = model; }
+ void SetModel (const Handle(Interface_InterfaceModel)& theModel) { myModel = theModel; }
//! Returns the Model which can be used for context
- const Handle(Interface_InterfaceModel)& Model() const { return themodel; }
+ const Handle(Interface_InterfaceModel)& Model() const { return myModel; }
//! Resets a TransferProcess as ready for a completely new work.
//! Clears general data (roots) and the Map
{
thelevel = 0; therootl = 0;
theroots.Clear();
- themap.Clear();
+ myMap.Clear();
theindex = 0; thelastobj.Nullify(); thelastbnd.Nullify();
}
//! Resizes the Map as required (if a new reliable value has been
//! determined). Acts only if <nb> is greater than actual NbMapped
- void Resize (const Standard_Integer nb) { if (nb > themap.NbBuckets()) themap.ReSize(nb); }
-
+ void Resize (const Standard_Integer nb) { if (nb > myMap.NbBuckets()) myMap.ReSize(nb); }
+
//! Defines an Actor, which is used for automatic Transfer
- //! If already defined, the new Actor is cumulated
- //! (see SetNext from Actor)
- void SetActor (const Handle(Actor)& actor)
- {
- if (theactor == actor) return;
- if (theactor.IsNull()) theactor = actor;
- else if (actor.IsNull()) theactor = actor;
- else theactor->SetNext(actor);
- }
+ void SetActor (const Handle(Actor)& theActor) { myActor = theActor; }
+
+ //! Returns an Actor, which is used for automatic Transfer
+ const Handle(Actor)& GetActor () const { return myActor; }
//! Returns the Binder which is linked with a starting Object
//! It can either bring a Result (Transfer done) or none (for a
//! Returns the maximum possible value for Map Index
//! (no result can be bound with a value greater than it)
- Standard_Integer NbMapped() const { return themap.Extent(); }
+ Standard_Integer NbMapped() const { return myMap.Extent(); }
//! Returns the Starting Object bound to an Index,
- const Handle(Standard_Transient) & Mapped (const Standard_Integer num) const { return themap.FindKey(num); }
+ const Handle(Standard_Transient) & Mapped (const Standard_Integer num) const { return myMap.FindKey(num); }
//! Returns the Index value bound to a Starting Object, 0 if none
- Standard_Integer MapIndex (const Handle(Standard_Transient) &start) const { return themap.FindIndex(start); }
+ Standard_Integer MapIndex (const Handle(Standard_Transient) &start) const { return myMap.FindIndex(start); }
//! Returns the Binder bound to an Index
//! Considers a category number, by default 0
- Handle(Transfer_Binder) MapItem (const Standard_Integer num) const { return themap.FindFromIndex(num); }
+ Handle(Transfer_Binder) MapItem (const Standard_Integer num) const { return myMap.FindFromIndex(num); }
//! Declares <obj> (and its Result) as Root. This status will be
//! later exploited by RootResult, see below (Result can be
{
Standard_Integer ind = 0;
if (num > 0 && num <= theroots.Extent()) ind = theroots.FindKey(num);
- return themap.FindKey (ind);
+ return myMap.FindKey (ind);
}
//! Returns the index in the list of roots for a starting item,
}
//! Method called when trace is asked
- //! Calls PrintTrace to display information relevant for starting
- //! objects (which can be redefined)
- //! <level> is Nesting Level of Transfer (0 = root)
- //! <mode> controls the way the trace is done :
+ //! Calls PrintTrace to display information relevant for source objects (which can be redefined)
+ //! <theLevel> is Nesting Level of Transfer (0 = root)
+ //! <theMode> controls the way the trace is done :
//! 0 neutral, 1 for Error, 2 for Warning message, 3 for new Root
- Standard_EXPORT void StartTrace (const Handle(Transfer_Binder)& binder, const Handle(Standard_Transient) &start, const Standard_Integer level, const Standard_Integer mode) const;
+ Standard_EXPORT void StartTrace (const Handle(Transfer_Binder)& theBinder, const Handle(Standard_Transient) &theSource, const Standard_Integer theLevel, const Standard_Integer theMode) const;
//! Prints statistics on transfer
Standard_EXPORT void PrintStats(const Handle(Message_Messenger)& S) const;
//! If <erronly> is True, checks with Warnings only are ignored
Standard_EXPORT Interface_CheckIterator CheckList (const Standard_Boolean erronly) const;
+ //! Prints the transfer status of a transferred item, as beeing the Mapped n0 <num>
+ //! Returns True when done, False else (i.e. num out of range)
+ Standard_EXPORT virtual Standard_Boolean PrintTransferStatus (const Standard_Integer theNum, const Handle(Message_Messenger)& theMessenger) const = 0;
+
//! Sets Progress indicator
void SetProgress (const Handle(Message_ProgressIndicator)& theProgress) { myProgress = theProgress; }
//! Prints a short information on a source object.
Standard_EXPORT virtual void PrintTrace (const Handle(Standard_Transient) &theSource, const Handle(Message_Messenger)& S) const;
- Handle(Interface_InterfaceModel) themodel;
+ Handle(Interface_InterfaceModel) myModel;
+ Handle(Actor) myActor;
private:
if (theindex > 0) return thelastbnd;
}
thelastobj = start;
- theindex = themap.FindIndex (start);
- if (theindex > 0) thelastbnd = themap.FindFromIndex(theindex);
+ theindex = myMap.FindIndex (start);
+ if (theindex > 0) thelastbnd = myMap.FindFromIndex(theindex);
else thelastbnd.Nullify();
return thelastbnd;
}
- Handle(Message_Messenger) themessenger;
+ Transfer_MapOfProcess myMap;
+
Standard_Integer thetrace;
Standard_Integer thelevel;
Standard_Integer therootl;
Handle(Standard_Transient) thelastobj;
Handle(Transfer_Binder) thelastbnd;
Standard_Integer theindex;
- Handle(Actor) theactor;
- Transfer_MapOfProcess themap;
+
+ Handle(Message_Messenger) themessenger;
Handle(Message_ProgressIndicator) myProgress;
};
#include <Interface_HGraph.hxx>
#include <Interface_InterfaceModel.hxx>
#include <Interface_MSG.hxx>
+#include <Interface_Macros.hxx>
+#include <Interface_Static.hxx>
#include <Message_Messenger.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <Transfer_Binder.hxx>
#include <Transfer_TransientProcess.hxx>
+#include <Transfer_ResultFromModel.hxx>
+#include <Transfer_ResultFromTransient.hxx>
+#include <Transfer_SimpleBinderOfTransient.hxx>
+#include <TransferBRep.hxx>
+#include <TransferBRep_ShapeBinder.hxx>
+#include <TransferBRep_ShapeMapper.hxx>
+#include <TopoDS_HShape.hxx>
+#include <ShapeFix.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Transfer_TransientProcess,Transfer_Process)
+static TopoDS_Shape BinderShape (const Handle(Standard_Transient)& tr)
+{
+ TopoDS_Shape sh;
+ DeclareAndCast(Transfer_Binder,sb,tr);
+ if (!sb.IsNull()) return TransferBRep::ShapeResult(sb);
+ DeclareAndCast(TransferBRep_ShapeMapper,sm,tr);
+ if (!sm.IsNull()) return sm->Shape();
+ DeclareAndCast(TopoDS_HShape,hs,tr);
+ if (!hs.IsNull()) return hs->Shape();
+ return sh;
+}
+
//=======================================================================
//function : SetGraph
//purpose :
{
thegraph = HG;
if (!thegraph.IsNull())
- SetModel(thegraph->Graph().Model());
+ myModel = thegraph->Graph().Model();
else
- themodel.Nullify();
+ myModel.Nullify();
}
//purpose :
//=======================================================================
-void Transfer_TransientProcess::PrintTrace (const Handle(Standard_Transient)& start, const Handle(Message_Messenger)& S) const
+void Transfer_TransientProcess::PrintTrace (const Handle(Standard_Transient)& theSource, const Handle(Message_Messenger)& S) const
{
- if (!start.IsNull()) {
+ if (!theSource.IsNull()) {
S << "Entity ";
- if (!themodel.IsNull())
- themodel->Print (start,S,1);
+ if (!myModel.IsNull())
+ myModel->Print (theSource,S,1);
else
- S<<" Type:"<< Interface_InterfaceModel::ClassName(start->DynamicType()->Name());
+ S<<" Type:"<< Interface_InterfaceModel::ClassName(theSource->DynamicType()->Name());
}
}
Standard_Integer Transfer_TransientProcess::CheckNum (const Handle(Standard_Transient)& start) const
{
- return (themodel.IsNull() ? 0 : themodel->Number(start));
+ return (myModel.IsNull() ? 0 : myModel->Number(start));
+}
+
+
+// ########################################################
+// ########### TRANSFERT ############
+// ########################################################
+
+
+//=======================================================================
+//function : BeginTransfer
+//purpose :
+//=======================================================================
+
+Standard_Boolean Transfer_TransientProcess::BeginTransfer ()
+{
+ if (myModel.IsNull()) return Standard_False;
+ /*c1:temporarily! if ( myActor.IsNull() && !myController.IsNull())
+ myActor = myController->ActorRead(myModel);*/
+ return (!myActor.IsNull());
+}
+
+
+//=======================================================================
+//function : TransferOne
+//purpose :
+//=======================================================================
+
+Standard_Integer Transfer_TransientProcess::TransferOne (const Handle(Standard_Transient)& ent)
+{
+ if (myActor.IsNull() || myModel.IsNull()) return 0;
+
+ //c1:if (myTP.IsNull()) { if (!BeginTransfer()) return 0; }
+
+ //c1:if (myGraph.IsNull()) myTP->SetModel(myModel);
+ //c1:else myTP->SetGraph(myGraph);
+
+ // Check if the entity belongs to the model
+ if (myModel->Number(ent) == 0)
+ return 0;
+
+ Transfer (ent);
+ SetRoot (ent);
+
+ // Resultat ...
+ Handle(Transfer_Binder) binder = Find (ent);
+ if (binder.IsNull()) return 0;
+
+ RecordResult (ent);
+
+ if (!binder->HasResult()) return 0;
+
+ return 1;
+}
+
+
+// ########################################################
+// ########### RESULTATS ############
+
+
+//=======================================================================
+//function : RecordResult
+//purpose :
+//=======================================================================
+
+Standard_Boolean Transfer_TransientProcess::RecordResult (const Handle(Standard_Transient)& ent)
+{
+ if (myModel.IsNull()) return Standard_False;
+ Standard_Integer num = myModel->Number(ent);
+ if (num == 0) return Standard_False;
+ Handle(TCollection_HAsciiString) lab = myModel->StringLabel(ent);
+
+ Handle(Transfer_ResultFromModel) res = new Transfer_ResultFromModel;
+ res->Fill (this,ent);
+
+ // Cas du resultat Shape : pour resultat principal, faire HShape ...
+ Handle(Transfer_Binder) binder = res->MainResult()->Binder();
+ DeclareAndCast(TransferBRep_ShapeBinder,shb,binder);
+ if (!shb.IsNull()) {
+ Handle(Transfer_SimpleBinderOfTransient) trb = new Transfer_SimpleBinderOfTransient;
+ trb->SetResult ( new TopoDS_HShape(shb->Result()) );
+ trb->Merge(binder);
+ res->MainResult()->SetBinder (trb);
+ }
+
+ //c1:res->SetFileName(myFileName.ToCString());
+ myResults.Bind(num,res);
+ return Standard_True;
+}
+
+
+//=======================================================================
+//function : IsRecorded
+//purpose :
+//=======================================================================
+
+Standard_Boolean Transfer_TransientProcess::IsRecorded (const Handle(Standard_Transient)& ent) const
+{
+ if (myModel.IsNull()) return Standard_False;
+ Standard_Integer num = myModel->Number(ent);
+ if (num == 0) return Standard_False;
+ if(!myResults.IsBound(num)) return Standard_False;
+ return (myResults.Find(num)->DynamicType() == STANDARD_TYPE(Transfer_ResultFromModel) );
+}
+
+
+//=======================================================================
+//function : RecordedList
+//purpose :
+//=======================================================================
+
+Handle(TColStd_HSequenceOfTransient) Transfer_TransientProcess::RecordedList () const
+{
+ Handle(TColStd_HSequenceOfTransient) li = new TColStd_HSequenceOfTransient();
+ if (myModel.IsNull()) return li;
+ Standard_Integer i, nb = myModel->NbEntities();
+ for (i = 1; i <= nb; i ++) {
+ if(myResults.IsBound(i))
+ if(!myResults.Find(i).IsNull()) li->Append (myModel->Value(i));
+ }
+ return li;
+}
+
+
+//=======================================================================
+//function : FinalResult
+//purpose :
+//=======================================================================
+
+Handle(Transfer_ResultFromModel) Transfer_TransientProcess::FinalResult (const Handle(Standard_Transient)& ent) const
+{
+ if (myModel.IsNull()) return NULL;
+ Standard_Integer num = myModel->Number(ent);
+ if (num == 0) return NULL;
+ if(!myResults.IsBound(num)) return NULL;
+ return Handle(Transfer_ResultFromModel)::DownCast(myResults.Find(num));
+}
+
+
+//=======================================================================
+//function : ShapeResult
+//purpose :
+//=======================================================================
+
+TopoDS_Shape Transfer_TransientProcess::ShapeResult (const Handle(Standard_Transient)& ent) const
+{
+ TopoDS_Shape aResult;
+ Handle(Transfer_ResultFromModel) res = FinalResult(ent);
+ if (res.IsNull()) return aResult;
+ Handle(Transfer_ResultFromTransient) mres = res->MainResult();
+ if (mres.IsNull()) return aResult;
+ aResult = BinderShape (mres->Binder());
+ if (aResult.IsNull()) return aResult;
+
+ // Ouh la vilaine verrue
+ Standard_Real tolang = Interface_Static::RVal("read.encoderegularity.angle");
+ if (tolang <= 0) return aResult;
+ ShapeFix::EncodeRegularity (aResult,tolang);
+ return aResult;
+}
+
+
+//=======================================================================
+//function : EntityFromShapeResult
+//purpose :
+//=======================================================================
+
+Handle(Standard_Transient) Transfer_TransientProcess::EntityFromShapeResult (const TopoDS_Shape& res, const Standard_Integer mode) const
+{
+ Handle(Standard_Transient) nulh, samesh, partner;
+ if (res.IsNull()) return nulh;
+ Standard_Integer i,j,nb;
+
+ if (mode == 0 || mode == 1 || mode == -1) {
+ // on regarde dans le TransientProcess
+ nb = (mode == 0 ? NbRoots() : NbMapped());
+ for (j = 1; j <= nb; j ++) {
+ i = (mode == 0 ? myModel->Number (Root(j)) : j);
+ if (i == 0) continue;
+ Handle(Standard_Transient) ent = Mapped(i);
+ TopoDS_Shape sh = TransferBRep::ShapeResult (this,ent);
+ if (!sh.IsNull()) {
+ if (sh == res) return ent;
+ // priorites moindre : Same (tjrs) ou Partner (mode < 0)
+ if (sh.IsSame(res)) samesh = ent;
+ if (mode == -1 && sh.IsPartner(res)) partner= ent;
+ }
+ }
+ // Ici, pas trouve de vraie egalite. Priorites moindres : Same puis Partner
+ if (!samesh.IsNull()) return samesh;
+ if (!partner.IsNull()) return partner; // calcule si mode = -1
+ return nulh;
+ }
+
+ // Recherche dans myResults (racines)
+ // 2 : Main only 3 : Main + one sub; 4 : all
+ if (mode >= 2) {
+ nb = myModel->NbEntities();
+ for (i = 1; i <= nb; i ++) {
+ Handle(Transfer_ResultFromModel) rec = ResultFromNumber (i);
+ if (rec.IsNull()) continue;
+
+ Handle(TColStd_HSequenceOfTransient) list = rec->Results (mode-2);
+ Standard_Integer ir,nr = list->Length();
+ for (ir = 1; ir <= nr; ir ++) {
+ DeclareAndCast(Transfer_ResultFromTransient,rft,list->Value(ir));
+ if (rft.IsNull()) continue;
+ TopoDS_Shape sh = BinderShape (rft->Binder());
+ if (!sh.IsNull() && sh == res) return rft->Start();
+ }
+ }
+ }
+
+ return nulh;
+}
+
+
+//=======================================================================
+//function : CheckedList
+//purpose :
+//=======================================================================
+
+Handle(TColStd_HSequenceOfTransient) Transfer_TransientProcess::CheckedList
+ (const Handle(Standard_Transient)& ent,
+ const Interface_CheckStatus withcheck, const Standard_Boolean level) const
+{
+ Handle(TColStd_HSequenceOfTransient) res = new TColStd_HSequenceOfTransient();
+ if (ent.IsNull()) return res;
+
+ if (ent == myModel) {
+ Standard_Integer i,nb = myModel->NbEntities();
+ for (i = 1; i <= nb; i ++) {
+ Handle(Transfer_ResultFromModel) rec = ResultFromNumber (i);
+ if (!rec.IsNull()) res->Append (rec->CheckedList(withcheck,level));
+ }
+ } else if (ent->IsKind(STANDARD_TYPE(TColStd_HSequenceOfTransient))) {
+ DeclareAndCast(TColStd_HSequenceOfTransient,list,ent);
+ Standard_Integer i,nb = list->Length();
+ for (i = 1; i <= nb; i ++) {
+ Handle(Transfer_ResultFromModel) rec = FinalResult (list->Value(i));
+ if (!rec.IsNull()) res->Append (rec->CheckedList(withcheck,level));
+ }
+ } else {
+ Handle(Transfer_ResultFromModel) rec = FinalResult (ent);
+ if (!rec.IsNull()) res = rec->CheckedList(withcheck,level);
+ }
+ return res;
+}
+
+
+//=======================================================================
+//function : PrintTransferStatus
+//purpose :
+//=======================================================================
+
+Standard_Boolean Transfer_TransientProcess::PrintTransferStatus(const Standard_Integer theNum,
+ const Handle(Message_Messenger)& theMessenger) const
+{
+ Handle(Transfer_Binder) binder;
+ Handle(Standard_Transient) finder;
+ Handle(Standard_Transient) aSource;
+
+ if (theNum == 0) return Standard_False;
+
+ const Handle(Interface_InterfaceModel) &model = Model();
+ if (model.IsNull()) cout<<"No Model"<<endl;
+
+ Standard_Integer ne=0, nr=0, max = NbMapped(), maxr = NbRoots();
+ if (theNum > 0) {
+ if (theNum > max) return Standard_False;
+ ne = theNum;
+ aSource = Mapped(ne);
+ nr = RootIndex(finder);
+ } else if (theNum < 0) {
+ nr = -theNum;
+ if (nr > maxr) return Standard_False;
+ aSource = Root(nr);
+ ne = MapIndex(aSource);
+ }
+
+ theMessenger<<"Transfer Read item n0."<<ne<<" of "<<max;
+ if (nr > 0) theMessenger<<" ** Transfer Root n0."<<ne<<endl;
+ if (!model.IsNull())
+ { theMessenger<<" In input Model, Entity "; model->Print(aSource,theMessenger); }
+ theMessenger<<endl;
+
+ binder = MapItem (ne);
+ StartTrace (binder,aSource,0,0);
+
+ // *** CHECK ***
+ if (!binder.IsNull()) {
+ const Handle(Interface_Check) ch = binder->Check();
+ Standard_Integer i, nbw = ch->NbWarnings(), nbf = ch->NbFails();
+ if (nbw > 0) {
+ theMessenger<<" - Warnings : "<<nbw<<" :\n";
+ for (i = 1; i <= nbw; i ++) theMessenger<<ch->CWarning(i)<<endl;
+ }
+ if (nbf > 0) {
+ theMessenger<<" - Fails : "<<nbf<<" :\n";
+ for (i = 1; i <= nbf; i ++) theMessenger<<ch->CFail(i)<<endl;
+ }
+ }
+ return Standard_True;
+}
+
+
+//=======================================================================
+//function : ResultFromNumber
+//purpose :
+//=======================================================================
+
+Handle(Transfer_ResultFromModel) Transfer_TransientProcess::ResultFromNumber (const Standard_Integer num) const
+{
+ if ( num<1 || num>myModel->NbEntities() ) return NULL;
+ if(!myResults.IsBound(num)) return NULL;
+ return Handle(Transfer_ResultFromModel)::DownCast(myResults.Find(num));
}
#include <Standard.hxx>
#include <Standard_Type.hxx>
+//c1:#include <TCollection_AsciiString.hxx>
#include <TColStd_SequenceOfTransient.hxx>
+#include <TColStd_DataMapOfIntegerTransient.hxx>
+#include <TopoDS_Shape.hxx>
#include <Transfer_Process.hxx>
+#include <Interface_CheckStatus.hxx>
class Dico_DictionaryOfTransient;
class Message_Messenger;
class Interface_HGraph;
class Interface_EntityIterator;
+class Transfer_ResultFromModel;
class Transfer_TransientProcess;
DEFINE_STANDARD_HANDLE(Transfer_TransientProcess, Transfer_Process)
Handle(Dico_DictionaryOfTransient)& Context() { return thectx; }
TColStd_SequenceOfTransient & RootsForTransfer() { return thetrroots; }
+
+ //! Defines a new TransferProcess for reading transfer
+ //! Returns True if done, False if data are not properly defined
+ //! (the Model, the Actor for Read)
+ Standard_EXPORT Standard_Boolean BeginTransfer();
+
+ //! Commands the transfer on reading for an entity to data for
+ //! Imagine, using the selected Actor for Read
+ //! Returns count of transferred entities, ok or with fails (0/1)
+ //! If <rec> is True (D), the result is recorded by RecordResult
+ Standard_EXPORT Standard_Integer TransferOne (const Handle(Standard_Transient)& theEnt);
+
+ //! Records a final result of transferring an entity
+ //! This result is recorded as a ResultFromModel, taken from
+ //! the TransientProcess
+ //! Returns True if a result is available, False else
+ Standard_EXPORT Standard_Boolean RecordResult (const Handle(Standard_Transient)& theEnt);
+
+ //! Returns True if a final result is recorded for an entity
+ //! Remark that it can bring no effective result if transfer has
+ //! completely failed (FinalResult brings only fail messages ...)
+ Standard_EXPORT Standard_Boolean IsRecorded (const Handle(Standard_Transient)& theEnt) const;
+
+ //! Returns the list of entities to which a final result is
+ //! attached (i.e. processed by RecordResult)
+ Standard_EXPORT Handle(TColStd_HSequenceOfTransient) RecordedList() const;
+
+ //! Returns the final result recorded for an entity, as such
+ Standard_EXPORT Handle(Transfer_ResultFromModel) FinalResult (const Handle(Standard_Transient)& theEnt) const;
+
+ //! Returns the resulting object as a Shape
+ //! Null Shape if no result or result not a shape
+ Standard_EXPORT TopoDS_Shape ShapeResult (const Handle(Standard_Transient)& theEnt) const;
+
+ //! Returns an entity from which a given shape result was produced
+ //! If <mode> = 0 (D), searches in last root transfers
+ //! If <mode> = 1, searches in last (root & sub) transfers
+ //! If <mode> = 2, searches in root recorded results
+ //! If <mode> = 3, searches in all (root & sub) recordeds
+ //! <res> can be, either a transient object (result itself) or
+ //! a binder. For a binder of shape, calls EntityFromShapeResult
+ //! Returns a Null Handle if <res> not recorded or not a Shape
+ Standard_EXPORT Handle(Standard_Transient) EntityFromShapeResult (const TopoDS_Shape& theRes, const Standard_Integer theMode = 0) const;
+
+ //! Returns the list of starting entities to which a given check
+ //! status is attached, IN FINAL RESULTS
+ //! <ent> can be an entity, or the model to query all entities
+ //! Below, "entities" are, either <ent> plus its sub-transferred,
+ //! or all the entities of the model
+ //!
+ //! <check> = -2 , all entities whatever the check (see result)
+ //! <check> = -1 , entities with no fail (warning allowed)
+ //! <check> = 0 , entities with no check at all
+ //! <check> = 1 , entities with warning but no fail
+ //! <check> = 2 , entities with fail
+ //! <result> : if True, only entities with an attached result
+ //! Remark : result True and check=0 will give an empty list
+ Standard_EXPORT Handle(TColStd_HSequenceOfTransient) CheckedList (const Handle(Standard_Transient)& theEnt, const Interface_CheckStatus WithCheck = Interface_CheckAny, const Standard_Boolean theResult = Standard_True) const;
+
+ //! Prints the transfer status of a transferred item, as beeing the Mapped n0 <num>
+ //! Returns True when done, False else (i.e. num out of range)
+ Standard_EXPORT virtual Standard_Boolean PrintTransferStatus (const Standard_Integer theNum, const Handle(Message_Messenger)& theMessenger) const Standard_OVERRIDE;
+
+ void ClearResults () { myResults.Clear(); }
DEFINE_STANDARD_RTTIEXT(Transfer_TransientProcess,Transfer_Process)
//! Specific printing to trace an entity : prints label and type
//! (if model is set)
Standard_EXPORT void PrintTrace (const Handle(Standard_Transient)& start, const Handle(Message_Messenger)& S) const Standard_OVERRIDE;
+
+ //! Returns the final result recorded for a NUMBER of entity
+ //! (internal use). Null if out of range
+ Standard_EXPORT Handle(Transfer_ResultFromModel) ResultFromNumber (const Standard_Integer theNum) const;
private:
Handle(Interface_HGraph) thegraph;
Handle(Dico_DictionaryOfTransient) thectx;
TColStd_SequenceOfTransient thetrroots;
+ TColStd_DataMapOfIntegerTransient myResults;
};
#endif // _Transfer_TransientProcess_HeaderFile
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <Draw.hxx>
#include <Draw_Interpretor.hxx>
-#include <IFSelect_SessionPilot.hxx>
#include <IGESCAFControl_Reader.hxx>
#include <IGESCAFControl_Writer.hxx>
#include <IGESControl_Controller.hxx>
#include <TDF_Data.hxx>
#include <TDocStd_Application.hxx>
#include <TDocStd_Document.hxx>
+#include <IFSelect_WorkSession.hxx>
#include <XDEDRAW.hxx>
#include <XDEDRAW_Common.hxx>
-#include <XSControl_WorkSession.hxx>
#include <XSDRAW.hxx>
#include <XSDRAW_Vars.hxx>
#include <XSDRAWIGES.hxx>
//============================================================
// Support for several models in DRAW
//============================================================
-static Handle(Dico_DictionaryOfTransient) thedictws = new Dico_DictionaryOfTransient;
-
-static void AddWS(TCollection_AsciiString filename,
- const Handle(XSControl_WorkSession)& WS)
-{
- WS->SetVars ( new XSDRAW_Vars ); // support of DRAW variables
- thedictws->SetItem( filename, WS );
-}
-
-
-static Standard_Boolean FillDicWS(Handle(STEPCAFControl_DictionaryOfExternFile)& dicFile)
+static class DictionaryOfSession
{
- thedictws->Clear();
- if ( dicFile->IsEmpty() ) {
- return Standard_False;
+ Handle(Dico_DictionaryOfTransient) myDict;
+public:
+ DictionaryOfSession() : myDict(new Dico_DictionaryOfTransient) {}
+ void AddWS(TCollection_AsciiString filename, const Handle(IFSelect_WorkSession)& WS)
+ {
+ WS->SetVars ( new XSDRAW_Vars ); // support of DRAW variables
+ myDict->SetItem( filename, WS );
+ }
+ void AddWS(Handle(STEPCAFControl_DictionaryOfExternFile)& dicFile)
+ {
+ myDict->Clear();
+ if ( !dicFile->IsEmpty() ) {
+ Handle(STEPCAFControl_ExternFile) EF;
+ STEPCAFControl_IteratorOfDictionaryOfExternFile DicEFIt ( dicFile );
+ for (; DicEFIt.More(); DicEFIt.Next() ) {
+ TCollection_AsciiString filename = DicEFIt.Name();
+ EF = DicEFIt.Value();
+ Handle(IFSelect_WorkSession) WS = Handle(IFSelect_WorkSession)::DownCast(EF->GetWS());
+ AddWS ( filename, WS ); //szv_c1: Need to provide IFSelect_WorkSession
+ }
+ }
+ }
+ // Set current file if many files are read
+ void SetCurWS (const TCollection_AsciiString &filename)
+ {
+ if ( myDict->HasItem(filename) ) {
+ Handle(IFSelect_WorkSession) CurrentWS = Handle(IFSelect_WorkSession)::DownCast( myDict->Item(filename) );
+ XSDRAW::Pilot()->SetSession( CurrentWS );
+ }
+ }
+ Standard_Integer GetDicWSList (Draw_Interpretor& di)
+ {
+ if ( myDict->IsEmpty() ) return 1;
+ Dico_IteratorOfDictionaryOfTransient DicIt ( myDict );
+ di << " The list of last translated files:\n";
+ Standard_Integer num = 0;
+ for (; DicIt.More() ; DicIt.Next(), num++ ) {
+ TCollection_AsciiString strng ( DicIt.Name() );
+ if ( num ) di << "\n";
+ di << "\"" << strng.ToCString() << "\"";
+ }
+ return 0;
}
- Handle(STEPCAFControl_ExternFile) EF;
- STEPCAFControl_IteratorOfDictionaryOfExternFile DicEFIt ( dicFile );
- for (; DicEFIt.More(); DicEFIt.Next() ) {
- TCollection_AsciiString filename = DicEFIt.Name();
- EF = DicEFIt.Value();
- AddWS ( filename, EF->GetWS() );
+ Standard_Integer FromShape (Draw_Interpretor& di, const char *command)
+ {
+ if ( myDict->IsEmpty() ) return di.Eval ( command );
+ const Handle(IFSelect_WorkSession) &WS = XSDRAW::Session();
+ Dico_IteratorOfDictionaryOfTransient DicIt ( myDict );
+ Standard_Integer num = 0;
+ for (; DicIt.More() ; DicIt.Next(), num++ ) {
+ Handle(IFSelect_WorkSession) CurrentWS = Handle(IFSelect_WorkSession)::DownCast( DicIt.Value() );
+ XSDRAW::Pilot()->SetSession( CurrentWS );
+ di.Eval ( command );
+ }
+ XSDRAW::Pilot()->SetSession( WS );
+ return 0;
}
- return Standard_True;
}
-
+gSessions;
//=======================================================================
//function : SetCurWS
di<<"Use: "<<argv[0]<<" filename \n";
return 1;
}
- TCollection_AsciiString filename (argv[1]);
- if ( thedictws->HasItem(filename) ) {
- Handle(XSControl_WorkSession) CurrentWS =
- Handle(XSControl_WorkSession)::DownCast( thedictws->Item(filename) );
- XSDRAW::Pilot()->SetSession( CurrentWS );
- }
+ TCollection_AsciiString filename(argv[1]);
+ gSessions.SetCurWS(filename);
return 0;
}
-
//=======================================================================
//function : GetDicWSList
//purpose : List all files recorded after translation
static Standard_Integer GetDicWSList (Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/)
{
- Handle(Dico_DictionaryOfTransient) DictWS = thedictws;
- if ( DictWS->IsEmpty() ) return 1;
- Dico_IteratorOfDictionaryOfTransient DicIt ( DictWS );
- di << " The list of last translated files:\n";
- Standard_Integer num = 0;
- for (; DicIt.More() ; DicIt.Next(), num++ ) {
- TCollection_AsciiString strng ( DicIt.Name() );
- if ( num ) di << "\n";
- di << "\"" << strng.ToCString() << "\"";
- }
- return 0;
+ return gSessions.GetDicWSList(di);
}
//=======================================================================
static Standard_Integer GetCurWS (Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/)
{
- Handle(XSControl_WorkSession) WS = XSDRAW::Session();
- di << "\"" << WS->LoadedFile() << "\"";
+ di << "\"" << XSDRAW::Session()->LoadedFile() << "\"";
return 0;
}
di << argv[0] << " shape: search for shape origin among all last tranalated files\n";
return 0;
}
-
+
char command[256];
Sprintf ( command, "fromshape %.200s -1", argv[1] );
- Handle(Dico_DictionaryOfTransient) DictWS = thedictws;
- if ( DictWS->IsEmpty() ) return di.Eval ( command );
-
- Handle(XSControl_WorkSession) WS = XSDRAW::Session();
-
- Dico_IteratorOfDictionaryOfTransient DicIt ( DictWS );
-// di << "Searching for shape among all the loaded files:\n";
- Standard_Integer num = 0;
- for (; DicIt.More() ; DicIt.Next(), num++ ) {
- Handle(XSControl_WorkSession) CurrentWS =
- Handle(XSControl_WorkSession)::DownCast( DicIt.Value() );
- XSDRAW::Pilot()->SetSession( CurrentWS );
- di.Eval ( command );
- }
- XSDRAW::Pilot()->SetSession( WS );
- return 0;
+ return gSessions.FromShape(di,command);
}
//=======================================================================
DeclareAndCast(IGESControl_Controller,ctl,XSDRAW::Controller());
if (ctl.IsNull()) XSDRAW::SetNorm("IGES");
- IGESCAFControl_Reader reader ( XSDRAW::Session(),Standard_True);
+ IGESCAFControl_Reader reader ( XSDRAW::Session(), Standard_True );
if (argc == 4) {
Standard_Boolean mode = Standard_True;
Standard_Boolean modfic = XSDRAW::FileAndVar (argv[2],argv[1],"IGES",fnom,rnom);
if (modfic) di<<" File IGES to read : "<<fnom.ToCString()<<"\n";
else di<<" Model taken from the session : "<<fnom.ToCString()<<"\n";
-// di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom<<"\n";
- IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
+ Interface_ReturnStatus readstat = Interface_RetVoid;
if (modfic) readstat = reader.ReadFile (fnom.ToCString());
- else if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
- if (readstat != IFSelect_RetDone) {
+ else if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = Interface_RetDone;
+ if (readstat != Interface_RetDone) {
if (modfic) di<<"Could not read file "<<fnom.ToCString()<<" , abandon\n";
else di<<"No model loaded\n";
return 1;
TDataStd_Name::Set(doc->GetData()->Root(),argv[1]);
Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(doc);
Draw::Set(argv[1],DD);
-// di << "Document saved with name " << argv[1];
}
if ( ! reader.Transfer ( doc ) ) {
di << "Cannot read any relevant data from the IGES file\n";
return 1;
}
-// Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(doc);
-// Draw::Set(argv[1],DD);
di << "Document saved with name " << argv[1];
return 0;
return 1;
}
- XSDRAW::SetNorm ("IGES");
+ XSDRAW::SetNorm("IGES");
-// IGESControl_Writer ICW (Interface_Static::CVal("write.iges.unit"),
-// Interface_Static::IVal("write.iges.brep.mode"));
-
- IGESCAFControl_Writer writer ( XSDRAW::Session(), Standard_True );
+ IGESCAFControl_Writer writer ( XSDRAW::Session() );
if (argc == 4) {
Standard_Boolean mode = Standard_True;
for ( Standard_Integer i = 0; argv[3][i] ; i++ )
DeclareAndCast(STEPControl_Controller,ctl,XSDRAW::Controller());
if (ctl.IsNull()) XSDRAW::SetNorm("STEP");
- STEPCAFControl_Reader reader ( XSDRAW::Session(),Standard_True);
+ STEPCAFControl_Reader reader ( XSDRAW::Session(), Standard_True );
if (argc == 4) {
Standard_Boolean mode = Standard_True;
Standard_Boolean modfic = XSDRAW::FileAndVar (argv[2],argv[1],"STEP",fnom,rnom);
if (modfic) di<<" File STEP to read : "<<fnom.ToCString()<<"\n";
else di<<" Model taken from the session : "<<fnom.ToCString()<<"\n";
-// di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom<<"\n";
- IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
+ Interface_ReturnStatus readstat = Interface_RetVoid;
if (modfic) readstat = reader.ReadFile (fnom.ToCString());
- else if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
- if (readstat != IFSelect_RetDone) {
+ else if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = Interface_RetDone;
+ if (readstat != Interface_RetDone) {
if (modfic) di<<"Could not read file "<<fnom.ToCString()<<" , abandon\n";
else di<<"No model loaded\n";
return 1;
TDataStd_Name::Set(doc->GetData()->Root(),argv[1]);
Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(doc);
Draw::Set(argv[1],DD);
-// di << "Document saved with name " << argv[1];
}
if ( ! reader.Transfer ( doc ) ) {
di << "Cannot read any relevant data from the STEP file\n";
di << "Document saved with name " << argv[1];
Handle(STEPCAFControl_DictionaryOfExternFile) DicFile = reader.ExternFiles();
- FillDicWS( DicFile );
- AddWS ( fnom , XSDRAW::Session() );
+ gSessions.AddWS( DicFile );
+ gSessions.AddWS( fnom, XSDRAW::Session() );
return 0;
}
di << "Writing STEP file " << argv[2] << "\n";
- IFSelect_ReturnStatus stat = writer.Write(argv[2]);
+ Interface_ReturnStatus stat = writer.Write(argv[2]);
switch (stat) {
- case IFSelect_RetVoid : di<<"No file written\n"; break;
- case IFSelect_RetDone : {
+ case Interface_RetVoid : di<<"No file written\n"; break;
+ case Interface_RetDone : {
di<<"File "<<argv[2]<<" written\n";
Handle(STEPCAFControl_DictionaryOfExternFile) DicFile = writer.ExternFiles();
- FillDicWS( DicFile );
- AddWS( argv[2], XSDRAW::Session() );
+ gSessions.AddWS( DicFile );
+ gSessions.AddWS( argv[2], XSDRAW::Session() );
break;
}
default : di<<"Error on writing file\n"; break;
di.Add("XExpand", "XExpand Doc recursively(0/1) or XExpand Doc recursively(0/1) label1 abel2 ..."
"or XExpand Doc recursively(0/1) shape1 shape2 ...",__FILE__, Expand, g);
-
}
//! and corrects it if necessary.
Standard_EXPORT virtual Standard_Boolean CheckPCurve (const TopoDS_Edge& edge, const TopoDS_Face& face, const Standard_Real preci, const Standard_Boolean isSeam) const;
- Standard_EXPORT virtual void MergeTransferInfo (const Handle(Transfer_TransientProcess)& TP, const Handle(Standard_Transient)& info, const Standard_Integer startTPitem = 1) const;
+ Standard_EXPORT void MergeTransferInfo (const Handle(Transfer_TransientProcess)& TP, const Handle(Standard_Transient)& info, const Standard_Integer startTPitem = 1) const;
//! Updates translation map (TP or FP) with information
//! resulting from ShapeProcessing
//! Parameter startTPitem can be used for optimisation, to
//! restrict modifications to entities stored in TP starting
//! from item startTPitem
- Standard_EXPORT virtual void MergeTransferInfo (const Handle(Transfer_FinderProcess)& FP, const Handle(Standard_Transient)& info) const;
-
-
-
+ Standard_EXPORT void MergeTransferInfo (const Handle(Transfer_FinderProcess)& FP, const Handle(Standard_Transient)& info) const;
DEFINE_STANDARD_RTTIEXT(XSAlgo_AlgoContainer,MMgt_TShared)
-protected:
-
-
-
-
-private:
-
+ private:
Handle(XSAlgo_ToolContainer) myTC;
-
-
};
-
#include <XSAlgo_AlgoContainer.lxx>
-
-
-
-
#endif // _XSAlgo_AlgoContainer_HeaderFile
-XSControl_ConnectedShapes.cxx
-XSControl_ConnectedShapes.hxx
XSControl_Controller.cxx
XSControl_Controller.hxx
XSControl_Reader.cxx
XSControl_Reader.hxx
-XSControl_SelectForTransfer.cxx
-XSControl_SelectForTransfer.hxx
-XSControl_SignTransferStatus.cxx
-XSControl_SignTransferStatus.hxx
-XSControl_TransferReader.cxx
-XSControl_TransferReader.hxx
-XSControl_TransferWriter.cxx
-XSControl_TransferWriter.hxx
-XSControl_Vars.cxx
-XSControl_Vars.hxx
XSControl_WorkSession.cxx
XSControl_WorkSession.hxx
XSControl_Writer.cxx
+++ /dev/null
-// 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 <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopTools_MapOfShape.hxx>
-#include <Transfer_TransientProcess.hxx>
-#include <TransferBRep.hxx>
-#include <XSControl_ConnectedShapes.hxx>
-#include <XSControl_TransferReader.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(XSControl_ConnectedShapes,IFSelect_SelectExplore)
-
-XSControl_ConnectedShapes::XSControl_ConnectedShapes ()
- : IFSelect_SelectExplore (1) { }
-
- XSControl_ConnectedShapes::XSControl_ConnectedShapes
- (const Handle(XSControl_TransferReader)& TR)
- : IFSelect_SelectExplore (1) , theTR (TR) { }
-
- void XSControl_ConnectedShapes::SetReader
- (const Handle(XSControl_TransferReader)& TR)
- { theTR = TR; }
-
- Standard_Boolean XSControl_ConnectedShapes::Explore
- (const Standard_Integer /*level*/, const Handle(Standard_Transient)& ent,
- const Interface_Graph& /*G*/, Interface_EntityIterator& explored) const
-{
- Handle(Transfer_TransientProcess) TP;
- if (!theTR.IsNull()) TP = theTR->TransientProcess();
- if (TP.IsNull()) return Standard_False;
- TopoDS_Shape Shape = TransferBRep::ShapeResult (TP,ent);
- if (Shape.IsNull()) return Standard_False;
- Handle(TColStd_HSequenceOfTransient) li = AdjacentEntities (Shape,TP,TopAbs_FACE);
- explored.AddList (li);
- return Standard_True;
-}
-
- TCollection_AsciiString XSControl_ConnectedShapes::ExploreLabel () const
-{
- TCollection_AsciiString lab("Connected Entities through produced Shapes");
- return lab;
-}
-
- Handle(TColStd_HSequenceOfTransient) XSControl_ConnectedShapes::AdjacentEntities
- (const TopoDS_Shape& ashape,
- const Handle(Transfer_TransientProcess)& TP,
- const TopAbs_ShapeEnum type)
-{
- Handle(TColStd_HSequenceOfTransient) li = new TColStd_HSequenceOfTransient();
- Standard_Integer i, nb = TP->NbMapped();
-// TopTools_MapOfShape adj (nb);
- TopTools_MapOfShape vtx(20);
-
- for (TopExp_Explorer vert(ashape,TopAbs_VERTEX); vert.More(); vert.Next()) {
- vtx.Add (vert.Current());
- }
-
- for (i = 1; i <= nb; i ++) {
- Handle(Transfer_Binder) bnd = TP->MapItem(i);
- TopoDS_Shape sh = TransferBRep::ShapeResult (bnd);
- if (sh.IsNull()) continue;
- if (sh.ShapeType() != type) continue;
- for (TopExp_Explorer vsh(sh,TopAbs_VERTEX); vsh.More(); vsh.Next()) {
- TopoDS_Shape avtx = vsh.Current();
- if (vtx.Contains(avtx)) {
- li->Append (TP->Mapped(i));
- break; // break de ce for interieur, entite suivante
- }
- }
- }
-
- return li;
-}
+++ /dev/null
-// Created on: 1999-02-24
-// Created by: Christian CAILLET
-// Copyright (c) 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 _XSControl_ConnectedShapes_HeaderFile
-#define _XSControl_ConnectedShapes_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectExplore.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <TopAbs_ShapeEnum.hxx>
-class XSControl_TransferReader;
-class Standard_Transient;
-class Interface_Graph;
-class Interface_EntityIterator;
-class TCollection_AsciiString;
-class TopoDS_Shape;
-class Transfer_TransientProcess;
-
-
-class XSControl_ConnectedShapes;
-DEFINE_STANDARD_HANDLE(XSControl_ConnectedShapes, IFSelect_SelectExplore)
-
-//! From a TopoDS_Shape, or from the entity which has produced it,
-//! searches for the shapes, and the entities which have produced
-//! them in last transfer, which are adjacent to it by VERTICES
-class XSControl_ConnectedShapes : public IFSelect_SelectExplore
-{
-
-public:
-
-
- //! Creates a Selection ConnectedShapes. It remains to be set a
- //! TransferReader
- Standard_EXPORT XSControl_ConnectedShapes();
-
- //! Creates a Selection ConnectedShapes, which will work with the
- //! current TransferProcess brought by the TransferReader
- Standard_EXPORT XSControl_ConnectedShapes(const Handle(XSControl_TransferReader)& TR);
-
- //! Sets a TransferReader to sort entities : it brings the
- //! TransferProcess which may change, while the TransferReader does not
- Standard_EXPORT void SetReader (const Handle(XSControl_TransferReader)& TR);
-
- //! Explores an entity : entities from which are connected to that
- //! produced by this entity, including itself
- Standard_EXPORT Standard_Boolean Explore (const Standard_Integer level, const Handle(Standard_Transient)& ent, const Interface_Graph& G, Interface_EntityIterator& explored) const Standard_OVERRIDE;
-
- //! Returns a text defining the criterium.
- //! "Connected Entities through produced Shapes"
- Standard_EXPORT TCollection_AsciiString ExploreLabel() const Standard_OVERRIDE;
-
- //! This functions considers a shape from a transfer and performs
- //! the search function explained above
- Standard_EXPORT static Handle(TColStd_HSequenceOfTransient) AdjacentEntities (const TopoDS_Shape& ashape, const Handle(Transfer_TransientProcess)& TP, const TopAbs_ShapeEnum type);
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(XSControl_ConnectedShapes,IFSelect_SelectExplore)
-
-protected:
-
-
-
-
-private:
-
-
- Handle(XSControl_TransferReader) theTR;
-
-
-};
-
-
-
-
-
-
-
-#endif // _XSControl_ConnectedShapes_HeaderFile
#include <Dico_DictionaryOfTransient.hxx>
-//#include <Dico_IteratorOfDictionaryOfInteger.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
-//s#include <IFSelect_DispPerCount.hxx>
-//s#include <IFSelect_DispPerFiles.hxx>
-//s#include <IFSelect_DispPerOne.hxx>
-//s#include <IFSelect_DispPerSignature.hxx>
-//s#include <IFSelect_EditForm.hxx>
-#include <IFSelect_GeneralModifier.hxx>
-//s#include <IFSelect_GraphCounter.hxx>
-//s#include <IFSelect_IntParam.hxx>
-//s#include <IFSelect_ParamEditor.hxx>
-//s#include <IFSelect_SelectModelEntities.hxx>
-//s#include <IFSelect_SelectModelRoots.hxx>
-//s#include <IFSelect_SelectPointed.hxx>
-//s#include <IFSelect_SelectShared.hxx>
-//s#include <IFSelect_SelectSharing.hxx>
-#include <IFSelect_ShareOut.hxx>
-//s#include <IFSelect_SignAncestor.hxx>
-//s#include <IFSelect_Signature.hxx>
-//s#include <IFSelect_SignCategory.hxx>
-//s#include <IFSelect_SignCounter.hxx>
-//s#include <IFSelect_SignType.hxx>
-//s#include <IFSelect_SignValidity.hxx>
#include <Interface_InterfaceModel.hxx>
+#include <Interface_HArray1OfHAsciiString.hxx>
#include <Interface_Macros.hxx>
#include <Interface_Protocol.hxx>
#include <Interface_Static.hxx>
#include <TCollection_HAsciiString.hxx>
#include <TColStd_HSequenceOfHAsciiString.hxx>
#include <TColStd_IndexedMapOfTransient.hxx>
-#include <TopoDS_Shape.hxx>
#include <Transfer_FinderProcess.hxx>
-#include <Transfer_SimpleBinderOfTransient.hxx>
-#include <TransferBRep_ShapeMapper.hxx>
-//s#include <XSControl_ConnectedShapes.hxx>
#include <XSControl_Controller.hxx>
-//s#include <XSControl_SelectForTransfer.hxx>
-//s#include <XSControl_SignTransferStatus.hxx>
#include <XSControl_WorkSession.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XSControl_Controller,MMgt_TShared)
-// ParamEditor
-// Transferts
-static const Handle(Dico_DictionaryOfTransient)& listadapt()
+namespace {
+static class RecordedAdaptors
+{
+ Handle(Dico_DictionaryOfTransient) myDictionary;
+ public:
+ RecordedAdaptors() : myDictionary(new Dico_DictionaryOfTransient) {}
+ void Record (const TCollection_AsciiString &theName, const Handle(XSControl_Controller) &theCtl) const
+ {
+ Standard_Boolean isAlreadyRegistered = Standard_False;
+ Handle(Standard_Transient)& newadapt = myDictionary->NewItem(theName,isAlreadyRegistered);
+ if (isAlreadyRegistered) {
+ if (newadapt->IsKind(theCtl->DynamicType()))
+ return;
+ if (!(theCtl->IsKind(newadapt->DynamicType())) && theCtl != newadapt)
+ Standard_DomainError::Raise("XSControl_Controller : Attempt to overwrite a more specific controller");
+ }
+ newadapt = theCtl;
+ }
+ Handle(XSControl_Controller) Recorded (const Standard_CString theName) const
+ {
+ Handle(Standard_Transient) recorded;
+ return (myDictionary->GetItem(theName,recorded)?
+ Handle(XSControl_Controller)::DownCast(recorded) :
+ Handle(XSControl_Controller)());
+ }
+} gAdaptors;
+}
+
+//=======================================================================
+//function : AutoRecord
+//purpose :
+//=======================================================================
+
+void XSControl_Controller::AutoRecord () const
{
- static Handle(Dico_DictionaryOfTransient) listad;
- if (listad.IsNull()) listad = new Dico_DictionaryOfTransient;
- return listad;
+ gAdaptors.Record (myName,this);
}
//=======================================================================
//purpose : Constructor
//=======================================================================
-XSControl_Controller::XSControl_Controller (const Standard_CString theLongName, const Standard_CString theShortName)
-: myShortName(theShortName), myLongName(theLongName)
+XSControl_Controller::XSControl_Controller (const Standard_CString theName)
+: myName(theName),
+ thelevdef(0)
{
// Standard parameters
Interface_Static::Standards();
TraceStatic ("write.precision.val" , 6);
}
-//=======================================================================
-//function : TraceStatic
-//purpose :
-//=======================================================================
-
-void XSControl_Controller::TraceStatic (const Standard_CString theName, const Standard_Integer theUse)
-{
- Handle(Interface_Static) val = Interface_Static::Static(theName);
- if (val.IsNull()) return;
- myParams.Append (val);
- myParamUses.Append(theUse);
-}
-
-//=======================================================================
-//function : SetNames
-//purpose :
-//=======================================================================
-
-void XSControl_Controller::SetNames (const Standard_CString theLongName, const Standard_CString theShortName)
-{
- if (theLongName && theLongName[0] != '\0') {
- myLongName.Clear(); myLongName.AssignCat (theLongName);
- }
- if (theShortName && theShortName[0] != '\0') {
- myShortName.Clear(); myShortName.AssignCat(theShortName);
- }
-}
-
-//=======================================================================
-//function : Record
-//purpose :
-//=======================================================================
-
-void XSControl_Controller::Record (const Standard_CString theName) const
-{
- Standard_Boolean isAlreadyRegistered = Standard_False;
- Handle(Standard_Transient)& newadapt = listadapt()->NewItem(theName,isAlreadyRegistered);
- if (isAlreadyRegistered) {
- Handle(Standard_Transient) thisadapt (this);
- if (newadapt->IsKind(thisadapt->DynamicType()))
- return;
- if (!(thisadapt->IsKind(newadapt->DynamicType())) && thisadapt != newadapt)
- Standard_DomainError::Raise("XSControl_Controller : Record");
- }
- newadapt = this;
-}
-
//=======================================================================
//function : Recorded
//purpose :
Handle(XSControl_Controller) XSControl_Controller::Recorded (const Standard_CString theName)
{
- Handle(Standard_Transient) recorded;
- return (listadapt()->GetItem(theName,recorded)?
- Handle(XSControl_Controller)::DownCast(recorded) :
- Handle(XSControl_Controller)());
+ return gAdaptors.Recorded(theName);
}
// #### DEFINITION ####
return myAdaptorRead;
}
-//=======================================================================
-//function : ActorWrite
-//purpose :
-//=======================================================================
-
-Handle(Transfer_ActorOfFinderProcess) XSControl_Controller::ActorWrite () const
-{
- return myAdaptorWrite;
-}
-
// ###########################
-// Help du Transfer : controle de valeur + help
-
-//=======================================================================
-//function : SetModeWrite
-//purpose :
-//=======================================================================
-
-void XSControl_Controller::SetModeWrite
- (const Standard_Integer modemin, const Standard_Integer modemax, const Standard_Boolean )
-{
- if (modemin > modemax) { myModeWriteShapeN.Nullify(); return; }
- myModeWriteShapeN = new Interface_HArray1OfHAsciiString (modemin,modemax);
-}
-
-//=======================================================================
-//function : SetModeWriteHelp
-//purpose :
-//=======================================================================
-
-void XSControl_Controller::SetModeWriteHelp
- (const Standard_Integer modetrans, const Standard_CString help, const Standard_Boolean )
-{
- if (myModeWriteShapeN.IsNull()) return;
- if (modetrans < myModeWriteShapeN->Lower() ||
- modetrans > myModeWriteShapeN->Upper()) return;
- Handle(TCollection_HAsciiString) hl = new TCollection_HAsciiString (help);
- myModeWriteShapeN->SetValue (modetrans,hl);
-}
+// Cutomisation ! On enregistre des Items pour une WorkSession
+// (annule et remplace)
+// Ensuite, on les remet en place a la demande
//=======================================================================
-//function : ModeWriteBounds
+//function : Customise
//purpose :
//=======================================================================
-Standard_Boolean XSControl_Controller::ModeWriteBounds
- (Standard_Integer& modemin, Standard_Integer& modemax, const Standard_Boolean ) const
+void XSControl_Controller::Customise (Handle(XSControl_WorkSession)&)
{
- modemin = modemax = 0;
- if (myModeWriteShapeN.IsNull()) return Standard_False;
- modemin = myModeWriteShapeN->Lower();
- modemax = myModeWriteShapeN->Upper();
- return Standard_True;
}
//=======================================================================
-//function : IsModeWrite
+//function : DumpEntity
//purpose :
//=======================================================================
-Standard_Boolean XSControl_Controller::IsModeWrite
- (const Standard_Integer modetrans, const Standard_Boolean ) const
+void XSControl_Controller::DumpEntity
+ (const Handle(Interface_InterfaceModel)& model,
+ const Handle(Interface_Protocol)& protocol,
+ const Handle(Standard_Transient)& entity,
+ const Handle(Message_Messenger)& S) const
{
- if (myModeWriteShapeN.IsNull()) return Standard_True;
- if (modetrans < myModeWriteShapeN->Lower()) return Standard_False;
- if (modetrans > myModeWriteShapeN->Upper()) return Standard_False;
- return Standard_True;
+ DumpEntity (model,protocol,entity,S,(thelevhlp.IsNull()? 0 : thelevdef));
}
//=======================================================================
-//function : ModeWriteHelp
+//function : SetDumpLevels
//purpose :
//=======================================================================
-Standard_CString XSControl_Controller::ModeWriteHelp
- (const Standard_Integer modetrans, const Standard_Boolean ) const
+void XSControl_Controller::SetDumpLevels
+ (const Standard_Integer def, const Standard_Integer max)
{
- if (myModeWriteShapeN.IsNull()) return "";
- if (modetrans < myModeWriteShapeN->Lower()) return "";
- if (modetrans > myModeWriteShapeN->Upper()) return "";
- Handle(TCollection_HAsciiString) str = myModeWriteShapeN->Value(modetrans);
- if (str.IsNull()) return "";
- return str->ToCString();
+ thelevdef = def;
+ if (max >= 0) thelevhlp = new Interface_HArray1OfHAsciiString (0,max);
+ else thelevhlp.Nullify();
}
-// ###########################
-// Transfer : on fait ce qu il faut par defaut (avec ActorWrite)
-// peut etre redefini ...
-
//=======================================================================
-//function : TransferWriteShape
+//function : DumpLevels
//purpose :
//=======================================================================
-IFSelect_ReturnStatus XSControl_Controller::TransferWriteShape
- (const TopoDS_Shape& shape,
- const Handle(Transfer_FinderProcess)& FP,
- const Handle(Interface_InterfaceModel)& model,
- const Standard_Integer modetrans) const
+void XSControl_Controller::DumpLevels
+ (Standard_Integer& def, Standard_Integer& max) const
{
- if (shape.IsNull()) return IFSelect_RetVoid;
- if (myAdaptorWrite.IsNull()) return IFSelect_RetError;
- if (model.IsNull()) return IFSelect_RetError;
-
- Handle(Transfer_Finder) aMapper = new TransferBRep_ShapeMapper(shape);
- myAdaptorWrite->SetTransferMode(modetrans);
- FP->SetModel (model);
- FP->SetActor (myAdaptorWrite);
- FP->Transfer (aMapper);
-
- IFSelect_ReturnStatus stat = IFSelect_RetFail;
- Handle(Transfer_Binder) binder = FP->Find (aMapper);
- while (!binder.IsNull()) {
- Handle(Transfer_SimpleBinderOfTransient) bindtr = Handle(Transfer_SimpleBinderOfTransient)::DownCast (binder);
- if (!bindtr.IsNull()) {
- Handle(Standard_Transient) ent = bindtr->Result();
- if (!ent.IsNull()) {
- stat = IFSelect_RetDone;
- model->AddWithRefs (ent);
- }
- }
- binder = binder->NextResult();
- }
- return stat;
+ def = thelevdef;
+ if (thelevhlp.IsNull()) { def = 0; max = -1; }
+ else max = thelevhlp->Upper();
}
-// ###########################
-// Cutomisation ! On enregistre des Items pour une WorkSession
-// (annule et remplace)
-// Ensuite, on les remet en place a la demande
-
//=======================================================================
-//function : AddSessionItem
+//function : SetDumpHelp
//purpose :
//=======================================================================
-void XSControl_Controller::AddSessionItem
- (const Handle(Standard_Transient)& theItem, const Standard_CString theName, const Standard_Boolean toApply)
+void XSControl_Controller::SetDumpHelp (const Standard_Integer level, const Standard_CString help)
{
- if (theItem.IsNull() || theName[0] == '\0') return;
- if (myAdaptorSession.IsNull())
- myAdaptorSession = new Dico_DictionaryOfTransient;
- myAdaptorSession->SetItem (theName,theItem);
- if (toApply && theItem->IsKind(STANDARD_TYPE(IFSelect_GeneralModifier)))
- myAdaptorApplied.Append(theItem);
+ if (thelevhlp.IsNull()) return;
+ if (level < 0 || level > thelevhlp->Upper()) return;
+ Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString (help);
+ thelevhlp->SetValue (level,str);
}
//=======================================================================
-//function : SessionItem
+//function : DumpHelp
//purpose :
//=======================================================================
-Handle(Standard_Transient) XSControl_Controller::SessionItem (const Standard_CString theName) const
+Standard_CString XSControl_Controller::DumpHelp (const Standard_Integer level) const
{
- Handle(Standard_Transient) item;
- if (!myAdaptorSession.IsNull())
- myAdaptorSession->GetItem (theName,item);
- return item;
+ 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();
}
//=======================================================================
-//function : Customise
+//function : TraceStatic
//purpose :
//=======================================================================
-void XSControl_Controller::Customise (Handle(XSControl_WorkSession)& WS)
+void XSControl_Controller::TraceStatic (const Standard_CString theName, const Standard_Integer theUse)
{
- WS->SetParams (myParams,myParamUses);
-
- // General
- if (!myAdaptorSession.IsNull()) {
- Dico_IteratorOfDictionaryOfTransient iter(myAdaptorSession);
- for (iter.Start(); iter.More(); iter.Next())
- WS->AddNamedItem (iter.Name().ToCString(), iter.Value());
- }
-
- /*szv_c1:
- if (WS->NamedItem("xst-model-all").IsNull()) {
-
- Handle(IFSelect_SelectModelEntities) sle = new IFSelect_SelectModelEntities;
- WS->AddNamedItem ("xst-model-all",sle);
-
- Handle(IFSelect_SelectModelRoots) slr = new IFSelect_SelectModelRoots;
- WS->AddNamedItem ("xst-model-roots",slr);
-
- if(strcasecmp(WS->SelectedNorm(),"STEP")) {
- Handle(XSControl_SelectForTransfer) st1 = new XSControl_SelectForTransfer;
- st1->SetInput (slr);
- st1->SetReader (WS->TransferReader());
- WS->AddNamedItem ("xst-transferrable-roots",st1);
- }
-
- Handle(XSControl_SelectForTransfer) st2 = new XSControl_SelectForTransfer;
- st2->SetInput (sle);
- st2->SetReader (WS->TransferReader());
- WS->AddNamedItem ("xst-transferrable-all",st2);
-
- Handle(XSControl_SignTransferStatus) strs = new XSControl_SignTransferStatus;
- strs->SetReader (WS->TransferReader());
- WS->AddNamedItem ("xst-transfer-status",strs);
-
- Handle(XSControl_ConnectedShapes) scs = new XSControl_ConnectedShapes;
- scs->SetReader (WS->TransferReader());
- WS->AddNamedItem ("xst-connected-faces",scs);
-
- Handle(IFSelect_SignType) stp = new IFSelect_SignType (Standard_False);
- WS->AddNamedItem ("xst-long-type",stp);
-
- Handle(IFSelect_SignType) stc = new IFSelect_SignType (Standard_True);
- WS->AddNamedItem ("xst-type",stc);
-
- WS->AddNamedItem ("xst-ancestor-type",new IFSelect_SignAncestor);
- WS->AddNamedItem ("xst-types",new IFSelect_SignCounter(stp,Standard_False,Standard_True));
- WS->AddNamedItem ("xst-category",new IFSelect_SignCategory);
- WS->AddNamedItem ("xst-validity",new IFSelect_SignValidity);
-
- Handle(IFSelect_DispPerOne) dispone = new IFSelect_DispPerOne;
- dispone->SetFinalSelection(slr);
- WS->AddNamedItem ("xst-disp-one",dispone);
-
- Handle(IFSelect_DispPerCount) dispcount = new IFSelect_DispPerCount;
- Handle(IFSelect_IntParam) intcount = new IFSelect_IntParam;
- intcount->SetValue(5);
- dispcount->SetCount(intcount);
- dispcount->SetFinalSelection(slr);
- WS->AddNamedItem ("xst-disp-count",dispcount);
-
- Handle(IFSelect_DispPerFiles) dispfiles = new IFSelect_DispPerFiles;
- Handle(IFSelect_IntParam) intfiles = new IFSelect_IntParam;
- intfiles->SetValue(10);
- dispfiles->SetCount(intfiles);
- dispfiles->SetFinalSelection(slr);
- WS->AddNamedItem ("xst-disp-files",dispfiles);
-
- Handle(IFSelect_DispPerSignature) dispsign = new IFSelect_DispPerSignature;
- dispsign->SetSignCounter(new IFSelect_SignCounter(Handle(IFSelect_Signature)(stc)));
- dispsign->SetFinalSelection(slr);
- WS->AddNamedItem ("xst-disp-sign",dispsign);
-
- // Not used directly but useful anyway
- WS->AddNamedItem ("xst-pointed",new IFSelect_SelectPointed);
- WS->AddNamedItem ("xst-sharing",new IFSelect_SelectSharing);
- WS->AddNamedItem ("xst-shared",new IFSelect_SelectShared);
- WS->AddNamedItem ("xst-nb-selected",new IFSelect_GraphCounter);
-
- WS->SetSignType( stp );
- }
- */
-
- // Applied Modifiers
- Standard_Integer i, nb = myAdaptorApplied.Length();
- for (i = 1; i <= nb; i ++) {
- const Handle(Standard_Transient) &anitem = myAdaptorApplied.Value(i);
- Handle(TCollection_HAsciiString) name = WS->Name(anitem);
- WS->SetAppliedModifier(GetCasted(IFSelect_GeneralModifier,anitem),WS->ShareOut());
- }
-
- // Editors of Parameters
- // Here for the specific manufacturers of controllers could create the
- // Parameters: So wait here
-
- /*szv_c1:
- Handle(TColStd_HSequenceOfHAsciiString) listat = Interface_Static::Items();
- Handle(IFSelect_ParamEditor) paramed = IFSelect_ParamEditor::StaticEditor (listat,"All Static Parameters");
- WS->AddNamedItem ("xst-static-params-edit",paramed);
- Handle(IFSelect_EditForm) paramform = paramed->Form(Standard_False);
- WS->AddNamedItem ("xst-static-params",paramform);
- */
+ Handle(Interface_Static) val = Interface_Static::Static(theName);
+ if (val.IsNull()) return;
+ myParams.Append (val);
+ myParamUses.Append(theUse);
}
#ifndef _XSControl_Controller_HeaderFile
#define _XSControl_Controller_HeaderFile
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_SequenceOfTransient.hxx>
-#include <TColStd_HSequenceOfHAsciiString.hxx>
-#include <TColStd_SequenceOfInteger.hxx>
-#include <Interface_HArray1OfHAsciiString.hxx>
#include <MMgt_TShared.hxx>
+
#include <NCollection_Vector.hxx>
-#include <IFSelect_ReturnStatus.hxx>
+#include <TCollection_AsciiString.hxx>
#include <Transfer_ActorOfTransientProcess.hxx>
#include <Transfer_ActorOfFinderProcess.hxx>
-class IFSelect_WorkLibrary;
class Interface_Protocol;
-class IFSelect_Signature;
-class Dico_DictionaryOfTransient;
-class Standard_DomainError;
-class XSControl_WorkSession;
class Interface_InterfaceModel;
-class Standard_Transient;
-class Transfer_FinderProcess;
-class TopoDS_Shape;
-class Interface_CheckIterator;
-
-
-class XSControl_Controller;
-DEFINE_STANDARD_HANDLE(XSControl_Controller, MMgt_TShared)
+class Interface_HArray1OfHAsciiString;
+class XSControl_WorkSession;
//! This class allows a general X-STEP engine to run generic
//! functions on any interface norm, in the same way. It includes
//!
//! The important point is that a given X-STEP Controller is
//! attached to a given couple made of an Interface Norm (such as
-//! IGES-5.1) and an application data model (CasCade Shapes for
-//! instance).
+//! IGES-5.1) and an application data model (OCCT shapes, for instance).
//!
-//! Finally, Controller can be gathered in a general dictionary then
-//! retreived later by a general call (method Recorded)
+//! Finally, a controller can be strored in a general dictionary
+//! then retreived later by a static method Recorded.
//!
//! It does not manage the produced data, but the Actors make the
//! link between the norm and the application
{
public:
- //! Changes names
- //! if a name is empty, the formerly set one remains
- //! Remark : Does not call Record or AutoRecord
- Standard_EXPORT void SetNames (const Standard_CString theLongName, const Standard_CString theShortName);
-
- //! Records <me> is a general dictionary under Short and Long
- //! Names (see method Name)
- void AutoRecord() const
- {
- Record (myShortName.ToCString());
- Record (myLongName.ToCString());
- }
+ //! Records a controller attached to its name
+ Standard_EXPORT void AutoRecord () const;
//! Returns the Controller attached to a given name
//! Returns a Null Handle if <name> is unknown
- Standard_EXPORT static Handle(XSControl_Controller) Recorded (const Standard_CString name);
+ Standard_EXPORT static Handle(XSControl_Controller) Recorded (const Standard_CString theName);
- //! Returns a name, as given when initializing :
- //! rsc = False (D) : True Name attached to the Norm (long name)
- //! rsc = True : Name of the ressource set (i.e. short name)
- Standard_CString Name (const Standard_Boolean rsc = Standard_False) const
- { return (rsc ? myShortName.ToCString() : myLongName.ToCString()); }
+ //! Returns a name, as given when initializing
+ Standard_CString Name () const { return myName.ToCString(); }
//! Returns the Protocol attached to the Norm (from field)
const Handle(Interface_Protocol) & Protocol () const { return myAdaptorProtocol; }
- //! Returns the WorkLibrary attached to the Norm. Remark that it
- //! has to be in phase with the Protocol (read from field)
- const Handle(IFSelect_WorkLibrary) & WorkLibrary() const
- { return myAdaptorLibrary; }
+ //! Gives the way to Read a File and transfer it to a Model
+ //! <mod> is the resulting Model, which has to be created by this
+ //! method. In case of error, <mod> 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 theFileName, Handle(Interface_InterfaceModel)& theModel) const = 0;
+
+ //! Gives the way to Write a File from a Model.
+ //! <ctx> 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
+ Standard_EXPORT virtual Standard_Boolean WriteFile (const Standard_CString theFileName, const Handle(Interface_InterfaceModel)& theModel, Interface_CheckIterator& theChecks) const = 0;
//! Creates a new empty Model ready to receive data of the Norm
//! Used to write data from Imagine to an interface file
//! Returns the Actor for Write attached to the pair (norm,appli)
//! Read from field. Can be redefined
- Standard_EXPORT virtual Handle(Transfer_ActorOfFinderProcess) ActorWrite() const;
-
- //! Sets mininum and maximum values for modetrans (write)
- //! Erases formerly recorded bounds and values
- //! Actually only for shape
- //! Then, for each value a little help can be attached
- Standard_EXPORT void SetModeWrite (const Standard_Integer modemin, const Standard_Integer modemax, const Standard_Boolean shape = Standard_True);
-
- //! Attaches a short line of help to a value of modetrans (write)
- Standard_EXPORT void SetModeWriteHelp (const Standard_Integer modetrans, const Standard_CString help, const Standard_Boolean shape = Standard_True);
-
- //! Returns recorded min and max values for modetrans (write)
- //! Actually only for shapes
- //! Returns True if bounds are set, False else (then, free value)
- Standard_EXPORT Standard_Boolean ModeWriteBounds (Standard_Integer& modemin, Standard_Integer& modemax, const Standard_Boolean shape = Standard_True) const;
-
- //! Tells if a value of <modetrans> is a good value(within bounds)
- //! Actually only for shapes
- Standard_EXPORT Standard_Boolean IsModeWrite (const Standard_Integer modetrans, const Standard_Boolean shape = Standard_True) const;
-
- //! Returns the help line recorded for a value of modetrans
- //! empty if help not defined or not within bounds or if values are free
- Standard_EXPORT Standard_CString ModeWriteHelp (const Standard_Integer modetrans, const Standard_Boolean shape = Standard_True) const;
-
- //! Takes one Shape and transfers it to an
- //! InterfaceModel (already created, e.g. by NewModel)
- //! Default uses ActorWrite; can be redefined as necessary
- //! Returned value is a status, as follows :
- //! Done OK , Void : No Result , Fail : Fail (e.g. exception)
- //! Error : bad conditions , bad model or null model
- Standard_EXPORT virtual IFSelect_ReturnStatus TransferWriteShape (const TopoDS_Shape& shape, const Handle(Transfer_FinderProcess)& FP, const Handle(Interface_InterfaceModel)& model, const Standard_Integer modetrans = 0) const;
-
- //! Records a Session Item, to be added for customisation of the Work Session.
- //! It must have a specific name.
- //! <setapplied> is used if <item> is a GeneralModifier, to decide
- //! If set to true, <item> will be applied to the hook list "send".
- //! Else, it is not applied to any hook list.
- //! Remark : this method is to be called at Create time,
- //! the recorded items will be used by Customise
- //! Warning : if <name> conflicts, the last recorded item is kept
- Standard_EXPORT void AddSessionItem (const Handle(Standard_Transient)& theItem, const Standard_CString theName, const Standard_Boolean toApply = Standard_False);
-
- //! Returns an item given its name to record in a Session
- //! If <name> is unknown, returns a Null Handle
- Standard_EXPORT Handle(Standard_Transient) SessionItem (const Standard_CString theName) const;
+ //const Handle(Transfer_ActorOfFinderProcess) & ActorWrite() const { return myAdaptorWrite; }
+ Standard_EXPORT virtual Handle(Transfer_ActorOfFinderProcess) NewActorWrite() const = 0;
//! Customises a WorkSession, by adding to it the recorded items (by AddSessionItem)
Standard_EXPORT virtual void Customise (Handle(XSControl_WorkSession)& WS);
- const Handle(Dico_DictionaryOfTransient) & AdaptorSession() const { return myAdaptorSession; }
+ //! Gives the way of dumping an entity under a form comprehensive
+ //! for each norm. <model> helps to identify, number ... entities.
+ //! <level> 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 <max>
+ //! default value will be <def>
+ 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 <level>, or an empty string
+ Standard_EXPORT Standard_CString DumpHelp (const Standard_Integer level) const;
DEFINE_STANDARD_RTTIEXT(XSControl_Controller,MMgt_TShared)
protected:
- //! Initializing with names
- //! <theLongName> is for the complete, official, long name
- //! <theShortName> is for the short name used for resources
- Standard_EXPORT XSControl_Controller(const Standard_CString theLongName, const Standard_CString theShortName);
-
- //! Records <me> in a general dictionary under a name
- //! Error if <name> already used for another one
- Standard_EXPORT void Record (const Standard_CString name) const;
+ //! Initializing with a name
+ Standard_EXPORT XSControl_Controller(const Standard_CString theName);
//! Records the name of a Static to be traced for a given use
Standard_EXPORT void TraceStatic (const Standard_CString theName, const Standard_Integer theUse);
- TCollection_AsciiString myShortName;
- TCollection_AsciiString myLongName;
- Handle(IFSelect_WorkLibrary) myAdaptorLibrary;
Handle(Interface_Protocol) myAdaptorProtocol;
Handle(Transfer_ActorOfTransientProcess) myAdaptorRead;
- Handle(Transfer_ActorOfFinderProcess) myAdaptorWrite;
- Handle(Dico_DictionaryOfTransient) myAdaptorSession;
private:
- TColStd_SequenceOfTransient myAdaptorApplied;
+ TCollection_AsciiString myName;
NCollection_Vector<Handle(Standard_Transient)> myParams;
NCollection_Vector<Standard_Integer> myParamUses;
- Handle(Interface_HArray1OfHAsciiString) myModeWriteShapeN;
+ Standard_Integer thelevdef;
+ Handle(Interface_HArray1OfHAsciiString) thelevhlp;
};
#endif // _XSControl_Controller_HeaderFile
#include <Interface_Static.hxx>
#include <Message_ProgressSentry.hxx>
#include <ShapeExtend_Explorer.hxx>
-#include <Standard_Transient.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Shape.hxx>
#include <Transfer_Binder.hxx>
#include <Transfer_TransientProcess.hxx>
#include <XSControl_Controller.hxx>
#include <XSControl_Reader.hxx>
-#include <XSControl_TransferReader.hxx>
#include <XSControl_WorkSession.hxx>
//=======================================================================
//=======================================================================
XSControl_Reader::XSControl_Reader ()
+: therootsta(Standard_False)
{
SetWS (new XSControl_WorkSession);
}
//purpose :
//=======================================================================
-Standard_Boolean XSControl_Reader::SetNorm (const Standard_CString norm)
+Standard_Boolean XSControl_Reader::SetNorm (const Standard_CString norm)
{
- if (thesession.IsNull()) SetWS (new XSControl_WorkSession);
- Standard_Boolean stat = thesession->SelectNorm (norm);
+ if (thesession.IsNull()) SetWS(new XSControl_WorkSession);
+ Standard_Boolean stat = thesession->SelectNorm(norm);
if (stat) {
thesession->InitTransferReader(0);
thesession->InitTransferReader(4);
//purpose :
//=======================================================================
-void XSControl_Reader::SetWS(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch)
+void XSControl_Reader::SetWS(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean WithNewModel)
{
therootsta = Standard_False;
theroots.Clear();
// Il doit y avoir un Controller ... Sinon onverra plus tard (apres SetNorm)
if (thesession->NormAdaptor().IsNull()) return;
Handle(Interface_InterfaceModel) model = thesession->Model ();
- if (scratch || model.IsNull()) model = thesession->NewModel ();
+ if (WithNewModel || model.IsNull()) model = thesession->NewModel ();
thesession->InitTransferReader(0);
thesession->InitTransferReader(4);
}
//purpose :
//=======================================================================
-IFSelect_ReturnStatus XSControl_Reader::ReadFile (const Standard_CString filename)
+Interface_ReturnStatus XSControl_Reader::ReadFile (const Standard_CString filename)
{
- IFSelect_ReturnStatus stat = thesession->ReadFile(filename);
+ Interface_ReturnStatus stat = thesession->ReadFile(filename);
thesession->InitTransferReader(4);
return stat;
}
}
-//=======================================================================
-//function : GiveList
-//purpose :
-//=======================================================================
-
-Handle(TColStd_HSequenceOfTransient) XSControl_Reader::GiveList
- (const Standard_CString first, const Standard_CString second)
-{
- if (first && first[0] != '\0') {
- return thesession->GiveList (first,second);
- }
-
- Handle(TColStd_HSequenceOfTransient) list = new TColStd_HSequenceOfTransient();
- Standard_Integer i,nbr = NbRootsForTransfer();
- for (i = 1; i <= nbr; i ++) list->Append (RootForTransfer(i));
- return list;
-}
-
-
-//=======================================================================
-//function : GiveList
-//purpose :
-//=======================================================================
-
-Handle(TColStd_HSequenceOfTransient) XSControl_Reader::GiveList
- (const Standard_CString first, const Handle(Standard_Transient)& list)
-{
- return thesession->GiveListFromList (first,list);
-}
-
-
//=======================================================================
//function : NbRootsForTransfer
//purpose :
//=======================================================================
-Standard_Integer XSControl_Reader::NbRootsForTransfer ()
+Standard_Integer XSControl_Reader::NbRootsForTransfer ()
{
- if (therootsta) return theroots.Length();
- therootsta = Standard_True;
- Interface_ShareFlags sf (thesession->Graph());
- Standard_Integer i, nbr = sf.NbRoots();
- for (i = 1; i <= nbr; i ++) {
- // on filtre les racines qu on sait transferer
- Handle(Standard_Transient) start = sf.Root(i);
- if (thesession->TransferReader()->Recognize(start)) theroots.Append(start);
+ if (!therootsta) {
+ therootsta = Standard_True;
+ Interface_ShareFlags sf (thesession->Graph());
+ Standard_Integer i, nbr = sf.NbRoots();
+ for (i = 1; i <= nbr; i ++) {
+ // on filtre les racines qu on sait transferer
+ Handle(Standard_Transient) start = sf.Root(i);
+ if (thesession->ReaderProcess()->GetActor()->Recognize(start)) theroots.Append(start);
+ }
}
return theroots.Length();
}
//purpose :
//=======================================================================
-Handle(Standard_Transient) XSControl_Reader::RootForTransfer
- (const Standard_Integer num)
+Handle(Standard_Transient) XSControl_Reader::RootForTransfer (const Standard_Integer num)
{
Handle(Standard_Transient) voidroot;
Standard_Integer nbr = NbRootsForTransfer();
//purpose :
//=======================================================================
-Standard_Boolean XSControl_Reader::TransferOneRoot(const Standard_Integer num)
+Standard_Boolean XSControl_Reader::TransferOneRoot(const Standard_Integer num)
{
return TransferEntity (RootForTransfer (num));
}
-//=======================================================================
-//function : TransferOne
-//purpose :
-//=======================================================================
-
-Standard_Boolean XSControl_Reader::TransferOne(const Standard_Integer num)
-{
- return TransferEntity (thesession->StartingEntity (num));
-}
-
-
//=======================================================================
//function : TransferEntity
//purpose :
//=======================================================================
-Standard_Boolean XSControl_Reader::TransferEntity (const Handle(Standard_Transient)& start)
+Standard_Boolean XSControl_Reader::TransferEntity (const Handle(Standard_Transient)& start)
{
if (start.IsNull()) return Standard_False;
- const Handle(XSControl_TransferReader) &TR = thesession->TransferReader();
- TR->BeginTransfer();
- if (TR->TransferOne (start) == 0) return Standard_False;
- TopoDS_Shape sh = TR->ShapeResult(start);
- //ShapeExtend_Explorer STU;
- //SMH May 00: allow empty shapes (STEP CAX-IF, external references)
- //if (STU.ShapeType(sh,Standard_True) == TopAbs_SHAPE) return Standard_False; // nulle-vide
+ const Handle(Transfer_TransientProcess) &TP = thesession->ReaderProcess();
+ TP->BeginTransfer();
+ if (TP->TransferOne (start) == 0) return Standard_False;
+ TopoDS_Shape sh = TP->ShapeResult(start);
theshapes.Append(sh);
return Standard_True;
}
//purpose :
//=======================================================================
-Standard_Integer XSControl_Reader::TransferList (const Handle(TColStd_HSequenceOfTransient)& list)
+Standard_Integer XSControl_Reader::TransferList (const Handle(TColStd_HSequenceOfTransient)& list)
{
if (list.IsNull()) return 0;
Standard_Integer nbt = 0;
Standard_Integer i, nb = list->Length();
- const Handle(XSControl_TransferReader) &TR = thesession->TransferReader();
- TR->BeginTransfer();
+ const Handle(Transfer_TransientProcess) &TP = thesession->ReaderProcess();
+ TP->BeginTransfer();
ClearShapes();
ShapeExtend_Explorer STU;
for (i = 1; i <= nb; i ++) {
Handle(Standard_Transient) start = list->Value(i);
- if (TR->TransferOne (start) == 0) continue;
- TopoDS_Shape sh = TR->ShapeResult(start);
+ if (TP->TransferOne (start) == 0) continue;
+ TopoDS_Shape sh = TP->ShapeResult(start);
if (STU.ShapeType(sh,Standard_True) == TopAbs_SHAPE) continue; // nulle-vide
theshapes.Append(sh);
nbt ++;
//purpose :
//=======================================================================
-Standard_Integer XSControl_Reader::TransferRoots ()
+Standard_Integer XSControl_Reader::TransferRoots ()
{
NbRootsForTransfer();
Standard_Integer nbt = 0;
Standard_Integer i, nb = theroots.Length();
- const Handle(XSControl_TransferReader) &TR = thesession->TransferReader();
+ const Handle(Transfer_TransientProcess) &TP = thesession->ReaderProcess();
- TR->BeginTransfer();
+ TP->BeginTransfer();
ClearShapes();
ShapeExtend_Explorer STU;
- const Handle(Transfer_TransientProcess) &proc = thesession->TransferReader()->TransientProcess();
- Message_ProgressSentry PS ( proc->GetProgress(), "Root", 0, nb, 1 );
+ Message_ProgressSentry PS ( TP->GetProgress(), "Root", 0, nb, 1 );
for (i = 1; i <= nb && PS.More(); i ++,PS.Next()) {
Handle(Standard_Transient) start = theroots.Value(i);
- if (TR->TransferOne (start) == 0) continue;
- TopoDS_Shape sh = TR->ShapeResult(start);
+ if (TP->TransferOne (start) == 0) continue;
+ TopoDS_Shape sh = TP->ShapeResult(start);
if (STU.ShapeType(sh,Standard_True) == TopAbs_SHAPE) continue; // nulle-vide
theshapes.Append(sh);
nbt ++;
return nbt;
}
-
//=======================================================================
//function : OneShape
//purpose :
//=======================================================================
-TopoDS_Shape XSControl_Reader::OneShape () const
+TopoDS_Shape XSControl_Reader::OneShape () const
{
TopoDS_Shape sh;
Standard_Integer i,nb = theshapes.Length();
#include <TColStd_SequenceOfTransient.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <TopTools_SequenceOfShape.hxx>
-#include <IFSelect_ReturnStatus.hxx>
+#include <Interface_ReturnStatus.hxx>
class XSControl_WorkSession;
class Interface_InterfaceModel;
//! initialize the transfer norm first, as shown in the example below.
//! Example:
//! Control_Reader reader;
-//! IFSelect_ReturnStatus status = reader.ReadFile (filename.);
+//! Interface_ReturnStatus status = reader.ReadFile (filename.);
//! When using IGESControl_Reader or STEPControl_Reader - as the
//! above example shows - the reader initializes the norm directly.
//! Note that loading the file only stores the data. It does
Standard_EXPORT virtual ~XSControl_Reader() {}
- //! Sets a specific norm to <me>
+ //! Sets a specific norm to <this>
//! Returns True if done, False if <norm> is not available
Standard_EXPORT Standard_Boolean SetNorm (const Standard_CString norm);
- //! Sets a specific session to <me>
- Standard_EXPORT void SetWS (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
+ //! Sets a specific session to <this>
+ Standard_EXPORT void SetWS (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean WithNewModel = Standard_True);
- //! Returns the session used in <me>
+ //! Returns the session used in <this>
const Handle(XSControl_WorkSession) & WS() const { return thesession; }
//! Loads a file and returns the read status
//! Zero for a Model which compies with the Controller
- Standard_EXPORT IFSelect_ReturnStatus ReadFile (const Standard_CString filename);
+ Standard_EXPORT Interface_ReturnStatus ReadFile (const Standard_CString filename);
//! Returns the model. It can then be consulted (header, product)
Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
- //! Returns a list of entities from the IGES or STEP file
- //! according to the following rules:
- //! - if first and second are empty strings, the whole file is selected.
- //! - if first is an entity number or label, the entity referred to is selected.
- //! - if first is a list of entity numbers/labels separated by commas, the entities referred to are selected,
- //! - if first is the name of a selection in the worksession and second is not defined,
- //! the list contains the standard output for that selection.
- //! - if first is the name of a selection and second is defined, the criterion defined
- //! by second is applied to the result of the first selection.
- //! A selection is an operator which computes a list of entities from a list given in
- //! input according to its type. If no list is specified, the selection computes its
- //! list of entities from the whole model.
- //! A selection can be:
- //! - A predefined selection (xst-transferrable-mode)
- //! - A filter based on a signature
- //! A Signature is an operator which returns a string from an entity according to its type. For example:
- //! - "xst-type" (CDL)
- //! - "iges-level"
- //! - "step-type".
- //! For example, if you wanted to select only the advanced_faces in a STEP file you
- //! would use the following code:
- //! Example
- //! Reader.GiveList("xst-transferrable-roots","step-type(ADVANCED_FACE)");
- //! Warning
- //! If the value given to second is incorrect, it will simply be ignored.
- Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GiveList (const Standard_CString first = "", const Standard_CString second = "");
-
- //! Computes a List of entities from the model as follows
- //! <first> beeing a Selection, <ent> beeing an entity or a list
- //! of entities (as a HSequenceOfTransient) :
- //! the standard result of this selection applied to this list
- //! if <first> is erroneous, a null handle is returned
- Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GiveList (const Standard_CString first, const Handle(Standard_Transient)& ent);
-
//! Determines the list of root entities which are candidate for
//! a transfer to a Shape, and returns the number
//! of entities in the list
//! false is returned if no shape is produced.
Standard_EXPORT Standard_Boolean TransferOneRoot (const Standard_Integer num = 1);
- //! Translates an IGES or STEP
- //! entity identified by the rank num in the model.
- //! false is returned if no shape is produced.
- Standard_EXPORT Standard_Boolean TransferOne (const Standard_Integer num);
-
//! Translates an IGES or STEP
//! entity in the model. true is returned if a shape is
//! produced; otherwise, false is returned.
protected:
- //! Returns a sequence of produced shapes
- //szv:TopTools_SequenceOfShape& Shapes() { return theshapes; }
- TopTools_SequenceOfShape theshapes;
-
+ Handle(XSControl_WorkSession) thesession;
Standard_Boolean therootsta;
+ TopTools_SequenceOfShape theshapes;
TColStd_SequenceOfTransient theroots;
-
- private:
-
- Handle(XSControl_WorkSession) thesession;
};
#endif // _XSControl_Reader_HeaderFile
+++ /dev/null
-// 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 <Interface_InterfaceModel.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <Transfer_ActorOfTransientProcess.hxx>
-#include <XSControl_SelectForTransfer.hxx>
-#include <XSControl_TransferReader.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(XSControl_SelectForTransfer,IFSelect_SelectExtract)
-
-XSControl_SelectForTransfer::XSControl_SelectForTransfer () { }
-
- XSControl_SelectForTransfer::XSControl_SelectForTransfer
- (const Handle(XSControl_TransferReader)& TR)
- { theTR = TR; }
-
-
- void XSControl_SelectForTransfer::SetReader
- (const Handle(XSControl_TransferReader)& TR)
- { theTR = TR; }
-
- void XSControl_SelectForTransfer::SetActor
- (const Handle(Transfer_ActorOfTransientProcess)& act)
- { theAC = act; }
-
- Handle(Transfer_ActorOfTransientProcess) XSControl_SelectForTransfer::Actor () const
- { return theAC; }
-
- Handle(XSControl_TransferReader) XSControl_SelectForTransfer::Reader () const
- { return theTR; }
-
- Standard_Boolean XSControl_SelectForTransfer::Sort
- (const Standard_Integer /*rank*/, const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& /*model*/) const
-{
- Handle(Transfer_ActorOfTransientProcess) act = theAC;
- if (act.IsNull() && !theTR.IsNull()) act = theTR->Actor();
- if (!act.IsNull()) return act->Recognize(ent);//,theTR->TransientProcess());//act->Recognize(ent);
- return Standard_False;
-}
-
-
- TCollection_AsciiString XSControl_SelectForTransfer::ExtractLabel () const
-{
- if (!theTR.IsNull()) return TCollection_AsciiString
- ("Recognized for Transfer (current actor)");
- return TCollection_AsciiString("Recognized for Transfer");
-}
+++ /dev/null
-// Created on: 1996-03-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 _XSControl_SelectForTransfer_HeaderFile
-#define _XSControl_SelectForTransfer_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectExtract.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-class XSControl_TransferReader;
-class Transfer_ActorOfTransientProcess;
-class Standard_Transient;
-class Interface_InterfaceModel;
-class TCollection_AsciiString;
-
-
-class XSControl_SelectForTransfer;
-DEFINE_STANDARD_HANDLE(XSControl_SelectForTransfer, IFSelect_SelectExtract)
-
-//! This selection selects the entities which are recognised for
-//! transfer by an Actor for Read : current one or another one.
-//!
-//! An Actor is an operator which runs transfers from interface
-//! entities to objects for Imagine. It has a method to recognize
-//! the entities it can process (by default, it recognises all,
-//! this method can be redefined).
-//!
-//! A TransferReader brings an Actor, according to the currently
-//! selected norm and transfer conditions.
-//!
-//! This selection considers, either the current Actor (brought by
-//! the TransferReader, updated as required), or a precise one.
-class XSControl_SelectForTransfer : public IFSelect_SelectExtract
-{
-
-public:
-
-
- //! Creates a SelectForTransfer, non initialised
- //! it sorts nothing, unless an Actor has been defined
- Standard_EXPORT XSControl_SelectForTransfer();
-
- //! Creates a SelectForTransfer, which will work with the
- //! currently defined Actor brought by the TransferReader
- Standard_EXPORT XSControl_SelectForTransfer(const Handle(XSControl_TransferReader)& TR);
-
- //! Sets a TransferReader to sort entities : it brings the Actor,
- //! which may change, while the TransferReader does not
- Standard_EXPORT void SetReader (const Handle(XSControl_TransferReader)& TR);
-
- //! Sets a precise actor to sort entities
- //! This definition oversedes the creation with a TransferReader
- Standard_EXPORT void SetActor (const Handle(Transfer_ActorOfTransientProcess)& act);
-
- //! Returns the Actor used as precised one.
- //! Returns a Null Handle for a creation from a TransferReader
- //! without any further setting
- Standard_EXPORT Handle(Transfer_ActorOfTransientProcess) Actor() const;
-
- //! Returns the Reader (if created with a Reader)
- //! Returns a Null Handle if not created with a Reader
- Standard_EXPORT Handle(XSControl_TransferReader) Reader() const;
-
- //! Returns True for an Entity which is recognized by the Actor,
- //! either the precised one, or the one defined by TransferReader
- Standard_EXPORT Standard_Boolean Sort (const Standard_Integer rank, const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
-
- //! Returns a text defining the criterium : "Recognized for Transfer [(current actor)]"
- Standard_EXPORT TCollection_AsciiString ExtractLabel() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(XSControl_SelectForTransfer,IFSelect_SelectExtract)
-
-protected:
-
-
-
-
-private:
-
-
- Handle(XSControl_TransferReader) theTR;
- Handle(Transfer_ActorOfTransientProcess) theAC;
-
-
-};
-
-
-
-
-
-
-
-#endif // _XSControl_SelectForTransfer_HeaderFile
+++ /dev/null
-// 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 <Interface_Check.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <Transfer_Binder.hxx>
-#include <Transfer_TransientProcess.hxx>
-#include <XSControl_SignTransferStatus.hxx>
-#include <XSControl_TransferReader.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(XSControl_SignTransferStatus,IFSelect_Signature)
-
-//#include <stdio.h>
-static TCollection_AsciiString& themes()
-{
- static TCollection_AsciiString tm;
- return tm;
-}
-// si resultat avec type: a exploiter tout de suite !
-
-XSControl_SignTransferStatus::XSControl_SignTransferStatus ()
-: IFSelect_Signature("Transfer Status") { }
-
-XSControl_SignTransferStatus::XSControl_SignTransferStatus
- (const Handle(XSControl_TransferReader)& TR)
-: IFSelect_Signature("Transfer Status") ,
- theTR (TR) { }
-
-void XSControl_SignTransferStatus::SetReader
- (const Handle(XSControl_TransferReader)& TR)
- { theTR = TR; }
-
-void XSControl_SignTransferStatus::SetMap
- (const Handle(Transfer_TransientProcess)& TP)
- { theTP = TP; }
-
-Handle(Transfer_TransientProcess) XSControl_SignTransferStatus::Map () const
- { return theTP; }
-
-Handle(XSControl_TransferReader) XSControl_SignTransferStatus::Reader () const
- { return theTR; }
-
-
-
-// BinderStatus retourne une valeur :
-// 0 Binder Null. 1 void 2 Warning seul 3 Fail seul
-// 11 Resultat OK. 12 Resultat+Warning. 13 Resultat+Fail
-// 20 Abnormal (Interrupted)
-
-static Standard_Integer BinderStatus (const Handle(Transfer_Binder)& binder)
-{
- Standard_Integer stat = 0;
- if (binder.IsNull()) return 0;
- Interface_CheckStatus cst = binder->Check()->Status();
- Transfer_StatusExec est = binder->StatusExec ();
- Standard_Boolean res = binder->HasResult();
- if (est == Transfer_StatusRun || est == Transfer_StatusLoop) return 20;
- if (cst == Interface_CheckOK) stat = (res ? 11 : 1);
- else if (cst == Interface_CheckWarning) stat = (res ? 12 : 2);
- else if (cst == Interface_CheckFail) stat = (res ? 13 : 3);
-
- return stat;
-}
-
-
-Standard_CString XSControl_SignTransferStatus::Value
- (const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& /*model*/) const
-{
- if (ent.IsNull()) return "";
- Handle(Transfer_TransientProcess) TP = theTP;
- if (TP.IsNull() && !theTR.IsNull()) TP = theTR->TransientProcess();
- if (TP.IsNull()) return "";
-
- Handle(Transfer_Binder) binder = TP->Find(ent);
-
- Standard_Integer stat = BinderStatus (binder);
-
- if (stat <= 1) return "";
- if (stat == 2) return "Warning";
- if (stat == 3) return "Fail";
- if (stat == 20) return "Fail on run";
-
- themes().Clear();
- if (stat > 10) {
-// Y a un resultat : donner son type
- Handle(Transfer_Binder) bnd = binder;
- Standard_Integer hasres = Standard_False;
- while (!bnd.IsNull()) {
- if (bnd->Status() != Transfer_StatusVoid) {
- if (!hasres) themes().AssignCat("Result:");
- else themes().AssignCat(",");
- themes().AssignCat(bnd->ResultTypeName());
- hasres = Standard_True;
- }
- bnd = bnd->NextResult();
- }
-// if (stat == 11) sprintf(themes,"Result:%s",binder->ResultTypeName());
- if (stat == 12) themes().AssignCat("/Warning");
- if (stat == 13) themes().AssignCat("/Fail");
- }
- return themes().ToCString();
-}
+++ /dev/null
-// Created on: 1998-07-31
-// 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 _XSControl_SignTransferStatus_HeaderFile
-#define _XSControl_SignTransferStatus_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Signature.hxx>
-#include <Standard_CString.hxx>
-class XSControl_TransferReader;
-class Transfer_TransientProcess;
-class Standard_Transient;
-class Interface_InterfaceModel;
-
-
-class XSControl_SignTransferStatus;
-DEFINE_STANDARD_HANDLE(XSControl_SignTransferStatus, IFSelect_Signature)
-
-//! This Signatures gives the Transfer Status of an entity, as
-//! recorded in a TransferProcess. It can be :
-//! - Void : not recorded, or recorded as void with no message
-//! (attributes are not taken into account)
-//! - Warning : no result, warning message(s), no fail
-//! - Fail : no result, fail messages (with or without warning)
-//! - Result.. : result, no message (neither warning nor fail)
-//! Result.. i.e. Result:TypeName of the result
-//! - Result../Warning : result, with warning but no fail
-//! - Result../Fail : result, with fail (.e. bad result)
-//! - Fail on run : no result yet recorded, no message, but
-//! an exception occurred while recording the result
-//! (this should not appear and indicates a programming error)
-class XSControl_SignTransferStatus : public IFSelect_Signature
-{
-
-public:
-
-
- //! Creates a SignTransferStatus, not initialised
- //! it gives nothing (empty string)
- Standard_EXPORT XSControl_SignTransferStatus();
-
- //! Creates a SignTransferStatus, which will work on the current
- //! TransientProcess brought by the TransferReader (its MapReader)
- Standard_EXPORT XSControl_SignTransferStatus(const Handle(XSControl_TransferReader)& TR);
-
- //! Sets a TransferReader to work
- Standard_EXPORT void SetReader (const Handle(XSControl_TransferReader)& TR);
-
- //! Sets a precise map to sign entities
- //! This definition oversedes the creation with a TransferReader
- Standard_EXPORT void SetMap (const Handle(Transfer_TransientProcess)& TP);
-
- //! Returns the TransientProcess used as precised one
- //! Returns a Null Handle for a creation from a TransferReader
- //! without any further setting
- Standard_EXPORT Handle(Transfer_TransientProcess) Map() const;
-
- //! Returns the Reader (if created with a Reader)
- //! Returns a Null Handle if not created with a Reader
- Standard_EXPORT Handle(XSControl_TransferReader) Reader() const;
-
- //! Returns the Signature for a Transient object, as its transfer
- //! status
- Standard_EXPORT Standard_CString Value (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(XSControl_SignTransferStatus,IFSelect_Signature)
-
-protected:
-
-
-
-
-private:
-
-
- Handle(XSControl_TransferReader) theTR;
- Handle(Transfer_TransientProcess) theTP;
-
-
-};
-
-
-
-
-
-
-
-#endif // _XSControl_SignTransferStatus_HeaderFile
+++ /dev/null
-// 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.
-
-//: abv 09.04.99: S4136: remove parameter lastpreci
-
-#include <BRepLib.hxx>
-#include <Dico_DictionaryOfTransient.hxx>
-#include <IFSelect_CheckCounter.hxx>
-#include <IFSelect_SignatureList.hxx>
-#include <Interface_Check.hxx>
-#include <Interface_CheckIterator.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_HGraph.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Interface_MSG.hxx>
-#include <Interface_SignLabel.hxx>
-#include <Interface_Static.hxx>
-#include <Interface_ShareFlags.hxx>
-#include <Message_Messenger.hxx>
-#include <ShapeFix.hxx>
-#include <Standard_ErrorHandler.hxx>
-#include <Standard_Failure.hxx>
-#include <TCollection_HAsciiString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <TopoDS_HShape.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopTools_MapOfShape.hxx>
-#include <Transfer_ActorOfTransientProcess.hxx>
-#include <Transfer_ResultFromModel.hxx>
-#include <Transfer_ResultFromTransient.hxx>
-#include <Transfer_SimpleBinderOfTransient.hxx>
-#include <Transfer_TransientProcess.hxx>
-#include <TransferBRep.hxx>
-#include <TransferBRep_ShapeBinder.hxx>
-#include <TransferBRep_ShapeMapper.hxx>
-#include <XSControl_Controller.hxx>
-#include <XSControl_TransferReader.hxx>
-
-#include <stdio.h>
-
-IMPLEMENT_STANDARD_RTTIEXT(XSControl_TransferReader,MMgt_TShared)
-
-//=======================================================================
-//function : BinderShape
-//purpose :
-//=======================================================================
-
-static TopoDS_Shape BinderShape (const Handle(Standard_Transient)& tr)
-{
- TopoDS_Shape sh;
- DeclareAndCast(Transfer_Binder,sb,tr);
- if (!sb.IsNull()) return TransferBRep::ShapeResult(sb);
- DeclareAndCast(TransferBRep_ShapeMapper,sm,tr);
- if (!sm.IsNull()) return sm->Shape();
- DeclareAndCast(TopoDS_HShape,hs,tr);
- if (!hs.IsNull()) return hs->Shape();
- return sh;
-}
-
-//=======================================================================
-//function : SetController
-//purpose :
-//=======================================================================
-
-void XSControl_TransferReader::SetController(const Handle(XSControl_Controller)& control)
-{
- myController = control;
- myActor.Nullify();
- Clear(-1);
-}
-
-
-//=======================================================================
-//function : Actor
-//purpose :
-//=======================================================================
-
-Handle(Transfer_ActorOfTransientProcess) XSControl_TransferReader::Actor ()
-{
- if ( myActor.IsNull() && !myController.IsNull() && !myModel.IsNull())
- myActor = myController->ActorRead(myModel);
- return myActor;
-}
-
-
-//=======================================================================
-//function : SetModel
-//purpose :
-//=======================================================================
-
-void XSControl_TransferReader::SetModel(const Handle(Interface_InterfaceModel)& model)
-{
- myModel = model;
- if (!myTP.IsNull()) myTP->SetModel(model);
-}
-
-
-//=======================================================================
-//function : SetGraph
-//purpose :
-//=======================================================================
-
-void XSControl_TransferReader::SetGraph(const Handle(Interface_HGraph)& graph)
-{
- if (graph.IsNull())
- {
- myModel.Nullify();
- }
- else
- myModel = graph->Graph().Model();
-
- myGraph = graph;
-
- if (!myTP.IsNull()) myTP->SetGraph(graph);
-}
-
-
-//=======================================================================
-//function : SetContext
-//purpose :
-//=======================================================================
-
-void XSControl_TransferReader::SetContext(const Standard_CString name,
- const Handle(Standard_Transient)& ctx)
-{
- if (myContext.IsNull()) myContext = new Dico_DictionaryOfTransient;
- myContext->SetItem (name,ctx);
-}
-
-
-//=======================================================================
-//function : GetContext
-//purpose :
-//=======================================================================
-
-Standard_Boolean XSControl_TransferReader::GetContext
- (const Standard_CString name, const Handle(Standard_Type)& type,
- Handle(Standard_Transient)& ctx) const
-{
- if (myContext.IsNull()) return Standard_False;
- if (!myContext->GetItem (name,ctx)) ctx.Nullify();
- if (ctx.IsNull()) return Standard_False;
- if (type.IsNull()) return Standard_True;
- if (!ctx->IsKind(type)) ctx.Nullify();
- return !ctx.IsNull();
-}
-
-
-//=======================================================================
-//function : Clear
-//purpose :
-//=======================================================================
-
-void XSControl_TransferReader::Clear (const Standard_Integer mode)
-{
- if (mode & 1) {
- myResults.Clear();
- myShapeResult.Nullify();
- }
- if (mode & 2) {
- myModel.Nullify();
- myGraph.Nullify();
- myTP.Nullify();
- myActor.Nullify();
- myFileName.Clear();
- }
-}
-
-
-// ########################################################
-// ########### RESULTATS ############
-
-
-//=======================================================================
-//function : RecordResult
-//purpose :
-//=======================================================================
-
-Standard_Boolean XSControl_TransferReader::RecordResult
- (const Handle(Standard_Transient)& ent)
-{
- if (myModel.IsNull() || myTP.IsNull()) return Standard_False;
- Standard_Integer num = myModel->Number(ent);
- if (num == 0) return Standard_False;
- Handle(TCollection_HAsciiString) lab = myModel->StringLabel(ent);
-
- Handle(Transfer_ResultFromModel) res = new Transfer_ResultFromModel;
- res->Fill (myTP,ent);
-
- // Cas du resultat Shape : pour resultat principal, faire HShape ...
- Handle(Transfer_Binder) binder = res->MainResult()->Binder();
- DeclareAndCast(TransferBRep_ShapeBinder,shb,binder);
- if (!shb.IsNull()) {
- Handle(Transfer_SimpleBinderOfTransient) trb = new Transfer_SimpleBinderOfTransient;
- trb->SetResult ( new TopoDS_HShape(shb->Result()) );
- trb->Merge(binder);
- res->MainResult()->SetBinder (trb);
- }
-
- res->SetFileName(myFileName.ToCString());
- myResults.Bind(num,res);
- return Standard_True;
-}
-
-
-//=======================================================================
-//function : IsRecorded
-//purpose :
-//=======================================================================
-
-Standard_Boolean XSControl_TransferReader::IsRecorded
- (const Handle(Standard_Transient)& ent) const
-{
- if (myModel.IsNull()) return Standard_False;
- Standard_Integer num = myModel->Number(ent);
- if (num == 0) return Standard_False;
- if(!myResults.IsBound(num)) return Standard_False;
- return (myResults.Find(num)->DynamicType() == STANDARD_TYPE(Transfer_ResultFromModel) );
-}
-
-
-//=======================================================================
-//function : HasResult
-//purpose :
-//=======================================================================
-
-Standard_Boolean XSControl_TransferReader::HasResult
- (const Handle(Standard_Transient)& ent) const
-{
- if (myModel.IsNull()) return Standard_False;
- Standard_Integer num = myModel->Number(ent);
- if (num == 0) return Standard_False;
- if(!myResults.IsBound(num)) return Standard_False;
- DeclareAndCast(Transfer_ResultFromModel,fr,myResults.Find(num));
- if (fr.IsNull()) return Standard_False;
- return fr->HasResult();
-}
-
-
-//=======================================================================
-//function : RecordedList
-//purpose :
-//=======================================================================
-
-Handle(TColStd_HSequenceOfTransient) XSControl_TransferReader::RecordedList () const
-{
- Handle(TColStd_HSequenceOfTransient) li = new TColStd_HSequenceOfTransient();
- if (myModel.IsNull()) return li;
- Standard_Integer i, nb = myModel->NbEntities();
- for (i = 1; i <= nb; i ++) {
- if(myResults.IsBound(i))
- if(!myResults.Find(i).IsNull()) li->Append (myModel->Value(i));
- }
- return li;
-}
-
-
-//=======================================================================
-//function : Skip
-//purpose :
-//=======================================================================
-
-Standard_Boolean XSControl_TransferReader::Skip(const Handle(Standard_Transient)& ent)
-{
- if (myModel.IsNull() || myTP.IsNull()) return Standard_False;
- Standard_Integer num = myModel->Number(ent);
- if (num == 0) return Standard_False;
- myResults.Bind(num,ent);
- return Standard_True;
-}
-
-
-//=======================================================================
-//function : IsSkipped
-//purpose :
-//=======================================================================
-
-Standard_Boolean XSControl_TransferReader::IsSkipped
- (const Handle(Standard_Transient)& ent) const
-{
- if (myModel.IsNull()) return Standard_False;
- Standard_Integer num = myModel->Number(ent);
- if (num == 0) return Standard_False;
- if(!myResults.IsBound(num)) return Standard_False;
- return (myResults.Find(num)->DynamicType() != STANDARD_TYPE(Transfer_ResultFromModel) );
-}
-
-
-//=======================================================================
-//function : IsMarked
-//purpose :
-//=======================================================================
-
-Standard_Boolean XSControl_TransferReader::IsMarked
- (const Handle(Standard_Transient)& ent) const
-{
- if (myModel.IsNull()) return Standard_False;
- Standard_Integer num = myModel->Number(ent);
- if (num == 0) return Standard_False;
- if(!myResults.IsBound(num)) return Standard_False;
- if (myResults.Find(num).IsNull()) return Standard_False;
- return Standard_True;
-}
-
-
-// ######### ACCES UN PEU PLUS FIN #########
-
-
-//=======================================================================
-//function : FinalResult
-//purpose :
-//=======================================================================
-
-Handle(Transfer_ResultFromModel) XSControl_TransferReader::FinalResult
- (const Handle(Standard_Transient)& ent) const
-{
- Handle(Transfer_ResultFromModel) res;
- if (myModel.IsNull()) return res;
- Standard_Integer num = myModel->Number(ent);
- if (num == 0) return res;
- if(!myResults.IsBound(num)) return res;
- res = GetCasted(Transfer_ResultFromModel,myResults.Find(num));
- return res;
-}
-
-
-//=======================================================================
-//function : FinalEntityLabel
-//purpose :
-//=======================================================================
-
-Standard_CString XSControl_TransferReader::FinalEntityLabel
- (const Handle(Standard_Transient)& ent) const
-{
- Handle(Transfer_ResultFromModel) resu = FinalResult (ent);
- if (resu.IsNull()) return "";
- return resu->MainLabel();
-}
-
-
-//=======================================================================
-//function : FinalEntityNumber
-//purpose :
-//=======================================================================
-
-Standard_Integer XSControl_TransferReader::FinalEntityNumber
- (const Handle(Standard_Transient)& ent) const
-{
- Handle(Transfer_ResultFromModel) resu = FinalResult (ent);
- if (resu.IsNull()) return 0;
- return resu->MainNumber();
-}
-
-
-//=======================================================================
-//function : ResultFromNumber
-//purpose :
-//=======================================================================
-
-Handle(Transfer_ResultFromModel) XSControl_TransferReader::ResultFromNumber
- (const Standard_Integer num) const
-{
- Handle(Transfer_ResultFromModel) res;
- if ( num<1 || num>myModel->NbEntities() ) return res;
- if(!myResults.IsBound(num)) return res;
- res = GetCasted(Transfer_ResultFromModel,myResults.Find(num));
- return res;
-}
-
-
-//=======================================================================
-//function : TransientResult
-//purpose :
-//=======================================================================
-
-Handle(Standard_Transient) XSControl_TransferReader::TransientResult
- (const Handle(Standard_Transient)& ent) const
-{
- Handle(Standard_Transient) tres;
- Handle(Transfer_ResultFromModel) res = FinalResult(ent);
- if (res.IsNull()) return tres;
- Handle(Transfer_ResultFromTransient) mres = res->MainResult();
- if (mres.IsNull()) return tres;
- DeclareAndCast(Transfer_SimpleBinderOfTransient,bnd,mres->Binder());
- if (bnd.IsNull()) return tres;
- if (!bnd->HasResult()) return tres;
- return bnd->Result();
-}
-
-
-//=======================================================================
-//function : ShapeResult
-//purpose :
-//=======================================================================
-
-TopoDS_Shape XSControl_TransferReader::ShapeResult
- (const Handle(Standard_Transient)& ent) const
-{
- TopoDS_Shape tres; // DOIT RESTER NULL
- Handle(Transfer_ResultFromModel) res = FinalResult(ent);
- if (res.IsNull()) return tres;
- Handle(Transfer_ResultFromTransient) mres = res->MainResult();
- if (mres.IsNull()) return tres;
- TopoDS_Shape sh = BinderShape (mres->Binder());
-
-// Ouh la vilaine verrue
- Standard_Real tolang = Interface_Static::RVal("read.encoderegularity.angle");
- if (tolang <= 0 || sh.IsNull()) return sh;
- ShapeFix::EncodeRegularity (sh,tolang);
- return sh;
-}
-
-
-//=======================================================================
-//function : ClearResult
-//purpose :
-//=======================================================================
-
-Standard_Boolean XSControl_TransferReader::ClearResult
- (const Handle(Standard_Transient)& ent, const Standard_Integer mode)
-{
- if (myModel.IsNull()) return Standard_False;
- Standard_Integer num = myModel->Number(ent);
- if (num == 0) return Standard_False;
- if(!myResults.IsBound(num)) return Standard_False;
- if (mode < 0)
- myResults.ChangeFind(num).Nullify();
- else {
- DeclareAndCast(Transfer_ResultFromModel,resu,myResults.Find(num));
- if (resu.IsNull()) return Standard_False;
- resu->Strip (mode);
- }
- return Standard_True;
-}
-
-
-// <<<< >>>> ATTENTION, pas terrible : mieux vaudrait
-// faire une map inverse et la consulter
-// ou muscler ResultFromModel ...
-
-
-//=======================================================================
-//function : EntityFromResult
-//purpose :
-//=======================================================================
-
-Handle(Standard_Transient) XSControl_TransferReader::EntityFromResult
- (const Handle(Standard_Transient)& res, const Standard_Integer mode) const
-{
- Handle(Standard_Transient) nulh;
- // cas de la shape
- TopoDS_Shape sh = BinderShape (res);
- if (!sh.IsNull()) return EntityFromShapeResult (sh,mode);
-
- Handle(Transfer_Binder) abinder;
- DeclareAndCast(Transfer_Binder,binder,res);
- Standard_Integer i,j,nb;
-
- if (mode == 0 || mode == 1) {
- // on regarde dans le TransientProcess (Roots ou tous Mappeds)
- if (!myTP.IsNull()) {
- nb = (mode == 0 ? myTP->NbRoots() : myTP->NbMapped());
- for (j = 1; j <= nb; j ++) {
- i = (mode == 0 ? myModel->Number (myTP->Root(j)) : j);
- if (i == 0) continue;
- abinder = myTP->MapItem(i);
- if (abinder.IsNull()) continue;
- if (!binder.IsNull()) {
- if (binder == abinder) return myTP->Mapped(i);
- continue;
- }
- DeclareAndCast(Transfer_SimpleBinderOfTransient,trb,abinder);
- if (trb.IsNull()) continue;
- if (trb->Result() == res) return myTP->Mapped(i);
- }
- }
- return nulh; // Null
- }
-
- // Recherche dans myResults (racines)
- // 2 : Main only 3 : Main + one sub; 4 : all
- if (mode >= 2) {
- nb = myModel->NbEntities();
- for (i = 1; i <= nb; i ++) {
- Handle(Transfer_ResultFromModel) rec = ResultFromNumber (i);
- if (rec.IsNull()) return nulh;
- Handle(TColStd_HSequenceOfTransient) list = rec->Results (mode-2);
- Standard_Integer ir,nr = list->Length();
- for (ir = 1; ir <= nr; ir ++) {
- DeclareAndCast(Transfer_ResultFromTransient,rft,list->Value(ir));
- if (rft.IsNull()) continue;
- if (rft->Binder() == binder) return rft->Start();
- }
-
- }
- }
-
- // autres cas non encore implementes
- return nulh;
-}
-
-
-// <<<< >>>> ATTENTION, encore moins bien que le precedent
-
-
-//=======================================================================
-//function : EntityFromShapeResult
-//purpose :
-//=======================================================================
-
-Handle(Standard_Transient) XSControl_TransferReader::EntityFromShapeResult
- (const TopoDS_Shape& res, const Standard_Integer mode) const
-{
- Handle(Standard_Transient) nulh, samesh, partner;
- if (res.IsNull()) return nulh;
- Standard_Integer i,j,nb;
-
- if (mode == 0 || mode == 1 || mode == -1) {
- // on regarde dans le TransientProcess
- if (!myTP.IsNull()) {
- nb = (mode == 0 ? myTP->NbRoots() : myTP->NbMapped());
- for (j = 1; j <= nb; j ++) {
- i = (mode == 0 ? myModel->Number (myTP->Root(j)) : j);
- if (i == 0) continue;
- Handle(Standard_Transient) ent = myTP->Mapped(i);
- TopoDS_Shape sh = TransferBRep::ShapeResult (myTP,ent);
- if (!sh.IsNull()) {
- if (sh == res) return ent;
- // priorites moindre : Same (tjrs) ou Partner (mode < 0)
- if (sh.IsSame(res)) samesh = ent;
- if (mode == -1 && sh.IsPartner(res)) partner= ent;
- }
- }
- }
- // Ici, pas trouve de vraie egalite. Priorites moindres : Same puis Partner
- if (!samesh.IsNull()) return samesh;
- if (!partner.IsNull()) return partner; // calcule si mode = -1
- return nulh;
- }
-
- // Recherche dans myResults (racines)
- // 2 : Main only 3 : Main + one sub; 4 : all
- if (mode >= 2) {
- nb = myModel->NbEntities();
- for (i = 1; i <= nb; i ++) {
- Handle(Transfer_ResultFromModel) rec = ResultFromNumber (i);
- if (rec.IsNull()) continue;
-
- Handle(TColStd_HSequenceOfTransient) list = rec->Results (mode-2);
- Standard_Integer ir,nr = list->Length();
- for (ir = 1; ir <= nr; ir ++) {
- DeclareAndCast(Transfer_ResultFromTransient,rft,list->Value(ir));
- if (rft.IsNull()) continue;
- TopoDS_Shape sh = BinderShape (rft->Binder());
- if (!sh.IsNull() && sh == res) return rft->Start();
- }
-
- }
- }
-
- return nulh;
-}
-
-
-//=======================================================================
-//function : EntitiesFromShapeList
-//purpose :
-//=======================================================================
-
-Handle(TColStd_HSequenceOfTransient) XSControl_TransferReader::EntitiesFromShapeList
- (const Handle(TopTools_HSequenceOfShape)& res,
- const Standard_Integer mode) const
-{
- Handle(TColStd_HSequenceOfTransient) lt = new TColStd_HSequenceOfTransient();
- if (res.IsNull()) return lt;
- TopTools_MapOfShape shapes;
-
- // On convertit res en une map, pour test de presence rapide
- Standard_Integer i, j, nb = res->Length();
- if (nb == 0) return lt;
- for (i = 1; i <= nb; i ++) shapes.Add (res->Value(i));
-
- // A present, recherche et enregistrement
-
- if (mode == 0 || mode == 1) {
- // on regarde dans le TransientProcess
- if (!myTP.IsNull()) {
- nb = (mode == 0 ? myTP->NbRoots() : myTP->NbMapped());
- for (j = 1; j <= nb; j ++) {
- i = (mode == 0 ? myModel->Number (myTP->Root(j)) : j);
- if (i == 0) continue;
- TopoDS_Shape sh = BinderShape (myTP->MapItem(i));
- if (!sh.IsNull() && shapes.Contains(sh)) {
- lt->Append (myTP->Mapped(i));
- j=nb; //skl (for looking for entities in checkbrep)
- }
- }
- }
- }
-
- // Recherche dans myResults (racines)
- // 2 : Main only 3 : Main + one sub; 4 : all
- if (mode >= 2) {
- nb = myModel->NbEntities();
- for (i = 1; i <= nb; i ++) {
- Handle(Transfer_ResultFromModel) rec = ResultFromNumber (i);
- if (rec.IsNull()) continue;
-
- Handle(TColStd_HSequenceOfTransient) list = rec->Results (mode-2);
- Standard_Integer ir,nr = list->Length();
- for (ir = 1; ir <= nr; ir ++) {
- DeclareAndCast(Transfer_ResultFromTransient,rft,list->Value(i));
- if (rft.IsNull()) continue;
- TopoDS_Shape sh = BinderShape (rft->Binder());
- if (!sh.IsNull() && shapes.Contains(sh)) lt->Append (rft->Start());
- }
-
- }
- }
-
- return lt;
-}
-
-
-// <<<< >>>> ATTENTION, level pas traite (utile ?) -> ResultFromModel
-
-
-//=======================================================================
-//function : CheckList
-//purpose :
-//=======================================================================
-
-Interface_CheckIterator XSControl_TransferReader::CheckList
- (const Handle(Standard_Transient)& ent, const Standard_Integer level) const
-{
- Interface_CheckIterator chl;
- if (myModel.IsNull() || ent.IsNull()) return chl;
- // Check-List COMPLETE ... tout le Modele
- if (ent == myModel) {
- Standard_Integer i,nb = myModel->NbEntities();
- for (i = 1; i <= nb; i ++) {
- Handle(Transfer_ResultFromModel) rec = ResultFromNumber (i);
- if (!rec.IsNull()) {
- Interface_CheckIterator chiter = rec->CheckList (Standard_False,2);
- chl.Merge (chiter);
- }
- }
- }
- // Check-List sur une LISTE ...
- else if (ent->IsKind(STANDARD_TYPE(TColStd_HSequenceOfTransient))) {
- DeclareAndCast(TColStd_HSequenceOfTransient,list,ent);
- Standard_Integer i,nb = list->Length();
- for (i = 1; i <= nb; i ++) {
- Handle(Transfer_ResultFromModel) rec = FinalResult (list->Value(i));
- if (!rec.IsNull()) {
- Interface_CheckIterator chiter = rec->CheckList (Standard_False,level);
- chl.Merge (chiter);
- }
- }
- }
-
- // sinon, Check-List sur une entite : Last ou FinalResult
- else if (level < 0) {
- if (myTP.IsNull()) return chl;
- chl.Add (myTP->Check(ent),myModel->Number(ent));
- } else {
- Handle(Transfer_ResultFromModel) rec = FinalResult (ent);
- if (rec.IsNull()) return chl;
- chl = rec->CheckList(Standard_False,level); // manque level ...
- }
- if (ent == myModel) chl.SetName ("XSControl : CheckList complete Model");
- else if (level < 0) chl.SetName ("XSControl : CheckList Last");
- else if (level == 0) chl.SetName ("XSControl : CheckList Final Main");
- else if (level == 1) chl.SetName ("XSControl : CheckList Final Main+Subs");
- else if (level >= 2) chl.SetName ("XSControl : CheckList Final Complete");
- return chl;
-}
-
-
-//=======================================================================
-//function : HasChecks
-//purpose :
-//=======================================================================
-
-Standard_Boolean XSControl_TransferReader::HasChecks
- (const Handle(Standard_Transient)& ent, const Standard_Boolean failsonly) const
-{
- Handle(Transfer_ResultFromModel) resu = FinalResult (ent);
- if (resu.IsNull()) return Standard_False;
- Standard_Integer stat = resu->ComputeCheckStatus (Standard_False);
- if (stat == 0) return Standard_False;
- if (stat > 1) return Standard_True;
- return (!failsonly);
-}
-
-
-//=======================================================================
-//function : CheckedList
-//purpose :
-//=======================================================================
-
-Handle(TColStd_HSequenceOfTransient) XSControl_TransferReader::CheckedList
- (const Handle(Standard_Transient)& ent,
- const Interface_CheckStatus withcheck, const Standard_Boolean level) const
-{
- Handle(TColStd_HSequenceOfTransient) res = new TColStd_HSequenceOfTransient();
- if (ent.IsNull()) return res;
-
- if (ent == myModel) {
- Standard_Integer i,nb = myModel->NbEntities();
- for (i = 1; i <= nb; i ++) {
- Handle(Transfer_ResultFromModel) rec = ResultFromNumber (i);
- if (!rec.IsNull()) res->Append (rec->CheckedList(withcheck,level));
- }
- } else if (ent->IsKind(STANDARD_TYPE(TColStd_HSequenceOfTransient))) {
- DeclareAndCast(TColStd_HSequenceOfTransient,list,ent);
- Standard_Integer i,nb = list->Length();
- for (i = 1; i <= nb; i ++) {
- Handle(Transfer_ResultFromModel) rec = FinalResult (list->Value(i));
- if (!rec.IsNull()) res->Append (rec->CheckedList(withcheck,level));
- }
- } else {
- Handle(Transfer_ResultFromModel) rec = FinalResult (ent);
- if (!rec.IsNull()) res = rec->CheckedList(withcheck,level);
- }
- return res;
-}
-
-
-// ########################################################
-// ########### TRANSFERT ############
-// ########################################################
-
-
-//=======================================================================
-//function : BeginTransfer
-//purpose :
-//=======================================================================
-
-Standard_Boolean XSControl_TransferReader::BeginTransfer ()
-{
- if (myModel.IsNull()) return Standard_False;
- if (Actor().IsNull()) return Standard_False;
- myShapeResult.Nullify();
-
- if (myTP.IsNull()) myTP = new Transfer_TransientProcess
- (myModel->NbEntities());
-
- Handle(Transfer_ActorOfTransientProcess) actor;
- myTP->SetActor (actor); // -> RAZ
- actor = Actor();
- myTP->SetActor (actor); // Set proprement dit
- myTP->Context() = myContext;
- return Standard_True;
-}
-
-
-//=======================================================================
-//function : Recognize
-//purpose :
-//=======================================================================
-
-Standard_Boolean XSControl_TransferReader::Recognize
- (const Handle(Standard_Transient)& ent)
-{
- if (myActor.IsNull()) return Standard_False;
- return myActor->Recognize (ent);
-}
-
-
-//=======================================================================
-//function : TransferOne
-//purpose :
-//=======================================================================
-
-Standard_Integer XSControl_TransferReader::TransferOne
- (const Handle(Standard_Transient)& ent, const Standard_Boolean rec)
-{
- if (myActor.IsNull() || myModel.IsNull()) return 0;
-
- if (myTP.IsNull()) { if (!BeginTransfer()) return 0; }
-
- const Handle(Message_Messenger) &sout = myTP->Messenger();
- Standard_Integer level = myTP->TraceLevel();
-
- if (myGraph.IsNull()) myTP->SetModel(myModel);
- else myTP->SetGraph(myGraph);
-
- // pour le log-file
- if (level > 1) {
- Standard_Integer num = myModel->Number(ent);
- Handle(TCollection_HAsciiString) lab = myModel->StringLabel(ent);
- sout<<"\n*******************************************************************\n";
- sout << "****** Transferring one Entity ******"<<endl;
- if (!lab.IsNull())
- sout<<"****** N0 in file : "<<Interface_MSG::Blanks(num,5)<<num
- <<" Ident : "<<lab->ToCString()
- << Interface_MSG::Blanks(14 - lab->Length())<<"******\n";
- sout << "****** Type : "<<myModel->TypeName(ent,Standard_False)
- << Interface_MSG::Blanks((Standard_Integer) (44 - strlen(myModel->TypeName(ent,Standard_False))))
- << "******";
- sout<<"\n*******************************************************************\n";
- }
-
- // seule difference entre TransferRoots et TransferOne
- Standard_Integer res = 0;
- // Check if the entity belongs to the model
- if (myModel->Number(ent) == 0)
- return 0;
- myTP->Transfer (ent);
- myTP->SetRoot (ent);
-
- // Resultat ...
- Handle(Transfer_Binder) binder = myTP->Find (ent);
- if (binder.IsNull()) return res;
- if (rec) RecordResult (ent);
-
- if (!binder->HasResult()) return res;
- res ++;
-
- return res;
-}
-
-
-//=======================================================================
-//function : TransferList
-//purpose :
-//=======================================================================
-
-Standard_Integer XSControl_TransferReader::TransferList
- (const Handle(TColStd_HSequenceOfTransient)& list, const Standard_Boolean rec)
-{
- if (myActor.IsNull() || myModel.IsNull()) return 0;
-
- if (myTP.IsNull()) { if (!BeginTransfer()) return 0; }
-
- Handle(Message_Messenger) sout = myTP->Messenger();
- Standard_Integer level = myTP->TraceLevel();
-
- if (myGraph.IsNull()) myTP->SetModel(myModel);
- 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 "<<Interface_MSG::Blanks(nb,5)<<" Entities ******"<<endl;
- sout<<"\n*******************************************************************\n";
-
- Handle(IFSelect_SignatureList) sl = new IFSelect_SignatureList;
- for (i = 1; i <= nb; i ++)
- sl->Add (list->Value(i), myModel->TypeName(list->Value(i),Standard_False));
- sl->SetName ("Entities to Transfer");
- sl->PrintCount (sout);
- sout<<"\n*******************************************************************\n";
- }
-
- // seule difference entre TransferRoots et TransferOne
- Standard_Integer res = 0;
- nb = list->Length();
-
- for (i = 1; i <= nb; i ++)
- {
- const Handle(Standard_Transient) &ent = list->Value(i);
- // Check if the entity belongs to the model
- if (myModel->Number(ent) == 0)
- continue;
- myTP->Transfer (ent);
- myTP->SetRoot (ent);
-
- // Resultat ...
- Handle(Transfer_Binder) binder = myTP->Find (ent);
- if (binder.IsNull()) continue;
- if (rec) RecordResult (ent);
-
- if (!binder->HasResult()) continue;
- res ++;
- }
- return res;
-}
-
-
-// <<<< >>>> passage Graph : judicieux ?
-
-
-//=======================================================================
-//function : TransferRoots
-//purpose :
-//=======================================================================
-
-Standard_Integer XSControl_TransferReader::TransferRoots(const Interface_Graph& G)
-{
- if (myModel != G.Model()) return -1;
- if (!BeginTransfer()) return -1;
- Handle(Message_Messenger) sout = myTP->Messenger();
- Standard_Integer level = myTP->TraceLevel();
-
- if (myGraph.IsNull()) myTP->SetModel(myModel);
- else myTP->SetGraph(myGraph);
-
- // Pour le log-file
- if (level > 0) {
- Interface_EntityIterator roots = G.RootEntities();
- Standard_Integer nb = roots.NbEntities();
- sout<<"\n*******************************************************************\n";
- sout << "****** Transferring the "<<Interface_MSG::Blanks(nb,5)<<" Root Entities ******"<<endl;
- sout<<"\n*******************************************************************\n";
- Handle(IFSelect_SignatureList) sl = new IFSelect_SignatureList;
- for (roots.Start(); roots.More(); roots.Next())
- sl->Add (roots.Value(),myModel->TypeName(roots.Value(),Standard_False));
- sl->SetName ("Entities to Transfer");
- sl->PrintCount (sout);
- sout<<"\n*******************************************************************\n";
- }
-
- myTP->SetRootManagement (Standard_False);
- Interface_ShareFlags tool(G);
- myTP->SetModel (G.Model());
- Interface_EntityIterator list = tool.RootEntities();
- for (list.Start(); list.More(); list.Next()) {
- const Handle(Standard_Transient) &ent = list.Value();
- if (myTP->Transfer(ent)) myTP->SetRoot(ent);
- }
-
- // Les entites transferees sont notees "asmain"
- Standard_Integer i,n = myTP->NbMapped();
- for (i = 1; i <= n; i ++) {
- Handle(Standard_Transient) ent = myTP->Mapped(i);
- Handle(Transfer_Binder) bnd = myTP->MapItem(i);
- if (bnd.IsNull()) continue;
- if (!bnd->HasResult()) continue;
- RecordResult (ent);
- }
-
- // Resultat ... on note soigneuseument les Shapes
- myShapeResult = TransferBRep::Shapes (myTP,Standard_True);
- // ???? Et ici, il faut alimenter Imagine ...
- return myShapeResult->Length();
-}
-
-
-//=======================================================================
-//function : PrintStats
-//purpose :
-//=======================================================================
-
-void XSControl_TransferReader::PrintStats
- (const Standard_Integer what, const Standard_Integer mode) const
-{
- Handle(Message_Messenger) sout = myTP->Messenger();
- // A ameliorer ... !
- sout<<"\n*******************************************************************\n";
- sout << "****** Statistics on Transfer (Read) ******"<<endl;
- sout<<"\n*******************************************************************\n";
- if (what > 10) { sout<<" *** Not yet implemented"<<endl; return; }
- if (what < 10) {
- sout << "****** Data recorded on Last Transfer ******"<<endl;
- PrintStatsProcess (myTP,what,mode);
- }
- // reste what = 10 : on liste les racines des final results
- sout << "****** Final Results ******"<<endl;
- if (myModel.IsNull()) { sout<<"**** Model unknown"<<endl; return; }
- Handle(TColStd_HSequenceOfTransient) list = RecordedList();
- Standard_Integer i, nb = list->Length();
- Handle(IFSelect_SignatureList) counter;
- if (mode > 2) counter = new IFSelect_SignatureList (mode == 6);
- IFSelect_PrintCount pcm = IFSelect_CountByItem;
- if (mode == 6) pcm = IFSelect_ListByItem;
-
- sout<<"**** Nb Recorded : "<<nb<<" : entities n0s : ";
- for (i = 1; i <= nb; i ++) {
- Handle(Standard_Transient) ent = list->Value(i);
- if (mode == 0) { sout<<" "<<myModel->Number(ent); continue; }
- if (mode == 1 || mode == 2) {
- sout<<"[ "<<Interface_MSG::Blanks (i,6)<<" ]:";
- myModel->Print (ent,sout);
- sout<<" Type:"<<myModel->TypeName(ent,Standard_False);
- }
- if (mode >= 3 && mode <= 6) {
- counter->Add (ent,myModel->TypeName(ent,Standard_False));
- }
- }
- if (!counter.IsNull()) counter->PrintList(sout,myModel,pcm);
-
- sout<<endl;
-}
-
-
-// ########################################################
-// ########### TRANSFERT ############
-
-
-//=======================================================================
-//function : LastCheckList
-//purpose :
-//=======================================================================
-
-Interface_CheckIterator XSControl_TransferReader::LastCheckList () const
-{
- Interface_CheckIterator chl;
- if (!myTP.IsNull()) chl = myTP->CheckList (Standard_False);
- return chl;
-}
-
-
-//=======================================================================
-//function : LastTransferList
-//purpose :
-//=======================================================================
-
-Handle(TColStd_HSequenceOfTransient) XSControl_TransferReader::LastTransferList
- (const Standard_Boolean roots) const
-{
- Handle(TColStd_HSequenceOfTransient) li = new TColStd_HSequenceOfTransient();
- if (myTP.IsNull()) return li;
- Standard_Integer i,j,nb =
- (roots ? myTP->NbRoots() : myTP->NbMapped());
- for (j = 1; j <= nb; j ++) {
- i = (roots ? myModel->Number (myTP->Root(j)) : j);
- Handle(Transfer_Binder) bnd = myTP->MapItem(i);
- if (bnd.IsNull()) continue;
- if (!bnd->HasResult()) continue;
- li->Append (myTP->Mapped(i));
- }
- return li;
-}
-
-
-//=======================================================================
-//function : ShapeResultList
-//purpose :
-//=======================================================================
-
-const Handle(TopTools_HSequenceOfShape) & XSControl_TransferReader::ShapeResultList
- (const Standard_Boolean rec)
-{
- if (!rec) {
- if (myShapeResult.IsNull()) myShapeResult = TransferBRep::Shapes (myTP,Standard_True);
- if (myShapeResult.IsNull()) myShapeResult = new TopTools_HSequenceOfShape();
- } else {
- if (myShapeResult.IsNull()) myShapeResult = new TopTools_HSequenceOfShape();
- if (myModel.IsNull()) return myShapeResult;
- Handle(TColStd_HSequenceOfTransient) li = RecordedList();
- myShapeResult = new TopTools_HSequenceOfShape();
- Standard_Integer i, nb = myModel->NbEntities();
- TopoDS_Shape sh;
- for (i = 1; i <= nb; i ++) {
- sh = ShapeResult (myModel->Value(i));
- if (!sh.IsNull()) myShapeResult->Append(sh);
- }
- }
- return myShapeResult;
-}
-
-
-// **** UTILITAIRE DE STATISTIQUES GENERALES
-
-// BinderStatus retourne une valeur :
-// 0 Binder Null. 1 void 2 Warning seul 3 Fail seul
-// 11 Resultat OK. 12 Resultat+Warning. 13 Resultat+Fail
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-static Standard_Integer BinderStatus (const Handle(Transfer_Binder)& binder, char* mess)
-{
- Standard_Integer stat = 0;
- mess[0] = '\0';
- if (binder.IsNull()) { sprintf (mess,"(no data recorded)"); return 0; }
- Interface_CheckStatus cst = binder->Check()->Status();
- if (cst == Interface_CheckOK) {
- stat = 11;
- if (binder->HasResult()) sprintf(mess,"%s",binder->ResultTypeName());
- else { sprintf(mess,"(no result)"); stat = 1; }
- } else if (cst == Interface_CheckWarning) {
- stat = 12;
- if (binder->HasResult()) sprintf(mess,"%s (+ warning)",binder->ResultTypeName());
- else { sprintf(mess,"(warning)"); stat = 2; }
- } else if (cst == Interface_CheckFail) {
- stat = 13;
- if (binder->HasResult()) sprintf(mess,"%s (+ FAIL)",binder->ResultTypeName());
- else { sprintf(mess,"(FAIL)"); stat = 3; }
- }
- return stat;
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-static void PrintPercent(const Handle(Message_Messenger)& sout, const Standard_CString mess,
- const Standard_Integer nb, const Standard_Integer nl)
-{
- if (nb <= 0 || nl == 0) return;
- sout<<"****** "<<mess<<": ";
- if (nb == nl) sout<<"100 %"<<endl;
- else if (nb*100/nl == 0) sout<<"< 1 %"<<endl;
- else sout<<(nb*100/nl < 10 ? " " : " ")<<nb*100/nl<<" %"<<endl;
-}
-
-
-//=======================================================================
-//function : PrintStatsProcess
-//purpose :
-//=======================================================================
-
-void XSControl_TransferReader::PrintStatsProcess(const Handle(Transfer_TransientProcess)& TP,
- const Standard_Integer what,
- const Standard_Integer mode)
-{
- Handle(TColStd_HSequenceOfTransient) list; // null
- XSControl_TransferReader::PrintStatsOnList (TP,list,what,mode);
-}
-
-
-//=======================================================================
-//function : PrintStatsOnList
-//purpose :
-//=======================================================================
-
-void XSControl_TransferReader::PrintStatsOnList(const Handle(Transfer_TransientProcess)& TP,
- const Handle(TColStd_HSequenceOfTransient)& list,
- const Standard_Integer what,
- const Standard_Integer mode)
-{
- Handle(Message_Messenger) sout = TP->Messenger();
- char mess[250];
- if (TP.IsNull()) return;
- if (what == 0) { TP->PrintStats(sout); return; }
-
- sout<<"\n*******************************************************************\n";
- sout << "****** Statistics on Transfer Process (Read) ******"<<endl;
- if (what == 1) sout << "****** Individual Transfers (Roots) ******\n";
- if (what == 2) sout << "****** All recorded data about Transfer ******\n";
- if (what == 3) sout << "****** Abnormal records ******\n";
- if (what == 1 || what == 2 || what == 3) {
- if (mode == 0) sout<<"****** (n0s of recorded entities) ******\n";
- if (mode == 1) sout<<"****** (per entity : type + result) ******\n";
- if (mode == 2) sout<<"****** (per entity : type + result/status) ******\n";
- if (mode == 3) sout<<"****** (count per type of entity) ******\n";
- if (mode == 4) sout<<"****** (count per type of result) ******\n";
- if (mode == 5) sout<<"****** (count per couple entity-type / result-type/status) ******\n";
- if (mode == 6) sout<<"****** (list per couple entity-type / result-type/status) ******\n";
- }
- if (what == 4) sout << "****** Check messages ******\n";
- if (what == 5) sout << "****** Fail messages ******\n";
- sout<<"*******************************************************************\n";
-
- // Cas what = 1,2,3 : contenu du TP (binders)
-
- const Standard_Boolean nolist = list.IsNull();
- Handle(Interface_InterfaceModel) model = TP->Model();
- if (what >= 1 && what <= 3) {
-
- Standard_Integer stat;
- Standard_Integer nbv = 0, nbw = 0, nbf = 0, nbr = 0, nbrw = 0, nbrf = 0, nbnr = 0, nbi = 0;
- Transfer_TransientProcess::Iterator itrp(Standard_True);
- if (what == 1) itrp = TP->RootResult(Standard_True);
- if (what == 2) itrp = TP->CompleteResult(Standard_True);
- if (what == 3) itrp = TP->AbnormalResult();
- Standard_Integer i = 0, nb = itrp.Number();
- if (!nolist) itrp.Filter (list);
- Standard_Integer nl = itrp.Number(); // apres filtrage
- Handle(IFSelect_SignatureList) counter;
- if (mode > 2) counter = new IFSelect_SignatureList (mode == 6);
- Standard_Boolean notrec = (!nolist && mode > 2); // noter les "no record"
- IFSelect_PrintCount pcm = IFSelect_CountByItem;
- if (mode == 6) pcm = IFSelect_ListByItem;
-
- sout <<"**** Entities in Model : "<<model->NbEntities()<<endl;
- sout <<"**** Nb Items (Transfer) : "<<nb<<endl;
- if (!nolist)
- sout<<"**** Nb Items (Listed) : "<<nl<<endl;
-
- for (itrp.Start(); itrp.More(); itrp.Next()) {
- nbi ++;
- Handle(Transfer_Binder) binder = itrp.Value();
- const Handle(Standard_Transient) &ent = itrp.SourceObject();
- if (binder.IsNull()) {
- nbnr ++;
- if (notrec) counter->Add(ent,"(not recorded)");
- else if (mode == 1 || mode == 2) {
- sout<<"["<<Interface_MSG::Blanks (nbi,4)<<nbi<<" ]:";
- model->Print (ent,sout);
- sout<<" "<<model->TypeName(ent,Standard_False)<<" (not recorded)"<<endl;
- continue;
- }
- }
- if (mode == 0) { sout<<" "<<model->Number(ent); continue; }
- if (mode != 3) {
- stat = BinderStatus(binder,mess);
- // 0 Binder Null. 1 void 2 Warning seul 3 Fail seul
- // 11 Resultat OK. 12 Resultat+Warning. 13 Resultat+Fail
- if (stat == 0 || stat == 1) nbv ++;
- if (stat == 2) nbw ++;
- if (stat == 3) nbf ++;
- if (stat == 11) nbr ++;
- if (stat == 12) nbrw ++;
- if (stat == 13) nbrf ++;
- }
-
- // mode : 0 list num; 1 : num+label + type + result (abrege); 2 : complet
- if (mode == 1 || mode == 2) {
- sout<<"["<<Interface_MSG::Blanks (i,4)<<i<<" ]:";
- model->Print (ent,sout);
- sout<<" "<<model->TypeName(ent,Standard_False);
- sout<<" Result:"<<mess<<endl;
- if (mode == 1) continue;
-
- const Handle(Interface_Check)& ch = binder->Check();
- Standard_Integer newi,newnbw = ch->NbWarnings(), newnbf = ch->NbFails();
-
- if (newnbw > 0) {
- sout<<" - Warnings : "<<newnbw<<":\n";
- for (newi = 1; newi <= newnbw; newi ++) sout<<ch->CWarning(newi)<<endl;
- }
- if (newnbf > 0) {
- sout<<" - Fails : "<<newnbf<<":\n";
- for (newi = 1; newi <= newnbf; newi ++) sout<<ch->CFail(newi)<<endl;
- }
- continue;
- }
-
- // mode : 3, counts per type of starting entity (class type)
- // 4 : counts per result type and/or status
- // 5 : counts per couple (starting type / result type/status)
- // 6 : idem plus gives for each item, the list of numbers of
- // entities in the starting model
- if (mode >= 3 && mode <= 6) {
- //IFSelect_PrintCount newpcm = IFSelect_CountByItem;
- //if (mode == 6) newpcm = IFSelect_ListByItem;
- if (mode == 3) counter->Add (ent,model->TypeName(ent,Standard_False));
- if (mode == 4) counter->Add (ent,mess);
- if (mode >= 5) {
- TCollection_AsciiString mest (model->TypeName(ent,Standard_False));
- mest.AssignCat(" -> ");
- mest.AssignCat(mess);
- //sprintf(mest,"%s -> %s",model->TypeName(ent,Standard_False),mess);
- counter->Add (ent,mest.ToCString());
- }
- }
-
- // Fin de l iteration
- }
- if (!counter.IsNull()) counter->PrintList(sout,model,pcm);
- else sout<<endl;
- // Pourcentages
- if (mode != 3 && nbi > 0) {
- sout << "****** Percentages according Transfer Status ******"<<endl;
- PrintPercent (sout,"Result ",nbr+nbrw,nl);
- PrintPercent (sout,"Result + FAIL ",nbrf,nl);
- PrintPercent (sout,"FAIL, no Result ",nbf,nl);
- PrintPercent (sout,"Just Warning ",nbw,nl);
- PrintPercent (sout,"Nothing Recorded",nbnr,nl);
-/* if (nbr+nbrw > 0)
- sout<<"****** Result : "<< (nbr+nbrw)*100/nl<<" %"<<endl;
- if (nbrf > 0)
- sout<<"****** Result + FAIL : "<< (nbrf)*100/nl<<" %"<<endl;
- if (nbf > 0)
- sout<<"****** FAIL, no Result : "<< (nbf)*100/nl<<" %"<<endl;
- if (nbw > 0)
- sout<<"****** Just Warning : "<< (nbw)*100/nl<<" %"<<endl;
- if (nbnr > 0)
- sout<<"****** Nothing Recorded: "<< (nbnr)*100/nl<<" %"<<endl; */
- }
- return;
- }
-
- // Cas what = 4,5 : check-list
-
- if (what == 4 || what == 5) {
-
- Interface_CheckIterator chl = TP->CheckList(Standard_False);
- chl.SetName("** TRANSFER READ CHECK **");
- if (mode == 0) chl.Print (sout,model,(what == 5));
- else {
- IFSelect_PrintCount pcm = IFSelect_CountByItem;
- if (mode == 2) pcm = IFSelect_ListByItem;
- Handle(IFSelect_CheckCounter) counter = new IFSelect_CheckCounter(Standard_True);
- counter->Analyse (chl,model,Standard_True,(what == 5));
- counter->PrintList (sout,model,pcm);
- }
- }
-
-}
+++ /dev/null
-// Created on: 1995-12-05
-// Created by: Christian CAILLET
-// Copyright (c) 1995-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 _XSControl_TransferReader_HeaderFile
-#define _XSControl_TransferReader_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_DataMapOfIntegerTransient.hxx>
-#include <TopTools_HSequenceOfShape.hxx>
-#include <MMgt_TShared.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <Interface_CheckStatus.hxx>
-class XSControl_Controller;
-class Interface_InterfaceModel;
-class Interface_HGraph;
-class Dico_DictionaryOfTransient;
-class Transfer_ActorOfTransientProcess;
-class Transfer_TransientProcess;
-class Standard_Transient;
-class Transfer_ResultFromModel;
-class TopoDS_Shape;
-class Interface_CheckIterator;
-class Interface_Graph;
-
-
-class XSControl_TransferReader;
-DEFINE_STANDARD_HANDLE(XSControl_TransferReader, MMgt_TShared)
-
-//! A TransferReader performs, manages, handles results of,
-//! transfers done when reading a file (i.e. from entities of an
-//! InterfaceModel, to objects for Imagine)
-//!
-//! Running is organised around basic tools : TransientProcess and
-//! its Actor, results are Binders and CheckIterators. It implies
-//! control by a Controller (which prepares the Actor as required)
-//!
-//! Getting results can be done directly on TransientProcess, but
-//! these are immediate "last produced" results. Each transfer of
-//! an entity gives a final result, but also possible intermediate
-//! data, and checks, which can be attached to sub-entities.
-//!
-//! Hence, final results (which intermediates and checks) are
-//! recorded as ResultFromModel and can be queried individually.
-//!
-//! Some more direct access are given for results which are
-//! Transient or Shapes
-class XSControl_TransferReader : public MMgt_TShared
-{
- public:
-
- //! Creates a TransferReader, empty
- XSControl_TransferReader()
- {}
-
- //! Sets a Controller. It is required to generate the Actor.
- //! Elsewhere, the Actor must be provided directly
- Standard_EXPORT void SetController (const Handle(XSControl_Controller)& theControl);
-
- //! Sets the Actor directly : this value will be used if the
- //! Controller is not set
- void SetActor (const Handle(Transfer_ActorOfTransientProcess)& theActor)
- { myActor = theActor; }
-
- //! Returns the Actor, determined by the Controller, or if this
- //! one is unknown, directly set.
- //! Once it has been defined, it can then be edited.
- Standard_EXPORT Handle(Transfer_ActorOfTransientProcess) Actor();
-
- //! Sets an InterfaceModel. This causes former results, computed
- //! from another one, to be lost (see also Clear)
- Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& theModel);
-
- //! Sets a Graph and its InterfaceModel (calls SetModel)
- Standard_EXPORT void SetGraph (const Handle(Interface_HGraph)& theGraph);
-
- //! Returns the currently set InterfaceModel
- const Handle(Interface_InterfaceModel) & Model() const
- { return myModel; }
-
- //! Sets a Context : according to receiving appli, to be
- //! interpreted by the Actor
- Standard_EXPORT void SetContext (const Standard_CString theName, const Handle(Standard_Transient)& theCtx);
-
- //! Returns the Context attached to a name, if set and if it is
- //! Kind of the type, else a Null Handle
- //! Returns True if OK, False if no Context
- Standard_EXPORT Standard_Boolean GetContext (const Standard_CString theName, const Handle(Standard_Type)& theType, Handle(Standard_Transient)& theCtx) const;
-
- //! Returns (modifiable) the whole definition of Context
- //! Rather for internal use (ex.: preparing and setting in once)
- Handle(Dico_DictionaryOfTransient)& Context()
- { return myContext; }
-
- //! Sets a new value for (loaded) file name
- void SetFileName (const Standard_CString theName)
- { myFileName = theName; }
-
- //! Returns actual value of file name
- Standard_CString FileName() const
- { return myFileName.ToCString(); }
-
- //! Clears data, according mode :
- //! -1 all
- //! 0 nothing done
- //! +1 final results
- //! +2 working data (model, context, transfer process)
- Standard_EXPORT void Clear (const Standard_Integer theMode);
-
- //! Returns the currently used TransientProcess
- //! It is computed from the model by TransferReadRoots, or by
- //! BeginTransferRead
- const Handle(Transfer_TransientProcess) & TransientProcess () const
- { return myTP; }
-
- //! Forces the TransientProcess
- //! Remark : it also changes the Model and the Actor, from those
- //! recorded in the new TransientProcess
- void SetTransientProcess (const Handle(Transfer_TransientProcess)& theTP)
- { myTP = theTP; }
-
- //! Records a final result of transferring an entity
- //! This result is recorded as a ResultFromModel, taken from
- //! the TransientProcess
- //! Returns True if a result is available, False else
- Standard_EXPORT Standard_Boolean RecordResult (const Handle(Standard_Transient)& theEnt);
-
- //! Returns True if a final result is recorded for an entity
- //! Remark that it can bring no effective result if transfer has
- //! completely failed (FinalResult brings only fail messages ...)
- Standard_EXPORT Standard_Boolean IsRecorded (const Handle(Standard_Transient)& theEnt) const;
-
- //! Returns True if a final result is recorded AND BRINGS AN
- //! EFFECTIVE RESULT (else, it brings only fail messages)
- Standard_EXPORT Standard_Boolean HasResult (const Handle(Standard_Transient)& theEnt) const;
-
- //! Returns the list of entities to which a final result is
- //! attached (i.e. processed by RecordResult)
- Standard_EXPORT Handle(TColStd_HSequenceOfTransient) RecordedList() const;
-
- //! Note that an entity has been required for transfer but no
- //! result at all is available (typically : case not implemented)
- //! It is not an error, but it gives a specific status : Skipped
- //! Returns True if done, False if <ent> is not in starting model
- Standard_EXPORT Standard_Boolean Skip (const Handle(Standard_Transient)& theEnt);
-
- //! Returns True if an entity is noted as skipped
- Standard_EXPORT Standard_Boolean IsSkipped (const Handle(Standard_Transient)& theEnt) const;
-
- //! Returns True if an entity has been asked for transfert, hence
- //! it is marked, as : Recorded (a computation has ran, with or
- //! without an effective result), or Skipped (case ignored)
- Standard_EXPORT Standard_Boolean IsMarked (const Handle(Standard_Transient)& theEnt) const;
-
- //! Returns the final result recorded for an entity, as such
- Standard_EXPORT Handle(Transfer_ResultFromModel) FinalResult (const Handle(Standard_Transient)& theEnt) const;
-
- //! Returns the label attached to an entity recorded for final,
- //! or an empty string if not recorded
- Standard_EXPORT Standard_CString FinalEntityLabel (const Handle(Standard_Transient)& theEnt) const;
-
- //! Returns the number attached to the entity recorded for final,
- //! or zero if not recorded (looks in the ResultFromModel)
- Standard_EXPORT Standard_Integer FinalEntityNumber (const Handle(Standard_Transient)& theEnt) const;
-
- //! Returns the final result recorded for a NUMBER of entity
- //! (internal use). Null if out of range
- Standard_EXPORT Handle(Transfer_ResultFromModel) ResultFromNumber (const Standard_Integer theNum) const;
-
- //! Returns the resulting object as a Transient
- //! Null Handle if no result or result not transient
- Standard_EXPORT Handle(Standard_Transient) TransientResult (const Handle(Standard_Transient)& theEnt) const;
-
- //! Returns the resulting object as a Shape
- //! Null Shape if no result or result not a shape
- Standard_EXPORT TopoDS_Shape ShapeResult (const Handle(Standard_Transient)& theEnt) const;
-
- //! Clears recorded result for an entity, according mode
- //! <mode> = -1 : true, complete, clearing (erasing result)
- //! <mode> >= 0 : simple "stripping", see ResultFromModel,
- //! in particular, 0 for simple internal strip,
- //! 10 for all but final result,
- //! 11 for all : just label, status and filename are kept
- //! Returns True when done, False if nothing was to clear
- Standard_EXPORT Standard_Boolean ClearResult (const Handle(Standard_Transient)& theEnt, const Standard_Integer theMode);
-
- //! Returns an entity from which a given result was produced.
- //! If <mode> = 0 (D), searches in last root transfers
- //! If <mode> = 1, searches in last (root & sub) transfers
- //! If <mode> = 2, searches in root recorded results
- //! If <mode> = 3, searches in all (root & sub) recordeds
- //! <res> can be, either a transient object (result itself) or
- //! a binder. For a binder of shape, calls EntityFromShapeResult
- //! Returns a Null Handle if <res> not recorded
- Standard_EXPORT Handle(Standard_Transient) EntityFromResult (const Handle(Standard_Transient)& theRes, const Standard_Integer theMode = 0) const;
-
- //! Returns an entity from which a given shape result was produced
- //! Returns a Null Handle if <res> not recorded or not a Shape
- Standard_EXPORT Handle(Standard_Transient) EntityFromShapeResult (const TopoDS_Shape& theRes, const Standard_Integer theMode = 0) const;
-
- //! Returns the list of entities from which some shapes were
- //! produced : it corresponds to a loop on EntityFromShapeResult,
- //! but is optimised
- Standard_EXPORT Handle(TColStd_HSequenceOfTransient) EntitiesFromShapeList (const Handle(TopTools_HSequenceOfShape)& theRes, const Standard_Integer theMode = 0) const;
-
- //! Returns the CheckList resulting from transferring <ent>, i.e.
- //! stored in its recorded form ResultFromModel
- //! (empty if transfer successful or not recorded ...)
- //!
- //! If <ent> is the Model, returns the complete cumulated
- //! check-list, <level> is ignored
- //!
- //! If <ent> is an entity of the Model, <level> applies as follows
- //! <level> : -1 for <ent> only, LAST transfer (TransientProcess)
- //! <level> : 0 for <ent> only (D)
- //! 1 for <ent> and its immediate subtransfers, if any
- //! 2 for <ent> and subtransferts at all levels
- Standard_EXPORT Interface_CheckIterator CheckList (const Handle(Standard_Transient)& theEnt, const Standard_Integer theLevel = 0) const;
-
- //! Returns True if an entity (with a final result) has checks :
- //! - failsonly = False : any kind of check message
- //! - failsonly = True : fails only
- //! Returns False if <ent> is not recorded
- Standard_EXPORT Standard_Boolean HasChecks (const Handle(Standard_Transient)& theEnt, const Standard_Boolean FailsOnly) const;
-
- //! Returns the list of starting entities to which a given check
- //! status is attached, IN FINAL RESULTS
- //! <ent> can be an entity, or the model to query all entities
- //! Below, "entities" are, either <ent> plus its sub-transferred,
- //! or all the entities of the model
- //!
- //! <check> = -2 , all entities whatever the check (see result)
- //! <check> = -1 , entities with no fail (warning allowed)
- //! <check> = 0 , entities with no check at all
- //! <check> = 1 , entities with warning but no fail
- //! <check> = 2 , entities with fail
- //! <result> : if True, only entities with an attached result
- //! Remark : result True and check=0 will give an empty list
- Standard_EXPORT Handle(TColStd_HSequenceOfTransient) CheckedList (const Handle(Standard_Transient)& theEnt, const Interface_CheckStatus WithCheck = Interface_CheckAny, const Standard_Boolean theResult = Standard_True) const;
-
- //! Defines a new TransferProcess for reading transfer
- //! Returns True if done, False if data are not properly defined
- //! (the Model, the Actor for Read)
- Standard_EXPORT Standard_Boolean BeginTransfer();
-
- //! Tells if an entity is recognized as a valid candidate for
- //! Transfer. Calls method Recognize from the Actor (if known)
- Standard_EXPORT Standard_Boolean Recognize (const Handle(Standard_Transient)& theEnt);
-
- //! Commands the transfer on reading for an entity to data for
- //! Imagine, using the selected Actor for Read
- //! Returns count of transferred entities, ok or with fails (0/1)
- //! If <rec> is True (D), the result is recorded by RecordResult
- Standard_EXPORT Standard_Integer TransferOne (const Handle(Standard_Transient)& theEnt, const Standard_Boolean theRec = Standard_True);
-
- //! Commands the transfer on reading for a list of entities to
- //! data for Imagine, using the selected Actor for Read
- //! Returns count of transferred entities, ok or with fails (0/1)
- //! If <rec> is True (D), the results are recorded by RecordResult
- Standard_EXPORT Standard_Integer TransferList (const Handle(TColStd_HSequenceOfTransient)& theList, const Standard_Boolean theRec = Standard_True);
-
- //! Transfers the content of the current Interface Model to
- //! data handled by Imagine, starting from its Roots (determined
- //! by the Graph <G>), using the selected Actor for Read
- //! Returns the count of performed root transfers (i.e. 0 if none)
- //! or -1 if no actor is defined
- Standard_EXPORT Standard_Integer TransferRoots (const Interface_Graph &theGraph);
-
- //! Prints statistics on current Trace File, according <what> and
- //! <mode>. See PrintStatsProcess for details
- Standard_EXPORT void PrintStats (const Standard_Integer theWhat, const Standard_Integer theMode = 0) const;
-
- //! Returns the CheckList resulting from last TransferRead
- //! i.e. from TransientProcess itself, recorded from last Clear
- Standard_EXPORT Interface_CheckIterator LastCheckList() const;
-
- //! Returns the list of entities recorded as lastly transferred
- //! i.e. from TransientProcess itself, recorded from last Clear
- //! If <roots> is True , considers only roots of transfer
- //! If <roots> is False, considers all entities bound with result
- Standard_EXPORT Handle(TColStd_HSequenceOfTransient) LastTransferList (const Standard_Boolean theRoots) const;
-
- //! Returns a list of result Shapes
- //! If <rec> is True , sees RecordedList
- //! If <rec> is False, sees LastTransferList (last ROOT transfers)
- //! For each one, if it is a Shape, it is cumulated to the list
- //! If no Shape is found, returns an empty Sequence
- Standard_EXPORT const Handle(TopTools_HSequenceOfShape) & ShapeResultList (const Standard_Boolean theRec);
-
- //! This routines prints statistics about a TransientProcess
- //! It can be called, by a TransferReader, or isolately
- //! Prints are done on the default trace file
- //! <what> defines what kind of statistics are to be printed :
- //! 0 : basic figures
- //! 1 : root results
- //! 2 : all recorded (roots, intermediate, checked entities)
- //! 3 : abnormal records
- //! 4 : check messages (warnings and fails)
- //! 5 : fail messages
- //!
- //! <mode> is used according <what> :
- //! <what> = 0 : <mode> is ignored
- //! <what> = 1,2,3 : <mode> as follows :
- //! 0 (D) : just lists numbers of concerned entities in the model
- //! 1 : for each entity, gives number,label, type and result
- //! type and/or status (fail/warning...)
- //! 2 : for each entity, gives maximal information (i.e. checks)
- //! 3 : counts per type of starting entity (class type)
- //! 4 : counts per result type and/or status
- //! 5 : counts per couple (starting type / result type/status)
- //! 6 : idem plus gives for each item, the list of numbers of
- //! entities in the starting model
- //!
- //! <what> = 4,5 : modes relays on an enum PrintCount :
- //! 0 (D) : ItemsByEntity (sequential list by entity)
- //! 1 : CountByItem
- //! 2 : ShortByItem (count + 5 first numbers)
- //! 3 : ListByItem (count + entity numbers)
- //! 4 : EntitiesByItem (count + entity numbers and labels)
- Standard_EXPORT static void PrintStatsProcess (const Handle(Transfer_TransientProcess)& theTP, const Standard_Integer theWhat, const Standard_Integer theMode = 0);
-
- //! Works as PrintStatsProcess, but displays data only on the
- //! entities which are in <list> (filter)
- Standard_EXPORT static void PrintStatsOnList (const Handle(Transfer_TransientProcess)& theTP, const Handle(TColStd_HSequenceOfTransient)& theList, const Standard_Integer theWhat, const Standard_Integer theMode = 0);
-
- DEFINE_STANDARD_RTTIEXT(XSControl_TransferReader,MMgt_TShared)
-
- private:
-
- Handle(XSControl_Controller) myController;
- TCollection_AsciiString myFileName;
- Handle(Interface_InterfaceModel) myModel;
- Handle(Interface_HGraph) myGraph;
- Handle(Dico_DictionaryOfTransient) myContext;
- Handle(Transfer_ActorOfTransientProcess) myActor;
- Handle(Transfer_TransientProcess) myTP;
- TColStd_DataMapOfIntegerTransient myResults;
- Handle(TopTools_HSequenceOfShape) myShapeResult;
-};
-
-#endif // _XSControl_TransferReader_HeaderFile
+++ /dev/null
-// 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 <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Message_Messenger.hxx>
-#include <Standard_ErrorHandler.hxx>
-#include <Standard_Failure.hxx>
-#include <TopoDS_Shape.hxx>
-#include <Transfer_ActorOfFinderProcess.hxx>
-#include <Transfer_FinderProcess.hxx>
-#include <Transfer_SimpleBinderOfTransient.hxx>
-#include <XSControl_Controller.hxx>
-#include <XSControl_TransferWriter.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(XSControl_TransferWriter,MMgt_TShared)
-
-
-//=======================================================================
-//function : Clear
-//purpose :
-//=======================================================================
-
-void XSControl_TransferWriter::Clear (const Standard_Integer mode)
-{
- if (mode < 0 || myProcess.IsNull())
- myProcess = new Transfer_FinderProcess;
- else myProcess->Clear();
-}
-
-// ########## LES ACTIONS ##########
-
-//=======================================================================
-//function : TransferWriteShape
-//purpose :
-//=======================================================================
-
-IFSelect_ReturnStatus XSControl_TransferWriter::TransferWriteShape
- (const Handle(Interface_InterfaceModel)& model,
- const TopoDS_Shape& shape)
-{
- if (myController.IsNull()) return IFSelect_RetError;
- if (model.IsNull()) return IFSelect_RetVoid;
-
- IFSelect_ReturnStatus status = IFSelect_RetVoid;
- if (myProcess.IsNull()) myProcess = new Transfer_FinderProcess;
-// effacer l actor : Controller s en charge
- const Handle(Transfer_ActorOfFinderProcess) nulact;
- myProcess->SetActor (nulact);
- const Handle(Message_Messenger) &sout = myProcess->Messenger();
- try {
- OCC_CATCH_SIGNALS
- // A ameliorer ... !
- sout<<"\n*******************************************************************\n";
- sout << "****** Statistics on Transfer (Write) ******"<<endl;
- sout<<"\n*******************************************************************\n";
- sout << "****** Transfer Mode = "<<myTransferMode;
- Standard_CString modehelp = myController->ModeWriteHelp (myTransferMode);
- if (modehelp && modehelp[0] != 0) sout<<" I.E. "<<modehelp;
- sout<<" ******"<<endl;
- sout << "****** Transferring Shape, ShapeType = " << shape.ShapeType();
- sout<<" ******"<<endl;
- status = myController->TransferWriteShape (shape,myProcess,model,myTransferMode);
- }
- catch(Standard_Failure) {
- sout<<"**** **** TransferWriteShape, EXCEPTION : ";
- sout<<Standard_Failure::Caught()->GetMessageString();
- sout<<endl;
- status = IFSelect_RetFail;
- }
- return status;
-}
+++ /dev/null
-// Created on: 1996-03-13
-// 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 _XSControl_TransferWriter_HeaderFile
-#define _XSControl_TransferWriter_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <MMgt_TShared.hxx>
-#include <IFSelect_ReturnStatus.hxx>
-#include <Transfer_FinderProcess.hxx>
-class XSControl_Controller;
-class Standard_Transient;
-class Interface_InterfaceModel;
-class TopoDS_Shape;
-class Interface_CheckIterator;
-
-
-class XSControl_TransferWriter;
-DEFINE_STANDARD_HANDLE(XSControl_TransferWriter, MMgt_TShared)
-
-//! TransferWriter gives help to control transfer to write a file
-//! after having converted data from Cascade/Imagine
-//!
-//! It works with a Controller (which itself can work with an
-//! Actor to Write) and a FinderProcess. It records results and
-//! checks
-class XSControl_TransferWriter : public MMgt_TShared
-{
- public:
-
- //! Creates a TransferWriter, empty, ready to run
- //! with an empty FinderProcess (but no controller, etc)
- XSControl_TransferWriter()
- : myProcess(new Transfer_FinderProcess),
- myTransferMode(0)
- {}
-
- //! Returns the FinderProcess itself
- const Handle(Transfer_FinderProcess) & FinderProcess() const { return myProcess; }
-
- //! Sets a new FinderProcess and forgets the former one
- void SetFinderProcess (const Handle(Transfer_FinderProcess)& theFP) { myProcess = theFP; }
-
- //! Returns the currently used Controller
- const Handle(XSControl_Controller) & Controller() const { return myController; }
-
- //! Sets a new Controller, also sets a new FinderProcess
- Standard_EXPORT void SetController (const Handle(XSControl_Controller)& theCtl)
- {
- myController = theCtl;
- Clear(-1);
- }
-
- //! Clears recorded data according a mode
- //! 0 clears FinderProcess (results, checks)
- //! -1 create a new FinderProcess
- Standard_EXPORT void Clear (const Standard_Integer theMode);
-
- //! Returns the current Transfer Mode (an Integer)
- //! It will be interpreted by the Controller to run Transfers
- //! This call form could be later replaced by more specific ones
- //! (parameters suited for each norm / transfer case)
- Standard_Integer TransferMode() const { return myTransferMode; }
-
- //! Changes the Transfer Mode
- void SetTransferMode (const Standard_Integer theMode) { myTransferMode = theMode; }
-
- //! Transfers a Shape from CasCade to a model of current norm,
- //! according to the last call to SetTransferMode
- //! Works by calling the Controller
- //! Returns status : =0 if OK, >0 if error during transfer, <0 if
- //! transfer badly initialised
- Standard_EXPORT IFSelect_ReturnStatus TransferWriteShape (const Handle(Interface_InterfaceModel)& theModel, const TopoDS_Shape& theShape);
-
- DEFINE_STANDARD_RTTIEXT(XSControl_TransferWriter,MMgt_TShared)
-
- private:
-
- Handle(XSControl_Controller) myController;
- Handle(Transfer_FinderProcess) myProcess;
- Standard_Integer myTransferMode;
-};
-
-#endif // _XSControl_TransferWriter_HeaderFile
+++ /dev/null
-// 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 <Dico_DictionaryOfTransient.hxx>
-#include <Geom2d_CartesianPoint.hxx>
-#include <Geom2d_Curve.hxx>
-#include <Geom_CartesianPoint.hxx>
-#include <Geom_Curve.hxx>
-#include <Geom_Geometry.hxx>
-#include <Geom_Surface.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_Pnt2d.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TopoDS_HShape.hxx>
-#include <TopoDS_Shape.hxx>
-#include <XSControl_Vars.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(XSControl_Vars,MMgt_TShared)
-
-XSControl_Vars::XSControl_Vars ()
- { thevars = new Dico_DictionaryOfTransient; }
-
-void XSControl_Vars::Set
- (const Standard_CString name,
- const Handle(Standard_Transient)& val)
-{
- thevars->SetItem (name,val);
-}
-
-Handle(Standard_Transient) XSControl_Vars::Get ( Standard_CString& name) const
-{
- Handle(Standard_Transient) val;
- if (!thevars->GetItem (name,val)) val.Nullify();
- return val;
-}
-
-Handle(Geom_Geometry) XSControl_Vars::GetGeom ( Standard_CString& name) const
-{ return GetCasted(Geom_Geometry,Get(name)); }
-
-Handle(Geom2d_Curve) XSControl_Vars::GetCurve2d ( Standard_CString& name) const
-{ return GetCasted(Geom2d_Curve,Get(name)); }
-
-Handle(Geom_Curve) XSControl_Vars::GetCurve ( Standard_CString& name) const
-{ return GetCasted(Geom_Curve,Get(name)); }
-
-Handle(Geom_Surface) XSControl_Vars::GetSurface ( Standard_CString& name) const
-{ return GetCasted(Geom_Surface,Get(name)); }
-
-
-void XSControl_Vars::SetPoint (const Standard_CString name, const gp_Pnt& val)
-{ Set (name, new Geom_CartesianPoint(val)); }
-
-Standard_Boolean XSControl_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 XSControl_Vars::SetPoint2d (const Standard_CString name, const gp_Pnt2d& val)
-{ Set (name, new Geom2d_CartesianPoint(val)); }
-
-Standard_Boolean XSControl_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 XSControl_Vars::SetShape (const Standard_CString name, const TopoDS_Shape& val)
-{ Set (name, new TopoDS_HShape(val)); }
-
-TopoDS_Shape XSControl_Vars::GetShape (Standard_CString& name) const
-{
- TopoDS_Shape sh;
- DeclareAndCast(TopoDS_HShape,val,Get(name));
- if (!val.IsNull()) sh = val->Shape();
- return sh;
-}
+++ /dev/null
-// 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 _XSControl_Vars_HeaderFile
-#define _XSControl_Vars_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <MMgt_TShared.hxx>
-#include <Standard_CString.hxx>
-#include <Standard_Boolean.hxx>
-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 XSControl_Vars;
-DEFINE_STANDARD_HANDLE(XSControl_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 XSControl_Vars : public MMgt_TShared
-{
- public:
-
- Standard_EXPORT XSControl_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(XSControl_Vars,MMgt_TShared)
-
- protected:
-
- Standard_EXPORT virtual Handle(Standard_Transient) Get (Standard_CString& name) const;
-
- Handle(Dico_DictionaryOfTransient) thevars;
-};
-
-#endif // _XSControl_Vars_HeaderFile
//:i1 pdn 03.04.99 BUC60301
+#include <Interface_Category.hxx>
#include <Interface_Check.hxx>
#include <Interface_CheckIterator.hxx>
+#include <Interface_CheckTool.hxx>
#include <Interface_Graph.hxx>
+#include <Interface_GTool.hxx>
#include <Interface_HGraph.hxx>
#include <Interface_InterfaceModel.hxx>
#include <Interface_IntVal.hxx>
#include <Interface_Macros.hxx>
+#include <Interface_Protocol.hxx>
+#include <Interface_ShareTool.hxx>
#include <Message_Messenger.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <Transfer_ResultFromTransient.hxx>
#include <Transfer_SimpleBinderOfTransient.hxx>
#include <Transfer_TransientProcess.hxx>
+#include <Transfer_ActorOfFinderProcess.hxx>
#include <TransferBRep.hxx>
#include <XSControl_Controller.hxx>
-#include <XSControl_TransferReader.hxx>
-#include <XSControl_Vars.hxx>
#include <XSControl_WorkSession.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(XSControl_WorkSession,IFSelect_WorkSession)
+IMPLEMENT_STANDARD_RTTIEXT(XSControl_WorkSession,MMgt_TShared)
+
+#define Flag_Incorrect 2
+// (Bit Map n0 2)
+
+static Standard_Boolean errhand; // pb : un seul a la fois, mais ca va si vite
+
+// #################################################################
//=======================================================================
//function : XSControl_WorkSession
//=======================================================================
XSControl_WorkSession::XSControl_WorkSession ()
-: myTransferReader(new XSControl_TransferReader),
- myTransferWriter(new XSControl_TransferWriter),
- myVars(new XSControl_Vars)
+: thegtool(new Interface_GTool),
+ thecheckdone(Standard_False),
+ themodelstat(Standard_False),
+ myReaderProcess(new Transfer_TransientProcess),
+ myWriterProcess(new Transfer_FinderProcess)
{
+ errhand = Standard_True;
}
//=======================================================================
-//function : ClearData
+//function :
//purpose :
//=======================================================================
-void XSControl_WorkSession::ClearData (const Standard_Integer mode)
+void XSControl_WorkSession::SetModel (const Handle(Interface_InterfaceModel)& model)
{
- // 1-2-3-4 : standard IFSelect
- if (mode >= 1 && mode <= 4) IFSelect_WorkSession::ClearData (mode);
+ if (myModel != model)
+ theloaded.Clear();
+ else
+ myModel = model;
- // 5 : Transferts seuls
- // 6 : Resultats forces seuls
- // 7 : Management, y compris tous transferts (forces/calcules), views
+ if (!thegtool.IsNull()) thegtool->ClearEntities(); //smh#14 FRA62479
+ myModel->SetGTool (thegtool);
+
+ thegraph.Nullify();
+ ComputeGraph(); // fait qqchose si Protocol present. Sinon, ne fait rien
- if (mode == 5 || mode == 7) {
- myTransferReader->Clear(-1);
- myTransferWriter->Clear(-1);
- }
- if (mode == 6 && !myTransferReader.IsNull()) myTransferReader->Clear(1);
- myTransferReader->SetGraph (HGraph());
+ thecheckdone = Standard_False; // RAZ CheckList, a refaire
+
+// MISE A JOUR des SelectPointed C-A-D on efface leur contenu
+ ClearData(4);
+ ClearData(0);
}
//=======================================================================
-//function : SelectNorm
+//function :
//purpose :
//=======================================================================
-Standard_Boolean XSControl_WorkSession::SelectNorm(const Standard_CString normname)
+Standard_Boolean XSControl_WorkSession::ComputeGraph (const Standard_Boolean enforce)
{
- // Old norm and results
- myTransferReader->Clear(-1);
- // ???? En toute rigueur, menage a faire dans XWS : virer les items
- // ( a la limite, pourquoi pas, refaire XWS en entier)
+ if (myModel.IsNull()) return Standard_False;
+ const Standard_Integer nb = myModel->NbEntities();
+
+ if (!enforce && !thegraph.IsNull() && (thegraph->Graph().Size() == nb))
+ return Standard_True;
+
+ thegraph.Nullify();
+
+ if (nb == 0)
+ return Standard_False;
+
+ // Il faut calculer le graphe pour de bon
+ thegraph = new Interface_HGraph (myModel,themodelstat);
+ 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();
+ 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));
+ }
- Handle(XSControl_Controller) newadapt = XSControl_Controller::Recorded (normname);
- if (newadapt.IsNull()) return Standard_False;
- if (newadapt == myController) return Standard_True;
- SetController (newadapt);
return Standard_True;
}
//=======================================================================
-//function : SetController
+//function :
//purpose :
//=======================================================================
-void XSControl_WorkSession::SetController(const Handle(XSControl_Controller)& ctl)
+Handle(Interface_HGraph) XSControl_WorkSession::HGraph ()
{
- myController = ctl;
-
- SetLibrary ( myController->WorkLibrary() );
- SetProtocol ( myController->Protocol() );
+ ComputeGraph();
+ return thegraph;
+}
- ClearItems();
- ClearFinalModifiers();
- ClearShareOut(Standard_False);
- ClearFile();
- // Set worksession parameters from teh controller
- Handle(XSControl_WorkSession) aWorkSession(this);
- myController->Customise (aWorkSession);
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
- myTransferReader->SetController (myController);
- myTransferWriter->SetController (myController);
+const Interface_Graph& XSControl_WorkSession::Graph ()
+{
+ ComputeGraph();
+ if (thegraph.IsNull()) Standard_DomainError::Raise
+ ("XSControl_WorkSession : Graph not available");
+ return thegraph->Graph();
}
//=======================================================================
-//function : SelectedNorm
+//function :
//purpose :
//=======================================================================
-Standard_CString XSControl_WorkSession::SelectedNorm(const Standard_Boolean rsc) const
+Standard_Boolean XSControl_WorkSession::IsLoaded () const
{
- //JR/Hp :
- Standard_CString astr = (Standard_CString ) (myController.IsNull() ? "" : myController->Name(rsc));
- return astr ;
+ if (myModel.IsNull()) return Standard_False;
+ if (myModel->NbEntities() == 0) return Standard_False;
+ if (thegraph.IsNull()) return Standard_False;
+ return (myModel->NbEntities() == thegraph->Graph().Size());
}
-// ##########################################
-// ############ RESULTATS FORCES ######
-// ##########################################
-
-
//=======================================================================
-//function : PrintTransferStatus
+//function :
//purpose :
//=======================================================================
-Standard_Boolean XSControl_WorkSession::PrintTransferStatus(const Standard_Integer num,
- const Standard_Boolean wri,
- const Handle(Message_Messenger)& S) const
+Standard_Boolean XSControl_WorkSession::ComputeCheck ()
{
- Handle(Transfer_Binder) binder;
- Handle(Standard_Transient) finder;
- Handle(Standard_Transient) ent;
-
- // *** WRITE ***
- if (wri) {
- const Handle(Transfer_FinderProcess) &FP = myTransferWriter->FinderProcess();
- if (FP.IsNull()) return Standard_False;
- if (num == 0 ) return Standard_False;
-
- Standard_Integer ne=0, nr=0, max = FP->NbMapped() ,maxr = FP->NbRoots();
- if (num > 0) {
- if (num > max) return Standard_False;
- ne = num;
- finder = FP->Mapped(ne);
- nr = FP->RootIndex(finder);
- } else if (num < 0) {
- nr = -num;
- if (nr > maxr) return Standard_False;
- finder = FP->Root(nr);
- ne = FP->MapIndex(finder);
- }
-
- S<<"Transfer Write item n0."<<ne<<" of "<<max;
- if (nr > 0) S<<" ** Transfer Root n0."<<ne; S<<endl;
- ent = FP->FindTransient(finder);
- S<<" -> Type "<<finder->DynamicType()->Name()<<endl;
- FP->StartTrace (binder,finder,0,0); // pb sout/S
- if (!ent.IsNull()) {
- S<<" ** Resultat Transient, type "<<ent->DynamicType()->Name();
- const Handle(Interface_InterfaceModel) &model = Model();
- if (!model.IsNull())
- { S<<" In output Model, Entity "; model->Print(ent,S); }
- S<<endl;
+ 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);
}
+ for (num = 1; num <= nb; num ++)
+ if (myModel->IsErrorEntity (num)) BM.SetTrue (num,Flag_Incorrect);
}
- // *** READ ***
- else {
- const Handle(Transfer_TransientProcess) &TP = myTransferReader->TransientProcess();
- if (TP.IsNull()) return Standard_False;
- Handle(Interface_InterfaceModel) model = TP->Model();
- if (model.IsNull()) cout<<"No Model"<<endl;
- else if (model != Model()) cout<<"Model different from the session"<<endl;
- if (num == 0) return Standard_False;
-
- Standard_Integer ne=0, nr=0, max = TP->NbMapped() ,maxr = TP->NbRoots();
- if (num > 0) {
- if (num > max) return Standard_False;
- ne = num;
- ent = TP->Mapped(ne);
- nr = TP->RootIndex(finder);
- } else if (num < 0) {
- nr = -num;
- if (nr > maxr) return Standard_False;
- ent = TP->Root(nr);
- ne = TP->MapIndex(ent);
- }
+ thecheckdone = Standard_True;
+
+ return Standard_True;
+}
- S<<"Transfer Read item n0."<<ne<<" of "<<max;
- if (nr > 0) S<<" ** Transfer Root n0."<<ne; S<<endl;
- if (!model.IsNull()) { S<<" In Model, Entity "; model->Print(ent,S); }
- binder = TP->MapItem (ne);
- S<<endl;
- TP->StartTrace (binder,ent,0,0);
- }
-// *** CHECK (commun READ+WRITE) ***
- if (!binder.IsNull()) {
- const Handle(Interface_Check) ch = binder->Check();
- Standard_Integer i, nbw = ch->NbWarnings(), nbf = ch->NbFails();
- if (nbw > 0) {
- S<<" - Warnings : "<<nbw<<" :\n";
- for (i = 1; i <= nbw; i ++) S<<ch->CWarning(i)<<endl;
+//=======================================================================
+//function : ClearData
+//purpose :
+//=======================================================================
+
+void XSControl_WorkSession::ClearData (const Standard_Integer mode)
+{
+ switch (mode) {
+ case 1 : {
+ theloaded.Clear();
+ if (!myModel.IsNull()) {
+ myModel->Clear();
+ myModel.Nullify();
+ }
+ ClearData(2); ClearData(4);
+ break;
}
- if (nbf > 0) {
- S<<" - Fails : "<<nbf<<" :\n";
- for (i = 1; i <= nbf; i ++) S<<ch->CFail(i)<<endl;
+ case 2 : { thegraph.Nullify(); thecheckdone = Standard_False; break; }
+ case 3 : { thecheckdone = Standard_False; break; }
+ // 5 : Transferts seuls
+ // 6 : Resultats forces seuls
+ case 5: {
+ myReaderProcess = new Transfer_TransientProcess;
+ myWriterProcess = new Transfer_FinderProcess;
+
+ if (!myController.IsNull()) {
+ myReaderProcess->SetActor(myController->ActorRead(Model())); //szv_c1:
+ myWriterProcess->SetActor(myController->NewActorWrite()); //szv_c1:
+ }
+ break;
}
+ case 6: { myReaderProcess->ClearResults(); }
+ default : break;
}
- return Standard_True;
+
+ myReaderProcess->SetGraph (HGraph());
}
//=======================================================================
-//function : InitTransferReader
+//function : SelectNorm
//purpose :
//=======================================================================
-void XSControl_WorkSession::InitTransferReader(const Standard_Integer mode)
+Standard_Boolean XSControl_WorkSession::SelectNorm(const Standard_CString normname)
{
- if (mode == 0 || mode == 5) myTransferReader->Clear(-1); // full clear
- if (myTransferReader.IsNull()) SetTransferReader (new XSControl_TransferReader);
- else SetTransferReader (myTransferReader);
+ // Old norm and results
+ //xxx1:myTransferReader->Clear();
+ // ???? En toute rigueur, menage a faire dans XWS : virer les items
+ // ( a la limite, pourquoi pas, refaire XWS en entier)
- // mode = 0 fait par SetTransferReader suite a Nullify
- if (mode == 1) {
- if (!myTransferReader.IsNull()) myTransferReader->Clear(-1);
- else SetTransferReader (new XSControl_TransferReader);
- }
- if (mode == 2) {
- Handle(Transfer_TransientProcess) TP = myTransferReader->TransientProcess();
- if (TP.IsNull()) {
- TP = new Transfer_TransientProcess;
- myTransferReader->SetTransientProcess(TP);
- TP->SetGraph (HGraph());
- }
- Handle(TColStd_HSequenceOfTransient) lis = myTransferReader->RecordedList();
- Standard_Integer i, nb = lis->Length();
- for (i = 1; i <= nb; i ++) TP->SetRoot(lis->Value(i));
- }
- if (mode == 3) {
- Handle(Transfer_TransientProcess) TP = myTransferReader->TransientProcess();
- if (TP.IsNull()) return;
- Standard_Integer i, nb = TP->NbRoots();
- for (i = 1; i <= nb; i ++) myTransferReader->RecordResult(TP->Root(i));
- }
- if (mode == 4 || mode == 5) myTransferReader->BeginTransfer();
+ Handle(XSControl_Controller) newadapt = XSControl_Controller::Recorded(normname);
+ if (newadapt.IsNull()) return Standard_False;
+ if (newadapt == myController) return Standard_True;
+ SetController (newadapt);
+ return Standard_True;
}
//=======================================================================
-//function : SetTransferReader
+//function : SetController
//purpose :
//=======================================================================
-void XSControl_WorkSession::SetTransferReader(const Handle(XSControl_TransferReader)& TR)
+void XSControl_WorkSession::SetController(const Handle(XSControl_Controller)& ctl)
{
- if (myTransferReader != TR) //i1 pdn 03.04.99 BUC60301
- myTransferReader = TR;
- if (TR.IsNull()) return;
- TR->SetController (myController);
- TR->SetGraph (HGraph());
- if (!TR->TransientProcess().IsNull()) return;
- Handle(Transfer_TransientProcess) TP = new Transfer_TransientProcess
- (Model().IsNull() ? 100 : Model()->NbEntities() + 100);
- TP->SetGraph (HGraph());
- TR->SetTransientProcess(TP);
+ myController = ctl;
+
+ const Handle(Interface_Protocol) &aProtocol = myController->Protocol();
+ Interface_Protocol::SetActive(aProtocol);
+ thegtool->SetProtocol(aProtocol);
+
+ /*szv_c1:ClearItems();
+ ClearShareOut();*/
+
+ // Set worksession parameters from the controller
+ Handle(XSControl_WorkSession) aWorkSession(this);
+ myController->Customise (aWorkSession);
+
+ myReaderProcess = new Transfer_TransientProcess;
+ myReaderProcess->SetActor(myController->ActorRead(Model())); //szv_c1:
+
+ myWriterProcess = new Transfer_FinderProcess;
+ myWriterProcess->SetActor(myController->NewActorWrite()); //szv_c1:
}
+
//=======================================================================
-//function : SetMapReader
+//function : ReadFile
//purpose :
//=======================================================================
-Standard_Boolean XSControl_WorkSession::SetMapReader (const Handle(Transfer_TransientProcess)& TP)
+Interface_ReturnStatus XSControl_WorkSession::ReadFile (const Standard_CString theFileName)
{
- if (TP.IsNull()) return Standard_False;
- if (TP->Model().IsNull()) TP->SetModel (Model());
- TP->SetGraph (HGraph());
- if (TP->Model() != Model()) return Standard_False;
- Handle(XSControl_TransferReader) TR = myTransferReader;
- TR->Clear(-1);
- SetTransferReader (TR); // avec le meme mais le reinitialise
- TR->SetTransientProcess (TP); // et prend le nouveau TP
- return Standard_True;
+ if (myController.IsNull()) return Interface_RetVoid;
+ if (myController->Protocol().IsNull()) return Interface_RetVoid;
+
+ Handle(Interface_InterfaceModel) model;
+ Interface_ReturnStatus status = Interface_RetVoid;
+ try {
+ OCC_CATCH_SIGNALS
+ const Standard_Integer stat = myController->ReadFile (theFileName,model);
+ if (stat == 0) status = Interface_RetDone;
+ else if (stat < 0) status = Interface_RetError;
+ else status = Interface_RetFail;
+ }
+ catch(Standard_Failure) {
+ const Handle(Message_Messenger) &sout = Message::DefaultMessenger();
+ sout<<" **** Interruption ReadFile par Exception : ****\n";
+ sout << Standard_Failure::Caught()->GetMessageString();
+ sout<<"\n Abandon"<<endl;
+ status = Interface_RetFail;
+ }
+ if (status != Interface_RetDone) return status;
+ if (model.IsNull()) return Interface_RetVoid;
+ SetModel (model);
+ SetLoadedFile (theFileName);
+ return status;
}
//=======================================================================
-//function : Result
+//function :
//purpose :
//=======================================================================
-Handle(Standard_Transient) XSControl_WorkSession::Result
- (const Handle(Standard_Transient)& ent, const Standard_Integer mode) const
+Interface_ReturnStatus XSControl_WorkSession::WriteFile (const Standard_CString theFileName)
{
- Standard_Integer ouca = (mode % 10);
- Standard_Integer kica = (mode / 10);
-
- Handle(Transfer_Binder) binder;
- Handle(Transfer_ResultFromModel) resu;
+ if (myController.IsNull())
+ return Interface_RetVoid;
+
+ ComputeGraph(Standard_True);
+ if (!IsLoaded())
+ return Interface_RetVoid;
+
+ Interface_CheckIterator checks;
+ if (errhand) {
+ errhand = Standard_False;
+ try {
+ OCC_CATCH_SIGNALS
+ CopySendAll(theFileName,checks);
+ }
+ catch (Standard_Failure) {
+ const Handle(Message_Messenger) &sout = Message::DefaultMessenger();
+ sout<<" **** Exception in XSControl_WorkSession::WriteFile : ****\n";
+ sout<<Standard_Failure::Caught()->GetMessageString();
+ sout<<"\n Abandon"<<endl;
+ errhand = Standard_True;
+ return Interface_RetFail;
+ }
+ }
+ else CopySendAll(theFileName,checks);
- if (ouca != 1) resu = myTransferReader->FinalResult(ent);
- if (mode == 20) return resu;
+ Handle(Interface_Check) aMainFail = checks.CCheck(0);
+ if (!aMainFail.IsNull() && aMainFail->HasFailed ())
+ {
+ return Interface_RetStop;
+ }
- if (!resu.IsNull()) binder = resu->MainResult()->Binder();
- if (binder.IsNull() && ouca > 0)
- binder = myTransferReader->TransientProcess()->Find(ent);
+ theloaded = theFileName;
- if (kica == 1) return binder;
- DeclareAndCast(Transfer_SimpleBinderOfTransient,trb,binder);
- if (!trb.IsNull()) return trb->Result();
- return binder;
+ return (checks.IsEmpty(Standard_True)? Interface_RetDone : Interface_RetError);
}
+
// ##########################################
-// ############ TRANSFERT #############
+// ############ RESULTATS FORCES ######
// ##########################################
//=======================================================================
-//function : TransferReadOne
+//function : InitTransferReader
//purpose :
//=======================================================================
-Standard_Integer XSControl_WorkSession::TransferReadOne (const Handle(Standard_Transient)& ent)
+void XSControl_WorkSession::InitTransferReader(const Standard_Integer mode)
{
- Handle(Interface_InterfaceModel) model = Model();
- if (ent == model) return TransferReadRoots();
+ //if (mode == 0) myTransferReader->Clear(); // full clear
+
+ //if (myTransferReader.IsNull())
+ //myTransferReader = new XSControl_TransferReader;
+ //SetTransferReader (myTransferReader.IsNull()? new XSControl_TransferReader : myTransferReader);
+ //{
+ //if (myTransferReader != TR) //i1 pdn 03.04.99 BUC60301
+ //myTransferReader = TR;
+
+ //xxx1:myTransferReader->SetController (myController);
+
+ //xxx1:TR->TransientProcess()->SetGraph (HGraph());
+ //xxx1:if (!TR->TransientProcess().IsNull()) return;
+ const Standard_Integer nbe = Model().IsNull() ? 0 : Model()->NbEntities();
+ Handle(Transfer_TransientProcess) TP = new Transfer_TransientProcess(nbe+100);
+ TP->SetActor(myController->ActorRead(Model())); //szv_c1:
+ TP->SetGraph (HGraph());
- Handle(TColStd_HSequenceOfTransient) list = GiveList(ent);
- if (list->Length() == 1) return myTransferReader->TransferOne(list->Value(1));
- else return myTransferReader->TransferList (list);
-}
+ myReaderProcess = TP;
+
+ // mode = 0 fait par SetTransferReader suite a Nullify
+ //szv_c1: mode = 1 not used
+ //szv_c1: mode = 2 not used
+ //szv_c1: mode = 3 not used
+ if (mode == 4) myReaderProcess->BeginTransfer(); //myTransferReader->BeginTransfer();
+}
//=======================================================================
-//function : TransferReadRoots
+//function : SetReaderProcess
//purpose :
//=======================================================================
-Standard_Integer XSControl_WorkSession::TransferReadRoots ()
+Standard_Boolean XSControl_WorkSession::SetReaderProcess (const Handle(Transfer_TransientProcess)& TP)
{
- return myTransferReader->TransferRoots(Graph());
-}
+ if (TP.IsNull()) return Standard_False;
+ if (TP->Model().IsNull()) TP->SetModel (Model());
+ TP->SetGraph (HGraph());
+ if (TP->Model() != Model()) return Standard_False;
+ TP->SetActor(myController->ActorRead(Model())); //szv_c1:
+ return Standard_True;
+}
// ##########################################
// ############ TRANSFERT WRITE
Handle(Interface_InterfaceModel) XSControl_WorkSession::NewModel ()
{
- Handle(Interface_InterfaceModel) newmod;
- if (myController.IsNull()) return newmod;
- newmod = myController->NewModel();
+ if (myController.IsNull())
+ return NULL;
+
+ Handle(Interface_InterfaceModel) newmod = myController->NewModel();
SetModel(newmod);
- if(!myTransferReader->TransientProcess().IsNull())
- myTransferReader->TransientProcess()->Clear();
+ /*xxx1:if(!myReaderProcess.IsNull())
+ myReaderProcess->Clear();
//clear all contains of WS
- myTransferReader->Clear(3);
- myTransferWriter->Clear(-1);
-
- return newmod;
-}
+ myTransferReader->Clear();*/
+ myReaderProcess = new Transfer_TransientProcess;
+ myReaderProcess->SetActor(myController->ActorRead(Model())); //szv_c1:
-//=======================================================================
-//function : TransferWriteShape
-//purpose :
-//=======================================================================
-
-IFSelect_ReturnStatus XSControl_WorkSession::TransferWriteShape (const TopoDS_Shape& shape, const Standard_Boolean compgraph)
-{
- IFSelect_ReturnStatus status;
- if (myController.IsNull()) return IFSelect_RetError;
- const Handle(Interface_InterfaceModel) &model = Model();
- if (model.IsNull()) return IFSelect_RetVoid;
-
- status = myTransferWriter->TransferWriteShape (model,shape);
- // qui s occupe de tout, try/catch inclus
+ myWriterProcess = new Transfer_FinderProcess;
+ myWriterProcess->SetActor(myController->NewActorWrite()); //szv_c1:
- //skl insert param compgraph for XDE writing 10.12.2003
- if(compgraph) ComputeGraph(Standard_True);
-
- return status;
+ return newmod;
}
-
//=======================================================================
-//function : ClearBinders
+//function : CopySendAll
//purpose :
//=======================================================================
-void XSControl_WorkSession::ClearBinders()
+void XSControl_WorkSession::CopySendAll (const Standard_CString theFileName, Interface_CheckIterator &theChecks)
{
- const Handle(Transfer_FinderProcess) &FP = myTransferWriter->FinderProcess();
- //Due to big number of chains of binders it is necessary to
- //collect head binders of each chain in the sequence
- TColStd_SequenceOfTransient aSeqBnd;
- TColStd_SequenceOfTransient aSeqShapes;
- Standard_Integer i =1;
- for( ; i <= FP->NbMapped();i++) {
- Handle(Transfer_Binder) bnd = FP->MapItem ( i );
- if(!bnd.IsNull())
- aSeqBnd.Append(bnd);
- Handle(Standard_Transient) ash (FP->Mapped(i));
- aSeqShapes.Append(ash);
- }
- //removing finder process containing result of translation.
- FP->Clear();
- ClearData(1);
- ClearData(5);
-
- //removing each chain of binders
- while(aSeqBnd.Length() >0) {
- Handle(Transfer_Binder) aBnd = Handle(Transfer_Binder)::DownCast(aSeqBnd.Value(1));
- Handle(Standard_Transient) ash =aSeqShapes.Value(1);
- aSeqBnd.Remove(1);
- aSeqShapes.Remove(1);
- ash.Nullify();
- while(!aBnd.IsNull()) {
- Handle(Transfer_Binder) aBndNext = aBnd->NextResult();
- aBnd.Nullify();
- aBnd = aBndNext;
- }
-
- }
+ theChecks.SetName ("X-STEP WorkSession : Send All");
+ Message::DefaultMessenger() << "** WorkSession : Sending all data"<<endl;
+
+ const Handle(Interface_Protocol)& aProtocol = myController->Protocol();
+ const Handle(Interface_InterfaceModel) &aModel = thegraph->Graph().Model();
+ if (aModel.IsNull() || aProtocol.IsNull()) return;
+ Interface_CheckIterator checklst;
+ const Standard_Boolean res = myController->WriteFile(theFileName,aModel,checklst);
+ theChecks.Merge(checklst);
+ if (!res) theChecks.CCheck(0)->AddFail ("SendAll (WriteFile) has failed");
}
#ifndef _XSControl_WorkSession_HeaderFile
#define _XSControl_WorkSession_HeaderFile
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
+#include <MMgt_TShared.hxx>
-#include <IFSelect_WorkSession.hxx>
-#include <IFSelect_ReturnStatus.hxx>
-#include <XSControl_TransferWriter.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <Interface_ReturnStatus.hxx>
+#include <Transfer_FinderProcess.hxx>
+#include <Transfer_TransientProcess.hxx>
+class Interface_InterfaceModel;
+class Interface_Graph;
+class Interface_HGraph;
+class Interface_GTool;
+class Interface_CheckIterator;
class XSControl_Controller;
-class XSControl_TransferReader;
-class XSControl_Vars;
class Message_Messenger;
-class Transfer_TransientProcess;
-class Standard_Transient;
-class Interface_InterfaceModel;
-class Transfer_FinderProcess;
class TopoDS_Shape;
-class Interface_CheckIterator;
class XSControl_WorkSession;
-DEFINE_STANDARD_HANDLE(XSControl_WorkSession, IFSelect_WorkSession)
+DEFINE_STANDARD_HANDLE(XSControl_WorkSession, MMgt_TShared)
//! This WorkSession completes the basic one, by adding :
//! - use of Controller, with norm selection...
//! - management of transfers (both ways) with auxiliary classes
-//! TransferReader and TransferWriter
+//! ReaderProcess and WriterProcess
//! -> these transfers may work with a Context List : its items
//! are given by the user, according to the transfer to be
//! i.e. it is interpreted by the Actors
//! Each item is accessed by a Name
-class XSControl_WorkSession : public IFSelect_WorkSession
+class XSControl_WorkSession : public MMgt_TShared
{
public:
-
- Standard_EXPORT XSControl_WorkSession();
-
- ~XSControl_WorkSession()
- { ClearBinders(); }
- //! In addition to basic ClearData, clears Transfer and Management
+ Standard_EXPORT XSControl_WorkSession ();
+
+ //! Sets a Model as input : this will be the Model from which the
+ //! ShareOut will work
+ //! All SelectPointed items are cleared
+ //! 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);
+
+ //! 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(); }
+
+ //! 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; }
+
+ //! 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 <enforce> 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 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).
+ //! 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
+ Standard_EXPORT Standard_Boolean ComputeCheck ();
+
+ //! 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
+ //! Clears Transfer and Management
//! for interactive use, for mode = 0,1,2 and over 4
//! Plus : mode = 5 to clear Transfers (both ways) only
//! mode = 6 to clear enforced results
- //! mode = 7 to clear transfers, results
- Standard_EXPORT virtual void ClearData (const Standard_Integer theMode) Standard_OVERRIDE;
+ Standard_EXPORT virtual void ClearData (const Standard_Integer theMode);
//! Selects a Norm defined by its name.
//! A Norm is described and handled by a Controller
Standard_EXPORT Standard_Boolean SelectNorm (const Standard_CString theNormName);
//! Selects a Norm defined by its Controller itself
- Standard_EXPORT void SetController (const Handle(XSControl_Controller)& theCtl);
-
- //! Returns the name of the last Selected Norm. If none is
- //! defined, returns an empty string
- //! By default, returns the complete name of the norm
- //! If <rsc> is True, returns the short name used for resource
- Standard_EXPORT Standard_CString SelectedNorm (const Standard_Boolean theRsc = Standard_False) const;
+ Standard_EXPORT virtual void SetController (const Handle(XSControl_Controller)& theCtl); //szv_c1: made virtual
//! Returns the norm controller itself
- const Handle(XSControl_Controller) & NormAdaptor() const { return myController; }
+ const Handle(XSControl_Controller) & NormAdaptor () const { return myController; }
- //! Prints the transfer status of a transferred item, as beeing
- //! the Mapped n0 <num>, from MapWriter if <wri> is True, or
- //! from MapReader if <wri> is False
- //! Returns True when done, False else (i.e. num out of range)
- Standard_EXPORT Standard_Boolean PrintTransferStatus (const Standard_Integer theNum, const Standard_Boolean theWri, const Handle(Message_Messenger)& theS) const;
+ //! Reads a file with the Controller (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 Interface_ReturnStatus ReadFile (const Standard_CString theFileName);
+
+ //! Writes the current Interface Model globally to a File, and
+ //! The Model and File Modifiers recorded to be applied on sending files.
+ //! Returns a status of execution :
+ //! Done if OK,
+ //! Void if no data available,
+ //! Error if errors occured (controller is not defined, errors during translation)
+ //! Fail if exception during translation is raised
+ //! Stop if no disk space or disk, file is write protected
+ //! Fills LastRunCheckList
+ Standard_EXPORT Interface_ReturnStatus WriteFile (const Standard_CString theFileName);
//! Sets a Transfer Reader, by internal ways, according mode :
- //! 0 recreates it clear, 1 clears it (does not recreate)
- //! 2 aligns Roots of TransientProcess from final Results
+ //! 0 recreates it clear
//! 3 aligns final Results from Roots of TransientProcess
//! 4 begins a new transfer (by BeginTransfer)
- //! 5 recreates TransferReader then begins a new transfer
Standard_EXPORT void InitTransferReader (const Standard_Integer theMode);
-
- //! Returns the Transfer Reader, Null if not set
- const Handle(XSControl_TransferReader) & TransferReader () const { return myTransferReader; }
- //! Changes the Map Reader, i.e. considers that the new one
+ //! Changes the ReaderProcess, i.e. considers that the new one
//! defines the relevant read results (forgets the former ones)
//! Returns True when done, False in case of bad definition, i.e.
//! if Model from TP differs from that of Session
- Standard_EXPORT Standard_Boolean SetMapReader (const Handle(Transfer_TransientProcess)& theTP);
-
- //! Returns the result attached to a starting entity
- //! If <mode> = 0, returns Final Result
- //! If <mode> = 1, considers Last Result
- //! If <mode> = 2, considers Final, else if absent, Last
- //! returns it as Transient, if result is not transient returns
- //! the Binder
- //! <mode> = 10,11,12 idem but returns the Binder itself
- //! (if it is not, e.g. Shape, returns the Binder)
- //! <mode> = 20, returns the ResultFromModel
- Standard_EXPORT Handle(Standard_Transient) Result (const Handle(Standard_Transient)& theEnt, const Standard_Integer theMode) const;
-
- //! Commands the transfer of, either one entity, or a list
- //! I.E. calls the TransferReader after having analysed <ents>
- //! It is cumulated from the last BeginTransfer
- //! <ents> is processed by GiveList, hence :
- //! - <ents> a Selection : its SelectionResult
- //! - <ents> a HSequenceOfTransient : this list
- //! - <ents> the Model : in this specific case, all the roots,
- //! with no cumulation of former transfers (TransferReadRoots)
- Standard_EXPORT Standard_Integer TransferReadOne (const Handle(Standard_Transient)& theEnts);
-
- //! Commands the transfer of all the root entities of the model
- //! i.e. calls TransferRoot from the TransferReader with the Graph
- //! No cumulation with former calls to TransferReadOne
- Standard_EXPORT Standard_Integer TransferReadRoots();
+ Standard_EXPORT Standard_Boolean SetReaderProcess (const Handle(Transfer_TransientProcess)& theTP);
+
+ //! Returns the Reader Process, Null if not set
+ const Handle(Transfer_TransientProcess) & ReaderProcess () const { return myReaderProcess; }
+
+ //! Returns the Writer Process, Null if not set
+ const Handle(Transfer_FinderProcess) & WriterProcess () const { return myWriterProcess; }
+
+ //! Changes the Map Writer, i.e. considers that the new one
+ //! defines the relevant write results (forgets the former ones)
+ void SetWriterProcess (const Handle(Transfer_FinderProcess)& theFP) { if (!theFP.IsNull()) myWriterProcess = theFP; }
//! produces and returns a new Model well conditionned
//! It is produced by the Norm Controller
//! It can be Null (if this function is not implemented)
- Standard_EXPORT Handle(Interface_InterfaceModel) NewModel();
+ Standard_EXPORT Handle(Interface_InterfaceModel) NewModel ();
- //! Returns the Transfer Reader, Null if not set
- const Handle(XSControl_TransferWriter) & TransferWriter() const { return myTransferWriter; }
-
- //! Changes the Map Reader, i.e. considers that the new one
- //! defines the relevant read results (forgets the former ones)
- //! Returns True when done, False if <FP> is Null
- Standard_Boolean SetMapWriter (const Handle(Transfer_FinderProcess)& theFP)
- {
- if (theFP.IsNull()) return Standard_False;
- myTransferWriter->SetFinderProcess(theFP);
- return Standard_True;
- }
-
- //! Transfers a Shape from CasCade to a model of current norm,
- //! according to the last call to SetModeWriteShape
- //! Returns status :Done if OK, Fail if error during transfer,
- //! Error if transfer badly initialised
- Standard_EXPORT IFSelect_ReturnStatus TransferWriteShape (const TopoDS_Shape& theShape, const Standard_Boolean theCompGraph = Standard_True);
-
- const Handle(XSControl_Vars) & Vars() const { return myVars; }
-
- void SetVars (const Handle(XSControl_Vars)& theVars) { myVars = theVars; }
-
- DEFINE_STANDARD_RTTIEXT(XSControl_WorkSession,IFSelect_WorkSession)
+ DEFINE_STANDARD_RTTIEXT(XSControl_WorkSession,MMgt_TShared)
- private:
-
- //! Sets a Transfer Reader, which manages transfers on reading
- Standard_EXPORT void SetTransferReader (const Handle(XSControl_TransferReader)& theTR);
-
- //! Clears binders
- Standard_EXPORT void ClearBinders();
+ protected:
+
+ Standard_EXPORT void CopySendAll (const Standard_CString filename, Interface_CheckIterator &checks);
+
+ Handle(XSControl_Controller) myController; // thelibrary;
+
+ Handle(Interface_InterfaceModel) myModel;
+
+ Handle(Interface_HGraph) thegraph;
+
+ Handle(Interface_GTool) thegtool;
+ Standard_Boolean thecheckdone;
+ Standard_Boolean themodelstat;
+ TCollection_AsciiString theloaded;
- Handle(XSControl_Controller) myController;
- Handle(XSControl_TransferReader) myTransferReader;
- Handle(XSControl_TransferWriter) myTransferWriter;
- Handle(XSControl_Vars) myVars;
+ Handle(Transfer_TransientProcess) myReaderProcess;
+ Handle(Transfer_FinderProcess) myWriterProcess;
};
#endif // _XSControl_WorkSession_HeaderFile
//:i1 gka 03.04.99 BUC60301
+#include <Standard_ErrorHandler.hxx>
+#include <Standard_Failure.hxx>
#include <Interface_InterfaceModel.hxx>
#include <Interface_Macros.hxx>
+#include <Transfer_FinderProcess.hxx>
+#include <Transfer_ActorOfFinderProcess.hxx>
+#include <Message_Messenger.hxx>
#include <TopoDS_Shape.hxx>
#include <XSControl_Controller.hxx>
-#include <XSControl_TransferWriter.hxx>
#include <XSControl_WorkSession.hxx>
#include <XSControl_Writer.hxx>
+#include <Transfer_SimpleBinderOfTransient.hxx>
+#include <TransferBRep_ShapeMapper.hxx>
-XSControl_Writer::XSControl_Writer ()
+Interface_ReturnStatus XSControl_Writer::TransferShape (const TopoDS_Shape& theShape, const Standard_Boolean theCompGraph)
{
- SetWS (new XSControl_WorkSession);
-}
+ if (theShape.IsNull()) return Interface_RetVoid;
-Standard_Boolean XSControl_Writer::SetNorm (const Standard_CString norm)
-{
- if (thesession.IsNull()) SetWS (new XSControl_WorkSession);
- Standard_Boolean sess = thesession->SelectNorm (norm);
- Handle(Interface_InterfaceModel) model = Model (); //:i1 gka 03.04.99 BUC60301
- return sess;
-}
+ if (myWS.IsNull()) return Interface_RetVoid;
-void XSControl_Writer::SetWS (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch)
-{
- thesession = WS;
-// Un controller doit etre defini ...
- thesession->InitTransferReader(0);
- Handle(Interface_InterfaceModel) model = Model (scratch);
-}
+ const Handle(Interface_InterfaceModel) &aModel = myWS->Model();
+ if (aModel.IsNull()) return Interface_RetVoid;
-Handle(Interface_InterfaceModel) XSControl_Writer::Model (const Standard_Boolean newone)
-{
- Handle(Interface_InterfaceModel) model = thesession->Model();
- if (newone || model.IsNull()) model = thesession->NewModel();
- return model;
-}
+ const Handle(Transfer_FinderProcess) &aProcess = myWS->WriterProcess();
+ if (aProcess.IsNull()) return Interface_RetVoid;
-IFSelect_ReturnStatus XSControl_Writer::TransferShape (const TopoDS_Shape& sh, const Standard_Integer mode)
-{
- thesession->TransferWriter()->SetTransferMode (mode);
- return thesession->TransferWriteShape (sh);
+ const Handle(Transfer_Process::Actor) &anActor = aProcess->GetActor();
+ if (anActor.IsNull()) return Interface_RetError;
+
+ const Handle(Message_Messenger) &sout = aProcess->Messenger();
+
+ sout<<"\n*******************************************************************";
+ sout<<"\n****** Statistics on Transfer (Write) ******";
+ sout<<"\n*******************************************************************\n";
+ /*szv_c1:sout<<"\n****** Transfer Mode = "<<theMode;
+ Standard_CString modehelp = anActor->TransferModeHelp(theMode);
+ if (modehelp && modehelp[0] != 0) sout<<" I.E. "<<modehelp;
+ sout<<" ******"<<endl;*/
+ //anActor->PrintInfo(sout);
+ sout<<"\n****** Transferring Shape, ShapeType = " <<theShape.ShapeType()<<" ******"<<endl;
+
+ //szv_c1:anActor->SetTransferMode(theMode);
+ aProcess->SetModel (aModel);
+
+ Interface_ReturnStatus status = Interface_RetFail;
+
+ try {
+ OCC_CATCH_SIGNALS
+
+ Handle(TransferBRep_ShapeMapper) aMapper = new TransferBRep_ShapeMapper(theShape);
+ aProcess->Transfer (aMapper);
+
+ Handle(Transfer_Binder) binder = aProcess->Find (aMapper);
+ while (!binder.IsNull()) {
+ Handle(Transfer_SimpleBinderOfTransient) bindtr = Handle(Transfer_SimpleBinderOfTransient)::DownCast (binder);
+ if (!bindtr.IsNull()) {
+ const Handle(Standard_Transient) &ent = bindtr->Result();
+ if (!ent.IsNull()) {
+ status = Interface_RetDone;
+ aModel->AddWithRefs (ent);
+ }
+ }
+ binder = binder->NextResult();
+ }
+ }
+ catch (Standard_Failure) {
+ sout<<"**** **** Transfer, EXCEPTION : ";
+ sout<<Standard_Failure::Caught()->GetMessageString();
+ sout<<endl;
+ status = Interface_RetFail;
+ }
+
+ if (theCompGraph) myWS->ComputeGraph(Standard_True);
+
+ return status;
}
-IFSelect_ReturnStatus XSControl_Writer::WriteFile (const Standard_CString filename)
+Interface_ReturnStatus XSControl_Writer::WriteFile (const Standard_CString theFileName)
{
- return thesession->SendAll(filename);
+ return myWS->WriteFile(theFileName);
}
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
-#include <IFSelect_ReturnStatus.hxx>
-class XSControl_WorkSession;
-class Interface_InterfaceModel;
+#include <Interface_ReturnStatus.hxx>
class TopoDS_Shape;
+class XSControl_WorkSession;
//! This class gives a simple way to create then write a
DEFINE_STANDARD_ALLOC
- //! Creates a Writer from scratch
- Standard_EXPORT XSControl_Writer();
-
- //! Creates a Writer from scratch, with a norm name which
- //! identifie a Controller
- XSControl_Writer(const Standard_CString norm) { SetNorm (norm); }
-
- //! Creates a Writer from an already existing Session
- //! If <scratch> is True (D), clears already recorded data
- XSControl_Writer(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True) { SetWS (WS,scratch); }
-
- //! Sets a specific norm to <me>
- //! Returns True if done, False if <norm> is not available
- Standard_EXPORT Standard_Boolean SetNorm (const Standard_CString norm);
-
- //! Sets a specific session to <me>
- Standard_EXPORT void SetWS (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
+ //! Creates a Writer from session
+ XSControl_Writer(const Handle(XSControl_WorkSession) &WS) : myWS(WS) {}
//! Returns the session used in <me>
- const Handle(XSControl_WorkSession) & WS() const { return thesession; }
-
- //! Returns the produced model. Produces a new one if not yet done
- //! or if <newone> is True
- //! This method allows for instance to edit product or header
- //! data before writing
- Standard_EXPORT Handle(Interface_InterfaceModel) Model (const Standard_Boolean newone = Standard_False);
+ const Handle(XSControl_WorkSession) & WS() const { return myWS; }
- //! Transfers a Shape according to the mode
- Standard_EXPORT IFSelect_ReturnStatus TransferShape (const TopoDS_Shape& sh, const Standard_Integer mode = 0);
+ //! Transfers a shape using the owned worksession
+ Standard_EXPORT Interface_ReturnStatus TransferShape (const TopoDS_Shape& theShape, const Standard_Boolean theCompGraph = Standard_True);
//! Writes the produced model
- Standard_EXPORT IFSelect_ReturnStatus WriteFile (const Standard_CString filename);
+ Standard_EXPORT Interface_ReturnStatus WriteFile (const Standard_CString filename);
- private:
+ protected:
- Handle(XSControl_WorkSession) thesession;
+ Handle(XSControl_WorkSession) myWS;
};
#endif // _XSControl_Writer_HeaderFile
XSDRAW.cxx
XSDRAW.hxx
+XSDRAW_Activator.cxx
+XSDRAW_Activator.hxx
XSDRAW_Commands.hxx
XSDRAW_ControlFunctions.cxx
XSDRAW_ControlFunctions.hxx
XSDRAW_SelectFunctions.cxx
XSDRAW_SelectFunctions.hxx
+XSDRAW_SessionItems.hxx
+XSDRAW_SessionPilot.cxx
+XSDRAW_SessionPilot.hxx
XSDRAW_ShapeFunctions.cxx
XSDRAW_ShapeFunctions.hxx
XSDRAW_Vars.cxx
#include <DBRep.hxx>
#include <Dico_DictionaryOfInteger.hxx>
#include <Draw_Appli.hxx>
-#include <IFSelect_SessionPilot.hxx>
#include <Interface_InterfaceModel.hxx>
#include <Interface_Macros.hxx>
#include <Interface_Protocol.hxx>
#include <Message.hxx>
#include <Message_Messenger.hxx>
-#include <Standard_Transient.hxx>
#include <TCollection_AsciiString.hxx>
#include <TColStd_HSequenceOfAsciiString.hxx>
#include <TopoDS_Shape.hxx>
#include <Transfer_TransientProcess.hxx>
#include <TransferBRep.hxx>
#include <XSControl_Controller.hxx>
-#include <XSControl_TransferReader.hxx>
-#include <XSControl_WorkSession.hxx>
+#include <IFSelect_WorkSession.hxx>
#include <XSDRAW.hxx>
-#include <XSDRAW_Vars.hxx>
#include <XSDRAW_SelectFunctions.hxx>
#include <XSDRAW_ControlFunctions.hxx>
#include <XSDRAW_ShapeFunctions.hxx>
+#include <XSDRAW_SessionPilot.hxx>
#include <stdio.h>
static int deja = 0, dejald = 0;
static Handle(Dico_DictionaryOfInteger) theolds;
static Handle(TColStd_HSequenceOfAsciiString) thenews;
-static Handle(IFSelect_SessionPilot) thepilot; // detient Session, Model
+static Handle(XSDRAW_SessionPilot) thepilot; // detient Session, Model
static Standard_Integer XSTEPDRAWRUN (Draw_Interpretor& , Standard_Integer argc, const char** argv)
{
mess.AssignCat(argv[i]); mess.AssignCat(" ");
}
- IFSelect_ReturnStatus stat = thepilot->Execute (mess.ToCString());
- if (stat == IFSelect_RetError || stat == IFSelect_RetFail) return 1;
+ Interface_ReturnStatus stat = thepilot->Execute (mess.ToCString());
+ if (stat == Interface_RetError || stat == Interface_RetFail) return 1;
else return 0;
}
void XSDRAW::LoadSession ()
{
- static int gInit= 0;
- if (!gInit) {
- gInit = 1;
- thepilot = new IFSelect_SessionPilot("XSTEP-DRAW>");
- Handle(XSControl_WorkSession) WS = new XSControl_WorkSession;
- WS->SetVars (new XSDRAW_Vars);
- thepilot->SetSession (WS);
+ if (thepilot.IsNull()) {
+ thepilot = XSDRAW_SessionPilot::Pilot();
XSDRAW_SelectFunctions::Init();
XSDRAW_ControlFunctions::Init();
LoadSession();
//skl: we remove commands "x" and "exit" in order to this commands are
- // performed not in IFSelect_SessionPilot but in standard Tcl interpretor
+ // performed not in XSDRAW_SessionPilot but in standard Tcl interpretor
XSDRAW::RemoveCommand("x");
XSDRAW::RemoveCommand("exit");
- Handle(TColStd_HSequenceOfAsciiString) list = IFSelect_Activator::Commands(0);
+ Handle(TColStd_HSequenceOfAsciiString) list = XSDRAW_Activator::Commands(0);
TCollection_AsciiString com;
Standard_Integer i, nb = list->Length();
for (i = 1; i <= nb; i ++) {
- Handle(IFSelect_Activator) act;
+ Handle(XSDRAW_Activator) act;
Standard_Integer nact, num = -1;
char help[200];
com = list->Value(i);
if (!theolds.IsNull())
if (theolds->HasItem(com.ToCString())) num = theolds->Item(com.ToCString());
if (num == 0) continue;
- if (!IFSelect_Activator::Select(com.ToCString(),nact,act))
+ if (!XSDRAW_Activator::Select(com.ToCString(),nact,act))
Sprintf (help,"type : xhelp %s for help",com.ToCString());
else if (!act.IsNull()) strcpy(help,act->Help(nact));
if (num < 0) theCommands.Add (com.ToCString(),help,XSTEPDRAWRUN,act->Group());
return 1; // stat ?
}
-const Handle(IFSelect_SessionPilot) & XSDRAW::Pilot ()
+const Handle(XSDRAW_SessionPilot) & XSDRAW::Pilot ()
{ return thepilot; }
-Handle(XSControl_WorkSession) XSDRAW::Session (const Handle(IFSelect_SessionPilot) &thePilot)
-{ return Handle(XSControl_WorkSession)::DownCast((thePilot.IsNull()? thepilot : thePilot)->Session()); }
+const Handle(IFSelect_WorkSession) & XSDRAW::Session (const Handle(XSDRAW_SessionPilot) &thePilot)
+{ return (thePilot.IsNull()? thepilot : thePilot)->Session(); }
#include <IFSelect_SelectModelEntities.hxx>
#include <IFSelect_SelectModelRoots.hxx>
-#include <XSControl_SelectForTransfer.hxx>
-#include <XSControl_SignTransferStatus.hxx>
-#include <XSControl_ConnectedShapes.hxx>
#include <IFSelect_SignType.hxx>
#include <IFSelect_SignAncestor.hxx>
#include <IFSelect_SignCounter.hxx>
#include <IFSelect_SignCategory.hxx>
#include <IFSelect_SignValidity.hxx>
-#include <IFSelect_DispPerOne.hxx>
-#include <IFSelect_DispPerCount.hxx>
#include <IFSelect_IntParam.hxx>
-#include <IFSelect_DispPerFiles.hxx>
-#include <IFSelect_DispPerSignature.hxx>
#include <IFSelect_SelectPointed.hxx>
#include <IFSelect_SelectSharing.hxx>
#include <IFSelect_SelectShared.hxx>
#include <IFSelect_GraphCounter.hxx>
#include <Interface_Static.hxx>
-#include <IFSelect_ParamEditor.hxx>
-#include <IFSelect_EditForm.hxx>
+#include <XSSelect_SelectForTransfer.hxx>
+#include <XSSelect_SignTransferStatus.hxx>
+#include <XSSelect_ConnectedShapes.hxx>
void XSDRAW::SetController (const Handle(XSControl_Controller)& control)
{
if (control.IsNull()) cout<<"XSTEP Controller not defined"<<endl;
else if (Session().IsNull()) cout<<"XSTEP Session badly or not defined"<<endl;
else {
- Handle(XSControl_WorkSession) WS = Session();
+ const Handle(IFSelect_WorkSession) &WS = Session();
if (WS->NamedItem("xst-model-all").IsNull()) {
Handle(IFSelect_SelectModelRoots) slr = new IFSelect_SelectModelRoots;
WS->AddNamedItem ("xst-model-roots",slr);
- if(strcasecmp(WS->SelectedNorm(),"STEP")) {
- Handle(XSControl_SelectForTransfer) st1 = new XSControl_SelectForTransfer;
+ const Handle(XSControl_Controller) &aCtl = WS->NormAdaptor();
+ if(strcasecmp((aCtl.IsNull()? "" : aCtl->Name()),"STEP")) {
+ Handle(XSSelect_SelectForTransfer) st1 = new XSSelect_SelectForTransfer(WS->ReaderProcess());
st1->SetInput (slr);
- st1->SetReader (WS->TransferReader());
WS->AddNamedItem ("xst-transferrable-roots",st1);
}
- Handle(XSControl_SelectForTransfer) st2 = new XSControl_SelectForTransfer;
+ Handle(XSSelect_SelectForTransfer) st2 = new XSSelect_SelectForTransfer(WS->ReaderProcess());
st2->SetInput (sle);
- st2->SetReader (WS->TransferReader());
WS->AddNamedItem ("xst-transferrable-all",st2);
- Handle(XSControl_SignTransferStatus) strs = new XSControl_SignTransferStatus;
- strs->SetReader (WS->TransferReader());
+ Handle(XSSelect_SignTransferStatus) strs = new XSSelect_SignTransferStatus(WS->ReaderProcess());
WS->AddNamedItem ("xst-transfer-status",strs);
- Handle(XSControl_ConnectedShapes) scs = new XSControl_ConnectedShapes;
- scs->SetReader (WS->TransferReader());
+ Handle(XSSelect_ConnectedShapes) scs = new XSSelect_ConnectedShapes(WS->ReaderProcess());
WS->AddNamedItem ("xst-connected-faces",scs);
Handle(IFSelect_SignType) stp = new IFSelect_SignType (Standard_False);
WS->AddNamedItem ("xst-category",new IFSelect_SignCategory);
WS->AddNamedItem ("xst-validity",new IFSelect_SignValidity);
- Handle(IFSelect_DispPerOne) dispone = new IFSelect_DispPerOne;
- dispone->SetFinalSelection(slr);
- WS->AddNamedItem ("xst-disp-one",dispone);
-
- Handle(IFSelect_DispPerCount) dispcount = new IFSelect_DispPerCount;
- Handle(IFSelect_IntParam) intcount = new IFSelect_IntParam;
- intcount->SetValue(5);
- dispcount->SetCount(intcount);
- dispcount->SetFinalSelection(slr);
- WS->AddNamedItem ("xst-disp-count",dispcount);
-
- Handle(IFSelect_DispPerFiles) dispfiles = new IFSelect_DispPerFiles;
- Handle(IFSelect_IntParam) intfiles = new IFSelect_IntParam;
- intfiles->SetValue(10);
- dispfiles->SetCount(intfiles);
- dispfiles->SetFinalSelection(slr);
- WS->AddNamedItem ("xst-disp-files",dispfiles);
-
- Handle(IFSelect_DispPerSignature) dispsign = new IFSelect_DispPerSignature;
- dispsign->SetSignCounter(new IFSelect_SignCounter(Handle(IFSelect_Signature)(stc)));
- dispsign->SetFinalSelection(slr);
- WS->AddNamedItem ("xst-disp-sign",dispsign);
-
// Not used directly but useful anyway
WS->AddNamedItem ("xst-pointed",new IFSelect_SelectPointed);
WS->AddNamedItem ("xst-sharing",new IFSelect_SelectSharing);
WS->SetSignType( stp );
}
- Handle(TColStd_HSequenceOfHAsciiString) listat = Interface_Static::Items();
- Handle(IFSelect_ParamEditor) paramed = IFSelect_ParamEditor::StaticEditor (listat,"All Static Parameters");
- WS->AddNamedItem ("xst-static-params-edit",paramed);
- Handle(IFSelect_EditForm) paramform = paramed->Form(Standard_False);
- WS->AddNamedItem ("xst-static-params",paramform);
-
WS->SetController (control);
}
}
Standard_Boolean XSDRAW::SetNorm
(const Standard_CString norm)
{
- return Session()->SelectNorm (norm);
+ return Session()->SelectNorm(norm);
}
Handle(Interface_Protocol) XSDRAW::Protocol ()
- { return thepilot->Session()->Protocol(); }
+{ return thepilot->Session()->NormAdaptor()->Protocol(); }
Handle(Interface_InterfaceModel) XSDRAW::Model ()
{ return thepilot->Session()->Model(); }
DeclareAndCast(Transfer_FinderProcess,FP,ATP);
DeclareAndCast(Transfer_TransientProcess,TP,ATP);
-// Cas FinderProcess ==> TransferWriter
- if (!FP.IsNull()) Session()->SetMapWriter(FP);
+// Cas FinderProcess ==> WriterProcess
+ if (!FP.IsNull()) Session()->SetWriterProcess(FP);
-// Cas TransientProcess ==> TransferReader
+// Cas TransientProcess ==> ReaderProcess
if (!TP.IsNull()) {
if (!TP->Model().IsNull() && TP->Model() != Session()->Model())
Session()->SetModel (TP->Model());
- Session()->SetMapReader(TP);
+ Session()->SetReaderProcess(TP);
}
}
- Handle(Transfer_TransientProcess) XSDRAW::TransientProcess ()
- { return Session()->TransferReader()->TransientProcess(); }
-
- Handle(Transfer_FinderProcess) XSDRAW::FinderProcess ()
- { return Session()->TransferWriter()->FinderProcess(); }
-
-
- void XSDRAW::InitTransferReader (const Standard_Integer mode)
-{
-// 0 nullify 1 clear
-// 2 init TR avec contenu TP (roots) 3 init TP avec contenu TR
-// 4 init avec model (debut scratch)
- Session()->InitTransferReader(mode);
-}
-
- Handle(XSControl_TransferReader) XSDRAW::TransferReader ()
- { return Session()->TransferReader(); }
-
// ############ AUXILIAIRES #############
return XSDRAW_ShapeFunctions::FileAndVar(Session(),file,var,def,resfile,resvar);
}
-Standard_Integer XSDRAW::MoreShapes (Handle(TopTools_HSequenceOfShape)& list, const Standard_CString name)
-{
- return XSDRAW_ShapeFunctions::MoreShapes(Session(),list,name);
-}
-
// FONCTION POUR LE DEBUG
Standard_Integer XSDRAW_WHAT (const Handle(Standard_Transient)& ent)
//! from a SessionPilot, as follows :
//!
//! Define a function as
-//! static IFSelect_RetStatus myfunc
+//! static Interface_ReturnStatus myfunc
//! (const Standard_CString name,
-//! const Handle(IFSelect_SessionPilot)& pilot)
+//! const Handle(XSDRAW_SessionPilot)& pilot)
//! { ... }
//! When ran, it receives the exact name (string) of the called
//! function, and the SessionPilot which brings other infos
//! name and help are given as CString
//!
//! Then, it is available for run
-class XSDRAW_Act : public IFSelect_Activator
+class XSDRAW_Act : public XSDRAW_Activator
{
public:
//! Execution of Command Line. remark that <number> is senseless
//! because each Act brings one and only one function
- Standard_EXPORT virtual IFSelect_ReturnStatus Do (const Standard_Integer, const Handle(IFSelect_SessionPilot)& pilot) Standard_OVERRIDE
- { return (thefunc? thefunc(pilot) : IFSelect_RetVoid); }
+ Standard_EXPORT virtual Interface_ReturnStatus Do (const Standard_Integer, const Handle(XSDRAW_SessionPilot)& pilot) Standard_OVERRIDE
+ { return (thefunc? thefunc(pilot) : Interface_RetVoid); }
//! Short Help for commands : returns the help given to create
Standard_EXPORT virtual Standard_CString Help (const Standard_Integer) const Standard_OVERRIDE
{ return thehelp.ToCString(); }
- DEFINE_STANDARD_RTTI_INLINE(XSDRAW_Act,IFSelect_Activator)
+ DEFINE_STANDARD_RTTI_INLINE(XSDRAW_Act,XSDRAW_Activator)
private:
#include <Draw_Interpretor.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <TopTools_HSequenceOfShape.hxx>
-#include <IFSelect_SessionPilot.hxx>
+#include <XSDRAW_SessionPilot.hxx>
+class TCollection_AsciiString;
class Interface_Protocol;
class Interface_InterfaceModel;
class Transfer_TransientProcess;
class Transfer_FinderProcess;
-class XSControl_WorkSession;
class XSControl_Controller;
-class XSControl_TransferReader;
-class TCollection_AsciiString;
+class XSselect_WorkSession;
-typedef IFSelect_ReturnStatus (*XSDRAW_ActFunc) (const Handle(IFSelect_SessionPilot)&);
+typedef Interface_ReturnStatus (*XSDRAW_ActFunc) (const Handle(XSDRAW_SessionPilot)&);
//! Basic package to work functions of X-STEP (IFSelect & Co)
//! under control of DRAW
//!
//! Works with some "static" data : a SessionPilot (used to run)
-//! with its WorkSession and Model and TransferReader, a
-//! FinderProcess
+//! with its WorkSession and Model, and ReaderProcess and WriterProcess
class XSDRAW
{
public:
Standard_EXPORT static Standard_Integer Execute (const Standard_CString command, const Standard_CString var = "");
//! Returns the SessionPilot (can be used for direct call)
- Standard_EXPORT static const Handle(IFSelect_SessionPilot) & Pilot();
+ Standard_EXPORT static const Handle(XSDRAW_SessionPilot) & Pilot();
//! Returns the WorkSession defined in AddDraw (through Pilot)
//! It is from XSControl, it brings functionnalities for Transfers
- Standard_EXPORT static Handle(XSControl_WorkSession) Session(const Handle(IFSelect_SessionPilot) &thePilot = NULL);
+ Standard_EXPORT static const Handle(IFSelect_WorkSession) & Session(const Handle(XSDRAW_SessionPilot) &thePilot = NULL);
//! Defines a Controller for the command "xinit" and applies it
//! (i.e. calls its method Customise)
Standard_EXPORT static Standard_Integer Number (const Handle(Standard_Transient)& ent);
//! Sets a TransferProcess in order to analyse it (see Activator)
- //! It can be either a FinderProcess or a TransientProcess, in
- //! that case a new TransferReader is created on it
+ //! It can be either a FinderProcess or a TransientProcess
Standard_EXPORT static void SetTransferProcess (const Handle(Standard_Transient)& TP);
- //! Returns the TransferProcess : TransientProcess detained by
- //! the TransferReader
- Standard_EXPORT static Handle(Transfer_TransientProcess) TransientProcess();
-
- //! Returns the FinderProcess, detained by the TransferWriter
- Standard_EXPORT static Handle(Transfer_FinderProcess) FinderProcess();
-
- //! Initialises a TransferReader, according to mode :
- //! 0 nullifies it, 1 clears it (not nullify)
- //! 2 sets it with TransientProcess & Model
- //! 3 idem plus roots of TransientProcess
- //! Remark : called with 0 at least at each SetModel/NewModel
- Standard_EXPORT static void InitTransferReader (const Standard_Integer mode);
-
- //! Returns the current TransferReader, can be null
- //! It detains the TransientProcess
- Standard_EXPORT static Handle(XSControl_TransferReader) TransferReader();
-
//! Takes the name of an entity, either as argument, or (if <name>
//! is empty) on keybord, and returns the entity
//! name can be a label or a number (in alphanumeric), it is
//! Else, the root part of <resfile> is considered, if defined
//! Else, <def> is taken
Standard_EXPORT static Standard_Boolean FileAndVar (const Standard_CString file, const Standard_CString var, const Standard_CString def, TCollection_AsciiString& resfile, TCollection_AsciiString& resvar);
-
- //! Analyses a name as designating Shapes from DRAW variables or
- //! XSTEP transfer (last Transfer on Reading). <name> can be :
- //! "*" : all the root shapes produced by last Transfer (Read)
- //! i.e. considers roots of the TransientProcess
- //! a name : a name of a variable DRAW
- //!
- //! Returns the count of designated Shapes. Their list is put in
- //! <list>. If <list> is null, it is firstly created. Then it is
- //! completed (Append without Clear) by the Shapes found
- //! Returns 0 if no Shape could be found
- Standard_EXPORT static Standard_Integer MoreShapes (Handle(TopTools_HSequenceOfShape)& list, const Standard_CString name);
//! Changes the default group name for the following Acts
//! group empty means to come back to default from Activator
--- /dev/null
+// 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 <Dico_DictionaryOfInteger.hxx>
+#include <Dico_IteratorOfDictionaryOfInteger.hxx>
+#include <XSDRAW_Activator.hxx>
+#include <Interface_Macros.hxx>
+#include <Standard_DomainError.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_SequenceOfInteger.hxx>
+#include <TColStd_SequenceOfTransient.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(XSDRAW_Activator,MMgt_TShared)
+
+static Handle(Dico_DictionaryOfInteger) thedico; // = new Dico_DictionaryOfInteger;
+static TColStd_SequenceOfInteger thenums, themodes;
+static TColStd_SequenceOfTransient theacts;
+
+
+ void XSDRAW_Activator::Adding
+ (const Handle(XSDRAW_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 "<<command<<" first defined remains ****"<<endl;
+// Standard_DomainError::Raise("XSDRAW_Activator : Add");
+#endif
+ }
+ num = thenums.Length() + 1;
+ thenums.Append(number);
+ theacts.Append(actor);
+ themodes.Append(mode);
+}
+
+ void XSDRAW_Activator::Add
+ (const Standard_Integer number, const Standard_CString command) const
+ { Adding (this,number,command,0); }
+
+ void XSDRAW_Activator::AddSet
+ (const Standard_Integer number, const Standard_CString command) const
+ { Adding (this,number,command,1); }
+
+ void XSDRAW_Activator::Remove (const Standard_CString command)
+ { thedico->RemoveItem(command); }
+
+ Standard_Boolean XSDRAW_Activator::Select
+ (const Standard_CString command, Standard_Integer& number,
+ Handle(XSDRAW_Activator)& actor)
+{
+ Standard_Integer num;
+ if (!thedico->GetItem(command,num,Standard_False)) return Standard_False;
+ number = thenums(num);
+ actor = Handle(XSDRAW_Activator)::DownCast(theacts(num));
+ return Standard_True;
+}
+
+ Standard_Integer XSDRAW_Activator::Mode
+ (const Standard_CString command)
+{
+ Standard_Integer num;
+ if (!thedico->GetItem(command,num,Standard_False)) return -1;
+ return themodes(num);
+}
+
+
+ Handle(TColStd_HSequenceOfAsciiString) XSDRAW_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(XSDRAW_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;
+}
+
+
+ XSDRAW_Activator::XSDRAW_Activator ()
+ : thegroup ("XSTEP") { }
+
+ void XSDRAW_Activator::SetForGroup
+ (const Standard_CString group, const Standard_CString file)
+ { thegroup.Clear(); thegroup.AssignCat (group);
+ thefile.Clear(); thefile.AssignCat (file); }
+
+ Standard_CString XSDRAW_Activator::Group () const
+ { return thegroup.ToCString(); }
+
+ Standard_CString XSDRAW_Activator::File () const
+ { return thefile.ToCString(); }
--- /dev/null
+// 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 _XSDRAW_Activator_HeaderFile
+#define _XSDRAW_Activator_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <TCollection_AsciiString.hxx>
+#include <MMgt_TShared.hxx>
+#include <Standard_Integer.hxx>
+#include <Standard_CString.hxx>
+#include <Standard_Boolean.hxx>
+#include <TColStd_HSequenceOfAsciiString.hxx>
+#include <Interface_ReturnStatus.hxx>
+class Standard_DomainError;
+class TCollection_AsciiString;
+class XSDRAW_SessionPilot;
+
+
+class XSDRAW_Activator;
+DEFINE_STANDARD_HANDLE(XSDRAW_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 XSDRAW_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
+ //! <mode> allows to distinguish various execution modes
+ //! 0: default mode; 1 : for xset
+ Standard_EXPORT static void Adding (const Handle(XSDRAW_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(XSDRAW_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.
+ //! <mode> : -1 (D) for all commands if <commands> 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. <number> 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 Interface_ReturnStatus Do (const Standard_Integer number, const Handle(XSDRAW_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(XSDRAW_Activator,MMgt_TShared)
+
+protected:
+
+ //! Sets the default values
+ Standard_EXPORT XSDRAW_Activator();
+
+ private:
+
+ TCollection_AsciiString thegroup;
+ TCollection_AsciiString thefile;
+};
+
+#endif // _XSDRAW_Activator_HeaderFile
#include <IFSelect_CheckCounter.hxx>
-#include <IFSelect_SessionPilot.hxx>
+#include <XSDRAW_SessionPilot.hxx>
#include <Interface_CheckIterator.hxx>
#include <Interface_InterfaceModel.hxx>
#include <Interface_Macros.hxx>
#include <Interface_Static.hxx>
+#include <Interface_MSG.hxx>
#include <Message.hxx>
#include <Message_Messenger.hxx>
#include <TColStd_HSequenceOfHAsciiString.hxx>
#include <Transfer_ResultFromModel.hxx>
#include <Transfer_TransientProcess.hxx>
#include <XSControl_Controller.hxx>
-#include <XSControl_SelectForTransfer.hxx>
-#include <XSControl_TransferReader.hxx>
-#include <XSControl_TransferWriter.hxx>
-#include <XSControl_WorkSession.hxx>
+#include <XSSelect_SelectForTransfer.hxx>
+#include <IFSelect_WorkSession.hxx>
#include <XSDRAW.hxx>
#include <XSDRAW_ControlFunctions.hxx>
#include <XSDRAW_SelectFunctions.hxx>
//=======================================================================
//function : xinit
//=======================================================================
-static IFSelect_ReturnStatus XSControl_xinit(const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus XSControl_xinit(const Handle(XSDRAW_SessionPilot)& pilot)
{
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
// **** xinit ****
- if (argc > 1) return (XSDRAW::Session(pilot)->SelectNorm(arg1) ?
- IFSelect_RetDone : IFSelect_RetFail);
+ if (argc > 1)
+ return (pilot->Session()->SelectNorm(arg1) ? Interface_RetDone : Interface_RetFail);
+ const Handle(XSControl_Controller) &aCtl = pilot->Session()->NormAdaptor();
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- sout<<"Selected Norm:"<<XSDRAW::Session(pilot)->SelectedNorm()<<endl;
- return IFSelect_RetVoid;
+ sout<<"Selected Norm:"<<(aCtl.IsNull()? "" : aCtl->Name())<<endl;
+ return Interface_RetVoid;
}
//=======================================================================
//function : xnorm
//=======================================================================
-static IFSelect_ReturnStatus XSControl_xnorm(const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus XSControl_xnorm(const Handle(XSDRAW_SessionPilot)& pilot)
{
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
// **** xnorm ****
- Handle(XSControl_WorkSession) WS = XSDRAW::Session(pilot);
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Handle(XSControl_Controller) control = WS->NormAdaptor();
Handle(Message_Messenger) sout = Message::DefaultMessenger();
if (argc == 1)
sout<<"Current Norm. xnorm newnorm to change"<<endl;
else sout<<"Current Norm :"<<endl;
if (control.IsNull()) sout<<"no norm currently defined"<<endl;
- else
- sout<<" Long Name (complete) : "<<control->Name(Standard_False)<<endl
- << " Short name (resource) : "<<control->Name(Standard_True)<<endl;
- if (argc == 1) return IFSelect_RetVoid;
+ else sout<<" Norm Name : "<<control->Name()<<endl;
+ if (argc == 1) return Interface_RetVoid;
control = XSControl_Controller::Recorded(arg1);
if (control.IsNull()) {
sout<<" No norm named : "<<arg1<<endl;
- return IFSelect_RetError;
+ return Interface_RetError;
}
WS->SetController(control);
sout<<"new norm : "<<control->Name()<<endl;
- return IFSelect_RetDone;
+ return Interface_RetDone;
}
//=======================================================================
//function : newmodel
//=======================================================================
-static IFSelect_ReturnStatus XSControl_newmodel(const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus XSControl_newmodel(const Handle(XSDRAW_SessionPilot)& pilot)
{
// **** newmodel ****
- if (!XSDRAW::Session(pilot)->NewModel().IsNull()) return IFSelect_RetDone;
+ if (!pilot->Session()->NewModel().IsNull()) return Interface_RetDone;
Handle(Message_Messenger) sout = Message::DefaultMessenger();
sout<<"No new Model produced"<<endl;
- return IFSelect_RetFail;
+ return Interface_RetFail;
}
//=======================================================================
//function : tpclear
//=======================================================================
-static IFSelect_ReturnStatus XSControl_tpclear(const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus XSControl_tpclear(const Handle(XSDRAW_SessionPilot)& pilot)
{
// **** tpclear/twclear ****
const Standard_Boolean modew = (pilot->Word(0).Value(2) == 'w');
- const Handle(Transfer_FinderProcess) &FP = XSDRAW::Session(pilot)->TransferWriter()->FinderProcess();
- const Handle(Transfer_TransientProcess) &TP = XSDRAW::Session(pilot)->TransferReader()->TransientProcess();
+ const Handle(Transfer_FinderProcess) &FP = pilot->Session()->WriterProcess();
+ const Handle(Transfer_TransientProcess) &TP = pilot->Session()->ReaderProcess();
Handle(Message_Messenger) sout = Message::DefaultMessenger();
if (modew) { if(!FP.IsNull()) FP->Clear(); else sout<<"No Transfer Write"<<endl; }
else { if(!TP.IsNull()) TP->Clear(); else sout<<"No Transfer Read"<<endl; }
- return IFSelect_RetDone;
+ return Interface_RetDone;
}
//=======================================================================
//function : tpstat
//=======================================================================
-static IFSelect_ReturnStatus XSControl_tpstat(const Handle(IFSelect_SessionPilot)& pilot)
+static Standard_Integer BinderStatus (const Handle(Transfer_Binder)& binder, char* mess)
+{
+ Standard_Integer stat = 0;
+ mess[0] = '\0';
+ if (binder.IsNull()) { sprintf (mess,"(no data recorded)"); return 0; }
+ Interface_CheckStatus cst = binder->Check()->Status();
+ if (cst == Interface_CheckOK) {
+ stat = 11;
+ if (binder->HasResult()) sprintf(mess,"%s",binder->ResultTypeName());
+ else { sprintf(mess,"(no result)"); stat = 1; }
+ } else if (cst == Interface_CheckWarning) {
+ stat = 12;
+ if (binder->HasResult()) sprintf(mess,"%s (+ warning)",binder->ResultTypeName());
+ else { sprintf(mess,"(warning)"); stat = 2; }
+ } else if (cst == Interface_CheckFail) {
+ stat = 13;
+ if (binder->HasResult()) sprintf(mess,"%s (+ FAIL)",binder->ResultTypeName());
+ else { sprintf(mess,"(FAIL)"); stat = 3; }
+ }
+ return stat;
+}
+
+static void PrintPercent(const Handle(Message_Messenger)& sout, const Standard_CString mess,
+ const Standard_Integer nb, const Standard_Integer nl)
+{
+ if (nb <= 0 || nl == 0) return;
+ sout<<"****** "<<mess<<": ";
+ if (nb == nl) sout<<"100 %"<<endl;
+ else if (nb*100/nl == 0) sout<<"< 1 %"<<endl;
+ else sout<<(nb*100/nl < 10 ? " " : " ")<<nb*100/nl<<" %"<<endl;
+}
+
+static void PrintStatsOnList(const Handle(Transfer_TransientProcess)& TP,
+ const Handle(TColStd_HSequenceOfTransient)& list,
+ const Standard_Integer what,
+ const Standard_Integer mode)
+{
+ Handle(Message_Messenger) sout = TP->Messenger();
+ char mess[250];
+ if (TP.IsNull()) return;
+ if (what == 0) { TP->PrintStats(sout); return; }
+
+ sout<<"\n*******************************************************************\n";
+ sout << "****** Statistics on Transfer Process (Read) ******"<<endl;
+ if (what == 1) sout << "****** Individual Transfers (Roots) ******\n";
+ if (what == 2) sout << "****** All recorded data about Transfer ******\n";
+ if (what == 3) sout << "****** Abnormal records ******\n";
+ if (what == 1 || what == 2 || what == 3) {
+ if (mode == 0) sout<<"****** (n0s of recorded entities) ******\n";
+ if (mode == 1) sout<<"****** (per entity : type + result) ******\n";
+ if (mode == 2) sout<<"****** (per entity : type + result/status) ******\n";
+ if (mode == 3) sout<<"****** (count per type of entity) ******\n";
+ if (mode == 4) sout<<"****** (count per type of result) ******\n";
+ if (mode == 5) sout<<"****** (count per couple entity-type / result-type/status) ******\n";
+ if (mode == 6) sout<<"****** (list per couple entity-type / result-type/status) ******\n";
+ }
+ if (what == 4) sout << "****** Check messages ******\n";
+ if (what == 5) sout << "****** Fail messages ******\n";
+ sout<<"*******************************************************************\n";
+
+ // Cas what = 1,2,3 : contenu du TP (binders)
+
+ const Standard_Boolean nolist = list.IsNull();
+ Handle(Interface_InterfaceModel) model = TP->Model();
+ if (what >= 1 && what <= 3) {
+
+ Standard_Integer stat;
+ Standard_Integer nbv = 0, nbw = 0, nbf = 0, nbr = 0, nbrw = 0, nbrf = 0, nbnr = 0, nbi = 0;
+ Transfer_TransientProcess::Iterator itrp(Standard_True);
+ if (what == 1) itrp = TP->RootResult(Standard_True);
+ if (what == 2) itrp = TP->CompleteResult(Standard_True);
+ if (what == 3) itrp = TP->AbnormalResult();
+ Standard_Integer i = 0, nb = itrp.Number();
+ if (!nolist) itrp.Filter (list);
+ Standard_Integer nl = itrp.Number(); // apres filtrage
+ Handle(IFSelect_SignatureList) counter;
+ if (mode > 2) counter = new IFSelect_SignatureList (mode == 6);
+ Standard_Boolean notrec = (!nolist && mode > 2); // noter les "no record"
+ IFSelect_PrintCount pcm = IFSelect_CountByItem;
+ if (mode == 6) pcm = IFSelect_ListByItem;
+
+ sout <<"**** Entities in Model : "<<model->NbEntities()<<endl;
+ sout <<"**** Nb Items (Transfer) : "<<nb<<endl;
+ if (!nolist)
+ sout<<"**** Nb Items (Listed) : "<<nl<<endl;
+
+ for (itrp.Start(); itrp.More(); itrp.Next()) {
+ nbi ++;
+ Handle(Transfer_Binder) binder = itrp.Value();
+ const Handle(Standard_Transient) &ent = itrp.SourceObject();
+ if (binder.IsNull()) {
+ nbnr ++;
+ if (notrec) counter->Add(ent,"(not recorded)");
+ else if (mode == 1 || mode == 2) {
+ sout<<"["<<Interface_MSG::Blanks (nbi,4)<<nbi<<" ]:";
+ model->Print (ent,sout);
+ sout<<" "<<model->TypeName(ent,Standard_False)<<" (not recorded)"<<endl;
+ continue;
+ }
+ }
+ if (mode == 0) { sout<<" "<<model->Number(ent); continue; }
+ if (mode != 3) {
+ stat = BinderStatus(binder,mess);
+ // 0 Binder Null. 1 void 2 Warning seul 3 Fail seul
+ // 11 Resultat OK. 12 Resultat+Warning. 13 Resultat+Fail
+ if (stat == 0 || stat == 1) nbv ++;
+ if (stat == 2) nbw ++;
+ if (stat == 3) nbf ++;
+ if (stat == 11) nbr ++;
+ if (stat == 12) nbrw ++;
+ if (stat == 13) nbrf ++;
+ }
+
+ // mode : 0 list num; 1 : num+label + type + result (abrege); 2 : complet
+ if (mode == 1 || mode == 2) {
+ sout<<"["<<Interface_MSG::Blanks (i,4)<<i<<" ]:";
+ model->Print (ent,sout);
+ sout<<" "<<model->TypeName(ent,Standard_False);
+ sout<<" Result:"<<mess<<endl;
+ if (mode == 1) continue;
+
+ const Handle(Interface_Check)& ch = binder->Check();
+ Standard_Integer newi,newnbw = ch->NbWarnings(), newnbf = ch->NbFails();
+
+ if (newnbw > 0) {
+ sout<<" - Warnings : "<<newnbw<<":\n";
+ for (newi = 1; newi <= newnbw; newi ++) sout<<ch->CWarning(newi)<<endl;
+ }
+ if (newnbf > 0) {
+ sout<<" - Fails : "<<newnbf<<":\n";
+ for (newi = 1; newi <= newnbf; newi ++) sout<<ch->CFail(newi)<<endl;
+ }
+ continue;
+ }
+
+ // mode : 3, counts per type of starting entity (class type)
+ // 4 : counts per result type and/or status
+ // 5 : counts per couple (starting type / result type/status)
+ // 6 : idem plus gives for each item, the list of numbers of
+ // entities in the starting model
+ if (mode >= 3 && mode <= 6) {
+ //IFSelect_PrintCount newpcm = IFSelect_CountByItem;
+ //if (mode == 6) newpcm = IFSelect_ListByItem;
+ if (mode == 3) counter->Add (ent,model->TypeName(ent,Standard_False));
+ if (mode == 4) counter->Add (ent,mess);
+ if (mode >= 5) {
+ TCollection_AsciiString mest (model->TypeName(ent,Standard_False));
+ mest.AssignCat(" -> ");
+ mest.AssignCat(mess);
+ //sprintf(mest,"%s -> %s",model->TypeName(ent,Standard_False),mess);
+ counter->Add (ent,mest.ToCString());
+ }
+ }
+
+ // Fin de l iteration
+ }
+ if (!counter.IsNull()) counter->PrintList(sout,model,pcm);
+ else sout<<endl;
+ // Pourcentages
+ if (mode != 3 && nbi > 0) {
+ sout << "****** Percentages according Transfer Status ******"<<endl;
+ PrintPercent (sout,"Result ",nbr+nbrw,nl);
+ PrintPercent (sout,"Result + FAIL ",nbrf,nl);
+ PrintPercent (sout,"FAIL, no Result ",nbf,nl);
+ PrintPercent (sout,"Just Warning ",nbw,nl);
+ PrintPercent (sout,"Nothing Recorded",nbnr,nl);
+ }
+ return;
+ }
+
+ // Cas what = 4,5 : check-list
+
+ if (what == 4 || what == 5) {
+
+ Interface_CheckIterator chl = TP->CheckList(Standard_False);
+ chl.SetName("** TRANSFER READ CHECK **");
+ if (mode == 0) chl.Print (sout,model,(what == 5));
+ else {
+ IFSelect_PrintCount pcm = IFSelect_CountByItem;
+ if (mode == 2) pcm = IFSelect_ListByItem;
+ Handle(IFSelect_CheckCounter) counter = new IFSelect_CheckCounter(Standard_True);
+ counter->Analyse (chl,model,Standard_True,(what == 5));
+ counter->PrintList (sout,model,pcm);
+ }
+ }
+
+}
+
+static Interface_ReturnStatus XSControl_tpstat(const Handle(XSDRAW_SessionPilot)& pilot)
{
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
//const Standard_CString arg2 = pilot->Arg(2);
- const Handle(Transfer_TransientProcess) &TP = XSDRAW::Session(pilot)->TransferReader()->TransientProcess();
+ const Handle(Transfer_TransientProcess) &TP = pilot->Session()->ReaderProcess();
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (TP.IsNull()) { sout<<"No Transfer Read"<<endl; return IFSelect_RetError;}
+ if (TP.IsNull()) { sout<<"No Transfer Read"<<endl; return Interface_RetError;}
// **** tpstat ****
Standard_Integer mod1 = -1;
<<" *n *s *b *t *r *l *L : idem on ALL recorded items\n"
<<" ?n ?s ?b ?t ... : idem on abnormal items\n"
<<" n select : n applied on a selection idem for s b t r l"<<endl;
- if (mod1 < -1) return IFSelect_RetError;
- return IFSelect_RetVoid;
+ if (mod1 < -1) return Interface_RetError;
+ return Interface_RetVoid;
}
if (!TP.IsNull()) {
if (TP->Model() != pilot->Session()->Model()) sout<<"Model differs from the session";
Handle(TColStd_HSequenceOfTransient) list =
XSDRAW_SelectFunctions::GiveList(pilot->Session(),pilot->CommandPart(2));
- XSControl_TransferReader::PrintStatsOnList (TP,list,mod1,mod2);
+ PrintStatsOnList (TP,list,mod1,mod2);
}
else sout<<"TransferRead : not defined"<<endl;
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
//=======================================================================
//function : tpent
//=======================================================================
-static IFSelect_ReturnStatus XSControl_tpent(const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus XSControl_tpent(const Handle(XSDRAW_SessionPilot)& pilot)
{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Handle(Transfer_TransientProcess) &TP = XSDRAW::Session(pilot)->TransferReader()->TransientProcess();
+ const Standard_Integer argc = pilot->NbWords();
// **** tpent ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (TP.IsNull()) { sout<<"No Transfer Read"<<endl; return IFSelect_RetError;}
- Handle(Interface_InterfaceModel) model = TP->Model();
- if (model.IsNull()) return IFSelect_RetFail;
+ const Handle(Message_Messenger) &sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Give ENTITY NUMBER (IN MODEL TransferProcess)"<<endl; return Interface_RetError; }
- if (argc < 2) { sout<<"Give ENTITY NUMBER (IN MODEL TransferProcess)"<<endl; return IFSelect_RetError; }
+ const Standard_CString arg1 = pilot->Arg(1);
Standard_Integer num = atoi(arg1);
- if (num <= 0 || num > model->NbEntities()) { sout<<"Number not in [1 - "<<model->NbEntities()<<"]"<<endl; return IFSelect_RetError; }
+
+ const Handle(Transfer_TransientProcess) &TP = pilot->Session()->ReaderProcess();
+ if (TP.IsNull()) { sout<<"No Transfer Process"<<endl; return Interface_RetError; }
+
+ const Handle(Interface_InterfaceModel) &model = TP->Model();
+ if (model.IsNull()) return Interface_RetFail;
+
+ if (num <= 0 || num > model->NbEntities()) { sout<<"Number not in [1 - "<<model->NbEntities()<<"]"<<endl; return Interface_RetError; }
Handle(Standard_Transient) ent = model->Value(num);
- Standard_Integer index = TP->MapIndex (ent);
- if (index == 0) sout<<"Entity "<<num<<" not recorded in transfer"<<endl;
- else XSDRAW::Session(pilot)->PrintTransferStatus (index,Standard_False,sout);
- return IFSelect_RetVoid;
+ const Standard_Integer index = TP->MapIndex (ent);
+ if (index == 0) { sout<<"Entity "<<num<<" not recorded in transfer"<<endl; return Interface_RetError; }
+
+ if (!TP->PrintTransferStatus(index,sout))
+ sout<<" - Index="<<index<<" incorrect"<<endl;
+ return Interface_RetVoid;
}
//=======================================================================
//function : tpitem
//=======================================================================
-static IFSelect_ReturnStatus XSControl_tpitem(const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus XSControl_tpitem(const Handle(XSDRAW_SessionPilot)& pilot)
{
- Standard_Integer argc = pilot->NbWords();
+ const Standard_Integer argc = pilot->NbWords();
+ // **** tpitem/tproot/twitem/twroot ****
+ const Handle(Message_Messenger) &sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Give ITEM NUMBER (in TransferProcess)"<<endl; return Interface_RetError; }
+
const Standard_CString arg1 = pilot->Arg(1);
-// **** tpitem/tproot/twitem/twroot ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give ITEM NUMBER (in TransferProcess)"<<endl; return IFSelect_RetError; }
Standard_Integer num = atoi(arg1);
+
if (pilot->Word(0).Value(3) == 'r') num = -num;
- Standard_Boolean modew = Standard_False;
- if (pilot->Word(0).Value(2) == 'w') modew = Standard_True;
- Handle(Transfer_Binder) binder;
- Handle(Standard_Transient) ent;
- if (!XSDRAW::Session(pilot)->PrintTransferStatus(num,modew,sout))
+
+ Handle(Transfer_Process) TP;
+ if (pilot->Word(0).Value(2) == 'w') {
+ TP = pilot->Session()->WriterProcess();
+ }
+ else {
+ TP = pilot->Session()->ReaderProcess();
+ }
+ if (TP.IsNull()) { sout<<"No Transfer Process"<<endl; return Interface_RetError; }
+
+ if (!TP->PrintTransferStatus(num,sout))
sout<<" - Num="<<num<<" incorrect"<<endl;
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
//=======================================================================
//function : trecord
//=======================================================================
-static IFSelect_ReturnStatus XSControl_trecord(const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus XSControl_trecord(const Handle(XSDRAW_SessionPilot)& pilot)
{
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
- const Handle(Transfer_TransientProcess) &TP = XSDRAW::Session(pilot)->TransferReader()->TransientProcess();
-// **** trecord : TransferReader ****
+ const Handle(Transfer_TransientProcess) &TP = pilot->Session()->ReaderProcess();
+// **** trecord : ReaderProcess ****
Standard_Boolean tous = (argc == 1);
Standard_Integer num = -1;
- const Handle(Interface_InterfaceModel) &mdl = XSDRAW::Session(pilot)->Model();
- const Handle(XSControl_TransferReader) &TR = XSDRAW::Session(pilot)->TransferReader();
- Handle(Standard_Transient) ent;
+ const Handle(Interface_InterfaceModel) &mdl = pilot->Session()->Model();
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (mdl.IsNull() || TR.IsNull() || TP.IsNull())
- { sout<<" init not done"<<endl; return IFSelect_RetError; }
+ if (mdl.IsNull() || TP.IsNull())
+ { sout<<" init not done"<<endl; return Interface_RetError; }
if (!tous) num = atoi(arg1);
// Enregistrer les racines
if (tous) {
Standard_Integer nb = TP->NbRoots();
sout<<" Recording "<<nb<<" Roots"<<endl;
for (Standard_Integer i = 1; i <= nb; i ++) {
- ent = TP->Root(i);
- if (TR->RecordResult (ent)) sout<<" Root n0."<<i<<endl;
+ if (TP->RecordResult (TP->Root(i))) sout<<" Root n0."<<i<<endl;
else sout<<" Root n0."<<i<<" not recorded"<<endl;
}
} else {
if (num < 1 || num > mdl->NbEntities()) sout<<"incorrect number:"<<num<<endl;
- else if (TR->RecordResult(mdl->Value(num))) sout<<" Entity n0."<<num<<endl;
+ else if (TP->RecordResult(mdl->Value(num))) sout<<" Entity n0."<<num<<endl;
else sout<<" Entity n0."<<num<<" not recorded"<<endl;
}
- return IFSelect_RetDone;
+ return Interface_RetDone;
}
//=======================================================================
//function : trstat
//=======================================================================
-static IFSelect_ReturnStatus XSControl_trstat(const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus XSControl_trstat(const Handle(XSDRAW_SessionPilot)& pilot)
{
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
-// **** trstat : TransferReader ****
- const Handle(XSControl_TransferReader) &TR = XSDRAW::Session(pilot)->TransferReader();
- if (TR.IsNull()) { sout<<" init not done"<<endl; return IFSelect_RetError; }
- Handle(Interface_InterfaceModel) mdl = TR->Model();
- if (mdl.IsNull()) { sout<<" No model"<<endl; return IFSelect_RetError; }
- sout<<" Statistics : FileName : "<<TR->FileName()<<endl;
+ const Handle(Message_Messenger) &sout = Message::DefaultMessenger();
+// **** trstat : ReaderProcess ****
+ const Handle(Transfer_TransientProcess) &TP = WS->ReaderProcess();
+ if (TP.IsNull()) { sout<<" init not done"<<endl; return Interface_RetError; }
+ const Handle(Interface_InterfaceModel) &mdl = TP->Model();
+ if (mdl.IsNull()) { sout<<" No model"<<endl; return Interface_RetError; }
+ sout<<" Statistics : FileName : "<<endl;
if (argc == 1) {
// stats generales
- TR->PrintStats(10,0);
+ // A ameliorer ... !
+ sout<<"\n*******************************************************************\n";
+ sout << "****** Statistics on Transfer (Read) ******"<<endl;
+ sout<<"\n*******************************************************************\n";
+ // reste what = 10 : on liste les racines des final results
+ sout << "****** Final Results ******"<<endl;
+ Handle(TColStd_HSequenceOfTransient) list = TP->RecordedList();
+ Standard_Integer i, nb = list->Length();
+ sout<<"**** Nb Recorded : "<<nb<<" : entities n0s : ";
+ for (i = 1; i <= nb; i ++) {
+ Handle(Standard_Transient) ent = list->Value(i);
+ sout<<" "<<mdl->Number(ent);
+ }
+ sout<<endl;
+
} else {
// stats unitaires
Standard_Integer num = atoi(arg1);
- if (num < 1 || num > mdl->NbEntities()) { sout<<" incorrect number:"<<arg1<<endl; return IFSelect_RetError; }
- Handle(Standard_Transient) ent = mdl->Value(num);
- if (!TR->IsRecorded(ent)) { sout<<" Entity "<<num<<" not recorded"<<endl; return IFSelect_RetError; }
- Handle(Transfer_ResultFromModel) RM = TR->FinalResult(ent);
- Handle(TColStd_HSequenceOfTransient) list = TR->CheckedList(ent);
+ if (num < 1 || num > mdl->NbEntities()) { sout<<" incorrect number:"<<arg1<<endl; return Interface_RetError; }
+ const Handle(Standard_Transient) &ent = mdl->Value(num);
+ if (ent.IsNull()) { sout<<" Entity "<<num<<" is null"<<endl; return Interface_RetError; }
+ if (!TP->IsRecorded(ent)) { sout<<" Entity "<<num<<" not recorded"<<endl; return Interface_RetError; }
+ Handle(Transfer_ResultFromModel) RM = TP->FinalResult(ent);
+ Handle(TColStd_HSequenceOfTransient) list = TP->CheckedList(ent);
Standard_Integer i, nb = list->Length();
if (nb > 0) sout<<" Entities implied by Check/Result :"<<nb<<" i.e.:";
for (i = 1; i <= nb; i ++) { sout<<" "; mdl->Print(list->Value(i),sout); }
sout<<endl;
- if (RM.IsNull()) { sout<<" no other info"<<endl; return IFSelect_RetVoid; }
+ if (RM.IsNull()) { sout<<" no other info"<<endl; return Interface_RetVoid; }
Interface_CheckIterator chl = RM->CheckList(Standard_False);
- pilot->Session()->PrintCheckList(chl,Standard_False,IFSelect_EntitiesByItem);
+ WS->PrintCheckList(chl,Standard_False,IFSelect_EntitiesByItem);
}
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
//=======================================================================
//function : trbegin
//=======================================================================
-static IFSelect_ReturnStatus XSControl_trbegin(const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus XSControl_trbegin(const Handle(XSDRAW_SessionPilot)& pilot)
{
- // **** trbegin : TransferReader ****
- Handle(XSControl_TransferReader) TR = XSDRAW::Session(pilot)->TransferReader();
- Standard_Boolean init = TR.IsNull();
+ // **** trbegin : ReaderProcess ****
+ Handle(Transfer_TransientProcess) TP = pilot->Session()->ReaderProcess();
+ Standard_Boolean init = TP.IsNull();
if (pilot->NbWords() > 1) { if (pilot->Arg(1)[0] == 'i') init = Standard_True; }
if (init) {
- XSDRAW::Session(pilot)->InitTransferReader (0);
- TR = XSDRAW::Session(pilot)->TransferReader();
- if (TR.IsNull()) {
+ pilot->Session()->InitTransferReader (0);
+ TP = pilot->Session()->ReaderProcess();
+ if (TP.IsNull()) {
Handle(Message_Messenger) sout = Message::DefaultMessenger();
sout<<" init not done or failed"<<endl;
- return IFSelect_RetError;
+ return Interface_RetError;
}
}
- TR->BeginTransfer();
- return IFSelect_RetDone;
+ pilot->Session()->InitTransferReader (4);
+ return Interface_RetDone;
}
//=======================================================================
//function : tread
//=======================================================================
-static IFSelect_ReturnStatus XSControl_tread(const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus XSControl_tread(const Handle(XSDRAW_SessionPilot)& pilot)
{
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
- //const Standard_CString arg1 = pilot->Arg(1);
- // **** tread : TransferReader ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- const Handle(XSControl_TransferReader) &TR = XSDRAW::Session(pilot)->TransferReader();
- if (TR.IsNull()) { sout<<" init not done"<<endl; return IFSelect_RetError; }
- const Handle(Interface_InterfaceModel) &mdl = TR->Model();
- if (mdl.IsNull()) { sout<<" No model"<<endl; return IFSelect_RetError; }
+ // **** tread : ReaderProcess ****
+ const Handle(Message_Messenger) &sout = Message::DefaultMessenger();
+ Handle(TColStd_HSequenceOfTransient) list;
if (argc < 2) {
-// DeclareAndCast(IFSelect_Selection,sel,pilot->Session()->NamedItem("xst-model-roots"));
- Handle(Standard_Transient) sel = pilot->Session()->NamedItem("xst-model-roots");
- if (sel.IsNull()) { sout<<"Select Roots absent"<<endl; return IFSelect_RetError; }
- Handle(TColStd_HSequenceOfTransient) list = pilot->Session()->GiveList(sel);
- sout<<" Transferring all roots i.e. : "<<TR->TransferList(list)<<endl;
+ Handle(Standard_Transient) sel = WS->NamedItem("xst-model-roots");
+ if (sel.IsNull()) { sout<<"Select Roots absent"<<endl; return Interface_RetError; }
+ list = WS->GiveList(sel);
+ sout<<" Transfer of all ("<<list->Length()<<") roots"<<endl;
} else {
- Handle(TColStd_HSequenceOfTransient) list =
- XSDRAW_SelectFunctions::GiveList(pilot->Session(),pilot->CommandPart(1));
+ Handle(TColStd_HSequenceOfTransient) list = XSDRAW_SelectFunctions::GiveList(WS,pilot->CommandPart(1));
sout<<" Transfer of "<<list->Length()<<" entities"<<endl;
- Standard_Integer nb = TR->TransferList(list);
- sout<<" Gives "<<nb<<" results"<<endl;
}
- return IFSelect_RetDone;
+ const Standard_Integer nb = WS->TransferList(list);
+ sout<<" Gives "<<nb<<" results"<<endl;
+ return Interface_RetDone;
}
//=======================================================================
//function : trtp
//=======================================================================
-static IFSelect_ReturnStatus XSControl_trtp(const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus XSControl_trtp(const Handle(XSDRAW_SessionPilot)& pilot)
{
// **** TReader -> TProcess ****
- const Handle(XSControl_TransferReader) &TR = XSDRAW::Session(pilot)->TransferReader();
+ const Handle(Transfer_TransientProcess) &TP = pilot->Session()->ReaderProcess();
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (TR.IsNull()) sout<<" No TransferReader"<<endl;
- else if (TR->TransientProcess().IsNull()) sout<<" Transfer Reader without Process"<<endl;
- return IFSelect_RetVoid;
+ if (TP.IsNull()) sout<<" No TransferProcess"<<endl;
+ return Interface_RetVoid;
}
//=======================================================================
//function : tptr
//=======================================================================
-static IFSelect_ReturnStatus XSControl_tptr(const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus XSControl_tptr(const Handle(XSDRAW_SessionPilot)& pilot)
{
// **** TProcess -> TReader ****
- XSDRAW::Session(pilot)->InitTransferReader (3);
- return IFSelect_RetDone;
-}
+ pilot->Session()->InitTransferReader (0);
-
-//=======================================================================
-//function : twmode
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_twmode(const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- // **** twmode ****
- Handle(XSControl_TransferWriter) TW = XSDRAW::Session(pilot)->TransferWriter();
- Handle(XSControl_Controller) control = XSDRAW::Session(pilot)->NormAdaptor();
- Standard_Integer modemin,modemax;
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (control->ModeWriteBounds (modemin,modemax)) {
- sout<<"Write Mode : allowed values "<<modemin<<" to "<<modemax<<endl;
- for (Standard_Integer modd = modemin; modd <= modemax; modd ++) {
- sout<<modd<<" : "<<control->ModeWriteHelp (modd)<<endl;;
- }
+ const Handle(Transfer_TransientProcess) &TP = pilot->Session()->ReaderProcess();
+ if (!TP.IsNull()) {
+ Standard_Integer i, nb = TP->NbRoots();
+ for (i = 1; i <= nb; i ++) TP->RecordResult(TP->Root(i));
}
- sout<<"Write Mode : actual = "<<TW->TransferMode()<<endl;
- if (argc <= 1) return IFSelect_RetVoid;
- Standard_Integer mod = atoi(arg1);
- sout<<"New value -> "<<arg1<<endl;
- TW->SetTransferMode(mod);
- if (!control->IsModeWrite (mod)) sout<<"Warning : this new value is not supported"<<endl;
- return IFSelect_RetDone;
+
+ return Interface_RetDone;
}
//=======================================================================
//function : twstat
//=======================================================================
-static IFSelect_ReturnStatus XSControl_twstat(const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus XSControl_twstat(const Handle(XSDRAW_SessionPilot)& pilot)
{
- const Handle(Transfer_FinderProcess) &FP = XSDRAW::Session(pilot)->TransferWriter()->FinderProcess();
+ const Handle(Transfer_FinderProcess) &FP = pilot->Session()->WriterProcess();
// **** twstat ****
// Pour Write
Handle(Message_Messenger) sout = Message::DefaultMessenger();
FP->PrintStats (sout);
}
else sout<<"TransferWrite: not defined"<<endl;
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
//=======================================================================
//function : settransfert
//=======================================================================
-static IFSelect_ReturnStatus XSControl_settransfert(const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus XSControl_settransfert(const Handle(XSDRAW_SessionPilot)& pilot)
{
// **** SelectForTransfer ****
- return pilot->RecordItem(new XSControl_SelectForTransfer(XSDRAW::Session(pilot)->TransferReader()));
+ return pilot->RecordItem(new XSSelect_SelectForTransfer(pilot->Session()->ReaderProcess()));
}
XSDRAW::AddFunc ("tpent","[num:integer] Statistics on an entity of the model (READ)",XSControl_tpent);
- XSDRAW::AddFunc ("tpitem","[num:integer] Statistics on ITEM of transfer (READ)" ,XSControl_tpitem);
- XSDRAW::AddFunc ("tproot","[num:integer] Statistics on a ROOT of transfert (READ)" ,XSControl_tpitem);
- XSDRAW::AddFunc ("twitem","[num:integer] Statistics on an ITEM of transfer (WRITE)" ,XSControl_tpitem);
+ XSDRAW::AddFunc ("tpitem","[num:integer] Statistics on an ITEM of transfer (READ)",XSControl_tpitem);
+ XSDRAW::AddFunc ("tproot","[num:integer] Statistics on a ROOT of transfer (READ)",XSControl_tpitem);
+ XSDRAW::AddFunc ("twitem","[num:integer] Statistics on an ITEM of transfer (WRITE)",XSControl_tpitem);
XSDRAW::AddFunc ("twroot","[num:integer] Statistics on a ROOT of transfer (WRITE)",XSControl_tpitem);
XSDRAW::AddFunc ("trecord","record : all root results; or num : for entity n0.num",XSControl_trecord);
XSDRAW::AddFunc ("trtp","feeds commands tp... with results from tr...",XSControl_trtp);
XSDRAW::AddFunc ("tptr","feeds tr... from tp... (may be incomplete)",XSControl_tptr);
- XSDRAW::AddFunc ("twmode","displays mode transfer write, + num changes it",XSControl_twmode);
XSDRAW::AddFunc ("twstat","Statistics on TransferProcess (WRITE)",XSControl_twstat);
XSDRAW::AddFSet ("selecttransfer","selection (recognize from transfer actor)",XSControl_settransfert);
//#58 rln 28.12.98 Versioning
#include <IFSelect_CheckCounter.hxx>
-#include <IFSelect_Dispatch.hxx>
-#include <IFSelect_DispGlobal.hxx>
-#include <IFSelect_DispPerCount.hxx>
-#include <IFSelect_DispPerFiles.hxx>
-#include <IFSelect_DispPerOne.hxx>
-#include <IFSelect_DispPerSignature.hxx>
-#include <IFSelect_EditForm.hxx>
-#include <IFSelect_Editor.hxx>
-#include <IFSelect_GeneralModifier.hxx>
#include <IFSelect_GraphCounter.hxx>
#include <IFSelect_IntParam.hxx>
-#include <IFSelect_ListEditor.hxx>
-#include <IFSelect_Modifier.hxx>
-#include <IFSelect_ModifReorder.hxx>
#include <IFSelect_SelectDeduct.hxx>
#include <IFSelect_SelectDiff.hxx>
#include <IFSelect_SelectEntityNumber.hxx>
#include <IFSelect_SelectSuite.hxx>
#include <IFSelect_SelectUnion.hxx>
#include <IFSelect_SelectUnknownEntities.hxx>
-#include <IFSelect_SessionFile.hxx>
-#include <IFSelect_SessionPilot.hxx>
-#include <IFSelect_ShareOut.hxx>
#include <IFSelect_Signature.hxx>
#include <IFSelect_SignatureList.hxx>
#include <IFSelect_SignCounter.hxx>
#include <IFSelect_SignType.hxx>
-#include <IFSelect_Transformer.hxx>
-#include <IFSelect_WorkLibrary.hxx>
-#include <IFSelect_WorkSession.hxx>
#include <Interface_Category.hxx>
#include <Interface_CheckIterator.hxx>
#include <Interface_EntityIterator.hxx>
#include <TColStd_HSequenceOfHAsciiString.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <TColStd_MapOfInteger.hxx>
+#include <XSControl_Controller.hxx>
#include <XSDRAW.hxx>
#include <XSDRAW_SelectFunctions.hxx>
+#include <XSDRAW_SessionPilot.hxx>
+#include <IFSelect_WorkSession.hxx>
#include <stdio.h>
-// Decomposition of a file name in its parts : prefix, root, suffix
-static void SplitFileName
- (const Standard_CString filename,
- TCollection_AsciiString& prefix,
- TCollection_AsciiString& fileroot,
- TCollection_AsciiString& suffix)
-{
- Standard_Integer nomdeb, nomfin, nomlon;
- TCollection_AsciiString resfile (filename);
- nomlon = resfile.Length();
- nomdeb = resfile.SearchFromEnd ("/");
- if (nomdeb <= 0) nomdeb = resfile.SearchFromEnd("\\"); // pour NT
- if (nomdeb < 0) nomdeb = 0;
- nomfin = resfile.SearchFromEnd (".");
- if (nomfin < nomdeb) nomfin = nomlon + 1;
-
- if (nomdeb > 0) prefix = resfile.SubString (1,nomdeb);
- fileroot = resfile.SubString(nomdeb+1,nomfin-1);
- if (nomfin <= nomlon) suffix = resfile.SubString (nomfin,nomlon);
-}
-
-
// Functions definit un certain nombre de commandes
// enregistrees dans le Dictionnaire de Activator (par des Act unitaires)
// Les definitions
-static IFSelect_ReturnStatus funstatus
- (const Handle(IFSelect_SessionPilot)& )
+static Interface_ReturnStatus funstatus
+ (const Handle(XSDRAW_SessionPilot)& )
{
// **** Version & cie ****
//#58 rln
sout<<"OL Version : "<<XSTEP_SYSTEM_VERSION<<endl;
sout<<"Configuration : "<<XSTEP_Config<<endl;
sout<<"UL Names : "<<XSTEP_ULNames<<endl;
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
-static IFSelect_ReturnStatus fun1
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun3
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** ToggleHandler ****
- Standard_Boolean hand = !WS->ErrorHandle();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (hand) sout << " -- Mode Catch Error now Active" <<endl;
- else sout << " -- Mode Catch Error now Inactive" <<endl;
- WS->SetErrorHandle(hand);
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun3
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
// **** XRead / Load ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Read/Load : give file name !"<<endl; return IFSelect_RetError; }
- if (WS->Protocol().IsNull()) { sout<<"Protocol not defined"<<endl; return IFSelect_RetError; }
- if (WS->WorkLibrary().IsNull()) { sout<<"WorkLibrary not defined"<<endl; return IFSelect_RetError; }
+ if (argc < 2) { sout<<"Read/Load : give file name !"<<endl; return Interface_RetError; }
+ if (WS->NormAdaptor()->Protocol().IsNull()) { sout<<"Protocol not defined"<<endl; return Interface_RetError; }
+ if (WS->NormAdaptor().IsNull()) { sout<<"Controller not defined"<<endl; return Interface_RetError; }
- IFSelect_ReturnStatus status = WS->ReadFile (arg1);
+ Interface_ReturnStatus status = WS->ReadFile (arg1);
// status : 0 OK, 1 erreur lecture, 2 Fail(try/catch),
// -1 fichier non trouve, -2 lecture faite mais resultat vide
switch (status) {
- case IFSelect_RetVoid : sout<<"file:"<<arg1<<" gives empty result"<<endl; break;
- case IFSelect_RetError : sout<<"file:"<<arg1<<" could not be opened"<<endl; break;
- case IFSelect_RetDone : sout<<"file:"<<arg1<<" read"<<endl; break;
- case IFSelect_RetFail : sout<<"file:"<<arg1<<" : error while reading"<<endl; break;
- case IFSelect_RetStop : sout<<"file:"<<arg1<<" : EXCEPTION while reading"<<endl; break;
+ case Interface_RetVoid : sout<<"file:"<<arg1<<" gives empty result"<<endl; break;
+ case Interface_RetError : sout<<"file:"<<arg1<<" could not be opened"<<endl; break;
+ case Interface_RetDone : sout<<"file:"<<arg1<<" read"<<endl; break;
+ case Interface_RetFail : sout<<"file:"<<arg1<<" : error while reading"<<endl; break;
+ case Interface_RetStop : sout<<"file:"<<arg1<<" : EXCEPTION while reading"<<endl; break;
default : sout<<"file:"<<arg1<<" could not be read"<<endl; break;
}
- if (status != IFSelect_RetDone) return status;
-// sout<<" - clearing list of already written files"<<endl;
- WS->BeginSentFiles(Standard_True);
+ if (status != Interface_RetDone) return status;
return status;
}
-static IFSelect_ReturnStatus fun4
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun7
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Write All ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Write All : give file name !"<<endl; return IFSelect_RetError; }
- return WS->SendAll (arg1);
-}
-
-static IFSelect_ReturnStatus fun5
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// const Standard_CString arg2 = pilot->Arg(2);
-// **** Write Selected ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"Write Selected : give file name + givelist !"<<endl; return IFSelect_RetError; }
- Handle(TColStd_HSequenceOfTransient) result =
- XSDRAW_SelectFunctions::GiveList (WS,pilot->CommandPart( 2));
- if (result.IsNull()) { sout<<"No entity selected"<<endl; return IFSelect_RetError; }
- else sout<<"Nb Entities selected : "<<result->Length()<<endl;
- Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
- sp->SetList (result);
- return WS->SendSelected (arg1,sp);
-}
-
-static IFSelect_ReturnStatus fun6
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Write Entite(s) ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"Write Entitie(s) : give file name + n0s entitie(s)!"<<endl; return IFSelect_RetError; }
- int ko = 0;
- Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
- for (Standard_Integer ia = 2; ia < argc ; ia ++) {
- Standard_Integer id = pilot->Number(pilot->Arg(ia));
- if (id > 0) {
- Handle(Standard_Transient) item = WS->StartingEntity(id);
- if (sp->Add(item)) sout<<"Added:no."<<id<<endl;
- else { sout<<" Fail Add n0."<<id<<endl; ko ++; }
- }
- else { sout<<"Not an entity number:"<<pilot->Arg(ia)<<endl; ko ++; }
- }
- if (ko > 0) { sout<<ko<<" bad arguments, abandon"<<endl; return IFSelect_RetError; }
- return WS->SendSelected (arg1,sp);
-}
-
-static IFSelect_ReturnStatus fun7
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
// **** Entity Label ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give entity number"<<endl; return IFSelect_RetError; }
- if (!WS->HasModel()) { sout<<"No loaded model, abandon"<<endl; return IFSelect_RetError; }
+ if (argc < 2) { sout<<"Give entity number"<<endl; return Interface_RetError; }
+ if (WS->Model().IsNull()) { sout<<"No loaded model, abandon"<<endl; return Interface_RetError; }
Standard_Integer nument = WS->NumberFromLabel (arg1);
if (nument <= 0 || nument > WS->NbStartingEntities())
- { sout<<"Not a suitable number: "<<arg1<<endl; return IFSelect_RetError; }
+ { sout<<"Not a suitable number: "<<arg1<<endl; return Interface_RetError; }
sout<<"N0."<<nument<<" ->Label in Model : ";
WS->Model()->PrintLabel(WS->StartingEntity(nument),sout);
sout<<endl;
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
-static IFSelect_ReturnStatus fun8
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun8
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
// **** Entity Number ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give label to search"<<endl; return IFSelect_RetError; }
- if (!WS->HasModel()) { sout<<"No loaded model, abandon"<<endl; return IFSelect_RetError; }
+ if (argc < 2) { sout<<"Give label to search"<<endl; return Interface_RetError; }
+ if (WS->Model().IsNull()) { sout<<"No loaded model, abandon"<<endl; return Interface_RetError; }
const Handle(Interface_InterfaceModel) &model = WS->Model();
Standard_Integer i, cnt = 0;
Standard_Boolean exact = Standard_False;
if (cnt == 0) sout<<" ** No Match"<<endl;
else if (cnt == 1) sout<<" ** 1 Match"<<endl;
else sout<<cnt<<" Matches"<<endl;
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
-static IFSelect_ReturnStatus fun9
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun9
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
// **** List Types ****
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Handle(IFSelect_Signature) signtype = WS->SignType();
if (signtype.IsNull()) signtype = new IFSelect_SignType;
Handle(IFSelect_SignCounter) counter =
return pilot->ExecuteCounter (counter,1);
}
-static IFSelect_ReturnStatus funcount
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus funcount
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg0 = pilot->Arg(0);
const Standard_CString arg1 = pilot->Arg(1);
sout<<" signature/compteur seul -> tout le modele"<<endl
<< " sign/compteur + selection -> cette selection, evaluation normale"<<endl
<<" sign/compteur + sel + num -> cette selection evaluee sur entite n0 num"<<endl;
- return IFSelect_RetError;
+ return Interface_RetError;
}
DeclareAndCast(IFSelect_SignCounter,counter,WS->NamedItem(arg1));
if (counter.IsNull()) {
DeclareAndCast(IFSelect_Signature,signa,WS->NamedItem(arg1));
if (!signa.IsNull()) counter = new IFSelect_SignCounter(signa,Standard_False,listmode);
}
-// Handle(IFSelect_Selection) sel;
-// Standard_Integer n3 = 0; if (argc > 3) n3 = WS->NumberFromLabel(arg3);
-// if (argc > 2) sel = GetCasted(IFSelect_Selection,WS->NamedItem(arg2));
-// if (counter.IsNull() || (argc > 2 && n3 <= 0 && sel.IsNull()) ) {
-// sout<<"Nom:"<<arg1; if (argc > 2) sout<<" et/ou "<<arg2;
-// sout<<" incorrect (demande: compteur ou signature [selection])"<<endl;
-// return IFSelect_RetError;
-// }
// Ajout : si Selection, on applique un GraphCounter
// Et en ce cas, on peut en avoir plusieurs : la limite est le mot-cle "on"
sel = WS->GiveSelection(pilot->Arg(i));
if (!suite->AddInput(sel)) {
sout<<"Incorrect definition for applied selection"<<endl;
- return IFSelect_RetError;
+ return Interface_RetError;
}
}
seld = suite;
if (counter.IsNull()) {
sout<<"Neither Counter nor Signature : "<<arg1<<endl;
- return IFSelect_RetError;
+ return Interface_RetError;
}
if (onflag == 0) onflag = 1;
return pilot->ExecuteCounter (counter,onflag+1, pcm);
}
-static IFSelect_ReturnStatus funsigntype
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus funsigntype
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
// **** Sign Type ****
sout<<"signtype now cleared"<<endl;
} else {
signtype = GetCasted(IFSelect_Signature,WS->NamedItem(arg1));
- if (signtype.IsNull()) { sout<<"Not a Signature : "<<arg1<<endl; return IFSelect_RetError; }
+ if (signtype.IsNull()) { sout<<"Not a Signature : "<<arg1<<endl; return Interface_RetError; }
else sout<<"signtype now set to "<<arg1<<endl;
}
WS->SetSignType(signtype);
- return IFSelect_RetDone;
+ return Interface_RetDone;
}
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
-static IFSelect_ReturnStatus funsigncase
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus funsigncase
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
const Standard_CString arg1 = pilot->Arg(1);
// **** Sign Case ****
Handle(IFSelect_Signature) signcase = GetCasted(IFSelect_Signature,WS->NamedItem(arg1));
sout<<endl;
}
}
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
-static IFSelect_ReturnStatus fun10
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun10
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
// **** Entity Status ****
for (i = 0; i <= nb; i ++)
sout<<"Cat."<<i<<" : "<<Interface_Category::Name(i)<<"\n";
sout<<" On a given entity : give its number"<<endl;
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
Standard_Integer num = pilot->Number(arg1);
if (num <= 0 || num > WS->NbStartingEntities())
- { sout<<"Not a suitable entity number : "<<arg1<<endl; return IFSelect_RetError; }
+ { sout<<"Not a suitable entity number : "<<arg1<<endl; return Interface_RetError; }
Handle(Standard_Transient) ent = WS->StartingEntity(num);
WS->PrintEntityStatus(ent,sout);
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
-static IFSelect_ReturnStatus fun11
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun11
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// Standard_Integer argc = pilot->NbWords();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
const Standard_CString arg1 = pilot->Arg(1);
// **** DumpModel (Data) ****
Standard_Integer niv = 0;
-// char arg10 = arg1[0];
-// if (argc < 2) arg10 = '?';
Handle(Message_Messenger) sout = Message::DefaultMessenger();
switch (arg1[0]) {
case '?' :
<<" totalcheck CheckList (complete) per message (listing n0 ents)\n"
<<" FAILS CheckList (fails) per message (listing complete)\n"
<<" TOTALCHECK CheckList (complete) per message (listing complete)"<<endl;
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
case 'g' : niv = 0; break;
case 'r' : niv = 1; break;
case 'e' : niv = 2; break;
case 'T' : niv = 7; break;
case 'f' : niv = 8; break;
case 'F' : niv =10; break;
- default : sout<<"Unknown Mode . data tout court pour help"<<endl; return IFSelect_RetError;
+ default : sout<<"Unknown Mode . data tout court pour help"<<endl; return Interface_RetError;
}
WS->TraceDumpModel(niv);
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
-static IFSelect_ReturnStatus fundumpent
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fundumpent
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
- Handle(IFSelect_WorkLibrary) WL = WS->WorkLibrary();
+ const Handle(XSControl_Controller) &WL = WS->NormAdaptor();
Standard_Integer levdef=0,levmax=10,level;
WL->DumpLevels (levdef,levmax);
Handle(Message_Messenger) sout = Message::DefaultMessenger();
Standard_CString help = WL->DumpHelp (level);
if (help[0] != '\0') sout<<level<<" : "<<help<<endl;
}
- return IFSelect_RetError;
+ return Interface_RetError;
}
const Standard_CString arg1 = pilot->Arg(1);
const Standard_CString arg2 = pilot->Arg(2);
Standard_Integer num = pilot->Number(arg1);
- if (num == 0) return IFSelect_RetError;
+ if (num == 0) return Interface_RetError;
level = levdef;
if (argc > 2) level = atoi(arg2);
Handle(Standard_Transient) ent = WS->StartingEntity(num);
}
else {
sout << " -- DUMP Entity n0 " << num << " level " << level << endl;
- WL->DumpEntity (WS->Model(),WS->Protocol(),ent,sout,level);
+ WL->DumpEntity (WS->Model(),WS->NormAdaptor()->Protocol(),ent,sout,level);
Interface_CheckIterator chl = WS->CheckOne (ent);
if (!chl.IsEmpty(Standard_False)) chl.Print(sout,WS->Model(),Standard_False);
}
// sout << flush;
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
-static IFSelect_ReturnStatus funsign
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus funsign
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
const Standard_CString arg2 = pilot->Arg(2);
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<" Give signature name + n0 or id of entity"<<endl; return IFSelect_RetError; }
+ if (argc < 3) { sout<<" Give signature name + n0 or id of entity"<<endl; return Interface_RetError; }
DeclareAndCast(IFSelect_Signature,sign,WS->NamedItem(arg1));
- if (sign.IsNull()) { sout<<"Not a signature : "<<arg1<<endl; return IFSelect_RetError; }
+ if (sign.IsNull()) { sout<<"Not a signature : "<<arg1<<endl; return Interface_RetError; }
Standard_Integer num = pilot->Number(arg2);
Handle(Standard_Transient) ent = WS->StartingEntity (num);
- if (num == 0) return IFSelect_RetError;
+ if (num == 0) return Interface_RetError;
sout<<"Entity n0 "<<num<<" : "<<WS->SignValue(sign,ent)<<endl;
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
-static IFSelect_ReturnStatus funqp
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus funqp
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
const Standard_CString arg2 = pilot->Arg(2);
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<" Give 2 numeros or labels : dad son"<<endl; return IFSelect_RetError; }
+ if (argc < 3) { sout<<" Give 2 numeros or labels : dad son"<<endl; return Interface_RetError; }
Standard_Integer n1 = WS->NumberFromLabel(arg1);
Standard_Integer n2 = WS->NumberFromLabel(arg2);
sout<<"QueryParent for dad:"<<arg1<<":"<<n1<<" and son:"<<arg2<<":"<<n2<<endl;
else if (qp == 0) sout<<arg1<<" is same as "<<arg2<<endl;
else sout<<arg1<<" is super-entity of "<<arg2<<" , max level found="<<qp<<endl;
// sout<<" Trouve "<<qp<<endl;
- return IFSelect_RetVoid;
-}
-
-
-static IFSelect_ReturnStatus fun12
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** DumpShare ****
- WS->DumpShare(); return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
-static IFSelect_ReturnStatus fun13
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun13
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
// **** ListItems ****
- WS->ListItems(pilot->Arg(1)); return IFSelect_RetVoid;
+ pilot->Session()->ListItems(pilot->Arg(1)); return Interface_RetVoid;
}
-static IFSelect_ReturnStatus fun14
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun14
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
// **** NewInt ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 1) { sout<<"Donner la valeur entiere pour IntParam"<<endl; return IFSelect_RetError; }
+ if (argc < 1) { sout<<"Donner la valeur entiere pour IntParam"<<endl; return Interface_RetError; }
Handle(IFSelect_IntParam) intpar = new IFSelect_IntParam;
if (argc >= 1) intpar->SetValue(atoi(arg1));
return pilot->RecordItem (intpar);
}
-static IFSelect_ReturnStatus fun15
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun15
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
const Standard_CString arg2 = pilot->Arg(2);
// **** SetInt ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
if (argc < 3)
- { sout<<"Donner 2 arguments : nom Parametre et Valeur"<<endl; return IFSelect_RetError; }
+ { sout<<"Donner 2 arguments : nom Parametre et Valeur"<<endl; return Interface_RetError; }
Standard_Integer val = atoi(arg2);
DeclareAndCast(IFSelect_IntParam,par,WS->NamedItem(arg1));
- if (!WS->SetIntValue(par,val)) return IFSelect_RetFail;
- return IFSelect_RetDone;
+ if (!WS->SetIntValue(par,val)) return Interface_RetFail;
+ return Interface_RetDone;
}
-static IFSelect_ReturnStatus fun16
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun16
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
// **** NewText ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 1) { sout<<"Donner la valeur texte pour TextParam"<<endl; return IFSelect_RetError; }
+ if (argc < 1) { sout<<"Donner la valeur texte pour TextParam"<<endl; return Interface_RetError; }
Handle(TCollection_HAsciiString) textpar = new TCollection_HAsciiString();
if (argc >= 1) textpar->AssignCat(arg1);
return pilot->RecordItem (textpar);
}
-static IFSelect_ReturnStatus fun17
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun17
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
const Standard_CString arg2 = pilot->Arg(2);
// **** SetText ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
if (argc < 3)
- { sout<<"Donner 2 arguments : nom Parametre et Valeur"<<endl; return IFSelect_RetError; }
+ { sout<<"Donner 2 arguments : nom Parametre et Valeur"<<endl; return Interface_RetError; }
DeclareAndCast(TCollection_HAsciiString,par,WS->NamedItem(arg1));
- if (!WS->SetTextValue(par,arg2)) return IFSelect_RetFail;
- return IFSelect_RetDone;
+ if (!WS->SetTextValue(par,arg2)) return Interface_RetFail;
+ return Interface_RetDone;
}
-static IFSelect_ReturnStatus fun19
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun19
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
// **** DumpSel ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give 1 argument : Selection Name"<<endl; return IFSelect_RetError; }
+ if (argc < 2) { sout<<"Give 1 argument : Selection Name"<<endl; return Interface_RetError; }
WS->DumpSelection (GetCasted(IFSelect_Selection,WS->NamedItem(arg1)));
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
-static IFSelect_ReturnStatus fun20
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun20
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
// **** EvalSel ****
// **** GiveList ****
char mode = pilot->Arg(0)[0]; // givelist/makelist
if (mode == 'g') mode = pilot->Arg(0)[4]; // l list s short p pointed
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give Entity ID, or Selection Name [+ optional other selection or entity]"<<endl; return IFSelect_RetError; }
+ if (argc < 2) { sout<<"Give Entity ID, or Selection Name [+ optional other selection or entity]"<<endl; return Interface_RetError; }
// MakeList : sur Pointed existante ou a creer
Handle(IFSelect_SelectPointed) pnt;
pnt->Clear();
} else if (!item.IsNull()) {
sout<<arg1<<":Already existing Item not for a List, command ignored"<<endl;
- return IFSelect_RetFail;
+ return Interface_RetFail;
} else {
pnt = new IFSelect_SelectPointed;
WS->AddNamedItem (arg1,pnt);
Handle(TColStd_HSequenceOfTransient) result =
XSDRAW_SelectFunctions::GiveList (WS,pilot->CommandPart( (mode == 'm' ? 2 : 1) ));
- if (result.IsNull()) return IFSelect_RetError;
+ if (result.IsNull()) return Interface_RetError;
Interface_EntityIterator iter (result);
sout<<pilot->CommandPart( (mode == 'm' ? 2 : 1) )<<" : ";
if (mode == 'l') WS->ListEntities (iter,0);
sout<<"Later editable by command setlist"<<endl;
}
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
-static IFSelect_ReturnStatus fun20c
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun20c
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
// **** GiveCount ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give Entity ID, or Selection Name [+ optional other selection or entity]"<<endl; return IFSelect_RetError; }
-// WS->EvaluateSelection(GetCasted(IFSelect_Selection,WS->NamedItem(arg1)));
+ if (argc < 2) { sout<<"Give Entity ID, or Selection Name [+ optional other selection or entity]"<<endl; return Interface_RetError; }
Handle(TColStd_HSequenceOfTransient) result =
XSDRAW_SelectFunctions::GiveList (WS,pilot->CommandPart(1));
- if (result.IsNull()) return IFSelect_RetError;
+ if (result.IsNull()) return Interface_RetError;
sout<<pilot->CommandPart(1)<<" : List of "<<result->Length()<<" Entities"<<endl;
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
-static IFSelect_ReturnStatus funselsuite
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus funselsuite
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
// **** SelSuite ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give Entity ID, or Selection Name [+ optional other selection or entity]"<<endl; return IFSelect_RetError; }
-// WS->EvaluateSelection(GetCasted(IFSelect_Selection,WS->NamedItem(arg1)));
+ if (argc < 2) { sout<<"Give Entity ID, or Selection Name [+ optional other selection or entity]"<<endl; return Interface_RetError; }
Handle(IFSelect_SelectSuite) selsuite = new IFSelect_SelectSuite;
for (Standard_Integer i = 1; i < argc; i ++) {
Handle(IFSelect_Selection) sel = WS->GiveSelection(pilot->Arg(i));
if (!selsuite->AddInput(sel)) {
sout<<pilot->Arg(i-1)<<" : not a SelectDeduct, no more can be added. Abandon"<<endl;
- return IFSelect_RetError;
+ return Interface_RetError;
}
}
selsuite->SetLabel (pilot->CommandPart(1));
return pilot->RecordItem (selsuite);
}
-
-static IFSelect_ReturnStatus fun21
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun21
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
// **** ClearItems ****
- WS->ClearItems(); WS->ClearFinalModifiers(); WS->ClearShareOut(Standard_False);
- return IFSelect_RetDone;
+ WS->ClearItems();
+ return Interface_RetDone;
}
-static IFSelect_ReturnStatus fun22
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun22
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
// **** ClearData ****
if (mode < 0) sout<<"Give a suitable mode";
sout<<" Available Modes :\n"
<<" a : all data g : graph+check c : check p : selectpointed"<<endl;
- return (mode < 0 ? IFSelect_RetError : IFSelect_RetVoid);
+ return (mode < 0 ? Interface_RetError : Interface_RetVoid);
}
WS->ClearData (mode);
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun24
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
-// **** Item Label ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- TCollection_AsciiString label;
- if (argc < 2) { sout<<" Give label to search"<<endl; return IFSelect_RetError; }
- for (int i = 1; i < argc; i ++) {
- label.AssignCat(pilot->Arg(i));
- if (i < argc-1) label.AssignCat(" ");
- }
- for (int mode = 0; mode <= 2; mode ++) {
- int nbitems = 0; int id;
- sout<<"Searching label : "<<label<<". in mode ";
- if (mode == 0) sout <<" exact" << endl;
- if (mode == 1) sout <<" same head" << endl;
- if (mode == 2) sout <<" search if present" << endl;
- for (id = WS->NextIdentForLabel(label.ToCString(), 0,mode) ; id != 0;
- id = WS->NextIdentForLabel(label.ToCString(),id,mode)) {
- sout<<" "<<id; nbitems ++;
- }
- sout<<" -- giving " << nbitems << " found" << endl;
- }
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun25
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Save (Dump) ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner nom du Fichier"<<endl; return IFSelect_RetError; }
- IFSelect_SessionFile dumper(WS,arg1);
- if (!dumper.IsDone()) return IFSelect_RetFail;
- return IFSelect_RetDone;
+ return Interface_RetDone;
}
-static IFSelect_ReturnStatus fun26
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun27
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
-// **** Restore (Dump) ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner nom du Fichier"<<endl; return IFSelect_RetError; }
- IFSelect_SessionFile dumper(WS);
- Standard_Integer readstat = dumper.Read(arg1);
- if (readstat == 0) return IFSelect_RetDone;
- else if (readstat > 0) sout << "-- Erreur Lecture Fichier "<<arg1<<endl;
- else sout << "-- Pas pu ouvrir Fichier "<<arg1<<endl;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun27
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- const Standard_CString arg1 = pilot->Arg(1);
const Standard_CString arg2 = pilot->Arg(2);
// **** Param(Value) ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
sout<<li->Value(i);
sout<<" : "<<Interface_Static::CVal(li->Value(i)->ToCString())<<endl;
}
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
} else if (atoi(arg1) > 0) {
Standard_Integer use = atoi (arg1);
WS->TraceStatics (use);
} else {
if (argc > 2) sout<<" FORMER STATUS of Static Parameter "<<arg1<<endl;
else sout<<" ACTUAL STATUS of Static Parameter "<<arg1<<endl;
- if (!Interface_Static::IsPresent(arg1)) { sout<<" Parameter "<<arg1<<" undefined"<<endl; return IFSelect_RetError; }
+ if (!Interface_Static::IsPresent(arg1)) { sout<<" Parameter "<<arg1<<" undefined"<<endl; return Interface_RetError; }
if (!Interface_Static::IsSet(arg1)) sout<<" Parameter "<<arg1<<" not valued"<<endl;
else if (argc == 2) Interface_Static::Static (arg1) -> Print(sout);
else sout<<" Value : "<<Interface_Static::CVal(arg1)<<endl;
else {
sout<<" New demanded value : "<<arg2;
if (Interface_Static::SetCVal (arg1,arg2))
- { sout<<" OK"<<endl; return IFSelect_RetDone; }
- else { sout <<" , refused"<<endl; return IFSelect_RetError; }
+ { sout<<" OK"<<endl; return Interface_RetDone; }
+ else { sout <<" , refused"<<endl; return Interface_RetError; }
}
}
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
-static IFSelect_ReturnStatus fun28
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun28
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
Handle(Interface_Static) unst = Interface_Static::Static (arg1);
if (unst.IsNull()) sout<<" undefined"<<endl;
else unst->Print(sout);
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
} else if (arg2[0] == 'i') {
// initialisation : arg1=nompar a2='i' a3=family a4=type [a5=val]
- if (argc < 5) { sout<<" name init family type [valinit]"<<endl; return IFSelect_RetVoid; }
+ if (argc < 5) { sout<<" name init family type [valinit]"<<endl; return Interface_RetVoid; }
char typ = (pilot->Arg(4))[0];
Standard_Boolean ok= (argc==5 ? Interface_Static::Init(arg3,arg1,typ) :
Interface_Static::Init(arg3,arg1,typ,pilot->Arg(5)));
- return (ok ? IFSelect_RetDone : IFSelect_RetFail);
+ return (ok ? Interface_RetDone : Interface_RetFail);
} else if (arg2[0] == 'e') {
// edition : arg1=nompar arg2='e' arg3=option arg4...=parametres option
<<" imin ival / imax ival / rmin rval / rmax rval /\n"
<<" enum stnum / enum stnum match / eval e1 e2 e3 ... (maxi 10)\n"
<<endl;
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
if (argc > 4) sout<<"Only the command and ONE more arg are considered"<<endl;
sprintf(comm,"%s %s",pilot->Arg(3),pilot->Arg(4));
sout<<"Editing parameter : "<<arg1<<" , by command : "<<comm<<endl;
Handle(Interface_Static) unst = Interface_Static::Static (arg1);
- if (unst.IsNull()) { sout<<arg1<<" undefined"<<endl; return IFSelect_RetError; }
+ if (unst.IsNull()) { sout<<arg1<<" undefined"<<endl; return Interface_RetError; }
if (Interface_Static::Init(unst->Family(),arg1,'&',comm))
- { sout<<"Editing done"<<endl; return IFSelect_RetDone; }
- else { sout<<"Command not processed : "<<comm<<endl; return IFSelect_RetFail; }
+ { sout<<"Editing done"<<endl; return Interface_RetDone; }
+ else { sout<<"Command not processed : "<<comm<<endl; return Interface_RetFail; }
}
sout<<"Unknown Option : "<<arg2<<endl;
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun29
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** SentFiles ****
- Handle(TColStd_HSequenceOfHAsciiString) list = WS->SentFiles();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (list.IsNull())
- { sout<<"List of Sent Files not enabled"<<endl; return IFSelect_RetVoid; }
- Standard_Integer i, nb = list->Length();
- sout<<" Sent Files : "<<nb<<" : "<<endl;
- for (i = 1; i <= nb; i ++)
- sout<<list->Value(i)->ToCString()<<endl;
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun30
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** FilePrefix ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) {
- if (WS->FilePrefix().IsNull()) sout<<"Pas de prefixe defini"<<endl;
- else sout<<"Prefixe : "<<WS->FilePrefix()->ToCString()<<endl;
- sout<<"Pour changer : filepref newprefix"<<endl;
- return IFSelect_RetVoid;
- }
- WS->SetFilePrefix(arg1);
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun31
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** FileExtension ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) {
- if (WS->FileExtension().IsNull()) sout<<"Pas d extension definie"<<endl;
- else sout<<"Extension : "<<WS->FileExtension()->ToCString()<<endl;
- sout<<"Pour changer : fileext newext"<<endl;
- return IFSelect_RetVoid;
- }
- WS->SetFileExtension(arg1);
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun32
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
-// **** FileRoot ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner Dispatch et nom de Root"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(arg1));
- if (argc < 3) {
- if (WS->FileRoot(disp).IsNull()) sout<<"Pas de racine definie pour "<<arg1<<endl;
- else sout<<"Racine pour "<<arg1<<" : "<<WS->FileRoot(disp)->ToCString()<<endl;
- sout<<"Pour changer : fileroot nomdisp newroot"<<endl;
- return IFSelect_RetVoid;
- }
- if (!WS->SetFileRoot(disp,arg2)) return IFSelect_RetFail;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun33
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Default File Root ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) {
- if (WS->DefaultFileRoot().IsNull()) sout<<"Pas de racine par defaut definie"<<endl;
- else sout<<"Racine par defaut : "<<WS->DefaultFileRoot()->ToCString()<<endl;
- sout<<"Pour changer : filedef newdef"<<endl;
- return IFSelect_RetVoid;
- }
- WS->SetDefaultFileRoot(arg1);
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun34
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** EvalFile ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (!WS->HasModel())
- { sout<<"Pas de Modele charge, abandon"<<endl; return IFSelect_RetFail; }
-
- sout<<"Evaluation avec Memorisation des resultats"<<endl;
- WS->EvaluateFile();
- Standard_Integer nbf = WS->NbFiles();
- for (Standard_Integer i = 1; i <= nbf; i ++) {
- Handle(Interface_InterfaceModel) mod = WS->FileModel(i);
- if (mod.IsNull())
- { sout<<"Modele "<<i<<" Model non genere ..."<<endl; continue; }
- TCollection_AsciiString name = WS->FileName(i);
- sout<<"Fichier n0 "<<i<<" Nb Entites : "<<mod->NbEntities()<<" Nom: ";
- sout<<name<<endl;
- }
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun35
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** ClearFile ****
- WS->ClearFile(); return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun36
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
-// **** Split ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- IFSelect_ReturnStatus stat = IFSelect_RetVoid;
- if (argc < 2) sout<<"Split : derniere liste de dispatches definie"<<endl;
- else {
- WS->ClearShareOut(Standard_True);
- for (Standard_Integer i = 1; i < argc; i ++) {
- DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(pilot->Arg(i)));
- if (disp.IsNull()) {
- sout<<"Pas un dispatch:"<<pilot->Arg(i)<<", Splitt abandonne"<<endl;
- stat = IFSelect_RetError;
- }
- else WS->SetActive(disp,Standard_True);
- }
- }
- if (stat == IFSelect_RetError) return stat;
- WS->BeginSentFiles(Standard_True);
- if (!WS->SendSplit()) return IFSelect_RetFail;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun37
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Remaining Data ****
- char mode = '?'; IFSelect_RemainMode numod = IFSelect_RemainDisplay;
- if (argc >= 2) mode = arg1[0];
- if (mode == 'u') numod = IFSelect_RemainUndo;
- else if (mode == 'l') numod = IFSelect_RemainDisplay;
- else if (mode == 'c') numod = IFSelect_RemainCompute;
- else if (mode == 'f') numod = IFSelect_RemainForget;
- else {
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc<2) sout<<"Donner un Mode - ";
- sout<<"Modes possibles : l list, c compute, u undo, f forget"<<endl;
- if (mode == '?') return IFSelect_RetDone; else return IFSelect_RetError;
- }
- if (!WS->SetRemaining(numod)) return IFSelect_RetVoid;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun38
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
-// **** SetModelContent ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"Donner nom selection et mode (k=keep,r=remove)"<<endl; return IFSelect_RetError; }
- Standard_Boolean keepmode;
- DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1));
- if (sel.IsNull())
- { sout<<"Pas de Selection de Nom : "<<arg1<<endl; return IFSelect_RetError; }
- if (arg2[0] == 'k') { sout<<" -- SetContent keep ..."; keepmode = Standard_True; }
- else if (arg2[0] == 'r') { sout<<" -- SetContent remove ..."; keepmode = Standard_False; }
- else { sout<<"Donner nom selection et mode (k=keep,r=remove)"<<endl; return IFSelect_RetError; }
-
- if (WS->SetModelContent(sel,keepmode)) sout<<" Done"<<endl;
- else sout<<" Result empty, ignored"<<endl;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun40
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** ListModif ****
- WS->ListFinalModifiers(Standard_True);
- WS->ListFinalModifiers(Standard_False); return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun41
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Modifier ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner Nom du Modifier"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_GeneralModifier,modif,WS->NamedItem(arg1));
- if (modif.IsNull())
- { sout<<"Pas de Modifier de Nom : "<<arg1<<endl; return IFSelect_RetVoid; }
- Handle(IFSelect_IntParam) low,up;
-
- Handle(IFSelect_Dispatch) disp = modif->Dispatch();
- sout<<"Modifier : "<<arg1<<" Label : "<<modif->Label()<<endl;
- Standard_Integer rank = WS->ModifierRank(modif);
- if (modif->IsKind(STANDARD_TYPE(IFSelect_Modifier)))
- sout<< "Model Modifier n0." << rank;
- else sout<< "File Modifier n0." << rank;
- if (disp.IsNull()) sout<<" Applique a tous les Dispatchs" << endl;
- else {
- sout << " Dispatch : "<<disp->Label();
- if (WS->HasName(disp)) sout << " - Nom:"<<WS->Name(disp)->ToCString();
- sout<<endl;
- }
-
- Handle(IFSelect_Selection) sel = modif->Selection();
- if (!sel.IsNull()) sout<<" Selection : "<< sel->Label();
- if (WS->HasName(sel)) sout<<" - Nom:"<< WS->Name(sel)->ToCString();
- sout<<endl;
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun42
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
-// **** ModifSel ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner Nom Modifier; + Nom Selection optionnel\n"
- <<"Selection pour Mettre une Selection, sinon Annule"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_GeneralModifier,modif,WS->NamedItem(arg1));
- if (modif.IsNull())
- { sout<<"Pas un nom de Modifier : "<<arg1<<endl; return IFSelect_RetError; }
- Handle(IFSelect_Selection) sel;
- if (arg2[0] != '\0') {
- sel = GetCasted(IFSelect_Selection,WS->NamedItem(arg2));
- if (sel.IsNull())
- { sout<<"Pas un nom de Selection : "<<arg2<<endl; return IFSelect_RetError; }
- }
- if (!WS->SetItemSelection(modif,sel)) return IFSelect_RetFail;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun43
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
-// **** SetAppliedModifier ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner Nom Modifier; + Nom Dispatch ou Transformer optionnel :\n"
- <<" - rien : tous Dispatches\n - Dispatch : ce Dispatch seul\n"
- <<" - Transformer : pas un Dispatch mais un Transformer"<<endl;
- return IFSelect_RetError; }
- DeclareAndCast(IFSelect_GeneralModifier,modif,WS->NamedItem(arg1));
- if (modif.IsNull())
- { sout<<"Pas un nom de Modifier : "<<arg1<<endl; return IFSelect_RetError; }
- Handle(Standard_Transient) item;
- if (arg2[0] != '\0') {
- item = WS->NamedItem(arg2);
- if (item.IsNull())
- { sout<<"Pas un nom connu : "<<arg2<<endl; return IFSelect_RetError; }
- }
- else item = WS->ShareOut();
- if (!WS->SetAppliedModifier(modif,item)) return IFSelect_RetFail;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun44
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** ResetApplied (modifier) ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Designer un modifier"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_GeneralModifier,modif,WS->NamedItem(arg1));
- if (modif.IsNull())
- { sout<<"Pas un nom de Modifier : "<<arg1<<endl; return IFSelect_RetError; }
- if (!WS->ResetAppliedModifier(modif)) return IFSelect_RetFail;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun45
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
- const Standard_CString arg3 = pilot->Arg(3);
-// **** ModifMove ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 4) { sout<<"modifmove MF rang1 rang2, M pour Model F pour File"<<endl; return IFSelect_RetError; }
- Standard_Boolean formodel;
- if (arg1[0] == 'm' || arg1[0] == 'M') formodel = Standard_True;
- else if (arg1[0] == 'f' || arg1[0] == 'F') formodel = Standard_False;
- else { sout<<"preciser M pour Model, F pour File"<<endl; return IFSelect_RetError; }
- Standard_Integer before = atoi(arg2);
- Standard_Integer after = atoi(arg3);
- if (before == 0 || after == 0) { sout<<"Donner 2 Entiers Positifs"<<endl; return IFSelect_RetError; }
- if (!WS->ChangeModifierRank(formodel,before,after)) return IFSelect_RetFail;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun51
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
-// **** DispSel ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"Donner Noms Dispatch et Selection Finale"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(arg1));
- if (disp.IsNull())
- { sout<<"Pas un nom de Dispatch : "<<arg1<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg2));
- if (sel.IsNull())
- { sout<<"Pas un nom de Selection : "<<arg2<<endl; return IFSelect_RetError; }
- if (!WS->SetItemSelection(disp,sel)) return IFSelect_RetFail;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun_dispone
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** DispOne ****
- Handle(IFSelect_DispPerOne) disp = new IFSelect_DispPerOne;
- return pilot->RecordItem(disp);
-}
-
-static IFSelect_ReturnStatus fun_dispglob
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** DispGlob ****
- Handle(IFSelect_DispGlobal) disp = new IFSelect_DispGlobal;
- return pilot->RecordItem(disp);
-}
-
-static IFSelect_ReturnStatus fun_dispcount
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** DispCount ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner Nom IntParam pour Count"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_IntParam,par,WS->NamedItem(arg1));
- if (par.IsNull())
- { sout<<"Pas un nom de IntParam : "<<arg1<<endl; return IFSelect_RetError; }
- Handle(IFSelect_DispPerCount) disp = new IFSelect_DispPerCount;
- disp->SetCount (par);
- return pilot->RecordItem(disp);
-}
-
-static IFSelect_ReturnStatus fun_dispfiles
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** DispFiles ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner Nom IntParam pour NbFiles"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_IntParam,par,WS->NamedItem(arg1));
- if (par.IsNull())
- { sout<<"Pas un nom de IntParam : "<<arg1<<endl; return IFSelect_RetError; }
- Handle(IFSelect_DispPerFiles) disp = new IFSelect_DispPerFiles;
- disp->SetCount (par);
- return pilot->RecordItem(disp);
-}
-
-
-static IFSelect_ReturnStatus fun_dispsign
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** DispFiles ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner Nom Signature"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_Signature,sig,WS->NamedItem(arg1));
- if (sig.IsNull())
- { sout<<"Pas un nom de Signature : "<<arg1<<endl; return IFSelect_RetError; }
- Handle(IFSelect_DispPerSignature) disp = new IFSelect_DispPerSignature;
- disp->SetSignCounter (new IFSelect_SignCounter(sig));
- return pilot->RecordItem(disp);
-}
-
-
-static IFSelect_ReturnStatus fun56
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Dispatch ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner Nom du Dispatch"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(arg1));
- if (disp.IsNull()) { sout<<"Pas un dispatch : "<<arg1<<endl; return IFSelect_RetError; }
- Standard_Integer num = WS->DispatchRank(disp);
- sout<<"Dispatch de Nom : "<<arg1<<" , en ShareOut, Numero "<<num<<" : ";
- Handle(IFSelect_Selection) sel = WS->ItemSelection(disp);
- Handle(TCollection_HAsciiString) selname = WS->Name(sel);
- if (sel.IsNull()) sout<<"Pas de Selection Finale"<<endl;
- else if (selname.IsNull()) sout<<"Selection Finale : #"<<WS->ItemIdent(sel)<<endl;
- else sout<<"Selection Finale : "<<selname->ToCString()<<endl;
- if (disp->HasRootName()) sout<<"-- Racine nom de fichier : "
- <<disp->RootName()->ToCString()<<endl;
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun57
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Remove ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give Name to Remove !"<<endl; return IFSelect_RetError; }
- if (!WS->RemoveNamedItem(arg1)) return IFSelect_RetFail;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun58
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** EvalDisp ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"evaldisp mode disp [disp ...] : Mode + Name(s) of Dispatch(es). Mode:\n"
- <<" 0 brief 1 +forgotten ents 2 +duplicata 3 1+2"<<endl
- <<"See also : evaladisp writedisp xsplit"<<endl;
- return IFSelect_RetVoid; }
- Standard_Boolean OK = Standard_True;
- Standard_Integer i , mode = atoi(arg1); sout<<" Mode "<<mode<<"\n";
- for (i = 2; i < argc; i ++) {
- DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(pilot->Arg(i)));
- if (disp.IsNull())
- { sout<<"Not a dispatch:"<<pilot->Arg(i)<<endl; OK = Standard_False; }
- }
- if (!OK) {
- sout<<"Some of the parameters are not correct"<<endl;
- return IFSelect_RetError;
- }
-
- WS->ClearShareOut(Standard_True);
- for (i = 2; i < argc; i ++) {
- DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(pilot->Arg(i)));
- WS->SetActive(disp,Standard_True);
- }
-// WS->EvaluateDispatch(disp,mode);
- WS->EvaluateComplete(mode);
- return IFSelect_RetVoid;
-}
-
-
-static IFSelect_ReturnStatus fun_evaladisp
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** EvalADisp [GiveList] ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"evaladisp mode(=0-1-2-3) disp [givelist] : Mode + Dispatch [+ GiveList]\n If GiveList not given, computed from Selection of the Dispatch. Mode:\n"
- <<" 0 brief 1 +forgotten ents 2 +duplicata 3 1+2"<<endl
- <<"See also : writedisp"<<endl;
- return IFSelect_RetVoid; }
- if (arg1[1] != '\0') { sout<<"first parameter : mode, must be a number between 0 and 3"<<endl; return IFSelect_RetError; }
- Standard_Integer mode = atoi(arg1); sout<<" Mode "<<mode<<"\n";
-// DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(pilot->Arg(2)));
- Handle(IFSelect_Dispatch) disp = XSDRAW_SelectFunctions::GiveDispatch (WS,pilot->Arg(2),Standard_True);
- if (disp.IsNull())
- { sout<<"Not a dispatch:"<<pilot->Arg(2)<<endl; return IFSelect_RetError; }
- Handle(IFSelect_Selection) selsav = disp->FinalSelection();
- Handle(IFSelect_Selection) sel;
- if (argc > 3) {
- Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
- Handle(TColStd_HSequenceOfTransient) list = XSDRAW_SelectFunctions::GiveList
- (pilot->Session(),pilot->CommandPart(3));
- Standard_Integer nb = (list.IsNull() ? 0 : list->Length());
- if (nb > 0) { sp->AddList (list); sel = sp; }
- }
-
- if (sel.IsNull() && selsav.IsNull())
- { sout<<"No Selection nor GiveList defined"<<endl; return IFSelect_RetError; }
- if (sel.IsNull() && !selsav.IsNull()) {
- if (argc > 3) sout<<"GiveList is empty, hence computed from the Selection of the Dispatch"<<endl;
- sel = selsav;
- }
- disp->SetFinalSelection(sel);
-// WS->ClearShareOut(Standard_True);
-// WS->SetActive(disp,Standard_True);
- WS->EvaluateDispatch(disp,mode);
- disp->SetFinalSelection(selsav);
-
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
-static IFSelect_ReturnStatus fun_writedisp
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun70
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** EvalADisp [GiveList] ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"writedisp filename disp [givelist] : FileName + Dispatch [+ GiveList]\n If GiveList not given, computed from Selection of the Dispatch.\n"
- <<"FileName : rootname.ext will gives rootname_1.ext etc...\n"
- <<" path/rootname.ext gives path/rootname_1.ext etc...\n"
- <<"See also : evaladisp"<<endl;
- return IFSelect_RetVoid; }
- TCollection_AsciiString prefix,rootname,suffix;
- SplitFileName (arg1,prefix,rootname,suffix);
- if (rootname.Length() == 0 || suffix.Length() == 0) {
- sout<<"Empty Root Name or Extension"<<endl;
- return IFSelect_RetError;
- }
-
-// DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(pilot->Arg(2)));
- Handle(IFSelect_Dispatch) disp = XSDRAW_SelectFunctions::GiveDispatch (WS,pilot->Arg(2),Standard_True);
- if (disp.IsNull())
- { sout<<"Not a dispatch:"<<pilot->Arg(2)<<endl; return IFSelect_RetError; }
- Handle(IFSelect_Selection) selsav = disp->FinalSelection();
- Handle(IFSelect_Selection) sel;
- if (argc > 3) {
- Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
- Handle(TColStd_HSequenceOfTransient) list = XSDRAW_SelectFunctions::GiveList
- (pilot->Session(),pilot->CommandPart(3));
- Standard_Integer nb = (list.IsNull() ? 0 : list->Length());
- if (nb > 0) { sp->AddList (list); sel = sp; }
- }
-
- if (sel.IsNull() && selsav.IsNull())
- { sout<<"No Selection nor GiveList defined"<<endl; return IFSelect_RetError; }
- if (sel.IsNull() && !selsav.IsNull()) {
- if (argc > 3) sout<<"GiveList is empty, hence computed from the Selection of the Dispatch"<<endl;
- sel = selsav;
- }
-
- WS->ClearShareOut(Standard_True);
- disp->SetFinalSelection(sel);
- WS->SetActive(disp,Standard_True);
- WS->BeginSentFiles(Standard_True);
-
- WS->SetFilePrefix (prefix.ToCString());
- WS->SetFileExtension (suffix.ToCString());
- WS->SetFileRoot(disp,rootname.ToCString());
-
- Standard_Boolean OK = WS->SendSplit();
- disp->SetFinalSelection(selsav);
- return (OK ? IFSelect_RetDone : IFSelect_RetFail);
-}
-
-
-static IFSelect_ReturnStatus fun59
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** EvalComplete ****
- Standard_Integer mode = 0;
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) sout << " -- mode par defaut 0\n";
- else { mode = atoi(arg1); sout << " -- mode : " << mode << endl; }
- WS->EvaluateComplete(mode); return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun60
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** LastRunCheckList ****
- Interface_CheckIterator chlist = WS->LastRunCheckList();
- Handle(IFSelect_CheckCounter) counter = new IFSelect_CheckCounter(0);
- counter->Analyse(chlist,WS->Model(),Standard_False);
- counter->PrintCount (Message::DefaultMessenger());
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun61
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** RunTransformer ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner Nom de Transformer"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_Transformer,tsf,WS->NamedItem(arg1));
- Standard_Integer effect = WS->RunTransformer(tsf);
- switch (effect) {
- case -4 : sout<<"Edition sur place, nouveau Protocole, erreur recalcul graphe"<<endl; break;
- case -3 : sout<<"Erreur, Transformation ignoree"<<endl; break;
- case -2 : sout<<"Erreur sur edition sur place, risque de corruption (verifier)"<<endl; break;
- case -1 : sout<<"Erreur sur edition locale, risque de corruption (verifier)"<<endl; break;
- case 0 :
- if (tsf.IsNull()) sout<<"Erreur, pas un Transformer: "<<arg1<<endl;
- else sout<<"Execution non faite"<<endl;
- break;
- case 1 : sout<<"Transformation locale (graphe non touche)"<<endl; break;
- case 2 : sout<<"Edition sur place (graphe recalcule)"<<endl; break;
- case 3 : sout<<"Modele reconstruit"<<endl; break;
- case 4 : sout<<"Edition sur place, nouveau Protocole"<<endl; break;
- case 5 : sout<<"Nouveau Modele avec nouveau Protocole"<<endl; break;
- default : break;
- }
- return ((effect > 0) ? IFSelect_RetDone : IFSelect_RetFail);
-}
-
-static IFSelect_ReturnStatus fun62
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** TransformStandard Copy ****
- return pilot->RecordItem(WS->NewTransformStandard(Standard_True));
-}
-
-static IFSelect_ReturnStatus fun63
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** TransformStandard OntheSpot ****
- return pilot->RecordItem(WS->NewTransformStandard(Standard_False));
-}
-
-static IFSelect_ReturnStatus fun6465
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Run Modifier avec Standard Copy ****
-// **** Run Modifier avec OnTheSpot ****
- Standard_Boolean runcopy = (pilot->Arg(0)[3] == 'c');
-// soit c est un nom, sinon c est une commande
- Handle(IFSelect_Modifier) modif;
- if (WS->NameIdent(arg1) > 0)
- modif = GetCasted(IFSelect_Modifier,WS->NamedItem(arg1));
- else {
- pilot->RemoveWord(0); // c etait la commande run
- pilot->Perform();
- modif = GetCasted(IFSelect_Modifier,pilot->RecordedItem());
- }
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (modif.IsNull())
- { sout<<"Pas un nom de Modifier : "<<arg1<<endl; return IFSelect_RetError; }
-
- Handle(TColStd_HSequenceOfTransient) list;
- Handle(IFSelect_SelectPointed) sp;
- if (argc > 2) {
- list = XSDRAW_SelectFunctions::GiveList (WS,pilot->CommandPart(2));
- sp = new IFSelect_SelectPointed;
- sp->SetList (list);
- }
-
- Standard_Integer effect = 0;
- effect = WS->RunModifierSelected (modif,sp,runcopy);
-// sout<<"Modifier applique sur TransformStandard #"<<WS->ItemIdent(tsf)<<endl;
- switch (effect) {
- case -4 : sout<<"Edition sur place, nouveau Protocole, erreur recalcul graphe"<<endl; break;
- case -3 : sout<<"Erreur, Transformation ignoree"<<endl; break;
- case -2 : sout<<"Erreur sur edition sur place, risque de corruption (verifier)"<<endl; break;
- case -1 : sout<<"Erreur sur edition locale, risque de corruption (verifier)"<<endl; break;
- case 0 :
- if (modif.IsNull()) sout<<"Erreur, pas un Modifier: "<<arg1<<endl;
- else sout<<"Execution non faite"<<endl;
- break;
- case 1 : sout<<"Transformation locale (graphe non touche)"<<endl; break;
- case 2 : sout<<"Edition sur place (graphe recalcule)"<<endl; break;
- case 3 : sout<<"Modele reconstruit"<<endl; break;
- case 4 : sout<<"Edition sur place, nouveau Protocole"<<endl; break;
- case 5 : sout<<"Nouveau Modele avec nouveau Protocole"<<endl; break;
- default : break;
- }
- return ((effect > 0) ? IFSelect_RetDone : IFSelect_RetFail);
-}
-
-static IFSelect_ReturnStatus fun66
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
-// **** (xset) ModifReorder ****
- char opt = ' ';
- Standard_Integer argc = pilot->NbWords();
- if (argc >= 2) opt = pilot->Word(1).Value(1);
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (opt != 'f' && opt != 'l')
- { sout<<"Donner option : f -> root-first l -> root-last"<<endl; return IFSelect_RetError; }
- return pilot->RecordItem(new IFSelect_ModifReorder(opt == 'l'));
-}
-
-static IFSelect_ReturnStatus fun70
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
// **** SelToggle ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner Nom de Selection"<<endl; return IFSelect_RetError; }
+ if (argc < 2) { sout<<"Donner Nom de Selection"<<endl; return Interface_RetError; }
DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1));
if (!WS->ToggleSelectExtract(sel))
- { sout<<"Pas une SelectExtract : "<<arg1<<endl; return IFSelect_RetFail; }
+ { sout<<"Pas une SelectExtract : "<<arg1<<endl; return Interface_RetFail; }
if (WS->IsReversedSelectExtract(sel)) sout<<arg1<<" a present Reversed"<<endl;
else sout<<arg1<<" a present Directe"<<endl;
- return IFSelect_RetDone;
+ return Interface_RetDone;
}
-static IFSelect_ReturnStatus fun71
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun71
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
const Standard_CString arg2 = pilot->Arg(2);
// **** SelInput ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"Donner Noms Selections cible et input"<<endl; return IFSelect_RetError; }
+ if (argc < 3) { sout<<"Donner Noms Selections cible et input"<<endl; return Interface_RetError; }
DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1));
DeclareAndCast(IFSelect_Selection,sou,WS->NamedItem(arg2));
if (sel.IsNull() || sou.IsNull())
- { sout<<"Incorrect : "<<arg1<<","<<arg2<<endl; return IFSelect_RetError; }
+ { sout<<"Incorrect : "<<arg1<<","<<arg2<<endl; return Interface_RetError; }
if (!WS->SetInputSelection(sel,sou)) {
sout<<"Nom incorrect ou Selection "<<arg1<<" ni Extract ni Deduct"<<endl;
- return IFSelect_RetFail;
+ return Interface_RetFail;
}
- return IFSelect_RetDone;
+ return Interface_RetDone;
}
-static IFSelect_ReturnStatus fun72
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun72
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
// **** SelModelRoots ****
return pilot->RecordItem (new IFSelect_SelectModelRoots);
}
-static IFSelect_ReturnStatus fun73
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun73
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
const Standard_CString arg2 = pilot->Arg(2);
<<" Formes admises :\n <n1> <n2> : Range de <n1> a <n2>\n"
<<" <n1> tout seul : Range n0 <n1>\n from <n1> : Range From <n1>\n"
<<" until <n2> : Range Until <n2>"<<endl;
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
Handle(IFSelect_IntParam) low,up;
Handle(IFSelect_SelectRange) sel;
// Range From
if (pilot->Word(1).IsEqual("from")) {
- if (argc < 3) { sout<<"Forme admise : from <i>"<<endl; return IFSelect_RetError; }
+ if (argc < 3) { sout<<"Forme admise : from <i>"<<endl; return Interface_RetError; }
low = GetCasted(IFSelect_IntParam,WS->NamedItem(arg2));
sel = new IFSelect_SelectRange;
sel->SetFrom (low);
// Range Until
} else if (pilot->Word(1).IsEqual("until")) {
- if (argc < 3) { sout<<"Forme admise : until <i>"<<endl; return IFSelect_RetError; }
+ if (argc < 3) { sout<<"Forme admise : until <i>"<<endl; return Interface_RetError; }
up = GetCasted(IFSelect_IntParam,WS->NamedItem(arg2));
sel = new IFSelect_SelectRange;
sel->SetUntil (up);
return pilot->RecordItem (sel);
}
-static IFSelect_ReturnStatus fun74
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun74
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
// **** SelRoots ****
return pilot->RecordItem (new IFSelect_SelectRoots);
}
-static IFSelect_ReturnStatus fun75
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun75
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
// **** SelShared ****
return pilot->RecordItem (new IFSelect_SelectShared);
}
-static IFSelect_ReturnStatus fun76
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun76
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
const Standard_CString arg2 = pilot->Arg(2);
// **** SelDiff ****
Handle(IFSelect_Selection) sel = new IFSelect_SelectDiff;
- if (sel.IsNull()) return IFSelect_RetFail;
+ if (sel.IsNull()) return Interface_RetFail;
Handle(Message_Messenger) sout = Message::DefaultMessenger();
if (argc < 3) sout<<"Diff sans input : ne pas oublier de les definir (ctlmain, ctlsec)!"<<endl;
DeclareAndCast(IFSelect_Selection,selmain,WS->NamedItem(arg1));
return pilot->RecordItem (sel);
}
-static IFSelect_ReturnStatus fun77
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun77
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
const Standard_CString arg2 = pilot->Arg(2);
// **** SelControlMain ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"Donner Noms de Control et MainInput"<<endl; return IFSelect_RetError; }
+ if (argc < 3) { sout<<"Donner Noms de Control et MainInput"<<endl; return Interface_RetError; }
DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1));
DeclareAndCast(IFSelect_Selection,selmain,WS->NamedItem(arg2));
- if (WS->SetControl(sel,selmain,Standard_True)) return IFSelect_RetDone;
+ if (WS->SetControl(sel,selmain,Standard_True)) return Interface_RetDone;
sout<<"Nom incorrect ou Selection "<<arg1<<" pas de type Control"<<endl;
- return IFSelect_RetFail;
+ return Interface_RetFail;
}
-static IFSelect_ReturnStatus fun78
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun78
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
const Standard_CString arg2 = pilot->Arg(2);
// **** SelControlSecond ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"Donner Noms de Control et SecondInput"<<endl; return IFSelect_RetError; }
+ if (argc < 3) { sout<<"Donner Noms de Control et SecondInput"<<endl; return Interface_RetError; }
DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1));
DeclareAndCast(IFSelect_Selection,seldif,WS->NamedItem(arg2));
- if (WS->SetControl(sel,seldif,Standard_False)) return IFSelect_RetDone;
+ if (WS->SetControl(sel,seldif,Standard_False)) return Interface_RetDone;
sout<<"Nom incorrect ou Selection "<<arg1<<" pas de type Control"<<endl;
- return IFSelect_RetFail;
+ return Interface_RetFail;
}
-static IFSelect_ReturnStatus fun79
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun79
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
// **** SelModelAll ****
return pilot->RecordItem (new IFSelect_SelectModelEntities);
}
-static IFSelect_ReturnStatus fun80
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun80
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
const Standard_CString arg2 = pilot->Arg(2);
// **** SelCombAdd ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"Donner n0 Combine et une Input"<<endl; return IFSelect_RetError; }
+ if (argc < 3) { sout<<"Donner n0 Combine et une Input"<<endl; return Interface_RetError; }
DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1));
DeclareAndCast(IFSelect_Selection,seladd,WS->NamedItem(arg2));
- if (WS->CombineAdd(sel,seladd)) return IFSelect_RetDone;
+ if (WS->CombineAdd(sel,seladd)) return Interface_RetDone;
sout<<"Nom incorrect ou Selection "<<arg1<<" pas Combine"<<endl;
- return IFSelect_RetFail;
+ return Interface_RetFail;
}
-static IFSelect_ReturnStatus fun81
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun81
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
const Standard_CString arg2 = pilot->Arg(2);
// **** SelCombRem ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"Donner n0 Combine et RANG a supprimer"<<endl; return IFSelect_RetError; }
+ if (argc < 3) { sout<<"Donner n0 Combine et RANG a supprimer"<<endl; return Interface_RetError; }
DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1));
DeclareAndCast(IFSelect_Selection,inp,WS->NamedItem(arg2));
- if (WS->CombineRemove(sel,inp)) return IFSelect_RetDone;
+ if (WS->CombineRemove(sel,inp)) return Interface_RetDone;
sout<<"Nom incorrect ou Selection "<<arg1<<" ni Union ni Intersection"<<endl;
- return IFSelect_RetFail;
+ return Interface_RetFail;
}
-static IFSelect_ReturnStatus fun82
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun82
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
// **** SelEntNumber ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner Nom IntParam pour n0 Entite"<<endl; return IFSelect_RetError; }
+ if (argc < 2) { sout<<"Donner Nom IntParam pour n0 Entite"<<endl; return Interface_RetError; }
DeclareAndCast(IFSelect_IntParam,par,WS->NamedItem(arg1));
Handle(IFSelect_SelectEntityNumber) sel = new IFSelect_SelectEntityNumber;
sel->SetNumber(par);
return pilot->RecordItem (sel);
}
-static IFSelect_ReturnStatus fun83
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun83
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
// **** SelUnion ****
return pilot->RecordItem (new IFSelect_SelectUnion);
}
-static IFSelect_ReturnStatus fun84
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun84
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
// **** SelIntersection ****
return pilot->RecordItem (new IFSelect_SelectIntersection);
}
-static IFSelect_ReturnStatus fun85
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun85
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
// **** SelTextType Exact ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner le TYPE a selectionner"<<endl; return IFSelect_RetError; }
+ if (argc < 2) { sout<<"Donner le TYPE a selectionner"<<endl; return Interface_RetError; }
return pilot->RecordItem (new IFSelect_SelectSignature
(new IFSelect_SignType,arg1,Standard_True));
}
-static IFSelect_ReturnStatus fun86
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun86
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
// **** SelErrorEntities ****
return pilot->RecordItem (new IFSelect_SelectErrorEntities);
}
-static IFSelect_ReturnStatus fun87
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun87
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
// **** SelUnknownEntities **
return pilot->RecordItem (new IFSelect_SelectUnknownEntities);
}
-static IFSelect_ReturnStatus fun88
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun88
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
// **** SelSharing ****
return pilot->RecordItem (new IFSelect_SelectSharing);
}
-static IFSelect_ReturnStatus fun89
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun89
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
// **** SelTextType Contain **
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner le TYPE a selectionner"<<endl; return IFSelect_RetError; }
+ if (argc < 2) { sout<<"Donner le TYPE a selectionner"<<endl; return Interface_RetError; }
return pilot->RecordItem (new IFSelect_SelectSignature
(new IFSelect_SignType,arg1,Standard_False));
}
-static IFSelect_ReturnStatus fun90
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun90
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
// **** SelPointed ****
Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
if (pilot->NbWords() > 1) {
Handle(TColStd_HSequenceOfTransient) list = XSDRAW_SelectFunctions::GiveList
(pilot->Session(),pilot->CommandPart(1));
- if (list.IsNull()) return IFSelect_RetFail;
+ if (list.IsNull()) return Interface_RetFail;
Handle(Message_Messenger) sout = Message::DefaultMessenger();
sout<<"SelectPointed : "<<list->Length()<<" entities"<<endl;
sp->AddList (list);
return pilot->RecordItem (sp);
}
-static IFSelect_ReturnStatus fun91
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun91
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
// **** SetPointed (edit) / SetList (edit) ****
sout<<"Donner NOM SelectPointed + Option(s) :\n"
<<" aucune : liste des entites pointees\n"
<<" 0: Clear +nn ajout entite nn -nn enleve nn /nn toggle nn"<<endl;
- return IFSelect_RetError;
+ return Interface_RetError;
}
DeclareAndCast(IFSelect_SelectPointed,sp,WS->NamedItem(arg1));
- if (sp.IsNull()) { sout<<"Pas une SelectPointed:"<<arg1<<endl; return IFSelect_RetError; }
+ if (sp.IsNull()) { sout<<"Pas une SelectPointed:"<<arg1<<endl; return Interface_RetError; }
const Handle(Interface_InterfaceModel) &model = WS->Model(); // pour Print
if (argc == 2) { // listage simple
Standard_Integer nb = sp->NbItems();
else { sout<<" "; model->Print(pointed,sout); }
}
if (nb > 0) sout<<endl;
- return IFSelect_RetDone;
+ return Interface_RetDone;
}
for (Standard_Integer ia = 2; ia < argc ; ia ++) {
sout<<"Ignore:"<<argi<<" , donner n0 PRECEDE de + ou - ou /"<<endl;
}
}
- return IFSelect_RetDone;
+ return Interface_RetDone;
}
-static IFSelect_ReturnStatus fun92
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun92
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
// **** SelIncorrectEntities ****
WS->ComputeCheck();
return pilot->RecordItem (new IFSelect_SelectIncorrectEntities);
}
-static IFSelect_ReturnStatus fun93
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun93
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
const Standard_CString arg2 = pilot->Arg(2);
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
// **** SelSignature ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"Give name of Signature or Counter, text + option exact(D) else contains"<<endl; return IFSelect_RetError; }
+ if (argc < 3) { sout<<"Give name of Signature or Counter, text + option exact(D) else contains"<<endl; return Interface_RetError; }
Standard_Boolean exact = Standard_True;
if (argc > 3) { if (pilot->Arg(3)[0] == 'c') exact = Standard_False; }
if (!sign.IsNull()) sel = new IFSelect_SelectSignature (sign,arg2,exact);
else if (!cnt.IsNull()) sel = new IFSelect_SelectSignature (cnt,arg2,exact);
- else { sout<<arg1<<":neither Signature nor Counter"<<endl; return IFSelect_RetError; }
+ else { sout<<arg1<<":neither Signature nor Counter"<<endl; return Interface_RetError; }
return pilot->RecordItem(sel);
}
-static IFSelect_ReturnStatus fun94
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus fun94
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
- Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
// **** SignCounter ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner nom signature"<<endl; return IFSelect_RetError; }
+ if (argc < 2) { sout<<"Donner nom signature"<<endl; return Interface_RetError; }
DeclareAndCast(IFSelect_Signature,sign,WS->NamedItem(arg1));
- if (sign.IsNull()) { sout<<arg1<<":pas une signature"<<endl; return IFSelect_RetError; }
+ if (sign.IsNull()) { sout<<arg1<<":pas une signature"<<endl; return Interface_RetError; }
Handle(IFSelect_SignCounter) cnt = new IFSelect_SignCounter (sign,Standard_True,Standard_True);
return pilot->RecordItem(cnt);
}
-static IFSelect_ReturnStatus funbselected
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus funbselected
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
- Handle(IFSelect_WorkSession) WS = pilot->Session();
// **** NbSelected = GraphCounter ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner nom selection (deduction) a appliquer"<<endl; return IFSelect_RetError; }
+ if (argc < 2) { sout<<"Donner nom selection (deduction) a appliquer"<<endl; return Interface_RetError; }
DeclareAndCast(IFSelect_SelectDeduct,applied,WS->GiveSelection(arg1));
- if (applied.IsNull()) { sout<<arg1<<":pas une SelectDeduct"<<endl; return IFSelect_RetError; }
+ if (applied.IsNull()) { sout<<arg1<<":pas une SelectDeduct"<<endl; return Interface_RetError; }
Handle(IFSelect_GraphCounter) cnt = new IFSelect_GraphCounter (Standard_True,Standard_True);
cnt->SetApplied (applied);
return pilot->RecordItem(cnt);
}
-// #########################################
-// #### EDITOR - EDITFORM ####
-// #########################################
-
-static IFSelect_ReturnStatus fun_editlist
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give the name of an EditForm or an Editor"<<endl;
- return IFSelect_RetError; }
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-
-// EditForm
-
- DeclareAndCast(IFSelect_EditForm,edf,WS->NamedItem(arg1));
- Handle(IFSelect_Editor) edt;
- if (!edf.IsNull()) {
- sout<<"Print EditForm "<<arg1<<endl;
- edt = edf->Editor();
- if (argc < 3) {
-
-// DEFINITIONS : Editor (direct ou via EditForm)
-
- if (edt.IsNull()) edt = GetCasted(IFSelect_Editor,WS->NamedItem(arg1));
- if (edt.IsNull()) return IFSelect_RetVoid;
-
- sout<<"Editor, Label : "<<edt->Label()<<endl;
- sout<<endl<<" -- Names (short - complete) + Labels of Values"<<endl;
- edt->PrintNames(sout);
- sout<<endl<<" -- Definitions --"<<endl;
- edt->PrintDefs (sout);
- if (!edf.IsNull()) {
- edf->PrintDefs(sout);
- sout<<endl<<"To display values, add an option : o original f final m modified"<<endl;
- }
-
- return IFSelect_RetVoid;
-
- } else {
- char opt = arg2[0];
- Standard_Integer what = 0;
- if (opt == 'o') what = -1;
- else if (opt == 'f') what = 1;
-
- edf->PrintValues (sout,what,Standard_False);
- }
- }
-
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun_editvalue
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"Give the name of an EditForm + name of Value [+ newvalue or . to nullify]"<<endl;
- return IFSelect_RetError; }
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- DeclareAndCast(IFSelect_EditForm,edf,WS->NamedItem(arg1));
- if (edf.IsNull())
- { sout<<"Not an EditForm : "<<arg1<<endl; return IFSelect_RetError; }
- Standard_Integer num = edf->NameNumber (arg2);
- if (num == 0) sout<<"Unknown Value Name : "<<arg2<<endl;
- if (num < 0) sout<<"Not Extracted Value Name : "<<arg2<<endl;
- if (num <= 0) return IFSelect_RetError;
-
- Standard_Boolean islist = edf->Editor()->IsList(num);
- Standard_CString name = edf->Editor()->Name(num,Standard_True); // vrai nom
- Handle(TColStd_HSequenceOfHAsciiString) listr;
- Handle(TCollection_HAsciiString) str;
- sout<<"Value Name : "<<name<<(edf->IsModified(num) ? "(already edited) : " : " : ");
-
- if (islist) {
- listr = edf->EditedList(num);
- if (listr.IsNull()) sout<<"(NULL LIST)"<<endl;
- else {
- Standard_Integer ilist,nblist = listr->Length();
- sout<<"(List : "<<nblist<<" Items)"<<endl;
- for (ilist = 1; ilist <= nblist; ilist ++) {
- str = listr->Value(ilist);
- sout<<" ["<<ilist<<"] "<< (str.IsNull() ? "(NULL)" : str->ToCString())<<endl;
- }
- }
- if (argc < 4) sout<<"To Edit, options by editval edit-form value-name ?"<<endl;
- } else {
- str = edf->EditedValue (num);
- sout<<(str.IsNull() ? "(NULL)" : str->ToCString())<<endl;
- }
- if (argc < 4) return IFSelect_RetVoid;
-
-// Valeur simple ou liste ?
- Standard_Integer numarg = 3;
- str.Nullify();
-
- const Standard_CString argval = pilot->Arg(numarg);
- if (islist) {
- if (argval[0] == '?') {
- sout<<"To Edit, options"<<endl<<" + val : add value at end (blanks allowed)"
- <<endl<<" +nn text : insert val before item nn"<<endl
- <<" nn text : replace item nn with a new value"<<endl
- <<" -nn : remove item nn"<<endl<<" . : clear the list"<<endl;
- return IFSelect_RetVoid;
- }
- Standard_Boolean stated = Standard_False;
- Handle(IFSelect_ListEditor) listed = edf->ListEditor (num);
- if (listed.IsNull()) return IFSelect_RetError;
- if (argval[0] == '.') { listr.Nullify(); stated = listed->LoadEdited(listr); }
- else if (argval[0] == '+') {
- Standard_Integer numadd = 0;
- if (argval[1] != '\0') numadd = atoi(argval);
- stated = listed->AddValue (new TCollection_HAsciiString(pilot->CommandPart(numarg+1)),numadd);
- }
- else if (argval[0] == '-') {
- Standard_Integer numrem = atoi(argval);
- stated = listed->Remove(numrem);
- }
- else {
- Standard_Integer numset = atoi(argval);
- if (numset > 0) stated = listed->AddValue
- (new TCollection_HAsciiString(pilot->CommandPart(numarg+1)),numset);
- }
- if (stated) stated = edf->ModifyList (num,listed,Standard_True);
- if (stated) sout<<"List Edition done"<<endl;
- else sout<<"List Edition not done, option"<<argval<<endl;
- } else {
- if (argval[0] == '.' && argval[1] == '\0') str.Nullify();
- else str = new TCollection_HAsciiString (pilot->CommandPart(numarg));
- if (edf->Modify (num,str,Standard_True)) {
- sout<<"Now set to "<<(str.IsNull() ? "(NULL)" : str->ToCString())<<endl;
- } else {
- sout<<"Modify not done"<<endl; return IFSelect_RetFail;
- }
- }
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun_editclear
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give the name of an EditForm [+ name of Value else all]"<<endl;
- return IFSelect_RetError; }
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- DeclareAndCast(IFSelect_EditForm,edf,WS->NamedItem(arg1));
- if (edf.IsNull())
- { sout<<"Not an EditForm : "<<arg1<<endl; return IFSelect_RetError; }
- if (argc < 3) { edf->ClearEdit(); sout<<"All Modifications Cleared"<<endl; }
- else {
- Standard_Integer num = edf->NameNumber (arg2);
- if (num == 0) sout<<"Unknown Value Name : "<<arg2<<endl;
- if (num < 0) sout<<"Not Extracted Value Name : "<<arg2<<endl;
- if (num <= 0) return IFSelect_RetError;
- if (!edf->IsModified(num))
- { sout<<"Value "<<arg2<<" was not modified"<<endl; return IFSelect_RetVoid; }
- edf->ClearEdit (num);
- sout<<"Modification on Value "<<arg2<<" Cleared"<<endl;
- }
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun_editapply
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give the name of an EditForm [+ option keep to re-apply edited values]"<<endl;
- return IFSelect_RetError; }
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- DeclareAndCast(IFSelect_EditForm,edf,WS->NamedItem(arg1));
- if (edf.IsNull())
- { sout<<"Not an EditForm : "<<arg1<<endl; return IFSelect_RetError; }
-
- Handle(Standard_Transient) ent = edf->Entity();
- Handle(Interface_InterfaceModel) model = edf->Model();
- if (!model.IsNull()) {
- if (ent.IsNull()) sout<<"Applying modifications on loaded model"<<endl;
- else {
- sout<<"Applying modifications on loaded entity : ";
- model->PrintLabel (ent,sout);
- }
- }
- else sout<<"Applying modifications"<<endl;
-
- if (!edf->ApplyData (edf->Entity(),edf->Model())) {
- sout<<"Modifications could not be applied"<<endl;
- return IFSelect_RetFail;
- }
- sout<<"Modifications have been applied"<<endl;
-
- Standard_Boolean stat = Standard_True;
- if (argc > 2 && arg2[0] == 'k') stat = Standard_False;
- if (stat) {
- edf->ClearEdit();
- sout<<"Edited values are cleared"<<endl;
- }
- else sout<<"Edited values are kept for another loading/applying"<<endl;
-
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun_editload
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give the name of an EditForm [+ Entity-Ident]"<<endl;
- return IFSelect_RetError; }
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- DeclareAndCast(IFSelect_EditForm,edf,WS->NamedItem(arg1));
- if (edf.IsNull())
- { sout<<"Not an EditForm : "<<arg1<<endl; return IFSelect_RetError; }
-
- Standard_Integer num = (argc < 3 ? 0 : pilot->Number (arg2));
- Standard_Boolean stat = Standard_False;
- if (argc < 3) {
- sout<<"EditForm "<<arg1<<" : Loading Model"<<endl;
- stat = edf->LoadModel(WS->Model());
- } else if (num <= 0) {
- sout<<"Not an entity ident : "<<arg2<<endl;
- return IFSelect_RetError;
- } else {
- sout<<"EditForm "<<arg1<<" : Loading Entity "<<arg2<<endl;
- stat = edf->LoadData (WS->StartingEntity(num),WS->Model());
- }
-
- if (!stat) {
- sout<<"Loading not done"<<endl;
- return IFSelect_RetFail;
- }
- sout<<"Loading done"<<endl;
- return IFSelect_RetDone;
-}
-
// #########################################
// #### FONCTIONS COMPLEMENTAIRES ####
// #########################################
}
-// Function which returns an EVALUATED DISPATCH
-// (could be added in WorkSession.cdl ...)
-// Two modes : returns dispatch as it is, or return with edition
-// Dispatch Name can be : an immediate name of already recorded Dispatch
-// Or a name of dispatch + a parameter : dispatch-name(param-value)
-// According to type of Dispatch : integer , signature name
-
-Handle(IFSelect_Dispatch) XSDRAW_SelectFunctions::GiveDispatch
- (const Handle(IFSelect_WorkSession)& WS,
- const Standard_CString name, const Standard_Boolean mode)
-{
- DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(name));
- if (!disp.IsNull()) return disp; // OK as it is given
-
-// Else, let s try special cases
- TCollection_AsciiString nam(name);
- Standard_Integer paro = nam.Location(1,'(',1,nam.Length());
- Standard_Integer parf = nam.Location(1,')',1,nam.Length());
- nam.SetValue(paro,'\0'); nam.SetValue(parf,'\0');
- if (paro <= 0 &&parf <= 0) return disp;
- disp = GetCasted(IFSelect_Dispatch,WS->NamedItem(nam.ToCString()));
- if (disp.IsNull()) return disp; // KO anyway
-
-// According to the type of dispatch :
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- DeclareAndCast(IFSelect_DispPerCount,dc,disp);
- if (!dc.IsNull()) {
- Standard_Integer nb = atoi( &(nam.ToCString())[paro]);
- if (nb <= 0) {
- sout<<" DispPerCount, count is not positive"<<endl;
- disp.Nullify();
- return disp;
- }
- if (mode) {
- Handle(IFSelect_IntParam) val = new IFSelect_IntParam;
- val->SetValue(nb);
- dc->SetCount (val);
- }
- return dc;
- }
- DeclareAndCast(IFSelect_DispPerFiles,dp,disp);
- if (!dp.IsNull()) {
- Standard_Integer nb = atoi( &(nam.ToCString())[paro]);
- if (nb <= 0) {
- sout<<" DispPerFiles, count is not positive"<<endl;
- disp.Nullify();
- return disp;
- }
- if (mode) {
- Handle(IFSelect_IntParam) val = new IFSelect_IntParam;
- val->SetValue(nb);
- dp->SetCount (val);
- }
- return dp;
- }
- DeclareAndCast(IFSelect_DispPerSignature,ds,disp);
- if (!ds.IsNull()) {
- DeclareAndCast(IFSelect_Signature,sg,WS->NamedItem( &(nam.ToCString())[paro]));
- if (sg.IsNull()) {
- sout<<"DispPerSignature "<<nam<<" , Signature not valid : "<<&(nam.ToCString())[paro]<<endl;
- disp.Nullify();
- return disp;
- }
- if (mode) ds->SetSignCounter (new IFSelect_SignCounter(sg));
- return ds;
- }
- sout<<"Dispatch : "<<name<<" , Parameter : "<<&(nam.ToCString())[paro]<<endl;
- return disp;
-}
-
-
// #########################################
// #### INITIALISATIONS ####
// #########################################
XSDRAW::SetGroup("DE: General");
XSDRAW::AddFunc("xstatus","Lists XSTEP Status : Version, System Name ...",funstatus);
- XSDRAW::AddFunc("handler","Toggle status catch Handler Error of the session",fun1);
+ //szv_c1:XSDRAW::AddFunc("handler","Toggle status catch Handler Error of the session",fun1);
XSDRAW::AddFunc("xload","file:string : Read File -> Load Model",fun3);
XSDRAW::AddFunc("xread","file:string : Read File -> Load Model",fun3);
- XSDRAW::AddFunc("writeall","file:string : Write all model (no split)",fun4);
- XSDRAW::AddFunc("writesel","file:string sel:Selection : Write Selected (no split)",fun5);
- XSDRAW::AddFunc("writeent","file:string n1ent n2ent...:integer : Write Entite(s) (no split)",fun6);
- XSDRAW::AddFunc("writent", "file:string n1ent n2ent...:integer : Write Entite(s) (no split)",fun6);
+ //szv_c1:XSDRAW::AddFunc("writeall","file:string : Write all model (no split)",fun4);
+ //szv_c1:XSDRAW::AddFunc("writesel","file:string sel:Selection : Write Selected (no split)",fun5);
+ //szv_c1:XSDRAW::AddFunc("writeent","file:string n1ent n2ent...:integer : Write Entite(s) (no split)",fun6);
+ //szv_c1:XSDRAW::AddFunc("writent", "file:string n1ent n2ent...:integer : Write Entite(s) (no split)",fun6);
XSDRAW::AddFunc("elabel","nument:integer : Displays Label Model of an entity",fun7);
XSDRAW::AddFunc("enum","label:string : Displays entities n0.s of which Label Model ends by..",fun8);
XSDRAW::AddFunc("signature","signature name + n0/ident entity",funsign);
XSDRAW::AddFunc("queryparent"," give 2 n0s/labels of entities : dad son",funqp);
- XSDRAW::AddFunc("dumpshare","Dump Share (dispatches, IntParams)",fun12);
+ //szv_c1:XSDRAW::AddFunc("dumpshare","Dump Share (dispatches, IntParams)",fun12);
XSDRAW::AddFunc("listitems","List Items [label else all] ->Type,Label[,Name]",fun13);
XSDRAW::AddFSet("integer","value:integer : cree un IntParam",fun14);
XSDRAW::AddFunc("setint","name:IntParam newValue:integer : Change valeur IntParam",fun15);
XSDRAW::AddFunc("clearitems","Clears all items (selections, dispatches, etc)",fun21);
XSDRAW::AddFunc("cleardata","mode:a-g-c-p : Clears all or some data (model, check...)",fun22);
- XSDRAW::AddFunc("itemlabel","xxx xxx : liste items having this label",fun24);
- XSDRAW::AddFunc("xsave","filename:string : sauve items-session",fun25);
- XSDRAW::AddFunc("xrestore","filename:string : restaure items-session",fun26);
+ //szv_c1:XSDRAW::AddFunc("itemlabel","xxx xxx : liste items having this label",fun24);
+ //szv_c1:XSDRAW::AddFunc("xsave","filename:string : sauve items-session",fun25);
+ //szv_c1:XSDRAW::AddFunc("xrestore","filename:string : restaure items-session",fun26);
XSDRAW::AddFunc("param","nompar:string : displays parameter value; + nompar val : changes it",fun27);
XSDRAW::AddFunc("defparam","nompar:string : display def. param; also : nompar edit, nompar init",fun28);
- XSDRAW::AddFunc("sentfiles","Lists files sent from last Load",fun29);
- XSDRAW::AddFunc("fileprefix","prefix:string : definit File Prefix",fun30);
- XSDRAW::AddFunc("fileext","extent:string : definit File Extension",fun31);
- XSDRAW::AddFunc("fileroot","disp:Dispatch root:string : definit File Root sur un Dispatch",fun32);
- XSDRAW::AddFunc("filedef","defroot:string : definit File DefaultRoot",fun33);
- XSDRAW::AddFunc("evalfile","Evaluation du FileNaming et memorisation",fun34);
- XSDRAW::AddFunc("clearfile","Efface la liste d'EvalFile",fun35);
- XSDRAW::AddFunc("xsplit","[disp:Dispatch sinon tout] : Split, la grande affaire !",fun36);
- XSDRAW::AddFunc("remaining","options... : Remaining Entities, help complet par remaining ?",fun37);
- XSDRAW::AddFunc("setcontent","sel:Selection mode:k ou r : Restreint contenu du modele",fun38);
-
- XSDRAW::AddFunc("listmodif","List Final Modifiers",fun40);
- XSDRAW::AddFunc("dumpmodif","modif:Modifier : Affiche le Statut d'un Modifier",fun41);
- XSDRAW::AddFunc("modifsel","modif:Modifier [sel:Selection] : Change/Annule Selection de Modifier",fun42);
- XSDRAW::AddFunc("setapplied","modif:Modifier [name:un item sinon sortie fichier] : Applique un Modifier",fun43);
- XSDRAW::AddFunc("resetapplied","modif:Modifier : Enleve un Modifier de la sortie fichier",fun44);
- XSDRAW::AddFunc("modifmove","modif:Modifier M(model)/F(file) avant,apres:integer : Deplace un Modifier (sortie fichier)",fun45);
-
- XSDRAW::AddFunc("dispsel","disp:Dispatch sel:Selection -> Selection Finale de Dispatch",fun51);
- XSDRAW::AddFSet("dispone","cree DispPerOne",fun_dispone);
- XSDRAW::AddFSet("dispglob","cree DispGlobal",fun_dispglob);
- XSDRAW::AddFSet("dispcount","count:IntParam : cree DispPerCount",fun_dispcount);
- XSDRAW::AddFSet("dispfile","files:IntParam : cree DispPerFiles",fun_dispfiles);
- XSDRAW::AddFSet("dispsign","sign:Signature : cree DispPerSignature",fun_dispsign);
- XSDRAW::AddFunc("dumpdisp","disp:Dispatch : Affiche le Statut d'un Dispatch",fun56);
-
- XSDRAW::AddFunc("xremove","nom : Remove a Control Item de la Session",fun57);
- XSDRAW::AddFunc("evaldisp","mode=[0-3] disp:Dispatch : Evaluates one or more Dispatch(es)",fun58);
- XSDRAW::AddFunc("evaladisp","mode=[0-3] disp:Dispatch [givelist] : Evaluates a Dispatch (on a GiveList)",fun_evaladisp);
- XSDRAW::AddFunc("writedisp","filepattern disp:Dispatch [givelist] : Writes Entities by Splitting by a Dispatch",fun_writedisp);
- XSDRAW::AddFunc("evalcomplete","Evaluation Complete de la Repartition",fun59);
-
- XSDRAW::AddFunc("runcheck","affiche LastRunCheckList (write,modif)",fun60);
- XSDRAW::AddFunc("runtranformer","transf:Transformer : Applique un Transformer",fun61);
- XSDRAW::AddFSet("copy","cree TransformStandard, option Copy, vide",fun62);
- XSDRAW::AddFSet("onthespot","cree TransformStandard, option OntheSpot, vide",fun63);
- XSDRAW::AddFunc("runcopy","modif:ModelModifier [givelist] : Run <modif> via TransformStandard option Copy",fun6465);
- XSDRAW::AddFunc("runonthespot","modif:ModelModifier [givelist] : Run <modif> via TransformStandard option OnTheSpot",fun6465);
- XSDRAW::AddFSet("reorder","[f ou t] reordonne le modele",fun66);
+ //szv_c1:XSDRAW::AddFunc("sentfiles","Lists files sent from last Load",fun29);
+ //szv_c1:XSDRAW::AddFunc("fileprefix","prefix:string : definit File Prefix",fun30);
+ //szv_c1:XSDRAW::AddFunc("fileext","extent:string : definit File Extension",fun31);
+ //szv_c1:XSDRAW::AddFunc("fileroot","disp:Dispatch root:string : definit File Root sur un Dispatch",fun32);
+ //szv_c1:XSDRAW::AddFunc("filedef","defroot:string : definit File DefaultRoot",fun33);
+ //szv_c1:XSDRAW::AddFunc("evalfile","Evaluation du FileNaming et memorisation",fun34);
+ //szv_c1:XSDRAW::AddFunc("clearfile","Efface la liste d'EvalFile",fun35);
+ //szv_c1:XSDRAW::AddFunc("xsplit","[disp:Dispatch sinon tout] : Split, la grande affaire !",fun36);
+ //szv_c1:XSDRAW::AddFunc("remaining","options... : Remaining Entities, help complet par remaining ?",fun37);
+ //szv_c1:XSDRAW::AddFunc("setcontent","sel:Selection mode:k ou r : Restreint contenu du modele",fun38);
+
+ //szv_c1:XSDRAW::AddFunc("listmodif","List Final Modifiers",fun40);
+ //szv_c1:XSDRAW::AddFunc("dumpmodif","modif:Modifier : Affiche le Statut d'un Modifier",fun41);
+ //szv_c1:XSDRAW::AddFunc("modifsel","modif:Modifier [sel:Selection] : Change/Annule Selection de Modifier",fun42);
+ //szv_c1:XSDRAW::AddFunc("setapplied","modif:Modifier [name:un item sinon sortie fichier] : Applique un Modifier",fun43);
+ //szv_c1:XSDRAW::AddFunc("resetapplied","modif:Modifier : Enleve un Modifier de la sortie fichier",fun44);
+ //szv_c1:XSDRAW::AddFunc("modifmove","modif:Modifier M(model)/F(file) avant,apres:integer : Deplace un Modifier (sortie fichier)",fun45);
+
+ //szv_c1:XSDRAW::AddFunc("dispsel","disp:Dispatch sel:Selection -> Selection Finale de Dispatch",fun51);
+ //szv_c1:XSDRAW::AddFSet("dispone","cree DispPerOne",fun_dispone);
+ //szv_c1:XSDRAW::AddFSet("dispglob","cree DispGlobal",fun_dispglob);
+ //szv_c1:XSDRAW::AddFSet("dispcount","count:IntParam : cree DispPerCount",fun_dispcount);
+ //szv_c1:XSDRAW::AddFSet("dispfile","files:IntParam : cree DispPerFiles",fun_dispfiles);
+ //szv_c1:XSDRAW::AddFSet("dispsign","sign:Signature : cree DispPerSignature",fun_dispsign);
+ //szv_c1:XSDRAW::AddFunc("dumpdisp","disp:Dispatch : Affiche le Statut d'un Dispatch",fun56);
+
+ //szv_c1:XSDRAW::AddFunc("xremove","nom : Remove a Control Item de la Session",fun57);
+ //szv_c1:XSDRAW::AddFunc("evaldisp","mode=[0-3] disp:Dispatch : Evaluates one or more Dispatch(es)",fun58);
+ //szv_c1:XSDRAW::AddFunc("evaladisp","mode=[0-3] disp:Dispatch [givelist] : Evaluates a Dispatch (on a GiveList)",fun_evaladisp);
+ //szv_c1:XSDRAW::AddFunc("writedisp","filepattern disp:Dispatch [givelist] : Writes Entities by Splitting by a Dispatch",fun_writedisp);
+ //szv_c1:XSDRAW::AddFunc("evalcomplete","Evaluation Complete de la Repartition",fun59);
+
+ //szv_c1:XSDRAW::AddFunc("runcheck","affiche LastRunCheckList (write,modif)",fun60);
+ //szv_c1:XSDRAW::AddFunc("runtranformer","transf:Transformer : Applique un Transformer",fun61);
+ //szv_c1:XSDRAW::AddFSet("copy","cree TransformStandard, option Copy, vide",fun62);
+ //szv_c1:XSDRAW::AddFSet("onthespot","cree TransformStandard, option OntheSpot, vide",fun63);
+ //szv_c1:XSDRAW::AddFunc("runcopy","modif:ModelModifier [givelist] : Run <modif> via TransformStandard option Copy",fun6465);
+ //szv_c1:XSDRAW::AddFunc("runonthespot","modif:ModelModifier [givelist] : Run <modif> via TransformStandard option OnTheSpot",fun6465);
+ //szv_c1:XSDRAW::AddFSet("reorder","[f ou t] reordonne le modele",fun66);
XSDRAW::AddFunc("toggle","sel:Selection genre Extract : Toggle Direct/Reverse",fun70);
XSDRAW::AddFunc("input","sel:Selection genre Deduct ou Extract input:Selection : Set Input",fun71);
XSDRAW::AddFSet("signcounter","sign:Signature : cree SignCounter",fun94);
XSDRAW::AddFSet("nbselected","applied:Selection : cree GraphCounter(=NbSelected)",funbselected);
- XSDRAW::AddFunc("editlist","editor or editform : lists defs + values",fun_editlist);
- XSDRAW::AddFunc("editvalue","editform paramname [newval or .] : lists-changes a value",fun_editvalue);
- XSDRAW::AddFunc("editclear","editform [paramname] : clears edition on all or one param",fun_editclear);
- XSDRAW::AddFunc("editload","editform [entity-id] : loads from model or an entity",fun_editload);
- XSDRAW::AddFunc("editapply","editform [keep] : applies on loaded data",fun_editapply);
+ //szv_c1:XSDRAW::AddFunc("editlist","editor or editform : lists defs + values",fun_editlist);
+ //szv_c1:XSDRAW::AddFunc("editvalue","editform paramname [newval or .] : lists-changes a value",fun_editvalue);
+ //szv_c1:XSDRAW::AddFunc("editclear","editform [paramname] : clears edition on all or one param",fun_editclear);
+ //szv_c1:XSDRAW::AddFunc("editload","editform [entity-id] : loads from model or an entity",fun_editload);
+ //szv_c1:XSDRAW::AddFunc("editapply","editform [keep] : applies on loaded data",fun_editapply);
}
#include <TColStd_HSequenceOfTransient.hxx>
class IFSelect_WorkSession;
-class IFSelect_Dispatch;
//! Functions gives access to all the actions which can be
//! If <second> is erroneous, it is ignored
Standard_EXPORT static Handle(TColStd_HSequenceOfTransient) GiveList (const Handle(IFSelect_WorkSession)& WS, const Standard_CString first = "", const Standard_CString second = "");
- //! Evaluates and returns a Dispatch, from data of a WorkSession
- //! if <mode> is False, searches for exact name of Dispatch in WS
- //! Else (D), allows a parameter between brackets :
- //! ex.: dispatch_name(parameter)
- //! The parameter can be: an integer for DispPerCount or DispPerFiles
- //! or the name of a Signature for DispPerSignature
- //! Returns Null Handle if not found not well evaluated
- Standard_EXPORT static Handle(IFSelect_Dispatch) GiveDispatch (const Handle(IFSelect_WorkSession)& WS, const Standard_CString name, const Standard_Boolean mode = Standard_True);
-
//! Defines and loads all basic functions (as ActFunc)
Standard_EXPORT static void Init();
};
--- /dev/null
+// Created on: 2016-10-17
+// Created by: Sergey ZERCHANINOV
+// Copyright (c) 2016 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 _XSDRAW_SessionItems_HeaderFile
+#define _XSDRAW_SessionItems_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+#include <Standard_Handle.hxx>
+
+#include <Dico_DictionaryOfTransient.hxx>
+#include <Dico_IteratorOfDictionaryOfTransient.hxx>
+
+class XSDRAW_SessionItems
+{
+ public:
+
+ DEFINE_STANDARD_ALLOC
+
+ XSDRAW_SessionItems() {}
+
+ //! Records a Session Item, to be added for customisation of the Work Session.
+ //! It must have a specific name.
+ //! <setapplied> is used if <item> is a GeneralModifier, to decide
+ //! If set to true, <item> will be applied to the hook list "send".
+ //! Else, it is not applied to any hook list.
+ //! Warning : if <name> conflicts, the last recorded item is kept
+ void AddItem (const Handle(Standard_Transient)& theItem, const Standard_CString theName)
+ {
+ if (theItem.IsNull() || theName[0] == '\0') return;
+ if (myAdaptorSession.IsNull())
+ myAdaptorSession = new Dico_DictionaryOfTransient;
+ myAdaptorSession->SetItem (theName,theItem);
+ }
+
+ //! Returns an item given its name to record in a Session
+ //! If <name> is unknown, returns a Null Handle
+ Handle(Standard_Transient) GetItem (const Standard_CString theName) const
+ {
+ Handle(Standard_Transient) item;
+ if (!myAdaptorSession.IsNull())
+ myAdaptorSession->GetItem (theName,item);
+ return item;
+ }
+
+ //! Apply recorded items
+ void Apply (const Handle(IFSelect_WorkSession) &theWS) const
+ {
+ // General
+ if (!myAdaptorSession.IsNull()) {
+ Dico_IteratorOfDictionaryOfTransient iter(myAdaptorSession);
+ for (iter.Start(); iter.More(); iter.Next())
+ theWS->AddNamedItem (iter.Name().ToCString(), iter.Value());
+ }
+ }
+
+ protected:
+
+ Handle(Dico_DictionaryOfTransient) myAdaptorSession;
+};
+
+#endif // _XSDRAW_SessionItems_HeaderFile
--- /dev/null
+// 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 <XSDRAW_SessionPilot.hxx>
+
+#include <Standard_Stream.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TColStd_HSequenceOfAsciiString.hxx>
+#include <OSD_OpenFile.hxx>
+#include <Message.hxx>
+#include <Message_Messenger.hxx>
+#include <Interface_EntityIterator.hxx>
+#include <Interface_InterfaceModel.hxx>
+#include <Interface_Macros.hxx>
+#include <IFSelect_Selection.hxx>
+#include <IFSelect_SignCounter.hxx>
+#include <IFSelect_WorkSession.hxx>
+#include <XSDRAW_Vars.hxx>
+
+#include <stdio.h>
+IMPLEMENT_STANDARD_RTTIEXT(XSDRAW_SessionPilot,XSDRAW_Activator)
+
+#define MAXWORDS 200
+#define MAXCARS 1000
+
+static TCollection_AsciiString nulword;
+
+//#define DEBUG_TRACE
+
+// Nb Maxi de words : cf thewords et method SetCommandLine
+
+const Handle(XSDRAW_SessionPilot) & XSDRAW_SessionPilot::Pilot ()
+{
+ static Handle(XSDRAW_SessionPilot) gPilot;
+ if (gPilot.IsNull())
+ gPilot = new XSDRAW_SessionPilot;
+ return gPilot;
+}
+
+XSDRAW_SessionPilot::XSDRAW_SessionPilot ()
+: theprompt ("XSTEP-DRAW>"), thenbwords(0),
+ thewords (0,MAXWORDS-1) , thewordeb (0,MAXWORDS-1),
+ therecord (Standard_False), thenumrec (0)
+{
+ Add (1,"x");
+ Add (1,"exit");
+ Add (2,"?");
+ Add (2,"xhelp");
+ Add (3,"xcommand");
+ Add (4,"xsource");
+ Add (5,"xstep");
+ Add (6,"xnew");
+
+ Handle(IFSelect_WorkSession) WS = new IFSelect_WorkSession;
+ WS->SetVars (new XSDRAW_Vars);
+ thesession = WS;
+}
+
+
+ void XSDRAW_SessionPilot::SetCommandLine
+ (const TCollection_AsciiString& command)
+{
+ Standard_Integer lc = command.Length();
+ if (lc > 200) cout<<" Commande TRES LONGUE : "<<lc<<" caracteres :"<<endl
+ <<command.ToCString()<<endl;
+ thecommand = command;
+ if (thecommand.Value(lc) <= ' ') { thecommand.Remove(lc); lc --; }
+ thenbwords = 0;
+ Standard_Integer i, nc = 0;
+ char unarg[MAXCARS];
+ for (i = 1; i <= lc; i ++) {
+ char val = command.Value(i);
+ if (val <= ' ') {
+ if (nc == 0) continue;
+ if (thenbwords >= MAXWORDS) { unarg[nc] = val; nc ++; continue; }
+ unarg[nc] = '\0';
+ thewords(thenbwords).Clear(); thewords(thenbwords).AssignCat(unarg);
+#ifdef DEBUG_TRACE
+ cout<<"thewords("<<thenbwords<<") ="<<unarg<<endl;
+#endif
+ thenbwords ++; nc = 0;
+ continue;
+ }
+ if (nc == 0) thewordeb.SetValue (thenbwords,i);
+ if (nc > MAXCARS) { cout<<"Arg."<<thenbwords<<" > "<<MAXCARS<<" car.s, tronque"<<endl; continue; }
+ unarg[nc] = val; nc ++;
+ }
+ if (nc > 0) {
+ unarg[nc] = '\0'; thewords(thenbwords).Clear();
+ thewords(thenbwords).AssignCat(unarg);
+#ifdef DEBUG_TRACE
+ cout<<"thewords("<<thenbwords<<")="<<unarg<<endl<<" .. Fin avec thenbwords="<<thenbwords+1<<endl;
+#endif
+ thenbwords ++;
+ }
+ thenumrec = 0;
+ theobjrec.Nullify();
+}
+
+ Standard_CString XSDRAW_SessionPilot::CommandPart
+ (const Standard_Integer numarg) const
+{
+ if (numarg <= 0) return thecommand.ToCString();
+ if (numarg >= thenbwords) return "";
+ return &(thecommand.ToCString())[thewordeb(numarg)-1];
+}
+
+ const TCollection_AsciiString& XSDRAW_SessionPilot::Word
+ (const Standard_Integer num) const
+ { if (num < thenbwords) return thewords(num); return nulword; }
+
+ Standard_CString XSDRAW_SessionPilot::Arg
+ (const Standard_Integer num) const
+ { return Word(num).ToCString(); }
+
+ Standard_Boolean XSDRAW_SessionPilot::RemoveWord
+ (const Standard_Integer num)
+{
+ if (num < 0 || num > 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;
+}
+
+ Interface_ReturnStatus XSDRAW_SessionPilot::RecordItem
+ (const Handle(Standard_Transient)& item)
+{
+ theobjrec = item;
+ return (item.IsNull() ? Interface_RetFail : Interface_RetDone);
+}
+
+// #######################################################################
+// ######## CONTROLE D EXECUTION
+
+
+ Interface_ReturnStatus XSDRAW_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 "<<file<<" not found"<<endl; return Interface_RetFail; }
+ cout << " ... Reading Script File " << file << endl;
+ }
+ else fic = stdin;
+ Interface_ReturnStatus stat = Interface_RetVoid;
+
+ for (;;) {
+ char ligne[100];
+ if (!lefic) std::cout << theprompt.ToCString();
+ ligne[0] = '\0';
+ if (fgets(ligne,100,fic) == NULL
+ || feof(fic) != 0)
+ {
+ break;
+ }
+ if (ligne[0] == '\0') continue;
+// On interprete cette commande
+ TCollection_AsciiString command(ligne);
+ if (lefic) cout<<file<<":"<<command; // le return est dans la ligne ... !
+ stat = Execute(command);
+ if (stat == Interface_RetStop) break;
+ if ((stat == Interface_RetError || stat == Interface_RetFail) && lefic)
+ { cout << " ... Error in Script File, abandon"<<endl; break; }
+ }
+ if (!lefic) return Interface_RetStop;
+ fclose(fic);
+ cout<<"End of Reading Script File " << file << endl;
+ if (stat == Interface_RetError || stat == Interface_RetFail) return stat;
+ return Interface_RetVoid; // fin fichier : depiler
+}
+
+
+// On boucle sur la lecture jusqu a une commande de fin ou un EOF
+
+ Interface_ReturnStatus XSDRAW_SessionPilot::Perform ()
+{
+ Interface_ReturnStatus stat = Interface_RetVoid;
+ if (thenbwords == 0) return stat;
+ if (thewords(0).Value(1) == '#') return stat; // commentaire
+
+ theobjrec.Nullify();
+// Est-ce un nom ?
+
+// Commande pour un Acteur
+ Handle(XSDRAW_Activator) actor; Standard_Integer num;
+ if (XSDRAW_Activator::Select(thewords(0).ToCString(),num,actor)) {
+ stat = actor->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"<<endl; return Interface_RetFail; }
+ }
+
+ if (stat == Interface_RetVoid || stat == Interface_RetDone) {
+ if (therecord) thecomlist.Append(thecommand);
+ }
+ else if (stat == Interface_RetError) cout<<"Error in Command : "<<thecommand<<endl;
+ else if (stat == Interface_RetFail) cout << "Execution Failure for : " <<thecommand<<endl;
+ return stat;
+ }
+ cout << " Command : " << thewords(0) << " unknown" << endl;
+ return Interface_RetError; // pas reconnu donc incorrect
+}
+
+ Interface_ReturnStatus XSDRAW_SessionPilot::Execute
+ (const TCollection_AsciiString& command)
+{
+ SetCommandLine(command);
+ return Perform();
+}
+
+ Interface_ReturnStatus XSDRAW_SessionPilot::ExecuteCounter
+ (const Handle(IFSelect_SignCounter)& counter, const Standard_Integer numword,
+ const IFSelect_PrintCount mode)
+{
+ if (counter.IsNull()) return Interface_RetError;
+ counter->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 : "<<CommandPart(numword)<<endl;
+ return Interface_RetError;
+ }
+ counter->AddWithGraph (list,thesession->Graph());
+ }
+ counter->PrintList(Message::DefaultMessenger(),thesession->Model(),mode);
+ return Interface_RetVoid;
+}
+
+ Standard_Integer XSDRAW_SessionPilot::Number
+ (const Standard_CString val) const
+{
+ Standard_Integer num = thesession->NumberFromLabel (val);
+ if (num < 0) cout<<" Label:"<<val<<" ->"<<-num<<" ent.s, refus"<<endl;
+ return num;
+}
+
+
+// #########################################################################
+// ######## ACTIONS SPECIFIQUES DU PILOTE
+
+#define MAXCOMPERLINE 5
+#define LENGTHFORCOM 15
+
+ Interface_ReturnStatus XSDRAW_SessionPilot::Do
+ (const Standard_Integer number,
+ const Handle(XSDRAW_SessionPilot)& session)
+{
+// Commandes Propres : x, exit, undo, redo, ?, help
+ Interface_ReturnStatus stat = Interface_RetVoid;
+ Standard_Integer argc = NbWords();
+ const Standard_CString arg1 = Word(1).ToCString();
+ Standard_Integer modhelp = -1;
+ switch (number) {
+ case -1 : // **** HELP-XSNEW
+ modhelp = 1;
+ cout<<" -- Commands candidate for xsnew --"<<endl;
+// HELP : soit complet (par defaut) soit limite a xsnew
+ case 0 : { // **** HELP
+ Handle(TColStd_HSequenceOfAsciiString) list;
+// Help complet : on donne la liste des commandes, sans plus (deja pas mal)
+ if (thenbwords <= 1) {
+ list = XSDRAW_Activator::Commands(modhelp);
+ Standard_Integer nbcom = 0;
+ Standard_Integer nb = list->Length();
+ cout << " -- Liste des Commands Disponibles --"<<endl;
+ for (Standard_Integer i = 1; i <= nb; i ++) {
+ const TCollection_AsciiString& uncom = list->Value(i);
+ Standard_Integer loncom = uncom.Length();
+ nbcom ++;
+ if (nbcom > MAXCOMPERLINE) { cout<<endl; nbcom = 1; }
+ cout<<" "<<uncom;
+ if (nbcom == MAXCOMPERLINE) continue;
+ for (Standard_Integer j = loncom; j < LENGTHFORCOM; j ++) cout<<" ";
+ }
+ if (nbcom > 0) cout<<endl;
+ cout<<"\nhelp * liste toutes les commandes avec un help sur chacune\n"
+ <<"help <com> liste la ou les commande debutant par <com>"
+ <<" avec un help sur chacune"<<endl;
+
+// Un Help particulier
+ } else {
+ if (thewords(1).IsEqual("*")) list = XSDRAW_Activator::Commands(modhelp);
+
+ else list = XSDRAW_Activator::Commands(modhelp,thewords(1).ToCString());
+
+ Standard_Integer nb = list->Length();
+ for (Standard_Integer i = 1; i <= nb; i ++) {
+ Handle(XSDRAW_Activator) actor; Standard_Integer num;
+ if (XSDRAW_Activator::Select
+ (list->Value(i).ToCString(),num,actor)) {
+ if (XSDRAW_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 "<<Word(1)<<" unknown. "
+ << " help (without command) lists all the commands" << endl;
+ }
+ return Interface_RetVoid;
+ }
+ case 1 : return Interface_RetStop; // **** Fin de session
+ case 2 : { // **** HELP
+ return Do(0,this);
+ }
+ case 3 : { // **** COMMAND
+ if (argc < 2) { cout << "Donner une option :\n"
+ <<"a : analyse une ligne r : toggle record mode\n"
+ <<"l : list recorded c : clear f nom : sauver dans fichier de nom"
+ << endl; return Interface_RetVoid; }
+ switch (arg1[0]) {
+ case 'a' : { // **** command analyse
+ cout<<"Command n0 " << number <<" : "<< session->CommandLine()<<endl;
+ cout<<"Nb Words : " << argc-2 << " :\n";
+ for (Standard_Integer i = 2; i < argc; i ++) {
+ cout << " Word." << i-1 << " : " << session->Word(i) <<endl;
+ }
+ break;
+ }
+ case 'c' : session->Clear(); break; // **** command clear
+ case 'f' : {
+ if (argc < 3) { cout<<"Donner nom de fichier"<<endl; return Interface_RetError; }
+ Standard_Integer nb = session->NbCommands();
+ if (nb == 0) { cout<<"Aucune commande enregistree"<<endl; break; }
+ cout << "Nb Commandes enregistrees : " << nb <<endl;
+ ofstream fout(Word(2).ToCString(),ios::out);
+ for (Standard_Integer i = 1; i <= nb; i ++)
+ fout<<session->Command(i)<<endl;
+ break;
+ }
+ case 'l' : { // **** command list
+ if (session->RecordMode()) cout<<" -- Record Mode Actif"<<endl;
+ else cout<<" -- Record Mode Inactif"<<endl;
+ Standard_Integer nb = session->NbCommands();
+ cout << "Nb Commandes enregistrees : " << nb << " :"<<endl;
+ for (Standard_Integer i = 1; i <= nb; i ++) {
+ cout<<" "<<i<<" "<<session->Command(i)<<endl;
+ }
+ break;
+ }
+ case 'r' : { // **** command record
+ Standard_Boolean mode = session->RecordMode();
+ if (mode) cout << " -- Record Mode a present Inactif" <<endl;
+ else cout << " -- Record Mode a present Actif" <<endl;
+ session->SetRecordMode(!mode);
+ break;
+ }
+ default : cout << "Option de controle de commande non comprise"<<endl;
+ }
+ return Interface_RetVoid;
+ }
+
+ case 4 : { // **** FILE
+ if (argc < 2) { cout<<"Donner nom de fichier"<<endl; return Interface_RetError; }
+ return session->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"<<endl
+ <<"xstep command args equivaut a command args"<<endl;
+ return Do(2,this);
+ } else {
+ RemoveWord(0);
+ return Perform();
+ }
+ }
+ case 6 : { // **** XSNEW(variable)
+ if (argc < 3) {
+ cout<<"xsnew nomvar command [args] creates an item"<<endl
+ <<" nomvar : name of item (must be a new name) in the session"<<endl;
+ return Do (-1,this);
+ } else {
+
+ theobjrec.Nullify();
+ TCollection_AsciiString name = Word(1);
+// Le nom ne doit pas etre deja pris !
+ if (thesession.IsNull()) { cout<<"Command with a Name and no Session defined !"<<endl; return Interface_RetFail; }
+ RemoveWord(0); RemoveWord(0);
+
+// Commande pour un Acteur
+ Handle(XSDRAW_Activator) actor; Standard_Integer num;
+ if (XSDRAW_Activator::Select(thewords(0).ToCString(),num,actor)) {
+ theobjrec.Nullify();
+ stat = actor->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:"<<name<<", sorry"<<endl; return Interface_RetFail; }
+ }
+ else cout<<"Remark : xsnew with name:"<<name<<" and no result"<<endl;
+
+ return stat;
+ }
+ cout << " Command : " << thewords(0) << " unknown" << endl;
+ return Interface_RetError; // pas reconnu donc incorrect
+ }
+ }
+ default : return Interface_RetError;
+ }
+}
+
+
+
+ Standard_CString XSDRAW_SessionPilot::Help
+ (const Standard_Integer number) const
+{
+ switch (number) {
+ case 1 : return "exit ou x : Fin de session";
+ case 2 : return "Liste les commandes. ? <titre> : commandes debutant par <titre>";
+ 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 "";
+ }
+}
--- /dev/null
+// 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 _XSDRAW_SessionPilot_HeaderFile
+#define _XSDRAW_SessionPilot_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <TCollection_AsciiString.hxx>
+#include <TColStd_Array1OfAsciiString.hxx>
+#include <TColStd_Array1OfInteger.hxx>
+#include <TColStd_SequenceOfAsciiString.hxx>
+#include <Interface_ReturnStatus.hxx>
+#include <IFSelect_PrintCount.hxx>
+#include <XSDRAW_Activator.hxx>
+class IFSelect_SignCounter;
+class IFSelect_WorkSession;
+
+
+class XSDRAW_SessionPilot;
+DEFINE_STANDARD_HANDLE(XSDRAW_SessionPilot, XSDRAW_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 XSDRAW_SessionPilot : public XSDRAW_Activator
+{
+ public:
+
+ //! Returns a unique static pilot
+ Standard_EXPORT static const Handle(XSDRAW_SessionPilot) & Pilot();
+
+ //! 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
+ //! <numarg> 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
+ //! <num> 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 Interface_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 <file>. 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 Interface_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 Interface_ReturnStatus Perform();
+
+ //! Sets the Command then tries to execute it. Return value :
+ //! same as for Perform
+ Standard_EXPORT Interface_ReturnStatus Execute (const TCollection_AsciiString& command);
+
+ //! Executes a Counter in a general way
+ //! If <numword> is greater than count of command words, it counts
+ //! all the model. Else it considers the word <numword> as the
+ //! identifier of a Selection
+ //! <mode> gives the mode of printing results, default is
+ //! CountByItem
+ Standard_EXPORT Interface_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 Interface_ReturnStatus Do (const Standard_Integer number, const Handle(XSDRAW_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(XSDRAW_SessionPilot,XSDRAW_Activator)
+
+ private:
+
+ //! Creates an empty SessionPilot, with a prompt which will be displayed on querying commands.
+ Standard_EXPORT XSDRAW_SessionPilot();
+
+ 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 // _XSDRAW_SessionPilot_HeaderFile
#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
#include <Geom_Geometry.hxx>
-#include <IFSelect_CheckCounter.hxx>
-#include <IFSelect_SessionPilot.hxx>
#include <Interface_CheckIterator.hxx>
#include <Interface_InterfaceModel.hxx>
#include <Interface_Macros.hxx>
+#include <IFSelect_Vars.hxx>
+#include <IFSelect_CheckCounter.hxx>
#include <Message.hxx>
#include <Message_Messenger.hxx>
#include <ShapeExtend_Explorer.hxx>
#include <Transfer_Binder.hxx>
#include <Transfer_Finder.hxx>
#include <Transfer_FinderProcess.hxx>
+#include <Transfer_ResultFromModel.hxx>
+#include <Transfer_ResultFromTransient.hxx>
#include <Transfer_SimpleBinderOfTransient.hxx>
#include <Transfer_TransientListBinder.hxx>
#include <Transfer_TransientProcess.hxx>
#include <TransferBRep_ShapeBinder.hxx>
#include <TransferBRep_ShapeListBinder.hxx>
#include <TransferBRep_ShapeMapper.hxx>
-#include <XSControl_ConnectedShapes.hxx>
#include <XSControl_Controller.hxx>
-#include <XSControl_TransferReader.hxx>
-#include <XSControl_TransferWriter.hxx>
-#include <XSControl_Vars.hxx>
-#include <XSControl_WorkSession.hxx>
+#include <IFSelect_WorkSession.hxx>
+#include <XSControl_Writer.hxx>
+#include <XSSelect_ConnectedShapes.hxx>
#include <XSDRAW.hxx>
#include <XSDRAW_SelectFunctions.hxx>
#include <XSDRAW_ShapeFunctions.hxx>
+#include <XSDRAW_SessionPilot.hxx>
#include <stdio.h>
//function : XSControl_tpdraw
//purpose :
//=======================================================================
-static Handle(XSControl_Vars) GetXSControlVars (const Handle(IFSelect_SessionPilot)& pilot)
+static Handle(IFSelect_Vars) GetXSControlVars (const Handle(XSDRAW_SessionPilot)& pilot)
{
- static const Handle(XSControl_Vars) avars;
- Handle(XSControl_WorkSession) WS = XSDRAW::Session(pilot);
+ static const Handle(IFSelect_Vars) avars;
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
return (WS.IsNull()? avars : WS->Vars());
}
//function : XSControl_tpdraw
//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_tpdraw
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus XSControl_tpdraw
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
const Standard_CString arg2 = pilot->Arg(2);
const Standard_CString arg3 = pilot->Arg(3);
- const Handle(Transfer_TransientProcess) &TP = XSDRAW::Session(pilot)->TransferReader()->TransientProcess();
+ const Handle(Transfer_TransientProcess) &TP = XSDRAW::Session(pilot)->ReaderProcess();
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (TP.IsNull()) { sout<<"No Transfer Read"<<endl; return IFSelect_RetError;}
+ if (TP.IsNull()) { sout<<"No Transfer Read"<<endl; return Interface_RetError;}
// **** tpdraw ****
if (argc < 2) {
sout<<"Donner [mode facultatif : item ou root] , NUMERO , nom DRAW facultatif"<<endl;
sout<<" mode si present : item ou root, sinon n0 d entite modele"<<endl;
sout<<" NUMERO entier : d entite, d item transfert ou de root transfert\n"
<< " ou * pour dire tous"<<endl;
- return IFSelect_RetError;
+ return Interface_RetError;
}
Standard_Integer mode = 0, num=0;
if (arg1[0] == 'i') mode = 1;
else if (arg1[0] == 'r') mode = 2;
Standard_Boolean tout = Standard_False;
if (mode == 0) {
- if (argc < 2) { sout<<"Donner au moins un NUMERO ou *"<<endl; return IFSelect_RetError; }
+ if (argc < 2) { sout<<"Donner au moins un NUMERO ou *"<<endl; return Interface_RetError; }
if (arg1[0] == '*') tout = Standard_True;
else num = XSDRAW_SelectFunctions::GiveEntityNumber(XSDRAW::Session(pilot),arg1);
} else {
if (model.IsNull()) {
if (mode == 0) {
sout<<"Pas de modele, preciser n0 d item de transfert"<<endl;
- return IFSelect_RetError;
+ return Interface_RetError;
}
}
if (mode == 0) { sout<<"Entite de modele"; max = model->NbEntities(); }
}
else if (num <= 0 || num > max) {
sout<<" - Num="<<num<<" hors limite (de 1 a "<<max<<")"<<endl;
- return IFSelect_RetError;
+ return Interface_RetError;
} else {
n1 = n2 = num; nbvar = -1; // nbvar : 1ere shape simple = pas de n0
sout<<", n0 "<<num<<endl;
}
if (sh.IsNull()) sout<<" (No Shape)"<<endl;
- return IFSelect_RetDone;
+ return Interface_RetDone;
}
//=======================================================================
//function : XSControl_tpcompound
//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_tpcompound
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus XSControl_tpcompound
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
- const Handle(Transfer_TransientProcess) &TP = XSDRAW::Session(pilot)->TransferReader()->TransientProcess();
+ const Handle(Transfer_TransientProcess) &TP = XSDRAW::Session(pilot)->ReaderProcess();
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (TP.IsNull()) { sout<<"No Transfer Read"<<endl; return IFSelect_RetError;}
+ if (TP.IsNull()) { sout<<"No Transfer Read"<<endl; return Interface_RetError;}
// **** tpcompound ****
- if (argc < 2) { sout<<"Give a NAME for the Compound + optional givelist, else roots are taken"<<endl; return IFSelect_RetError; }
+ if (argc < 2) { sout<<"Give a NAME for the Compound + optional givelist, else roots are taken"<<endl; return Interface_RetError; }
Handle(TopTools_HSequenceOfShape) list;
if (argc == 2) list = TransferBRep::Shapes(TP);
else {
Handle(TColStd_HSequenceOfTransient) lise = XSDRAW_SelectFunctions::GiveList(pilot->Session(),pilot->CommandPart(2));
- if (lise.IsNull()) { sout<<"Not a valid entity list : "<<pilot->CommandPart(2)<<endl; return IFSelect_RetError; }
+ if (lise.IsNull()) { sout<<"Not a valid entity list : "<<pilot->CommandPart(2)<<endl; return Interface_RetError; }
list = TransferBRep::Shapes (TP,lise);
sout<<lise->Length()<<" Entities, ";
}
- if (list.IsNull()) { sout<<"No Shape listed"<<endl; return IFSelect_RetError; }
+ if (list.IsNull()) { sout<<"No Shape listed"<<endl; return Interface_RetError; }
Standard_Integer nb = list->Length();
sout<<nb<<" Shape(s) listed"<<endl;
TopoDS_Compound C;
B.MakeCompound(C);
for (Standard_Integer i = 1; i <= nb; i ++) B.Add (C,list->Value(i));
GetXSControlVars(pilot)->SetShape (arg1,C);
- return IFSelect_RetDone;
+ return Interface_RetDone;
}
//function : XSControl_traccess
//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_traccess
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus XSControl_traccess
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
const Standard_CString arg2 = pilot->Arg(2);
- // **** trdraw : TransferReader **** 26
- // **** trsave : TransferReader **** 27
+ // **** trdraw : ReaderProcess **** 26
+ // **** trsave : ReaderProcess **** 27
// **** trcomp (comp -> DRAW) **** 28
// **** trscomp (comp -> save) **** 29
Standard_Boolean cascomp = (pilot->Word(0).Location(1,'o',1,5) > 0);
Standard_Boolean cassave = (pilot->Word(0).Location(1,'s',1,5) > 0);
char nomsh[100], noms[100];
- const Handle(XSControl_TransferReader) &TR = XSDRAW::Session(pilot)->TransferReader();
+ const Handle(Transfer_TransientProcess) &TP = XSDRAW::Session(pilot)->ReaderProcess();
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (TR.IsNull()) { sout<<" manque init"<<endl; return IFSelect_RetError; }
- const Handle(Interface_InterfaceModel) &mdl = TR->Model();
- if (mdl.IsNull()) { sout<<" modele absent"<<endl; return IFSelect_RetError; }
+ if (TP.IsNull()) { sout<<" manque init"<<endl; return Interface_RetError; }
+ const Handle(Interface_InterfaceModel) &mdl = TP->Model();
+ if (mdl.IsNull()) { sout<<" modele absent"<<endl; return Interface_RetError; }
Standard_Integer num = (argc > 1 ? XSDRAW_SelectFunctions::GiveEntityNumber(XSDRAW::Session(pilot),arg1) : 0);
if (argc > 1) strcpy (nomsh,arg1);
BRep_Builder B;
B.MakeCompound(C);
- const Handle(TopTools_HSequenceOfShape) &list = TR->ShapeResultList(Standard_True);
- Standard_Integer i, nb = list->Length();
+ Handle(TopTools_HSequenceOfShape) list = new TopTools_HSequenceOfShape();
+ Handle(TColStd_HSequenceOfTransient) li = TP->RecordedList();
+ Standard_Integer i, nb = mdl->NbEntities();
+ TopoDS_Shape sh;
+ for (i = 1; i <= nb; i ++) {
+ sh = TP->ShapeResult (mdl->Value(i));
+ if (!sh.IsNull()) list->Append(sh);
+ }
+
+ nb = list->Length();
sout<<" TOUS RESULTATS par ShapeResultList, soit "<<nb<<endl;
for (i = 1; i <= nb; i ++) {
sprintf (noms,"%s_%d",nomsh,i);
if (cascomp && !cassave) GetXSControlVars(pilot)->SetShape(nomsh,C);
else if (cascomp && cassave) BRepTools::Write (C,nomsh);
} else {
- if (num < 1 || num > mdl->NbEntities()) { sout<<" incorrect:"<<arg1<<endl; return IFSelect_RetError; }
- TopoDS_Shape sh = TR->ShapeResult(mdl->Value(num));
- if (sh.IsNull()) { sout<<" Pas de resultat pour "<<arg1<<endl; return IFSelect_RetError; }
+ if (num < 1 || num > mdl->NbEntities()) { sout<<" incorrect:"<<arg1<<endl; return Interface_RetError; }
+ TopoDS_Shape sh = TP->ShapeResult(mdl->Value(num));
+ if (sh.IsNull()) { sout<<" Pas de resultat pour "<<arg1<<endl; return Interface_RetError; }
if (argc > 2) sprintf (nomsh,"%s",arg2);
else sprintf (nomsh,"TREAD_%d",num);
if (!cascomp && !cassave) GetXSControlVars(pilot)->SetShape(nomsh,sh);
else if (!cascomp && cassave) BRepTools::Write (sh,nomsh);
else sout<<"Option non comprise"<<endl;
}
- return IFSelect_RetDone;
+ return Interface_RetDone;
}
//=======================================================================
//function : XSControl_fromshape
//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_fromshape
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus XSControl_fromshape
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
Handle(Message_Messenger) sout = Message::DefaultMessenger();
if (argc < 2) {
sout<<"Give name of a DRAW Shape"<<endl;
- return IFSelect_RetError;
+ return Interface_RetError;
}
const char* a1 = (char *)arg1;
TopoDS_Shape Shape = GetXSControlVars(pilot)->GetShape(a1);
if (Shape.IsNull()) {
sout<<"Not a DRAW Shape:"<<arg1<<endl;
- return IFSelect_RetError;
+ return Interface_RetError;
}
Standard_Boolean yena = Standard_False;
Standard_Integer aLevel = 1;
silent = Standard_True;
aLevel = -aLevel;
}
-
+
// IMPORT
- const Handle(XSControl_TransferReader) &TR = XSDRAW::Session(pilot)->TransferReader();
- if (TR.IsNull()) { } // sout<<"No read transfer (import) recorded"<<endl;
+ const Handle(Transfer_TransientProcess) &TP = XSDRAW::Session(pilot)->ReaderProcess();
+ if (TP.IsNull()) { }
else {
yena = Standard_True;
if ( ! silent ) sout<<"Shape "<<arg1<<" : ";
Standard_Integer modrec = 1;
- Handle(Standard_Transient) ent = TR->EntityFromShapeResult (Shape,modrec);
+ Handle(Standard_Transient) ent = TP->EntityFromShapeResult (Shape,modrec);
if (ent.IsNull()) {
modrec = -1;
- ent = TR->EntityFromShapeResult (Shape,modrec);
+ ent = TP->EntityFromShapeResult (Shape,modrec);
}
if (ent.IsNull()) {
modrec = 2;
- Handle(Transfer_TransientProcess) TP = TR->TransientProcess();
- if (TP.IsNull()) {
- if ( silent )
- sout << "Shape "<<arg1<<" : ";
- sout<<"no map"<<endl;
- }
- else {
- TopoDS_Shape S0 = Shape;
- TopLoc_Location L;
- S0.Location ( L );
- Standard_Integer i, nb = TP->NbMapped();
- if ( ! silent ) sout<<"searching in map among "<<nb<<" ...";
- for (i = 1; i <= nb; i ++) {
- ent = TP->Mapped(i);
- TopoDS_Shape sh = TransferBRep::ShapeResult(TP,ent);
- if (sh.IsNull()) {
- ent.Nullify();
- continue;
- }
- if (XSControl_IsEqualSubShape(Shape, sh, aLevel)) break;
- modrec = -2;
- sh.Location ( L );
- if (XSControl_IsEqualSubShape(S0, sh, aLevel)) break;
- ent.Nullify();
- modrec = 2;
- }
+ TopoDS_Shape S0 = Shape;
+ TopLoc_Location L;
+ S0.Location ( L );
+ Standard_Integer i, nb = TP->NbMapped();
+ if ( ! silent ) sout<<"searching in map among "<<nb<<" ...";
+ for (i = 1; i <= nb; i ++) {
+ ent = TP->Mapped(i);
+ TopoDS_Shape sh = TransferBRep::ShapeResult(TP,ent);
+ if (sh.IsNull()) {
+ ent.Nullify();
+ continue;
+ }
+ if (XSControl_IsEqualSubShape(Shape, sh, aLevel)) break;
+ modrec = -2;
+ sh.Location ( L );
+ if (XSControl_IsEqualSubShape(S0, sh, aLevel)) break;
+ ent.Nullify();
+ modrec = 2;
}
}
if ( ! ent.IsNull() ) {
if ( silent ) sout << "Shape " << arg1 << ": ";
if (modrec <0) sout<<"(moved from origin) ";
- //else sout<<"(origin) ";
}
// on affiche
if (ent.IsNull()) {
TopoDS_Iterator Iter(Shape);
for (; Iter.More(); Iter.Next()) {
TopoDS_Shape subsh = Iter.Value();
- Standard_Integer submodrec = 1;
- Handle(Standard_Transient) subent = TR->EntityFromShapeResult(subsh,submodrec);
- if (subent.IsNull()) {
- submodrec = -1;
- subent = TR->EntityFromShapeResult(subsh,submodrec);
- }
+ Handle(Standard_Transient) subent = TP->EntityFromShapeResult(subsh,1);
+ if (subent.IsNull())
+ subent = TP->EntityFromShapeResult(subsh,-1);
if (!subent.IsNull()) {
sout<<" "<<XSDRAW::Session(pilot)->Model()->Number(subent);
}
}
// ET EN EXPORT ?
- const Handle(Transfer_FinderProcess) &FP = XSDRAW::Session(pilot)->TransferWriter()->FinderProcess();
+ const Handle(Transfer_FinderProcess) &FP = XSDRAW::Session(pilot)->WriterProcess();
if (FP.IsNull()) { }
else {
yena = Standard_True;
}
if (!yena) sout<<"No transfer (either import or export) recorded"<<endl;
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
//=======================================================================
//function : XSControl_trconnexentities
//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_trconnexentities
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus XSControl_trconnexentities
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
// **** connected entities (last transfer) ****
- const Handle(XSControl_TransferReader) &TR = XSDRAW::Session(pilot)->TransferReader();
- Handle(Transfer_TransientProcess) TP;
- if (!TR.IsNull()) TP = TR->TransientProcess();
+ const Handle(Transfer_TransientProcess) &TP = XSDRAW::Session(pilot)->ReaderProcess();
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (TP.IsNull()) { sout<<"no transfer map"<<endl; return IFSelect_RetVoid; }
+ if (TP.IsNull()) { sout<<"no transfer map"<<endl; return Interface_RetVoid; }
if (argc < 2) {
sout<<"Give name of a DRAW Shape + optional shape type v-e-w-f(D)-s"<<endl;
- return IFSelect_RetError;
+ return Interface_RetError;
}
const char* a1 = (const char *)arg1;
TopoDS_Shape Shape = GetXSControlVars(pilot)->GetShape(a1);
- if (Shape.IsNull()) { sout<<"Not a DRAW Shape:"<<arg1<<endl; return IFSelect_RetError; }
+ if (Shape.IsNull()) { sout<<"Not a DRAW Shape:"<<arg1<<endl; return Interface_RetError; }
sout<<"Shape "<<arg1<<" : ";
Handle(TColStd_HSequenceOfTransient) list =
- XSControl_ConnectedShapes::AdjacentEntities (Shape,TP,TopAbs_FACE);
+ XSSelect_ConnectedShapes::AdjacentEntities (Shape,TP,TopAbs_FACE);
Standard_Integer i, nb = list->Length();
sout<<nb<<" Entities produced Connected Shapes :"<<endl;
const Handle(Interface_InterfaceModel) &model = XSDRAW::Session(pilot)->Model();
sout<<model->Number(list->Value(i));
}
sout<<")"<<endl;
- return IFSelect_RetDone;
+ return Interface_RetDone;
}
//=======================================================================
//function : XSControl_trimport
//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_trimport
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus XSControl_trimport
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
// FileName ou . (pour courant) VarName GiveList (obligatoire)
// GiveList : * pour xst-transferrable-roots
- Handle(XSControl_WorkSession) WS = XSDRAW::Session(pilot);
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
Standard_Integer argc = pilot->NbWords();
Handle(Message_Messenger) sout = Message::DefaultMessenger();
if (argc < 4) {
sout<<"Give : filename or . for current model; varname or . to take fileroot\n GiveList, * for all transferrable roots"<<endl;
- return IFSelect_RetError;
+ return Interface_RetError;
}
const Standard_CString arg1 = pilot->Arg(1);
const Standard_CString arg2 = pilot->Arg(2);
if (modfic) {
TCollection_AsciiString comload ("xload ");
comload.AssignCat(arg1);
- IFSelect_ReturnStatus status = pilot->Execute(comload);
- if (status != IFSelect_RetDone)
+ Interface_ReturnStatus status = pilot->Execute(comload);
+ if (status != Interface_RetDone)
{ sout<<"Abandon import"<<endl; return status; }
} else {
sout<<"Currently Loaded Model"<<endl;
sout<<"List given by "<<compart.ToCString()<<" : ";
list = WS->GiveList (compart.ToCString());
}
- if (list.IsNull()) { sout<<"No list defined. Abandon"<<endl; return IFSelect_RetError; }
+ if (list.IsNull()) { sout<<"No list defined. Abandon"<<endl; return Interface_RetError; }
Standard_Integer nbl = list->Length();
sout<<"Nb entities selected : "<<nbl<<endl;
// Starting Transfer
WS->InitTransferReader (0);
- const Handle(XSControl_TransferReader) &TR = WS->TransferReader();
- if (TR.IsNull()) { sout<<" init not done or failed"<<endl; return IFSelect_RetError; }
+ WS->InitTransferReader (4);
- TR->BeginTransfer();
+ const Handle(Transfer_TransientProcess) &TP = WS->ReaderProcess();
+ if (TP.IsNull()) { sout<<" init not done or failed"<<endl; return Interface_RetError; }
// Transferring
- Standard_Integer nbt = TR->TransferList(list);
+ Standard_Integer nbt = WS->TransferList(list);
sout<<"Nb Entities Selected : "<<nbl<<" have given "<<nbt<<" results"<<endl;
// Filling VARS. one compound (trimpcomp) or one shape per ent (trimport)
TopoDS_Compound C;
BRep_Builder B;
B.MakeCompound (C);
- Handle(Interface_InterfaceModel) mdl = TR->Model();
- if (mdl.IsNull()) { sout<<" modele absent"<<endl; return IFSelect_RetError; }
+ const Handle(Interface_InterfaceModel) &mdl = TP->Model();
+ if (mdl.IsNull()) { sout<<" modele absent"<<endl; return Interface_RetError; }
for (Standard_Integer il= 1; il <= nbl; il ++) {
Handle(Standard_Transient) ent = list->Value(il);
- sh = TR->ShapeResult(ent);
+ sh = TP->ShapeResult(ent);
if (sh.IsNull()) continue;
nbs ++;
if (iscomp) B.Add (C,sh);
sout<<nbs<<" Shapes, named "<<rnom.ToCString()<<"_1 to "<<rnom.ToCString()<<"_"<<nbs<<endl;
}
- return IFSelect_RetDone;
+ return Interface_RetDone;
+}
+
+//=======================================================================
+//function : twmode
+//=======================================================================
+static Standard_Integer gWriteMode = 0;
+static Interface_ReturnStatus XSControl_twmode(const Handle(XSDRAW_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ // **** twmode ****
+ Handle(Transfer_Process::Actor) anActor = pilot->Session()->WriterProcess()->GetActor();
+ if (anActor.IsNull())
+ {
+ const Handle(XSControl_Controller) &aCtl = pilot->Session()->NormAdaptor();
+ if (aCtl.IsNull()) return Interface_RetError;
+
+ anActor = aCtl->NewActorWrite();
+ pilot->Session()->WriterProcess()->SetActor(anActor);
+ }
+ Standard_Integer modemin,modemax;
+ const Standard_Boolean bset = anActor->TransferModeBounds(modemin,modemax);
+ const Handle(Message_Messenger) &sout = Message::DefaultMessenger();
+ if (bset) {
+ sout<<"Write Mode : allowed values "<<modemin<<" to "<<modemax<<endl;
+ for (Standard_Integer modd = modemin; modd <= modemax; modd++)
+ sout<<modd<<" : "<<anActor->TransferModeHelp(modd)<<endl;
+ }
+ sout<<"Write Mode : actual = "<<gWriteMode<<endl;
+ if (argc <= 1) return Interface_RetVoid;
+ Standard_Integer mod = atoi(arg1);
+ sout<<"New value -> "<<arg1<<endl;
+ gWriteMode = mod;
+ if (bset && (gWriteMode < modemin || gWriteMode > modemax)) sout<<"Warning : this new value is not supported"<<endl;
+ return Interface_RetDone;
}
//=======================================================================
//function : XSControl_twrite
//purpose :
//=======================================================================
-static IFSelect_ReturnStatus XSControl_twrite
- (const Handle(IFSelect_SessionPilot)& pilot)
+static Interface_ReturnStatus XSControl_twrite
+ (const Handle(XSDRAW_SessionPilot)& pilot)
{
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
// **** twrite ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- Handle(XSControl_TransferWriter) TW = XSDRAW::Session(pilot)->TransferWriter();
- if (argc < 2) { sout<<" donner nom de shape draw"<<endl; return IFSelect_RetError; }
+ if (argc < 2) { sout<<" donner nom de shape draw"<<endl; return Interface_RetError; }
sout<<"Attention, on alimente le modele courant ..."<<endl;
+ XSControl_Writer aWriter(XSDRAW::Session(pilot));
// Shape
for (Standard_Integer i = 1; i < argc; i ++) {
const char* ai = (const char *)pilot->Arg(i);
TopoDS_Shape Shape = GetXSControlVars(pilot)->GetShape(ai);
if (Shape.IsNull()) { sout<<"pas un nom de shape draw:"<<arg1<<endl; continue; }
sout<<"Pour Shape : "<<ai;
- Standard_Integer stat = TW->TransferWriteShape (XSDRAW::Session(pilot)->Model(),Shape);
+ Interface_ReturnStatus stat = aWriter.TransferShape(Shape,Standard_False);
sout<<" Transfer Write Status = "<<stat<<endl;
}
pilot->Session()->ComputeGraph();
// Transient ? (Geom) : ignore
- return IFSelect_RetDone;
+ return Interface_RetDone;
}
// ######################################################################
XSDRAW::AddFunc ("trimport","filename or . varname givelist -> 1 shape per entity",XSControl_trimport);
XSDRAW::AddFunc ("trimpcomp","filename or . varname givelist -> one xcompound",XSControl_trimport);
+ XSDRAW::AddFunc ("twmode","displays mode transfer write, + num changes it",XSControl_twmode);
XSDRAW::AddFunc ("twrite","shape : transfer write for this shape, AFTER newmodel !",XSControl_twrite);
}
// ######################################################################
-//=======================================================================
-//function : MoreShapes
-//purpose :
-//=======================================================================
-
-Standard_Integer XSDRAW_ShapeFunctions::MoreShapes
- (const Handle(XSControl_WorkSession)& session,
- Handle(TopTools_HSequenceOfShape)& list, const Standard_CString name)
-{
- // name = un nom -> Draw
- // name = "*" -> tous les transferts RACINES du TP
- // name = "**" -> tous les transferts du TP : VRAIMENT TOUS
- // name = "." -> reperage graphique (not yet impl)
- // name = nom(n1-n2) avec n1,n2 entiers : les variables de nom nomn1 a nomn2
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (list.IsNull()) list = new TopTools_HSequenceOfShape();
- if (name[0] == '*' && (name[1] == '\0' || (name[1] == '*' && name[2] == '\0'))) {
- const Handle(Transfer_TransientProcess) &TP = session->TransferReader()->TransientProcess();
- if (TP.IsNull()) { sout<<"last transfer : unknown"<<endl;return 0; }
- Handle(TopTools_HSequenceOfShape) li = TransferBRep::Shapes(TP,(name[1] == '\0'));
- if (li.IsNull()) return 0;
- list->Append (li);
- return li->Length();
- }
- Standard_Integer i, paro = 0, parf = 0, moins = 0, n1 = 0, n2 = 0;
- for (i = 0; name[i] != '\0'; i ++) {
- if (name[i] == '(') paro = i;
- if (name[i] == '-') moins = i;
- if (name[i] == ')') parf = i;
- }
- if (paro && moins && parf) {
- n2 = atoi (&name[moins+1]);
- n1 = atoi (&name[paro +1]); if (n1 < 0) n1 += n2; // sinon on a n1-n2
- }
- // liste
- if (n1 <= n2 && n1 > 0) {
- char nom[50], nomsh[60]; Standard_Integer nbsh = 0;
- for (i = 0; i < paro; i ++) nom[i]=name[i]; nom[paro] = '\0';
- sout<<"Shapes DRAW named : "<<nom<<n1<<" to "<<nom<<n2;
- for (i = n1; i <= n2 ; i ++) {
- const char* nomshh = &nomsh[0];
- sprintf (nomsh,"%s%d",nom,i);
- TopoDS_Shape Shape = session->Vars()->GetShape(nomshh);
- if (Shape.IsNull()) continue;
- list->Append(Shape);
- nbsh ++;
- }
- sout<<" -> taken "<<nbsh<<" Shapes"<<endl;
- return nbsh;
- }
- const char* a1 = (const char *)name;
- TopoDS_Shape Shape = session->Vars()->GetShape(a1);
- if (Shape.IsNull()) { sout<<"not a shape draw:"<<a1<<endl; return 0; }
- list->Append(Shape);
- return 1;
-}
-
-
//=======================================================================
//function : FileAndVar
//purpose :
//! Defines and loads all functions which work on shapes for XSDRAW (as ActFunc)
Standard_EXPORT static void Init();
- //! Analyses a name as designating Shapes from a Vars or from
- //! XSTEP transfer (last Transfer on Reading). <name> can be :
- //! "*" : all the root shapes produced by last Transfer (Read)
- //! i.e. considers roots of the TransientProcess
- //! a name : a name of a variable DRAW
- //!
- //! Returns the count of designated Shapes. Their list is put in
- //! <list>. If <list> is null, it is firstly created. Then it is
- //! completed (Append without Clear) by the Shapes found
- //! Returns 0 if no Shape could be found
- Standard_EXPORT static Standard_Integer MoreShapes (const Handle(XSControl_WorkSession)& session, Handle(TopTools_HSequenceOfShape)& list, const Standard_CString name);
-
//! Analyses given file name and variable name, with a default
//! name for variables. Returns resulting file name and variable
//! name plus status "file to read"(True) or "already read"(False)
#include <TopoDS_Shape.hxx>
#include <XSDRAW_Vars.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(XSDRAW_Vars,XSControl_Vars)
+IMPLEMENT_STANDARD_RTTIEXT(XSDRAW_Vars,IFSelect_Vars)
void XSDRAW_Vars::Set
(const Standard_CString name,
#include <Standard.hxx>
#include <Standard_Type.hxx>
-#include <XSControl_Vars.hxx>
+#include <IFSelect_Vars.hxx>
class Geom_Geometry;
class Geom2d_Curve;
class Geom_Curve;
class XSDRAW_Vars;
-DEFINE_STANDARD_HANDLE(XSDRAW_Vars, XSControl_Vars)
+DEFINE_STANDARD_HANDLE(XSDRAW_Vars, IFSelect_Vars)
//! Vars for DRAW session (i.e. DBRep and DrawTrSurf)
-class XSDRAW_Vars : public XSControl_Vars
+class XSDRAW_Vars : public IFSelect_Vars
{
public:
Standard_EXPORT virtual TopoDS_Shape GetShape (Standard_CString& name) const Standard_OVERRIDE;
- DEFINE_STANDARD_RTTIEXT(XSDRAW_Vars,XSControl_Vars)
+ DEFINE_STANDARD_RTTIEXT(XSDRAW_Vars,IFSelect_Vars)
};
#endif // _XSDRAW_Vars_HeaderFile
XSDRAWIGES.cxx
XSDRAWIGES.hxx
-XSDRAWIGES_Activator.cxx
-XSDRAWIGES_Activator.hxx
#include <Draw_Appli.hxx>
#include <Draw_ProgressIndicator.hxx>
#include <DrawTrSurf.hxx>
+#include <Dico_DictionaryOfInteger.hxx>
+#include <Dico_DictionaryOfTransient.hxx>
+#include <Dico_IteratorOfDictionaryOfInteger.hxx>
+#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
#include <IGESControl_Controller.hxx>
#include <IGESData_IGESModel.hxx>
#include <IGESData_Protocol.hxx>
#include <IGESToBRep.hxx>
-#include <IGESToBRep_Actor.hxx>
#include <IGESToBRep_Reader.hxx>
#include <Interface_Check.hxx>
#include <Interface_CheckIterator.hxx>
#include <Interface_Macros.hxx>
#include <Interface_Static.hxx>
#include <Message.hxx>
+#include <Message_Msg.hxx>
#include <Message_Messenger.hxx>
#include <Message_ProgressSentry.hxx>
#include <Standard_ErrorHandler.hxx>
#include <TopoDS_Shape.hxx>
#include <Transfer_FinderProcess.hxx>
#include <Transfer_TransientProcess.hxx>
-#include <XSControl_WorkSession.hxx>
-#include <XSControl_TransferReader.hxx>
+#include <IFSelect_WorkSession.hxx>
#include <XSDRAW.hxx>
#include <XSDRAW_Commands.hxx>
#include <XSDRAW_SelectFunctions.hxx>
#include <XSDRAWIGES.hxx>
-#include <XSDRAWIGES_Activator.hxx>
#include <stdio.h>
-// #include <IGESData_IGESWriter.hxx>
-// pour igeslist
-//#include <GeometryTest.hxx> essai CKY 4-AUT-1998
-//#include <BRepTest.hxx> essai CKY 4-AUT-1998
-//#include <MeshTest.hxx> essai CKY 4-AUT-1998
-// Init functions
-// + tplosttrim
+
//--------------------------------------------------------------
// Function : igesbrep
//--------------------------------------------------------------
Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
progress->SetScale ( 0, 100, 1 );
progress->Show();
-
- IGESControl_Reader Reader (XSDRAW::Session(),Standard_False);
- Standard_Boolean aFullMode = Standard_True;
- Reader.WS()->SetModeStat(aFullMode);
+
+ const Handle(IFSelect_WorkSession) &WS = XSDRAW::Session();
+
+ IGESControl_Reader Reader (WS,Standard_False);
+ WS->SetModeStat(Standard_True);
if (ctl.IsNull())
ctl=Handle(IGESControl_Controller)::DownCast(XSDRAW::Controller());
if (modfic) di<<" File IGES to read : "<<fnom.ToCString()<<"\n";
else di<<" Model taken from the session : "<<fnom.ToCString()<<"\n";
di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom.ToCString()<<"\n";
- IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
+ Interface_ReturnStatus readstat = Interface_RetVoid;
#ifdef CHRONOMESURE
OSD_Timer Chr; Chr.Reset();
progress->Show();
if (modfic) readstat = Reader.ReadFile (fnom.ToCString());
- else if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
+ else if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = Interface_RetDone;
progress->EndScope();
progress->Show();
- if (readstat != IFSelect_RetDone) {
+ if (readstat != Interface_RetDone) {
if (modfic) di<<"Could not read file "<<fnom.ToCString()<<" , abandon\n";
else di<<"No model loaded\n";
return 1;
di << "All Geometry Transfer\n";
di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)\n";
di<<" To modify : command param read.iges.bspline.continuity\n";
- Handle(XSControl_WorkSession) thesession = Reader.WS();
- thesession->TransferReader()->Context().Nullify();
- XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
+ XSDRAW::SetTransferProcess (WS->ReaderProcess());
progress->NewScope ( 80, "Translation" );
progress->Show();
- thesession->TransferReader()->TransientProcess()->SetProgress ( progress );
+ WS->ReaderProcess()->SetProgress ( progress );
if (modepri == 1) Reader.SetReadVisible (Standard_True);
Reader.TransferRoots();
- thesession->TransferReader()->TransientProcess()->SetProgress ( 0 );
+ WS->ReaderProcess()->SetProgress ( 0 );
progress->EndScope();
progress->Show();
// result in only one shape for all the roots
cout << " give the number of the Entity : " << flush;
nent = XSDRAW::GetEntityNumber();
- if (!Reader.TransferOne (nent)) di<<"Transfer entity n0 "<<nent<<" : no result\n";
+ if (!Reader.TransferEntity (WS->StartingEntity(nent))) di<<"Transfer entity n0 "<<nent<<" : no result\n";
else {
nbs = Reader.NbShapes();
char shname[30]; Sprintf (shname,"%s_%d",rnom.ToCString(),nent);
di << "All Geometry Transfer\n";
di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)\n";
di<<" To modify : command param read.iges.bspline.continuity\n";
- Handle(XSControl_WorkSession) thesession = Reader.WS();
- thesession->TransferReader()->Context().Nullify();
- XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
+ XSDRAW::SetTransferProcess (WS->ReaderProcess());
progress->NewScope ( 80, "Translation" );
progress->Show();
- thesession->TransferReader()->TransientProcess()->SetProgress ( progress );
+ WS->ReaderProcess()->SetProgress ( progress );
Reader.SetReadVisible (Standard_True);
Reader.TransferRoots();
- thesession->TransferReader()->TransientProcess()->SetProgress ( 0 );
+ WS->ReaderProcess()->SetProgress ( 0 );
progress->EndScope();
progress->Show();
}
if (answer == 1 || answer == 2) {
Standard_Integer nbt = 0;
- Handle(XSControl_WorkSession) thesession = Reader.WS();
- XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
+ XSDRAW::SetTransferProcess (WS->ReaderProcess());
progress->NewScope ( 80, "Translation" );
progress->Show();
- thesession->TransferReader()->TransientProcess()->SetProgress ( progress );
+ WS->ReaderProcess()->SetProgress ( progress );
Message_ProgressSentry PSentry ( progress, "Root", 0, nbl, 1 );
for (Standard_Integer ill = 1; ill <= nbl && PSentry.More(); ill ++, PSentry.Next()) {
nent = Reader.Model()->Number(list->Value(ill));
if (nent == 0) continue;
- if (!Reader.TransferOne(nent)) di<<"Transfer entity n0 "<<nent<<" : no result\n";
+ if (!Reader.TransferEntity (WS->StartingEntity(nent))) di<<"Transfer entity n0 "<<nent<<" : no result\n";
else {
nbs = Reader.NbShapes();
char shname[30]; Sprintf (shname,"%s_%d",rnom.ToCString(),nbs);
nbt++;
}
}
- thesession->TransferReader()->TransientProcess()->SetProgress ( 0 );
+ WS->ReaderProcess()->SetProgress ( 0 );
progress->EndScope();
progress->Show();
di<<"Nb Shapes successfully produced : "<<nbt<<"\n";
}
IGESControl_Reader Reader;
Standard_CString filename = argv[1];
- IFSelect_ReturnStatus readstat = Reader.ReadFile(filename);
+ Interface_ReturnStatus readstat = Reader.ReadFile(filename);
di<<"Status from reading IGES file "<<filename<<" : ";
switch(readstat) {
- case IFSelect_RetVoid : { di<<"empty file\n"; return 1; }
- case IFSelect_RetDone : { di<<"file read\n"; break; }
- case IFSelect_RetError : { di<<"file not found\n"; return 1; }
- case IFSelect_RetFail : { di<<"error during read\n"; return 1; }
+ case Interface_RetVoid : { di<<"empty file\n"; return 1; }
+ case Interface_RetDone : { di<<"file read\n"; break; }
+ case Interface_RetError : { di<<"file not found\n"; return 1; }
+ case Interface_RetFail : { di<<"error during read\n"; return 1; }
default : { di<<"failure\n"; return 1; }
}
Reader.TransferRoots();
static Standard_Integer brepiges (Draw_Interpretor& di, Standard_Integer n, const char** a)
{
- XSDRAW::SetNorm ("IGES");
+ XSDRAW::SetNorm("IGES");
// ecriture dans le model d'une entite :
// - model_AddEntity(ent) : ecriture de l`entite seule
// - model->AddWithRefs(ent, protocol): ecriture de l`entite et eventuellement
progress->NewScope(10,"Writing");
progress->Show();
- di<<npris<<" Shapes written, giving "<<XSDRAW::Model()->NbEntities()<<" Entities\n";
+ di<<npris<<" Shapes translated, giving "<<XSDRAW::Model()->NbEntities()<<" Entities\n";
if ( ! nomfic ) // delayed write
{
- di<<" Now, to write a file, command : writeall filename\n";
+ di<<" Now, the model is ready\n";
return 0;
}
{
Standard_Integer narg = n;
- Handle(XSControl_WorkSession) WS = XSDRAW::Session();
- const Handle(Transfer_TransientProcess) &TP = WS->TransferReader()->TransientProcess();
+ const Handle(IFSelect_WorkSession) &WS = XSDRAW::Session();
+ const Handle(Transfer_TransientProcess) &TP = WS->ReaderProcess();
TColStd_Array1OfAsciiString strarg(1, 3);
TColStd_Array1OfAsciiString typarg(1, 3);
return 0;
}
//-------------------------------------------------------------------
+// #### Reliquat de methodes a reprendre ####
+
+//=======================================================================
+// Function : PrintTransferInfo
+// Purpose : Print statistics information on transfer using MoniTool message management
+// Created : 18/01/98 DCE for S3767
+// Modified :
+//=======================================================================
+static void PrintTransferInfo (IGESControl_Reader &reader, const IFSelect_PrintCount mode)
+{
+ Standard_Integer nbWarn = 0, nbFail= 0, nbEntities =0, nbRoots = 0, nbResults = 0;
+ const Handle(Transfer_TransientProcess) &TP = reader.WS()->ReaderProcess();
+ Handle(Message_Messenger) TF = TP->Messenger();
+ const Handle(Interface_InterfaceModel) &model = TP->Model();
+ if (! model.IsNull()) {
+ nbEntities = model->NbEntities();
+ nbRoots = TP->NbRoots();
+ Transfer_TransientProcess::Iterator iterTrans = TP->RootResult(Standard_True);
+ Handle(Dico_DictionaryOfInteger) dicoCountResult = new Dico_DictionaryOfInteger;
+ Handle(Dico_DictionaryOfInteger) dicoCountMapping = new Dico_DictionaryOfInteger;
+ for (iterTrans.Start(); iterTrans.More() ; iterTrans.Next() ) {
+ nbResults++;
+ // Init for dicoCountResult for IFSelect_ResultCount
+ if ( mode == IFSelect_ResultCount ) {
+ char mess[300];
+ const Handle(Transfer_Binder) aBinder = iterTrans.Value();
+ sprintf(mess,"\t%s",aBinder->ResultTypeName());
+ Standard_Boolean deja;
+ Standard_Integer& nb = dicoCountResult->NewItem(mess,deja);
+ if (!deja) nb = 0;
+ nb ++;
+ }
+ // Init for dicoCountMapping for IFSelect_Mapping
+ else if ( mode == IFSelect_Mapping ) {
+ char mess[300];
+ const Handle(Transfer_Binder) aBinder = iterTrans.Value();
+ DeclareAndCast(IGESData_IGESEntity,igesEnt,iterTrans.SourceObject());
+
+ sprintf(mess,"%d\t%d\t%s\t%s", igesEnt->TypeNumber(), igesEnt->FormNumber(),
+ "%d", aBinder->ResultTypeName());
+ //cout << mess << endl;
+ Standard_Boolean deja;
+ Standard_Integer& nb = dicoCountMapping->NewItem(mess,deja);
+ if (!deja) nb = 0;
+ nb ++;
+ }
+ }
+
+ Interface_CheckIterator checkIterator = TP->CheckList(Standard_False);
+ Handle(Dico_DictionaryOfInteger) dicoCount = new Dico_DictionaryOfInteger;
+ Handle(Dico_DictionaryOfTransient) dicoList = new Dico_DictionaryOfTransient;
+ // Init the dicoCount dicoList and nbWarn ,nb Fail.
+ for(checkIterator.Start(); checkIterator.More(); checkIterator.Next() ) {
+ char mess[300];
+ const Handle(Interface_Check) aCheck = checkIterator.Value();
+ Handle(Standard_Transient) ent = model->Value(checkIterator.Number());
+ DeclareAndCast(IGESData_IGESEntity,igesEnt,ent);
+ Standard_Integer type = igesEnt->TypeNumber(), form = igesEnt->FormNumber();
+ Standard_Integer nw = aCheck->NbWarnings(), nf = aCheck->NbFails(), i;
+ for(i = 1; i <= nw; i++) {
+ sprintf(mess,"\t W\t%d\t%d\t%s",type,form,aCheck->CWarning(i));
+ Standard_Boolean deja;
+ Standard_Integer& nb = dicoCount->NewItem(mess,deja);
+ if (!deja) nb = 0;
+ nb ++;
+ Handle(Standard_Transient)& anitem = dicoList->NewItem(mess,deja);
+ DeclareAndCast(TColStd_HSequenceOfInteger,alist,anitem);
+ if (!deja) { alist = new TColStd_HSequenceOfInteger(); anitem = alist; }
+ alist->Append(model->Number(igesEnt)*2-1);
+ }
+ for(i = 1; i<= nf; i++) {
+ sprintf(mess,"\t F\t%d\t%d\t%s",type,form,aCheck->CFail(i));
+ // TF << mess << endl;
+ Standard_Boolean deja;
+ Standard_Integer& nb = dicoCount->NewItem(mess,deja);
+ if (!deja) nb = 0;
+ nb ++;
+ Handle(Standard_Transient)& anitem = dicoList->NewItem(mess,deja);
+ DeclareAndCast(TColStd_HSequenceOfInteger,alist,anitem);
+ if (!deja) { alist = new TColStd_HSequenceOfInteger(); anitem = alist; }
+ alist->Append(model->Number(igesEnt)*2-1);
+ }
+ nbWarn += nw;
+ nbFail += nf;
+ }
+ Message_Msg msg3000("IGES_3000"); // *************************
+ TF->Send (msg3000, Message_Info); //smh#14
+
+ switch (mode) {
+ case IFSelect_GeneralInfo : {
+ Message_Msg msg3005("IGES_3005");TF->Send(msg3005, Message_Info);
+ Message_Msg msg3010("IGES_3010");msg3010.Arg(nbEntities);TF->Send(msg3010, Message_Info);
+ Message_Msg msg3011("IGES_3011");msg3011.Arg(nbRoots);TF->Send(msg3011, Message_Info);
+ Message_Msg msg3015("IGES_3015");msg3015.Arg(nbResults);TF->Send(msg3015, Message_Info);
+ Message_Msg msg3020("IGES_3020");msg3020.Arg(nbWarn);TF->Send(msg3020, Message_Info);
+ Message_Msg msg3025("IGES_3025");msg3025.Arg(nbFail);TF->Send(msg3025, Message_Info);
+ break;
+ }
+ case IFSelect_CountByItem :
+ case IFSelect_ListByItem : {
+ Message_Msg msg3030("IGES_3030");
+ TF->Send(msg3030, Message_Info);
+ Dico_IteratorOfDictionaryOfInteger dicoCountIter(dicoCount);
+ Dico_IteratorOfDictionaryOfTransient dicoListIter(dicoList);
+ for(dicoCountIter.Start(),dicoListIter.Start();
+ dicoCountIter.More() && dicoListIter.More();
+ dicoCountIter.Next(),dicoListIter.Next()) {
+ TF << dicoCountIter.Value() << dicoCountIter.Name() << endl;
+ if (mode == IFSelect_ListByItem) {
+ DeclareAndCast(TColStd_HSequenceOfInteger, entityList, dicoListIter.Value());
+ Standard_Integer length = entityList->Length();
+ Message_Msg msg3035("IGES_3035");
+ TF->Send(msg3035, Message_Info);
+ char line[80];
+ sprintf(line,"\t\t\t");
+ TF << line ;
+ Standard_Integer nbInLine =0;
+ for(Standard_Integer i = 1; i <= length ; i++ ) {
+ // IDT_Out << (entityList->Value(i)) << " ";
+ sprintf(line,"\t %d", entityList->Value(i));
+ TF << line ;
+ if (++nbInLine == 6) {
+ nbInLine = 0;
+ sprintf(line,"\n\t\t\t");
+ TF << line ;
+ }
+ }
+ TF << endl ;
+ }
+ }
+ break;
+ }
+ case IFSelect_ResultCount : {
+ Message_Msg msg3040("IGES_3040");TF->Send(msg3040, Message_Info);
+ Message_Msg msg3011("IGES_3011");msg3011.Arg(nbRoots);TF->Send(msg3011, Message_Info);
+ Message_Msg msg3015("IGES_3015");msg3015.Arg(nbResults);TF->Send(msg3015, Message_Info);
+ Message_Msg msg3045("IGES_3045");TF->Send(msg3045, Message_Info);
+ Dico_IteratorOfDictionaryOfInteger dicoCountIter(dicoCountResult);
+ for(dicoCountIter.Start(); dicoCountIter.More(); dicoCountIter.Next()) {
+ TF << dicoCountIter.Value() << dicoCountIter.Name() << endl;
+ }
+ break;
+ }
+ case IFSelect_Mapping : {
+ Message_Msg msg3040("IGES_3050");TF->Send(msg3040, Message_Info);
+ Message_Msg msg3011("IGES_3011");msg3011.Arg(nbRoots);TF->Send(msg3011, Message_Info);
+ Message_Msg msg3015("IGES_3015");msg3015.Arg(nbResults);TF->Send(msg3015, Message_Info);
+ Message_Msg msg3045("IGES_3055");TF->Send(msg3045, Message_Info);
+ // Add failed entities in dicoCountMapping
+ if (nbRoots!=nbResults) {
+ for( Standard_Integer i = 1; i <= nbRoots ; i++) {
+ DeclareAndCast(IGESData_IGESEntity, root, TP->Root(i));
+ if (!TP->IsBound(root)) {
+ char mess[300];
+
+ sprintf(mess,"%d\t%d \t%s\t%s", root->TypeNumber(), root->FormNumber(),
+ "%d", "Failed");
+ //cout << mess << endl;
+ Standard_Boolean deja;
+ Standard_Integer& nb = dicoCountMapping->NewItem(mess,deja);
+ if (!deja) nb = 0;
+ nb ++;
+ }
+ }
+ }
+ Dico_IteratorOfDictionaryOfInteger dicoCountIter(dicoCountMapping);
+ for(dicoCountIter.Start(); dicoCountIter.More(); dicoCountIter.Next()) {
+ char mess[80];
+ sprintf(mess, dicoCountIter.Name().ToCString() , dicoCountIter.Value());
+ TF << mess << endl; //dicoCountIter.Value() << dicoCountIter.Name() << endl;
+ }
+ break;
+ }
+ default: break;
+ }
+ }
+}
+
//--------------------------------------------------------------
// Function : TPSTAT
//
{
Standard_Integer argc = n;
const Standard_CString arg1 = a[1];
- const Handle(Transfer_TransientProcess) &TP = XSDRAW::Session()->TransferReader()->TransientProcess();
+ const Handle(Transfer_TransientProcess) &TP = XSDRAW::Session()->ReaderProcess();
IGESControl_Reader read;
// **** tpent ****
Handle(Interface_InterfaceModel) model = TP->Model();
if (model.IsNull()) {di<<"No Transfer Read\n"; return -1;}
Handle(XSControl_WorkSession) thesession = read.WS();
- thesession->SetMapReader(TP);
+ thesession->SetReaderProcess(TP);
Standard_Integer mod1 = 0;
if (argc > 1) {
char a2 = arg1[1]; if (a2 == '\0') a2 = '!';
switch (arg1[0]) {
- case 'g' : read.PrintTransferInfo(IFSelect_FailAndWarn,IFSelect_GeneralInfo);break;
- case 'c' : read.PrintTransferInfo(IFSelect_FailAndWarn,IFSelect_CountByItem); break;
- case 'C' : read.PrintTransferInfo(IFSelect_FailAndWarn,IFSelect_ListByItem); break;
- case 'r' : read.PrintTransferInfo(IFSelect_FailAndWarn,IFSelect_ResultCount);break;
- case 's' : read.PrintTransferInfo(IFSelect_FailAndWarn,IFSelect_Mapping);break;
+ case 'g' : PrintTransferInfo(read,IFSelect_GeneralInfo);break;
+ case 'c' : PrintTransferInfo(read,IFSelect_CountByItem); break;
+ case 'C' : PrintTransferInfo(read,IFSelect_ListByItem); break;
+ case 'r' : PrintTransferInfo(read,IFSelect_ResultCount);break;
+ case 's' : PrintTransferInfo(read,IFSelect_Mapping);break;
case '?' : mod1 = -1; break;
default : mod1 = -2; break;
}
//
//--------------------------------------------------------------
-#include <IGESSelect_AutoCorrect.hxx>
-#include <IGESSelect_ComputeStatus.hxx>
-#include <IGESControl_FloatFormat.hxx>
-#include <IGESSelect_RemoveCurves.hxx>
-#include <IGESSelect_SetGlobalParameter.hxx>
-#include <IGESSelect_SetLabel.hxx>
-#include <IGESSelect_UpdateFileName.hxx>
#include <IFSelect_SelectModelEntities.hxx>
#include <IFSelect_SelectModelRoots.hxx>
-#include <XSControl_SelectForTransfer.hxx>
+#include <XSSelect_SelectForTransfer.hxx>
#include <IGESSelect_SelectVisibleStatus.hxx>
#include <IGESSelect_SelectSubordinate.hxx>
#include <IGESSelect_SelectBypassGroup.hxx>
#include <IGESSelect_SignColor.hxx>
#include <IGESBasic_SubfigureDef.hxx>
#include <IFSelect_SignType.hxx>
-#include <IGESSelect_EditHeader.hxx>
-#include <IFSelect_EditForm.hxx>
-#include <IGESSelect_EditDirPart.hxx>
-#include <IGESSelect_Dumper.hxx>
void XSDRAWIGES::InitSelect ()
{
- Handle(XSDRAWIGES_Activator) igesact = new XSDRAWIGES_Activator;
-
IGESControl_Controller::Init();
- Handle(XSControl_Controller) aCntl = XSControl_Controller::Recorded("iges");
-
- static int gInit = 0;
- if (!gInit) {
- gInit = 1;
- Handle(IGESSelect_Dumper) sesdump = new IGESSelect_Dumper; // ainsi,cestfait
-
- aCntl->AddSessionItem (new IGESSelect_RemoveCurves(Standard_True) ,"iges-remove-pcurves");
- aCntl->AddSessionItem (new IGESSelect_RemoveCurves(Standard_False),"iges-remove-curves-3d");
- aCntl->AddSessionItem (new IGESSelect_SetLabel (0,Standard_True) ,"iges-clear-label");
- aCntl->AddSessionItem (new IGESSelect_SetLabel (1,Standard_False),"iges-set-label-dnum");
-
- aCntl->AddSessionItem (new IGESSelect_AutoCorrect,"iges-auto-correct",Standard_True);
- aCntl->AddSessionItem (new IGESSelect_ComputeStatus,"iges-compute-status",Standard_True);
-
- Handle(IGESControl_FloatFormat) flf = new IGESControl_FloatFormat;
- flf->SetDefault (12);
- aCntl->AddSessionItem (flf,"iges-float-digits-12",Standard_True);
-
- // -- Sender Product Identification -- (pas un statique ...)
- Handle(IGESSelect_SetGlobalParameter) set3 = new IGESSelect_SetGlobalParameter(3);
- Handle(TCollection_HAsciiString) pa3 = Interface_Static::Static("write.iges.header.product")->HStringValue();
- set3->SetValue(pa3);
- aCntl->AddSessionItem (pa3, "iges-header-val-sender");
- aCntl->AddSessionItem (set3,"iges-header-set-sender",Standard_True);
-
- aCntl->AddSessionItem (new IGESSelect_UpdateFileName,"iges-update-file-name",Standard_True);
-
- // -- Receiver -- Acces par Static, ajustable
- Handle(IGESSelect_SetGlobalParameter) set12 = new IGESSelect_SetGlobalParameter(12);
- Handle(TCollection_HAsciiString) pa12 = Interface_Static::Static("write.iges.header.receiver")->HStringValue();
- set12->SetValue(pa12);
- aCntl->AddSessionItem (pa12, "iges-header-val-receiver");
- aCntl->AddSessionItem (set12,"iges-header-set-receiver",Standard_True);
-
- // -- Auteur -- acces par Static (demarre par whoami), ajustable
- Handle(IGESSelect_SetGlobalParameter) set21 = new IGESSelect_SetGlobalParameter(21);
- Handle(TCollection_HAsciiString) pa21 = Interface_Static::Static("write.iges.header.author")->HStringValue();
- set21->SetValue(pa21);
- aCntl->AddSessionItem (pa21, "iges-header-val-author");
- aCntl->AddSessionItem (set21,"iges-header-set-author",Standard_True);
-
- // -- Compagnie (de l auteur) -- acces par Static, ajustable
- Handle(IGESSelect_SetGlobalParameter) set22 = new IGESSelect_SetGlobalParameter(22);
- Handle(TCollection_HAsciiString) pa22 = Interface_Static::Static("write.iges.header.company")->HStringValue();
- set22->SetValue(pa22);
- aCntl->AddSessionItem (pa22, "iges-header-val-company");
- aCntl->AddSessionItem (set22,"iges-header-set-company",Standard_True);
- }
+ Handle(XSControl_Controller) aCntl = XSControl_Controller::Recorded("IGES");
XSDRAW::SetController (aCntl);
- Handle(XSControl_WorkSession) WS = XSDRAW::Session();
+ const Handle(IFSelect_WorkSession) &WS = XSDRAW::Session();
// --- SELECTIONS, SIGNATURES, COMPTEURS, EDITEURS
// -- BypassGroup / xst-model-roots
WS->AddNamedItem ("xst-model-roots",xmr);
}
- Handle(XSControl_SelectForTransfer) xtr;
+ Handle(XSSelect_SelectForTransfer) xtr;
Handle(Standard_Transient) xtr1 = WS->NamedItem("xst-transferrable-roots");
if (!xtr1.IsNull())
- xtr = Handle(XSControl_SelectForTransfer)::DownCast(xtr1);
+ xtr = Handle(XSSelect_SelectForTransfer)::DownCast(xtr1);
else {
- xtr = new XSControl_SelectForTransfer;
- xtr->SetReader (WS->TransferReader());
+ xtr = new XSSelect_SelectForTransfer(WS->ReaderProcess());
WS->AddNamedItem ("xst-transferrable-roots",xtr);
}
Handle(IGESSelect_SignColor) scol6 = new IGESSelect_SignColor (6);
WS->AddNamedItem ("iges-color-blue",scol6);
- Handle(IGESSelect_EditHeader) edhead = new IGESSelect_EditHeader;
- WS->AddNamedItem ("iges-header-edit",edhead);
- Handle(IFSelect_EditForm) edheadf = edhead->Form(Standard_False);
- WS->AddNamedItem ("iges-header",edheadf);
-
- Handle(IGESSelect_EditDirPart) eddirp = new IGESSelect_EditDirPart;
- WS->AddNamedItem ("iges-dir-part-edit",eddirp);
- Handle(IFSelect_EditForm) eddirpf = eddirp->Form(Standard_False);
- WS->AddNamedItem ("iges-dir-part",eddirpf);
-
WS->SetSignType( typnam );
}
+++ /dev/null
-// 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 <XSDRAWIGES_Activator.hxx>
-
-#include <IFSelect_IntParam.hxx>
-#include <IFSelect_PacketList.hxx>
-#include <IFSelect_SelectSignature.hxx>
-#include <IFSelect_SessionPilot.hxx>
-#include <IFSelect_WorkSession.hxx>
-#include <IGESData_IGESEntity.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESData_Protocol.hxx>
-#include <IGESSelect_AddGroup.hxx>
-#include <IGESSelect_AutoCorrect.hxx>
-#include <IGESSelect_ComputeStatus.hxx>
-#include <IGESSelect_DispPerDrawing.hxx>
-#include <IGESSelect_DispPerSingleView.hxx>
-#include <IGESControl_FloatFormat.hxx>
-#include <IGESSelect_IGESTypeForm.hxx>
-#include <IGESSelect_RebuildDrawings.hxx>
-#include <IGESSelect_RebuildGroups.hxx>
-#include <IGESSelect_SelectBypassGroup.hxx>
-#include <IGESSelect_SelectDrawingFrom.hxx>
-#include <IGESSelect_SelectFromDrawing.hxx>
-#include <IGESSelect_SelectFromSingleView.hxx>
-#include <IGESSelect_SelectLevelNumber.hxx>
-#include <IGESSelect_SelectName.hxx>
-#include <IGESSelect_SelectSingleViewFrom.hxx>
-#include <IGESSelect_SelectVisibleStatus.hxx>
-#include <IGESSelect_SetGlobalParameter.hxx>
-#include <IGESSelect_SetVersion5.hxx>
-#include <IGESSelect_SplineToBSpline.hxx>
-#include <IGESSelect_UpdateCreationDate.hxx>
-#include <IGESSelect_UpdateFileName.hxx>
-#include <IGESSelect_UpdateLastChange.hxx>
-#include <IGESSelect_ViewSorter.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_ErrorHandler.hxx>
-#include <Standard_Failure.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_HAsciiString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(XSDRAWIGES_Activator,IFSelect_Activator)
-
-XSDRAWIGES_Activator::XSDRAWIGES_Activator ()
-{
- static int initActivator = 0;
- if (initActivator) return; initActivator = 1;
-
- SetForGroup ("XSTEP-IGES");
-
- Add ( 5,"listviews");
- Add ( 6,"listdrawings");
- Add ( 7,"listsviews");
-
- AddSet (10,"igestype");
- AddSet (11,"bypassgroup");
- AddSet (12,"igesname");
- AddSet (13,"igesvisible");
- AddSet (14,"igeslevel");
-
- AddSet (21,"igesfromdrawing");
- AddSet (22,"igesfromview");
- AddSet (23,"igesdrawingfrom");
- AddSet (24,"igesviewfrom");
-
- AddSet (31,"igesdispdrawing");
- AddSet (32,"igesdispview");
-
- AddSet (40,"floatformat");
- AddSet (41,"setglobalparam");
- AddSet (42,"setversion5");
- AddSet (43,"updatecreationdate");
- AddSet (44,"updatelastchange");
- AddSet (45,"updatefilename");
-
- AddSet (50,"autocorrect");
- AddSet (51,"computestatus");
- AddSet (52,"rebuildgroups");
- AddSet (53,"rebuilddrawings");
- AddSet (54,"addgroup");
-
- AddSet (60,"splinetobspline");
-
- Add (70,"setuseflag");
-}
-
-
-IFSelect_ReturnStatus XSDRAWIGES_Activator::Do (const Standard_Integer number, const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Word(1).ToCString();
- const Standard_CString arg2 = pilot->Word(2).ToCString();
- const Handle(IFSelect_WorkSession) &WS = pilot->Session();
-
- switch (number) {
-
- case 5 : // **** ListViews (sans tri complementaire)
- case 6 : // **** ListDrawings
- case 7 : { // **** ListS(ingle)Views
- Standard_Integer listmode = 0;
- if (argc == 2 && arg1[0] == '?') argc = -1;
- if (argc < 2) {
- cout<<"Ajouter un argument pour avoir :\n"<<
- " l : liste resumee"<<
- " c : liste complete par item (mais pas pour remaining)\n"<<
- " r : idem + liste complete remaining\n"<<
- " sur tout le modele. Ajouter nom selection pour lister sur une partie"<<endl;
- return (argc >= 0 ? IFSelect_RetError : IFSelect_RetVoid);
- }
- if (arg1[0] == 'l') {
- listmode = 0; cout<<"Liste resumee";
- }
- else if (arg1[0] == 'c') {
- listmode = 1; cout<<"Liste complete par item (pas pour Remaining)"<<endl;
- }
- else if (arg1[0] == 'r') {
- listmode = 2; cout<<"Liste complete par item et pour Remaining"<<endl;
- }
- else {
- cout<<"Parametre de listage non compris"<<endl; return IFSelect_RetError;
- }
-
- Handle(IGESSelect_ViewSorter) vs = new IGESSelect_ViewSorter;
- vs->SetModel(GetCasted(IGESData_IGESModel,WS->Model()));
- if (argc == 2) vs->AddModel(WS->Model());
- else {
-// on demande une selection
- DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg2));
- if (sel.IsNull()) {
- cout<<"Pas une selection : "<<arg2<<endl;
- return IFSelect_RetError;
- }
- vs->AddList (WS->SelectionResult(sel));
- }
- Standard_Boolean listdr = (number > 5);
- if (number == 6) vs->SortDrawings(WS->Graph());
- if (number == 7) vs->SortSingleViews(Standard_True);
- Handle(IFSelect_PacketList) sets = vs->Sets(listdr);
- Standard_Integer nb = vs->NbSets(listdr);
- cout<<" -- ViewSorter for";
- if (number == 5) cout<<" Views & Drawings";
- if (number == 6) cout<<" Drawings only (complete)";
- if (number == 7) cout<<" Single Views & Drawing Frames";
- cout<<", on "<<vs->NbEntities()<<" ent.s, give "<<nb<<" Sets"<<endl;
-
- Interface_EntityIterator iter;
- for (Standard_Integer i = 1; i <= nb; i ++) {
- cout<<" -- Set n0 "<<i<<" Item=entity n0: "<<
- WS->Model()->Number(vs->SetItem(i,listdr))<<" List:";
- cout<<sets->NbEntities(i)<<" ent.s:"<<endl;
- if (listmode == 0) continue;
- iter = sets->Entities(i);
- WS->ListEntities (iter,0);
- }
-
- cout <<" -- Remaining Entities (not yet sorted) :"
- <<sets->NbDuplicated(0,Standard_False)<<endl;
- if (listmode < 2) return IFSelect_RetVoid;
- iter = sets->Duplicated(0,Standard_False);
- WS->ListEntities(iter,0);
- return IFSelect_RetVoid;
- }
-
- case 10 : { // **** IGESType (form Type/Form)
- if (argc < 2) {
- cout<<"Donner le n0 de type desire, + en option la forme\n"
- <<" Si pas de forme, prend toutes les formes du type demande"<<endl;
- return IFSelect_RetError;
- }
- char signature[20];
- if (argc == 2) sprintf(signature,"%s",arg1);
- else sprintf(signature,"%s %s",arg1,arg2);
- Handle(IFSelect_SelectSignature) sel = new IFSelect_SelectSignature
- (new IGESSelect_IGESTypeForm, signature,(argc > 2));
- return pilot->RecordItem (sel);
- }
-
- case 11 : { // **** IGES BypassGroup
- return pilot->RecordItem (new IGESSelect_SelectBypassGroup);
- }
-
- case 12 : { // **** IGES Name
- if (argc < 2) {
- cout<<"Donner un Nom de TextParam pour IGESName"<<endl;
- return IFSelect_RetError;
- }
- Handle(IGESSelect_SelectName) sel = new IGESSelect_SelectName;
- sel->SetName
- (GetCasted(TCollection_HAsciiString,WS->NamedItem(arg1)) );
- return pilot->RecordItem (sel);
- }
-
- case 13 : { // **** IGES VisibleStatus
- return pilot->RecordItem (new IGESSelect_SelectVisibleStatus);
- }
-
- case 14 : { // **** IGES LevelNumber
- if (argc < 2) {
- cout<<"Donner nom IntParam pour Level"<<endl;
- return IFSelect_RetError;
- }
- DeclareAndCast(IFSelect_IntParam,lev,WS->NamedItem(arg1));
- if (lev.IsNull()) {
- cout<<arg1<<" : pas un IntParam (pour Level)"<<endl;
- return IFSelect_RetError;
- }
- Handle(IGESSelect_SelectLevelNumber) sel = new IGESSelect_SelectLevelNumber;
- sel->SetLevelNumber(lev);
- return pilot->RecordItem (sel);
- }
-
- case 21 : { // **** IGES FromDrawing
- return pilot->RecordItem (new IGESSelect_SelectFromDrawing);
- }
- case 22 : { // **** IGES FromSingleView
- return pilot->RecordItem (new IGESSelect_SelectFromSingleView);
- }
- case 23 : { // **** IGES FromDrawing
- return pilot->RecordItem (new IGESSelect_SelectDrawingFrom);
- }
- case 24 : { // **** IGES FromDrawing
- return pilot->RecordItem (new IGESSelect_SelectSingleViewFrom);
- }
-
- case 31 : { // **** IGES DispatchPerDrawing
- return pilot->RecordItem (new IGESSelect_DispPerDrawing);
- }
- case 32 : { // **** IGES DispatchPerSingleView
- return pilot->RecordItem (new IGESSelect_DispPerSingleView);
- }
-
- case 40 : { // **** FloatFormat
- char prem = ' ';
- if (argc < 2) prem = '?';
- else if (argc == 5) {
- cout<<"floatformat tout court donne les formes admises"<<endl;
- return IFSelect_RetError;
- }
- else prem = arg1[0];
- Standard_Boolean zerosup=Standard_False;
- Standard_Integer digits = 0;
- if (prem == 'N' || prem == 'n') zerosup = Standard_False;
- else if (prem == 'Z' || prem == 'z') zerosup = Standard_True;
- else if (prem >= 48 && prem <= 57) digits = atoi(arg1);
- else {
- cout<<"floatformat digits, digits=nb de chiffres signifiants, ou\n"
- << "floatformat NZ %mainformat [%rangeformat [Rmin Rmax]]\n"
- <<" NZ : N ou n pour Non-zero-suppress, Z ou z pour zero-suppress\n"
- <<" %mainformat : format principal type printf, ex,: %E\n"
- <<" + optionnel : format secondaire (flottants autour de 1.) :\n"
- <<" %rangeformat Rmin Rmax : format type printf entre Rmin et Rmax\n"
- <<" %rangeformat tout seul : format type printf entre 0.1 et 1000.\n"
- <<flush;
- return (prem == '?' ? IFSelect_RetVoid : IFSelect_RetError);
- }
- Standard_Real Rmin=0., Rmax=0.;
- if (argc > 4) {
- Rmin = Atof(pilot->Word(4).ToCString());
- Rmax = Atof(pilot->Word(5).ToCString());
- if (Rmin <= 0 || Rmax <= 0) { cout<<"intervalle : donner reels > 0"<<endl; return IFSelect_RetError; }
- }
- Handle(IGESControl_FloatFormat) fm = new IGESControl_FloatFormat;
- if (argc == 2) fm->SetDefault(digits);
- else {
- fm->SetZeroSuppress(zerosup);
- fm->SetFormat (arg2);
- if (argc == 4) fm->SetFormatForRange(pilot->Word(3).ToCString());
- else if (argc >= 6) fm->SetFormatForRange(pilot->Word(3).ToCString(),Rmin,Rmax);
- else fm->SetFormatForRange("");
- }
- return pilot->RecordItem(fm);
- }
-
- case 41 : { // **** SetGlobalParameter
- if (argc < 3) {
- cout<<"Donner entier=n0 param a changer + nom TextParam pour la valeur"<<endl;
- return IFSelect_RetError;
- }
- Standard_Integer numpar = atoi(arg1);
- if (numpar <= 0) {
- cout<<"Pas un n0 de param global correct:"<<arg1<<endl;
- return IFSelect_RetError;
- }
- DeclareAndCast(TCollection_HAsciiString,val,WS->NamedItem(arg2));
- if (val.IsNull()) {
- cout<<"Pas un nom de TextParam:"<<arg2<<endl;
- return IFSelect_RetError;
- }
- Handle(IGESSelect_SetGlobalParameter) mod =
- new IGESSelect_SetGlobalParameter(numpar);
- mod->SetValue(val);
- return pilot->RecordItem (mod);
- }
-
- case 42 : { // **** Set IGES Version 5.1
- return pilot->RecordItem (new IGESSelect_SetVersion5);
- }
- case 43 : { // **** Update Creation Date
- return pilot->RecordItem (new IGESSelect_UpdateCreationDate);
- }
- case 44 : { // **** Update Last Change Date
- return pilot->RecordItem (new IGESSelect_UpdateLastChange);
- }
- case 45 : { // **** Update File Name
- return pilot->RecordItem (new IGESSelect_UpdateFileName);
- }
-
- case 50 : { // **** AutoCorrect
- return pilot->RecordItem (new IGESSelect_AutoCorrect);
- }
- case 51 : { // **** Compute Status
- return pilot->RecordItem (new IGESSelect_ComputeStatus);
- }
- case 52 : { // **** Rebuild Groups
- return pilot->RecordItem (new IGESSelect_RebuildGroups);
- }
- case 53 : { // **** Rebuild Drawings
- return pilot->RecordItem (new IGESSelect_RebuildDrawings);
- }
- case 54 : { // **** Add Group
- return pilot->RecordItem (new IGESSelect_AddGroup);
- }
-
- case 60 : { // **** Spline To BSpline
- if (argc < 2) {
- cout<<"Pour SplineToBSpline, donner mode :\n"<<
- " n pour normal, t pour tryC2"<<endl;
- return IFSelect_RetError;
- }
- Standard_Boolean tryC2;
- if (arg1[0] == 'n' || arg1[0] == 'N')
- tryC2 = Standard_False;
- else if (arg1[0] == 't' || arg1[0] == 'T')
- tryC2 = Standard_True;
- else {
- cout<<" Mode incorrect : "<<arg1<<endl;
- return IFSelect_RetError;
- }
- Handle(IGESSelect_SplineToBSpline) conv =
- new IGESSelect_SplineToBSpline (tryC2);
- return pilot->RecordItem(conv);
- }
-
- case 70 : { // **** SetUseFlag
- Standard_Integer usefl = atoi (arg1);
- if (argc > 2) {
- Handle(TColStd_HSequenceOfTransient) list = WS->GiveList(pilot->CommandPart(2));
- Standard_Integer i, nb = list->Length();
- for (i = 1; i <= nb; i ++) {
- DeclareAndCast(IGESData_IGESEntity,ent,list->Value(i));
- if (!ent.IsNull()) ent->InitStatus
- (ent->BlankStatus(),ent->SubordinateStatus(),usefl,ent->HierarchyStatus());
- }
- }
- else {
- Standard_Integer i, nb = WS->NbStartingEntities();
- for (i = 1; i <= nb; i ++) {
- DeclareAndCast(IGESData_IGESEntity,ent,WS->StartingEntity(i));
- if (!ent.IsNull()) ent->InitStatus
- (ent->BlankStatus(),ent->SubordinateStatus(),usefl,ent->HierarchyStatus());
- }
- }
- return IFSelect_RetDone;
- }
-
- default : break;
- }
- return IFSelect_RetVoid;
-
-}
-
-Standard_CString XSDRAWIGES_Activator::Help (const Standard_Integer number) const
-{
- switch (number) {
- case 5 : return "Liste Vues (tous types). Nom selection sinon tout modele";
- case 6 : return "Liste Drawings. Nom selection sinon tout modele";
- case 7 : return "Liste Vues SIMPLES. Nom selection sinon tout modele";
-
- case 10 : return "type:integer [form:integer] : cree Select IGESType";
- case 11 : return "cree Select Bypass Group";
- case 12 : return "name:TextParam : cree Select Name (Name/Label)";
- case 13 : return "cree Select Visible Status (Blank Status = 0 sinon 1)";
- case 14 : return "level:IntParam : cree Select LevelNumber";
-
- case 21 : return "cree Select From Drawing";
- case 22 : return "cree Select From Single View";
- case 23 : return "cree Select Drawing From, drawing(s) pour une liste d entites";
- case 24 : return "cree Select View From, views pour une liste d entites";
-
- case 31 : return "cree Dispatch Per Drawing";
- case 32 : return "cree Dispatch Per SingleView";
-
- case 40 : return "options... : cree FloatFormat ... floatformat tout court->help";
- case 41 : return "numpar:integer value:TextParam : cree Set Global Param";
- case 42 : return "cree Set Version -> 5.1";
- case 43 : return "cree Update Creation Date";
- case 44 : return "cree Update Last Change Date";
- case 45 : return "cree Update File Name (dynamic)";
-
- case 50 : return "cree AutoCorrect";
- case 51 : return "cree Compute Status (in D.E.)";
- case 52 : return "cree Rebuild Groups";
- case 53 : return "cree Rebuild Drawings";
- case 54 : return "cree AddGroup";
-
- case 60 : return "cree SplineToBSpline Conversion";
-
- case 70 : return "useflag givelist : Set Use Flag to value";
-
- default : break;
- }
- return "??";
-}
+++ /dev/null
-// Created on: 1994-06-03
-// 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 _XSDRAWIGES_Activator_HeaderFile
-#define _XSDRAWIGES_Activator_HeaderFile
-
-#include <IFSelect_Activator.hxx>
-
-//! Performs Actions specific to IGESSelect, i.e. creation of
-//! IGES Selections and Dispatches, plus dumping specific to IGES
-class XSDRAWIGES_Activator : public IFSelect_Activator
-{
- public:
-
- Standard_EXPORT XSDRAWIGES_Activator();
-
- //! Executes a Command Line for IGESSelect
- Standard_EXPORT IFSelect_ReturnStatus Do (const Standard_Integer number, const Handle(IFSelect_SessionPilot)& pilot) Standard_OVERRIDE;
-
- //! Sends a short help message for IGESSelect commands
- Standard_EXPORT Standard_CString Help (const Standard_Integer number) const Standard_OVERRIDE;
-
- DEFINE_STANDARD_RTTIEXT(XSDRAWIGES_Activator,IFSelect_Activator)
-};
-
-#endif // _XSDRAWIGES_Activator_HeaderFile
XSDRAWSTEP.hxx
XSDRAWSTEP_Activator.cxx
XSDRAWSTEP_Activator.hxx
-XSDRAWSTEP_EditHeader.cxx
-XSDRAWSTEP_EditHeader.hxx
#include <Draw_Appli.hxx>
#include <Draw_Interpretor.hxx>
#include <Draw_ProgressIndicator.hxx>
-#include <IFSelect_SessionPilot.hxx>
+#include <XSDRAW_SessionPilot.hxx>
#include <Interface_InterfaceModel.hxx>
#include <Interface_Macros.hxx>
#include <Interface_Static.hxx>
#include <Transfer_TransientProcess.hxx>
#include <TransferBRep_ShapeMapper.hxx>
#include <XSControl_Controller.hxx>
-#include <XSControl_TransferReader.hxx>
-#include <XSControl_WorkSession.hxx>
+#include <IFSelect_WorkSession.hxx>
#include <XSDRAW.hxx>
#include <XSDRAWSTEP.hxx>
#include <XSDRAWSTEP_Activator.hxx>
#include <IFSelect_SelectSignature.hxx>
#include <IFSelect_SelectModelEntities.hxx>
#include <IFSelect_SelectModelRoots.hxx>
-#include <IFSelect_EditForm.hxx>
#include <StepAP214.hxx>
#include <StepAP214_Protocol.hxx>
#include <STEPSelections_SelectDerived.hxx>
#include <STEPSelections_SelectGSCurves.hxx>
#include <STEPSelections_SelectAssembly.hxx>
#include <STEPSelections_SelectForTransfer.hxx>
-#include <XSDRAWSTEP_EditHeader.hxx>
-#include <STEPEdit_EditContext.hxx>
-#include <STEPEdit_EditSDR.hxx>
//! Returns a SignType fit for STEP (creates the first time)
static Handle(IFSelect_Signature) SignType()
return sel;
}
+#include <XSDRAW_SessionItems.hxx>
+
+static XSDRAW_SessionItems gSessionItems;
+
void XSDRAWSTEP::Init ()
{
Handle(XSDRAWSTEP_Activator) stepact = new XSDRAWSTEP_Activator;
gInit = 1;
// --- SELECTIONS, SIGNATURES, COMPTEURS, EDITEURS
- DeclareAndCast(IFSelect_Selection,xmr,aCntl->SessionItem("xst-model-roots"));
+ DeclareAndCast(IFSelect_Selection,xmr,gSessionItems.GetItem("xst-model-roots"));
if (!xmr.IsNull()) {
Handle(IFSelect_Signature) sty = SignType();
- aCntl->AddSessionItem (sty,"step-type");
+ gSessionItems.AddItem (sty,"step-type");
Handle(IFSelect_SignCounter) tys = new IFSelect_SignCounter(sty,Standard_False,Standard_True);
- aCntl->AddSessionItem (tys,"step-types");
+ gSessionItems.AddItem (tys,"step-types");
//pdn S4133 18.02.99
- aCntl->AddSessionItem (new IFSelect_SignAncestor(),"xst-derived");
+ gSessionItems.AddItem (new IFSelect_SignAncestor(),"xst-derived");
Handle(STEPSelections_SelectDerived) stdvar = new STEPSelections_SelectDerived();
stdvar->SetProtocol(StepAP214::Protocol());
- aCntl->AddSessionItem (stdvar,"step-derived");
+ gSessionItems.AddItem (stdvar,"step-derived");
Handle(IFSelect_SelectSignature) selsdr = NewSelectSDR();
selsdr->SetInput (xmr);
- aCntl->AddSessionItem (selsdr,"step-shape-def-repr");
+ gSessionItems.AddItem (selsdr,"step-shape-def-repr");
- aCntl->AddSessionItem (NewSelectPlacedItem(),"step-placed-items");
+ gSessionItems.AddItem (NewSelectPlacedItem(),"step-placed-items");
// input deja pret avec ModelAll
- aCntl->AddSessionItem (NewSelectShapeRepr(),"step-shape-repr");
+ gSessionItems.AddItem (NewSelectShapeRepr(),"step-shape-repr");
}
//pdn
Handle(STEPSelections_SelectFaces) stfaces = new STEPSelections_SelectFaces;
stfaces->SetInput (xmr);
- aCntl->AddSessionItem (stfaces,"step-faces");
+ gSessionItems.AddItem (stfaces,"step-faces");
Handle(STEPSelections_SelectInstances) stinst = new STEPSelections_SelectInstances;
- aCntl->AddSessionItem (stinst,"step-instances");
+ gSessionItems.AddItem (stinst,"step-instances");
Handle(STEPSelections_SelectGSCurves) stcurves = new STEPSelections_SelectGSCurves;
stcurves->SetInput (xmr);
- aCntl->AddSessionItem (stcurves,"step-GS-curves");
+ gSessionItems.AddItem (stcurves,"step-GS-curves");
Handle(STEPSelections_SelectAssembly) assembly = new STEPSelections_SelectAssembly;
assembly->SetInput (xmr);
- aCntl->AddSessionItem (assembly,"step-assembly");
-
- Handle(XSDRAWSTEP_EditHeader) edhead = new XSDRAWSTEP_EditHeader;
- Handle(IFSelect_EditForm) edheadf = new IFSelect_EditForm (edhead,Standard_False,Standard_True,"Step Header");
- aCntl->AddSessionItem (edhead,"step-header-edit");
- aCntl->AddSessionItem (edheadf,"step-header");
-
- Handle(STEPEdit_EditContext) edctx = new STEPEdit_EditContext;
- Handle(IFSelect_EditForm) edctxf = new IFSelect_EditForm (edctx,Standard_False,Standard_True,"STEP Product Definition Context");
- aCntl->AddSessionItem (edctx,"step-context-edit");
- aCntl->AddSessionItem (edctxf,"step-context");
-
- Handle(STEPEdit_EditSDR) edsdr = new STEPEdit_EditSDR;
- Handle(IFSelect_EditForm) edsdrf = new IFSelect_EditForm (edsdr,Standard_False,Standard_True,"STEP Product Data (SDR)");
- aCntl->AddSessionItem (edsdr,"step-SDR-edit");
- aCntl->AddSessionItem (edsdrf,"step-SDR-data");
+ gSessionItems.AddItem (assembly,"step-assembly");
}
XSDRAW::SetController(aCntl);
- Handle(XSControl_WorkSession) WS = XSDRAW::Session();
+ const Handle(IFSelect_WorkSession) &WS = XSDRAW::Session();
+
+ gSessionItems.Apply (WS);
Handle(IFSelect_SelectModelRoots) slr;
Handle(Standard_Transient) slr1 = WS->NamedItem("xst-model-roots");
WS->AddNamedItem ("xst-model-roots",slr);
}
- Handle(STEPSelections_SelectForTransfer) st1= new STEPSelections_SelectForTransfer;
- st1->SetReader (WS->TransferReader());
+ Handle(STEPSelections_SelectForTransfer) st1 = new STEPSelections_SelectForTransfer(WS->ReaderProcess());
WS->AddNamedItem ("xst-transferrable-roots",st1);
if (!slr.IsNull()) {
Handle(STEPSelections_SelectAssembly) assembly = new STEPSelections_SelectAssembly;
assembly->SetInput (slr);
WS->AddNamedItem ("step-assembly",assembly);
-
- Handle(XSDRAWSTEP_EditHeader) edhead = new XSDRAWSTEP_EditHeader;
- Handle(IFSelect_EditForm) edheadf = new IFSelect_EditForm (edhead,Standard_False,Standard_True,"Step Header");
- WS->AddNamedItem ("step-header-edit",edhead);
- WS->AddNamedItem ("step-header",edheadf);
-
- Handle(STEPEdit_EditContext) edctx = new STEPEdit_EditContext;
- Handle(IFSelect_EditForm) edctxf = new IFSelect_EditForm (edctx,Standard_False,Standard_True,"STEP Product Definition Context");
- WS->AddNamedItem ("step-context-edit",edctx);
- WS->AddNamedItem ("step-context",edctxf);
-
- Handle(STEPEdit_EditSDR) edsdr = new STEPEdit_EditSDR;
- Handle(IFSelect_EditForm) edsdrf = new IFSelect_EditForm (edsdr,Standard_False,Standard_True,"STEP Product Data (SDR)");
- WS->AddNamedItem ("step-SDR-edit",edsdr);
- WS->AddNamedItem ("step-SDR-data",edsdrf);
atexit (cleanpilot);
}
progress->SetScale ( 0, 100, 1 );
progress->Show();
- STEPControl_Reader sr (XSDRAW::Session(),Standard_False);
+ const Handle(IFSelect_WorkSession) &WS = XSDRAW::Session();
+
+ STEPControl_Reader sr (WS,Standard_False);
TCollection_AsciiString fnom,rnom;
Standard_Boolean modfic = XSDRAW::FileAndVar
(argv[1],argv[2],"STEP",fnom,rnom);
if (modfic) di<<" File STEP to read : "<<fnom.ToCString()<<"\n";
else di<<" Model taken from the session : "<<fnom.ToCString()<<"\n";
di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom.ToCString()<<"\n";
- IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
+ Interface_ReturnStatus readstat = Interface_RetVoid;
progress->NewScope ( 20, "Loading" ); // On average loading takes 20%
progress->Show();
else
cout<<"Reduced model for translation without additional info will be used \n"<<flush;
- sr.WS()->SetModeStat(aFullMode);
+ WS->SetModeStat(aFullMode);
if (modfic) readstat = sr.ReadFile (fnom.ToCString());
- else if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
+ else if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = Interface_RetDone;
progress->EndScope();
progress->Show();
- if (readstat != IFSelect_RetDone) {
+ if (readstat != Interface_RetDone) {
if (modfic) di<<"Could not read file "<<fnom.ToCString()<<" , abandon\n";
else di<<"No model loaded\n";
return 1;
progress->NewScope ( 80, "Translation" );
progress->Show();
- sr.WS()->TransferReader()->TransientProcess()->SetProgress ( progress );
+ WS->ReaderProcess()->SetProgress ( progress );
if (!sr.TransferRoot (num)) di<<"Transfer root n0 "<<num<<" : no result\n";
else {
DBRep::Set (shname,sh);
}
- sr.WS()->TransferReader()->TransientProcess()->SetProgress ( 0 );
+ WS->ReaderProcess()->SetProgress ( 0 );
progress->EndScope();
progress->Show();
}
else if (modepri == 3) {
cout<<"Entity : "<<flush; num = XSDRAW::GetEntityNumber();
- if (!sr.TransferOne (num)) di<<"Transfer entity n0 "<<num<<" : no result\n";
+ if (!sr.TransferEntity (WS->StartingEntity(num))) di<<"Transfer entity n0 "<<num<<" : no result\n";
else {
nbs = sr.NbShapes();
char shname[30]; Sprintf (shname,"%s_%d",rnom.ToCString(),num);
progress->NewScope ( 80, "Translation" );
progress->Show();
- sr.WS()->TransferReader()->TransientProcess()->SetProgress ( progress );
+ WS->ReaderProcess()->SetProgress ( progress );
Message_ProgressSentry PSentry ( progress, "Root", 0, nbl, 1 );
for (ill = 1; ill <= nbl && PSentry.More(); ill ++, PSentry.Next()) {
num = sr.Model()->Number(list->Value(ill));
if (num == 0) continue;
- if (!sr.TransferOne(num)) di<<"Transfer entity n0 "<<num<<" : no result\n";
+ if (!sr.TransferEntity (WS->StartingEntity(num))) di<<"Transfer entity n0 "<<num<<" : no result\n";
else {
nbs = sr.NbShapes();
char shname[30]; Sprintf (shname,"%s_%d",rnom.ToCString(),nbs);
DBRep::Set (shname,sh);
}
}
- sr.WS()->TransferReader()->TransientProcess()->SetProgress ( 0 );
+ WS->ReaderProcess()->SetProgress ( 0 );
progress->EndScope();
progress->Show();
}
}
STEPControl_Reader Reader;
Standard_CString filename = argv[1];
- IFSelect_ReturnStatus readstat = Reader.ReadFile(filename);
+ Interface_ReturnStatus readstat = Reader.ReadFile(filename);
di<<"Status from reading STEP file "<<filename<<" : ";
switch(readstat) {
- case IFSelect_RetVoid : { di<<"empty file\n"; return 1; }
- case IFSelect_RetDone : { di<<"file read\n"; break; }
- case IFSelect_RetError : { di<<"file not found\n"; return 1; }
- case IFSelect_RetFail : { di<<"error during read\n"; return 1; }
+ case Interface_RetVoid : { di<<"empty file\n"; return 1; }
+ case Interface_RetDone : { di<<"file read\n"; break; }
+ case Interface_RetError : { di<<"file not found\n"; return 1; }
+ case Interface_RetFail : { di<<"error during read\n"; return 1; }
default : { di<<"failure\n"; return 1; }
}
Reader.TransferRoots();
default : di<<"1st arg = mode, incorrect [give fsmw]\n"; return 1;
}
- //:k8 abv 6 Jan 98: using parameter for writing mode (assemblies/shapes)
- Handle(STEPControl_ActorWrite) ActWrite =
- Handle(STEPControl_ActorWrite)::DownCast ( ctl->ActorWrite() );
- if ( ! ActWrite.IsNull() )
- ActWrite->SetGroupMode (Interface_Static::IVal("write.step.assembly"));
-
TopoDS_Shape shape = DBRep::Get(argv[2]);
STEPControl_Writer sw (XSDRAW::Session(),Standard_False);
- Handle(Interface_InterfaceModel) stepmodel = sw.Model();
+ Handle(StepData_StepModel) stepmodel = sw.Model();
Standard_Integer nbavant = (stepmodel.IsNull() ? 0 : stepmodel->NbEntities());
Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
progress->NewScope(90,"Translating");
progress->Show();
- sw.WS()->TransferWriter()->FinderProcess()->SetProgress(progress);
+ sw.WS()->WriterProcess()->SetProgress(progress);
Standard_Integer stat = sw.Transfer (shape,mode);
- if (stat == IFSelect_RetDone)
+ if (stat == Interface_RetDone)
{
di << "Translation: OK\n";
}
di << "Error: translation failed, status = " << stat << "\n";
}
- sw.WS()->TransferWriter()->FinderProcess()->SetProgress(0);
+ sw.WS()->WriterProcess()->SetProgress(0);
progress->EndScope();
progress->Show();
progress->NewScope(10,"Writing");
if (nbapres == 0) { di<<"No data to write\n"; return 0; }
if (argc <= 3) {
- di<<" Now, to write a file, command : writeall filename\n";
+ di<<" Now, the model is ready\n";
return 0;
}
const char *nomfic = argv[3];
stat = sw.Write(nomfic);
switch (stat) {
- case IFSelect_RetVoid : di<<"Error: No file written\n"; break;
- case IFSelect_RetDone : di<<"File "<<nomfic<<" written\n"; break;
- case IFSelect_RetStop : di<<"Error on writing file: no space on disk or destination is write protected\n"; break;
+ case Interface_RetVoid : di<<"Error: No file written\n"; break;
+ case Interface_RetDone : di<<"File "<<nomfic<<" written\n"; break;
+ case Interface_RetStop : di<<"Error on writing file: no space on disk or destination is write protected\n"; break;
default : di<<"Error: File "<<nomfic<<" written with fail messages\n"; break;
}
STEPControl_Writer Writer;
Standard_CString filename = argv[1];
TopoDS_Shape shape = DBRep::Get(argv[2]);
- IFSelect_ReturnStatus stat = Writer.Transfer(shape,STEPControl_AsIs);
+ Interface_ReturnStatus stat = Writer.Transfer(shape,STEPControl_AsIs);
stat = Writer.Write(filename);
- if(stat != IFSelect_RetDone){
+ if(stat != Interface_RetDone){
di<<"Error on writing file\n";
return 1;
}
static Standard_Integer countexpected
(Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/)
{
- Handle(IFSelect_SessionPilot) pilot = XSDRAW::Pilot();
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- const Interface_Graph& graph = WS->Graph();
+ const Handle(IFSelect_WorkSession) &WS = XSDRAW::Session();
+ const Interface_Graph& graph = WS->Graph();
Handle(TColStd_HSequenceOfTransient) roots = WS->GiveList("xst-transferrable-roots", "");
STEPSelections_Counter cnt;
static Standard_Integer dumpassembly
(Draw_Interpretor& /*di*/, Standard_Integer /*argc*/, const char** /*argv*/)
{
- Handle(IFSelect_SessionPilot) pilot = XSDRAW::Pilot();
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- const Interface_Graph& graph = WS->Graph();
+ const Interface_Graph& graph = XSDRAW::Session()->Graph();
STEPSelections_AssemblyExplorer exp(graph);
exp.Dump(cout);
}
STEPControl_Reader aStepReader;
- IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
+ Interface_ReturnStatus readstat = Interface_RetVoid;
readstat = aStepReader.ReadFile (argv[1]);
- if (readstat != IFSelect_RetDone) {
+ if (readstat != Interface_RetDone) {
di<<"No model loaded\n";
return 1;
// commercial license or contractual agreement.
-#include <IFSelect_SessionPilot.hxx>
-#include <IFSelect_WorkSession.hxx>
#include <Interface_Macros.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <StepData_Plex.hxx>
#include <StepData_Simple.hxx>
#include <StepData_UndefinedEntity.hxx>
-#include <STEPControl_FloatFormat.hxx>
+#include <IFSelect_WorkSession.hxx>
#include <XSDRAWSTEP_Activator.hxx>
+#include <XSDRAW_SessionPilot.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(XSDRAWSTEP_Activator,IFSelect_Activator)
+IMPLEMENT_STANDARD_RTTIEXT(XSDRAWSTEP_Activator,XSDRAW_Activator)
XSDRAWSTEP_Activator::XSDRAWSTEP_Activator ()
{
static int initActivator = 0;
if (initActivator) return; initActivator = 1;
-// Add ( 0,"load");
-// Add ( 0,"loadstep"); // homonyme
-// Add ( 1,"entity");
-// Add ( 2,"liststep");
-
-// AddSet (10,"steptype");
Add ( 1,"stepschema");
- AddSet (40,"floatformat");
}
-IFSelect_ReturnStatus XSDRAWSTEP_Activator::Do
+Interface_ReturnStatus XSDRAWSTEP_Activator::Do
(const Standard_Integer number,
- const Handle(IFSelect_SessionPilot)& pilot)
+ const Handle(XSDRAW_SessionPilot)& pilot)
{
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Word(1).ToCString();
const Standard_CString arg2 = pilot->Word(2).ToCString();
-// const Standard_CString arg3 = pilot->Word(3).ToCString();
switch (number) {
case 1 : { // **** StepSchema
if (argc < 2) {
cout<<"Identify an entity"<<endl;
- return IFSelect_RetError;
+ return Interface_RetError;
}
Standard_Integer num = pilot->Number(arg1);
if (num <= 0) {
cout<<"Not an entity : "<<arg2<<endl;
- return IFSelect_RetError;
+ return Interface_RetError;
}
Handle(Standard_Transient) ent = pilot->Session()->StartingEntity(num);
DeclareAndCast(StepData_UndefinedEntity,und,ent);
if (!und.IsNull()) {
cout<<"Entity "<<arg2<<" : No Binding known"<<endl;
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
DeclareAndCast(StepData_Simple,sim,ent);
if (!sim.IsNull()) {
cout<<"Entity "<<arg2<<" : Late Binding"<<endl;
cout<<"Simple Type : "<<sim->StepType()<<endl;
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
DeclareAndCast(StepData_Plex,plx,ent);
if (!plx.IsNull()) {
// reste Early Binding
cout<<"Entity "<<arg2<<" : Early Binding"<<endl;
cout<<"CDL Type : "<<ent->DynamicType()->Name()<<endl;
- return IFSelect_RetVoid;
- }
-
- case 40 : { // **** FloatFormat
- char prem = ' ';
- if (argc < 2) prem = '?';
- else if (argc == 5) { cout<<"floatformat tout court donne les formes admises"<<endl; return IFSelect_RetError; }
- else prem = arg1[0];
- Standard_Boolean zerosup=Standard_False;
- Standard_Integer digits = 0;
- if (prem == 'N' || prem == 'n') zerosup = Standard_False;
- else if (prem == 'Z' || prem == 'z') zerosup = Standard_True;
- else if (prem >= 48 && prem <= 57) digits = atoi(arg1);
- else {
- cout<<"floatformat digits, digits=nb de chiffres signifiants, ou\n"
- << "floatformat NZ %mainformat [%rangeformat [Rmin Rmax]]\n"
- <<" NZ : N ou n pour Non-zero-suppress, Z ou z pour zero-suppress\n"
- <<" %mainformat : format principal type printf, ex,: %E\n"
- <<" + optionnel : format secondaire (flottants autour de 1.) :\n"
- <<" %rangeformat Rmin Rmax : format type printf entre Rmin et Rmax\n"
- <<" %rangeformat tout seul : format type printf entre 0.1 et 1000.\n"
- <<flush;
- return (prem == '?' ? IFSelect_RetVoid : IFSelect_RetError);
- }
- Standard_Real Rmin=0., Rmax=0.;
- if (argc > 4) {
- Rmin = Atof(pilot->Word(4).ToCString());
- Rmax = Atof(pilot->Word(5).ToCString());
- if (Rmin <= 0 || Rmax <= 0) { cout<<"intervalle : donner reels > 0"<<endl; return IFSelect_RetError; }
- }
- Handle(STEPControl_FloatFormat) fm = new STEPControl_FloatFormat;
- if (argc == 2) fm->SetDefault(digits);
- else {
- fm->SetZeroSuppress(zerosup);
- fm->SetFormat (arg2);
- if (argc == 4) fm->SetFormatForRange(pilot->Word(3).ToCString());
- else if (argc >= 6) fm->SetFormatForRange(pilot->Word(3).ToCString(),Rmin,Rmax);
- else fm->SetFormatForRange("");
- }
- return pilot->RecordItem(fm);
+ return Interface_RetVoid;
}
default : break;
}
- return IFSelect_RetVoid;
+ return Interface_RetVoid;
}
Standard_CString XSDRAWSTEP_Activator::Help
- (const Standard_Integer number) const
+ (const Standard_Integer) const
{
- switch (number) {
-
- case 40 : return "options... : cree FloatFormat ... floatformat tout court->help";
- default : break;
- }
return "";
}
#ifndef _XSDRAWSTEP_Activator_HeaderFile
#define _XSDRAWSTEP_Activator_HeaderFile
-#include <IFSelect_Activator.hxx>
+#include <XSDRAW_Activator.hxx>
//! Performs Actions specific to StepSelect, i.e. creation of
//! Step Selections and Counters, plus dumping specific to Step
-class XSDRAWSTEP_Activator : public IFSelect_Activator
+class XSDRAWSTEP_Activator : public XSDRAW_Activator
{
public:
Standard_EXPORT XSDRAWSTEP_Activator();
//! Executes a Command Line for StepSelect
- Standard_EXPORT IFSelect_ReturnStatus Do (const Standard_Integer number, const Handle(IFSelect_SessionPilot)& pilot) Standard_OVERRIDE;
+ Standard_EXPORT Interface_ReturnStatus Do (const Standard_Integer number, const Handle(XSDRAW_SessionPilot)& pilot) Standard_OVERRIDE;
//! Sends a short help message for StepSelect commands
Standard_EXPORT Standard_CString Help (const Standard_Integer number) const Standard_OVERRIDE;
- DEFINE_STANDARD_RTTIEXT(XSDRAWSTEP_Activator,IFSelect_Activator)
+ DEFINE_STANDARD_RTTIEXT(XSDRAWSTEP_Activator,XSDRAW_Activator)
};
#endif // _XSDRAWSTEP_Activator_HeaderFile
+++ /dev/null
-// 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 <XSDRAWSTEP_EditHeader.hxx>
-#include <APIHeaderSection_MakeHeader.hxx>
-#include <IFSelect_EditForm.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_TypedValue.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <StepData_StepModel.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(XSDRAWSTEP_EditHeader,IFSelect_Editor)
-
-static Standard_Boolean IsTimeStamp
- (const Handle(TCollection_HAsciiString)& val)
-{
- if (val.IsNull()) return Standard_False;
- if (val->Length() != 19) return Standard_False;
-// On y va
- char dizmois = val->Value(6);
- char dizjour = val->Value(9);
- char dizheur = val->Value(12);
- for (Standard_Integer i = 1; i <= 19; i ++) {
- char uncar = val->Value(i);
- switch (i) {
- case 1 : if (uncar != '1' && uncar != '2') return Standard_False; break;
- case 2 :
- case 3 :
- case 4 : if (uncar < '0' || uncar > '9') return Standard_False; break;
- case 5 : if (uncar != '-') return Standard_False;
- case 6 : if (uncar != '0' && uncar != '1') return Standard_False; break;
- case 7 : if (uncar < '0' || uncar > '9') return Standard_False;
- if (dizmois == '1' && (uncar < '0' || uncar > '2')) return Standard_False; break;
- case 8 : if (uncar != '-') return Standard_False;
- case 9 : if (uncar < '0' || uncar > '3') return Standard_False; break;
- case 10 : if (uncar < '0' || uncar > '9') return Standard_False;
- if (dizjour == '3' && (uncar != '0' && uncar != '1')) return Standard_False; break;
- case 11 : if (uncar != 'T') return Standard_False;
- case 12 : if (uncar < '0' || uncar > '2') return Standard_False; break;
- case 13 : if (uncar < '0' || uncar > '9') return Standard_False;
- if (dizheur == '2' && (uncar < '0' || uncar > '3')) return Standard_False; break;
- case 14 : if (uncar != ':') return Standard_False;
- case 15 : if (uncar < '0' || uncar > '5') return Standard_False; break;
- case 16 : if (uncar < '0' || uncar > '9') return Standard_False; break;
- case 17 : if (uncar != ':') return Standard_False;
- case 18 : if (uncar < '0' || uncar > '5') return Standard_False; break;
- case 19 : if (uncar < '0' || uncar > '9') return Standard_False; break;
- default : break;
- }
- }
- return Standard_True;
-}
-
-
- XSDRAWSTEP_EditHeader::XSDRAWSTEP_EditHeader ()
- : IFSelect_Editor (10)
-{
-// Definition
- Handle(Interface_TypedValue) fn_name = new Interface_TypedValue("fn_name");
- SetValue (1,fn_name,"name");
- Handle(Interface_TypedValue) fn_time = new Interface_TypedValue("fn_time_stamp");
- fn_time->SetSatisfies (IsTimeStamp,"IsTimeStamp");
- SetValue (2,fn_time,"time");
- Handle(Interface_TypedValue) fn_author = new Interface_TypedValue("fn_author");
- SetValue (3,fn_author,"author"); // 1 seul (1er de liste)
- Handle(Interface_TypedValue) fn_org = new Interface_TypedValue("fn_organization");
- SetValue (4,fn_org,"org"); // 1 seul (1er de liste)
- Handle(Interface_TypedValue) fn_preproc = new Interface_TypedValue("fn_preprocessor_version");
- SetValue (5,fn_preproc,"preproc");
- Handle(Interface_TypedValue) fn_orig = new Interface_TypedValue("fn_originating_system");
- SetValue (6,fn_orig,"orig");
- Handle(Interface_TypedValue) fn_autorize = new Interface_TypedValue("fn_authorization");
- SetValue (7,fn_autorize,"autorize");
-
- Handle(Interface_TypedValue) fs_schema = new Interface_TypedValue("fs_schema_identifiers");
- SetValue (8,fs_schema,"schema"); // 1 seul (1er de liste)
-
- Handle(Interface_TypedValue) fd_descr = new Interface_TypedValue("fd_description");
- SetValue (9,fd_descr,"descr"); // 1 seul (1er de liste)
-
- Handle(Interface_TypedValue) fd_level = new Interface_TypedValue("fd_implementation_level");
- SetValue (10,fd_level,"level");
-
-}
-
- TCollection_AsciiString XSDRAWSTEP_EditHeader::Label () const
- { return TCollection_AsciiString ("Step Header"); }
-
- Standard_Boolean XSDRAWSTEP_EditHeader::Recognize
- (const Handle(IFSelect_EditForm)& /*form*/) const
-{ return Standard_True; } // ??
-
- Handle(TCollection_HAsciiString) XSDRAWSTEP_EditHeader::StringValue
- (const Handle(IFSelect_EditForm)& /*form*/, const Standard_Integer num) const
-{
-// Default Values
- return TypedValue(num)->HStringValue();
-}
-
- Standard_Boolean XSDRAWSTEP_EditHeader::Load
- (const Handle(IFSelect_EditForm)& form,
- const Handle(Standard_Transient)& /*ent*/,
- const Handle(Interface_InterfaceModel)& model) const
-{
- Handle(StepData_StepModel) modl =
- Handle(StepData_StepModel)::DownCast(model);
- if (modl.IsNull()) return Standard_False;
-
- APIHeaderSection_MakeHeader mkh (modl);
-
- form->LoadValue (1 ,mkh.Name ());
- form->LoadValue (2 ,mkh.TimeStamp ());
- form->LoadValue (3 ,mkh.AuthorValue (1));
- form->LoadValue (4 ,mkh.OrganizationValue (1));
- form->LoadValue (5 ,mkh.PreprocessorVersion ());
- form->LoadValue (6 ,mkh.OriginatingSystem ());
- form->LoadValue (7 ,mkh.Authorisation ());
-
- form->LoadValue (8 ,mkh.SchemaIdentifiersValue (1));
-
- form->LoadValue (9 ,mkh.DescriptionValue (1));
- form->LoadValue (10,mkh.ImplementationLevel ());
-
- return Standard_True;
-}
-
- Standard_Boolean XSDRAWSTEP_EditHeader::Apply
- (const Handle(IFSelect_EditForm)& form,
- const Handle(Standard_Transient)& /*ent*/,
- const Handle(Interface_InterfaceModel)& model) const
-{
- Handle(StepData_StepModel) modl =
- Handle(StepData_StepModel)::DownCast(model);
- if (modl.IsNull()) return Standard_False;
-
- APIHeaderSection_MakeHeader mkh (modl);
-
- if (form->IsModified(1)) mkh.SetName (form->EditedValue(1));
- if (form->IsModified(2)) mkh.SetTimeStamp (form->EditedValue(2));
- if (form->IsModified(3)) mkh.SetAuthorValue (1,form->EditedValue(3));
- if (form->IsModified(4)) mkh.SetOrganizationValue (1,form->EditedValue(4));
- if (form->IsModified(5)) mkh.SetPreprocessorVersion (form->EditedValue(5));
- if (form->IsModified(6)) mkh.SetOriginatingSystem (form->EditedValue(6));
- if (form->IsModified(7)) mkh.SetAuthorisation (form->EditedValue(7));
-
- if (form->IsModified(8)) mkh.SetSchemaIdentifiersValue (1,form->EditedValue(8));
-
- if (form->IsModified(9)) mkh.SetDescriptionValue (1,form->EditedValue(9));
- if (form->IsModified(10)) mkh.SetImplementationLevel (form->EditedValue(10));
-
- mkh.Apply( Handle(StepData_StepModel)::DownCast(model) );
-
- return Standard_True;
-}
+++ /dev/null
-// Created on: 1998-07-08
-// 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 _XSDRAWSTEP_EditHeader_HeaderFile
-#define _XSDRAWSTEP_EditHeader_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Editor.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-class TCollection_AsciiString;
-class IFSelect_EditForm;
-class TCollection_HAsciiString;
-class Standard_Transient;
-class Interface_InterfaceModel;
-
-
-class XSDRAWSTEP_EditHeader;
-DEFINE_STANDARD_HANDLE(XSDRAWSTEP_EditHeader, IFSelect_Editor)
-
-
-class XSDRAWSTEP_EditHeader : public IFSelect_Editor
-{
- public:
-
- Standard_EXPORT XSDRAWSTEP_EditHeader();
-
- 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 Apply (const Handle(IFSelect_EditForm)& form, const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) 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;
-
- DEFINE_STANDARD_RTTIEXT(XSDRAWSTEP_EditHeader,IFSelect_Editor)
-};
-
-#endif // _XSDRAWSTEP_EditHeader_HeaderFile
--- /dev/null
+XSSelect_ConnectedShapes.cxx
+XSSelect_ConnectedShapes.hxx
+XSSelect_SelectForTransfer.cxx
+XSSelect_SelectForTransfer.hxx
+XSSelect_SignTransferStatus.cxx
+XSSelect_SignTransferStatus.hxx
--- /dev/null
+// 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 <Interface_EntityIterator.hxx>
+#include <Interface_Graph.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <Transfer_TransientProcess.hxx>
+#include <TransferBRep.hxx>
+#include <XSSelect_ConnectedShapes.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(XSSelect_ConnectedShapes,IFSelect_SelectExplore)
+
+Standard_Boolean XSSelect_ConnectedShapes::Explore
+ (const Standard_Integer /*level*/, const Handle(Standard_Transient)& ent,
+ const Interface_Graph& /*G*/, Interface_EntityIterator& explored) const
+{
+ if (theTP.IsNull()) return Standard_False;
+ TopoDS_Shape Shape = TransferBRep::ShapeResult (theTP,ent);
+ if (Shape.IsNull()) return Standard_False;
+ Handle(TColStd_HSequenceOfTransient) li = AdjacentEntities (Shape,theTP,TopAbs_FACE);
+ explored.AddList (li);
+ return Standard_True;
+}
+
+TCollection_AsciiString XSSelect_ConnectedShapes::ExploreLabel () const
+{
+ TCollection_AsciiString lab("Connected Entities through produced Shapes");
+ return lab;
+}
+
+Handle(TColStd_HSequenceOfTransient) XSSelect_ConnectedShapes::AdjacentEntities
+ (const TopoDS_Shape& ashape,
+ const Handle(Transfer_TransientProcess)& TP,
+ const TopAbs_ShapeEnum type)
+{
+ Handle(TColStd_HSequenceOfTransient) li = new TColStd_HSequenceOfTransient();
+ Standard_Integer i, nb = TP->NbMapped();
+ TopTools_MapOfShape vtx(20);
+
+ for (TopExp_Explorer vert(ashape,TopAbs_VERTEX); vert.More(); vert.Next()) {
+ vtx.Add (vert.Current());
+ }
+
+ for (i = 1; i <= nb; i ++) {
+ Handle(Transfer_Binder) bnd = TP->MapItem(i);
+ TopoDS_Shape sh = TransferBRep::ShapeResult (bnd);
+ if (sh.IsNull()) continue;
+ if (sh.ShapeType() != type) continue;
+ for (TopExp_Explorer vsh(sh,TopAbs_VERTEX); vsh.More(); vsh.Next()) {
+ TopoDS_Shape avtx = vsh.Current();
+ if (vtx.Contains(avtx)) {
+ li->Append (TP->Mapped(i));
+ break; // break de ce for interieur, entite suivante
+ }
+ }
+ }
+
+ return li;
+}
--- /dev/null
+// Created on: 1999-02-24
+// Created by: Christian CAILLET
+// Copyright (c) 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 _XSSelect_ConnectedShapes_HeaderFile
+#define _XSSelect_ConnectedShapes_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <IFSelect_SelectExplore.hxx>
+#include <Standard_Boolean.hxx>
+#include <Standard_Integer.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+#include <TopAbs_ShapeEnum.hxx>
+class Interface_Graph;
+class Interface_EntityIterator;
+class TCollection_AsciiString;
+class TopoDS_Shape;
+class Transfer_TransientProcess;
+
+
+class XSSelect_ConnectedShapes;
+DEFINE_STANDARD_HANDLE(XSSelect_ConnectedShapes, IFSelect_SelectExplore)
+
+//! From a TopoDS_Shape, or from the entity which has produced it,
+//! searches for the shapes, and the entities which have produced
+//! them in last transfer, which are adjacent to it by VERTICES
+class XSSelect_ConnectedShapes : public IFSelect_SelectExplore
+{
+ public:
+
+ //! Creates a Selection ConnectedShapes, which will work with the current TransferProcess
+ XSSelect_ConnectedShapes(const Handle(Transfer_TransientProcess)& TP) : IFSelect_SelectExplore(1), theTP(TP) {}
+
+ //! Explores an entity : entities from which are connected to that
+ //! produced by this entity, including itself
+ Standard_EXPORT Standard_Boolean Explore (const Standard_Integer level, const Handle(Standard_Transient)& ent, const Interface_Graph& G, Interface_EntityIterator& explored) const Standard_OVERRIDE;
+
+ //! Returns a text defining the criterium.
+ //! "Connected Entities through produced Shapes"
+ Standard_EXPORT TCollection_AsciiString ExploreLabel() const Standard_OVERRIDE;
+
+ //! This functions considers a shape from a transfer and performs
+ //! the search function explained above
+ Standard_EXPORT static Handle(TColStd_HSequenceOfTransient) AdjacentEntities (const TopoDS_Shape& ashape, const Handle(Transfer_TransientProcess)& TP, const TopAbs_ShapeEnum type);
+
+ DEFINE_STANDARD_RTTIEXT(XSSelect_ConnectedShapes,IFSelect_SelectExplore)
+
+ private:
+
+ Handle(Transfer_TransientProcess) theTP;
+};
+
+#endif // _XSSelect_ConnectedShapes_HeaderFile
--- /dev/null
+// 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 <Interface_InterfaceModel.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <Transfer_ActorOfTransientProcess.hxx>
+#include <XSSelect_SelectForTransfer.hxx>
+#include <Transfer_TransientProcess.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(XSSelect_SelectForTransfer,IFSelect_SelectExtract)
+
+Standard_Boolean XSSelect_SelectForTransfer::Sort
+ (const Standard_Integer /*rank*/, const Handle(Standard_Transient)& ent,
+ const Handle(Interface_InterfaceModel)& /*model*/) const
+{
+ Handle(Transfer_ActorOfTransientProcess) act;
+ if (!theTP.IsNull()) act = theTP->GetActor();
+ if (!act.IsNull()) return act->Recognize(ent);
+ return Standard_False;
+}
+
+
+TCollection_AsciiString XSSelect_SelectForTransfer::ExtractLabel () const
+{
+ return TCollection_AsciiString(theTP.IsNull()? "Recognized for Transfer" : "Recognized for Transfer (current actor)");
+}
--- /dev/null
+// Created on: 1996-03-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 _XSSelect_SelectForTransfer_HeaderFile
+#define _XSSelect_SelectForTransfer_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <IFSelect_SelectExtract.hxx>
+class Transfer_TransientProcess;
+class Interface_InterfaceModel;
+class TCollection_AsciiString;
+
+
+class XSSelect_SelectForTransfer;
+DEFINE_STANDARD_HANDLE(XSSelect_SelectForTransfer, IFSelect_SelectExtract)
+
+//! This selection selects the entities which are recognised for
+//! transfer by an Actor for Read : current one or another one.
+//!
+//! An Actor is an operator which runs transfers from interface
+//! entities to objects for Imagine. It has a method to recognize
+//! the entities it can process (by default, it recognises all,
+//! this method can be redefined).
+//!
+//! A TransferProcess brings an Actor, according to the currently
+//! selected norm and transfer conditions.
+class XSSelect_SelectForTransfer : public IFSelect_SelectExtract
+{
+ public:
+
+ //! Creates a SelectForTransfer, which will work with the
+ //! currently defined Actor brought by the TransferProcess
+ XSSelect_SelectForTransfer(const Handle(Transfer_TransientProcess)& TP) : theTP(TP) {}
+
+ //! Returns True for an Entity which is recognized by the Actor,
+ //! either the precised one, or the one defined by TransferProcess
+ Standard_EXPORT Standard_Boolean Sort (const Standard_Integer rank, const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
+
+ //! Returns a text defining the criterium : "Recognized for Transfer [(current actor)]"
+ Standard_EXPORT TCollection_AsciiString ExtractLabel() const Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT(XSSelect_SelectForTransfer,IFSelect_SelectExtract)
+
+ protected:
+
+ Handle(Transfer_TransientProcess) theTP;
+};
+
+#endif // _XSSelect_SelectForTransfer_HeaderFile
--- /dev/null
+// 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 <Interface_Check.hxx>
+#include <Interface_InterfaceModel.hxx>
+#include <Transfer_Binder.hxx>
+#include <Transfer_TransientProcess.hxx>
+#include <XSSelect_SignTransferStatus.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(XSSelect_SignTransferStatus,IFSelect_Signature)
+
+// si resultat avec type: a exploiter tout de suite !
+
+// BinderStatus retourne une valeur :
+// 0 Binder Null. 1 void 2 Warning seul 3 Fail seul
+// 11 Resultat OK. 12 Resultat+Warning. 13 Resultat+Fail
+// 20 Abnormal (Interrupted)
+
+static Standard_Integer BinderStatus (const Handle(Transfer_Binder)& binder)
+{
+ Standard_Integer stat = 0;
+ if (binder.IsNull()) return 0;
+ Interface_CheckStatus cst = binder->Check()->Status();
+ Transfer_StatusExec est = binder->StatusExec ();
+ Standard_Boolean res = binder->HasResult();
+ if (est == Transfer_StatusRun || est == Transfer_StatusLoop) return 20;
+ if (cst == Interface_CheckOK) stat = (res ? 11 : 1);
+ else if (cst == Interface_CheckWarning) stat = (res ? 12 : 2);
+ else if (cst == Interface_CheckFail) stat = (res ? 13 : 3);
+
+ return stat;
+}
+
+Standard_CString XSSelect_SignTransferStatus::Value
+ (const Handle(Standard_Transient)& ent,
+ const Handle(Interface_InterfaceModel)& /*model*/) const
+{
+ if (ent.IsNull()) return "";
+ if (theTP.IsNull()) return "";
+
+ Handle(Transfer_Binder) binder = theTP->Find(ent);
+
+ Standard_Integer stat = BinderStatus (binder);
+
+ if (stat <= 1) return "";
+ if (stat == 2) return "Warning";
+ if (stat == 3) return "Fail";
+ if (stat == 20) return "Fail on run";
+
+ theMes.Clear();
+ if (stat > 10) {
+// Y a un resultat : donner son type
+ Handle(Transfer_Binder) bnd = binder;
+ Standard_Integer hasres = Standard_False;
+ while (!bnd.IsNull()) {
+ if (bnd->Status() != Transfer_StatusVoid) {
+ theMes.AssignCat(hasres? "," : "Result:");
+ theMes.AssignCat(bnd->ResultTypeName());
+ hasres = Standard_True;
+ }
+ bnd = bnd->NextResult();
+ }
+ if (stat == 12) theMes.AssignCat("/Warning");
+ if (stat == 13) theMes.AssignCat("/Fail");
+ }
+ return theMes.ToCString();
+}
--- /dev/null
+// Created on: 1998-07-31
+// 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 _XSSelect_SignTransferStatus_HeaderFile
+#define _XSSelect_SignTransferStatus_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <IFSelect_Signature.hxx>
+#include <TCollection_AsciiString.hxx>
+class Transfer_TransientProcess;
+class Interface_InterfaceModel;
+
+
+class XSSelect_SignTransferStatus;
+DEFINE_STANDARD_HANDLE(XSSelect_SignTransferStatus, IFSelect_Signature)
+
+//! This Signatures gives the Transfer Status of an entity, as
+//! recorded in a TransferProcess. It can be :
+//! - Void : not recorded, or recorded as void with no message
+//! (attributes are not taken into account)
+//! - Warning : no result, warning message(s), no fail
+//! - Fail : no result, fail messages (with or without warning)
+//! - Result.. : result, no message (neither warning nor fail)
+//! Result.. i.e. Result:TypeName of the result
+//! - Result../Warning : result, with warning but no fail
+//! - Result../Fail : result, with fail (.e. bad result)
+//! - Fail on run : no result yet recorded, no message, but
+//! an exception occurred while recording the result
+//! (this should not appear and indicates a programming error)
+class XSSelect_SignTransferStatus : public IFSelect_Signature
+{
+ public:
+
+ //! Creates a SignTransferStatus, which will work on the current TransientProcess
+ XSSelect_SignTransferStatus(const Handle(Transfer_TransientProcess)& TP) : IFSelect_Signature("Transfer Status"), theTP(TP) {}
+
+ //! Returns the Signature for a Transient object, as its transfer
+ //! status
+ Standard_EXPORT Standard_CString Value (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT(XSSelect_SignTransferStatus,IFSelect_Signature)
+
+ private:
+
+ Handle(Transfer_TransientProcess) theTP;
+ mutable TCollection_AsciiString theMes;
+};
+
+#endif // _XSSelect_SignTransferStatus_HeaderFile