Before performing any other operation, you have to load the file using the syntax below.
~~~~{.cpp}
IGESControl_Reader reader;
-IFSelect_ReturnStatus stat = reader.ReadFile(“filename.igs”);
+XSControl_ReturnStatus stat = reader.ReadFile(“filename.igs”);
~~~~
The loading operation only loads the IGES file into computer memory; it does not translate it.
Before performing any other operation, you must load an IGES file with:
~~~~{.cpp}
IGESCAFControl_Reader reader(XSDRAW::Session(), Standard_False);
-IFSelect_ReturnStatus stat = reader.ReadFile(“filename.igs”);
+XSControl_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:
~~~~{.cpp}
-IFSelect_ReturnStatus aRetSt = aWriter.Transfer(doc);
+XSControl_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:
~~~~{.cpp}
-IFSelect_ReturnStatus statw = aWriter.WriteFile("filename.igs");
+XSControl_ReturnStatus statw = aWriter.WriteFile("filename.igs");
~~~~
or
~~~~{.cpp}
-IFSelect_ReturnStatus statw = writer.WriteFile (S);
+XSControl_ReturnStatus statw = writer.WriteFile (S);
~~~~
where S is OStream.
Before performing any other operation you have to load the file with:
~~~~{.cpp}
STEPControl_Reader reader;
-IFSelect_ReturnStatus stat = reader.ReadFile("filename.stp");
+XSControl_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.
~~~~{.cpp}
STEP214Control_StepModelTope mode = STEP214Control_ManifoldSolidBrep;
-IFSelect_ReturnStatus stat = writer.Transfer(shape,mode);
+XSControl_ReturnStatus stat = writer.Transfer(shape,mode);
~~~~
@subsubsection occt_step_3_3_4 Writing the STEP file
Write the STEP file with:
~~~~{.cpp}
-IFSelect_ReturnStatus stat = writer.Write("filename.stp");
+XSControl_ReturnStatus stat = writer.Write("filename.stp");
~~~~
to give the file name.
Before performing any other operation, you must load a STEP file with:
~~~~{.cpp}
STEPCAFControl_Reader reader(XSDRAW::Session(), Standard_False);
-IFSelect_ReturnStatus stat = reader.ReadFile("filename.stp");
+XSControl_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:
~~~~{.cpp}
-IFSelect_ReturnStatus aRetSt = aWriter.Transfer(doc);
+XSControl_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:
~~~~{.cpp}
-IFSelect_ReturnStatus statw = aWriter.WriteFile("filename.stp");
+XSControl_ReturnStatus statw = aWriter.WriteFile("filename.stp");
~~~~
or
~~~~{.cpp}
-IFSelect_ReturnStatus statw = writer.WriteFile (S);
+XSControl_ReturnStatus statw = writer.WriteFile (S);
~~~~
where *S* is *OStream*.
~~~~{.cpp}
const char* theFilename = ...;
STEPCAFControl_Reader aReader;
-IFSelect_ReturnStatus aReadStat = aReader.ReadFile (theFilename);
-if (aReadStat != IFSelect_RetDone) { .. reader/parser error .. }
+XSControl_ReturnStatus aReadStat = aReader.ReadFile (theFilename);
+if (aReadStat != XSControl_RetDone) { .. reader/parser error .. }
// 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) aDoc = ...;
// writing the File
const char* theFilename = ...;
-IFSelect_ReturnStatus aStat = aWriter.Write (theFilename);
-if (aStat != IFSelect_RetDone) { .. writing failed .. }
+XSControl_ReturnStatus aStat = aWriter.Write (theFilename);
+if (aStat != XSControl_RetDone) { .. writing failed .. }
~~~~
@subsection occt_xde_2_11_3 Reading an IGES File
+++ /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 <APIHeaderSection_EditHeader.hxx>
-#include <APIHeaderSection_MakeHeader.hxx>
-#include <IFSelect_EditForm.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(APIHeaderSection_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;
- Standard_FALLTHROUGH
- 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;
- Standard_FALLTHROUGH
- 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;
- Standard_FALLTHROUGH
- 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;
- Standard_FALLTHROUGH
- 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;
- Standard_FALLTHROUGH
- 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;
-}
-
-
- APIHeaderSection_EditHeader::APIHeaderSection_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 APIHeaderSection_EditHeader::Label () const
- { return TCollection_AsciiString ("Step Header"); }
-
- Standard_Boolean APIHeaderSection_EditHeader::Recognize
- (const Handle(IFSelect_EditForm)& /*form*/) const
-{ return Standard_True; } // ??
-
- Handle(TCollection_HAsciiString) APIHeaderSection_EditHeader::StringValue
- (const Handle(IFSelect_EditForm)& /*form*/, const Standard_Integer num) const
-{
-// Default Values
- return TypedValue(num)->HStringValue();
-}
-
- Standard_Boolean APIHeaderSection_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 APIHeaderSection_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 _APIHeaderSection_EditHeader_HeaderFile
-#define _APIHeaderSection_EditHeader_HeaderFile
-
-#include <Standard.hxx>
-
-#include <IFSelect_Editor.hxx>
-#include <Standard_Integer.hxx>
-class TCollection_AsciiString;
-class IFSelect_EditForm;
-class TCollection_HAsciiString;
-class Standard_Transient;
-class Interface_InterfaceModel;
-
-
-class APIHeaderSection_EditHeader;
-DEFINE_STANDARD_HANDLE(APIHeaderSection_EditHeader, IFSelect_Editor)
-
-
-class APIHeaderSection_EditHeader : public IFSelect_Editor
-{
-
-public:
-
-
- Standard_EXPORT APIHeaderSection_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(APIHeaderSection_EditHeader,IFSelect_Editor)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _APIHeaderSection_EditHeader_HeaderFile
+++ /dev/null
-// Created on: 1993-08-12
-// Created by: Frederic MAUPAS
-// 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.
-
-//#58 rln 28.12.98 STEP header fields (NOTE: more parameterization is necessary)
-//pdn 11.01.99 including <stdio.h> for compilation on NT
-
-#include <APIHeaderSection_MakeHeader.hxx>
-#include <HeaderSection_FileDescription.hxx>
-#include <HeaderSection_FileName.hxx>
-#include <HeaderSection_FileSchema.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_HArray1OfHAsciiString.hxx>
-#include <Interface_Macros.hxx>
-#include <Interface_MSG.hxx>
-#include <Interface_Version.hxx>
-#include <StepData_Protocol.hxx>
-#include <StepData_StepModel.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-#include <stdio.h>
-// This is a generic header for any STEP sheme
-static Handle(TCollection_HAsciiString) nulstr;
-static Handle(Interface_HArray1OfHAsciiString) nularr;
-
-APIHeaderSection_MakeHeader::APIHeaderSection_MakeHeader
- (const Handle(StepData_StepModel)& model)
-{
- done = Standard_True;
- if (model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileName))) {
- fn = GetCasted(HeaderSection_FileName,
- model->HeaderEntity(STANDARD_TYPE(HeaderSection_FileName)));
- }
- else done = Standard_False;
- if (model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileSchema))) {
- fs = GetCasted(HeaderSection_FileSchema,
- model->HeaderEntity(STANDARD_TYPE(HeaderSection_FileSchema)));
- }
- else done = Standard_False;
- if (model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileDescription))) {
- fd = GetCasted(HeaderSection_FileDescription,
- model->HeaderEntity(STANDARD_TYPE(HeaderSection_FileDescription)));
- }
- else done = Standard_False;
-}
-
-APIHeaderSection_MakeHeader::APIHeaderSection_MakeHeader
- (const Standard_Integer shapetype)
-{
- switch(shapetype) {
- case 1 : Init ("Open CASCADE Facetted BRep Model"); break;
- case 2 : Init ("Open CASCADE Face Based Surface Model"); break;
- case 3 : Init ("Open CASCADE Shell Based Surface Model"); break;
- case 4 : Init ("Open CASCADE Manifold Solid Brep Model"); break;
- default: Init ("Open CASCADE Shape Model"); break;
- }
-}
-
-void APIHeaderSection_MakeHeader::Init (const Standard_CString nameval)
-{
- done = Standard_True;
-
- // - File Name
- char timestamp[50];
-
- if (fn.IsNull()) fn = new HeaderSection_FileName;
- Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(nameval);
- fn->SetName(name);
- Interface_MSG::TDate (timestamp,0,0,0,0,0,1,"C:%4.4d-%2.2d-%2.2dT%2.2d:%2.2d:%2.2d"); // actually
- Handle(TCollection_HAsciiString) tst =
- new TCollection_HAsciiString(timestamp);
- fn->SetTimeStamp(tst);
- Handle(Interface_HArray1OfHAsciiString) authors =
- new Interface_HArray1OfHAsciiString(1,1);
- Handle(TCollection_HAsciiString) a1 =
- new TCollection_HAsciiString("Author");
- authors->SetValue(1,a1);
- fn->SetAuthor(authors);
- Handle(Interface_HArray1OfHAsciiString) org =
- new Interface_HArray1OfHAsciiString(1,1);
- Handle(TCollection_HAsciiString) org1 =
- new TCollection_HAsciiString("Open CASCADE");
- org->SetValue(1,org1);
- fn->SetOrganization(org);
-
- char procver[80];
- sprintf (procver, XSTEP_PROCESSOR_VERSION, "STEP");
- Handle(TCollection_HAsciiString) pv = new TCollection_HAsciiString (procver);
- //Handle(TCollection_HAsciiString) pv =
- //new TCollection_HAsciiString(XSTEP_VERSION);
- fn->SetPreprocessorVersion(pv);
-
- Handle(TCollection_HAsciiString) sys =
- new TCollection_HAsciiString(XSTEP_SYSTEM_VERSION);//#58 rln
- fn->SetOriginatingSystem(sys);
- Handle(TCollection_HAsciiString) auth =
- new TCollection_HAsciiString("Unknown");
- fn->SetAuthorisation(auth);
-
- // - File Description
-
- if (fd.IsNull()) fd = new HeaderSection_FileDescription;
- Handle(Interface_HArray1OfHAsciiString) descr =
- new Interface_HArray1OfHAsciiString(1,1);
- Handle(TCollection_HAsciiString) descr1 =
- new TCollection_HAsciiString("Open CASCADE Model");
- descr->SetValue(1,descr1);
- fd->SetDescription(descr);
- Handle(TCollection_HAsciiString) il =
- new TCollection_HAsciiString("2;1");
- fd->SetImplementationLevel(il);
-
- // - File Schema
-
- if (fs.IsNull()) fs = new HeaderSection_FileSchema;
- Handle(Interface_HArray1OfHAsciiString) schid =
- new Interface_HArray1OfHAsciiString(1,1);
- Handle(TCollection_HAsciiString) schid1 =
- new TCollection_HAsciiString("");
- schid->SetValue(1,schid1);
- fs->SetSchemaIdentifiers(schid);
-
-}
-
-Standard_Boolean APIHeaderSection_MakeHeader::IsDone() const
-{
- return done;
-}
-
-void APIHeaderSection_MakeHeader::Apply
- (const Handle(StepData_StepModel)& model) const
-{
- Interface_EntityIterator header = model->Header();
- if (HasFd() && !model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileDescription)))
- header.AddItem(fd);
- if (HasFn() && !model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileName)))
- header.AddItem(fn);
- if (HasFs() && !model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileSchema))) {
-
-// Schema defined? If not take it from the protocole
- Handle(TCollection_HAsciiString) sch;
- Handle(Interface_HArray1OfHAsciiString) schid = fs->SchemaIdentifiers();
- if (!schid.IsNull()) sch = schid->Value(1);
- else {
- schid = new Interface_HArray1OfHAsciiString(1,1);
- fs->SetSchemaIdentifiers(schid);
- }
- if (!sch.IsNull()) { if (sch->Length() < 2) sch.Nullify(); } // not defined
- if (sch.IsNull()) {
- Handle(StepData_Protocol) stepro = Handle(StepData_Protocol)::DownCast
- ( model->Protocol());
- if (!stepro.IsNull()) sch = new TCollection_HAsciiString
- (stepro->SchemaName());
- if (!sch.IsNull()) schid->SetValue (1,sch);
- }
- header.AddItem(fs);
- }
- model->ClearHeader();
- for (header.Start(); header.More(); header.Next())
- model->AddHeaderEntity(header.Value());
-}
-
-
-// ========
-// FileName
-// ========
-
-Handle(StepData_StepModel) APIHeaderSection_MakeHeader::NewModel
- (const Handle(Interface_Protocol)& protocol) const
-{
- Handle(StepData_StepModel) stepmodel = new StepData_StepModel;
- stepmodel->SetProtocol (protocol);
-
- // - Make Header information
-
- Apply(stepmodel);
- return stepmodel;
-}
-
-// ######## Individual Queries / Actions ########
-
-// ========
-// FileName
-// ========
-
-Standard_Boolean APIHeaderSection_MakeHeader::HasFn() const
-{ return (!fn.IsNull()); }
-
-Handle(HeaderSection_FileName) APIHeaderSection_MakeHeader::FnValue() const
-{
- return fn;
-}
-
-/*
-void APIHeaderSection_MakeHeader::SetNameFromShapeType(const Standard_Integer shapetype)
-{
- Handle(TCollection_HAsciiString) name;
- switch(shapetype)
- {
- case 1: // face_based_surface_model
- name = new TCollection_HAsciiString
- ("Euclid Face Based Surface Model");
- break;
- case 2: // manifold_solid_brep
- name = new TCollection_HAsciiString
- ("Euclid Manifold Solid Brep Model");
- break;
- case 3: // facetted_brep
- name = new TCollection_HAsciiString
- ("Euclid Facetted Brep Model");
- break;
- default : // others ?
- name = new TCollection_HAsciiString
- ("Euclid Shape Model");
- break;
- }
- SetName(aName);
-}
-*/
-
-void APIHeaderSection_MakeHeader::SetName(const Handle(TCollection_HAsciiString)& aName)
-{
- if (!fn.IsNull()) fn->SetName(aName);
-}
-
-Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::Name() const
-{
- return (fn.IsNull() ? nulstr : fn->Name());
-}
-
-void APIHeaderSection_MakeHeader::SetTimeStamp(const Handle(TCollection_HAsciiString)& aTimeStamp)
-{
- if (!fn.IsNull()) fn->SetTimeStamp(aTimeStamp);
-}
-
-Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::TimeStamp() const
-{
- return (fn.IsNull() ? nulstr : fn->TimeStamp());
-}
-
-void APIHeaderSection_MakeHeader::SetAuthor(const Handle(Interface_HArray1OfHAsciiString)& aAuthor)
-{
- if (!fn.IsNull()) fn->SetAuthor(aAuthor);
-}
-
-void APIHeaderSection_MakeHeader::SetAuthorValue(const Standard_Integer num, const Handle(TCollection_HAsciiString)& aAuthor)
-{
- if (fn.IsNull()) return;
- Handle(Interface_HArray1OfHAsciiString) li = fn->Author();
- if (num >= li->Lower() && num <= li->Upper()) li->SetValue(num,aAuthor);
-}
-
-Handle(Interface_HArray1OfHAsciiString) APIHeaderSection_MakeHeader::Author() const
-{
- return (fn.IsNull() ? nularr : fn->Author());
-}
-
-Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::AuthorValue(const Standard_Integer num) const
-{
- return (fn.IsNull() ? nulstr : fn->AuthorValue(num));
-}
-
-Standard_Integer APIHeaderSection_MakeHeader::NbAuthor () const
-{
- return (fn.IsNull() ? 0 : fn->NbAuthor());
-}
-
-void APIHeaderSection_MakeHeader::SetOrganization(const Handle(Interface_HArray1OfHAsciiString)& aOrganization)
-{
- if (!fn.IsNull()) fn->SetOrganization(aOrganization);
-}
-
-void APIHeaderSection_MakeHeader::SetOrganizationValue(const Standard_Integer num, const Handle(TCollection_HAsciiString)& aOrgan)
-{
- if (fn.IsNull()) return;
- Handle(Interface_HArray1OfHAsciiString) li = fn->Organization();
- if (num >= li->Lower() && num <= li->Upper()) li->SetValue(num,aOrgan);
-}
-
-Handle(Interface_HArray1OfHAsciiString) APIHeaderSection_MakeHeader::Organization() const
-{
- return (fn.IsNull() ? nularr : fn->Organization());
-}
-
-Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::OrganizationValue(const Standard_Integer num) const
-{
- return (fn.IsNull() ? nulstr : fn->OrganizationValue(num));
-}
-
-Standard_Integer APIHeaderSection_MakeHeader::NbOrganization () const
-{
- return (fn.IsNull() ? 0 : fn->NbOrganization());
-}
-
-void APIHeaderSection_MakeHeader::SetPreprocessorVersion(const Handle(TCollection_HAsciiString)& aPreprocessorVersion)
-{
- if (!fn.IsNull()) fn->SetPreprocessorVersion(aPreprocessorVersion);
-}
-
-Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::PreprocessorVersion() const
-{
- return (fn.IsNull() ? nulstr : fn->PreprocessorVersion());
-}
-
-void APIHeaderSection_MakeHeader::SetOriginatingSystem(const Handle(TCollection_HAsciiString)& aOriginatingSystem)
-{
- if (!fn.IsNull()) fn->SetOriginatingSystem(aOriginatingSystem);
-}
-
-Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::OriginatingSystem() const
-{
- return (fn.IsNull() ? nulstr : fn->OriginatingSystem());
-}
-
-void APIHeaderSection_MakeHeader::SetAuthorisation(const Handle(TCollection_HAsciiString)& aAuthorisation)
-{
- if (!fn.IsNull()) fn->SetAuthorisation(aAuthorisation);
-}
-
-Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::Authorisation() const
-{
- return (fn.IsNull() ? nulstr : fn->Authorisation());
-}
-
-// ===========
-// File Schema
-// ===========
-
-Standard_Boolean APIHeaderSection_MakeHeader::HasFs() const
-{ return (!fs.IsNull()); }
-
-Handle(HeaderSection_FileSchema) APIHeaderSection_MakeHeader::FsValue() const
-{
- return fs;
-}
-
-void APIHeaderSection_MakeHeader::SetSchemaIdentifiers(const Handle(Interface_HArray1OfHAsciiString)& aSchemaIdentifiers)
-{
- if (!fs.IsNull()) fs->SetSchemaIdentifiers(aSchemaIdentifiers);
-}
-
-void APIHeaderSection_MakeHeader::SetSchemaIdentifiersValue(const Standard_Integer num, const Handle(TCollection_HAsciiString)& aSchem)
-{
- if (fs.IsNull()) return;
- Handle(Interface_HArray1OfHAsciiString) li = fs->SchemaIdentifiers();
- if (num >= li->Lower() && num <= li->Upper()) li->SetValue(num,aSchem);
-}
-
-Handle(Interface_HArray1OfHAsciiString) APIHeaderSection_MakeHeader::SchemaIdentifiers() const
-{
- return (fs.IsNull() ? nularr : fs->SchemaIdentifiers());
-}
-
-Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::SchemaIdentifiersValue(const Standard_Integer num) const
-{
- return (fs.IsNull() ? nulstr : fs->SchemaIdentifiersValue(num));
-}
-
-Standard_Integer APIHeaderSection_MakeHeader::NbSchemaIdentifiers () const
-{
- return (fs.IsNull() ? 0 : fs->NbSchemaIdentifiers());
-}
-
-//=======================================================================
-//function : AddSchemaIdentifier
-//purpose :
-//=======================================================================
-
-void APIHeaderSection_MakeHeader::AddSchemaIdentifier(const Handle(TCollection_HAsciiString)& aSchem)
-{
- if ( fs.IsNull() ) fs = new HeaderSection_FileSchema;
- Handle(Interface_HArray1OfHAsciiString) idents = fs->SchemaIdentifiers();
-
- // check that requested subschema is already in the list
- Standard_Integer i;
- for ( i=1; ! idents.IsNull() && i <= idents->Length(); i++ ) {
- if ( aSchem->IsSameString ( idents->Value(i) ) ) return;
- }
-
- // add a subshema
- Handle(Interface_HArray1OfHAsciiString) ids =
- new Interface_HArray1OfHAsciiString ( 1, ( idents.IsNull() ? 1 : idents->Length() + 1 ) );
- for ( i=1; ! idents.IsNull() && i <= idents->Length(); i++ ) {
- ids->SetValue ( i, idents->Value(i) );
- }
- ids->SetValue ( i, aSchem );
-
- fs->SetSchemaIdentifiers ( ids );
-}
-
-// ================
-// File Description
-// ================
-
-Standard_Boolean APIHeaderSection_MakeHeader::HasFd() const
-{ return (!fd.IsNull()); }
-
-Handle(HeaderSection_FileDescription) APIHeaderSection_MakeHeader::FdValue() const
-{
- return fd;
-}
-
-void APIHeaderSection_MakeHeader::SetDescription(const Handle(Interface_HArray1OfHAsciiString)& aDescription)
-{
- if (!fs.IsNull()) fd->SetDescription(aDescription);
-}
-
-void APIHeaderSection_MakeHeader::SetDescriptionValue(const Standard_Integer num, const Handle(TCollection_HAsciiString)& aDescr)
-{
- if (fd.IsNull()) return;
- Handle(Interface_HArray1OfHAsciiString) li = fd->Description();
- if (num >= li->Lower() && num <= li->Upper()) li->SetValue(num,aDescr);
-}
-
-Handle(Interface_HArray1OfHAsciiString) APIHeaderSection_MakeHeader::Description() const
-{
- return (fd.IsNull() ? nularr : fd->Description());
-}
-
-Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::DescriptionValue(const Standard_Integer num) const
-{
- return (fd.IsNull() ? nulstr : fd->DescriptionValue(num));
-}
-
-Standard_Integer APIHeaderSection_MakeHeader::NbDescription () const
-{
- return (fd.IsNull() ? 0 : fd->NbDescription());
-}
-
-void APIHeaderSection_MakeHeader::SetImplementationLevel(const Handle(TCollection_HAsciiString)& aImplementationLevel)
-{
- if (!fd.IsNull()) fd->SetImplementationLevel(aImplementationLevel);
-}
-
-Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::ImplementationLevel() const
-{
- return (fd.IsNull() ? nulstr : fd->ImplementationLevel());
-}
+++ /dev/null
-// Created on: 1993-08-12
-// Created by: Frederic MAUPAS
-// 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 _APIHeaderSection_MakeHeader_HeaderFile
-#define _APIHeaderSection_MakeHeader_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-#include <Interface_HArray1OfHAsciiString.hxx>
-class HeaderSection_FileName;
-class HeaderSection_FileSchema;
-class HeaderSection_FileDescription;
-class StepData_StepModel;
-class Interface_Protocol;
-class TCollection_HAsciiString;
-
-
-//! This class allows to consult and prepare/edit data stored in
-//! a Step Model Header
-class APIHeaderSection_MakeHeader
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- //! Prepares a new MakeHeader from scratch
- Standard_EXPORT APIHeaderSection_MakeHeader(const Standard_Integer shapetype = 0);
-
- //! Prepares a MakeHeader from the content of a StepModel
- //! See IsDone to know if the Header is well defined
- Standard_EXPORT APIHeaderSection_MakeHeader(const Handle(StepData_StepModel)& model);
-
- //! Cancels the former definition and gives a FileName
- //! To be used when a Model has no well defined Header
- Standard_EXPORT void Init (const Standard_CString nameval);
-
- //! Returns True if all data have been defined (see also
- //! HasFn, HasFs, HasFd)
- Standard_EXPORT Standard_Boolean IsDone() const;
-
- //! Creates an empty header for a new
- //! STEP model and allows the header fields to be completed.
- Standard_EXPORT void Apply (const Handle(StepData_StepModel)& model) const;
-
- //! Builds a Header, creates a new StepModel, then applies the
- //! Header to the StepModel
- //! The Schema Name is taken from the Protocol (if it inherits
- //! from StepData, else it is left in blanks)
- Standard_EXPORT Handle(StepData_StepModel) NewModel (const Handle(Interface_Protocol)& protocol) const;
-
- //! Checks whether there is a
- //! file_name entity. Returns True if there is one.
- Standard_EXPORT Standard_Boolean HasFn() const;
-
- //! Returns the file_name entity.
- //! Returns an empty entity if the file_name entity is not initialized.
- Standard_EXPORT Handle(HeaderSection_FileName) FnValue() const;
-
- Standard_EXPORT void SetName (const Handle(TCollection_HAsciiString)& aName);
-
- //! Returns the name attribute for the file_name entity.
- Standard_EXPORT Handle(TCollection_HAsciiString) Name() const;
-
- Standard_EXPORT void SetTimeStamp (const Handle(TCollection_HAsciiString)& aTimeStamp);
-
- //! Returns the value of the time_stamp attribute for the file_name entity.
- Standard_EXPORT Handle(TCollection_HAsciiString) TimeStamp() const;
-
- Standard_EXPORT void SetAuthor (const Handle(Interface_HArray1OfHAsciiString)& aAuthor);
-
- Standard_EXPORT void SetAuthorValue (const Standard_Integer num, const Handle(TCollection_HAsciiString)& aAuthor);
-
- Standard_EXPORT Handle(Interface_HArray1OfHAsciiString) Author() const;
-
- //! Returns the value of the name attribute for the file_name entity.
- Standard_EXPORT Handle(TCollection_HAsciiString) AuthorValue (const Standard_Integer num) const;
-
- //! Returns the number of values for the author attribute in the file_name entity.
- Standard_EXPORT Standard_Integer NbAuthor() const;
-
- Standard_EXPORT void SetOrganization (const Handle(Interface_HArray1OfHAsciiString)& aOrganization);
-
- Standard_EXPORT void SetOrganizationValue (const Standard_Integer num, const Handle(TCollection_HAsciiString)& aOrganization);
-
- Standard_EXPORT Handle(Interface_HArray1OfHAsciiString) Organization() const;
-
- //! Returns the value of attribute
- //! organization for the file_name entity.
- Standard_EXPORT Handle(TCollection_HAsciiString) OrganizationValue (const Standard_Integer num) const;
-
- //! Returns the number of values for
- //! the organization attribute in the file_name entity.
- Standard_EXPORT Standard_Integer NbOrganization() const;
-
- Standard_EXPORT void SetPreprocessorVersion (const Handle(TCollection_HAsciiString)& aPreprocessorVersion);
-
- //! Returns the name of the preprocessor_version for the file_name entity.
- Standard_EXPORT Handle(TCollection_HAsciiString) PreprocessorVersion() const;
-
- Standard_EXPORT void SetOriginatingSystem (const Handle(TCollection_HAsciiString)& aOriginatingSystem);
-
- Standard_EXPORT Handle(TCollection_HAsciiString) OriginatingSystem() const;
-
- Standard_EXPORT void SetAuthorisation (const Handle(TCollection_HAsciiString)& aAuthorisation);
-
- //! Returns the value of the authorization attribute for the file_name entity.
- Standard_EXPORT Handle(TCollection_HAsciiString) Authorisation() const;
-
- //! Checks whether there is a file_schema entity. Returns True if there is one.
- Standard_EXPORT Standard_Boolean HasFs() const;
-
- //! Returns the file_schema entity. Returns an empty entity if the file_schema entity is not initialized.
- Standard_EXPORT Handle(HeaderSection_FileSchema) FsValue() const;
-
- Standard_EXPORT void SetSchemaIdentifiers (const Handle(Interface_HArray1OfHAsciiString)& aSchemaIdentifiers);
-
- Standard_EXPORT void SetSchemaIdentifiersValue (const Standard_Integer num, const Handle(TCollection_HAsciiString)& aSchemaIdentifier);
-
- Standard_EXPORT Handle(Interface_HArray1OfHAsciiString) SchemaIdentifiers() const;
-
- //! Returns the value of the schema_identifier attribute for the file_schema entity.
- Standard_EXPORT Handle(TCollection_HAsciiString) SchemaIdentifiersValue (const Standard_Integer num) const;
-
- //! Returns the number of values for the schema_identifier attribute in the file_schema entity.
- Standard_EXPORT Standard_Integer NbSchemaIdentifiers() const;
-
- //! Add a subname of schema (if not yet in the list)
- Standard_EXPORT void AddSchemaIdentifier (const Handle(TCollection_HAsciiString)& aSchemaIdentifier);
-
- //! Checks whether there is a file_description entity. Returns True if there is one.
- Standard_EXPORT Standard_Boolean HasFd() const;
-
- //! Returns the file_description
- //! entity. Returns an empty entity if the file_description entity is not initialized.
- Standard_EXPORT Handle(HeaderSection_FileDescription) FdValue() const;
-
- Standard_EXPORT void SetDescription (const Handle(Interface_HArray1OfHAsciiString)& aDescription);
-
- Standard_EXPORT void SetDescriptionValue (const Standard_Integer num, const Handle(TCollection_HAsciiString)& aDescription);
-
- Standard_EXPORT Handle(Interface_HArray1OfHAsciiString) Description() const;
-
- //! Returns the value of the
- //! description attribute for the file_description entity.
- Standard_EXPORT Handle(TCollection_HAsciiString) DescriptionValue (const Standard_Integer num) const;
-
- //! Returns the number of values for
- //! the file_description entity in the STEP file header.
- Standard_EXPORT Standard_Integer NbDescription() const;
-
- Standard_EXPORT void SetImplementationLevel (const Handle(TCollection_HAsciiString)& aImplementationLevel);
-
- //! Returns the value of the
- //! implementation_level attribute for the file_description entity.
- Standard_EXPORT Handle(TCollection_HAsciiString) ImplementationLevel() const;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
- Standard_Boolean done;
- Handle(HeaderSection_FileName) fn;
- Handle(HeaderSection_FileSchema) fs;
- Handle(HeaderSection_FileDescription) fd;
-
-
-};
-
-
-
-
-
-
-
-#endif // _APIHeaderSection_MakeHeader_HeaderFile
+++ /dev/null
-APIHeaderSection_EditHeader.cxx
-APIHeaderSection_EditHeader.hxx
-APIHeaderSection_MakeHeader.cxx
-APIHeaderSection_MakeHeader.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.
+
+//szv#4 S4163
+//svv#1 11.01.00 : porting on DEC
+//svv#2 21.02.00 : porting on SIL
+//smh#14 17.03.2000 : FRA62479 Clearing of gtool.
+
+#include <Interface_Check.hxx>
+#include <Interface_CheckIterator.hxx>
+#include <Interface_EntityIterator.hxx>
+#include <Interface_GeneralModule.hxx>
+#include <Interface_GTool.hxx>
+#include <Interface_InterfaceMismatch.hxx>
+#include <Interface_InterfaceModel.hxx>
+#include <Interface_Protocol.hxx>
+#include <Interface_ReportEntity.hxx>
+#include <Interface_SignType.hxx>
+#include <Standard_Transient.hxx>
+#include <Standard_Type.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_Array1OfTransient.hxx>
+#include <TColStd_DataMapIteratorOfDataMapOfIntegerTransient.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Interface_InterfaceModel, Standard_Transient)
+
+// Un Modele d`Interface est un ensemble ferme d`Entites d`interface : chacune
+// est dans un seul modele a la fois; elle y a un numero (Number) qui permet de
+// verifier qu`une entite est bien dans un seul modele, de definir des Map tres
+// performantes, de fournir un identifieur numerique
+// Il est a meme d`etre utilise dans des traitements de Graphe
+// STATICS : les TEMPLATES
+static NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> atemp;
+
+static const Handle(Standard_Type)& typerep()
+{
+ static Handle(Standard_Type) tr = STANDARD_TYPE(Interface_ReportEntity);
+ return tr;
+}
+
+
+static const Handle(Interface_Check)& nulch()
+{
+ static Handle(Interface_Check) anulch = new Interface_Check;
+ return anulch;
+}
+
+
+//=======================================================================
+//function : Interface_InterfaceModel
+//purpose :
+//=======================================================================
+
+Interface_InterfaceModel::Interface_InterfaceModel ()
+ : haschecksem (Standard_False), isdispatch (Standard_False)
+{
+ thecheckstx = new Interface_Check;
+ thechecksem = new Interface_Check;
+}
+
+
+//=======================================================================
+//function : Destroy
+//purpose :
+//=======================================================================
+
+void Interface_InterfaceModel::Destroy () // on fait un mimumum
+{
+// Moins que Clear que, lui, est adapte a chaque norme
+ ClearEntities();
+ thecheckstx->Clear();
+ thechecksem->Clear();
+ thecategory.Nullify();
+}
+
+
+//=======================================================================
+//function : SetProtocol
+//purpose :
+//=======================================================================
+
+void Interface_InterfaceModel::SetProtocol(const Handle(Interface_Protocol)& proto)
+{
+ thegtool = new Interface_GTool(proto);
+}
+
+
+//=======================================================================
+//function : Protocol
+//purpose :
+//=======================================================================
+
+Handle(Interface_Protocol) Interface_InterfaceModel::Protocol () const
+{
+ Handle(Interface_Protocol) proto;
+ if (!thegtool.IsNull()) return thegtool->Protocol();
+ return proto;
+}
+
+
+//=======================================================================
+//function : SetGTool
+//purpose :
+//=======================================================================
+
+void Interface_InterfaceModel::SetGTool(const Handle(Interface_GTool)& gtool)
+{
+ thegtool = gtool;
+}
+
+
+//=======================================================================
+//function : GTool
+//purpose :
+//=======================================================================
+
+Handle(Interface_GTool) Interface_InterfaceModel::GTool () const
+{
+ return thegtool;
+}
+
+
+//=======================================================================
+//function : Clear
+//purpose :
+//=======================================================================
+
+void Interface_InterfaceModel::Clear ()
+{
+ ClearEntities();
+ thecheckstx->Clear();
+ thechecksem->Clear();
+ ClearHeader();
+ ClearLabels();
+ thecategory.Nullify();
+}
+
+
+//=======================================================================
+//function : DispatchStatus
+//purpose :
+//=======================================================================
+
+Standard_Boolean& Interface_InterfaceModel::DispatchStatus ()
+{
+ return isdispatch;
+}
+
+
+//=======================================================================
+//function : ClearEntities
+//purpose :
+//=======================================================================
+
+void Interface_InterfaceModel::ClearEntities ()
+{
+ thereports.Clear();
+ therepch.Clear();
+ haschecksem = Standard_False;
+
+ if (!thegtool.IsNull()) {
+// WhenDeleteCase is not applicable
+/* Handle(Interface_GeneralModule) module; Standard_Integer CN;
+ Standard_Integer nb = NbEntities();
+ for (Standard_Integer i = 1; i <= nb ; i ++) {
+ Handle(Standard_Transient) anent = Value(i);
+ if (thegtool->Select (anent,module,CN))
+ module->WhenDeleteCase (CN,anent,isdispatch);
+ }*/
+ thegtool->ClearEntities(); //smh#14 FRA62479
+ }
+ isdispatch = Standard_False;
+ theentities.Clear();
+}
+
+
+// .... ACCES AUX ENTITES ....
+
+
+//=======================================================================
+//function : NbEntities
+//purpose :
+//=======================================================================
+
+Standard_Integer Interface_InterfaceModel::NbEntities () const
+{
+ return theentities.Extent();
+}
+
+
+//=======================================================================
+//function : Contains
+//purpose :
+//=======================================================================
+
+Standard_Boolean Interface_InterfaceModel::Contains
+ (const Handle(Standard_Transient)& anentity) const
+{
+ if (theentities.Contains(anentity)) return Standard_True;
+ Handle(Interface_ReportEntity) rep =
+ Handle(Interface_ReportEntity)::DownCast(anentity);
+ if (!rep.IsNull()) return Contains(rep->Concerned());
+ return Standard_False;
+}
+
+
+//=======================================================================
+//function : Number
+//purpose :
+//=======================================================================
+
+Standard_Integer Interface_InterfaceModel::Number
+ (const Handle(Standard_Transient)& anentity) const
+{
+ if (anentity.IsNull()) return 0;
+ Standard_Integer num = theentities.FindIndex(anentity);
+ if (num > 0) return num;
+ if (anentity->IsKind(typerep())) {
+ Handle(Interface_ReportEntity) rep =
+ Handle(Interface_ReportEntity)::DownCast(anentity);
+ if (!rep.IsNull()) return Number(rep->Concerned());
+ }
+ return 0;
+}
+
+/*
+Standard_Integer Interface_InterfaceModel::DENumber
+ (const Handle(Standard_Transient)& anentity) const
+{
+ if (anentity.IsNull()) return 0;
+ Standard_Integer num = theentities.FindIndex(anentity);
+ if (num > 0) return (2*num-1);
+ if (anentity->IsKind(typerep())) {
+ Handle(Interface_ReportEntity) rep =
+ Handle(Interface_ReportEntity)::DownCast(anentity);
+ if (!rep.IsNull()) return (Number(rep->Concerned())*2-1);
+ }
+ return 0;
+}
+*/
+
+// .. Acces Speciaux (Report, etc...) ..
+
+
+//=======================================================================
+//function : Value
+//purpose :
+//=======================================================================
+
+const Handle(Standard_Transient)& Interface_InterfaceModel::Value
+ (const Standard_Integer num) const
+{
+ return theentities.FindKey(num);
+}
+
+
+//=======================================================================
+//function : NbTypes
+//purpose :
+//=======================================================================
+
+Standard_Integer Interface_InterfaceModel::NbTypes
+ (const Handle(Standard_Transient)& ent) const
+{
+ if (Protocol().IsNull()) return 1;
+ return Protocol()->NbTypes(ent);
+}
+
+
+//=======================================================================
+//function : Type
+//purpose :
+//=======================================================================
+
+Handle(Standard_Type) Interface_InterfaceModel::Type
+ (const Handle(Standard_Transient)& ent, const Standard_Integer nt) const
+{
+ if (Protocol().IsNull()) return ent->DynamicType();
+ return Protocol()->Type(ent,nt);
+}
+
+
+//=======================================================================
+//function : TypeName
+//purpose :
+//=======================================================================
+
+Standard_CString Interface_InterfaceModel::TypeName
+ (const Handle(Standard_Transient)& ent, const Standard_Boolean complet) const
+{
+ if (!thegtool.IsNull()) return thegtool->SignValue (ent,this);
+ Standard_CString tn = ent->DynamicType()->Name();
+ if (complet) return tn;
+ return Interface_InterfaceModel::ClassName(tn);
+}
+
+
+//=======================================================================
+//function : ClassName
+//purpose :
+//=======================================================================
+
+Standard_CString Interface_InterfaceModel::ClassName(const Standard_CString typnam)
+{
+ return Interface_SignType::ClassName (typnam);
+}
+
+
+//=======================================================================
+//function : EntityState
+//purpose :
+//=======================================================================
+
+Interface_DataState Interface_InterfaceModel::EntityState
+ (const Standard_Integer num) const
+{
+ Handle(Interface_ReportEntity) rep;
+ if (!thereports.IsBound(num)) {
+ if (!therepch.IsBound(num)) return Interface_StateOK;
+ rep = Handle(Interface_ReportEntity)::DownCast(therepch.Find(num));
+ if (rep->IsError()) return Interface_DataFail;
+ return Interface_DataWarning;
+ }
+ rep = Handle(Interface_ReportEntity)::DownCast(thereports.Find(num));
+ if (rep.IsNull()) return Interface_StateUnknown;
+ if (rep->IsUnknown()) return Interface_StateUnknown;
+ if (rep->HasNewContent()) return Interface_StateUnloaded;
+ if (rep->IsError()) return Interface_LoadFail;
+
+ if (!therepch.IsBound(num)) return Interface_LoadWarning;
+ rep = Handle(Interface_ReportEntity)::DownCast(therepch.Find(num));
+ if (rep->IsError()) return Interface_DataFail;
+ return Interface_DataWarning;
+}
+
+
+//=======================================================================
+//function : IsReportEntity
+//purpose :
+//=======================================================================
+
+Standard_Boolean Interface_InterfaceModel::IsReportEntity
+ (const Standard_Integer num, const Standard_Boolean semantic) const
+{
+ return (semantic ? therepch.IsBound(num) : thereports.IsBound(num));
+}
+
+
+//=======================================================================
+//function : ReportEntity
+//purpose :
+//=======================================================================
+
+Handle(Interface_ReportEntity) Interface_InterfaceModel::ReportEntity
+ (const Standard_Integer num, const Standard_Boolean semantic) const
+{
+ Handle(Interface_ReportEntity) rep;
+ if (!IsReportEntity(num,semantic)) return rep;
+ if (semantic) rep = Handle(Interface_ReportEntity)::DownCast(therepch.Find(num));
+ else rep = Handle(Interface_ReportEntity)::DownCast(thereports.Find(num));
+ return rep;
+}
+
+
+//=======================================================================
+//function : IsErrorEntity
+//purpose :
+//=======================================================================
+
+Standard_Boolean Interface_InterfaceModel::IsErrorEntity
+ (const Standard_Integer num) const
+{
+ Handle(Interface_ReportEntity) rep = ReportEntity(num);
+ if (rep.IsNull()) return Standard_False;
+ return rep->IsError();
+}
+
+
+//=======================================================================
+//function : IsRedefinedContent
+//purpose :
+//=======================================================================
+
+Standard_Boolean Interface_InterfaceModel::IsRedefinedContent
+ (const Standard_Integer num) const
+{
+ Handle(Interface_ReportEntity) rep = ReportEntity(num);
+ if (rep.IsNull()) return Standard_False;
+ return rep->HasNewContent();
+}
+
+
+//=======================================================================
+//function : ClearReportEntity
+//purpose :
+//=======================================================================
+
+Standard_Boolean Interface_InterfaceModel::ClearReportEntity
+ (const Standard_Integer num)
+{
+ if (!thereports.IsBound(num)) return Standard_False;
+ thereports.UnBind (num);
+ return Standard_True;
+}
+
+
+//=======================================================================
+//function : SetReportEntity
+//purpose :
+//=======================================================================
+
+Standard_Boolean Interface_InterfaceModel::SetReportEntity
+ (const Standard_Integer num, const Handle(Interface_ReportEntity)& rep)
+{
+ Standard_Integer nm = num;
+ Handle(Standard_Transient) ent;
+ if (num > 0) {
+ ent = Value(nm);
+ if (! (ent == rep->Concerned()) ) throw Interface_InterfaceMismatch("InterfaceModel : SetReportEntity");
+ } else if (num < 0) {
+ nm = -num;
+ ent = Value(nm);
+ if (! (ent == rep->Concerned()) ) throw Interface_InterfaceMismatch("InterfaceModel : SetReportEntity");
+ } else {
+ ent = rep->Concerned();
+ nm = Number (ent);
+ if (nm == 0) throw Interface_InterfaceMismatch("InterfaceModel : SetReportEntity");
+ }
+ if (!thereports.IsBound(nm)) {
+ Standard_Integer maxrep = thereports.NbBuckets();
+ if (thereports.Extent() > maxrep - 10) thereports.ReSize(maxrep*3/2);
+ }
+ if (nm <= 0) return Standard_False;
+ return thereports.Bind (nm,rep);
+}
+
+
+//=======================================================================
+//function : AddReportEntity
+//purpose :
+//=======================================================================
+
+Standard_Boolean Interface_InterfaceModel::AddReportEntity
+ (const Handle(Interface_ReportEntity)& rep, const Standard_Boolean semantic)
+{
+ if (rep.IsNull()) return Standard_False;
+ Handle(Standard_Transient) ent = rep->Concerned();
+ if (ent.IsNull()) return Standard_False;
+ Standard_Integer num = Number(ent);
+ if (num == 0) return Standard_False;
+ if (semantic) return thereports.Bind (num,rep);
+ else return therepch.Bind (num,rep);
+}
+
+
+//=======================================================================
+//function : IsUnknownEntity
+//purpose :
+//=======================================================================
+
+Standard_Boolean Interface_InterfaceModel::IsUnknownEntity
+ (const Standard_Integer num) const
+{
+ Handle(Interface_ReportEntity) rep = ReportEntity(num);
+ if (rep.IsNull()) return Standard_False;
+ return rep->IsUnknown();
+}
+
+
+// .... Checks semantiques .... //
+
+
+//=======================================================================
+//function : FillSemanticChecks
+//purpose :
+//=======================================================================
+
+void Interface_InterfaceModel::FillSemanticChecks
+ (const Interface_CheckIterator& checks, const Standard_Boolean clear)
+{
+ if (!checks.Model().IsNull()) {
+ Handle(Standard_Transient) t1 = checks.Model();
+ Handle(Standard_Transient) t2 = this;
+ if (t2 != t1) return;
+ }
+ if (clear) { therepch.Clear(); thechecksem->Clear(); }
+ Standard_Integer nb = 0;
+ for (checks.Start(); checks.More(); checks.Next()) nb ++;
+ therepch.ReSize (therepch.Extent() + nb + 2);
+ for (checks.Start(); checks.More(); checks.Next()) {
+ const Handle(Interface_Check) ach = checks.Value();
+ Standard_Integer num = checks.Number();
+// global check : ok si MEME MODELE
+ if (num == 0) thechecksem->GetMessages(ach);
+ else {
+ Handle(Standard_Transient) ent = Value(num);
+ Handle(Interface_ReportEntity) rep = new Interface_ReportEntity(ach,ent);
+ therepch.Bind (num,rep);
+ }
+ }
+ haschecksem = Standard_True;
+}
+
+
+//=======================================================================
+//function : HasSemanticChecks
+//purpose :
+//=======================================================================
+
+Standard_Boolean Interface_InterfaceModel::HasSemanticChecks () const
+{
+ return haschecksem;
+}
+
+
+//=======================================================================
+//function : Check
+//purpose :
+//=======================================================================
+
+const Handle(Interface_Check)& Interface_InterfaceModel::Check
+ (const Standard_Integer num, const Standard_Boolean syntactic) const
+{
+ if (num == 0) {
+ if (syntactic) return thecheckstx;
+ else return thechecksem;
+ }
+ if (! (syntactic ? thereports.IsBound(num) : therepch.IsBound(num)) )
+ return nulch();
+ Handle(Standard_Transient) trep;
+ if (syntactic) trep = thereports.Find(num);
+ else trep = therepch.Find(num);
+ Handle(Interface_ReportEntity) rep = Handle(Interface_ReportEntity)::DownCast(trep);
+ if (rep.IsNull()) return nulch();
+ return rep->Check();
+}
+
+
+// .... Chargement des donnees du Modele .... //
+
+
+//=======================================================================
+//function : Reservate
+//purpose :
+//=======================================================================
+
+void Interface_InterfaceModel::Reservate (const Standard_Integer nbent)
+{
+ if (nbent > theentities.NbBuckets()) theentities.ReSize (nbent);
+ if (nbent < -thereports.NbBuckets()) thereports.ReSize (-nbent);
+}
+
+
+//=======================================================================
+//function : AddEntity
+//purpose :
+//=======================================================================
+
+void Interface_InterfaceModel::AddEntity(const Handle(Standard_Transient)& anentity)
+{
+ //Standard_Integer newnum; svv #2
+ if (!anentity->IsKind(typerep())) theentities.Add(anentity);
+// Report : Ajouter Concerned, mais noter presence Report et sa valeur
+ else {
+ Handle(Interface_ReportEntity) rep =
+ Handle(Interface_ReportEntity)::DownCast(anentity);
+ AddEntity(rep->Concerned());
+ Standard_Integer maxrep = thereports.NbBuckets();
+ if (thereports.Extent() > maxrep - 10) thereports.ReSize(maxrep*3/2);
+ thereports.Bind (Number(rep->Concerned()),rep);
+ }
+}
+
+
+// AddWithRefs itere sur les Entities referencees pour charger une Entite
+// au complet, avec tout ce dont elle a besoin
+
+
+//=======================================================================
+//function : AddWithRefs
+//purpose :
+//=======================================================================
+
+void Interface_InterfaceModel::AddWithRefs(const Handle(Standard_Transient)& anent,
+ const Handle(Interface_Protocol)& proto,
+ const Standard_Integer level,
+ const Standard_Boolean listall)
+{
+ if (anent.IsNull()) return;
+ if (theentities.FindIndex(anent) != 0) {
+ if (!listall) return;
+ }
+ Interface_GeneralLib lib(proto);
+ AddWithRefs (anent,lib,level,listall);
+ if (Protocol().IsNull() && !proto.IsNull()) SetProtocol(proto);
+}
+
+
+//=======================================================================
+//function : AddWithRefs
+//purpose :
+//=======================================================================
+
+void Interface_InterfaceModel::AddWithRefs(const Handle(Standard_Transient)& anent,
+ const Standard_Integer level,
+ const Standard_Boolean listall)
+{
+ Handle(Interface_Protocol) proto = Protocol();
+ if (proto.IsNull()) throw Interface_InterfaceMismatch("InterfaceModel : AddWithRefs");
+ AddWithRefs (anent,proto,level,listall);
+}
+
+
+//=======================================================================
+//function : AddWithRefs
+//purpose :
+//=======================================================================
+
+void Interface_InterfaceModel::AddWithRefs(const Handle(Standard_Transient)& anent,
+ const Interface_GeneralLib& lib,
+ const Standard_Integer level,
+ const Standard_Boolean listall)
+{
+ if (anent.IsNull()) return;
+ if (theentities.FindIndex(anent) != 0) {
+ if (!listall) return;
+ }
+ else AddEntity(anent);
+
+ Interface_EntityIterator iter;
+ Handle(Interface_GeneralModule) module; Standard_Integer CN;
+ if (lib.Select (anent,module,CN)) {
+ module->FillSharedCase (CN,anent,iter);
+// FillShared tout court : supposerait que le modele soit deja pret
+// or justement, on est en train de le construire ...
+ module->ListImpliedCase (CN,anent,iter);
+ }
+ Standard_Integer lev1 = level-1;
+ if (lev1 == 0) return; // level = 0 -> tous niveaux; sinon encore n-1
+ for (iter.Start(); iter.More(); iter.Next())
+ AddWithRefs(iter.Value(),lib,lev1,listall);
+}
+
+
+//=======================================================================
+//function : ReplaceEntity
+//purpose :
+//=======================================================================
+
+void Interface_InterfaceModel::ReplaceEntity(const Standard_Integer nument,
+ const Handle(Standard_Transient)& anent)
+{
+ theentities.Substitute(nument,anent);
+}
+
+// ReverseOrders permet de mieux controler la numeration des Entites :
+// Souvent, les fichiers mettent les racines en fin, tandis que AddWithRefs
+// les met en tete.
+
+
+//=======================================================================
+//function : ReverseOrders
+//purpose :
+//=======================================================================
+
+void Interface_InterfaceModel::ReverseOrders (const Standard_Integer after)
+{
+ Standard_Integer nb = NbEntities(); //Standard_Integer num; svv #2
+ if (nb < 2 || after >= nb) return;
+ TColStd_Array1OfTransient ents(1,nb);
+ Standard_Integer i; // svv #1
+ for (i = 1; i <= nb; i ++)
+ ents.SetValue (i, theentities.FindKey(i));
+// On va vider la Map, puis la recharger : dans l ordre jusqua after
+// en ordre inverse apres
+ theentities.Clear();
+ Reservate (nb);
+ for (i = 1; i <= after; i ++) theentities.Add (ents(i));// svv #2
+ for (i = nb; i > after; i --) theentities.Add (ents(i));
+// Faudra aussi s occuper des Reports
+ for (i = nb; i > after; i --) {
+ Standard_Integer i2 = nb+after-i;
+ Handle(Standard_Transient) rep1,rep2;
+ if (thereports.IsBound(i)) rep1 = thereports.Find(i);
+ if (thereports.IsBound(i2)) rep2 = thereports.Find(i2);
+ if (!rep1.IsNull()) thereports.Bind (i2,rep1);
+ else thereports.UnBind (i2);
+ if (!rep2.IsNull()) thereports.Bind (i,rep2);
+ else thereports.UnBind (i);
+ }
+}
+
+
+//=======================================================================
+//function : ChangeOrder
+//purpose :
+//=======================================================================
+
+void Interface_InterfaceModel::ChangeOrder(const Standard_Integer oldnum,
+ const Standard_Integer newnum,
+ const Standard_Integer cnt) //szv#4:S4163:12Mar99 `count` hid one from this
+{
+ Standard_Integer nb = NbEntities(); Standard_Integer i; //, num; svv #2
+ if (nb < 2 || newnum >= nb || cnt<= 0) return;
+ TColStd_Array1OfTransient ents(1,nb);
+ // On va preparer le changement
+ Standard_Integer minum = (oldnum > newnum ? newnum : oldnum);
+ Standard_Integer mxnum = (oldnum < newnum ? newnum : oldnum);
+ Standard_Integer kount = (oldnum > newnum ? cnt : -cnt);
+ if (cnt <= 0 || cnt > mxnum - minum) throw Interface_InterfaceMismatch("InterfaceModel : ChangeOrder, Overlap");
+ for (i = 1; i < minum; i ++) ents.SetValue (i,theentities.FindKey(i));
+ for (i = mxnum+cnt; i <= nb; i ++) ents.SetValue (i,theentities.FindKey(i));
+ for (i = minum; i < mxnum; i ++)
+ ents.SetValue( i + kount, theentities.FindKey(i) );
+ for (i = oldnum; i < oldnum+cnt; i ++)
+ ents.SetValue( i + (newnum-oldnum), theentities.FindKey(i) );
+
+ theentities.Clear();
+ Reservate (nb);
+ for (i = 1; i <= nb; i ++) theentities.Add (ents(i)); // svv #2
+
+ Standard_Integer difnum = mxnum - minum;
+ for (i = minum; i < minum+cnt; i ++) {
+ Handle(Standard_Transient) rep1, rep2;
+ if (thereports.IsBound(i)) rep1 = thereports.Find(i);
+ if (thereports.IsBound(i+difnum)) rep1 = thereports.Find(i+difnum);
+ if (!rep1.IsNull()) thereports.Bind (i+difnum,rep1);
+ else thereports.UnBind (i+difnum);
+ if (!rep2.IsNull()) thereports.Bind (i,rep2);
+ else thereports.UnBind (i);
+ }
+}
+
+
+// GetFromTransfer permet de recuperer un resultat prepare par ailleurs
+// Le Modele demarre a zero. Les entites doivent etre libres (cf AddEntity)
+
+
+//=======================================================================
+//function : GetFromTransfer
+//purpose :
+//=======================================================================
+
+void Interface_InterfaceModel::GetFromTransfer
+ (const Interface_EntityIterator& aniter)
+{
+ theentities.Clear(); theentities.ReSize (aniter.NbEntities());
+ for (aniter.Start(); aniter.More(); aniter.Next()) {
+ Handle(Standard_Transient) ent = aniter.Value(); AddEntity(ent);
+ }
+}
+
+
+// .... Interrogations .... //
+
+
+//=======================================================================
+//function : SetCategoryNumber
+//purpose :
+//=======================================================================
+
+Standard_Boolean Interface_InterfaceModel::SetCategoryNumber
+ (const Standard_Integer num, const Standard_Integer val)
+{
+ Standard_Integer i,nb = NbEntities();
+ if (num < 1 || num > nb) return Standard_False;
+ if (thecategory.IsNull()) thecategory = new TCollection_HAsciiString(nb,' ');
+ else if (thecategory->Length() < nb) {
+ Handle(TCollection_HAsciiString) c = new TCollection_HAsciiString(nb,' ');
+ for (i = thecategory->Length(); i > 0; i --)
+ c->SetValue(i,thecategory->Value(i));
+ thecategory = c;
+ }
+ Standard_Character cval = (Standard_Character)(val + 32);
+ thecategory->SetValue(num,cval);
+ return Standard_True;
+}
+
+
+//=======================================================================
+//function : CategoryNumber
+//purpose :
+//=======================================================================
+
+Standard_Integer Interface_InterfaceModel::CategoryNumber
+ (const Standard_Integer num) const
+{
+ if (thecategory.IsNull()) return 0;
+ if (num < 1 || num > thecategory->Length()) return 0;
+ Standard_Integer val = thecategory->Value(num);
+ return val-32;
+}
+
+
+//=======================================================================
+//function : FillIterator
+//purpose :
+//=======================================================================
+
+void Interface_InterfaceModel::FillIterator(Interface_EntityIterator& iter) const
+{
+ Standard_Integer nb = NbEntities();
+ for (Standard_Integer i = 1; i <= nb; i ++)
+ iter.GetOneItem (theentities.FindKey(i));
+}
+
+
+//=======================================================================
+//function : Entities
+//purpose :
+//=======================================================================
+
+Interface_EntityIterator Interface_InterfaceModel::Entities () const
+{
+ Interface_EntityIterator iter;
+ FillIterator(iter);
+ return iter;
+}
+
+
+//=======================================================================
+//function : Reports
+//purpose :
+//=======================================================================
+
+Interface_EntityIterator Interface_InterfaceModel::Reports
+ (const Standard_Boolean semantic) const
+{
+ Interface_EntityIterator iter;
+ if (semantic) {
+ TColStd_DataMapIteratorOfDataMapOfIntegerTransient itmap (therepch);
+ for (; itmap.More(); itmap.Next()) iter.AddItem (itmap.Value());
+ } else {
+ TColStd_DataMapIteratorOfDataMapOfIntegerTransient itmap (thereports);
+ for (; itmap.More(); itmap.Next()) iter.AddItem (itmap.Value());
+ }
+ return iter;
+}
+
+
+//=======================================================================
+//function : Redefineds
+//purpose :
+//=======================================================================
+
+Interface_EntityIterator Interface_InterfaceModel::Redefineds () const
+{
+ Interface_EntityIterator iter;
+ TColStd_DataMapIteratorOfDataMapOfIntegerTransient itmap (thereports);
+ for (; itmap.More(); itmap.Next()) {
+ Handle(Interface_ReportEntity) rep =
+ Handle(Interface_ReportEntity)::DownCast(itmap.Value());
+ if (rep.IsNull()) continue;
+ if (!rep->HasNewContent()) continue;
+ iter.AddItem (rep);
+ }
+ return iter;
+}
+
+//#include <limits.h>
+//#include <TColStd_MapTransientHasher.hxx>
+
+
+//=======================================================================
+//function : GlobalCheck
+//purpose :
+//=======================================================================
+
+const Handle(Interface_Check)& Interface_InterfaceModel::GlobalCheck
+ (const Standard_Boolean syntactic) const
+{
+ if (syntactic) return thecheckstx;
+ else return thechecksem;
+}
+
+
+//=======================================================================
+//function : SetGlobalCheck
+//purpose :
+//=======================================================================
+
+void Interface_InterfaceModel::SetGlobalCheck(const Handle(Interface_Check)& ach)
+{
+ thecheckstx = ach;
+}
+
+
+//=======================================================================
+//function : VerifyCheck
+//purpose :
+//=======================================================================
+
+void Interface_InterfaceModel::VerifyCheck (Handle(Interface_Check)& /*ach*/) const
+{
+}
+
+
+//=======================================================================
+//function : Print
+//purpose :
+//=======================================================================
+
+void Interface_InterfaceModel::Print(const Handle(Standard_Transient)& ent,
+ Standard_OStream& S,
+ const Standard_Integer mode) const
+{
+ if (ent.IsNull()) { S << "NULL" ; return; }
+ Standard_Integer num = Number(ent);
+ if (mode <= 0) S <<num;
+ if (mode == 0) S <<":";
+ if (mode >= 0) {
+ if (num > 0)
+ PrintToLog(ent,S);
+// PrintLabel (ent,S);
+ else S <<"??";
+ }
+}
+
+
+//=======================================================================
+//function : PrintToLog
+//purpose :
+//=======================================================================
+
+void Interface_InterfaceModel::PrintToLog(const Handle(Standard_Transient)& ent,
+ Standard_OStream& S) const
+{
+ PrintLabel (ent,S);
+}
+
+
+// .... TEMPLATES .... //
+
+
+//=======================================================================
+//function : NextNumberForLabel
+//purpose :
+//=======================================================================
+
+Standard_Integer Interface_InterfaceModel::NextNumberForLabel
+ (const Standard_CString label, const Standard_Integer fromnum,
+ const Standard_Boolean exact) const
+{
+ Standard_Integer n = NbEntities();
+ Handle(TCollection_HAsciiString) labs = new TCollection_HAsciiString(label);
+ Standard_Integer lnb = labs->Length();
+ labs->LowerCase();
+
+ Standard_Integer i; // svv #1
+ for (i = fromnum+1; i <= n; i ++) {
+ Handle(TCollection_HAsciiString) lab = StringLabel (Value(i));
+ if (lab.IsNull()) continue;
+ if (exact) {
+ if (lab->IsSameString(labs,Standard_False)) return i;
+ } else {
+ if (lab->Length() < lnb) continue;
+ lab->LowerCase();
+ if (lab->SearchFromEnd(labs) == lab->Length() - lnb + 1) return i;
+ }
+ }
+
+// En "non exact", on admet de recevoir le numero entre 1 et n
+ if (exact) return 0;
+ i = 0;
+ if (labs->IsIntegerValue()) i = atoi (labs->ToCString());
+ if (i <= 0 || i > n) i = 0;
+ return i;
+}
+
+
+//=======================================================================
+//function : HasTemplate
+//purpose :
+//=======================================================================
+
+Standard_Boolean Interface_InterfaceModel::HasTemplate
+ (const Standard_CString name)
+{
+ return atemp.IsBound(name);
+}
+
+
+//=======================================================================
+//function : Template
+//purpose :
+//=======================================================================
+
+Handle(Interface_InterfaceModel) Interface_InterfaceModel::Template
+ (const Standard_CString name)
+{
+ Handle(Interface_InterfaceModel) model,newmod;
+ if (!HasTemplate(name)) return model;
+ model = Handle(Interface_InterfaceModel)::DownCast(atemp.ChangeFind(name));
+ newmod = model->NewEmptyModel();
+ newmod->GetFromAnother (model);
+ return newmod;
+}
+
+
+//=======================================================================
+//function : SetTemplate
+//purpose :
+//=======================================================================
+
+Standard_Boolean Interface_InterfaceModel::SetTemplate
+ (const Standard_CString name, const Handle(Interface_InterfaceModel)& model)
+{
+ return atemp.Bind(name, model);
+}
+
+
+//=======================================================================
+//function : ListTemplates
+//purpose :
+//=======================================================================
+
+Handle(TColStd_HSequenceOfHAsciiString) Interface_InterfaceModel::ListTemplates ()
+{
+ Handle(TColStd_HSequenceOfHAsciiString) list = new
+ TColStd_HSequenceOfHAsciiString();
+ if (atemp.IsEmpty()) return list;
+ NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator iter(atemp);
+ for (; iter.More(); iter.Next()) {
+ list->Append (new TCollection_HAsciiString (iter.Key()) );
+ }
+ return list;
+}
--- /dev/null
+// Created by: Christian CAILLET <cky@phobox>
+// 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_InterfaceModel_HeaderFile
+#define _Interface_InterfaceModel_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <TColStd_IndexedMapOfTransient.hxx>
+#include <TColStd_DataMapOfIntegerTransient.hxx>
+#include <Standard_Transient.hxx>
+#include <Standard_Integer.hxx>
+#include <Interface_DataState.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+class Interface_Check;
+class TCollection_HAsciiString;
+class Interface_GTool;
+class Interface_Protocol;
+class Interface_ReportEntity;
+class Interface_CheckIterator;
+class Interface_GeneralLib;
+class Interface_EntityIterator;
+
+
+class Interface_InterfaceModel;
+DEFINE_STANDARD_HANDLE(Interface_InterfaceModel, Standard_Transient)
+
+//! Defines an (Indexed) Set of data corresponding to a complete
+//! Transfer by a File Interface, i.e. File Header and Transient
+//! Entities (Objects) contained in a File. Contained Entities are
+//! identified in the Model by unique and consecutive Numbers.
+//!
+//! In addition, a Model can attach to each entity, a specific
+//! Label according to the norm (e.g. Name for VDA, #ident for
+//! Step ...), intended to be output on a string or a stream
+//! (remark : labels are not obliged to be unique)
+//!
+//! InterfaceModel itself is not Transient, it is intended to
+//! work on a set of Transient Data. The services offered are
+//! basic Listing and Identification operations on Transient
+//! Entities, storage of Error Reports, Copying.
+//!
+//! Moreovere, it is possible to define and use templates. These
+//! are empty Models, from which copies can be obtained in order
+//! to be filled with effective data. This allows to record
+//! standard definitions for headers, avoiding to recreate them
+//! for each sendings, and assuring customisation of produced
+//! files for a given site.
+//! A template is attached to a name. It is possible to define a
+//! template from another one (get it, edit it then record it
+//! under another name).
+//!
+//! See also Graph, ShareTool, CheckTool for more
+class Interface_InterfaceModel : public Standard_Transient
+{
+
+public:
+
+
+ //! Clears the list of entities (service WhenDelete)
+ Standard_EXPORT void Destroy();
+~Interface_InterfaceModel()
+{
+ Destroy();
+}
+
+ //! Sets a Protocol for this Model
+ //! It is also set by a call to AddWithRefs with Protocol
+ //! It is used for : DumpHeader (as required), ClearEntities ...
+ Standard_EXPORT void SetProtocol (const Handle(Interface_Protocol)& proto);
+
+ //! Returns the Protocol which has been set by SetProtocol, or
+ //! AddWithRefs with Protocol
+ Standard_EXPORT virtual Handle(Interface_Protocol) Protocol() const;
+
+ //! Sets a GTool for this model, which already defines a Protocol
+ Standard_EXPORT void SetGTool (const Handle(Interface_GTool)& gtool);
+
+ //! Returns the GTool, set by SetProtocol or by SetGTool
+ Standard_EXPORT Handle(Interface_GTool) GTool() const;
+
+ //! Returns the Dispatch Status, either for get or set
+ //! A Model which is produced from Dispatch may share entities
+ //! with the original (according to the Protocol), hence these
+ //! non-copied entities should not be deleted
+ Standard_EXPORT Standard_Boolean& DispatchStatus();
+
+ //! Erases contained data; used when a Model is copied to others :
+ //! the new copied ones begin from clear
+ //! Clear calls specific method ClearHeader (see below)
+ Standard_EXPORT virtual void Clear();
+
+ //! Clears the entities; uses the general service WhenDelete, in
+ //! addition to the standard Memory Manager; can be redefined
+ Standard_EXPORT virtual void ClearEntities();
+
+ //! Erases information about labels, if any : specific to each
+ //! norm
+ Standard_EXPORT virtual void ClearLabels() = 0;
+
+ //! Clears Model's header : specific to each norm
+ Standard_EXPORT virtual void ClearHeader() = 0;
+
+ //! Returns count of contained Entities
+ Standard_EXPORT Standard_Integer NbEntities() const;
+
+ //! Returns True if a Model contains an Entity (for a ReportEntity,
+ //! looks for the ReportEntity itself AND its Concerned Entity)
+ Standard_EXPORT Standard_Boolean Contains (const Handle(Standard_Transient)& anentity) const;
+
+ //! Returns the Number of an Entity in the Model if it contains it.
+ //! Else returns 0. For a ReportEntity, looks at Concerned Entity.
+ //! Returns the Directory entry Number of an Entity in
+ //! the Model if it contains it. Else returns 0. For a
+ //! ReportEntity, looks at Concerned Entity.
+ Standard_EXPORT Standard_Integer Number (const Handle(Standard_Transient)& anentity) const;
+
+ //! Returns an Entity identified by its number in the Model
+ //! Each sub-class of InterfaceModel can define its own method
+ //! Entity to return its specific class of Entity (e.g. for VDA,
+ //! VDAModel returns a VDAEntity), working by calling Value
+ //! Remark : For a Reported Entity, (Erroneous, Corrected, Unknown), this
+ //! method returns this Reported Entity.
+ //! See ReportEntity for other questions.
+ Standard_EXPORT const Handle(Standard_Transient)& Value (const Standard_Integer num) const;
+
+ //! Returns the count of DISTINCT types under which an entity may
+ //! be processed. Defined by the Protocol, which gives default as
+ //! 1 (dynamic Type).
+ Standard_EXPORT Standard_Integer NbTypes (const Handle(Standard_Transient)& ent) const;
+
+ //! Returns a type, given its rank : defined by the Protocol
+ //! (by default, the first one)
+ Standard_EXPORT Handle(Standard_Type) Type (const Handle(Standard_Transient)& ent, const Standard_Integer num = 1) const;
+
+ //! Returns the type name of an entity, from the list of types
+ //! (one or more ...)
+ //! <complete> True (D) gives the complete type, else packages are
+ //! removed
+ //! WARNING : buffered, to be immediately copied or printed
+ Standard_EXPORT Standard_CString TypeName (const Handle(Standard_Transient)& ent, const Standard_Boolean complete = Standard_True) const;
+
+ //! From a CDL Type Name, returns the Class part (package dropped)
+ //! WARNING : buffered, to be immediately copied or printed
+ Standard_EXPORT static Standard_CString ClassName (const Standard_CString typnam);
+
+ //! Returns the State of an entity, given its number
+ Standard_EXPORT Interface_DataState EntityState (const Standard_Integer num) const;
+
+ //! Returns True if <num> identifies a ReportEntity in the Model
+ //! Hence, ReportEntity can be called.
+ //!
+ //! By default, queries main report, if <semantic> is True, it
+ //! queries report for semantic check
+ //!
+ //! Remember that a Report Entity can be defined for an Unknown
+ //! Entity, or a Corrected or Erroneous (at read time) Entity.
+ //! The ReportEntity is defined before call to method AddEntity.
+ Standard_EXPORT Standard_Boolean IsReportEntity (const Standard_Integer num, const Standard_Boolean semantic = Standard_False) const;
+
+ //! Returns a ReportEntity identified by its number in the Model,
+ //! or a Null Handle If <num> does not identify a ReportEntity.
+ //!
+ //! By default, queries main report, if <semantic> is True, it
+ //! queries report for semantic check
+ Standard_EXPORT Handle(Interface_ReportEntity) ReportEntity (const Standard_Integer num, const Standard_Boolean semantic = Standard_False) const;
+
+ //! Returns True if <num> identifies an Error Entity : in this
+ //! case, a ReportEntity brings Fail Messages and possibly an
+ //! "undefined" Content, see IsRedefinedEntity
+ Standard_EXPORT Standard_Boolean IsErrorEntity (const Standard_Integer num) const;
+
+ //! Returns True if <num> identifies an Entity which content is
+ //! redefined through a ReportEntity (i.e. with literal data only)
+ //! This happens when an entity is syntactically erroneous in the
+ //! way that its basic content remains empty.
+ //! For more details (such as content itself), see ReportEntity
+ Standard_EXPORT Standard_Boolean IsRedefinedContent (const Standard_Integer num) const;
+
+ //! Removes the ReportEntity attached to Entity <num>. Returns
+ //! True if done, False if no ReportEntity was attached to <num>.
+ //! Warning : the caller must assume that this clearing is meaningful
+ Standard_EXPORT Standard_Boolean ClearReportEntity (const Standard_Integer num);
+
+ //! Sets or Replaces a ReportEntity for the Entity <num>. Returns
+ //! True if Report is replaced, False if it has been replaced
+ //! Warning : the caller must assume that this setting is meaningful
+ Standard_EXPORT Standard_Boolean SetReportEntity (const Standard_Integer num, const Handle(Interface_ReportEntity)& rep);
+
+ //! Adds a ReportEntity as such. Returns False if the concerned
+ //! entity is not recorded in the Model
+ //! Else, adds it into, either the main report list or the
+ //! list for semantic checks, then returns True
+ Standard_EXPORT Standard_Boolean AddReportEntity (const Handle(Interface_ReportEntity)& rep, const Standard_Boolean semantic = Standard_False);
+
+ //! Returns True if <num> identifies an Unknown Entity : in this
+ //! case, a ReportEntity with no Check Messages designates it.
+ Standard_EXPORT Standard_Boolean IsUnknownEntity (const Standard_Integer num) const;
+
+ //! Fills the list of semantic checks.
+ //! This list is computed (by CheckTool). Hence, it can be stored
+ //! in the model for later queries
+ //! <clear> True (D) : new list replaces
+ //! <clear> False : new list is cumulated
+ Standard_EXPORT void FillSemanticChecks (const Interface_CheckIterator& checks, const Standard_Boolean clear = Standard_True);
+
+ //! Returns True if semantic checks have been filled
+ Standard_EXPORT Standard_Boolean HasSemanticChecks() const;
+
+ //! Returns the check attached to an entity, designated by its
+ //! Number. 0 for global check
+ //! <semantic> True : recorded semantic check
+ //! <semantic> False : recorded syntactic check (see ReportEntity)
+ //! If no check is recorded for <num>, returns an empty Check
+ Standard_EXPORT const Handle(Interface_Check)& Check (const Standard_Integer num, const Standard_Boolean syntactic) const;
+
+ //! Does a reservation for the List of Entities (for optimized
+ //! storage management). If it is not called, storage management
+ //! can be less efficient. <nbent> is the expected count of
+ //! Entities to store
+ Standard_EXPORT virtual void Reservate (const Standard_Integer nbent);
+
+ //! Internal method for adding an Entity. Used by file reading
+ //! (defined by each Interface) and Transfer tools. It adds the
+ //! entity required to be added, not its refs : see AddWithRefs.
+ //! If <anentity> is a ReportEntity, it is added to the list of
+ //! Reports, its Concerned Entity (Erroneous or Corrected, else
+ //! Unknown) is added to the list of Entities.
+ //! That is, the ReportEntity must be created before Adding
+ Standard_EXPORT virtual void AddEntity (const Handle(Standard_Transient)& anentity);
+
+ //! Adds to the Model, an Entity with all its References, as they
+ //! are defined by General Services FillShared and ListImplied.
+ //! Process is recursive (any sub-levels) if <level> = 0 (Default)
+ //! Else, adds sub-entities until the required sub-level.
+ //! Especially, if <level> = 1, adds immediate subs and that's all
+ //!
+ //! If <listall> is False (Default), an entity (<anentity> itself
+ //! or one of its subs at any level) which is already recorded in
+ //! the Model is not analysed, only the newly added ones are.
+ //! If <listall> is True, all items are analysed (this allows to
+ //! ensure the consistency of an adding made by steps)
+ Standard_EXPORT void AddWithRefs (const Handle(Standard_Transient)& anent, const Handle(Interface_Protocol)& proto, const Standard_Integer level = 0, const Standard_Boolean listall = Standard_False);
+
+ //! Same as above, but works with the Protocol of the Model
+ Standard_EXPORT void AddWithRefs (const Handle(Standard_Transient)& anent, const Standard_Integer level = 0, const Standard_Boolean listall = Standard_False);
+
+ //! Same as above, but works with an already created GeneralLib
+ Standard_EXPORT void AddWithRefs (const Handle(Standard_Transient)& anent, const Interface_GeneralLib& lib, const Standard_Integer level = 0, const Standard_Boolean listall = Standard_False);
+
+ //! Replace Entity with Number=nument on other entity - "anent"
+ Standard_EXPORT void ReplaceEntity (const Standard_Integer nument, const Handle(Standard_Transient)& anent);
+
+ //! Reverses the Numbers of the Entities, between <after> and the
+ //! total count of Entities. Thus, the entities :
+ //! 1,2 ... after, after+1 ... nb-1, nb become numbered as :
+ //! 1,2 ... after, nb, nb-1 ... after+1
+ //! By default (after = 0) the whole list of Entities is reversed
+ Standard_EXPORT void ReverseOrders (const Standard_Integer after = 0);
+
+ //! Changes the Numbers of some Entities : <oldnum> is moved to
+ //! <newnum>, same for <count> entities. Thus :
+ //! 1,2 ... newnum-1 newnum ... oldnum .. oldnum+count oldnum+count+1 .. gives
+ //! 1,2 ... newnum-1 oldnum .. oldnum+count newnum ... oldnum+count+1
+ //! (can be seen as a circular permutation)
+ Standard_EXPORT void ChangeOrder (const Standard_Integer oldnum, const Standard_Integer newnum, const Standard_Integer count = 1);
+
+ //! Gets contents from an EntityIterator, prepared by a
+ //! Transfer tool (e.g TransferCopy). Starts from clear
+ Standard_EXPORT void GetFromTransfer (const Interface_EntityIterator& aniter);
+
+ //! Gets header (data specific of a defined Interface) from
+ //! another InterfaceModel; called from TransferCopy
+ Standard_EXPORT virtual void GetFromAnother (const Handle(Interface_InterfaceModel)& other) = 0;
+
+ //! Returns a New Empty Model, same type as <me> (whatever its
+ //! Type); called to Copy parts a Model into other ones, then
+ //! followed by a call to GetFromAnother (Header) then filling
+ //! with specified Entities, themselves copied
+ Standard_EXPORT virtual Handle(Interface_InterfaceModel) NewEmptyModel() const = 0;
+
+ //! Records a category number for an entity number
+ //! Returns True when done, False if <num> is out of range
+ Standard_EXPORT Standard_Boolean SetCategoryNumber (const Standard_Integer num, const Standard_Integer val);
+
+ //! Returns the recorded category number for a given entity number
+ //! 0 if none was defined for this entity
+ Standard_EXPORT Standard_Integer CategoryNumber (const Standard_Integer num) const;
+
+ //! Allows an EntityIterator to get a list of Entities
+ Standard_EXPORT void FillIterator (Interface_EntityIterator& iter) const;
+
+ //! Returns the list of all Entities, as an Iterator on Entities
+ //! (the Entities themselves, not the Reports)
+ Standard_EXPORT Interface_EntityIterator Entities() const;
+
+ //! Returns the list of all ReportEntities, i.e. data about
+ //! Entities read with Error or Warning information
+ //! (each item has to be casted to Report Entity then it can be
+ //! queried for Concerned Entity, Content, Check ...)
+ //! By default, returns the main reports, is <semantic> is True it
+ //! returns the list for semantic checks
+ Standard_EXPORT Interface_EntityIterator Reports (const Standard_Boolean semantic = Standard_False) const;
+
+ //! Returns the list of ReportEntities which redefine data
+ //! (generally, if concerned entity is "Error", a literal content
+ //! is added to it : this is a "redefined entity"
+ Standard_EXPORT Interface_EntityIterator Redefineds() const;
+
+ //! Returns the GlobalCheck, which memorizes messages global to
+ //! the file (not specific to an Entity), especially Header
+ Standard_EXPORT const Handle(Interface_Check)& GlobalCheck (const Standard_Boolean syntactic = Standard_True) const;
+
+ //! Allows to modify GlobalCheck, after getting then completing it
+ //! Remark : it is SYNTACTIC check. Semantics, see FillChecks
+ Standard_EXPORT void SetGlobalCheck (const Handle(Interface_Check)& ach);
+
+ //! Minimum Semantic Global Check on data in model (header)
+ //! Can only check basic Data. See also GlobalCheck from Protocol
+ //! for a check which takes the Graph into account
+ //! Default does nothing, can be redefined
+ Standard_EXPORT virtual void VerifyCheck (Handle(Interface_Check)& ach) const;
+
+ //! Dumps Header in a short, easy to read, form, onto a Stream
+ //! <level> allows to print more or less parts of the header,
+ //! if necessary. 0 for basic print
+ Standard_EXPORT virtual void DumpHeader (Standard_OStream& S, const Standard_Integer level = 0) const = 0;
+
+ //! Prints identification of a given entity in <me>, in order to
+ //! be printed in a list or phrase
+ //! <mode> < 0 : prints only its number
+ //! <mode> = 1 : just calls PrintLabel
+ //! <mode> = 0 (D) : prints its number plus '/' plus PrintLabel
+ //! If <ent> == <me>, simply prints "Global"
+ //! If <ent> is unknown, prints "??/its type"
+ Standard_EXPORT void Print (const Handle(Standard_Transient)& ent, Standard_OStream& s, const Standard_Integer mode = 0) const;
+
+ //! Prints label specific to each norm, for a given entity.
+ //! Must only print label itself, in order to be included in a
+ //! phrase. Can call the result of StringLabel, but not obliged.
+ Standard_EXPORT virtual void PrintLabel (const Handle(Standard_Transient)& ent, Standard_OStream& S) const = 0;
+
+ //! Prints label specific to each norm in log format, for
+ //! a given entity.
+ //! By default, just calls PrintLabel, can be redefined
+ Standard_EXPORT virtual void PrintToLog (const Handle(Standard_Transient)& ent, Standard_OStream& S) const;
+
+ //! Returns a string with the label attached to a given entity.
+ //! Warning : While this string may be edited on the spot, if it is a read
+ //! field, the returned value must be copied before.
+ Standard_EXPORT virtual Handle(TCollection_HAsciiString) StringLabel (const Handle(Standard_Transient)& ent) const = 0;
+
+ //! Searches a label which matches with one entity.
+ //! Begins from <lastnum>+1 (default:1) and scans the entities
+ //! until <NbEntities>. For the first which matches <label>,
+ //! this method returns its Number. Returns 0 if nothing found
+ //! Can be called recursively (labels are not specified as unique)
+ //! <exact> : if True (default), exact match is required
+ //! else, checks the END of entity label
+ //!
+ //! This method is virtual, hence it can be redefined for a more
+ //! efficient search (if exact is true).
+ Standard_EXPORT virtual Standard_Integer NextNumberForLabel (const Standard_CString label, const Standard_Integer lastnum = 0, const Standard_Boolean exact = Standard_True) const;
+
+ //! Returns true if a template is attached to a given name
+ Standard_EXPORT static Standard_Boolean HasTemplate (const Standard_CString name);
+
+ //! Returns the template model attached to a name, or a Null Handle
+ Standard_EXPORT static Handle(Interface_InterfaceModel) Template (const Standard_CString name);
+
+ //! Records a new template model with a name. If the name was
+ //! already recorded, the corresponding template is replaced by
+ //! the new one. Then, WARNING : test HasTemplate to avoid
+ //! surprises
+ Standard_EXPORT static Standard_Boolean SetTemplate (const Standard_CString name, const Handle(Interface_InterfaceModel)& model);
+
+ //! Returns the complete list of names attached to template models
+ Standard_EXPORT static Handle(TColStd_HSequenceOfHAsciiString) ListTemplates();
+
+
+
+ DEFINE_STANDARD_RTTIEXT(Interface_InterfaceModel,Standard_Transient)
+
+protected:
+
+
+ //! Defines empty InterfaceModel, ready to be filled
+ Standard_EXPORT Interface_InterfaceModel();
+
+
+
+private:
+
+
+ TColStd_IndexedMapOfTransient theentities;
+ TColStd_DataMapOfIntegerTransient thereports;
+ TColStd_DataMapOfIntegerTransient therepch;
+ Handle(Interface_Check) thecheckstx;
+ Handle(Interface_Check) thechecksem;
+ Standard_Boolean haschecksem;
+ Standard_Boolean isdispatch;
+ Handle(TCollection_HAsciiString) thecategory;
+ Handle(Interface_GTool) thegtool;
+
+
+};
+
+
+
+
+
+
+
+#endif // _Interface_InterfaceModel_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_Static.hxx>
+
+#include <OSD_Path.hxx>
+#include <Standard_Transient.hxx>
+#include <Standard_Type.hxx>
+#include <TCollection_HAsciiString.hxx>
+
+#include <stdio.h>
+IMPLEMENT_STANDARD_RTTIEXT(Interface_Static,Interface_TypedValue)
+
+static char defmess[31];
+
+// Fonctions Satisfies offertes en standard ...
+
+//svv #2
+//static Standard_Boolean StaticPath(const Handle(TCollection_HAsciiString)& val)
+//{
+// OSD_Path apath;
+// return apath.IsValid (TCollection_AsciiString(val->ToCString()));
+//}
+
+
+ Interface_Static::Interface_Static
+ (const Standard_CString family, const Standard_CString name,
+ const Interface_ParamType type, const Standard_CString init)
+ : Interface_TypedValue (name,type,init) ,
+ thefamily (family) ,
+ theupdate (Standard_True) { }
+
+ Interface_Static::Interface_Static
+ (const Standard_CString family, const Standard_CString name,
+ const Handle(Interface_Static)& other)
+ : Interface_TypedValue (name, other->Type(), "") ,
+ thefamily (family) ,
+ theupdate (Standard_True)
+{
+ switch (Type()) {
+ case Interface_ParamInteger : {
+ Standard_Integer lim;
+ if (other->IntegerLimit (Standard_True ,lim)) SetIntegerLimit (Standard_True ,lim);
+ if (other->IntegerLimit (Standard_False,lim)) SetIntegerLimit (Standard_False,lim);
+ }
+ break;
+ case Interface_ParamReal : {
+ Standard_Real lim;
+ if (other->RealLimit (Standard_True ,lim)) SetRealLimit (Standard_True ,lim);
+ if (other->RealLimit (Standard_False,lim)) SetRealLimit (Standard_False,lim);
+ SetUnitDef (other->UnitDef());
+ }
+ break;
+ case Interface_ParamEnum : {
+ Standard_Boolean match; Standard_Integer e0,e1,i;
+ other->EnumDef (e0,e1,match);
+ StartEnum (e0,match);
+// if (e1 >= e0) theenums = new TColStd_HArray1OfAsciiString(e0,e1);
+ for (i = e0; i <= e1; i ++)
+ AddEnum (other->EnumVal(i));
+ }
+ break;
+ case Interface_ParamIdent :
+ SetObjectType (other->ObjectType());
+ break;
+ default : break;
+ }
+
+ if (other->IsSetValue()) SetCStringValue (other->CStringValue());
+}
+
+
+// ## Print ##
+
+void Interface_Static::PrintStatic (Standard_OStream& S) const
+{
+ S <<"--- Static Value : "<<Name()<<" Family:"<<Family();
+ Print (S);
+ if (!thewild.IsNull())
+ S <<" -- Attached to wild-card : "<<thewild->Name()<<std::endl;
+ S <<"--- Actual status : "<<(theupdate ? "" : "original")<<" Value : ";
+
+ if (thesatisf) S <<" -- Specific Function for Satisfies : "<<thesatisn.ToCString()<<std::endl;
+}
+
+
+// ######### COMPLEMENTS ##########
+
+Standard_CString Interface_Static::Family () const
+{
+ return thefamily.ToCString();
+}
+
+
+Handle(Interface_Static) Interface_Static::Wild () const
+{
+ return thewild;
+}
+
+
+void Interface_Static::SetWild (const Handle(Interface_Static)& wild)
+{
+ thewild = wild;
+}
+
+
+// ######### UPDATE ##########
+
+void Interface_Static::SetUptodate ()
+{
+ theupdate = Standard_True;
+}
+
+
+Standard_Boolean Interface_Static::UpdatedStatus () const
+{
+ return theupdate;
+}
+
+
+
+// #######################################################################
+// ######### DICTIONNAIRE DES STATICS (static sur Static) ##########
+
+Standard_Boolean Interface_Static::Init
+ (const Standard_CString family, const Standard_CString name,
+ const Interface_ParamType type, const Standard_CString init)
+{
+ if (name[0] == '\0') return Standard_False;
+
+ if (MoniTool_TypedValue::Stats().IsBound(name)) return Standard_False;
+ Handle(Interface_Static) item;
+ if (type == Interface_ParamMisc) {
+ Handle(Interface_Static) other = Interface_Static::Static(init);
+ if (other.IsNull()) return Standard_False;
+ item = new Interface_Static (family,name,other);
+ }
+ else item = new Interface_Static (family,name,type,init);
+
+ MoniTool_TypedValue::Stats().Bind (name,item);
+ return Standard_True;
+}
+
+
+Standard_Boolean Interface_Static::Init
+ (const Standard_CString family, const Standard_CString name,
+ const Standard_Character type, const Standard_CString init)
+{
+ Interface_ParamType epyt;
+ switch (type) {
+ case 'e' : epyt = Interface_ParamEnum; break;
+ case 'i' : epyt = Interface_ParamInteger; break;
+ case 'o' : epyt = Interface_ParamIdent; break;
+ case 'p' : epyt = Interface_ParamText; break;
+ case 'r' : epyt = Interface_ParamReal; break;
+ case 't' : epyt = Interface_ParamText; break;
+ case '=' : epyt = Interface_ParamMisc; break;
+ case '&' : {
+ Handle(Interface_Static) unstat = Interface_Static::Static(name);
+ if (unstat.IsNull()) return Standard_False;
+// Editions : init donne un petit texte d edition, en 2 termes "cmd var" :
+// imin <ival> imax <ival> rmin <rval> rmax <rval> unit <def>
+// enum <from> ematch <from> eval <cval>
+ Standard_Integer i,iblc = 0;
+ for (i = 0; init[i] != '\0'; i ++) if (init[i] == ' ') iblc = i+1;
+// Reconnaissance du sous-cas et aiguillage
+ if (init[0] == 'i' && init[2] == 'i')
+ unstat->SetIntegerLimit (Standard_False,atoi(&init[iblc]));
+ else if (init[0] == 'i' && init[2] == 'a')
+ unstat->SetIntegerLimit (Standard_True ,atoi(&init[iblc]));
+ else if (init[0] == 'r' && init[2] == 'i')
+ unstat->SetRealLimit (Standard_False,Atof(&init[iblc]));
+ else if (init[0] == 'r' && init[2] == 'a')
+ unstat->SetRealLimit (Standard_True ,Atof(&init[iblc]));
+ else if (init[0] == 'u')
+ unstat->SetUnitDef (&init[iblc]);
+ else if (init[0] == 'e' && init[1] == 'm')
+ unstat->StartEnum (atoi(&init[iblc]),Standard_True);
+ else if (init[0] == 'e' && init[1] == 'n')
+ unstat->StartEnum (atoi(&init[iblc]),Standard_False);
+ else if (init[0] == 'e' && init[1] == 'v')
+ unstat->AddEnum (&init[iblc]);
+ else return Standard_False;
+ return Standard_True;
+ }
+ default : return Standard_False;
+ }
+ if (!Interface_Static::Init (family,name,epyt,init)) return Standard_False;
+ if (type != 'p') return Standard_True;
+ Handle(Interface_Static) stat = Interface_Static::Static(name);
+//NT stat->SetSatisfies (StaticPath,"Path");
+ if (!stat->Satisfies(stat->HStringValue())) stat->SetCStringValue("");
+ return Standard_True;
+}
+
+
+Handle(Interface_Static) Interface_Static::Static
+ (const Standard_CString name)
+{
+ Handle(Standard_Transient) result;
+ MoniTool_TypedValue::Stats().Find(name, result);
+ return Handle(Interface_Static)::DownCast(result);
+}
+
+
+Standard_Boolean Interface_Static::IsPresent (const Standard_CString name)
+{
+ return MoniTool_TypedValue::Stats().IsBound (name);
+}
+
+
+Standard_CString Interface_Static::CDef
+ (const Standard_CString name, const Standard_CString part)
+{
+ if (!part || part[0] == '\0') return "";
+ Handle(Interface_Static) stat = Interface_Static::Static(name);
+ if (stat.IsNull()) return "";
+ if (part[0] == 'f' && part[1] == 'a') return stat->Family();
+ if (part[0] == 'l' && part[1] == 'a') return stat->Label();
+ if (part[0] == 's' && part[1] == 'a') return stat->SatisfiesName();
+ if (part[0] == 't' && part[1] == 'y') {
+ Interface_ParamType typ = stat->Type();
+ if (typ == Interface_ParamInteger) return "integer";
+ if (typ == Interface_ParamReal) return "real";
+ if (typ == Interface_ParamText) return "text";
+ if (typ == Interface_ParamEnum) return "enum";
+ return "?type?";
+ }
+ if (part[0] == 'e') {
+ Standard_Integer nume = 0;
+ sscanf (part,"%30s %d",defmess,&nume);
+ return stat->EnumVal(nume);
+ }
+ if (part[0] == 'i') {
+ Standard_Integer ilim;
+ if (!stat->IntegerLimit((part[2] == 'a'),ilim)) return "";
+ Sprintf(defmess,"%d",ilim); return defmess;
+ }
+ if (part[0] == 'r') {
+ Standard_Real rlim;
+ if (!stat->RealLimit((part[2] == 'a'),rlim)) return "";
+ Sprintf(defmess,"%f",rlim); return defmess;
+ }
+ if (part[0] == 'u') return stat->UnitDef();
+ return "";
+}
+
+
+Standard_Integer Interface_Static::IDef
+ (const Standard_CString name, const Standard_CString part)
+{
+ if (!part || part[0] == '\0') return 0;
+ Handle(Interface_Static) stat = Interface_Static::Static(name);
+ if (stat.IsNull()) return 0;
+ if (part[0] == 'i') {
+ Standard_Integer ilim;
+ if (!stat->IntegerLimit((part[2] == 'a'),ilim)) return 0;
+ return ilim;
+ }
+ if (part[0] == 'e') {
+ Standard_Integer startcase,endcase; Standard_Boolean match;
+ stat->EnumDef (startcase,endcase,match);
+ if (part[1] == 's') return startcase;
+ if (part[1] == 'c') return (endcase - startcase + 1);
+ if (part[1] == 'm') return (match ? 1 : 0);
+ if (part[1] == 'v') {
+ char vale[51];
+ sscanf (part,"%30s %50s",defmess,vale);
+ return stat->EnumCase (vale);
+ }
+ }
+ return 0;
+}
+
+
+// ########## VALEUR COURANTE ###########
+
+Standard_Boolean Interface_Static::IsSet
+ (const Standard_CString name, const Standard_Boolean proper)
+{
+ Handle(Interface_Static) item = Interface_Static::Static(name);
+ if (item.IsNull()) return Standard_False;
+ if (item->IsSetValue()) return Standard_True;
+ if (proper) return Standard_False;
+ item = item->Wild();
+ return item->IsSetValue();
+}
+
+
+Standard_CString Interface_Static::CVal (const Standard_CString name)
+{
+ Handle(Interface_Static) item = Interface_Static::Static(name);
+ if (item.IsNull()) {
+#ifdef OCCT_DEBUG
+ std::cout << "Warning: Interface_Static::CVal: incorrect parameter " << name << std::endl;
+#endif
+ return "";
+ }
+ return item->CStringValue();
+}
+
+
+Standard_Integer Interface_Static::IVal (const Standard_CString name)
+{
+ Handle(Interface_Static) item = Interface_Static::Static(name);
+ if (item.IsNull()) {
+#ifdef OCCT_DEBUG
+ std::cout << "Warning: Interface_Static::IVal: incorrect parameter " << name << std::endl;
+#endif
+ return 0;
+ }
+ return item->IntegerValue();
+}
+
+
+Standard_Real Interface_Static::RVal (const Standard_CString name)
+{
+ Handle(Interface_Static) item = Interface_Static::Static(name);
+ if (item.IsNull()) {
+#ifdef OCCT_DEBUG
+ std::cout << "Warning: Interface_Static::RVal: incorrect parameter " << name << std::endl;
+#endif
+ return 0.0;
+ }
+ return item->RealValue();
+}
+
+
+Standard_Boolean Interface_Static::SetCVal
+ (const Standard_CString name, const Standard_CString val)
+{
+ Handle(Interface_Static) item = Interface_Static::Static(name);
+ if (item.IsNull()) return Standard_False;
+ return item->SetCStringValue(val);
+}
+
+
+Standard_Boolean Interface_Static::SetIVal
+ (const Standard_CString name, const Standard_Integer val)
+{
+ Handle(Interface_Static) item = Interface_Static::Static(name);
+ if (item.IsNull()) return Standard_False;
+ if (!item->SetIntegerValue(val)) return Standard_False;
+ return Standard_True;
+}
+
+
+Standard_Boolean Interface_Static::SetRVal
+ (const Standard_CString name, const Standard_Real val)
+{
+ Handle(Interface_Static) item = Interface_Static::Static(name);
+ if (item.IsNull()) return Standard_False;
+ return item->SetRealValue(val);
+}
+
+// UPDATE
+
+Standard_Boolean Interface_Static::Update (const Standard_CString name)
+{
+ Handle(Interface_Static) item = Interface_Static::Static(name);
+ if (item.IsNull()) return Standard_False;
+ item->SetUptodate();
+ return Standard_True;
+}
+
+Standard_Boolean Interface_Static::IsUpdated (const Standard_CString name)
+{
+ Handle(Interface_Static) item = Interface_Static::Static(name);
+ if (item.IsNull()) return Standard_False;
+ return item->UpdatedStatus();
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) Interface_Static::Items
+ (const Standard_Integer mode, const Standard_CString criter)
+{
+ Standard_Integer modup = (mode / 100); // 0 any, 1 non-update, 2 update
+ Handle(TColStd_HSequenceOfHAsciiString) list =
+ new TColStd_HSequenceOfHAsciiString();
+ NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator iter(MoniTool_TypedValue::Stats());
+ for (; iter.More(); iter.Next()) {
+ Handle(Interface_Static) item =
+ Handle(Interface_Static)::DownCast(iter.Value());
+ if (item.IsNull()) continue;
+ Standard_Boolean ok = Standard_True;
+ if (criter[0] == '$' && criter[1] == '\0') {
+ if ( (item->Family())[0] != '$') ok = Standard_False;
+ } else if (criter[0] != '\0') {
+ if (strcmp(criter, item->Family())) continue;
+ ok = Standard_True;
+ } else { // tous ... sauf famille a $
+ if (item->Family()[0] == '$') continue;
+ }
+ if (ok && (modup == 1)) ok = !item->UpdatedStatus();
+ if (ok && (modup == 2)) ok = item->UpdatedStatus();
+
+ if (ok) list->Append (new TCollection_HAsciiString (iter.Key()) );
+ }
+ return list;
+}
+
+//=======================================================================
+// function : FillMap
+// purpose : Fills given string-to-string map with all static data
+//=======================================================================
+void Interface_Static::FillMap (NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString, TCollection_AsciiString>& theMap)
+{
+ theMap.Clear();
+
+ NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& aMap = MoniTool_TypedValue::Stats();
+
+ for (NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator anIt(aMap); anIt.More(); anIt.Next())
+ {
+ Handle(Interface_Static) aValue = Handle(Interface_Static)::DownCast(anIt.Value());
+ if (aValue.IsNull())
+ {
+ continue;
+ }
+ if (aValue->HStringValue().IsNull())
+ {
+ continue;
+ }
+
+ theMap.Bind (anIt.Key(), aValue->HStringValue()->String());
+ }
+}
--- /dev/null
+// Created on: 1995-12-08
+// 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 _Interface_Static_HeaderFile
+#define _Interface_Static_HeaderFile
+
+#include <Standard.hxx>
+
+#include <Standard_Integer.hxx>
+#include <Standard_Real.hxx>
+#include <Interface_StaticSatisfies.hxx>
+#include <Interface_TypedValue.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+class TCollection_HAsciiString;
+
+class Interface_Static;
+DEFINE_STANDARD_HANDLE(Interface_Static, Interface_TypedValue)
+
+//! This class gives a way to manage meaningful static variables,
+//! used as "global" parameters in various procedures.
+//!
+//! A Static brings a specification (its type, constraints if any)
+//! and a value. Its basic form is a string, it can be specified
+//! as integer or real or enumerative string, and queried as such.
+//! Its string content, which is a Handle(HAsciiString) can be
+//! shared by other data structures, hence gives a direct on line
+//! access to its value.
+//!
+//! All this description is inherited from TypedValue
+//!
+//! A Static can be given an initial value, it can be filled from,
+//! either a set of Resources (an applicative feature which
+//! accesses and manages parameter files), or environment or
+//! internal definition : these define families of Static.
+//! In addition, it supports a status for reinitialisation : an
+//! initialisation procedure can ask if the value of the Static
+//! has changed from its last call, in this case does something
+//! then marks the Status "uptodate", else it does nothing.
+//!
+//! Statics are named and recorded then accessed in an alphabetic
+//! dictionary
+class Interface_Static : public Interface_TypedValue
+{
+
+public:
+
+
+ //! Creates and records a Static, with a family and a name
+ //! family can report to a name of resource or to a system or
+ //! internal definition. The name must be unique.
+ //!
+ //! type gives the type of the parameter, default is free text
+ //! Also available : Integer, Real, Enum, Entity (i.e. Object)
+ //! More precise specifications, titles, can be given to the
+ //! Static once created
+ //!
+ //! init gives an initial value. If it is not given, the Static
+ //! begin as "not set", its value is empty
+ Standard_EXPORT Interface_Static(const Standard_CString family, const Standard_CString name, const Interface_ParamType type = Interface_ParamText, const Standard_CString init = "");
+
+ //! Creates a new Static with same definition as another one
+ //! (value is copied, except for Entity : it remains null)
+ Standard_EXPORT Interface_Static(const Standard_CString family, const Standard_CString name, const Handle(Interface_Static)& other);
+
+ //! Writes the properties of a
+ //! parameter in the diagnostic file. These include:
+ //! - Name
+ //! - Family,
+ //! - Wildcard (if it has one)
+ //! - Current status (empty string if it was updated or
+ //! if it is the original one)
+ //! - Value
+ Standard_EXPORT void PrintStatic (Standard_OStream& S) const;
+
+ //! Returns the family. It can be : a resource name for applis,
+ //! an internal name between : $e (environment variables),
+ //! $l (other, purely local)
+ Standard_EXPORT Standard_CString Family() const;
+
+ //! Sets a "wild-card" static : its value will be considered
+ //! if <me> is not properly set. (reset by set a null one)
+ Standard_EXPORT void SetWild (const Handle(Interface_Static)& wildcard);
+
+ //! Returns the wildcard static, which can be (is most often) null
+ Standard_EXPORT Handle(Interface_Static) Wild() const;
+
+ //! Records a Static has "uptodate", i.e. its value has been taken
+ //! into account by a reinitialisation procedure
+ //! This flag is reset at each successful SetValue
+ Standard_EXPORT void SetUptodate();
+
+ //! Returns the status "uptodate"
+ Standard_EXPORT Standard_Boolean UpdatedStatus() const;
+
+ //! Declares a new Static (by calling its constructor)
+ //! If this name is already taken, does nothing and returns False
+ //! Else, creates it and returns True
+ //! For additional definitions, get the Static then edit it
+ Standard_EXPORT static Standard_Boolean Init (const Standard_CString family, const Standard_CString name, const Interface_ParamType type, const Standard_CString init = "");
+
+ //! As Init with ParamType, but type is given as a character
+ //! This allows a simpler call
+ //! Types : 'i' Integer, 'r' Real, 't' Text, 'e' Enum, 'o' Object
+ //! '=' for same definition as, <init> gives the initial Static
+ //! Returns False if <type> does not match this list
+ Standard_EXPORT static Standard_Boolean Init (const Standard_CString family, const Standard_CString name, const Standard_Character type, const Standard_CString init = "");
+
+ //! Returns a Static from its name. Null Handle if not present
+ Standard_EXPORT static Handle(Interface_Static) Static (const Standard_CString name);
+
+ //! Returns True if a Static named <name> is present, False else
+ Standard_EXPORT static Standard_Boolean IsPresent (const Standard_CString name);
+
+ //! Returns a part of the definition of a Static, as a CString
+ //! The part is designated by its name, as a CString
+ //! If the required value is not a string, it is converted to a
+ //! CString then returned
+ //! If <name> is not present, or <part> not defined for <name>,
+ //! this function returns an empty string
+ //!
+ //! Allowed parts for CDef :
+ //! family : the family
+ //! type : the type ("integer","real","text","enum")
+ //! label : the label
+ //! satis : satisfy function name if any
+ //! rmin : minimum real value
+ //! rmax : maximum real value
+ //! imin : minimum integer value
+ //! imax : maximum integer value
+ //! enum nn (nn : value of an integer) : enum value for nn
+ //! unit : unit definition for a real
+ Standard_EXPORT static Standard_CString CDef (const Standard_CString name, const Standard_CString part);
+
+ //! Returns a part of the definition of a Static, as an Integer
+ //! The part is designated by its name, as a CString
+ //! If the required value is not a string, returns zero
+ //! For a Boolean, 0 for false, 1 for true
+ //! If <name> is not present, or <part> not defined for <name>,
+ //! this function returns zero
+ //!
+ //! Allowed parts for IDef :
+ //! imin, imax : minimum or maximum integer value
+ //! estart : starting number for enum
+ //! ecount : count of enum values (starting from estart)
+ //! ematch : exact match status
+ //! eval val : case determined from a string
+ Standard_EXPORT static Standard_Integer IDef (const Standard_CString name, const Standard_CString part);
+
+ //! Returns True if <name> is present AND set
+ //! <proper> True (D) : considers this item only
+ //! <proper> False : if not set and attached to a wild-card,
+ //! considers this wild-card
+ Standard_EXPORT static Standard_Boolean IsSet (const Standard_CString name, const Standard_Boolean proper = Standard_True);
+
+ //! Returns the value of the
+ //! parameter identified by the string name.
+ //! If the specified parameter does not exist, an empty
+ //! string is returned.
+ //! Example
+ //! Interface_Static::CVal("write.step.schema");
+ //! which could return:
+ //! "AP214"
+ Standard_EXPORT static Standard_CString CVal (const Standard_CString name);
+
+ //! Returns the integer value of
+ //! the translation parameter identified by the string name.
+ //! Returns the value 0 if the parameter does not exist.
+ //! Example
+ //! Interface_Static::IVal("write.step.schema");
+ //! which could return: 3
+ Standard_EXPORT static Standard_Integer IVal (const Standard_CString name);
+
+ //! Returns the value of a static
+ //! translation parameter identified by the string name.
+ //! Returns the value 0.0 if the parameter does not exist.
+ Standard_EXPORT static Standard_Real RVal (const Standard_CString name);
+
+ //! Modifies the value of the
+ //! parameter identified by name. The modification is specified
+ //! by the string val. false is returned if the parameter does not exist.
+ //! Example
+ //! Interface_Static::SetCVal
+ //! ("write.step.schema","AP203")
+ //! This syntax specifies a switch from the default STEP 214 mode to STEP 203 mode.
+ Standard_EXPORT static Standard_Boolean SetCVal (const Standard_CString name, const Standard_CString val);
+
+ //! Modifies the value of the
+ //! parameter identified by name. The modification is specified
+ //! by the integer value val. false is returned if the
+ //! parameter does not exist.
+ //! Example
+ //! Interface_Static::SetIVal
+ //! ("write.step.schema", 3)
+ //! This syntax specifies a switch from the default STEP 214 mode to STEP 203 mode.S
+ Standard_EXPORT static Standard_Boolean SetIVal (const Standard_CString name, const Standard_Integer val);
+
+ //! Modifies the value of a
+ //! translation parameter. false is returned if the
+ //! parameter does not exist. The modification is specified
+ //! by the real number value val.
+ Standard_EXPORT static Standard_Boolean SetRVal (const Standard_CString name, const Standard_Real val);
+
+ //! Sets a Static to be "uptodate"
+ //! Returns False if <name> is not present
+ //! This status can be used by a reinitialisation procedure to
+ //! rerun if a value has been changed
+ Standard_EXPORT static Standard_Boolean Update (const Standard_CString name);
+
+ //! Returns the status "uptodate" from a Static
+ //! Returns False if <name> is not present
+ Standard_EXPORT static Standard_Boolean IsUpdated (const Standard_CString name);
+
+ //! Returns a list of names of statics :
+ //! <mode> = 0 (D) : criter is for family
+ //! <mode> = 1 : criter is regexp on names, takes final items
+ //! (ignore wild cards)
+ //! <mode> = 2 : idem but take only wilded, not final items
+ //! <mode> = 3 : idem, take all items matching criter
+ //! idem + 100 : takes only non-updated items
+ //! idem + 200 : takes only updated items
+ //! criter empty (D) : returns all names
+ //! else returns names which match the given criter
+ //! Remark : families beginning by '$' are not listed by criter ""
+ //! they are listed only by criter "$"
+ //!
+ //! This allows for instance to set new values after having loaded
+ //! or reloaded a resource, then to update them as required
+ Standard_EXPORT static Handle(TColStd_HSequenceOfHAsciiString) Items (const Standard_Integer mode = 0, const Standard_CString criter = "");
+
+ //! Initializes all standard static parameters, which can be used
+ //! by every function. statics specific of a norm or a function
+ //! must be defined around it
+ Standard_EXPORT static void Standards();
+
+ //! Fills given string-to-string map with all static data
+ Standard_EXPORT static void FillMap(NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString, TCollection_AsciiString>& theMap);
+
+ DEFINE_STANDARD_RTTIEXT(Interface_Static,Interface_TypedValue)
+
+protected:
+
+
+
+
+private:
+
+
+ TCollection_AsciiString thefamily;
+ TCollection_AsciiString thename;
+ TCollection_AsciiString thelabel;
+ Interface_ParamType thetype;
+ Handle(Standard_Type) theotyp;
+ Handle(Interface_Static) thewild;
+ Standard_Integer thelims;
+ Standard_Integer theintlow;
+ Standard_Integer theintup;
+ Standard_Real therealow;
+ Standard_Real therealup;
+ TCollection_AsciiString theunidef;
+ Handle(TColStd_HArray1OfAsciiString) theenums;
+ NCollection_DataMap<TCollection_AsciiString, Standard_Integer> theeadds;
+ Interface_StaticSatisfies thesatisf;
+ TCollection_AsciiString thesatisn;
+ Standard_Boolean theupdate;
+ Standard_Integer theival;
+ Handle(TCollection_HAsciiString) thehval;
+ Handle(Standard_Transient) theoval;
+
+
+};
+
+
+
+
+
+
+
+#endif // _Interface_Static_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 XSControl_ReturnStatus
+{
+XSControl_RetVoid,
+XSControl_RetDone,
+XSControl_RetError,
+XSControl_RetFail,
+XSControl_RetStop
+};
+
+#endif // _IFSelect_ReturnStatus_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 <XSControl_WorkSession.hxx>
+
+#include <Interface_Check.hxx>
+#include <Interface_InterfaceModel.hxx>
+#include <Interface_Macros.hxx>
+#include <Message_Messenger.hxx>
+#include <Message_ProgressScope.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+#include <Transfer_ResultFromModel.hxx>
+#include <Transfer_ResultFromTransient.hxx>
+#include <Transfer_SimpleBinderOfTransient.hxx>
+#include <Transfer_TransientProcess.hxx>
+#include <XSControl_Controller.hxx>
+#include <XSControl_TransferReader.hxx>
+#include <XSControl_TransferWriter.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(XSControl_WorkSession, Standard_Transient)
+
+//=======================================================================
+//function : XSControl_WorkSession
+//purpose :
+//=======================================================================
+XSControl_WorkSession::XSControl_WorkSession() :
+ myTransferReader(new XSControl_TransferReader),
+ myTransferWriter(new XSControl_TransferWriter)
+{}
+
+//=======================================================================
+//function : XSControl_WorkSession
+//purpose :
+//=======================================================================
+XSControl_WorkSession::~XSControl_WorkSession()
+{
+ clearBinders();
+}
+
+//=======================================================================
+//function : ClearData
+//purpose :
+//=======================================================================
+void XSControl_WorkSession::ClearData(const Standard_Integer mode)
+{
+ // 1-2-3-4 : standard IFSelect
+ if (mode >= 1 && mode <= 4) IFSelect_WorkSession::ClearData(mode);
+
+ // 5 : Transferts seuls
+ // 6 : Resultats forces seuls
+ // 7 : Management, y compris tous transferts (forces/calcules), views
+
+ if (mode == 5 || mode == 7)
+ {
+ myTransferReader->Clear(-1);
+ myTransferWriter->Clear(-1);
+ }
+ if (mode == 6 && !myTransferReader.IsNull()) myTransferReader->Clear(1);
+ myTransferReader->SetGraph(HGraph());
+}
+
+//=======================================================================
+//function : SelectNorm
+//purpose :
+//=======================================================================
+Standard_Boolean XSControl_WorkSession::SelectNorm(const Standard_CString normname)
+{
+ // 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)
+
+ 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
+//purpose :
+//=======================================================================
+void XSControl_WorkSession::SetController(const Handle(XSControl_Controller)& ctl)
+{
+ myController = ctl;
+
+ SetLibrary(myController->WorkLibrary());
+ SetProtocol(myController->Protocol());
+
+ ClearItems();
+ ClearFinalModifiers();
+ ClearShareOut(Standard_False);
+ ClearFile();
+
+ myTransferReader->SetController(myController);
+ myTransferWriter->SetController(myController);
+}
+
+//=======================================================================
+//function : SelectedNorm
+//purpose :
+//=======================================================================
+Standard_CString XSControl_WorkSession::SelectedNorm(const Standard_Boolean rsc) const
+{
+ //JR/Hp :
+ Standard_CString astr = (Standard_CString)(myController.IsNull() ? "" : myController->Name(rsc));
+ return astr;
+}
+
+//=======================================================================
+//function : SelectedNorm
+//purpose :
+//=======================================================================
+void XSControl_WorkSession::AppendReferenceWS(const TCollection_AsciiString& theName,
+ const Handle(XSControl_WorkSession)& theWS)
+{
+ myReferenceWS.Bind(theName, theWS);
+}
+
+//=======================================================================
+//function : PrintTransferStatus
+//purpose :
+//=======================================================================
+Standard_Boolean XSControl_WorkSession::PrintTransferStatus(const Standard_Integer num,
+ const Standard_Boolean wri,
+ Standard_OStream& S) const
+{
+ const Handle(Transfer_FinderProcess)& FP = myTransferWriter->FinderProcess();
+ Handle(Transfer_TransientProcess) TP = myTransferReader->TransientProcess();
+
+ Handle(Transfer_Binder) binder;
+ Handle(Transfer_Finder) finder;
+ Handle(Standard_Transient) ent;
+
+ // *** WRITE ***
+ if (wri)
+ {
+ 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 << std::endl;
+ ent = FP->FindTransient(finder);
+ S << " -> Type " << finder->DynamicType()->Name() << std::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 << std::endl;
+ }
+ }
+
+ // *** READ ***
+ else
+ {
+ if (TP.IsNull()) return Standard_False;
+ Handle(Interface_InterfaceModel) model = TP->Model();
+ if (model.IsNull()) std::cout << "No Model" << std::endl;
+ else if (model != Model()) std::cout << "Model different from the session" << std::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);
+ }
+
+ S << "Transfer Read item n0." << ne << " of " << max;
+ if (nr > 0)
+ {
+ S << " ** Transfer Root n0." << ne;
+ }
+ S << std::endl;
+ if (!model.IsNull()) { S << " In Model, Entity "; model->Print(ent, S); }
+ binder = TP->MapItem(ne);
+ S << std::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) << std::endl;
+ }
+ if (nbf > 0)
+ {
+ S << " - Fails : " << nbf << " :\n";
+ for (i = 1; i <= nbf; i++) S << ch->CFail(i) << std::endl;
+ }
+ }
+ return Standard_True;
+}
+
+//=======================================================================
+//function : InitTransferReader
+//purpose :
+//=======================================================================
+void XSControl_WorkSession::InitTransferReader(const Standard_Integer mode)
+{
+ if (mode == 0 || mode == 5) myTransferReader->Clear(-1); // full clear
+ if (myTransferReader.IsNull()) SetTransferReader(new XSControl_TransferReader);
+ else SetTransferReader(myTransferReader);
+
+ // 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();
+}
+
+//=======================================================================
+//function : SetTransferReader
+//purpose :
+//=======================================================================
+void XSControl_WorkSession::SetTransferReader(const Handle(XSControl_TransferReader)& TR)
+{
+ 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());
+ TP->SetErrorHandle(Standard_True);
+ TR->SetTransientProcess(TP);
+}
+
+//=======================================================================
+//function : MapReader
+//purpose :
+//=======================================================================
+Handle(Transfer_TransientProcess) XSControl_WorkSession::MapReader() const
+{
+ return myTransferReader->TransientProcess();
+}
+
+//=======================================================================
+//function : SetMapReader
+//purpose :
+//=======================================================================
+Standard_Boolean XSControl_WorkSession::SetMapReader(const Handle(Transfer_TransientProcess)& TP)
+{
+ if (TP.IsNull()) return Standard_False;
+ if (TP->Model().IsNull()) TP->SetModel(Model());
+ TP->SetGraph(HGraph());
+ if (TP->Model() != Model()) return Standard_False;
+ // TR ne doit pas bouger, c est un "crochet" pour signatures, selections ...
+ // En revanche, mieux vaut le RAZ
+ // Handle(XSControl_TransferReader) TR = new XSControl_TransferReader;
+ 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;
+}
+
+//=======================================================================
+//function : Result
+//purpose :
+//=======================================================================
+Handle(Standard_Transient) XSControl_WorkSession::Result(const Handle(Standard_Transient)& ent,
+ const Standard_Integer mode) const
+{
+ Standard_Integer ouca = (mode % 10);
+ Standard_Integer kica = (mode / 10);
+
+ Handle(Transfer_Binder) binder;
+ Handle(Transfer_ResultFromModel) resu;
+
+ if (ouca != 1) resu = myTransferReader->FinalResult(ent);
+ if (mode == 20) return resu;
+
+ if (!resu.IsNull()) binder = resu->MainResult()->Binder();
+ if (binder.IsNull() && ouca > 0)
+ binder = myTransferReader->TransientProcess()->Find(ent);
+
+ if (kica == 1) return binder;
+ DeclareAndCast(Transfer_SimpleBinderOfTransient, trb, binder);
+ if (!trb.IsNull()) return trb->Result();
+ return binder;
+}
+
+//=======================================================================
+//function : TransferReadOne
+//purpose :
+//=======================================================================
+Standard_Integer XSControl_WorkSession::TransferReadOne(const Handle(Standard_Transient)& ent,
+ const Message_ProgressRange& theProgress)
+{
+ Handle(Interface_InterfaceModel) model = Model();
+ if (ent == model) return TransferReadRoots(theProgress);
+
+ Handle(TColStd_HSequenceOfTransient) list = GiveList(ent);
+ if (list->Length() == 1)
+ return myTransferReader->TransferOne(list->Value(1), Standard_True, theProgress);
+ else
+ return myTransferReader->TransferList(list, Standard_True, theProgress);
+}
+
+//=======================================================================
+//function : TransferReadRoots
+//purpose :
+//=======================================================================
+Standard_Integer XSControl_WorkSession::TransferReadRoots(const Message_ProgressRange& theProgress)
+{
+ return myTransferReader->TransferRoots(Graph(), theProgress);
+}
+
+//=======================================================================
+//function : NewModel
+//purpose :
+//=======================================================================
+Handle(Interface_InterfaceModel) XSControl_WorkSession::NewModel()
+{
+ Handle(Interface_InterfaceModel) newmod;
+ if (myController.IsNull()) return newmod;
+ newmod = myController->NewModel();
+
+ SetModel(newmod);
+ if (!myTransferReader->TransientProcess().IsNull())
+ myTransferReader->TransientProcess()->Clear();
+ //clear all contains of WS
+ myTransferReader->Clear(3);
+ myTransferWriter->Clear(-1);
+
+ return newmod;
+}
+
+//=======================================================================
+//function : TransferWriter
+//purpose :
+//=======================================================================
+const Handle(XSControl_TransferWriter)& XSControl_WorkSession::TransferWriter() const
+{
+ return myTransferWriter;
+}
+
+//=======================================================================
+//function : SetMapWriter
+//purpose :
+//=======================================================================
+Standard_Boolean XSControl_WorkSession::SetMapWriter(const Handle(Transfer_FinderProcess)& theFP)
+{
+ if (theFP.IsNull()) return Standard_False;
+ myTransferWriter->SetFinderProcess(theFP);
+ return Standard_True;
+}
+
+//=======================================================================
+//function : TransferWriteShape
+//purpose :
+//=======================================================================
+XSControl_ReturnStatus XSControl_WorkSession::TransferWriteShape(const TopoDS_Shape& shape,
+ const Standard_Boolean compgraph,
+ const Message_ProgressRange& theProgress)
+{
+ XSControl_ReturnStatus status;
+ if (myController.IsNull()) return XSControl_RetError;
+ const Handle(Interface_InterfaceModel)& model = Model();
+ if (model.IsNull() || shape.IsNull())
+ {
+ return XSControl_RetVoid;
+ }
+
+ status = myTransferWriter->TransferWriteShape(model, shape, theProgress);
+ if (theProgress.UserBreak())
+ return XSControl_RetStop;
+ // qui s occupe de tout, try/catch inclus
+
+ //skl insert param compgraph for XDE writing 10.12.2003
+ if (compgraph) ComputeGraph(Standard_True);
+
+ return status;
+}
+
+//=======================================================================
+//function : TransferWriteCheckList
+//purpose :
+//=======================================================================
+Interface_CheckIterator XSControl_WorkSession::TransferWriteCheckList() const
+{
+ return myTransferWriter->ResultCheckList(Model());
+}
+
+//=======================================================================
+//function : clearBinders
+//purpose :
+//=======================================================================
+void XSControl_WorkSession::clearBinders()
+{
+ 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;
+ }
+ }
+}
--- /dev/null
+// Created on: 1995-06-01
+// 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_WorkSession_HeaderFile
+#define _XSControl_WorkSession_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <IFSelect_WorkSession.hxx>
+#include <Message_ProgressRange.hxx>
+
+class XSControl_Controller;
+class XSControl_TransferReader;
+class XSControl_TransferWriter;
+class Transfer_TransientProcess;
+class Interface_InterfaceModel;
+class Transfer_FinderProcess;
+class TopoDS_Shape;
+class Interface_CheckIterator;
+
+class XSControl_WorkSession;
+DEFINE_STANDARD_HANDLE(XSControl_WorkSession, IFSelect_WorkSession)
+
+typedef NCollection_DataMap<TCollection_AsciiString, Handle(XSControl_WorkSession)> XSControl_WorkSessionMap;
+
+//! 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
+//! -> 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
+{
+public:
+
+ Standard_EXPORT XSControl_WorkSession();
+
+ Standard_EXPORT ~XSControl_WorkSession();
+
+ //! In addition to basic ClearData, 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;
+
+ //! Selects a Norm defined by its name.
+ //! A Norm is described and handled by a Controller
+ //! Returns True if done, False if <normname> is unknown
+ //!
+ //! The current Profile for this Norm is taken.
+ 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;
+
+ //! Returns the norm controller itself
+ const Handle(XSControl_Controller)& NormAdaptor() const { return myController; }
+
+ //! Returns the current reference WS List, empty if not defined
+ const XSControl_WorkSessionMap& ReferenceWS() const { return myReferenceWS; }
+
+ //! Appends new refrence Work Session
+ Standard_EXPORT void AppendReferenceWS(const TCollection_AsciiString& theName,
+ const Handle(XSControl_WorkSession)& theWS);
+
+ //! Prints the transfer status of a transferred item, as being
+ //! 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,
+ Standard_OStream& theS) const;
+
+ //! 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
+ //! 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);
+
+ //! Sets a Transfer Reader, which manages transfers on reading
+ Standard_EXPORT void SetTransferReader(const Handle(XSControl_TransferReader)& theTR);
+
+ //! Returns the Transfer Reader, Null if not set
+ const Handle(XSControl_TransferReader)& TransferReader() const { return myTransferReader; }
+
+ //! Returns the TransientProcess(internal data for TransferReader)
+ Standard_EXPORT Handle(Transfer_TransientProcess) MapReader() const;
+
+ //! 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 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,
+ const Message_ProgressRange& theProgress = Message_ProgressRange());
+
+ //! 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(const Message_ProgressRange& theProgress = Message_ProgressRange());
+
+ //! produces and returns a new Model well conditioned
+ //! It is produced by the Norm Controller
+ //! It can be Null (if this function is not implemented)
+ Standard_EXPORT Handle(Interface_InterfaceModel) NewModel();
+
+ //! Returns the Transfer Reader, Null if not set
+ Standard_EXPORT const Handle(XSControl_TransferWriter)& TransferWriter() const;
+
+ //! 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_EXPORT Standard_Boolean SetMapWriter(const Handle(Transfer_FinderProcess)& theFP);
+
+ //! 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 XSControl_ReturnStatus TransferWriteShape(const TopoDS_Shape& theShape,
+ const Standard_Boolean theCompGraph = Standard_True,
+ const Message_ProgressRange& theProgress = Message_ProgressRange());
+
+ //! Returns the check-list of last transfer (write)
+ //! It is recorded in the FinderProcess, but it must be bound with
+ //! resulting entities (in the resulting file model) rather than
+ //! with original objects (in fact, their mappers)
+ Standard_EXPORT Interface_CheckIterator TransferWriteCheckList() const;
+
+ DEFINE_STANDARD_RTTIEXT(XSControl_WorkSession, IFSelect_WorkSession)
+
+protected:
+
+ //! Clears binders
+ void clearBinders();
+
+private:
+
+ Handle(XSControl_Controller) myController;
+ Handle(XSControl_TransferReader) myTransferReader;
+ Handle(XSControl_TransferWriter) myTransferWriter;
+ XSControl_WorkSessionMap myReferenceWS;
+};
+
+#endif // _XSControl_WorkSession_HeaderFile
DE_ConfigurationContext.hxx
DE_ConfigurationNode.cxx
DE_ConfigurationNode.hxx
+DE_DataModel.cxx
+DE_DataModel.hxx
+DE_InterfaceParameters.cxx
+DE_InterfaceParameters.hxx
DE_Provider.cxx
DE_Provider.hxx
+DE_ReturnStatus.hxx
+DE_WorkSession.cxx
+DE_WorkSession.hxx
DE_Wrapper.cxx
DE_Wrapper.hxx
HeaderSection_FileName.hxx
HeaderSection_FileSchema.cxx
HeaderSection_FileSchema.hxx
+HeaderSection_MakeHeader.cxx
+HeaderSection_MakeHeader.hxx
HeaderSection_Protocol.cxx
HeaderSection_Protocol.hxx
--- /dev/null
+// Created on: 1993-08-12
+// Created by: Frederic MAUPAS
+// 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.
+
+//#58 rln 28.12.98 STEP header fields (NOTE: more parameterization is necessary)
+//pdn 11.01.99 including <stdio.h> for compilation on NT
+
+#include <HeaderSection_MakeHeader.hxx>
+#include <HeaderSection_FileDescription.hxx>
+#include <HeaderSection_FileName.hxx>
+#include <HeaderSection_FileSchema.hxx>
+#include <Interface_EntityIterator.hxx>
+#include <Interface_HArray1OfHAsciiString.hxx>
+#include <Interface_Macros.hxx>
+#include <Interface_MSG.hxx>
+#include <Interface_Version.hxx>
+#include <StepData_Protocol.hxx>
+#include <StepData_StepModel.hxx>
+#include <TCollection_HAsciiString.hxx>
+
+#include <stdio.h>
+// This is a generic header for any STEP sheme
+static Handle(TCollection_HAsciiString) nulstr;
+static Handle(Interface_HArray1OfHAsciiString) nularr;
+
+HeaderSection_MakeHeader::HeaderSection_MakeHeader
+ (const Handle(StepData_StepModel)& model)
+{
+ done = Standard_True;
+ if (model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileName))) {
+ fn = GetCasted(HeaderSection_FileName,
+ model->HeaderEntity(STANDARD_TYPE(HeaderSection_FileName)));
+ }
+ else done = Standard_False;
+ if (model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileSchema))) {
+ fs = GetCasted(HeaderSection_FileSchema,
+ model->HeaderEntity(STANDARD_TYPE(HeaderSection_FileSchema)));
+ }
+ else done = Standard_False;
+ if (model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileDescription))) {
+ fd = GetCasted(HeaderSection_FileDescription,
+ model->HeaderEntity(STANDARD_TYPE(HeaderSection_FileDescription)));
+ }
+ else done = Standard_False;
+}
+
+HeaderSection_MakeHeader::HeaderSection_MakeHeader
+ (const Standard_Integer shapetype)
+{
+ switch(shapetype) {
+ case 1 : Init ("Open CASCADE Facetted BRep Model"); break;
+ case 2 : Init ("Open CASCADE Face Based Surface Model"); break;
+ case 3 : Init ("Open CASCADE Shell Based Surface Model"); break;
+ case 4 : Init ("Open CASCADE Manifold Solid Brep Model"); break;
+ default: Init ("Open CASCADE Shape Model"); break;
+ }
+}
+
+void HeaderSection_MakeHeader::Init (const Standard_CString nameval)
+{
+ done = Standard_True;
+
+ // - File Name
+ char timestamp[50];
+
+ if (fn.IsNull()) fn = new HeaderSection_FileName;
+ Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(nameval);
+ fn->SetName(name);
+ Interface_MSG::TDate (timestamp,0,0,0,0,0,1,"C:%4.4d-%2.2d-%2.2dT%2.2d:%2.2d:%2.2d"); // actually
+ Handle(TCollection_HAsciiString) tst =
+ new TCollection_HAsciiString(timestamp);
+ fn->SetTimeStamp(tst);
+ Handle(Interface_HArray1OfHAsciiString) authors =
+ new Interface_HArray1OfHAsciiString(1,1);
+ Handle(TCollection_HAsciiString) a1 =
+ new TCollection_HAsciiString("Author");
+ authors->SetValue(1,a1);
+ fn->SetAuthor(authors);
+ Handle(Interface_HArray1OfHAsciiString) org =
+ new Interface_HArray1OfHAsciiString(1,1);
+ Handle(TCollection_HAsciiString) org1 =
+ new TCollection_HAsciiString("Open CASCADE");
+ org->SetValue(1,org1);
+ fn->SetOrganization(org);
+
+ char procver[80];
+ sprintf (procver, XSTEP_PROCESSOR_VERSION, "STEP");
+ Handle(TCollection_HAsciiString) pv = new TCollection_HAsciiString (procver);
+ //Handle(TCollection_HAsciiString) pv =
+ //new TCollection_HAsciiString(XSTEP_VERSION);
+ fn->SetPreprocessorVersion(pv);
+
+ Handle(TCollection_HAsciiString) sys =
+ new TCollection_HAsciiString(XSTEP_SYSTEM_VERSION);//#58 rln
+ fn->SetOriginatingSystem(sys);
+ Handle(TCollection_HAsciiString) auth =
+ new TCollection_HAsciiString("Unknown");
+ fn->SetAuthorisation(auth);
+
+ // - File Description
+
+ if (fd.IsNull()) fd = new HeaderSection_FileDescription;
+ Handle(Interface_HArray1OfHAsciiString) descr =
+ new Interface_HArray1OfHAsciiString(1,1);
+ Handle(TCollection_HAsciiString) descr1 =
+ new TCollection_HAsciiString("Open CASCADE Model");
+ descr->SetValue(1,descr1);
+ fd->SetDescription(descr);
+ Handle(TCollection_HAsciiString) il =
+ new TCollection_HAsciiString("2;1");
+ fd->SetImplementationLevel(il);
+
+ // - File Schema
+
+ if (fs.IsNull()) fs = new HeaderSection_FileSchema;
+ Handle(Interface_HArray1OfHAsciiString) schid =
+ new Interface_HArray1OfHAsciiString(1,1);
+ Handle(TCollection_HAsciiString) schid1 =
+ new TCollection_HAsciiString("");
+ schid->SetValue(1,schid1);
+ fs->SetSchemaIdentifiers(schid);
+
+}
+
+Standard_Boolean HeaderSection_MakeHeader::IsDone() const
+{
+ return done;
+}
+
+void HeaderSection_MakeHeader::Apply
+ (const Handle(StepData_StepModel)& model) const
+{
+ Interface_EntityIterator header = model->Header();
+ if (HasFd() && !model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileDescription)))
+ header.AddItem(fd);
+ if (HasFn() && !model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileName)))
+ header.AddItem(fn);
+ if (HasFs() && !model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileSchema))) {
+
+// Schema defined? If not take it from the protocole
+ Handle(TCollection_HAsciiString) sch;
+ Handle(Interface_HArray1OfHAsciiString) schid = fs->SchemaIdentifiers();
+ if (!schid.IsNull()) sch = schid->Value(1);
+ else {
+ schid = new Interface_HArray1OfHAsciiString(1,1);
+ fs->SetSchemaIdentifiers(schid);
+ }
+ if (!sch.IsNull()) { if (sch->Length() < 2) sch.Nullify(); } // not defined
+ if (sch.IsNull()) {
+ Handle(StepData_Protocol) stepro = Handle(StepData_Protocol)::DownCast
+ ( model->Protocol());
+ if (!stepro.IsNull()) sch = new TCollection_HAsciiString
+ (stepro->SchemaName());
+ if (!sch.IsNull()) schid->SetValue (1,sch);
+ }
+ header.AddItem(fs);
+ }
+ model->ClearHeader();
+ for (header.Start(); header.More(); header.Next())
+ model->AddHeaderEntity(header.Value());
+}
+
+
+// ========
+// FileName
+// ========
+
+Handle(StepData_StepModel) HeaderSection_MakeHeader::NewModel
+ (const Handle(Interface_Protocol)& protocol) const
+{
+ Handle(StepData_StepModel) stepmodel = new StepData_StepModel;
+ stepmodel->SetProtocol (protocol);
+
+ // - Make Header information
+
+ Apply(stepmodel);
+ return stepmodel;
+}
+
+// ######## Individual Queries / Actions ########
+
+// ========
+// FileName
+// ========
+
+Standard_Boolean HeaderSection_MakeHeader::HasFn() const
+{ return (!fn.IsNull()); }
+
+Handle(HeaderSection_FileName) HeaderSection_MakeHeader::FnValue() const
+{
+ return fn;
+}
+
+/*
+void HeaderSection_MakeHeader::SetNameFromShapeType(const Standard_Integer shapetype)
+{
+ Handle(TCollection_HAsciiString) name;
+ switch(shapetype)
+ {
+ case 1: // face_based_surface_model
+ name = new TCollection_HAsciiString
+ ("Euclid Face Based Surface Model");
+ break;
+ case 2: // manifold_solid_brep
+ name = new TCollection_HAsciiString
+ ("Euclid Manifold Solid Brep Model");
+ break;
+ case 3: // facetted_brep
+ name = new TCollection_HAsciiString
+ ("Euclid Facetted Brep Model");
+ break;
+ default : // others ?
+ name = new TCollection_HAsciiString
+ ("Euclid Shape Model");
+ break;
+ }
+ SetName(aName);
+}
+*/
+
+void HeaderSection_MakeHeader::SetName(const Handle(TCollection_HAsciiString)& aName)
+{
+ if (!fn.IsNull()) fn->SetName(aName);
+}
+
+Handle(TCollection_HAsciiString) HeaderSection_MakeHeader::Name() const
+{
+ return (fn.IsNull() ? nulstr : fn->Name());
+}
+
+void HeaderSection_MakeHeader::SetTimeStamp(const Handle(TCollection_HAsciiString)& aTimeStamp)
+{
+ if (!fn.IsNull()) fn->SetTimeStamp(aTimeStamp);
+}
+
+Handle(TCollection_HAsciiString) HeaderSection_MakeHeader::TimeStamp() const
+{
+ return (fn.IsNull() ? nulstr : fn->TimeStamp());
+}
+
+void HeaderSection_MakeHeader::SetAuthor(const Handle(Interface_HArray1OfHAsciiString)& aAuthor)
+{
+ if (!fn.IsNull()) fn->SetAuthor(aAuthor);
+}
+
+void HeaderSection_MakeHeader::SetAuthorValue(const Standard_Integer num, const Handle(TCollection_HAsciiString)& aAuthor)
+{
+ if (fn.IsNull()) return;
+ Handle(Interface_HArray1OfHAsciiString) li = fn->Author();
+ if (num >= li->Lower() && num <= li->Upper()) li->SetValue(num,aAuthor);
+}
+
+Handle(Interface_HArray1OfHAsciiString) HeaderSection_MakeHeader::Author() const
+{
+ return (fn.IsNull() ? nularr : fn->Author());
+}
+
+Handle(TCollection_HAsciiString) HeaderSection_MakeHeader::AuthorValue(const Standard_Integer num) const
+{
+ return (fn.IsNull() ? nulstr : fn->AuthorValue(num));
+}
+
+Standard_Integer HeaderSection_MakeHeader::NbAuthor () const
+{
+ return (fn.IsNull() ? 0 : fn->NbAuthor());
+}
+
+void HeaderSection_MakeHeader::SetOrganization(const Handle(Interface_HArray1OfHAsciiString)& aOrganization)
+{
+ if (!fn.IsNull()) fn->SetOrganization(aOrganization);
+}
+
+void HeaderSection_MakeHeader::SetOrganizationValue(const Standard_Integer num, const Handle(TCollection_HAsciiString)& aOrgan)
+{
+ if (fn.IsNull()) return;
+ Handle(Interface_HArray1OfHAsciiString) li = fn->Organization();
+ if (num >= li->Lower() && num <= li->Upper()) li->SetValue(num,aOrgan);
+}
+
+Handle(Interface_HArray1OfHAsciiString) HeaderSection_MakeHeader::Organization() const
+{
+ return (fn.IsNull() ? nularr : fn->Organization());
+}
+
+Handle(TCollection_HAsciiString) HeaderSection_MakeHeader::OrganizationValue(const Standard_Integer num) const
+{
+ return (fn.IsNull() ? nulstr : fn->OrganizationValue(num));
+}
+
+Standard_Integer HeaderSection_MakeHeader::NbOrganization () const
+{
+ return (fn.IsNull() ? 0 : fn->NbOrganization());
+}
+
+void HeaderSection_MakeHeader::SetPreprocessorVersion(const Handle(TCollection_HAsciiString)& aPreprocessorVersion)
+{
+ if (!fn.IsNull()) fn->SetPreprocessorVersion(aPreprocessorVersion);
+}
+
+Handle(TCollection_HAsciiString) HeaderSection_MakeHeader::PreprocessorVersion() const
+{
+ return (fn.IsNull() ? nulstr : fn->PreprocessorVersion());
+}
+
+void HeaderSection_MakeHeader::SetOriginatingSystem(const Handle(TCollection_HAsciiString)& aOriginatingSystem)
+{
+ if (!fn.IsNull()) fn->SetOriginatingSystem(aOriginatingSystem);
+}
+
+Handle(TCollection_HAsciiString) HeaderSection_MakeHeader::OriginatingSystem() const
+{
+ return (fn.IsNull() ? nulstr : fn->OriginatingSystem());
+}
+
+void HeaderSection_MakeHeader::SetAuthorisation(const Handle(TCollection_HAsciiString)& aAuthorisation)
+{
+ if (!fn.IsNull()) fn->SetAuthorisation(aAuthorisation);
+}
+
+Handle(TCollection_HAsciiString) HeaderSection_MakeHeader::Authorisation() const
+{
+ return (fn.IsNull() ? nulstr : fn->Authorisation());
+}
+
+// ===========
+// File Schema
+// ===========
+
+Standard_Boolean HeaderSection_MakeHeader::HasFs() const
+{ return (!fs.IsNull()); }
+
+Handle(HeaderSection_FileSchema) HeaderSection_MakeHeader::FsValue() const
+{
+ return fs;
+}
+
+void HeaderSection_MakeHeader::SetSchemaIdentifiers(const Handle(Interface_HArray1OfHAsciiString)& aSchemaIdentifiers)
+{
+ if (!fs.IsNull()) fs->SetSchemaIdentifiers(aSchemaIdentifiers);
+}
+
+void HeaderSection_MakeHeader::SetSchemaIdentifiersValue(const Standard_Integer num, const Handle(TCollection_HAsciiString)& aSchem)
+{
+ if (fs.IsNull()) return;
+ Handle(Interface_HArray1OfHAsciiString) li = fs->SchemaIdentifiers();
+ if (num >= li->Lower() && num <= li->Upper()) li->SetValue(num,aSchem);
+}
+
+Handle(Interface_HArray1OfHAsciiString) HeaderSection_MakeHeader::SchemaIdentifiers() const
+{
+ return (fs.IsNull() ? nularr : fs->SchemaIdentifiers());
+}
+
+Handle(TCollection_HAsciiString) HeaderSection_MakeHeader::SchemaIdentifiersValue(const Standard_Integer num) const
+{
+ return (fs.IsNull() ? nulstr : fs->SchemaIdentifiersValue(num));
+}
+
+Standard_Integer HeaderSection_MakeHeader::NbSchemaIdentifiers () const
+{
+ return (fs.IsNull() ? 0 : fs->NbSchemaIdentifiers());
+}
+
+//=======================================================================
+//function : AddSchemaIdentifier
+//purpose :
+//=======================================================================
+
+void HeaderSection_MakeHeader::AddSchemaIdentifier(const Handle(TCollection_HAsciiString)& aSchem)
+{
+ if ( fs.IsNull() ) fs = new HeaderSection_FileSchema;
+ Handle(Interface_HArray1OfHAsciiString) idents = fs->SchemaIdentifiers();
+
+ // check that requested subschema is already in the list
+ Standard_Integer i;
+ for ( i=1; ! idents.IsNull() && i <= idents->Length(); i++ ) {
+ if ( aSchem->IsSameString ( idents->Value(i) ) ) return;
+ }
+
+ // add a subshema
+ Handle(Interface_HArray1OfHAsciiString) ids =
+ new Interface_HArray1OfHAsciiString ( 1, ( idents.IsNull() ? 1 : idents->Length() + 1 ) );
+ for ( i=1; ! idents.IsNull() && i <= idents->Length(); i++ ) {
+ ids->SetValue ( i, idents->Value(i) );
+ }
+ ids->SetValue ( i, aSchem );
+
+ fs->SetSchemaIdentifiers ( ids );
+}
+
+// ================
+// File Description
+// ================
+
+Standard_Boolean HeaderSection_MakeHeader::HasFd() const
+{ return (!fd.IsNull()); }
+
+Handle(HeaderSection_FileDescription) HeaderSection_MakeHeader::FdValue() const
+{
+ return fd;
+}
+
+void HeaderSection_MakeHeader::SetDescription(const Handle(Interface_HArray1OfHAsciiString)& aDescription)
+{
+ if (!fs.IsNull()) fd->SetDescription(aDescription);
+}
+
+void HeaderSection_MakeHeader::SetDescriptionValue(const Standard_Integer num, const Handle(TCollection_HAsciiString)& aDescr)
+{
+ if (fd.IsNull()) return;
+ Handle(Interface_HArray1OfHAsciiString) li = fd->Description();
+ if (num >= li->Lower() && num <= li->Upper()) li->SetValue(num,aDescr);
+}
+
+Handle(Interface_HArray1OfHAsciiString) HeaderSection_MakeHeader::Description() const
+{
+ return (fd.IsNull() ? nularr : fd->Description());
+}
+
+Handle(TCollection_HAsciiString) HeaderSection_MakeHeader::DescriptionValue(const Standard_Integer num) const
+{
+ return (fd.IsNull() ? nulstr : fd->DescriptionValue(num));
+}
+
+Standard_Integer HeaderSection_MakeHeader::NbDescription () const
+{
+ return (fd.IsNull() ? 0 : fd->NbDescription());
+}
+
+void HeaderSection_MakeHeader::SetImplementationLevel(const Handle(TCollection_HAsciiString)& aImplementationLevel)
+{
+ if (!fd.IsNull()) fd->SetImplementationLevel(aImplementationLevel);
+}
+
+Handle(TCollection_HAsciiString) HeaderSection_MakeHeader::ImplementationLevel() const
+{
+ return (fd.IsNull() ? nulstr : fd->ImplementationLevel());
+}
--- /dev/null
+// Created on: 1993-08-12
+// Created by: Frederic MAUPAS
+// 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 _HeaderSection_MakeHeader_HeaderFile
+#define _HeaderSection_MakeHeader_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+#include <Standard_Handle.hxx>
+
+#include <Standard_Boolean.hxx>
+#include <Standard_Integer.hxx>
+#include <Interface_HArray1OfHAsciiString.hxx>
+class HeaderSection_FileName;
+class HeaderSection_FileSchema;
+class HeaderSection_FileDescription;
+class StepData_StepModel;
+class Interface_Protocol;
+class TCollection_HAsciiString;
+
+
+//! This class allows to consult and prepare/edit data stored in
+//! a Step Model Header
+class HeaderSection_MakeHeader
+{
+public:
+
+ DEFINE_STANDARD_ALLOC
+
+
+ //! Prepares a new MakeHeader from scratch
+ Standard_EXPORT HeaderSection_MakeHeader(const Standard_Integer shapetype = 0);
+
+ //! Prepares a MakeHeader from the content of a StepModel
+ //! See IsDone to know if the Header is well defined
+ Standard_EXPORT HeaderSection_MakeHeader(const Handle(StepData_StepModel)& model);
+
+ //! Cancels the former definition and gives a FileName
+ //! To be used when a Model has no well defined Header
+ Standard_EXPORT void Init (const Standard_CString nameval);
+
+ //! Returns True if all data have been defined (see also
+ //! HasFn, HasFs, HasFd)
+ Standard_EXPORT Standard_Boolean IsDone() const;
+
+ //! Creates an empty header for a new
+ //! STEP model and allows the header fields to be completed.
+ Standard_EXPORT void Apply (const Handle(StepData_StepModel)& model) const;
+
+ //! Builds a Header, creates a new StepModel, then applies the
+ //! Header to the StepModel
+ //! The Schema Name is taken from the Protocol (if it inherits
+ //! from StepData, else it is left in blanks)
+ Standard_EXPORT Handle(StepData_StepModel) NewModel (const Handle(Interface_Protocol)& protocol) const;
+
+ //! Checks whether there is a
+ //! file_name entity. Returns True if there is one.
+ Standard_EXPORT Standard_Boolean HasFn() const;
+
+ //! Returns the file_name entity.
+ //! Returns an empty entity if the file_name entity is not initialized.
+ Standard_EXPORT Handle(HeaderSection_FileName) FnValue() const;
+
+ Standard_EXPORT void SetName (const Handle(TCollection_HAsciiString)& aName);
+
+ //! Returns the name attribute for the file_name entity.
+ Standard_EXPORT Handle(TCollection_HAsciiString) Name() const;
+
+ Standard_EXPORT void SetTimeStamp (const Handle(TCollection_HAsciiString)& aTimeStamp);
+
+ //! Returns the value of the time_stamp attribute for the file_name entity.
+ Standard_EXPORT Handle(TCollection_HAsciiString) TimeStamp() const;
+
+ Standard_EXPORT void SetAuthor (const Handle(Interface_HArray1OfHAsciiString)& aAuthor);
+
+ Standard_EXPORT void SetAuthorValue (const Standard_Integer num, const Handle(TCollection_HAsciiString)& aAuthor);
+
+ Standard_EXPORT Handle(Interface_HArray1OfHAsciiString) Author() const;
+
+ //! Returns the value of the name attribute for the file_name entity.
+ Standard_EXPORT Handle(TCollection_HAsciiString) AuthorValue (const Standard_Integer num) const;
+
+ //! Returns the number of values for the author attribute in the file_name entity.
+ Standard_EXPORT Standard_Integer NbAuthor() const;
+
+ Standard_EXPORT void SetOrganization (const Handle(Interface_HArray1OfHAsciiString)& aOrganization);
+
+ Standard_EXPORT void SetOrganizationValue (const Standard_Integer num, const Handle(TCollection_HAsciiString)& aOrganization);
+
+ Standard_EXPORT Handle(Interface_HArray1OfHAsciiString) Organization() const;
+
+ //! Returns the value of attribute
+ //! organization for the file_name entity.
+ Standard_EXPORT Handle(TCollection_HAsciiString) OrganizationValue (const Standard_Integer num) const;
+
+ //! Returns the number of values for
+ //! the organization attribute in the file_name entity.
+ Standard_EXPORT Standard_Integer NbOrganization() const;
+
+ Standard_EXPORT void SetPreprocessorVersion (const Handle(TCollection_HAsciiString)& aPreprocessorVersion);
+
+ //! Returns the name of the preprocessor_version for the file_name entity.
+ Standard_EXPORT Handle(TCollection_HAsciiString) PreprocessorVersion() const;
+
+ Standard_EXPORT void SetOriginatingSystem (const Handle(TCollection_HAsciiString)& aOriginatingSystem);
+
+ Standard_EXPORT Handle(TCollection_HAsciiString) OriginatingSystem() const;
+
+ Standard_EXPORT void SetAuthorisation (const Handle(TCollection_HAsciiString)& aAuthorisation);
+
+ //! Returns the value of the authorization attribute for the file_name entity.
+ Standard_EXPORT Handle(TCollection_HAsciiString) Authorisation() const;
+
+ //! Checks whether there is a file_schema entity. Returns True if there is one.
+ Standard_EXPORT Standard_Boolean HasFs() const;
+
+ //! Returns the file_schema entity. Returns an empty entity if the file_schema entity is not initialized.
+ Standard_EXPORT Handle(HeaderSection_FileSchema) FsValue() const;
+
+ Standard_EXPORT void SetSchemaIdentifiers (const Handle(Interface_HArray1OfHAsciiString)& aSchemaIdentifiers);
+
+ Standard_EXPORT void SetSchemaIdentifiersValue (const Standard_Integer num, const Handle(TCollection_HAsciiString)& aSchemaIdentifier);
+
+ Standard_EXPORT Handle(Interface_HArray1OfHAsciiString) SchemaIdentifiers() const;
+
+ //! Returns the value of the schema_identifier attribute for the file_schema entity.
+ Standard_EXPORT Handle(TCollection_HAsciiString) SchemaIdentifiersValue (const Standard_Integer num) const;
+
+ //! Returns the number of values for the schema_identifier attribute in the file_schema entity.
+ Standard_EXPORT Standard_Integer NbSchemaIdentifiers() const;
+
+ //! Add a subname of schema (if not yet in the list)
+ Standard_EXPORT void AddSchemaIdentifier (const Handle(TCollection_HAsciiString)& aSchemaIdentifier);
+
+ //! Checks whether there is a file_description entity. Returns True if there is one.
+ Standard_EXPORT Standard_Boolean HasFd() const;
+
+ //! Returns the file_description
+ //! entity. Returns an empty entity if the file_description entity is not initialized.
+ Standard_EXPORT Handle(HeaderSection_FileDescription) FdValue() const;
+
+ Standard_EXPORT void SetDescription (const Handle(Interface_HArray1OfHAsciiString)& aDescription);
+
+ Standard_EXPORT void SetDescriptionValue (const Standard_Integer num, const Handle(TCollection_HAsciiString)& aDescription);
+
+ Standard_EXPORT Handle(Interface_HArray1OfHAsciiString) Description() const;
+
+ //! Returns the value of the
+ //! description attribute for the file_description entity.
+ Standard_EXPORT Handle(TCollection_HAsciiString) DescriptionValue (const Standard_Integer num) const;
+
+ //! Returns the number of values for
+ //! the file_description entity in the STEP file header.
+ Standard_EXPORT Standard_Integer NbDescription() const;
+
+ Standard_EXPORT void SetImplementationLevel (const Handle(TCollection_HAsciiString)& aImplementationLevel);
+
+ //! Returns the value of the
+ //! implementation_level attribute for the file_description entity.
+ Standard_EXPORT Handle(TCollection_HAsciiString) ImplementationLevel() const;
+
+
+
+
+protected:
+
+
+
+
+
+private:
+
+
+
+ Standard_Boolean done;
+ Handle(HeaderSection_FileName) fn;
+ Handle(HeaderSection_FileSchema) fs;
+ Handle(HeaderSection_FileDescription) fd;
+
+
+};
+
+
+
+
+
+
+
+#endif // _HeaderSection_MakeHeader_HeaderFile
+++ /dev/null
-IFGraph_AllConnected.cxx
-IFGraph_AllConnected.hxx
-IFGraph_AllShared.cxx
-IFGraph_AllShared.hxx
-IFGraph_Articulations.cxx
-IFGraph_Articulations.hxx
-IFGraph_Compare.cxx
-IFGraph_Compare.hxx
-IFGraph_ConnectedComponants.cxx
-IFGraph_ConnectedComponants.hxx
-IFGraph_Cumulate.cxx
-IFGraph_Cumulate.hxx
-IFGraph_Cycles.cxx
-IFGraph_Cycles.hxx
-IFGraph_ExternalSources.cxx
-IFGraph_ExternalSources.hxx
-IFGraph_SCRoots.cxx
-IFGraph_SCRoots.hxx
-IFGraph_StrongComponants.cxx
-IFGraph_StrongComponants.hxx
-IFGraph_SubPartsIterator.cxx
-IFGraph_SubPartsIterator.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 <IFGraph_AllConnected.hxx>
-#include <Interface_Graph.hxx>
-#include <Standard_Transient.hxx>
-
-// AllConnected prend toutes les Entites connectees a une Entite donnee
-// c-a-d toutes les "Shared" + toutes les "Sharings" et on recommence
-// Autrement dit le contenu du "Composant Connexe" du graphe d'ensemble
-// qui contient cette entite
-// Le calcul est effectue par GetFromEntity (Evaluate n'a rien a faire)
-IFGraph_AllConnected::IFGraph_AllConnected (const Interface_Graph& agraph)
- : thegraph (agraph) { }
-
-
- IFGraph_AllConnected::IFGraph_AllConnected
- (const Interface_Graph& agraph, const Handle(Standard_Transient)& ent)
- : thegraph (agraph)
- { GetFromEntity(ent); }
-
- void IFGraph_AllConnected::GetFromEntity
- (const Handle(Standard_Transient)& ent)
-{
- if (!thegraph.IsPresent(thegraph.EntityNumber(ent))) return;
- thegraph.GetFromEntity(ent,Standard_False);
-
- for (Interface_EntityIterator shareds = thegraph.Shareds(ent);
- shareds.More(); shareds.Next())
- GetFromEntity(shareds.Value());
-
- for (Interface_EntityIterator sharings = thegraph.Sharings(ent);
- sharings.More(); sharings.Next())
- GetFromEntity(sharings.Value());
-}
-
- void IFGraph_AllConnected::ResetData ()
- { Reset(); thegraph.Reset(); }
-
- void IFGraph_AllConnected::Evaluate()
- { GetFromGraph(thegraph); } // GetFromEntity a tout fait
+++ /dev/null
-// Created on: 1992-10-02
-// 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 _IFGraph_AllConnected_HeaderFile
-#define _IFGraph_AllConnected_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Interface_Graph.hxx>
-#include <Interface_GraphContent.hxx>
-class Standard_Transient;
-
-
-//! this class gives content of the CONNECTED COMPONENT(S)
-//! which include specific Entity(ies)
-class IFGraph_AllConnected : public Interface_GraphContent
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- //! creates an AllConnected from a graph, empty ready to be filled
- Standard_EXPORT IFGraph_AllConnected(const Interface_Graph& agraph);
-
- //! creates an AllConnected which memorizes Entities Connected to
- //! a given one, at any level : that is, itself, all Entities
- //! Shared by it and Sharing it, and so on.
- //! In other terms, this is the content of the CONNECTED COMPONENT
- //! which include a specific Entity
- Standard_EXPORT IFGraph_AllConnected(const Interface_Graph& agraph, const Handle(Standard_Transient)& ent);
-
- //! adds an entity and its Connected ones to the list (allows to
- //! cumulate all Entities Connected by some ones)
- //! Note that if "ent" is in the already computed list,, no entity
- //! will be added, but if "ent" is not already in the list, a new
- //! Connected Component will be cumulated
- Standard_EXPORT void GetFromEntity (const Handle(Standard_Transient)& ent);
-
- //! Allows to restart on a new data set
- Standard_EXPORT void ResetData();
-
- //! does the specific evaluation (Connected entities atall levels)
- Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
- Interface_Graph thegraph;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFGraph_AllConnected_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 <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Transient.hxx>
-
-IFGraph_AllShared::IFGraph_AllShared (const Interface_Graph& agraph)
- : thegraph (agraph) { }
-
-
- IFGraph_AllShared::IFGraph_AllShared
- (const Interface_Graph& agraph, const Handle(Standard_Transient)& ent)
- : thegraph (agraph)
-{
- if (!agraph.Model()->Contains(ent)) return;
- GetFromEntity(ent);
-}
-
- void IFGraph_AllShared::GetFromEntity
- (const Handle(Standard_Transient)& ent)
- { thegraph.GetFromEntity(ent,Standard_True); } // le fait pour nous
-
- void IFGraph_AllShared::GetFromIter (const Interface_EntityIterator& iter)
-{
- for (iter.Start(); iter.More(); iter.Next())
- thegraph.GetFromEntity(iter.Value(),Standard_True);
-}
-
- void IFGraph_AllShared::ResetData ()
- { Reset(); thegraph.Reset(); }
-
- void IFGraph_AllShared::Evaluate()
- { Reset(); GetFromGraph(thegraph); }
+++ /dev/null
-// Created on: 1992-09-30
-// 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 _IFGraph_AllShared_HeaderFile
-#define _IFGraph_AllShared_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Interface_Graph.hxx>
-#include <Interface_GraphContent.hxx>
-class Standard_Transient;
-class Interface_EntityIterator;
-
-
-//! this class determines all Entities shared by some specific
-//! ones, at any level (those which will be lead in a Transfer
-//! for instance)
-class IFGraph_AllShared : public Interface_GraphContent
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- //! creates an AllShared from a graph, empty ready to be filled
- Standard_EXPORT IFGraph_AllShared(const Interface_Graph& agraph);
-
- //! creates an AllShared which memrizes Entities shared by a given
- //! one, at any level, including itself
- Standard_EXPORT IFGraph_AllShared(const Interface_Graph& agraph, const Handle(Standard_Transient)& ent);
-
- //! adds an entity and its shared ones to the list (allows to
- //! cumulate all Entities shared by some ones)
- Standard_EXPORT void GetFromEntity (const Handle(Standard_Transient)& ent);
-
- //! Adds Entities from an EntityIterator and all their shared
- //! ones at any level
- Standard_EXPORT void GetFromIter (const Interface_EntityIterator& iter);
-
- //! Allows to restart on a new data set
- Standard_EXPORT void ResetData();
-
- //! does the specific evaluation (shared entities atall levels)
- Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
- Interface_Graph thegraph;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFGraph_AllShared_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_Articulations.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Transient.hxx>
-
-// Points d'Articulation d'un Graphe : ce sont les "passages obliges" du graphe
-// Algorithme tire du Sedgewick, p 392
-IFGraph_Articulations::IFGraph_Articulations
- (const Interface_Graph& agraph, const Standard_Boolean whole)
- : thegraph (agraph)
- { if (whole) thegraph.GetFromModel(); }
-
-
- void IFGraph_Articulations::GetFromEntity
- (const Handle(Standard_Transient)& ent)
- { thegraph.GetFromEntity(ent,Standard_True); }
-
- void IFGraph_Articulations::GetFromIter(const Interface_EntityIterator& iter)
- { thegraph.GetFromIter(iter,0); }
-
-
- void IFGraph_Articulations::ResetData ()
-{ Reset(); thegraph.Reset(); thelist = new TColStd_HSequenceOfInteger(); }
-
- void IFGraph_Articulations::Evaluate ()
-{
-// Algorithme, cf Sedgewick "Algorithms", p 392
- thelist = new TColStd_HSequenceOfInteger();
-// Utilisation de Visit
- Standard_Integer nb = thegraph.Size();
- for (Standard_Integer i = 1; i <= nb; i ++) {
- thenow = 0;
- if (thegraph.IsPresent(i)) Visit(i);
- }
-// Resultat dans thelist
- Reset();
- Standard_Integer nbres = thelist->Length();
- for (Standard_Integer ires = 1; ires <= nbres; ires ++) {
- Standard_Integer num = thelist->Value(ires);
- GetOneItem(thegraph.Model()->Value(num));
- }
-}
-
- Standard_Integer IFGraph_Articulations::Visit (const Standard_Integer num)
-{
- thenow ++;
- thegraph.SetStatus(num,thenow);
- Standard_Integer min = thenow;
-
- for (Interface_EntityIterator iter = thegraph.Shareds(thegraph.Entity(num));
- iter.More(); iter.Next()) {
- Handle(Standard_Transient) ent = iter.Value();
- Standard_Integer nument = thegraph.EntityNumber(ent);
- if (!thegraph.IsPresent(num)) {
- thegraph.GetFromEntity(ent,Standard_False);
- nument = thegraph.EntityNumber(ent);
- }
- Standard_Integer statent = thegraph.Status(nument); // pas reevalue
- if (statent == 0) {
- Standard_Integer mm = Visit(nument);
- if (mm < min) min = mm;
- if (mm > thegraph.Status(num)) thelist->Append(num); // ON EN A UN : num
- }
- else if (statent < min) min = statent;
- }
- return min;
-}
+++ /dev/null
-// Created on: 1992-09-23
-// 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 _IFGraph_Articulations_HeaderFile
-#define _IFGraph_Articulations_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Interface_Graph.hxx>
-#include <Standard_Integer.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-#include <Interface_GraphContent.hxx>
-#include <Standard_Boolean.hxx>
-class Standard_Transient;
-class Interface_EntityIterator;
-
-//! this class gives entities which are Articulation points
-//! in a whole Model or in a sub-part
-//! An Articulation Point divides the graph in two (or more)
-//! disconnected sub-graphs
-//! Identifying Articulation Points allows improving
-//! efficiency of splitting a set of Entities into sub-sets
-class IFGraph_Articulations : public Interface_GraphContent
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
- //! creates Articulations to evaluate a Graph
- //! whole True : works on the whole Model
- //! whole False : remains empty, ready to work on a sub-part
- Standard_EXPORT IFGraph_Articulations(const Interface_Graph& agraph, const Standard_Boolean whole);
-
- //! adds an entity and its shared ones to the list
- Standard_EXPORT void GetFromEntity (const Handle(Standard_Transient)& ent);
-
- //! adds a list of entities (as an iterator)
- Standard_EXPORT void GetFromIter (const Interface_EntityIterator& iter);
-
- //! Allows to restart on a new data set
- Standard_EXPORT void ResetData();
-
- //! Evaluates the list of Articulation points
- Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
-
-private:
-
- //! basic routine of computation
- //! (see book Sedgewick "Algorithms", p 392)
- Standard_EXPORT Standard_Integer Visit (const Standard_Integer num);
-
-private:
-
- Interface_Graph thegraph;
- Standard_Integer thenow;
- Handle(TColStd_HSequenceOfInteger) thelist;
-
-};
-
-#endif // _IFGraph_Articulations_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 <IFGraph_Compare.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Standard_Transient.hxx>
-
-// Comparateur de deux sous-ensembles d un Modele
-// Au premier sous-ensemble, est attribue le Status 1
-// Au deuxieme sous-ensemble, est attribue le Status 2
-// La partie commune se voit attribuer le Status 3
-IFGraph_Compare::IFGraph_Compare (const Interface_Graph& agraph)
- : thegraph (agraph) { }
-
- void IFGraph_Compare::GetFromEntity
- (const Handle(Standard_Transient)& ent, const Standard_Boolean first)
-{
- IFGraph_AllShared iter(thegraph.Model(),ent);
- GetFromIter(iter,first);
-}
-
- void IFGraph_Compare::GetFromIter
- (const Interface_EntityIterator& iter, const Standard_Boolean first)
-{
- Standard_Integer stat = 2;
- if (first) stat = 1;
- thegraph.GetFromIter(iter,stat,3,Standard_False);
-}
-
-
- void IFGraph_Compare::Merge ()
-{
- thegraph.ChangeStatus (2,1);
- thegraph.ChangeStatus (3,1);
-}
-
- void IFGraph_Compare::RemoveSecond ()
-{
- thegraph.ChangeStatus (3,1);
- thegraph.RemoveStatus (2);
-}
-
- void IFGraph_Compare::KeepCommon ()
-{
- thegraph.RemoveStatus (1);
- thegraph.RemoveStatus (2);
- thegraph.ChangeStatus (3,1);
-}
-
- void IFGraph_Compare::ResetData ()
- { Reset(); thegraph.Reset(); }
-
- void IFGraph_Compare::Evaluate ()
-{
- Reset(); GetFromGraph(thegraph); // Evaluation deja faite par le graphe
-}
-
- Interface_EntityIterator IFGraph_Compare::Common () const
- { return Interface_GraphContent(thegraph,3); }
-
- Interface_EntityIterator IFGraph_Compare::FirstOnly () const
- { return Interface_GraphContent(thegraph,1); }
-
- Interface_EntityIterator IFGraph_Compare::SecondOnly () const
- { return Interface_GraphContent(thegraph,2); }
+++ /dev/null
-// Created on: 1992-09-23
-// 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 _IFGraph_Compare_HeaderFile
-#define _IFGraph_Compare_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Interface_Graph.hxx>
-#include <Interface_GraphContent.hxx>
-class Standard_Transient;
-class Interface_EntityIterator;
-
-
-//! this class evaluates effect of two compared sub-parts :
-//! cumulation (union), common part (intersection-overlapping)
-//! part specific to first sub-part or to the second one
-//! Results are kept in a Graph, several question can be set
-//! Basic Iteration gives Cumulation (union)
-class IFGraph_Compare : public Interface_GraphContent
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- //! creates empty Compare, ready to work
- Standard_EXPORT IFGraph_Compare(const Interface_Graph& agraph);
-
- //! adds an entity and its shared ones to the list :
- //! first True means adds to the first sub-list, else to the 2nd
- Standard_EXPORT void GetFromEntity (const Handle(Standard_Transient)& ent, const Standard_Boolean first);
-
- //! adds a list of entities (as an iterator) as such, that is,
- //! their shared entities are not considered (use AllShared to
- //! have them)
- //! first True means adds to the first sub-list, else to the 2nd
- Standard_EXPORT void GetFromIter (const Interface_EntityIterator& iter, const Standard_Boolean first);
-
- //! merges the second list into the first one, hence the second
- //! list is empty
- Standard_EXPORT void Merge();
-
- //! Removes the contents of second list
- Standard_EXPORT void RemoveSecond();
-
- //! Keeps only Common part, sets it as First list and clears
- //! second list
- Standard_EXPORT void KeepCommon();
-
- //! Allows to restart on a new data set
- Standard_EXPORT void ResetData();
-
- //! Recomputes result of comparing to sub-parts
- Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
-
- //! returns entities common to the both parts
- Standard_EXPORT Interface_EntityIterator Common() const;
-
- //! returns entities which are exclusively in the first list
- Standard_EXPORT Interface_EntityIterator FirstOnly() const;
-
- //! returns entities which are exclusively in the second part
- Standard_EXPORT Interface_EntityIterator SecondOnly() const;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
- Interface_Graph thegraph;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFGraph_Compare_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_AllConnected.hxx>
-#include <IFGraph_ConnectedComponants.hxx>
-#include <Interface_Graph.hxx>
-#include <Standard_Transient.hxx>
-
-// Pour travailler, ConnectedComponants exploite AllConnected :
-// On prend un 1er Vertex, on determine ses AllConnected -> voila un 1er
-// Connected Component
-// On recommence jusqu'a ce qu'il n'y ait plus de Vertex libre
-// Honnetement, si ca ne marche pas, cf classe ConnectedVerticesIterator
-// de GraphTools qui fait en principe la meme chose
-IFGraph_ConnectedComponants::IFGraph_ConnectedComponants
- (const Interface_Graph& agraph, const Standard_Boolean whole)
- : IFGraph_SubPartsIterator (agraph, whole) { }
-
- void IFGraph_ConnectedComponants::Evaluate()
-{
-// On part des "loaded"
-// Pour chacun : s il est note dans le graphe, on passe
-// Sinon, on ajoute les AllConnected en tant que sub-part
- Interface_EntityIterator loaded = Loaded();
- Reset();
- for (loaded.Start(); loaded.More(); loaded.Next()) {
- Handle(Standard_Transient) ent = loaded.Value();
- if (IsInPart(ent)) continue;
- IFGraph_AllConnected connect(Model(),ent);
- AddPart();
- GetFromIter (connect);
- }
-}
+++ /dev/null
-// Created on: 1992-09-23
-// 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 _IFGraph_ConnectedComponants_HeaderFile
-#define _IFGraph_ConnectedComponants_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-
-#include <IFGraph_SubPartsIterator.hxx>
-class Interface_Graph;
-
-//! determines Connected Components in a Graph.
-//! They define disjoined sets of Entities.
-class IFGraph_ConnectedComponants : public IFGraph_SubPartsIterator
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
- //! creates with a Graph, and will analyse :
- //! whole True : all the contents of the Model
- //! whole False : sub-parts which will be given later
- Standard_EXPORT IFGraph_ConnectedComponants(const Interface_Graph& agraph, const Standard_Boolean whole);
-
- //! does the computation
- Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
-
-};
-
-#endif // _IFGraph_ConnectedComponants_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 <IFGraph_Cumulate.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Transient.hxx>
-
-// Calcul de cumul
-// Tres simple, on note les entites demandees, et a la fin
-// on a le cumul lui-meme, et comme infos derivees, les doubles et les oublis
-// Chaque recouvrement correspond a une augmentation de UN du status
-// Les status demarrent a 2, ainsi a l ajout d une entite, on distingue bien
-// entre les entites nouvelles, liees a cet appel (statut temporaire 1) et les
-// autres (statut superieur ou egal a 2)
-IFGraph_Cumulate::IFGraph_Cumulate (const Interface_Graph& agraph)
- : thegraph (agraph) { }
-
- void IFGraph_Cumulate::GetFromEntity
- (const Handle(Standard_Transient)& ent)
-{
- IFGraph_AllShared iter(thegraph.Model(),ent);
- GetFromIter (iter);
-}
-
- void IFGraph_Cumulate::ResetData ()
- { Reset(); thegraph.Reset(); }
-
- void IFGraph_Cumulate::GetFromIter (const Interface_EntityIterator& iter)
-{
- thegraph.GetFromIter(iter,1,1,Standard_True);
- thegraph.ChangeStatus (1,2); // une fois le calcul fait
-}
-
- void IFGraph_Cumulate::Evaluate ()
-{
- Reset(); GetFromGraph(thegraph); // evaluation deja faite dans le graphe
-}
-
- Interface_EntityIterator IFGraph_Cumulate::Overlapped () const
-{
- Interface_EntityIterator iter;
- Standard_Integer nb = thegraph.Size();
- for (Standard_Integer i = 1; i <= nb; i ++) {
- if (thegraph.IsPresent(i) && thegraph.Status(i) > 2)
- iter.GetOneItem(thegraph.Entity(i));
- }
- return iter;
-}
-
- Interface_EntityIterator IFGraph_Cumulate::Forgotten () const
-{
- Interface_EntityIterator iter;
- Standard_Integer nb = thegraph.Size();
- for (Standard_Integer i = 1; i <= nb; i ++) {
- if (!thegraph.IsPresent(i))
- iter.GetOneItem(thegraph.Model()->Value(i));
- }
- return iter;
-}
-
- Interface_EntityIterator IFGraph_Cumulate::PerCount
- (const Standard_Integer count) const
-{
- Interface_EntityIterator iter;
- Standard_Integer nb = thegraph.Size();
- for (Standard_Integer i = 1; i <= nb; i ++) {
- if (thegraph.IsPresent(i) && thegraph.Status(i) == (count + 1))
- iter.GetOneItem(thegraph.Model()->Value(i));
- }
- return iter;
-}
-
-
- Standard_Integer IFGraph_Cumulate::NbTimes
- (const Handle(Standard_Transient)& ent) const
-{
- Standard_Integer num = thegraph.EntityNumber(ent);
- if (num == 0) return 0;
- Standard_Integer stat = thegraph.Status(num);
- return stat-1;
-}
-
- Standard_Integer IFGraph_Cumulate::HighestNbTimes () const
-{
- Standard_Integer max = 0;
- Standard_Integer nb = thegraph.Size();
- for (Standard_Integer i = 1; i <= nb; i ++) {
- if (!thegraph.IsPresent(i)) continue;
- Standard_Integer count = thegraph.Status(i) - 1;
- if (count > max) max = count;
- }
- return max;
-}
+++ /dev/null
-// Created on: 1992-09-23
-// 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 _IFGraph_Cumulate_HeaderFile
-#define _IFGraph_Cumulate_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Interface_Graph.hxx>
-#include <Interface_GraphContent.hxx>
-#include <Standard_Integer.hxx>
-class Standard_Transient;
-class Interface_EntityIterator;
-
-
-//! this class evaluates effect of cumulated sub-parts :
-//! overlapping, forgotten entities
-//! Results are kept in a Graph, several question can be set
-//! Basic Iteration gives entities which are part of Cumulation
-class IFGraph_Cumulate : public Interface_GraphContent
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- //! creates empty Cumulate, ready to work
- Standard_EXPORT IFGraph_Cumulate(const Interface_Graph& agraph);
-
- //! adds an entity and its shared ones to the list
- Standard_EXPORT void GetFromEntity (const Handle(Standard_Transient)& ent);
-
- //! adds a list of entities (as an iterator) as such, that is,
- //! without their shared entities (use AllShared to have them)
- Standard_EXPORT void GetFromIter (const Interface_EntityIterator& iter);
-
- //! Allows to restart on a new data set
- Standard_EXPORT void ResetData();
-
- //! Evaluates the result of cumulation
- Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
-
- //! returns entities which are taken several times
- Standard_EXPORT Interface_EntityIterator Overlapped() const;
-
- //! returns entities which are not taken
- Standard_EXPORT Interface_EntityIterator Forgotten() const;
-
- //! Returns entities taken a given count of times
- //! (0 : same as Forgotten, 1 : same as no Overlap : default)
- Standard_EXPORT Interface_EntityIterator PerCount (const Standard_Integer count = 1) const;
-
- //! returns number of times an Entity has been counted
- //! (0 means forgotten, more than 1 means overlap, 1 is normal)
- Standard_EXPORT Standard_Integer NbTimes (const Handle(Standard_Transient)& ent) const;
-
- //! Returns the highest number of times recorded for every Entity
- //! (0 means empty, 1 means no overlap)
- Standard_EXPORT Standard_Integer HighestNbTimes() const;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
- Interface_Graph thegraph;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFGraph_Cumulate_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_Cycles.hxx>
-#include <IFGraph_StrongComponants.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_GraphContent.hxx>
-
-// Cycles utilise les services de StrongComponants :
-// Il retient les Strong Componants qui ne sont pas Single
-IFGraph_Cycles::IFGraph_Cycles
- (const Interface_Graph& agraph, const Standard_Boolean whole)
- : IFGraph_SubPartsIterator (agraph,whole) { }
-
- IFGraph_Cycles::IFGraph_Cycles (IFGraph_StrongComponants& subparts)
- : IFGraph_SubPartsIterator (subparts) { }
-
-
- void IFGraph_Cycles::Evaluate ()
-{
- IFGraph_StrongComponants complist(Model(),Standard_False);
- complist.GetFromIter(Loaded());
- for (complist.Start(); complist.More(); complist.Next()) {
- if (complist.IsSingle()) continue;
- AddPart();
- GetFromIter(complist.Entities());
- }
-}
+++ /dev/null
-// Created on: 1992-09-23
-// 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 _IFGraph_Cycles_HeaderFile
-#define _IFGraph_Cycles_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <IFGraph_SubPartsIterator.hxx>
-#include <Standard_Boolean.hxx>
-class Interface_Graph;
-class IFGraph_StrongComponants;
-
-
-//! determines strong components in a graph which are Cycles
-class IFGraph_Cycles : public IFGraph_SubPartsIterator
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- //! creates with a Graph, and will analyse :
- //! whole True : all the contents of the Model
- //! whole False : sub-parts which will be given later
- Standard_EXPORT IFGraph_Cycles(const Interface_Graph& agraph, const Standard_Boolean whole);
-
- //! creates from a StrongComponants which was already computed
- Standard_EXPORT IFGraph_Cycles(IFGraph_StrongComponants& subparts);
-
- //! does the computation. Cycles are StrongComponants which are
- //! not Single
- Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFGraph_Cycles_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_ExternalSources.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Standard_Transient.hxx>
-
-// ExternalSources exploite les resultats stockes dans le Graphe sur Sharings
-// Soit les "Sharings" des entites notees par GetFromEntity et GetFromIter
-// Celles des "Sharings" qui n etaient pas deja notees sont ExternalSources
-// Les status :
-// - Les entites de depart sont au Status 0
-// - Les entites Sharing NOUVELLES (ExternalSources) sont au Status 1
-IFGraph_ExternalSources::IFGraph_ExternalSources
- (const Interface_Graph& agraph)
- : thegraph (agraph) { }
-
-
- void IFGraph_ExternalSources::GetFromEntity
- (const Handle(Standard_Transient)& ent)
- { thegraph.GetFromEntity(ent,Standard_True); }
-
- void IFGraph_ExternalSources::GetFromIter
- (const Interface_EntityIterator& iter)
- { thegraph.GetFromIter(iter,0); }
-
- void IFGraph_ExternalSources::ResetData ()
- { Reset(); thegraph.Reset(); }
-
-
- void IFGraph_ExternalSources::Evaluate ()
-{
- Reset();
- thegraph.RemoveStatus(1);
- Standard_Integer nb = thegraph.Size();
- for (Standard_Integer i = 1; i <= nb; i ++) {
- if (thegraph.IsPresent(i) && thegraph.Status(i) == 0)
- thegraph.GetFromIter ( thegraph.Sharings(thegraph.Entity(i)), 1 );
- }
- GetFromGraph(thegraph,1);
-}
-
- Standard_Boolean IFGraph_ExternalSources::IsEmpty ()
-{
- Evaluate();
- Standard_Integer nb = thegraph.Size();
- for (Standard_Integer i = 1; i <= nb; i ++) {
- if (thegraph.IsPresent(i) || thegraph.Status(i) == 1)
- return Standard_False;
- }
- return Standard_True;
-}
+++ /dev/null
-// Created on: 1992-09-23
-// 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 _IFGraph_ExternalSources_HeaderFile
-#define _IFGraph_ExternalSources_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Interface_Graph.hxx>
-#include <Interface_GraphContent.hxx>
-#include <Standard_Boolean.hxx>
-class Standard_Transient;
-class Interface_EntityIterator;
-
-
-//! this class gives entities which are Source of entities of
-//! a sub-part, but are not contained by this sub-part
-class IFGraph_ExternalSources : public Interface_GraphContent
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- //! creates empty ExternalSources, ready to work
- Standard_EXPORT IFGraph_ExternalSources(const Interface_Graph& agraph);
-
- //! adds an entity and its shared ones to the list
- Standard_EXPORT void GetFromEntity (const Handle(Standard_Transient)& ent);
-
- //! adds a list of entities (as an iterator) with shared ones
- Standard_EXPORT void GetFromIter (const Interface_EntityIterator& iter);
-
- //! Allows to restart on a new data set
- Standard_EXPORT void ResetData();
-
- //! Evaluates external sources of a set of entities
- Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
-
- //! Returns True if no External Source are found
- //! It means that we have a "root" set
- //! (performs an Evaluation as necessary)
- Standard_EXPORT Standard_Boolean IsEmpty();
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
- Interface_Graph thegraph;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFGraph_ExternalSources_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_ExternalSources.hxx>
-#include <IFGraph_SCRoots.hxx>
-#include <IFGraph_StrongComponants.hxx>
-#include <Interface_Graph.hxx>
-#include <Standard_Transient.hxx>
-
-//#include <Interface_GraphContent.hxx>
-IFGraph_SCRoots::IFGraph_SCRoots
- (const Interface_Graph& agraph, const Standard_Boolean whole)
- : IFGraph_StrongComponants (agraph,whole) { }
-
- IFGraph_SCRoots::IFGraph_SCRoots (IFGraph_StrongComponants& subparts)
- : IFGraph_StrongComponants (subparts) { }
-
-// StrongComponants racines d un ensemble donne
-// On ne tient pas compte du reste eventuel (c est un autre probleme)
-// On part du fait que StrongComponants donne les Composants dans l ordre de
-// dependance, le premier ne dependant de rien (les autres, on ne sait pas ...)
-
- void IFGraph_SCRoots::Evaluate ()
-{
- IFGraph_StrongComponants complist (Model(),Standard_False);
- complist.GetFromIter(Loaded());
-// Interface_Graph G(Model());
- Interface_Graph G(thegraph);
-#ifdef OCCT_DEBUG
- std::cout<<" SCRoots:"<<std::endl;
-#endif
- G.ResetStatus();
- for (complist.Start(); complist.More(); complist.Next()) {
- Handle(Standard_Transient) ent = complist.FirstEntity();
- Standard_Integer num = G.EntityNumber(ent);
-#ifdef OCCT_DEBUG
- std::cout<<" Iteration,num="<<num<<(G.IsPresent(num) ? " Pris" : " A prendre")<<std::endl;
-#endif
- if (!G.IsPresent(num)) { // enregistrer pour suivants
- G.GetFromEntity(ent,Standard_True);
- Interface_EntityIterator list = complist.Entities();
- AddPart();
- GetFromIter(list);
- }
- }
-}
-
-/* ce qui suit, c etait autre chose : les SC qui n ont pas d ExternalSource
- Interface_EntityIterator list = complist.Entities();
- IFGraph_ExternalSources eval (Model());
- eval.GetFromIter(list);
- if (eval.IsEmpty()) {
- AddPart();
- GetFromIter(list);
- }
- }
-}
-*/
+++ /dev/null
-// Created on: 1992-09-23
-// 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 _IFGraph_SCRoots_HeaderFile
-#define _IFGraph_SCRoots_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-
-#include <IFGraph_StrongComponants.hxx>
-class Interface_Graph;
-
-
-//! determines strong components in a graph which are Roots
-class IFGraph_SCRoots : public IFGraph_StrongComponants
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- //! creates with a Graph, and will analyse :
- //! whole True : all the contents of the Model
- //! whole False : sub-parts which will be given later
- Standard_EXPORT IFGraph_SCRoots(const Interface_Graph& agraph, const Standard_Boolean whole);
-
- //! creates from a StrongComponants which was already computed
- Standard_EXPORT IFGraph_SCRoots(IFGraph_StrongComponants& subparts);
-
- //! does the computation
- Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFGraph_SCRoots_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_StrongComponants.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_GraphContent.hxx>
-
-//#include <IFGraph_SortedStrongs.hxx>
-IFGraph_StrongComponants::IFGraph_StrongComponants
- (const Interface_Graph& agraph, const Standard_Boolean whole)
- : IFGraph_SubPartsIterator (agraph, whole) { }
-
- void IFGraph_StrongComponants::Evaluate ()
-{
- Interface_GraphContent iter = Loaded();
- Interface_Graph G(thegraph); G.GetFromIter(iter,0);
- Standard_Integer nb = G.Size();
- for (Standard_Integer i = 1; i <= nb; i ++) {
- if (!G.IsPresent(i)) continue;
- AddPart();
- GetFromEntity (G.Entity(i),Standard_False);
- }
-}
+++ /dev/null
-// Created on: 1992-09-23
-// 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 _IFGraph_StrongComponants_HeaderFile
-#define _IFGraph_StrongComponants_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <IFGraph_SubPartsIterator.hxx>
-#include <Standard_Boolean.hxx>
-class Interface_Graph;
-
-
-//! determines strong components of a graph, that is
-//! isolated entities (single components) or loops
-class IFGraph_StrongComponants : public IFGraph_SubPartsIterator
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- //! creates with a Graph, and will analyse :
- //! whole True : all the contents of the Model
- //! whole False : sub-parts which will be given later
- Standard_EXPORT IFGraph_StrongComponants(const Interface_Graph& agraph, const Standard_Boolean whole);
-
- //! does the computation
- Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFGraph_StrongComponants_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 <Interface_Graph.hxx>
-#include <Interface_GraphContent.hxx>
-#include <Interface_InterfaceError.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_NoSuchObject.hxx>
-#include <Standard_OutOfRange.hxx>
-#include <Standard_Transient.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-
-// SubPartsIterator permet de regrouper les entites en plusieurs sous-parties
-// A chaque sous-partie est attache un Status : la 1re a 1, la 2e a 2, etc...
-// (consequence, les sous-parties sont necessairement disjointes)
-IFGraph_SubPartsIterator::IFGraph_SubPartsIterator
- (const Interface_Graph& agraph, const Standard_Boolean whole)
- : thegraph (agraph)
-{
- if (whole) thegraph.GetFromModel();
- theparts = new TColStd_HSequenceOfInteger();
- thefirsts = new TColStd_HSequenceOfInteger();
- thepart = 0;
- thecurr = 0;
-}
-
- IFGraph_SubPartsIterator::IFGraph_SubPartsIterator
- (IFGraph_SubPartsIterator& other)
- : thegraph (other.Graph())
-{
- Standard_Integer nb = thegraph.Size();
- theparts = new TColStd_HSequenceOfInteger();
- thepart = 0;
- for (other.Start(); other.More(); other.Next()) {
- thepart ++;
- Standard_Integer nbent = 0;
- GetFromIter (other.Entities());
- for (Standard_Integer i = 1; i <= nb; i ++) {
- if (thegraph.Status(i) == thepart) nbent ++;
- }
- theparts->Append(nbent); // compte vide
- }
- thepart = 0;
- thecurr = 1;
-}
-
- void IFGraph_SubPartsIterator::GetParts
- (IFGraph_SubPartsIterator& other)
-{
- if (Model() != other.Model()) throw Interface_InterfaceError("SubPartsIterator : GetParts");
-// On AJOUTE les Parts de other, sans perdre les siennes propres
-// (meme principe que le constructeur ci-dessus)
- Standard_Integer nb = thegraph.Size();
- thepart = theparts->Length();
- for (other.Start(); other.More(); other.Next()) {
- thepart ++;
- Standard_Integer nbent = 0;
- GetFromIter (other.Entities());
- for (Standard_Integer i = 1; i <= nb; i ++) {
- if (thegraph.Status(i) == thepart) nbent ++;
- }
- theparts->Append(nbent); // compte vide
- }
-}
-
- const Interface_Graph& IFGraph_SubPartsIterator::Graph () const
- { return thegraph; }
-
-// .... Gestion Interne (remplissage, etc...) .... //
-
- Handle(Interface_InterfaceModel) IFGraph_SubPartsIterator::Model() const
- { return thegraph.Model(); }
-
- void IFGraph_SubPartsIterator::AddPart ()
-{
- theparts->Append( Standard_Integer(0) );
- thepart = theparts->Length();
-}
-
- Standard_Integer IFGraph_SubPartsIterator::NbParts () const
- { return theparts->Length(); }
-
- Standard_Integer IFGraph_SubPartsIterator::PartNum () const
- { return thepart; }
-
- void IFGraph_SubPartsIterator::SetLoad ()
- { thepart = 0; }
-
- void IFGraph_SubPartsIterator::SetPartNum (const Standard_Integer num)
-{
- if (num <= 0 || num > theparts->Length()) throw Standard_OutOfRange("IFGraph_SubPartsIterator : SetPartNum");
- thepart = num;
-}
-
- void IFGraph_SubPartsIterator::GetFromEntity
- (const Handle(Standard_Transient)& ent, const Standard_Boolean shared)
-{
- thegraph.GetFromEntity(ent,shared, thepart,thepart,Standard_False);
-}
-
- void IFGraph_SubPartsIterator::GetFromIter (const Interface_EntityIterator& iter)
-{
- thegraph.GetFromIter(iter, thepart,thepart, Standard_False);
-}
-
- void IFGraph_SubPartsIterator::Reset ()
-{
- thegraph.Reset();
- theparts->Clear();
- thepart = 0;
- thecurr = 0;
-}
-
-
-// .... Resultat (Evaluation, Iterations) .... //
-
- void IFGraph_SubPartsIterator::Evaluate ()
-{ } // par defaut, ne fait rien; redefinie par les sous-classes
-
- Interface_GraphContent IFGraph_SubPartsIterator::Loaded () const
-{
- Interface_EntityIterator iter;
-// Standard_Integer nb = thegraph.Size();
- return Interface_GraphContent(thegraph,0);
-}
-
- Interface_Graph IFGraph_SubPartsIterator::LoadedGraph () const
-{
- Interface_Graph G(Model());
- Standard_Integer nb = thegraph.Size();
- for (Standard_Integer i = 1; i <= nb; i ++) {
- if (thegraph.IsPresent(i) && thegraph.Status(i) == 0)
- G.GetFromEntity(thegraph.Entity(i),Standard_False);
- }
- return G;
-}
-
-
- Standard_Boolean IFGraph_SubPartsIterator::IsLoaded
- (const Handle(Standard_Transient)& ent) const
-{ return thegraph.IsPresent(thegraph.EntityNumber(ent)); }
-
- Standard_Boolean IFGraph_SubPartsIterator::IsInPart
- (const Handle(Standard_Transient)& ent) const
-{
- Standard_Integer num = thegraph.EntityNumber(ent);
- if (!thegraph.IsPresent(num)) return Standard_False;
- return (thegraph.Status(num) != 0);
-}
-
- Standard_Integer IFGraph_SubPartsIterator::EntityPartNum
- (const Handle(Standard_Transient)& ent) const
-{
- Standard_Integer num = thegraph.EntityNumber(ent);
- if (!thegraph.IsPresent(num)) return 0;
- return thegraph.Status(num);
-}
-
-
- void IFGraph_SubPartsIterator::Start ()
-{
- Evaluate();
-// On evalue les tailles des contenus des Parts
- Standard_Integer nb = thegraph.Size();
- Standard_Integer nbp = theparts->Length();
- if (thepart > nbp) thepart = nbp;
- if (nbp == 0) { thecurr = 1; return; } // L Iteration s arrete de suite
-
-// - On fait les comptes (via tableaux pour performances)
- TColStd_Array1OfInteger partcounts (1,nbp); partcounts.Init(0);
- TColStd_Array1OfInteger partfirsts (1,nbp); partfirsts.Init(0);
- for (Standard_Integer i = 1; i <= nb; i ++) {
- if (!thegraph.IsPresent(i)) continue;
- Standard_Integer nump = thegraph.Status(i);
- if (nump < 1 || nump > nbp) continue;
- Standard_Integer nbent = partcounts.Value(nump);
- partcounts.SetValue(nump,nbent+1);
- if (nbent == 0) partfirsts.SetValue(nump,i);
- }
-// - On les met en forme (c-a-d dans les sequences)
- theparts->Clear(); thefirsts->Clear();
- Standard_Integer lastp = 0;
- for (Standard_Integer np = 1; np <= nbp; np ++) {
- Standard_Integer nbent = partcounts.Value(np);
- if (np != 0) lastp = np;
- theparts->Append (nbent);
- thefirsts->Append (partfirsts.Value(np));
- }
- if (lastp < nbp) theparts->Remove(lastp+1,nbp);
-// Enfin, on se prepare a iterer
- thecurr = 1;
-}
-
- Standard_Boolean IFGraph_SubPartsIterator::More ()
-{
- if (thecurr == 0) Start();
- return (thecurr <= theparts->Length());
-}
-
- void IFGraph_SubPartsIterator::Next ()
-{
- thecurr ++; if (thecurr > theparts->Length()) return;
- if (theparts->Value(thecurr) == 0) Next(); // sauter parties vides
-}
-
- Standard_Boolean IFGraph_SubPartsIterator::IsSingle () const
-{
- if (thecurr < 1 || thecurr > theparts->Length()) throw Standard_NoSuchObject("IFGraph_SubPartsIterator : IsSingle");
- return (theparts->Value(thecurr) == 1);
-}
-
- Handle(Standard_Transient) IFGraph_SubPartsIterator::FirstEntity
- () const
-{
- if (thecurr < 1 || thecurr > theparts->Length()) throw Standard_NoSuchObject("IFGraph_SubPartsIterator : FirstEntity");
- Standard_Integer nument = thefirsts->Value(thecurr);
- if (nument == 0) throw Standard_NoSuchObject("IFGraph_SubPartsIterator : FirstEntity (current part is empty)");
- return thegraph.Entity(nument);
-}
-
- Interface_EntityIterator IFGraph_SubPartsIterator::Entities () const
-{
- if (thecurr < 1 || thecurr > theparts->Length()) throw Standard_NoSuchObject("IFGraph_SubPartsIterator : Entities");
- Interface_EntityIterator iter;
- Standard_Integer nb = thegraph.Size();
- Standard_Integer nument = thefirsts->Value(thecurr);
- if (nument == 0) return iter;
- if (theparts->Value(thecurr) == 1) nb = nument; // evident : 1 seule Entite
- for (Standard_Integer i = nument; i <= nb; i ++) {
- if (thegraph.Status(i) == thecurr && thegraph.IsPresent(i))
- iter.GetOneItem(thegraph.Entity(i));
- }
- return iter;
-}
-
-//=======================================================================
-//function : ~IFGraph_SubPartsIterator
-//purpose :
-//=======================================================================
-
-IFGraph_SubPartsIterator::~IFGraph_SubPartsIterator()
-{}
+++ /dev/null
-// Created on: 1992-09-23
-// 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 _IFGraph_SubPartsIterator_HeaderFile
-#define _IFGraph_SubPartsIterator_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Interface_Graph.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Boolean.hxx>
-class Interface_InterfaceModel;
-class Standard_Transient;
-class Interface_EntityIterator;
-class Interface_GraphContent;
-
-
-//! defines general form for graph classes of which result is
-//! not a single iteration on Entities, but a nested one :
-//! External iteration works on sub-parts, identified by each
-//! class (according to its algorithm)
-//! Internal Iteration concerns Entities of a sub-part
-//! Sub-Parts are assumed to be disjoined; if they are not,
-//! the first one has priority
-//!
-//! A SubPartsIterator can work in two steps : first, load
-//! entities which have to be processed
-//! then, analyse to set those entities into sub-parts
-class IFGraph_SubPartsIterator
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- //! Creates with a Graph, whole or parts of it
- //! whole True : works on the entire Model
- //! whole False : empty, ready to be filled
- //! SubPartIterator is set to load entities
- Standard_EXPORT IFGraph_SubPartsIterator(const Interface_Graph& agraph, const Standard_Boolean whole);
-
- //! Creates a SubPartIterator from another one and gets its Data
- //! Note that only non-empty sub-parts are taken into account
- //! PartNum is set to the last one
- Standard_EXPORT IFGraph_SubPartsIterator(IFGraph_SubPartsIterator& other);
-
- //! Gets Parts from another SubPartsIterator (in addition to the
- //! ones already recorded)
- //! Error if both SubPartsIterators are not based on the same Model
- Standard_EXPORT void GetParts (IFGraph_SubPartsIterator& other);
-
- //! Returns the Model with which this Iterator was created
- Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
-
- //! Adds an empty part and sets it to receive entities
- Standard_EXPORT void AddPart();
-
- //! Returns count of registered parts
- Standard_EXPORT Standard_Integer NbParts() const;
-
- //! Returns numero of part which currently receives entities
- //! (0 at load time)
- Standard_EXPORT Standard_Integer PartNum() const;
-
- //! Sets SubPartIterator to get Entities (by GetFromEntity &
- //! GetFromIter) into load status, to be analysed later
- Standard_EXPORT void SetLoad();
-
- //! Sets numero of receiving part to a new value
- //! Error if not in range (1-NbParts)
- Standard_EXPORT void SetPartNum (const Standard_Integer num);
-
- //! Adds an Entity : into load status if in Load mode, to the
- //! current part if there is one. If shared is True, adds
- //! also its shared ones (shared at all levels)
- Standard_EXPORT void GetFromEntity (const Handle(Standard_Transient)& ent, const Standard_Boolean shared);
-
- //! Adds a list of Entities (into Load mode or to a Part),
- //! given as an Iterator
- Standard_EXPORT void GetFromIter (const Interface_EntityIterator& iter);
-
- //! Erases data (parts, entities) : "me" becomes empty and in
- //! load status
- Standard_EXPORT void Reset();
-
- //! Called by Clear, this method allows evaluation just before
- //! iteration; its default is doing nothing, it is designed to
- //! be redefined
- Standard_EXPORT virtual void Evaluate();
-
- //! Returns entities which where loaded (not set into a sub-part)
- Standard_EXPORT Interface_GraphContent Loaded() const;
-
- //! Same as above, but under the form of a Graph
- Standard_EXPORT Interface_Graph LoadedGraph() const;
-
- //! Returns True if an Entity is loaded (either set into a
- //! sub-part or not)
- Standard_EXPORT Standard_Boolean IsLoaded (const Handle(Standard_Transient)& ent) const;
-
- //! Returns True if an Entity is Present in a sub-part
- Standard_EXPORT Standard_Boolean IsInPart (const Handle(Standard_Transient)& ent) const;
-
- //! Returns number of the sub-part in which an Entity has been set
- //! if it is not in a sub-part (or not loaded at all), Returns 0
- Standard_EXPORT Standard_Integer EntityPartNum (const Handle(Standard_Transient)& ent) const;
-
- //! Sets iteration to its beginning; calls Evaluate
- Standard_EXPORT void Start();
-
- //! Returns True if there are more sub-parts to iterate on
- //! Note : an empty sub-part is not taken in account by Iteration
- Standard_EXPORT Standard_Boolean More();
-
- //! Sets iteration to the next sub-part
- //! if there is not, IsSingle-Entities will raises an exception
- Standard_EXPORT void Next();
-
- //! Returns True if current sub-part is single (has only one Entity)
- //! Error if there is no sub-part to iterate now
- Standard_EXPORT Standard_Boolean IsSingle() const;
-
- //! Returns the first entity of current sub-part, that is for a
- //! Single one, the only one it contains
- //! Error : same as above (end of iteration)
- Standard_EXPORT Handle(Standard_Transient) FirstEntity() const;
-
- //! Returns current sub-part, not as a "Value", but as an Iterator
- //! on Entities it contains
- //! Error : same as above (end of iteration)
- Standard_EXPORT Interface_EntityIterator Entities() const;
-
- Standard_EXPORT virtual ~IFGraph_SubPartsIterator();
-
-protected:
-
-
-
- Interface_Graph thegraph;
-
-
-private:
-
-
- //! Returns the Graph used by <me>. Used to create another
- //! SubPartsIterator from <me>
- Standard_EXPORT const Interface_Graph& Graph() const;
-
-
- Handle(TColStd_HSequenceOfInteger) theparts;
- Handle(TColStd_HSequenceOfInteger) thefirsts;
- Standard_Integer thepart;
- Standard_Integer thecurr;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFGraph_SubPartsIterator_HeaderFile
+++ /dev/null
-IFSelect.cxx
-IFSelect.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_FileModifier.gxx
-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_SelectAnyType.hxx
-IFSelect_SelectBase.cxx
-IFSelect_SelectBase.hxx
-IFSelect_SelectCombine.cxx
-IFSelect_SelectCombine.hxx
-IFSelect_SelectControl.cxx
-IFSelect_SelectControl.hxx
-IFSelect_SelectDeduct.cxx
-IFSelect_SelectDeduct.hxx
-IFSelect_SelectDiff.cxx
-IFSelect_SelectDiff.hxx
-IFSelect_SelectEntityNumber.cxx
-IFSelect_SelectEntityNumber.hxx
-IFSelect_SelectErrorEntities.cxx
-IFSelect_SelectErrorEntities.hxx
-IFSelect_SelectExplore.cxx
-IFSelect_SelectExplore.hxx
-IFSelect_SelectExtract.cxx
-IFSelect_SelectExtract.hxx
-IFSelect_SelectFlag.cxx
-IFSelect_SelectFlag.hxx
-IFSelect_SelectIncorrectEntities.cxx
-IFSelect_SelectIncorrectEntities.hxx
-IFSelect_SelectInList.cxx
-IFSelect_SelectInList.hxx
-IFSelect_SelectIntersection.cxx
-IFSelect_SelectIntersection.hxx
-IFSelect_Selection.cxx
-IFSelect_Selection.hxx
-IFSelect_SelectionIterator.cxx
-IFSelect_SelectionIterator.hxx
-IFSelect_SelectModelEntities.cxx
-IFSelect_SelectModelEntities.hxx
-IFSelect_SelectModelRoots.cxx
-IFSelect_SelectModelRoots.hxx
-IFSelect_SelectPointed.cxx
-IFSelect_SelectPointed.hxx
-IFSelect_SelectRange.cxx
-IFSelect_SelectRange.hxx
-IFSelect_SelectRootComps.cxx
-IFSelect_SelectRootComps.hxx
-IFSelect_SelectRoots.cxx
-IFSelect_SelectRoots.hxx
-IFSelect_SelectSent.cxx
-IFSelect_SelectSent.hxx
-IFSelect_SelectShared.cxx
-IFSelect_SelectShared.hxx
-IFSelect_SelectSharing.cxx
-IFSelect_SelectSharing.hxx
-IFSelect_SelectSignature.cxx
-IFSelect_SelectSignature.hxx
-IFSelect_SelectSignedShared.cxx
-IFSelect_SelectSignedShared.hxx
-IFSelect_SelectSignedSharing.cxx
-IFSelect_SelectSignedSharing.hxx
-IFSelect_SelectSuite.cxx
-IFSelect_SelectSuite.hxx
-IFSelect_SelectType.cxx
-IFSelect_SelectType.hxx
-IFSelect_SelectUnion.cxx
-IFSelect_SelectUnion.hxx
-IFSelect_SelectUnknownEntities.cxx
-IFSelect_SelectUnknownEntities.hxx
-IFSelect_SequenceOfAppliedModifiers.hxx
-IFSelect_SequenceOfGeneralModifier.hxx
-IFSelect_SequenceOfInterfaceModel.hxx
-IFSelect_SessionDumper.cxx
-IFSelect_SessionDumper.hxx
-IFSelect_SessionFile.cxx
-IFSelect_SessionFile.hxx
-IFSelect_ShareOut.cxx
-IFSelect_ShareOut.hxx
-IFSelect_ShareOutResult.cxx
-IFSelect_ShareOutResult.hxx
-IFSelect_SignAncestor.cxx
-IFSelect_SignAncestor.hxx
-IFSelect_Signature.cxx
-IFSelect_Signature.hxx
-IFSelect_SignatureList.cxx
-IFSelect_SignatureList.hxx
-IFSelect_SignCategory.cxx
-IFSelect_SignCategory.hxx
-IFSelect_SignCounter.cxx
-IFSelect_SignCounter.hxx
-IFSelect_SignMultiple.cxx
-IFSelect_SignMultiple.hxx
-IFSelect_SignType.cxx
-IFSelect_SignType.hxx
-IFSelect_SignValidity.cxx
-IFSelect_SignValidity.hxx
-IFSelect_Transformer.cxx
-IFSelect_Transformer.hxx
-IFSelect_TransformStandard.cxx
-IFSelect_TransformStandard.hxx
-IFSelect_TSeqOfDispatch.hxx
-IFSelect_TSeqOfSelection.hxx
-IFSelect_WorkLibrary.cxx
-IFSelect_WorkLibrary.hxx
-IFSelect_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 <IFSelect.hxx>
-#include <IFSelect_SessionFile.hxx>
-#include <IFSelect_WorkSession.hxx>
-
-// Methodes de confort, evitant de devoir connaitre SessionFile, qui est un
-// Tool non destine a l export (en particulier, pas un Handle)
-Standard_Boolean IFSelect::SaveSession
- (const Handle(IFSelect_WorkSession)& WS, const Standard_CString file)
-{
- IFSelect_SessionFile sesfile(WS,file);
- return sesfile.IsDone();
-}
-
- Standard_Boolean IFSelect::RestoreSession
- (const Handle(IFSelect_WorkSession)& WS, const Standard_CString file)
-{
- IFSelect_SessionFile sesfile(WS);
- return (sesfile.Read(file) == 0);
-}
+++ /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_HeaderFile
-#define _IFSelect_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Standard_Boolean.hxx>
-class IFSelect_WorkSession;
-
-
-//! Gives tools to manage Selecting a group of Entities
-//! processed by an Interface, for instance to divide up an
-//! original Model (from a File) to several smaller ones
-//! They use description of an Interface Model as a graph
-//!
-//! Remark that this corresponds to the description of a
-//! "scenario" of sharing out a File. Parts of this Scenario
-//! are intended to be permanently stored. IFSelect provides
-//! the Transient, active counterparts (to run the Scenario).
-//! But a permanent one (either as Persistent Objects or as
-//! interpretable Text) must be provided elsewhere.
-class IFSelect
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- //! Saves the state of a WorkSession from IFSelect, by using a
- //! SessionFile from IFSelect. Returns True if Done, False in
- //! case of Error on Writing. <file> gives the name of the File
- //! to be produced (this avoids to export the class SessionFile).
- Standard_EXPORT static Standard_Boolean SaveSession (const Handle(IFSelect_WorkSession)& WS, const Standard_CString file);
-
- //! Restore the state of a WorkSession from IFSelect, by using a
- //! SessionFile from IFSelect. Returns True if Done, False in
- //! case of Error on Writing. <file> gives the name of the File
- //! to be used (this avoids to export the class SessionFile).
- Standard_EXPORT static Standard_Boolean RestoreSession (const Handle(IFSelect_WorkSession)& WS, const Standard_CString file);
-
-};
-
-#endif // _IFSelect_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,Standard_Transient)
-
-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 <IFSelect_SequenceOfGeneralModifier.hxx>
-#include <Interface_IntList.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Transient.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-class IFSelect_GeneralModifier;
-
-class IFSelect_AppliedModifiers;
-DEFINE_STANDARD_HANDLE(IFSelect_AppliedModifiers, Standard_Transient)
-
-//! 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 (optional) : 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 Standard_Transient
-{
-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,Standard_Transient)
-
-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_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>
-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_CheckCounter.hxx>
-#include <Interface_CheckIterator.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <MoniTool_SignText.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_CheckCounter,IFSelect_SignatureList)
-
-//=======================================================================
-//function : IFSelect_CheckCounter
-//purpose :
-//=======================================================================
-IFSelect_CheckCounter::IFSelect_CheckCounter(const Standard_Boolean withlist)
- : IFSelect_SignatureList (withlist)
-{
- SetName("Check");
-}
-
-
-//=======================================================================
-//function : SetSignature
-//purpose :
-//=======================================================================
-
-void IFSelect_CheckCounter::SetSignature(const Handle(MoniTool_SignText)& sign)
-{
- thesign = sign;
-}
-
-
-//=======================================================================
-//function : Signature
-//purpose :
-//=======================================================================
-
-Handle(MoniTool_SignText) IFSelect_CheckCounter::Signature () const
-{
- return thesign;
-}
-
-
-//=======================================================================
-//function : Analyse
-//purpose :
-//=======================================================================
-
-void IFSelect_CheckCounter::Analyse(const Interface_CheckIterator& list,
- const Handle(Interface_InterfaceModel)& model,
- const Standard_Boolean original,
- const Standard_Boolean failsonly)
-{
- Standard_Integer i,nb,num, nbe = (model.IsNull() ? 0 : model->NbEntities());
- char mess[300];
- sprintf (mess,"Check %s",list.Name());
- SetName (mess);
- for (list.Start(); list.More(); list.Next()) {
- num = list.Number();
- Handle(Standard_Transient) ent;
- const Handle(Interface_Check) check = list.Value();
- ent = check->Entity();
- if (ent.IsNull() && num > 0 && num <= nbe) ent = model->Value(num);
- nb = check->NbFails();
- Standard_CString tystr = NULL;
- if (!ent.IsNull()) {
- if (!thesign.IsNull()) tystr = thesign->Text (ent,model).ToCString();
- else if (!model.IsNull()) tystr = model->TypeName (ent);
- else tystr =
- Interface_InterfaceModel::ClassName(ent->DynamicType()->Name());
- }
- for (i = 1; i <= nb; i ++) {
- if (ent.IsNull()) sprintf(mess,"F: %s",check->CFail(i,original));
- else sprintf(mess,"F:%s: %s",tystr,check->CFail(i,original));
- Add (ent,mess);
- }
- nb = 0;
- if (!failsonly) nb = check->NbWarnings();
- for (i = 1; i <= nb; i ++) {
- if (ent.IsNull()) sprintf(mess,"W: %s",check->CWarning(i,original));
- else sprintf(mess,"W:%s: %s",tystr,check->CWarning(i,original));
- Add (ent,mess);
- }
- }
-}
+++ /dev/null
-// Created on: 1994-11-07
-// 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_CheckCounter_HeaderFile
-#define _IFSelect_CheckCounter_HeaderFile
-
-#include <Standard.hxx>
-
-#include <IFSelect_SignatureList.hxx>
-class MoniTool_SignText;
-class Interface_CheckIterator;
-class Interface_InterfaceModel;
-
-
-class IFSelect_CheckCounter;
-DEFINE_STANDARD_HANDLE(IFSelect_CheckCounter, IFSelect_SignatureList)
-
-//! A CheckCounter allows to see a CheckList (i.e. CheckIterator)
-//! not per entity, its messages, but per message, the entities
-//! attached (count and list). Because many messages can be
-//! repeated if they are due to systematic errors
-class IFSelect_CheckCounter : public IFSelect_SignatureList
-{
-
-public:
-
-
- //! Creates a CheckCounter, empty ready to work
- Standard_EXPORT IFSelect_CheckCounter(const Standard_Boolean withlist = Standard_False);
-
- //! Sets a specific signature
- //! Else, the current SignType (in the model) is used
- Standard_EXPORT void SetSignature (const Handle(MoniTool_SignText)& sign);
-
- //! Returns the Signature;
- Standard_EXPORT Handle(MoniTool_SignText) Signature() const;
-
- //! Analyses a CheckIterator according a Model (which detains the
- //! entities for which the CheckIterator has messages), i.e.
- //! counts messages for entities
- //! If <original> is True, does not consider final messages but
- //! those before interpretation (such as inserting variables :
- //! integers, reals, strings)
- //! If <failsonly> is True, only Fails are considered
- //! Remark : global messages are recorded with a Null entity
- Standard_EXPORT void Analyse (const Interface_CheckIterator& list, const Handle(Interface_InterfaceModel)& model, const Standard_Boolean original = Standard_False, const Standard_Boolean failsonly = Standard_False);
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_CheckCounter,IFSelect_SignatureList)
-
-protected:
-
-
-
-
-private:
-
-
- Handle(MoniTool_SignText) thesign;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_CheckCounter_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) throw Standard_NoSuchObject("IFSelect_ContextModif");
- return thegraf.Entity(thecurr);
-}
-
-
-//=======================================================================
-//function : ValueResult
-//purpose :
-//=======================================================================
-
-Handle(Standard_Transient) IFSelect_ContextModif::ValueResult () const
-{
- if (thecurr <= 0) throw Standard_NoSuchObject("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;
-
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- sout << "--- Run Modifier:" << std::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)"<<std::endl;
- else sout<<" Entities,Total:"<<nb<<" Concerned:"<<ne<<std::endl;
-}
-
-
-//=======================================================================
-//function : Trace
-//purpose :
-//=======================================================================
-
-void IFSelect_ContextModif::Trace (const Standard_CString mess)
-{
-// Trace courante
- if (thecurr <= 0) return;
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (ValueOriginal() == ValueResult())
- sout<<"-- ContextModif. Entity n0 "<<thecurr<<std::endl;
- else
- sout<<"-- ContextModif. Entity in Original, n0 "<<thecurr<<" in Result, n0 "
- <<thecurt<<std::endl;
- if (mess[0] != '\0') sout<<"-- Message:"<<mess<<std::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>
-class Interface_Protocol;
-class Interface_CopyControl;
-class Interface_CopyTool;
-class Interface_EntityIterator;
-class Interface_InterfaceModel;
-class Standard_Transient;
-class IFSelect_GeneralModifier;
-class Interface_Check;
-
-
-//! This class gathers various information used by Model Modifiers
-//! apart from the target model itself, and the CopyTool which
-//! must be passed directly.
-//!
-//! These information 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 information :
- //! - 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 information :
- //! - 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 individual entity really modified
- //! <mess> is an optional 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;
-
-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_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)
- throw Standard_NoSuchObject("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 <Interface_CheckIterator.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_CString.hxx>
-class Interface_InterfaceModel;
-class Interface_Protocol;
-class IFSelect_AppliedModifiers;
-class Interface_HGraph;
-class IFSelect_GeneralModifier;
-class Interface_Graph;
-class Standard_Transient;
-class Interface_Check;
-
-
-//! This class gathers various information used by File Modifiers
-//! apart from the writer object, which is specific of the norm
-//! and of the physical format
-//!
-//! These information 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 information :
- //! - 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_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_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>
-class IFSelect_IntParam;
-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_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>
-class IFSelect_IntParam;
-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_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 <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_Integer.hxx>
-class IFSelect_SignCounter;
-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_SelectionIterator.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Dispatch,Standard_Transient)
-
-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 <Standard_Transient.hxx>
-#include <Standard_Integer.hxx>
-class TCollection_HAsciiString;
-class IFSelect_Selection;
-class IFSelect_SelectionIterator;
-class TCollection_AsciiString;
-class Interface_EntityIterator;
-class Interface_Graph;
-class IFGraph_SubPartsIterator;
-
-
-class IFSelect_Dispatch;
-DEFINE_STANDARD_HANDLE(IFSelect_Dispatch, Standard_Transient)
-
-//! 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 Standard_Transient
-{
-
-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,Standard_Transient)
-
-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 <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_HAsciiString.hxx>
-#include <TColStd_HSequenceOfHAsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_EditForm,Standard_Transient)
-
-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 (Standard_OStream& S) const
-{
- Standard_Integer iv, nbv = NbValues(Standard_True);
- S<<"***** EditForm, Label : "<<Label()<<std::endl;
- if (IsComplete()) S<<"Complete, "<<nbv<<" Values"<<std::endl;
- else {
- S<<"Extraction on "<<nbv<<" Values : (extracted<-editor)"<<std::endl;
- for (iv = 1; iv <= nbv; iv ++) S<<" "<<iv<<"<-"<<NumberFromRank(iv);
- S<<std::endl;
- }
- S<<"*****"<<std::endl;
-}
-
-
-static void PrintList
- (const Handle(TColStd_HSequenceOfHAsciiString)& list,
- Standard_OStream& S, const Standard_Boolean alsolist)
-{
- if (list.IsNull()) { S<<"(NULL LIST)"<<std::endl; return; }
-
- Standard_Integer i,nb = list->Length();
- S<<"(List : "<<nb<<" Items)"<<std::endl;
- if (!alsolist) return;
-
- for (i = 1; i <= nb; i ++) {
- Handle(TCollection_HAsciiString) str = list->Value(i);
- S<<" ["<<i<<"] "<< (str.IsNull() ? "(NULL)" : str->ToCString())<<std::endl;
- }
-}
-
- void IFSelect_EditForm::PrintValues
- (Standard_OStream& S, const Standard_Integer what,
- const Standard_Boolean names, const Standard_Boolean alsolist) const
-{
- Standard_Integer iv, nbv = NbValues(Standard_True);
- S<< "****************************************************"<<std::endl;
- S<<"***** "<<Label()<<Interface_MSG::Blanks(Label(),40)<<"*****"<<std::endl;
- S<<"***** *****"<<std::endl;
- if (!theloaded)
- S<<"***** Values are NOT loaded *****"<<std::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<<std::endl<<"****************************************************"<<std::endl<<std::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"<<std::endl;
- else S<<" N0 Name Value"<<std::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()) <<std::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()) <<std::endl;
- str = EditedValue (jv);
- S<<Interface_MSG::Blanks("",maxnam+4)<<" MOD :"<< (str.IsNull() ? "(NULL)" : str->ToCString()) <<std::endl;
- }
- }
- if (what == 0) S<<"On "<<nbv<<" Values, "<<nbmod<<" Modified"<<std::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 <TColStd_Array1OfInteger.hxx>
-#include <TColStd_Array1OfTransient.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Transient.hxx>
-#include <TColStd_SequenceOfInteger.hxx>
-#include <TColStd_HSequenceOfHAsciiString.hxx>
-class IFSelect_Editor;
-class Interface_InterfaceModel;
-class IFSelect_ListEditor;
-class TCollection_HAsciiString;
-
-class IFSelect_EditForm;
-DEFINE_STANDARD_HANDLE(IFSelect_EditForm, Standard_Transient)
-
-//! 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 correspondence between this Number and
-//! the Rank in the EditForm : RankFromNumber and NumberFromRank
-class IFSelect_EditForm : public Standard_Transient
-{
-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 (Standard_OStream& 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 (Standard_OStream& 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,Standard_Transient)
-
-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 <IFSelect_EditForm.hxx>
-#include <IFSelect_Editor.hxx>
-#include <IFSelect_ListEditor.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_MSG.hxx>
-#include <Interface_TypedValue.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,Standard_Transient)
-
-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)
- { thelists.Init(-1); }
-
- void IFSelect_Editor::SetNbValues (const Standard_Integer nbval)
-{
- if (nbval > thevalues.Upper()) throw Standard_OutOfRange("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.Bind (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.Bind (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 (Standard_OStream& S) const
-{
- Standard_Integer i, nb = NbValues();
- S<<"**** Editor : "<<Label()<<std::endl;
- S<<"**** Nb Values = "<<nb<<" **** Names / Labels"<<std::endl;
- S<<" Num ";
- if (themaxsh > 0) S<<"Short"<<Interface_MSG::Blanks("Short",themaxsh)<<" ";
- S<<"Complete"<<Interface_MSG::Blanks("Complete",themaxco)<<" Label"<<std::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()<<std::endl;
- }
-}
-
- void IFSelect_Editor::PrintDefs
- (Standard_OStream& S, const Standard_Boolean labels) const
-{
- Standard_Integer i, nb = NbValues();
- S<<"**** Editor : "<<Label()<<std::endl;
- S<<"**** Nb Values = "<<nb<<" **** "<<(labels ? "Labels" : "Names")<<" / Definitions"<<std::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"<<std::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()<<std::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.Find(name,res))
- 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 <Standard_Transient.hxx>
-#include <IFSelect_EditValue.hxx>
-#include <TColStd_HSequenceOfHAsciiString.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <NCollection_DataMap.hxx>
-class Interface_TypedValue;
-class IFSelect_EditForm;
-class TCollection_HAsciiString;
-class IFSelect_ListEditor;
-class Interface_InterfaceModel;
-
-
-class IFSelect_Editor;
-DEFINE_STANDARD_HANDLE(IFSelect_Editor, Standard_Transient)
-
-//! 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 Standard_Transient
-{
-
-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 (Standard_OStream& S) const;
-
- Standard_EXPORT void PrintDefs (Standard_OStream& 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,Standard_Transient)
-
-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;
- NCollection_DataMap<TCollection_AsciiString, Standard_Integer> 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_FileModifier.ixx>
-
-
-
-IFSelect_FileModifier::IFSelect_FileModifier ()
- : IFSelect_GeneralModifier (Standard_False) { }
+++ /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,Standard_Transient)
-
-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_Transient.hxx>
-class IFSelect_Selection;
-class IFSelect_Dispatch;
-class TCollection_AsciiString;
-
-class IFSelect_GeneralModifier;
-DEFINE_STANDARD_HANDLE(IFSelect_GeneralModifier, Standard_Transient)
-
-//! 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
-//! split 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 Standard_Transient
-{
-
-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 additional 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,Standard_Transient)
-
-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_GraphCounter.hxx>
-#include <IFSelect_SelectDeduct.hxx>
-#include <IFSelect_SelectPointed.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Standard_Type.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_GraphCounter,IFSelect_SignCounter)
-
-IFSelect_GraphCounter::IFSelect_GraphCounter
- (const Standard_Boolean withmap, const Standard_Boolean withlist)
- : IFSelect_SignCounter (withmap,withlist) { }
-
- Handle(IFSelect_SelectDeduct) IFSelect_GraphCounter::Applied () const
- { return theapplied; }
-
- void IFSelect_GraphCounter::SetApplied
- (const Handle(IFSelect_SelectDeduct)& applied)
- { theapplied = applied; }
-
- void IFSelect_GraphCounter::AddWithGraph
- (const Handle(TColStd_HSequenceOfTransient)& list,
- const Interface_Graph& graph)
-{
- if (theapplied.IsNull()) { AddList (list,graph.Model()); return; }
- if (list.IsNull()) return;
- Standard_Integer i, nb = list->Length();
- for (i = 1; i <= nb; i ++) {
- char val[12];
- Handle(Standard_Transient) ent = list->Value(i);
- theapplied->Alternate()->SetEntity (ent);
- Interface_EntityIterator iter = theapplied->UniqueResult(graph);
- Standard_Integer n = iter.NbEntities();
- switch (n) {
- case 0: Add (ent,"0"); break;
- case 1: Add (ent,"1"); break;
- case 2: Add (ent,"2"); break;
- case 3: Add (ent,"3"); break;
- case 4: Add (ent,"4"); break;
- case 5: Add (ent,"5"); break;
- case 6: Add (ent,"6"); break;
- case 7: Add (ent,"7"); break;
- case 8: Add (ent,"8"); break;
- case 9: Add (ent,"9"); break;
- default :
- sprintf (val,"%d",n);
- Add (ent,val);
- break;
- }
- }
-}
+++ /dev/null
-// Created on: 1998-10-15
-// 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_GraphCounter_HeaderFile
-#define _IFSelect_GraphCounter_HeaderFile
-
-#include <Standard.hxx>
-
-#include <IFSelect_SignCounter.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-class IFSelect_SelectDeduct;
-class Interface_Graph;
-
-
-class IFSelect_GraphCounter;
-DEFINE_STANDARD_HANDLE(IFSelect_GraphCounter, IFSelect_SignCounter)
-
-//! A GraphCounter computes values to be sorted with the help of
-//! a Graph. I.E. not from a Signature
-//!
-//! The default GraphCounter works with an Applied Selection (a
-//! SelectDeduct), the value is the count of selected entities
-//! from each input entities)
-class IFSelect_GraphCounter : public IFSelect_SignCounter
-{
-
-public:
-
-
- //! Creates a GraphCounter, without applied selection
- Standard_EXPORT IFSelect_GraphCounter(const Standard_Boolean withmap = Standard_True, const Standard_Boolean withlist = Standard_False);
-
- //! Returns the applied selection
- Standard_EXPORT Handle(IFSelect_SelectDeduct) Applied() const;
-
- //! Sets a new applied selection
- Standard_EXPORT void SetApplied (const Handle(IFSelect_SelectDeduct)& sel);
-
- //! Adds a list of entities in the context given by the graph
- //! Default takes the count of entities selected by the applied
- //! selection, when it is given each entity of the list
- //! Can be redefined
- Standard_EXPORT virtual void AddWithGraph (const Handle(TColStd_HSequenceOfTransient)& list, const Interface_Graph& graph) Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_GraphCounter,IFSelect_SignCounter)
-
-protected:
-
-
-
-
-private:
-
-
- Handle(IFSelect_SelectDeduct) theapplied;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_GraphCounter_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_HSeqOfSelection_HeaderFile
-#define IFSelect_HSeqOfSelection_HeaderFile
-
-#include <IFSelect_TSeqOfSelection.hxx>
-#include <NCollection_DefineHSequence.hxx>
-
-DEFINE_HSEQUENCE(IFSelect_HSeqOfSelection, IFSelect_TSeqOfSelection)
-
-
-#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_IntParam.hxx>
-#include <Interface_Static.hxx>
-#include <Standard_Type.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_IntParam,Standard_Transient)
-
-IFSelect_IntParam::IFSelect_IntParam ()
- { theval = 0; }
-
- void IFSelect_IntParam::SetStaticName (const Standard_CString statname)
- { thestn.Clear(); thestn.AssignCat (statname); }
-
- Standard_Integer IFSelect_IntParam::Value () const
-{
- if (thestn.Length() == 0) return theval;
- if (!Interface_Static::IsSet(thestn.ToCString()) ) return theval;
- return Interface_Static::IVal(thestn.ToCString());
-}
-
- void IFSelect_IntParam::SetValue (const Standard_Integer val)
-{
- theval = val;
- if (thestn.Length() == 0) return;
- if (!Interface_Static::IsPresent(thestn.ToCString()) ) return;
- Interface_Static::SetIVal (thestn.ToCString(),theval);
-}
+++ /dev/null
-// Created on: 1992-11-30
-// 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_IntParam_HeaderFile
-#define _IFSelect_IntParam_HeaderFile
-
-#include <Standard.hxx>
-
-#include <Standard_Integer.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <Standard_Transient.hxx>
-
-class IFSelect_IntParam;
-DEFINE_STANDARD_HANDLE(IFSelect_IntParam, Standard_Transient)
-
-//! This class simply allows to access an Integer value through a
-//! Handle, as a String can be (by using HString).
-//! Hence, this value can be accessed : read and modified, without
-//! passing through the specific object which detains it. Thus,
-//! parameters of a Selection or a Dispatch (according its type)
-//! can be controlled directly from the ShareOut which contains them
-//!
-//! Additionally, an IntParam can be bound to a Static.
-//! Remember that for a String, binding is immediate, because the
-//! string value of a Static is a HAsciiString, it then suffices
-//! to get its Handle.
-//! For an Integer, an IntParam can designate (by its name) a
-//! Static : each time its value is required or set, the Static
-//! is aknowledged
-class IFSelect_IntParam : public Standard_Transient
-{
-
-public:
-
- //! Creates an IntParam. Initial value is set to zer
- Standard_EXPORT IFSelect_IntParam();
-
- //! Commands this IntParam to be bound to a Static
- //! Hence, Value will return the value if this Static if it is set
- //! Else, Value works on the locally stored value
- //! SetValue also will set the value of the Static
- //! This works only for a present static of type integer or enum
- //! Else, it is ignored
- //!
- //! If <statname> is empty, disconnects the IntParam from Static
- Standard_EXPORT void SetStaticName (const Standard_CString statname);
-
- //! Returns the name of static parameter to which this IntParam
- //! is bound, empty if none
- Standard_EXPORT Standard_CString StaticName() const;
-
- //! Reads Integer Value of the IntParam. If a StaticName is
- //! defined and the Static is set, looks in priority the value
- //! of the static
- Standard_EXPORT Standard_Integer Value() const;
-
- //! Sets a new Integer Value for the IntParam. If a StaticName is
- //! defined and the Static is set, also sets the value of the static
- Standard_EXPORT void SetValue (const Standard_Integer val);
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_IntParam,Standard_Transient)
-
-private:
-
- Standard_Integer theval;
- TCollection_AsciiString thestn;
-
-};
-
-#endif // _IFSelect_IntParam_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,Standard_Transient)
-
-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_Integer.hxx>
-#include <TColStd_HSequenceOfHAsciiString.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-#include <Standard_Transient.hxx>
-class Interface_TypedValue;
-class Interface_InterfaceModel;
-class TCollection_HAsciiString;
-
-class IFSelect_ListEditor;
-DEFINE_STANDARD_HANDLE(IFSelect_ListEditor, Standard_Transient)
-
-//! 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 Standard_Transient
-{
-
-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 more 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,Standard_Transient)
-
-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 <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_ModelCopier,Standard_Transient)
-
-//#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::SendInfo() << "** WorkSession : Copying split data before sending"<<std::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::SendInfo() << "** WorkSession : Sending split data already copied"<<std::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 : **"<<std::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::SendInfo() << " ** Sending File n0."<<i<<" has failed, abandon **"<<std::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::SendInfo() << "** WorkSession : Copying then sending split data"<<std::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 : **"<<std::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::SendInfo() << " ** Sending File "<<filename<<" has failed, abandon **"<<std::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::SendInfo() << "** WorkSession : Sending all data"<<std::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::SendWarning() <<
-// " ** SendAll has produced Check Messages : **"<<std::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::SendInfo() << "** WorkSession : Sending selected data"<<std::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::SendWarning() <<
-// " ** SendSelected has produced Check Messages : **"<<std::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::SendWarning() <<
-// " Messages on Copied Model n0 "<<numod<<", Dispatch Rank "<<dispnum<<std::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
- std::cout << " Remaining Model : " << newmod->NbEntities() << " Entities"<<std::endl;
- Standard_Integer ne = 0;
- for (i = 1; i <= nb; i ++) {
- if (theremain->Value(i) == 0) {
- if (ne == 0) std::cout << " Refractaires : ";
- ne ++; std::cout << " " << i;
- }
- }
- if (ne > 0) std::cout << " -- " << ne << " Entities" << std::endl;
- else std::cout<<" -- Remaining data complete"<<std::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 <Standard_Transient.hxx>
-#include <Standard_Integer.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, Standard_Transient)
-
-//! 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, according to 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 Standard_Transient
-{
-
-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,Standard_Transient)
-
-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 useful 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 <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>
-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 information 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,Standard_Transient)
-
-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) throw Interface_InterfaceError("PacketList:Add, Entity not in Model");
- if (thelast == 0) throw Interface_InterfaceError("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 <Interface_IntList.hxx>
-#include <Standard_Integer.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <Standard_Transient.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-class Interface_InterfaceModel;
-class Interface_EntityIterator;
-
-
-class IFSelect_PacketList;
-DEFINE_STANDARD_HANDLE(IFSelect_PacketList, Standard_Transient)
-
-//! 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 Standard_Transient
-{
-
-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,Standard_Transient)
-
-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 <TColStd_HSequenceOfHAsciiString.hxx>
-class Interface_TypedValue;
-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 made explicit
- 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)
-
-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_PrintCount_HeaderFile
-#define _IFSelect_PrintCount_HeaderFile
-
-
-//! Lets you choose the manner in which you want to analyze an
-//! IGES or STEP file. Your analysis can be either message-oriented or
-//! entity-oriented. The specific values are as follows:
-//! - ItemsByEntity is a sequential list of all
-//! messages per entity of the defined type
-//! - CountByItem is the number of entities of the defined
-//! type, with their rank number per message
-//! - ShortByItem is the number of entities of the defined
-//! type, with their types per message; displays the rank
-//! numbers of the first five entities of the defined type
-//! per message
-//! - ListByItem is the number of entities of the defined type
-//! per message and the numbers of the entities
-//! - EntitiesByItem is the number of entities of the
-//! defined type, with their types, rank numbers and
-//! Directory Entry numbers per message
-//! - GeneralInfo is general information on transfer such as:
-//! - number of entities
-//! - number of roots
-//! - number of resulting Open CASCADE shapes
-//! - number of warnings and failures
-//! - CountSummary summary statistics for counters and signatures
-//! - ResultCount information that contains the number of
-//! roots in the IGES file and the number of resulting Open CASCADE shapes.
-//! - Mapping of the IGES root entities to the resulting Open
-//! CASCADE shape (including type and form of the IGES entity
-//! and type of the resulting shape).
-enum IFSelect_PrintCount
-{
-IFSelect_ItemsByEntity,
-IFSelect_CountByItem,
-IFSelect_ShortByItem,
-IFSelect_ListByItem,
-IFSelect_EntitiesByItem,
-IFSelect_CountSummary,
-IFSelect_GeneralInfo,
-IFSelect_Mapping,
-IFSelect_ResultCount
-};
-
-#endif // _IFSelect_PrintCount_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
+++ /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_SelectAnyList.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceError.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectAnyList,IFSelect_SelectDeduct)
-
-// .... Definition de liste : methodes "deferred" NbItems & FillResult
-void IFSelect_SelectAnyList::SetRange
- (const Handle(IFSelect_IntParam)& rankfrom,
- const Handle(IFSelect_IntParam)& rankto)
- { thelower = rankfrom; theupper = rankto; }
-
- void IFSelect_SelectAnyList::SetOne (const Handle(IFSelect_IntParam)& rank)
- { thelower = theupper = rank; }
-
- void IFSelect_SelectAnyList::SetFrom
- (const Handle(IFSelect_IntParam)& rankfrom)
- { thelower = rankfrom; theupper.Nullify(); }
-
- void IFSelect_SelectAnyList::SetUntil
- (const Handle(IFSelect_IntParam)& rankto)
- { thelower.Nullify(); theupper = rankto; }
-
- Standard_Boolean IFSelect_SelectAnyList::HasLower () const
- { return (!thelower.IsNull()); }
-
- Handle(IFSelect_IntParam) IFSelect_SelectAnyList::Lower () const
- { return thelower; }
-
- Standard_Integer IFSelect_SelectAnyList::LowerValue () const
-{
- if (thelower.IsNull()) return 0;
- return thelower->Value();
-}
-
- Standard_Boolean IFSelect_SelectAnyList::HasUpper () const
- { return (!theupper.IsNull()); }
-
- Handle(IFSelect_IntParam) IFSelect_SelectAnyList::Upper () const
- { return theupper; }
-
- Standard_Integer IFSelect_SelectAnyList::UpperValue () const
-{
- if (theupper.IsNull()) return 0;
- return theupper->Value();
-}
-
-// On prend les sous-entites de lower a upper (inclus)
- Interface_EntityIterator IFSelect_SelectAnyList::RootResult
- (const Interface_Graph& G) const
-{
- Interface_EntityIterator input = InputResult(G);
- KeepInputEntity (input); // selon type voulu
- if (input.NbEntities() > 1) throw Interface_InterfaceError("SelectAnyList : more than ONE Entity in input");
- if (input.NbEntities() == 0) return input;
-
- Handle(Standard_Transient) ent;
- for (input.Start(); input.More(); input.Next()) ent = input.Value();
-
- Standard_Integer rankmax = NbItems(ent);
- Standard_Integer rankfrom = 1;
- if (!thelower.IsNull()) rankfrom = thelower->Value();
- Standard_Integer rankto;
- if (!theupper.IsNull()) rankto = theupper->Value();
- else rankto = rankmax;
- if (rankfrom < 1) rankfrom = 1;
- if (rankto > rankmax) rankto = rankmax;
-
- Interface_EntityIterator iter;
- if (rankfrom <= rankto) FillResult(rankfrom,rankto,ent,iter);
- return iter;
-}
-
-
- TCollection_AsciiString IFSelect_SelectAnyList::Label () const
-{
- char lab[30];
- Standard_Integer rankfrom = 0;
- if (HasLower()) rankfrom = LowerValue();
- Standard_Integer rankto = 0;
- if (HasUpper()) rankto = UpperValue();
- if (rankfrom == rankto) sprintf(lab," (no %d)",rankfrom);
- else if (rankfrom == 0) sprintf(lab," (-> %d)",rankfrom);
- else if (rankto == 0) sprintf(lab," (%d ->)",rankto);
- else sprintf(lab," (%d -> %d)",rankfrom,rankto);
-
- TCollection_AsciiString labl("In List ");
- labl.AssignCat(ListLabel());
- labl.AssignCat(lab);
- return labl;
-}
+++ /dev/null
-// Created on: 1992-12-09
-// 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_SelectAnyList_HeaderFile
-#define _IFSelect_SelectAnyList_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectDeduct.hxx>
-#include <Standard_Integer.hxx>
-class IFSelect_IntParam;
-class Interface_EntityIterator;
-class Standard_Transient;
-class Interface_Graph;
-class TCollection_AsciiString;
-
-
-class IFSelect_SelectAnyList;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectAnyList, IFSelect_SelectDeduct)
-
-//! A SelectAnyList kind Selection selects a List of an Entity, as
-//! well as this Entity contains some. A List contains sub-entities
-//! as one per Item, or several (for instance if an Entity binds
-//! couples of sub-entities, each item is one of these couples).
-//! Remark that only Entities are taken into account (neither
-//! Reals, nor Strings, etc...)
-//!
-//! To define the list on which to work, SelectAnyList has two
-//! deferred methods : NbItems (which gives the length of the
-//! list), FillResult (which fills an EntityIterator). They are
-//! intended to get a List in an Entity of the required Type (and
-//! consider that list is empty if Entity has not required Type)
-//!
-//! In addition, remark that some types of Entity define more than
-//! one list in each instance : a given sub-class of SelectAnyList
-//! must be attached to one list
-//!
-//! SelectAnyList keeps or rejects a sub-set of the list,
-//! that is the Items of which rank in the list is in a given
-//! range (for instance form 2nd to 6th, etc...)
-//! Range is defined by two Integer values. In order to allow
-//! external control of them, these values are not directly
-//! defined as fields, but accessed through IntParams, that is,
-//! referenced as Transient (Handle) objects
-//!
-//! Warning : the Input can be any kind of Selection, BUT its
-//! RootResult must have zero (empty) or one Entity maximum
-class IFSelect_SelectAnyList : public IFSelect_SelectDeduct
-{
-
-public:
-
-
- //! Keeps Input Entity, as having required type. It works by
- //! keeping in <iter>, only suitable Entities (SelectType can be
- //! used). Called by RootResult (which waits for ONE ENTITY MAX)
- Standard_EXPORT virtual void KeepInputEntity (Interface_EntityIterator& iter) const = 0;
-
- //! Returns count of Items in the list in the Entity <ent>
- //! If <ent> has not required type, returned value must be Zero
- Standard_EXPORT virtual Standard_Integer NbItems (const Handle(Standard_Transient)& ent) const = 0;
-
- //! Sets a Range for numbers, with a lower and a upper limits
- Standard_EXPORT void SetRange (const Handle(IFSelect_IntParam)& rankfrom, const Handle(IFSelect_IntParam)& rankto);
-
- //! Sets a unique number (only one Entity will be sorted as True)
- Standard_EXPORT void SetOne (const Handle(IFSelect_IntParam)& rank);
-
- //! Sets a Lower limit but no upper limit
- Standard_EXPORT void SetFrom (const Handle(IFSelect_IntParam)& rankfrom);
-
- //! Sets an Upper limit but no lower limit (equivalent to lower 1)
- Standard_EXPORT void SetUntil (const Handle(IFSelect_IntParam)& rankto);
-
- //! Returns True if a Lower limit is defined
- Standard_EXPORT Standard_Boolean HasLower() const;
-
- //! Returns Lower limit (if there is; else, value is senseless)
- Standard_EXPORT Handle(IFSelect_IntParam) Lower() const;
-
- //! Returns Integer Value of Lower Limit (0 if none)
- Standard_EXPORT Standard_Integer LowerValue() const;
-
- //! Returns True if a Lower limit is defined
- Standard_EXPORT Standard_Boolean HasUpper() const;
-
- //! Returns Upper limit (if there is; else, value is senseless)
- Standard_EXPORT Handle(IFSelect_IntParam) Upper() const;
-
- //! Returns Integer Value of Upper Limit (0 if none)
- Standard_EXPORT Standard_Integer UpperValue() const;
-
- //! Returns the list of selected entities (list of entities
- //! complying with rank criterium)
- //! Error if the input list has more than one Item
- Standard_EXPORT Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! Puts into <res>, the sub-entities of the list, from n1 to
- //! n2 included. Remark that adequation with Entity's type and
- //! length of list has already been made at this stage
- //! Called by RootResult
- Standard_EXPORT virtual void FillResult (const Standard_Integer n1, const Standard_Integer n2, const Handle(Standard_Transient)& ent, Interface_EntityIterator& res) const = 0;
-
- //! Returns a text defining the criterium : "Components of List "
- //! then Specific List Label, then, following cases :
- //! " From .. Until .." or "From .." or "Until .." or "Rank no .."
- //! Specific type is given by deferred method ListLabel
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
- //! Returns the specific label for the list, which is included as
- //! a part of Label
- Standard_EXPORT virtual TCollection_AsciiString ListLabel() const = 0;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectAnyList,IFSelect_SelectDeduct)
-
-protected:
-
-
-
-
-private:
-
-
- Handle(IFSelect_IntParam) thelower;
- Handle(IFSelect_IntParam) theupper;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectAnyList_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_SelectAnyType.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectAnyType,IFSelect_SelectExtract)
-
-Standard_Boolean IFSelect_SelectAnyType::Sort
- (const Standard_Integer , const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& ) const
- { return ent->IsKind(TypeForMatch()); }
+++ /dev/null
-// Created on: 1992-11-18
-// 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_SelectAnyType_HeaderFile
-#define _IFSelect_SelectAnyType_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectExtract.hxx>
-#include <Standard_Type.hxx>
-#include <Standard_Integer.hxx>
-class Standard_Transient;
-class Interface_InterfaceModel;
-
-class IFSelect_SelectAnyType;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectAnyType, IFSelect_SelectExtract)
-
-//! A SelectAnyType sorts the Entities of which the Type is Kind
-//! of a given Type : this Type for Match is specific of each
-//! class of SelectAnyType
-class IFSelect_SelectAnyType : public IFSelect_SelectExtract
-{
-
-public:
-
- //! Returns the Type which has to be matched for select
- Standard_EXPORT virtual Handle(Standard_Type) TypeForMatch() const = 0;
-
- //! Returns True for an Entity (model->Value(num)) which is kind
- //! of the chosen type, given by the method TypeForMatch.
- //! Criterium is IsKind.
- Standard_EXPORT Standard_Boolean Sort (const Standard_Integer rank, const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectAnyType,IFSelect_SelectExtract)
-
-};
-
-#endif // _IFSelect_SelectAnyType_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_SelectBase.hxx>
-#include <IFSelect_SelectionIterator.hxx>
-#include <Standard_Type.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectBase,IFSelect_Selection)
-
-void IFSelect_SelectBase::FillIterator
- (IFSelect_SelectionIterator& ) const
- { } // rien a faire, une SelectBase ne depend d aucune autre Selection
+++ /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_SelectBase_HeaderFile
-#define _IFSelect_SelectBase_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Selection.hxx>
-class IFSelect_SelectionIterator;
-
-
-class IFSelect_SelectBase;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectBase, IFSelect_Selection)
-
-//! SelectBase works directly from an InterfaceModel : it is the
-//! first base for other Selections.
-class IFSelect_SelectBase : public IFSelect_Selection
-{
-
-public:
-
-
- //! Puts in an Iterator the Selections from which "me" depends
- //! This list is empty for all SelectBase type Selections
- Standard_EXPORT void FillIterator (IFSelect_SelectionIterator& iter) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectBase,IFSelect_Selection)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectBase_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_Cumulate.hxx>
-#include <IFSelect_SelectCombine.hxx>
-#include <IFSelect_Selection.hxx>
-#include <IFSelect_SelectionIterator.hxx>
-#include <Standard_Type.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectCombine,IFSelect_Selection)
-
-IFSelect_SelectCombine::IFSelect_SelectCombine () { }
-// { thelist = new IFSelect_SequenceOfSelection(); }
-
- Standard_Integer IFSelect_SelectCombine::NbInputs () const
- { return thelist.Length(); }
-
- Handle(IFSelect_Selection) IFSelect_SelectCombine::Input
- (const Standard_Integer num) const
- { return thelist.Value(num); }
-
- Standard_Integer IFSelect_SelectCombine::InputRank
- (const Handle(IFSelect_Selection)& sel) const
-{
- if (sel.IsNull()) return 0;
- Standard_Integer i, nb = thelist.Length();
- for (i = 1; i <= nb; i ++)
- if (sel == thelist.Value(i)) return i;
- return 0;
-}
-
- void IFSelect_SelectCombine::Add
- (const Handle(IFSelect_Selection)& sel, const Standard_Integer atnum)
-{
- if (atnum <= 0 || atnum > thelist.Length()) thelist.Append(sel);
- else thelist.InsertBefore(atnum,sel);
-}
-
- Standard_Boolean IFSelect_SelectCombine::Remove
- (const Handle(IFSelect_Selection)& sel)
- { return Remove (InputRank(sel)); }
-
- Standard_Boolean IFSelect_SelectCombine::Remove
- (const Standard_Integer num)
-{
- if (num <= 0 || num > thelist.Length()) return Standard_False;
- thelist.Remove(num);
- return Standard_True;
-}
-
-
- Standard_Boolean IFSelect_SelectCombine::HasUniqueResult () const
- { return Standard_True; }
-
- void IFSelect_SelectCombine::FillIterator
- (IFSelect_SelectionIterator& iter) const
- { iter.AddList(thelist); }
+++ /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_SelectCombine_HeaderFile
-#define _IFSelect_SelectCombine_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_TSeqOfSelection.hxx>
-#include <IFSelect_Selection.hxx>
-#include <Standard_Integer.hxx>
-class IFSelect_SelectionIterator;
-
-
-class IFSelect_SelectCombine;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectCombine, IFSelect_Selection)
-
-//! A SelectCombine type Selection defines algebraic operations
-//! between results of several Selections
-//! It is a deferred class : sub-classes will have to define
-//! precise what operator is to be applied
-class IFSelect_SelectCombine : public IFSelect_Selection
-{
-
-public:
-
-
- //! Returns the count of Input Selections
- Standard_EXPORT Standard_Integer NbInputs() const;
-
- //! Returns an Input Selection, given its rank in the list
- Standard_EXPORT Handle(IFSelect_Selection) Input (const Standard_Integer num) const;
-
- //! Returns the rank of an input Selection, 0 if not in the list.
- //! Most generally, its value is meaningless, except for testing
- //! the presence of an input Selection :
- //! - == 0 if <sel> is not an input for <me>
- //! - > 0 if <sel> is an input for <me>
- Standard_EXPORT Standard_Integer InputRank (const Handle(IFSelect_Selection)& sel) const;
-
- //! Adds a Selection to the filling list
- //! By default, adds it to the end of the list
- //! A Positive rank less then NbInputs gives an insertion rank
- //! (InsertBefore : the new <atnum>th item of the list is <sel>)
- Standard_EXPORT void Add (const Handle(IFSelect_Selection)& sel, const Standard_Integer atnum = 0);
-
- //! Removes an input Selection.
- //! Returns True if Done, False, if <sel> is not an input for <me>
- Standard_EXPORT Standard_Boolean Remove (const Handle(IFSelect_Selection)& sel);
-
- //! Removes an input Selection, given its rank in the list
- //! Returns True if Done, False if <num> is out of range
- Standard_EXPORT Standard_Boolean Remove (const Standard_Integer num);
-
- //! Puts in an Iterator the Selections from which "me" depends
- //! That is to say, the list of Input Selections
- Standard_EXPORT void FillIterator (IFSelect_SelectionIterator& iter) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectCombine,IFSelect_Selection)
-
-protected:
-
-
- //! Defines an empty SelectCombine
- Standard_EXPORT IFSelect_SelectCombine();
-
- //! Returns always True, because RootResult gives a Unique list
- Standard_EXPORT virtual Standard_Boolean HasUniqueResult() const Standard_OVERRIDE;
-
-
-
-private:
-
-
- IFSelect_TSeqOfSelection thelist;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectCombine_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_SelectControl.hxx>
-#include <IFSelect_Selection.hxx>
-#include <IFSelect_SelectionIterator.hxx>
-#include <Standard_Type.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectControl,IFSelect_Selection)
-
-Handle(IFSelect_Selection) IFSelect_SelectControl::MainInput () const
- { return themain; }
-
- Handle(IFSelect_Selection) IFSelect_SelectControl::SecondInput () const
- { return thesecond; }
-
- Standard_Boolean IFSelect_SelectControl::HasSecondInput () const
- { return (!thesecond.IsNull()); }
-
- void IFSelect_SelectControl::SetMainInput
- (const Handle(IFSelect_Selection)& sel)
- { themain = sel; }
-
- void IFSelect_SelectControl::SetSecondInput
- (const Handle(IFSelect_Selection)& sel)
- { thesecond = sel; }
-
-
- void IFSelect_SelectControl::FillIterator
- (IFSelect_SelectionIterator& iter) const
-{
- iter.AddItem(themain);
- if (!thesecond.IsNull()) iter.AddItem(thesecond);
-}
+++ /dev/null
-// Created on: 1994-02-16
-// 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_SelectControl_HeaderFile
-#define _IFSelect_SelectControl_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Selection.hxx>
-class IFSelect_SelectionIterator;
-
-
-class IFSelect_SelectControl;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectControl, IFSelect_Selection)
-
-//! A SelectControl kind Selection works with two input Selections
-//! in a dissymmetric way : the Main Input which gives an input
-//! list of Entities, to be processed, and the Second Input which
-//! gives another list, to be used to filter the main input.
-//!
-//! e.g. : SelectDiff retains the items of the Main Input which
-//! are not in the Control Input (which acts as Diff Input)
-//! or a specific selection which retains Entities from the Main
-//! Input if and only if they are concerned by an entity from
-//! the Control Input (such as Views in IGES, etc...)
-//!
-//! The way RootResult and Label are produced are at charge of
-//! each sub-class
-class IFSelect_SelectControl : public IFSelect_Selection
-{
-
-public:
-
-
- //! Returns the Main Input Selection
- Standard_EXPORT Handle(IFSelect_Selection) MainInput() const;
-
- //! Returns True if a Control Input is defined
- //! Thus, Result can be computed differently if there is a
- //! Control Input or if there is none
- Standard_EXPORT Standard_Boolean HasSecondInput() const;
-
- //! Returns the Control Input Selection, or a Null Handle
- Standard_EXPORT Handle(IFSelect_Selection) SecondInput() const;
-
- //! Sets a Selection to be the Main Input
- Standard_EXPORT void SetMainInput (const Handle(IFSelect_Selection)& sel);
-
- //! Sets a Selection to be the Control Input
- Standard_EXPORT void SetSecondInput (const Handle(IFSelect_Selection)& sel);
-
- //! Puts in an Iterator the Selections from which "me" depends
- //! That is to say, the list of Input Selections
- Standard_EXPORT void FillIterator (IFSelect_SelectionIterator& iter) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectControl,IFSelect_Selection)
-
-protected:
-
-
-
-
-private:
-
-
- Handle(IFSelect_Selection) themain;
- Handle(IFSelect_Selection) thesecond;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectControl_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_SelectDeduct.hxx>
-#include <IFSelect_Selection.hxx>
-#include <IFSelect_SelectionIterator.hxx>
-#include <IFSelect_SelectPointed.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Standard_Type.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectDeduct,IFSelect_Selection)
-
-void IFSelect_SelectDeduct::SetInput (const Handle(IFSelect_Selection)& sel)
- { thesel = sel; }
-
- Handle(IFSelect_Selection) IFSelect_SelectDeduct::Input () const
- { return thesel; }
-
- Standard_Boolean IFSelect_SelectDeduct::HasInput () const
- { return (!thesel.IsNull()); }
-
- Standard_Boolean IFSelect_SelectDeduct::HasAlternate () const
-{ if (!thealt.IsNull()) return thealt->IsSet(); return Standard_False; }
-
- Handle(IFSelect_SelectPointed)& IFSelect_SelectDeduct::Alternate ()
-{
- if (thealt.IsNull()) thealt = new IFSelect_SelectPointed;
- return thealt;
-}
-
-
- Interface_EntityIterator IFSelect_SelectDeduct::InputResult
- (const Interface_Graph& G) const
-{
- Interface_EntityIterator res;
- if (!thealt.IsNull()) {
- if (thealt->IsSet()) {
- res = thealt->UniqueResult (G);
- thealt->Clear();
- return res;
- }
- }
- if (thesel.IsNull()) return res;
- return thesel->UniqueResult(G);
-}
-
- void IFSelect_SelectDeduct::FillIterator
- (IFSelect_SelectionIterator& iter) const
- { iter.AddItem(thesel); }
+++ /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_SelectDeduct_HeaderFile
-#define _IFSelect_SelectDeduct_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Selection.hxx>
-class IFSelect_SelectPointed;
-class Interface_EntityIterator;
-class Interface_Graph;
-class IFSelect_SelectionIterator;
-
-
-class IFSelect_SelectDeduct;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectDeduct, IFSelect_Selection)
-
-//! A SelectDeduct determines a list of Entities from an Input
-//! Selection, by a computation : Output list is not obliged to be
-//! a sub-list of Input list
-//! (for more specific, see SelectExtract for filtered sub-lists,
-//! and SelectExplore for recurcive exploration)
-//!
-//! A SelectDeduct may use an alternate input for one shot
-//! This allows to use an already existing definition, by
-//! overloading the input selection by an alternate list,
-//! already defined, for one use :
-//! If this alternate list is set, InputResult queries it instead
-//! of calling the input selection, then clears it immediately
-class IFSelect_SelectDeduct : public IFSelect_Selection
-{
-
-public:
-
-
- //! Defines or Changes the Input Selection
- Standard_EXPORT void SetInput (const Handle(IFSelect_Selection)& sel);
-
- //! Returns the Input Selection
- Standard_EXPORT Handle(IFSelect_Selection) Input() const;
-
- //! Returns True if the Input Selection is defined, False else
- Standard_EXPORT Standard_Boolean HasInput() const;
-
- //! Tells if an Alternate List has been set, i.e. : the Alternate
- //! Definition is present and set
- Standard_EXPORT Standard_Boolean HasAlternate() const;
-
- //! Returns the Alternate Definition
- //! It is returned modifiable, hence an already defined
- //! SelectPointed can be used
- //! But if it was not yet defined, it is created the first time
- //!
- //! It is exploited by InputResult
- Standard_EXPORT Handle(IFSelect_SelectPointed)& Alternate();
-
- //! Returns the Result determined by Input Selection, as Unique
- //! if Input Selection is not defined, returns an empty list.
- //!
- //! If Alternate is set, InputResult takes its definition instead
- //! of calling the Input Selection, then clears it
- Standard_EXPORT Interface_EntityIterator InputResult (const Interface_Graph& G) const;
-
- //! Puts in an Iterator the Selections from which "me" depends
- //! This list contains one Selection : the InputSelection
- Standard_EXPORT void FillIterator (IFSelect_SelectionIterator& iter) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectDeduct,IFSelect_Selection)
-
-protected:
-
-
-
-
-private:
-
-
- Handle(IFSelect_Selection) thesel;
- Handle(IFSelect_SelectPointed) thealt;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectDeduct_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 <IFSelect_SelectDiff.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectDiff,IFSelect_SelectControl)
-
-IFSelect_SelectDiff::IFSelect_SelectDiff () { }
-
-
- Interface_EntityIterator IFSelect_SelectDiff::RootResult
- (const Interface_Graph& G) const
-{
- IFGraph_Compare GC(G);
- GC.GetFromIter(MainInput()->RootResult(G),Standard_True); // first
- if (HasSecondInput())
- GC.GetFromIter(SecondInput()->RootResult(G),Standard_False); // second
- return GC.FirstOnly();
-}
-
- Standard_Boolean IFSelect_SelectDiff::HasUniqueResult () const
- { return Standard_True; } // naturellement unique
-
- TCollection_AsciiString IFSelect_SelectDiff::Label () const
- { return TCollection_AsciiString("Differences"); }
+++ /dev/null
-// Created on: 1992-11-18
-// 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_SelectDiff_HeaderFile
-#define _IFSelect_SelectDiff_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectControl.hxx>
-class Interface_EntityIterator;
-class Interface_Graph;
-class TCollection_AsciiString;
-
-
-class IFSelect_SelectDiff;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectDiff, IFSelect_SelectControl)
-
-//! A SelectDiff keeps the entities from a Selection, the Main
-//! Input, which are not listed by the Second Input
-class IFSelect_SelectDiff : public IFSelect_SelectControl
-{
-
-public:
-
-
- //! Creates an empty SelectDiff
- Standard_EXPORT IFSelect_SelectDiff();
-
- //! Returns the list of selected entities : they are the Entities
- //! gotten from the Main Input but not from the Diff Input
- Standard_EXPORT Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! Returns a text defining the criterium : "Difference"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectDiff,IFSelect_SelectControl)
-
-protected:
-
-
- //! Returns always True, because RootResult gives a Unique list
- Standard_EXPORT virtual Standard_Boolean HasUniqueResult() const Standard_OVERRIDE;
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectDiff_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_SelectEntityNumber.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_SelectEntityNumber,IFSelect_SelectBase)
-
-IFSelect_SelectEntityNumber::IFSelect_SelectEntityNumber () { }
-
- void IFSelect_SelectEntityNumber::SetNumber
- (const Handle(IFSelect_IntParam)& num)
- { thenum = num; }
-
- Handle(IFSelect_IntParam) IFSelect_SelectEntityNumber::Number () const
- { return thenum; }
-
- Interface_EntityIterator IFSelect_SelectEntityNumber::RootResult
- (const Interface_Graph& G) const
-{
- Interface_EntityIterator iter;
- Standard_Integer num = 0;
- if (!thenum.IsNull()) num = thenum->Value();
- if (num < 1) return iter; // vide si num < 1 ou num > NbEntities
- if (num <= G.Size()) iter.GetOneItem(G.Entity(num));
- return iter;
-}
-
- TCollection_AsciiString IFSelect_SelectEntityNumber::Label () const
-{
- Standard_Integer num = 0;
- if (!thenum.IsNull()) num = thenum->Value();
- TCollection_AsciiString labl(num);
- labl.InsertBefore (1,"Entity Number ");
- return labl;
-}
+++ /dev/null
-// Created on: 1992-11-18
-// 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_SelectEntityNumber_HeaderFile
-#define _IFSelect_SelectEntityNumber_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectBase.hxx>
-class IFSelect_IntParam;
-class Interface_EntityIterator;
-class Interface_Graph;
-class TCollection_AsciiString;
-
-class IFSelect_SelectEntityNumber;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectEntityNumber, IFSelect_SelectBase)
-
-//! A SelectEntityNumber gets in an InterfaceModel (through a
-//! Graph), the Entity which has a specified Number (its rank of
-//! adding into the Model) : there can be zero (if none) or one.
-//! The Number is not directly defined as an Integer, but as a
-//! Parameter, which can be externally controlled
-class IFSelect_SelectEntityNumber : public IFSelect_SelectBase
-{
-
-public:
-
- //! Creates a SelectEntityNumber, initially with no specified Number
- Standard_EXPORT IFSelect_SelectEntityNumber();
-
- //! Sets Entity Number to be taken (initially, none is set : 0)
- Standard_EXPORT void SetNumber (const Handle(IFSelect_IntParam)& num);
-
- //! Returns specified Number (as a Parameter)
- Standard_EXPORT Handle(IFSelect_IntParam) Number() const;
-
- //! Returns the list of selected entities : the Entity having the
- //! specified Number (this result assures naturally uniqueness)
- Standard_EXPORT Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! Returns a text defining the criterium : "Entity Number ..."
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectEntityNumber,IFSelect_SelectBase)
-
-private:
-
- Handle(IFSelect_IntParam) thenum;
-
-};
-
-#endif // _IFSelect_SelectEntityNumber_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_SelectErrorEntities.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectErrorEntities,IFSelect_SelectExtract)
-
-IFSelect_SelectErrorEntities::IFSelect_SelectErrorEntities () { }
-
- Standard_Boolean IFSelect_SelectErrorEntities::Sort
- (const Standard_Integer , const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& model) const
-//.. ne peut pas marcher, il faut aussi le modele ! ex. via le graphe ...
- { return model->IsErrorEntity (model->Number(ent)); }
-
- TCollection_AsciiString IFSelect_SelectErrorEntities::ExtractLabel () const
- { return TCollection_AsciiString("Error Entities"); }
+++ /dev/null
-// Created on: 1992-11-18
-// 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_SelectErrorEntities_HeaderFile
-#define _IFSelect_SelectErrorEntities_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectExtract.hxx>
-#include <Standard_Integer.hxx>
-class Standard_Transient;
-class Interface_InterfaceModel;
-class TCollection_AsciiString;
-
-
-class IFSelect_SelectErrorEntities;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectErrorEntities, IFSelect_SelectExtract)
-
-//! A SelectErrorEntities sorts the Entities which are qualified
-//! as "Error" (their Type has not been recognized) during reading
-//! a File. This does not concern Entities which are syntactically
-//! correct, but with incorrect data (for integrity constraints).
-class IFSelect_SelectErrorEntities : public IFSelect_SelectExtract
-{
-
-public:
-
-
- //! Creates a SelectErrorEntities
- Standard_EXPORT IFSelect_SelectErrorEntities();
-
- //! Returns True for an Entity which is qualified as "Error", i.e.
- //! if <model> explicitly knows <ent> (through its Number) as
- //! Erroneous
- 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 : "Error Entities"
- Standard_EXPORT TCollection_AsciiString ExtractLabel() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectErrorEntities,IFSelect_SelectExtract)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectErrorEntities_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_SelectExplore.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_IndexedMapOfTransient.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectExplore,IFSelect_SelectDeduct)
-
-IFSelect_SelectExplore::IFSelect_SelectExplore (const Standard_Integer level)
-: thelevel (level) { }
-
-
- Standard_Integer IFSelect_SelectExplore::Level () const
- { return thelevel; }
-
-
- Interface_EntityIterator IFSelect_SelectExplore::RootResult
- (const Interface_Graph& G) const
-{
-// Attention, voila comme on procede
-// On a une IndexedMapOfTransient en entree (entites deja traitees/a traiter)
-// Elle est initialisee par InputResult
-// Et une map en sortie (resultats pris) -> le resultat sera unique
-// En entree, un curseur d entite courante
-// Pour chaque entite, on appelle Explore. 3 cas possibles :
-// retour False, on passe
-// retour True et liste vide, on prend cette entite sans aller plus loin
-// retour True et liste non vide, on ne prend pas cette entite mais on
-// considere son resultat.
-// Si dernier niveau, on le prend en entier. Sinon, il alimente l entree
-
- Standard_Integer nb = G.Size();
- TColStd_IndexedMapOfTransient entrees (nb);
- TColStd_IndexedMapOfTransient result (nb);
-// Initialisation
- Standard_Integer i, j, level = 1, ilev = 0;
- Interface_EntityIterator input; input = InputResult(G);
- for (input.Start(); input.More(); input.Next())
- i = entrees.Add (input.Value());
- ilev = entrees.Extent();
-
-// Exploration
- for (i = 1; i <= nb; i ++) {
- if (i > entrees.Extent()) break;
- if (i > ilev) {
- level ++;
- if (level > thelevel && thelevel > 0) break;
- ilev = entrees.Extent();
- }
- Handle(Standard_Transient) ent = entrees.FindKey(i);
- if (ent.IsNull()) continue;
- Interface_EntityIterator exp;
- if (!Explore (level,ent,G,exp)) continue;
-
-// On prend en compte : entite a prendre directement ?
-// reprendre liste en entree (niveau pas atteint) ou resultat (niveau atteint)
- if (exp.NbEntities() == 0) {
- j = result.Add (ent);
- continue;
- } else if (level == thelevel) {
- for (exp.Start(); exp.More(); exp.Next()) j = result.Add (exp.Value());
- } else {
- for (exp.Start(); exp.More(); exp.Next()) j = entrees.Add (exp.Value());
- }
- }
-
-// On recolte le resultat
- Interface_EntityIterator res;
- nb = result.Extent();
- for (j = 1; j <= nb; j ++) res.AddItem (result.FindKey(j));
- return res;
-}
-
-
- TCollection_AsciiString IFSelect_SelectExplore::Label () const
-{
- TCollection_AsciiString labl;
- if (thelevel == 0) labl.AssignCat("(Recursive)");
- else if (thelevel > 0) {
- char lab[30];
- sprintf (lab,"(Level %d)",thelevel);
- labl.AssignCat(lab);
- }
- labl.AssignCat(ExploreLabel());
- return labl;
-}
+++ /dev/null
-// Created on: 1996-09-25
-// 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_SelectExplore_HeaderFile
-#define _IFSelect_SelectExplore_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Integer.hxx>
-#include <IFSelect_SelectDeduct.hxx>
-class Interface_EntityIterator;
-class Interface_Graph;
-class Standard_Transient;
-class TCollection_AsciiString;
-
-
-class IFSelect_SelectExplore;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectExplore, IFSelect_SelectDeduct)
-
-//! A SelectExplore determines from an input list of Entities,
-//! a list obtained by a way of exploration. This implies the
-//! possibility of recursive exploration : the output list is
-//! itself reused as input, etc...
-//! Examples : Shared Entities, can be considered at one level
-//! (immediate shared) or more, or max level
-//!
-//! Then, for each input entity, if it is not rejected, it can be
-//! either taken itself, or explored : it then produces a list.
-//! According to a level, either the produced lists or taken
-//! entities give the result (level one), or lists are themselves
-//! considered and for each item, is it taken or explored.
-//!
-//! Remark that rejection is just a safety : normally, an input
-//! entity is, either taken itself, or explored
-//! A maximum level can be specified. Else, the process continues
-//! until all entities have been either taken or rejected
-class IFSelect_SelectExplore : public IFSelect_SelectDeduct
-{
-
-public:
-
-
- //! Returns the required exploring level
- Standard_EXPORT Standard_Integer Level() const;
-
- //! Returns the list of selected entities. Works by calling the
- //! method Explore on each input entity : it can be rejected,
- //! taken for output, or to explore. If the maximum level has not
- //! yet been attained, or if no max level is specified, entities
- //! to be explored are themselves used as if they were input
- Standard_EXPORT Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! Analyses and, if required, Explores an entity, as follows :
- //! The explored list starts as empty, it has to be filled by this
- //! method.
- //! If it returns False, <ent> is rejected for result (this is to
- //! be used only as safety)
- //! If it returns True and <explored> remains empty, <ent> is
- //! taken itself for result, not explored
- //! If it returns True and <explored> is not empty, the content
- //! of this list is considered :
- //! If maximum level is attained, it is taken for result
- //! Else (or no max), each of its entity will be itself explored
- Standard_EXPORT virtual Standard_Boolean Explore (const Standard_Integer level, const Handle(Standard_Transient)& ent, const Interface_Graph& G, Interface_EntityIterator& explored) const = 0;
-
- //! Returns a text saying "(Recursive)" or "(Level nn)" plus
- //! specific criterium returned by ExploreLabel (see below)
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
- //! Returns a text defining the way of exploration
- Standard_EXPORT virtual TCollection_AsciiString ExploreLabel() const = 0;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectExplore,IFSelect_SelectDeduct)
-
-protected:
-
-
- //! Initializes a SelectExplore : the level must be specified on
- //! starting. 0 means all levels, 1 means level one only, etc...
- Standard_EXPORT IFSelect_SelectExplore(const Standard_Integer level);
-
-
-
-private:
-
-
- Standard_Integer thelevel;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectExplore_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_SelectExtract.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectExtract,IFSelect_SelectDeduct)
-
-IFSelect_SelectExtract::IFSelect_SelectExtract ()
- { thesort = Standard_True; }
-
- Standard_Boolean IFSelect_SelectExtract::IsDirect () const
- { return thesort; }
-
- void IFSelect_SelectExtract::SetDirect (const Standard_Boolean direct)
- { thesort = direct; }
-
-
- Interface_EntityIterator IFSelect_SelectExtract::RootResult
- (const Interface_Graph& G) const
-{
- Interface_EntityIterator iter;
- Interface_EntityIterator inputer = InputResult(G); // tient compte de tout
- Handle(Interface_InterfaceModel) model = G.Model();
- Standard_Integer rank = 0;
- for (inputer.Start(); inputer.More(); inputer.Next()) {
- Handle(Standard_Transient) ent = inputer.Value();
- rank ++;
- if (SortInGraph(rank,ent,G) == thesort) iter.GetOneItem(ent);
- }
- return iter;
-}
-
-
- Standard_Boolean IFSelect_SelectExtract::SortInGraph
- (const Standard_Integer rank, const Handle(Standard_Transient)& ent,
- const Interface_Graph& G) const
- { return Sort (rank, ent, G.Model()); }
-
-
- TCollection_AsciiString IFSelect_SelectExtract::Label () const
-{
- TCollection_AsciiString labl;
- if ( thesort) labl.AssignCat("Picked: ");
- if (!thesort) labl.AssignCat("Removed: ");
- labl.AssignCat(ExtractLabel());
- return labl;
-}
+++ /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_SelectExtract_HeaderFile
-#define _IFSelect_SelectExtract_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectDeduct.hxx>
-#include <Standard_Integer.hxx>
-class Interface_EntityIterator;
-class Interface_Graph;
-class Standard_Transient;
-class Interface_InterfaceModel;
-class TCollection_AsciiString;
-
-
-class IFSelect_SelectExtract;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectExtract, IFSelect_SelectDeduct)
-
-//! A SelectExtract determines a list of Entities from an Input
-//! Selection, as a sub-list of the Input Result
-//! It works by applying a sort criterium on each Entity of the
-//! Input. This criterium can be applied Direct to Pick Items
-//! (default case) or Reverse to Remove Item
-//!
-//! Basic features (the unique Input) are inherited from SelectDeduct
-class IFSelect_SelectExtract : public IFSelect_SelectDeduct
-{
-
-public:
-
-
- //! Returns True if Sort criterium is Direct, False if Reverse
- Standard_EXPORT Standard_Boolean IsDirect() const;
-
- //! Sets Sort criterium sense to a new value
- //! (True : Direct , False : Reverse)
- Standard_EXPORT void SetDirect (const Standard_Boolean direct);
-
- //! Returns the list of selected entities. Works by calling the
- //! method Sort on each input Entity : the Entity is kept as
- //! output if Sort returns the same value as Direct status
- Standard_EXPORT virtual Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! Returns True for an Entity if it satisfies the Sort criterium
- //! It receives :
- //! - <rank>, the rank of the Entity in the Iteration,
- //! - <ent> , the Entity itself, and
- //! - <model>, the Starting Model
- //! Hence, the Entity to check is "model->Value(num)" (but an
- //! InterfaceModel allows other checks)
- //! This method is specific to each class of SelectExtract
- Standard_EXPORT virtual Standard_Boolean Sort (const Standard_Integer rank, const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const = 0;
-
- //! Works as Sort but works on the Graph
- //! Default directly calls Sort, but it can be redefined
- //! If SortInGraph is redefined, Sort should be defined even if
- //! not called (to avoid deferred methods in a final class)
- Standard_EXPORT virtual Standard_Boolean SortInGraph (const Standard_Integer rank, const Handle(Standard_Transient)& ent, const Interface_Graph& G) const;
-
- //! Returns a text saying "Picked" or "Removed", plus the
- //! specific criterium returned by ExtractLabel (see below)
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
- //! Returns a text defining the criterium for extraction
- Standard_EXPORT virtual TCollection_AsciiString ExtractLabel() const = 0;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectExtract,IFSelect_SelectDeduct)
-
-protected:
-
-
- //! Initializes a SelectExtract : enforces the sort to be Direct
- Standard_EXPORT IFSelect_SelectExtract();
-
-
-
-private:
-
-
- Standard_Boolean thesort;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectExtract_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_SelectFlag.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectFlag,IFSelect_SelectExtract)
-
-IFSelect_SelectFlag::IFSelect_SelectFlag (const Standard_CString flagname)
- : thename (flagname) { }
-
- Standard_CString IFSelect_SelectFlag::FlagName () const
- { return thename.ToCString(); }
-
-
- Interface_EntityIterator IFSelect_SelectFlag::RootResult
- (const Interface_Graph& G) const
-{
- Standard_Boolean direct = IsDirect();
- Interface_EntityIterator res;
- const Interface_BitMap& bm = G.BitMap();
- Standard_Integer flag = bm.FlagNumber (thename.ToCString());
- if (flag == 0) return res;
- Interface_EntityIterator inp = InputResult(G);
-
- for (inp.Start(); inp.More(); inp.Next()) {
- Standard_Integer num = G.EntityNumber(inp.Value());
- if (num == 0) continue;
- if (direct == bm.Value(num,flag)) res.AddItem (G.Entity(num));
- }
- return res;
-}
-
- Standard_Boolean IFSelect_SelectFlag::Sort
- (const Standard_Integer ,
- const Handle(Standard_Transient)&,
- const Handle(Interface_InterfaceModel)& ) const
- { return Standard_False; }
-
- TCollection_AsciiString IFSelect_SelectFlag::ExtractLabel () const
-{
- TCollection_AsciiString lab ("Entities Flagged by ");
- lab.AssignCat (thename);
- return lab;
-}
+++ /dev/null
-// Created on: 1995-09-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 _IFSelect_SelectFlag_HeaderFile
-#define _IFSelect_SelectFlag_HeaderFile
-
-#include <Standard.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <IFSelect_SelectExtract.hxx>
-#include <Standard_Integer.hxx>
-class Interface_EntityIterator;
-class Interface_Graph;
-class Standard_Transient;
-class Interface_InterfaceModel;
-
-
-class IFSelect_SelectFlag;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectFlag, IFSelect_SelectExtract)
-
-//! A SelectFlag queries a flag noted in the bitmap of the Graph.
-//! The Flag is designated by its Name. Flag Names are defined
-//! by Work Session and, as necessary, other functional objects
-//!
-//! WorkSession from IFSelect defines flag "Incorrect"
-//! Objects which control application running define some others
-class IFSelect_SelectFlag : public IFSelect_SelectExtract
-{
-
-public:
-
-
- //! Creates a Select Flag, to query a flag designated by its name
- Standard_EXPORT IFSelect_SelectFlag(const Standard_CString flagname);
-
- //! Returns the name of the flag
- Standard_EXPORT Standard_CString FlagName() const;
-
- //! Returns the list of selected entities. It is redefined to
- //! work on the graph itself (not queried by sort)
- //!
- //! An entity is selected if its flag is True on Direct mode,
- //! False on Reversed mode
- //!
- //! If flag does not exist for the given name, returns an empty
- //! result, whatever the Direct/Reversed sense
- Standard_EXPORT virtual Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! Returns always False because RootResult has done the work
- 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, includes the flag name
- Standard_EXPORT TCollection_AsciiString ExtractLabel() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectFlag,IFSelect_SelectExtract)
-
-protected:
-
-
-
-
-private:
-
-
- TCollection_AsciiString thename;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectFlag_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_SelectInList.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectInList,IFSelect_SelectAnyList)
-
-// .... Specialisation de SelectAnyList dans laquelle on traite une liste
-// dont chaque item est une Entite
-void IFSelect_SelectInList::FillResult
- (const Standard_Integer n1, const Standard_Integer n2,
- const Handle(Standard_Transient)& ent,
- Interface_EntityIterator& result) const
-{
- for (Standard_Integer i = n1; i <= n2; i ++)
- result.GetOneItem (ListedEntity(i,ent));
-}
+++ /dev/null
-// Created on: 1993-01-07
-// 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_SelectInList_HeaderFile
-#define _IFSelect_SelectInList_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectAnyList.hxx>
-#include <Standard_Integer.hxx>
-class Standard_Transient;
-class Interface_EntityIterator;
-
-
-class IFSelect_SelectInList;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectInList, IFSelect_SelectAnyList)
-
-//! A SelectInList kind Selection selects a List of an Entity,
-//! which is composed of single Entities
-//! To know the list on which to work, SelectInList has two
-//! deferred methods : NbItems (inherited from SelectAnyList) and
-//! ListedEntity (which gives an item as an Entity) which must be
-//! defined to get a List in an Entity of the required Type (and
-//! consider that list is empty if Entity has not required Type)
-//!
-//! As for SelectAnyList, if a type of Entity defines several
-//! lists, a given sub-class of SelectInList is attached on one
-class IFSelect_SelectInList : public IFSelect_SelectAnyList
-{
-
-public:
-
-
- //! Returns an Entity, given its rank in the list
- Standard_EXPORT virtual Handle(Standard_Transient) ListedEntity (const Standard_Integer num, const Handle(Standard_Transient)& ent) const = 0;
-
- //! Puts into the result, the sub-entities of the list, from n1 to
- //! n2 included. Remark that adequation with Entity's type and
- //! length of list has already been made at this stage
- //! Called by RootResult; calls ListedEntity (see below)
- Standard_EXPORT void FillResult (const Standard_Integer n1, const Standard_Integer n2, const Handle(Standard_Transient)& ent, Interface_EntityIterator& result) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectInList,IFSelect_SelectAnyList)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectInList_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_SelectIncorrectEntities.hxx>
-#include <Standard_Type.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectIncorrectEntities,IFSelect_SelectFlag)
-
-IFSelect_SelectIncorrectEntities::IFSelect_SelectIncorrectEntities ()
- : IFSelect_SelectFlag ("Incorrect") { }
+++ /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_SelectIncorrectEntities_HeaderFile
-#define _IFSelect_SelectIncorrectEntities_HeaderFile
-
-#include <Standard.hxx>
-
-#include <IFSelect_SelectFlag.hxx>
-
-
-class IFSelect_SelectIncorrectEntities;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectIncorrectEntities, IFSelect_SelectFlag)
-
-//! A SelectIncorrectEntities sorts the Entities which have been
-//! noted as Incorrect in the Graph of the Session
-//! (flag "Incorrect")
-//! It can find a result only if ComputeCheck has formerly been
-//! called on the WorkSession. Else, its result will be empty.
-class IFSelect_SelectIncorrectEntities : public IFSelect_SelectFlag
-{
-
-public:
-
-
- //! Creates a SelectIncorrectEntities
- //! i.e. a SelectFlag("Incorrect")
- Standard_EXPORT IFSelect_SelectIncorrectEntities();
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectIncorrectEntities,IFSelect_SelectFlag)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectIncorrectEntities_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 <IFSelect_SelectIntersection.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectIntersection,IFSelect_SelectCombine)
-
-IFSelect_SelectIntersection::IFSelect_SelectIntersection () { }
-
-
- Interface_EntityIterator IFSelect_SelectIntersection::RootResult
- (const Interface_Graph& G) const
-{
- IFGraph_Compare GC(G);
- Standard_Integer nb = NbInputs();
- for (Standard_Integer i = 1; i <= nb; i ++) {
- GC.GetFromIter(Input(i)->RootResult(G), (i==1));
- if (i > 1 && i < nb) {
- Interface_EntityIterator comm = GC.Common();
- GC.ResetData();
- GC.GetFromIter (comm,Standard_True);
- }
- }
- return GC.Common();
-}
-
- TCollection_AsciiString IFSelect_SelectIntersection::Label () const
- { return TCollection_AsciiString("Intersection (AND)"); }
+++ /dev/null
-// Created on: 1993-01-11
-// 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_SelectIntersection_HeaderFile
-#define _IFSelect_SelectIntersection_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectCombine.hxx>
-class Interface_EntityIterator;
-class Interface_Graph;
-class TCollection_AsciiString;
-
-
-class IFSelect_SelectIntersection;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectIntersection, IFSelect_SelectCombine)
-
-//! A SelectIntersection filters the Entities issued from several
-//! other Selections as Intersection of results : "AND" operator
-class IFSelect_SelectIntersection : public IFSelect_SelectCombine
-{
-
-public:
-
-
- //! Creates an empty SelectIntersection
- Standard_EXPORT IFSelect_SelectIntersection();
-
- //! Returns the list of selected Entities, which is the common part
- //! of results from all input selections. Uniqueness is guaranteed.
- Standard_EXPORT Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! Returns a text defining the criterium : "Intersection (AND)"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectIntersection,IFSelect_SelectCombine)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectIntersection_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_SelectModelEntities.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_SelectModelEntities,IFSelect_SelectBase)
-
-IFSelect_SelectModelEntities::IFSelect_SelectModelEntities () { }
-
- Interface_EntityIterator IFSelect_SelectModelEntities::RootResult
- (const Interface_Graph& G) const
- { return G.Model()->Entities(); }
-
- Interface_EntityIterator IFSelect_SelectModelEntities::CompleteResult
- (const Interface_Graph& G) const
- { return G.Model()->Entities(); }
-
- TCollection_AsciiString IFSelect_SelectModelEntities::Label () const
-{ return TCollection_AsciiString("All Entities from Model"); }
+++ /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_SelectModelEntities_HeaderFile
-#define _IFSelect_SelectModelEntities_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectBase.hxx>
-class Interface_EntityIterator;
-class Interface_Graph;
-class TCollection_AsciiString;
-
-
-class IFSelect_SelectModelEntities;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectModelEntities, IFSelect_SelectBase)
-
-//! A SelectModelEntities gets all the Entities of an
-//! InterfaceModel.
-class IFSelect_SelectModelEntities : public IFSelect_SelectBase
-{
-
-public:
-
-
- //! Creates a SelectModelRoot
- Standard_EXPORT IFSelect_SelectModelEntities();
-
- //! Returns the list of selected entities : the Entities of the
- //! Model (note that this result assures naturally uniqueness)
- Standard_EXPORT Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! The complete list of Entities (including shared ones) ...
- //! is exactly identical to RootResults in this case
- Standard_EXPORT virtual Interface_EntityIterator CompleteResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! Returns a text defining the criterium : "Model Entities"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectModelEntities,IFSelect_SelectBase)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectModelEntities_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_SelectModelRoots.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectModelRoots,IFSelect_SelectBase)
-
-IFSelect_SelectModelRoots::IFSelect_SelectModelRoots () { }
-
- Interface_EntityIterator IFSelect_SelectModelRoots::RootResult
- (const Interface_Graph& G) const
- { return G.RootEntities(); }
-
- TCollection_AsciiString IFSelect_SelectModelRoots::Label () const
-{ return TCollection_AsciiString("Root (not shared) Entities from Model"); }
+++ /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_SelectModelRoots_HeaderFile
-#define _IFSelect_SelectModelRoots_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectBase.hxx>
-class Interface_EntityIterator;
-class Interface_Graph;
-class TCollection_AsciiString;
-
-
-class IFSelect_SelectModelRoots;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectModelRoots, IFSelect_SelectBase)
-
-//! A SelectModelRoots gets all the Root Entities of an
-//! InterfaceModel. Remember that a "Root Entity" is defined as
-//! having no Sharing Entity (if there is a Loop between Entities,
-//! none of them can be a "Root").
-class IFSelect_SelectModelRoots : public IFSelect_SelectBase
-{
-
-public:
-
-
- //! Creates a SelectModelRoot
- Standard_EXPORT IFSelect_SelectModelRoots();
-
- //! Returns the list of selected entities : the Roots of the Model
- //! (note that this result assures naturally uniqueness)
- Standard_EXPORT Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! Returns a text defining the criterium : "Model Roots"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectModelRoots,IFSelect_SelectBase)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectModelRoots_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_SelectPointed.hxx>
-#include <IFSelect_Transformer.hxx>
-#include <Interface_CopyControl.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_MapOfTransient.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectPointed,IFSelect_SelectBase)
-
-IFSelect_SelectPointed::IFSelect_SelectPointed ()
- : theset (Standard_False) { }
-
- void IFSelect_SelectPointed::Clear()
- { theitems.Clear(); theset = Standard_False; }
-
- Standard_Boolean IFSelect_SelectPointed::IsSet () const
- { return theset; }
-
- void IFSelect_SelectPointed::SetEntity
- (const Handle(Standard_Transient)& ent)
-{
- theitems.Clear();
- theset = Standard_True;
- if (ent.IsNull()) return;
- theitems.Append (ent);
-}
-
- void IFSelect_SelectPointed::SetList
- (const Handle(TColStd_HSequenceOfTransient)& list)
-{
- theitems.Clear();
- theset = Standard_True;
- if (list.IsNull()) return;
- Standard_Integer i,nb = list->Length();
- for (i = 1; i <= nb; i ++) theitems.Append (list->Value(i));
-}
-
-// .... Editions
-
- Standard_Boolean IFSelect_SelectPointed::Add
- (const Handle(Standard_Transient)& item)
-{
- if (item.IsNull()) return Standard_False;
- for (Standard_Integer i = theitems.Length(); i >= 1; i --)
- if (item == theitems.Value(i)) return Standard_False;
- theitems.Append(item);
- theset = Standard_True;
- return Standard_True;
-}
-
- Standard_Boolean IFSelect_SelectPointed::Remove
- (const Handle(Standard_Transient)& item)
-{
- if (item.IsNull()) return Standard_False;
- for (Standard_Integer i = theitems.Length(); i >= 1; i --)
- if (item == theitems.Value(i)) { theitems.Remove(i); return Standard_True;}
- return Standard_True;
-}
-
- Standard_Boolean IFSelect_SelectPointed::Toggle
- (const Handle(Standard_Transient)& item)
-{
- if (item.IsNull()) return Standard_False;
- Standard_Integer num = 0;
- for (Standard_Integer i = theitems.Length(); i >= 1; i --)
- if (item == theitems.Value(i)) num = i;
- if (num == 0) theitems.Append(item);
- else theitems.Remove(num);
- return (num == 0);
-}
-
- Standard_Boolean IFSelect_SelectPointed::AddList
- (const Handle(TColStd_HSequenceOfTransient)& list)
-{
-// Optimise avec une Map
- Standard_Boolean res = Standard_False;
- if (list.IsNull()) return res;
- Standard_Integer i, nb = theitems.Length(), nl = list->Length();
- TColStd_MapOfTransient deja (nb+nl+1);
- for (i = 1; i <= nb; i ++) deja.Add (theitems.Value(i));
-
- for (i = 1; i <= nl; i ++) {
- if (!deja.Contains (list->Value(i)) ) theitems.Append (list->Value(i));
- }
- theset = Standard_True;
- return res;
-}
-
- Standard_Boolean IFSelect_SelectPointed::RemoveList
- (const Handle(TColStd_HSequenceOfTransient)& list)
-{
- Standard_Boolean res = Standard_False;
- if (list.IsNull()) return res;
- Standard_Integer i, nb = list->Length();
- for (i = 1; i <= nb; i ++) res |= Remove (list->Value(i));
- return res;
-}
-
- Standard_Boolean IFSelect_SelectPointed::ToggleList
- (const Handle(TColStd_HSequenceOfTransient)& list)
-{
- Standard_Boolean res = Standard_True;
- if (list.IsNull()) return res;
- Standard_Integer i, nb = list->Length();
- for (i = 1; i <= nb; i ++) res |= Toggle (list->Value(i));
- return res;
-}
-
-
-// .... Consultations
-
- Standard_Integer IFSelect_SelectPointed::Rank
- (const Handle(Standard_Transient)& item) const
-{
- if (item.IsNull()) return 0;
- for (Standard_Integer i = theitems.Length(); i >= 1; i --)
- if (item == theitems.Value(i)) return i;
- return 0;
-}
-
- Standard_Integer IFSelect_SelectPointed::NbItems () const
- { return theitems.Length(); }
-
- Handle(Standard_Transient) IFSelect_SelectPointed::Item
- (const Standard_Integer num) const
-{
- Handle(Standard_Transient) item;
- if (num <= 0 || num > theitems.Length()) return item;
- return theitems.Value(num);
-}
-
- void IFSelect_SelectPointed::Update
- (const Handle(Interface_CopyControl)& control)
-{
- Standard_Integer nb = theitems.Length();
- for (Standard_Integer i = nb; i > 0; i --) {
- Handle(Standard_Transient) enfr, ento;
- enfr = theitems.Value(i);
- if (!control->Search(enfr,ento)) theitems.Remove(i);
- else theitems.SetValue(i,ento);
- }
-}
-
- 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
- (const Interface_Graph& G) const
-{
- Interface_EntityIterator result;
- Standard_Integer nb = theitems.Length();
- for (Standard_Integer i = 1; i <= nb; i ++) {
- Handle(Standard_Transient) item = theitems.Value(i);
- if (G.EntityNumber(item) > 0) result.GetOneItem(item);
- }
- return result;
-}
-
- TCollection_AsciiString IFSelect_SelectPointed::Label () const
- { return TCollection_AsciiString ("Pointed Entities"); }
+++ /dev/null
-// Created on: 1994-05-30
-// 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_SelectPointed_HeaderFile
-#define _IFSelect_SelectPointed_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectBase.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <Standard_Integer.hxx>
-class Standard_Transient;
-class Interface_CopyControl;
-class IFSelect_Transformer;
-class Interface_EntityIterator;
-class Interface_Graph;
-class TCollection_AsciiString;
-
-
-class IFSelect_SelectPointed;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectPointed, IFSelect_SelectBase)
-
-//! This type of Selection is intended to describe a direct
-//! selection without an explicit criterium, for instance the
-//! result of picking viewed entities on a graphic screen
-//!
-//! It can also be used to provide a list as internal alternate
-//! input : this use implies to clear the list once queried
-class IFSelect_SelectPointed : public IFSelect_SelectBase
-{
-
-public:
-
-
- //! Creates a SelectPointed
- Standard_EXPORT IFSelect_SelectPointed();
-
- //! Clears the list of selected items
- //! Also says the list is unset
- //! All Add* methods and SetList say the list is set
- Standard_EXPORT void Clear();
-
- //! Tells if the list has been set. Even if empty
- Standard_EXPORT Standard_Boolean IsSet() const;
-
- //! As SetList but with only one entity
- //! If <ent> is Null, the list is said as being set but is empty
- Standard_EXPORT void SetEntity (const Handle(Standard_Transient)& item);
-
- //! Sets a given list to define the list of selected items
- //! <list> can be empty or null : in this case, the list is said
- //! as being set, but it is empty
- //!
- //! To use it as an alternate input, one shot :
- //! - SetList or SetEntity to define the input list
- //! - RootResult to get it
- //! - then Clear to drop it
- Standard_EXPORT void SetList (const Handle(TColStd_HSequenceOfTransient)& list);
-
- //! Adds an item. Returns True if Done, False if <item> is already
- //! in the selected list
- Standard_EXPORT Standard_Boolean Add (const Handle(Standard_Transient)& item);
-
- //! Removes an item. Returns True if Done, False if <item> was not
- //! in the selected list
- Standard_EXPORT Standard_Boolean Remove (const Handle(Standard_Transient)& item);
-
- //! Toggles status of an item : adds it if not pointed or removes
- //! it if already pointed. Returns the new status (Pointed or not)
- Standard_EXPORT Standard_Boolean Toggle (const Handle(Standard_Transient)& item);
-
- //! Adds all the items defined in a list. Returns True if at least
- //! one item has been added, False else
- Standard_EXPORT Standard_Boolean AddList (const Handle(TColStd_HSequenceOfTransient)& list);
-
- //! Removes all the items defined in a list. Returns True if at
- //! least one item has been removed, False else
- Standard_EXPORT Standard_Boolean RemoveList (const Handle(TColStd_HSequenceOfTransient)& list);
-
- //! Toggles status of all the items defined in a list : adds it if
- //! not pointed or removes it if already pointed.
- Standard_EXPORT Standard_Boolean ToggleList (const Handle(TColStd_HSequenceOfTransient)& list);
-
- //! Returns the rank of an item in the selected list, or 0.
- Standard_EXPORT Standard_Integer Rank (const Handle(Standard_Transient)& item) const;
-
- //! Returns the count of selected items
- Standard_EXPORT Standard_Integer NbItems() const;
-
- //! Returns an item given its rank, or a Null Handle
- Standard_EXPORT Handle(Standard_Transient) Item (const Standard_Integer num) const;
-
- //! Rebuilds the selected list. Any selected entity which has a
- //! 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).
- Standard_EXPORT Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! Returns a text which identifies the type of selection made.
- //! It is "Pointed Entities"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectPointed,IFSelect_SelectBase)
-
-protected:
-
-
-
-
-private:
-
-
- Standard_Boolean theset;
- TColStd_SequenceOfTransient theitems;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectPointed_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_SelectRange.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectRange,IFSelect_SelectExtract)
-
-IFSelect_SelectRange::IFSelect_SelectRange () { }
-
- void IFSelect_SelectRange::SetRange
- (const Handle(IFSelect_IntParam)& rankfrom,
- const Handle(IFSelect_IntParam)& rankto)
- { thelower = rankfrom; theupper = rankto; }
-
- void IFSelect_SelectRange::SetOne (const Handle(IFSelect_IntParam)& rank)
- { thelower = theupper = rank; }
-
- void IFSelect_SelectRange::SetFrom
- (const Handle(IFSelect_IntParam)& rankfrom)
- { thelower = rankfrom; theupper.Nullify(); }
-
- void IFSelect_SelectRange::SetUntil
- (const Handle(IFSelect_IntParam)& rankto)
- { thelower.Nullify(); theupper = rankto; }
-
-
- Standard_Boolean IFSelect_SelectRange::HasLower () const
- { return (!thelower.IsNull()); }
-
- Handle(IFSelect_IntParam) IFSelect_SelectRange::Lower () const
- { return thelower; }
-
- Standard_Integer IFSelect_SelectRange::LowerValue () const
-{
- if (thelower.IsNull()) return 0;
- return thelower->Value();
-}
-
- Standard_Boolean IFSelect_SelectRange::HasUpper () const
- { return (!theupper.IsNull()); }
-
- Handle(IFSelect_IntParam) IFSelect_SelectRange::Upper () const
- { return theupper; }
-
- Standard_Integer IFSelect_SelectRange::UpperValue () const
-{
- if (theupper.IsNull()) return 0;
- return theupper->Value();
-}
-
- Standard_Boolean IFSelect_SelectRange::Sort
- (const Standard_Integer rank, const Handle(Standard_Transient)& ,
- const Handle(Interface_InterfaceModel)& ) const
-{
- Standard_Integer rankfrom = 0;
- if (!thelower.IsNull()) rankfrom = thelower->Value();
- Standard_Integer rankto = 0;
- if (!theupper.IsNull()) rankto = theupper->Value();
- return (rank >= rankfrom && (rankto == 0 || rankto >= rank));
-}
-
- TCollection_AsciiString IFSelect_SelectRange::ExtractLabel () const
-{
- char lab[30];
- Standard_Integer rankfrom = 0;
- if (!thelower.IsNull()) rankfrom = thelower->Value();
- Standard_Integer rankto = 0;
- if (!theupper.IsNull()) rankto = theupper->Value();
- if (rankfrom == rankto) sprintf(lab,"Rank no %d",rankfrom);
- else if (rankfrom == 0) sprintf(lab,"Until no %d",rankto);
- else if (rankto == 0) sprintf(lab,"From no %d",rankto);
- else sprintf(lab,"From %d Until %d",rankfrom,rankto);
-
- return TCollection_AsciiString(lab);
-}
+++ /dev/null
-// Created on: 1992-11-18
-// 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_SelectRange_HeaderFile
-#define _IFSelect_SelectRange_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectExtract.hxx>
-#include <Standard_Integer.hxx>
-class IFSelect_IntParam;
-class Standard_Transient;
-class Interface_InterfaceModel;
-class TCollection_AsciiString;
-
-class IFSelect_SelectRange;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectRange, IFSelect_SelectExtract)
-
-//! A SelectRange keeps or rejects a sub-set of the input set,
-//! that is the Entities of which rank in the iteration list
-//! is in a given range (for instance form 2nd to 6th, etc...)
-class IFSelect_SelectRange : public IFSelect_SelectExtract
-{
-
-public:
-
-
- //! Creates a SelectRange. Default is Take all the input list
- Standard_EXPORT IFSelect_SelectRange();
-
- //! Sets a Range for numbers, with a lower and a upper limits
- //! Error if rankto is lower then rankfrom
- Standard_EXPORT void SetRange (const Handle(IFSelect_IntParam)& rankfrom, const Handle(IFSelect_IntParam)& rankto);
-
- //! Sets a unique number (only one Entity will be sorted as True)
- Standard_EXPORT void SetOne (const Handle(IFSelect_IntParam)& rank);
-
- //! Sets a Lower limit but no upper limit
- Standard_EXPORT void SetFrom (const Handle(IFSelect_IntParam)& rankfrom);
-
- //! Sets an Upper limit but no lower limit (equivalent to lower 1)
- Standard_EXPORT void SetUntil (const Handle(IFSelect_IntParam)& rankto);
-
- //! Returns True if a Lower limit is defined
- Standard_EXPORT Standard_Boolean HasLower() const;
-
- //! Returns Lower limit (if there is; else, value is senseless)
- Standard_EXPORT Handle(IFSelect_IntParam) Lower() const;
-
- //! Returns Value of Lower Limit (0 if none is defined)
- Standard_EXPORT Standard_Integer LowerValue() const;
-
- //! Returns True if a Lower limit is defined
- Standard_EXPORT Standard_Boolean HasUpper() const;
-
- //! Returns Upper limit (if there is; else, value is senseless)
- Standard_EXPORT Handle(IFSelect_IntParam) Upper() const;
-
- //! Returns Value of Upper Limit (0 if none is defined)
- Standard_EXPORT Standard_Integer UpperValue() const;
-
- //! Returns True for an Entity of which occurrence number in the
- //! iteration is inside the selected Range (considers <rank>)
- 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 : following cases,
- //! " From .. Until .." or "From .." or "Until .." or "Rank no .."
- Standard_EXPORT TCollection_AsciiString ExtractLabel() const Standard_OVERRIDE;
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectRange,IFSelect_SelectExtract)
-
-private:
-
- Handle(IFSelect_IntParam) thelower;
- Handle(IFSelect_IntParam) theupper;
-
-};
-
-#endif // _IFSelect_SelectRange_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_Cumulate.hxx>
-#include <IFGraph_StrongComponants.hxx>
-#include <IFSelect_SelectRootComps.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectRootComps,IFSelect_SelectExtract)
-
-IFSelect_SelectRootComps::IFSelect_SelectRootComps () { }
-
-
-// Refait pour travailler en une fois
-// ATTENTION, il ne faut pas s interesser aux ENTITES mais aux COMPOSANTS
-// c-a-d gerer les CYCLES s il y en a
-
- Interface_EntityIterator IFSelect_SelectRootComps::RootResult
- (const Interface_Graph& G) const
-{
- Interface_EntityIterator IEIinput = InputResult(G);
- Interface_EntityIterator iter;
-// ICI, extraire les Componants, puis considerer une Entite de chacun
- IFGraph_StrongComponants comps(G,Standard_False);
- comps.SetLoad();
- comps.GetFromIter(IEIinput);
- Interface_EntityIterator inp1; // IEIinput reduit a une Entite par Composant
-
- IFGraph_Cumulate GC(G);
-
-// On note dans le graphe : le cumul de chaque ensemble (Entite + Shared tous
-// niveaux). Les Roots initiales comptees une seule fois sont bonnes
-// Pour Entite : une par Componant (peu importe)
- for (comps.Start(); comps.More(); comps.Next()) {
- Handle(Standard_Transient) ent = comps.FirstEntity();
- GC.GetFromEntity(ent);
- inp1.GetOneItem(ent);
- }
-// A present, on retient, parmi les inputs, celles comptees une seule fois
-// (N.B.: on prend inp1, qui donne UNE entite par composant, simple ou cycle)
- for (inp1.Start(); inp1.More(); inp1.Next()) {
- Handle(Standard_Transient) ent = inp1.Value();
- if ((GC.NbTimes(ent) <= 1) == IsDirect()) iter.GetOneItem(ent);
- }
- return iter;
-}
-
- Standard_Boolean IFSelect_SelectRootComps::HasUniqueResult () const
- { return Standard_True; }
-
-
- Standard_Boolean IFSelect_SelectRootComps::Sort
- (const Standard_Integer , const Handle(Standard_Transient)& ,
- const Handle(Interface_InterfaceModel)& ) const
- { return Standard_True; }
-
- TCollection_AsciiString IFSelect_SelectRootComps::ExtractLabel () const
-{ return TCollection_AsciiString("Local Root Components"); }
+++ /dev/null
-// Created on: 1992-12-02
-// 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_SelectRootComps_HeaderFile
-#define _IFSelect_SelectRootComps_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectExtract.hxx>
-#include <Standard_Integer.hxx>
-class Interface_EntityIterator;
-class Interface_Graph;
-class Standard_Transient;
-class Interface_InterfaceModel;
-class TCollection_AsciiString;
-
-class IFSelect_SelectRootComps;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectRootComps, IFSelect_SelectExtract)
-
-//! A SelectRootComps sorts the Entities which are part of Strong
-//! Components, local roots of a set of Entities : they can be
-//! Single Components (containing one Entity) or Cycles
-//! This class gives a more secure result than SelectRoots (which
-//! considers only Single Components) but is longer to work : it
-//! can be used when there can be or there are cycles in a Model
-//! For each cycle, one Entity is given arbitrarily
-//! Reject works as for SelectRoots : Strong Components defined in
-//! the input list which are not local roots are given
-class IFSelect_SelectRootComps : public IFSelect_SelectExtract
-{
-
-public:
-
- //! Creates a SelectRootComps
- Standard_EXPORT IFSelect_SelectRootComps();
-
- //! Returns the list of local root strong components, by one Entity per component.
- //! It is redefined for a purpose of efficiency : calling a Sort routine for each Entity would
- //! cost more resources than to work in once using a Map
- //! RootResult takes in account the Direct status
- Standard_EXPORT virtual Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! Returns always True, because RootResult has done work
- 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 : "Local Root Components"
- Standard_EXPORT TCollection_AsciiString ExtractLabel() const Standard_OVERRIDE;
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectRootComps,IFSelect_SelectExtract)
-
-protected:
-
- //! Returns True, RootResult assuring uniqueness
- Standard_EXPORT virtual Standard_Boolean HasUniqueResult() const Standard_OVERRIDE;
-
-};
-
-#endif // _IFSelect_SelectRootComps_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_Cumulate.hxx>
-#include <IFSelect_SelectRoots.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectRoots,IFSelect_SelectExtract)
-
-IFSelect_SelectRoots::IFSelect_SelectRoots () { }
-
-
-// Refait pour travailler en une fois
-
- Interface_EntityIterator IFSelect_SelectRoots::RootResult
- (const Interface_Graph& G) const
-{
- Interface_EntityIterator input = InputResult(G);
- Interface_EntityIterator iter;
- IFGraph_Cumulate GC(G);
-
-// On note dans le graphe : le cumul de chaque ensemble (Entite + Shared tous
-// niveaux). Les Roots initiales comptees une seule fois sont bonnes
- for (input.Start(); input.More(); input.Next()) {
- Handle(Standard_Transient) ent = input.Value();
- GC.GetFromEntity(ent);
- }
-// A present, on retient, parmi les inputs, celles comptees une seule fois
- for (input.Start(); input.More(); input.Next()) {
- Handle(Standard_Transient) ent = input.Value();
- if ((GC.NbTimes(ent) <= 1) == IsDirect()) iter.GetOneItem(ent);
- }
- return iter;
-}
-
- Standard_Boolean IFSelect_SelectRoots::HasUniqueResult () const
- { return Standard_True; }
-
- Standard_Boolean IFSelect_SelectRoots::Sort
- (const Standard_Integer , const Handle(Standard_Transient)& ,
- const Handle(Interface_InterfaceModel)& ) const
- { return Standard_True; }
-
- TCollection_AsciiString IFSelect_SelectRoots::ExtractLabel () const
- { return TCollection_AsciiString("Local Roots"); }
+++ /dev/null
-// Created on: 1992-11-18
-// 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_SelectRoots_HeaderFile
-#define _IFSelect_SelectRoots_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectExtract.hxx>
-#include <Standard_Integer.hxx>
-class Interface_EntityIterator;
-class Interface_Graph;
-class Standard_Transient;
-class Interface_InterfaceModel;
-class TCollection_AsciiString;
-
-class IFSelect_SelectRoots;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectRoots, IFSelect_SelectExtract)
-
-//! A SelectRoots sorts the Entities which are local roots of a
-//! set of Entities (not shared by other Entities inside this set,
-//! even if they are shared by other Entities outside it)
-class IFSelect_SelectRoots : public IFSelect_SelectExtract
-{
-
-public:
-
- //! Creates a SelectRoots
- Standard_EXPORT IFSelect_SelectRoots();
-
- //! Returns the list of local roots.
- //! It is redefined for a purpose of efficiency:
- //! calling a Sort routine for each Entity would cost more resources
- //! than to work in once using a Map RootResult takes in account the Direct status.
- Standard_EXPORT virtual Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! Returns always True, because RootResult has done work
- 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 : "Local Root Entities"
- Standard_EXPORT TCollection_AsciiString ExtractLabel() const Standard_OVERRIDE;
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectRoots,IFSelect_SelectExtract)
-
-protected:
-
- //! Returns True, because RootResult assures uniqueness
- Standard_EXPORT virtual Standard_Boolean HasUniqueResult() const Standard_OVERRIDE;
-
-};
-
-#endif // _IFSelect_SelectRoots_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_SelectSent.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectSent,IFSelect_SelectExtract)
-
-IFSelect_SelectSent::IFSelect_SelectSent
- (const Standard_Integer sentcount, const Standard_Boolean atleast)
- { thecnt = sentcount; thelst = atleast; }
-
- Standard_Integer IFSelect_SelectSent::SentCount () const
- { return thecnt; }
-
- Standard_Boolean IFSelect_SelectSent::AtLeast () const
- { return thelst; }
-
- Interface_EntityIterator IFSelect_SelectSent::RootResult
- (const Interface_Graph& G) const
-{
- Standard_Boolean direct = IsDirect();
- Interface_EntityIterator res;
- Interface_EntityIterator inp = InputResult(G);
-
- for (inp.Start(); inp.More(); inp.Next()) {
- Standard_Integer num = G.EntityNumber(inp.Value());
- if (num == 0) continue;
- Standard_Integer nb = G.Status(num); // nb sent
- Standard_Boolean ok;
- if (thecnt == 0) ok = (nb == 0);
- else if (thelst) ok = (nb >= thecnt);
- else ok = (nb == thecnt);
- if (ok == direct) res.AddItem (G.Entity(num));
- }
- return res;
-}
-
- Standard_Boolean IFSelect_SelectSent::Sort
- (const Standard_Integer ,
- const Handle(Standard_Transient)&,
- const Handle(Interface_InterfaceModel)& ) const
- { return Standard_False; }
-
-
- TCollection_AsciiString IFSelect_SelectSent::ExtractLabel () const
-{
- char lb[80];
- TCollection_AsciiString lab;
- if (thecnt == 0) lab.AssignCat ("Remaining (non-sent) entities");
- if (thecnt == 1 && thelst) lab.AssignCat ("Sent entities");
- if (thecnt == 1 && !thelst) lab.AssignCat ("Sent once (non-duplicated) entities");
- if (thecnt == 2 && thelst) lab.AssignCat ("Sent several times entities");
- if (thecnt == 2 && !thelst) lab.AssignCat ("Sent just twice entities");
- if (thecnt > 2) {
- if (thelst) sprintf (lb,"Sent at least %d times entities", thecnt);
- else sprintf (lb,"Sent just %d times entities", thecnt);
- lab.AssignCat (lb);
- }
- return lab;
-}
+++ /dev/null
-// Created on: 1995-10-25
-// 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 _IFSelect_SelectSent_HeaderFile
-#define _IFSelect_SelectSent_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Integer.hxx>
-#include <IFSelect_SelectExtract.hxx>
-class Interface_EntityIterator;
-class Interface_Graph;
-class Standard_Transient;
-class Interface_InterfaceModel;
-class TCollection_AsciiString;
-
-
-class IFSelect_SelectSent;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectSent, IFSelect_SelectExtract)
-
-//! This class returns entities according sending to a file
-//! Once a model has been loaded, further sendings are recorded
-//! as status in the graph (for each value, a count of sendings)
-//!
-//! Hence, it is possible to query entities : sent ones (at least
-//! once), non-sent (i.e. remaining) ones, duplicated ones, etc...
-//!
-//! This selection performs this query
-class IFSelect_SelectSent : public IFSelect_SelectExtract
-{
-
-public:
-
-
- //! Creates a SelectSent :
- //! sentcount = 0 -> remaining (non-sent) entities
- //! sentcount = 1, atleast = True (D) -> sent (at least once)
- //! sentcount = 2, atleast = True -> duplicated (sent least twice)
- //! etc...
- //! sentcount = 1, atleast = False -> sent just once (non-dupl.d)
- //! sentcount = 2, atleast = False -> sent just twice
- //! etc...
- Standard_EXPORT IFSelect_SelectSent(const Standard_Integer sentcount = 1, const Standard_Boolean atleast = Standard_True);
-
- //! Returns the queried count of sending
- Standard_EXPORT Standard_Integer SentCount() const;
-
- //! Returns the <atleast> status, True for sending at least the
- //! sending count, False for sending exactly the sending count
- //! Remark : if SentCount is 0, AtLeast is ignored
- Standard_EXPORT Standard_Boolean AtLeast() const;
-
- //! Returns the list of selected entities. It is redefined to
- //! work on the graph itself (not queried by sort)
- //!
- //! An entity is selected if its count complies to the query in
- //! Direct Mode, rejected in Reversed Mode
- //!
- //! Query works on the sending count recorded as status in Graph
- Standard_EXPORT virtual Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! Returns always False because RootResult has done the work
- 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 : query :
- //! SentCount = 0 -> "Remaining (non-sent) entities"
- //! SentCount = 1, AtLeast = True -> "Sent entities"
- //! SentCount = 1, AtLeast = False -> "Sent once (no duplicated)"
- //! SentCount = 2, AtLeast = True -> "Sent several times entities"
- //! SentCount = 2, AtLeast = False -> "Sent twice entities"
- //! SentCount > 2, AtLeast = True -> "Sent at least <count> times entities"
- //! SentCount > 2, AtLeast = False -> "Sent <count> times entities"
- Standard_EXPORT TCollection_AsciiString ExtractLabel() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectSent,IFSelect_SelectExtract)
-
-protected:
-
-
-
-
-private:
-
-
- Standard_Integer thecnt;
- Standard_Boolean thelst;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectSent_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_SelectShared.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_GraphContent.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectShared,IFSelect_SelectDeduct)
-
-IFSelect_SelectShared::IFSelect_SelectShared () { }
-
-
-// Entites partagees par d autres (a 1 niveau et au sens Strict)
-
- Interface_EntityIterator IFSelect_SelectShared::RootResult
- (const Interface_Graph& G) const
-{
- Interface_EntityIterator iter = InputResult(G);
- Interface_Graph GG(G);
- for (iter.Start(); iter.More(); iter.Next()) {
- GG.GetFromIter(G.Shareds(iter.Value()),0);
- }
- return Interface_GraphContent(GG);
-}
-
- TCollection_AsciiString IFSelect_SelectShared::Label () const
- { return TCollection_AsciiString("Shared Entities (one level)"); }
+++ /dev/null
-// Created on: 1992-11-18
-// 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_SelectShared_HeaderFile
-#define _IFSelect_SelectShared_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectDeduct.hxx>
-class Interface_EntityIterator;
-class Interface_Graph;
-class TCollection_AsciiString;
-
-
-class IFSelect_SelectShared;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectShared, IFSelect_SelectDeduct)
-
-//! A SelectShared selects Entities which are directly Shared
-//! by the Entities of the Input list
-class IFSelect_SelectShared : public IFSelect_SelectDeduct
-{
-
-public:
-
-
- //! Creates a SelectShared;
- Standard_EXPORT IFSelect_SelectShared();
-
- //! Returns the list of selected entities (list of entities
- //! shared by those of input list)
- Standard_EXPORT Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! Returns a text defining the criterium : "Shared (one level)"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectShared,IFSelect_SelectDeduct)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectShared_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_SelectSharing.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_GraphContent.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectSharing,IFSelect_SelectDeduct)
-
-IFSelect_SelectSharing::IFSelect_SelectSharing () { }
-
-
-// Entites en partageant d autres (a 1 niveau et au sens Strict)
-
- Interface_EntityIterator IFSelect_SelectSharing::RootResult
- (const Interface_Graph& G) const
-{
- Interface_EntityIterator iter = InputResult(G);
- Interface_Graph GG(G);
- for (iter.Start(); iter.More(); iter.Next()) {
- GG.GetFromIter(G.Sharings(iter.Value()),0);
- }
- return Interface_GraphContent(GG);
-}
-
- TCollection_AsciiString IFSelect_SelectSharing::Label () const
- { return TCollection_AsciiString("Sharing Entities (one level)"); }
+++ /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_SelectSharing_HeaderFile
-#define _IFSelect_SelectSharing_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectDeduct.hxx>
-class Interface_EntityIterator;
-class Interface_Graph;
-class TCollection_AsciiString;
-
-
-class IFSelect_SelectSharing;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectSharing, IFSelect_SelectDeduct)
-
-//! A SelectSharing selects Entities which directly Share (Level
-//! One) the Entities of the Input list
-//! Remark : if an Entity of the Input List directly shares
-//! another one, it is of course present in the Result List
-class IFSelect_SelectSharing : public IFSelect_SelectDeduct
-{
-
-public:
-
-
- //! Creates a SelectSharing;
- Standard_EXPORT IFSelect_SelectSharing();
-
- //! Returns the list of selected entities (list of entities
- //! which share (level one) those of input list)
- Standard_EXPORT Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! Returns a text defining the criterium : "Sharing (one level)"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectSharing,IFSelect_SelectDeduct)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectSharing_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_SelectSignature.hxx>
-#include <IFSelect_Signature.hxx>
-#include <IFSelect_SignCounter.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectSignature,IFSelect_SelectExtract)
-
-// theexact : -1 OUI 0 NON une seule valeur > 0 NON nb de valeurs
-// signmode : 1 prendre si contenu, 2 refuser si contenu
-// 3 prendre si egal, 4 refuser si egal
-// ou test numerique, ajouter : 16 < 24 <= 32 > 40 >=
-static Standard_Integer multsign
- (const TCollection_AsciiString& signtext,
- TColStd_SequenceOfAsciiString& signlist,
- TColStd_SequenceOfInteger& signmode)
-{
- Standard_Integer i, nb = signtext.Length(), mode = 0;
- for (i = 1; i <= nb; i ++) {
- char unsign = signtext.Value(i);
- if (unsign == '|' || unsign == '!' || unsign == '=') { mode = 1; break; }
- if (unsign == '<' || unsign == '>') { mode = 1; break; }
- }
- if (mode == 0) return mode;
-// On va tronconner
- TCollection_AsciiString item; Standard_Integer imod = 1;
- for (i = 1; i <= nb; i ++) {
- char unsign = signtext.Value(i);
- if (unsign == '|' || unsign == '!') {
- if (item.Length() > 0) {
- signlist.Append (item);
- signmode.Append (imod);
- item.Clear();
- mode ++;
- }
- imod = (unsign == '|' ? 1 : 2);
- }
- else if (unsign == '<') imod += 16;
- else if (unsign == '>') imod += 32;
- else if (unsign == '=') { if (imod < 8) imod += 2; else imod += 8; }
- else item.AssignCat (unsign);
- }
- if (item.Length() > 0) {
- signlist.Append (item);
- signmode.Append (imod);
-// mode ++; valait un au depart
- }
- return mode;
-}
-
-
-
- IFSelect_SelectSignature::IFSelect_SelectSignature
- (const Handle(IFSelect_Signature)& matcher,
- const TCollection_AsciiString& signtext, const Standard_Boolean exact)
- : thematcher (matcher) , thesigntext (signtext) , theexact (exact ? -1 : 0)
-{ if (!exact) theexact = multsign (thesigntext,thesignlist,thesignmode); }
-
- IFSelect_SelectSignature::IFSelect_SelectSignature
- (const Handle(IFSelect_Signature)& matcher,
- const Standard_CString signtext, const Standard_Boolean exact)
- : thematcher (matcher) , thesigntext (signtext) , theexact (exact ? -1 : 0)
-{ if (!exact) theexact = multsign (thesigntext,thesignlist,thesignmode); }
-
- IFSelect_SelectSignature::IFSelect_SelectSignature
- (const Handle(IFSelect_SignCounter)& counter,
- const Standard_CString signtext, const Standard_Boolean exact)
- : thecounter (counter) , thesigntext (signtext) , theexact (exact ? -1 : 0)
-{ if (!exact) theexact = multsign (thesigntext,thesignlist,thesignmode); }
-
- Handle(IFSelect_Signature) IFSelect_SelectSignature::Signature () const
- { return thematcher; }
-
- Handle(IFSelect_SignCounter) IFSelect_SelectSignature::Counter () const
- { return thecounter; }
-
-
- Standard_Boolean IFSelect_SelectSignature::SortInGraph
- (const Standard_Integer , const Handle(Standard_Transient)& ent,
- const Interface_Graph& G) const
-{
- Standard_Boolean res;
- Standard_CString txt;
- Handle(Interface_InterfaceModel) model = G.Model();
- if (theexact <= 0) {
- if (!thematcher.IsNull()) return thematcher->Matches (ent,model,thesigntext, (theexact < 0));
- txt = thecounter->ComputedSign(ent,G);
- return IFSelect_Signature::MatchValue (txt,thesigntext , (theexact < 0));
- }
-
-// sinon : liste
-// Analyse en sequence : si alternance prend/prend-pas, le dernier a raison
-// en consequence, si que des prend ou que des prend-pas, c est commutatif
-// DONC recommendation : mettre les prend-pas en fin
-
-// AU DEPART : prendre = ne prendre que. prend-pas = prend-tout-sauf ...
-// Donc si le premier est un prend-pas, je commence par tout prendre
- Standard_Integer hmod = thesignmode.Value(1);
- Standard_Integer jmod = hmod/8;
- Standard_Integer imod = hmod - (jmod*8);
- res = (imod == 2 || imod == 4);
- for (Standard_Integer i = 1; i <= theexact; i ++) {
- Standard_CString signtext = thesignlist.Value(i).ToCString();
- hmod = thesignmode.Value(i);
- jmod = hmod/8;
- imod = hmod - (jmod*8);
- Standard_Boolean quid;
- if (jmod == 0) {
- if (!thematcher.IsNull()) quid = thematcher->Matches (ent,model,signtext,(imod > 2));
- else quid = IFSelect_Signature::MatchValue
- ( thecounter->ComputedSign(ent,G),signtext, (imod > 2) );
- }
- else {
- if (!thematcher.IsNull()) txt = thematcher->Value (ent,model);
- else txt = thecounter->ComputedSign (ent,G);
-
- Standard_Integer val = atoi(txt);
- Standard_Integer lav = atoi (signtext);
- switch (jmod) {
- case 2 : quid = (val < lav); break;
- case 3 : quid = (val <= lav); break;
- case 4 : quid = (val > lav); break;
- case 5 : quid = (val >= lav); break;
- default : quid = Standard_False; break;
- }
- }
- if ((imod == 1 || imod == 3) && quid) res = Standard_True;
- if ((imod == 2 || imod == 4) && quid) res = Standard_False;
- }
- return res;
-}
-
- Standard_Boolean IFSelect_SelectSignature::Sort
- (const Standard_Integer , const Handle(Standard_Transient)& /*ent*/,
- const Handle(Interface_InterfaceModel)& /*model*/) const
-{ return Standard_True; }
-
- const TCollection_AsciiString& IFSelect_SelectSignature::SignatureText () const
- { return thesigntext; }
-
- Standard_Boolean IFSelect_SelectSignature::IsExact () const
- { return (theexact < 0); }
-
- TCollection_AsciiString IFSelect_SelectSignature::ExtractLabel () const
-{
- TCollection_AsciiString lab;
- if (!thematcher.IsNull()) lab.AssignCat (thematcher->Name());
- else lab.AssignCat (thecounter->Name());
- if (theexact < 0) lab.AssignCat(" matching ");
- else if (theexact == 0) lab.AssignCat(" containing ");
- else lab.AssignCat(" matching list ");
- lab.AssignCat(thesigntext);
- return lab;
-}
+++ /dev/null
-// Created on: 1994-04-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_SelectSignature_HeaderFile
-#define _IFSelect_SelectSignature_HeaderFile
-
-#include <Standard.hxx>
-
-#include <Standard_Integer.hxx>
-#include <TColStd_SequenceOfAsciiString.hxx>
-#include <TColStd_SequenceOfInteger.hxx>
-#include <IFSelect_SelectExtract.hxx>
-class IFSelect_Signature;
-class IFSelect_SignCounter;
-class Standard_Transient;
-class Interface_Graph;
-class Interface_InterfaceModel;
-
-
-class IFSelect_SelectSignature;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectSignature, IFSelect_SelectExtract)
-
-//! A SelectSignature sorts the Entities on a Signature Matching.
-//! The signature to match is given at creation time. Also, the
-//! required match is given at creation time : exact (IsEqual) or
-//! contains (the Type's Name must contain the criterium Text)
-//!
-//! Remark that no more interpretation is done, it is an
-//! alpha-numeric signature : for instance, DynamicType is matched
-//! as such, super-types are not considered
-//!
-//! Also, numeric (integer) comparisons are supported : an item
-//! can be <val ou <=val or >val or >=val , val being an Integer
-//!
-//! A SelectSignature may also be created from a SignCounter,
-//! which then just gives its LastValue as SignatureValue
-class IFSelect_SelectSignature : public IFSelect_SelectExtract
-{
-
-public:
-
-
- //! Creates a SelectSignature with its Signature and its Text to
- //! Match.
- //! <exact> if True requires exact match,
- //! if False requires <signtext> to be contained in the Signature
- //! of the entity (default is "exact")
- Standard_EXPORT IFSelect_SelectSignature(const Handle(IFSelect_Signature)& matcher, const Standard_CString signtext, const Standard_Boolean exact = Standard_True);
-
- //! As above with an AsciiString
- Standard_EXPORT IFSelect_SelectSignature(const Handle(IFSelect_Signature)& matcher, const TCollection_AsciiString& signtext, const Standard_Boolean exact = Standard_True);
-
- //! Creates a SelectSignature with a Counter, more precisely a
- //! SelectSignature. Which is used here to just give a Signature
- //! Value (by SignOnly Mode)
- //! Matching is the default provided by the class Signature
- Standard_EXPORT IFSelect_SelectSignature(const Handle(IFSelect_SignCounter)& matcher, const Standard_CString signtext, const Standard_Boolean exact = Standard_True);
-
- //! Returns the used Signature, then it is possible to access it,
- //! modify it as required. Can be null, hence see Counter
- Standard_EXPORT Handle(IFSelect_Signature) Signature() const;
-
- //! Returns the used SignCounter. Can be used as alternative for
- //! Signature
- Standard_EXPORT Handle(IFSelect_SignCounter) Counter() const;
-
- //! Returns True for an Entity (model->Value(num)) of which the
- //! signature matches the text given as creation time
- //! May also work with a Counter from the Graph
- Standard_EXPORT virtual Standard_Boolean SortInGraph (const Standard_Integer rank, const Handle(Standard_Transient)& ent, const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! Not called, defined only to remove a deferred method here
- Standard_EXPORT Standard_Boolean Sort (const Standard_Integer rank, const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
-
- //! Returns Text used to Sort Entity on its Signature or SignCounter
- Standard_EXPORT const TCollection_AsciiString& SignatureText() const;
-
- //! Returns True if match must be exact
- Standard_EXPORT Standard_Boolean IsExact() const;
-
- //! Returns a text defining the criterium.
- //! (it refers to the text and exact flag to be matched, and is
- //! qualified by the Name provided by the Signature)
- Standard_EXPORT TCollection_AsciiString ExtractLabel() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectSignature,IFSelect_SelectExtract)
-
-protected:
-
-
-
-
-private:
-
-
- Handle(IFSelect_Signature) thematcher;
- Handle(IFSelect_SignCounter) thecounter;
- TCollection_AsciiString thesigntext;
- Standard_Integer theexact;
- TColStd_SequenceOfAsciiString thesignlist;
- TColStd_SequenceOfInteger thesignmode;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectSignature_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_SelectSignedShared.hxx>
-#include <IFSelect_Signature.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectSignedShared,IFSelect_SelectExplore)
-
-IFSelect_SelectSignedShared::IFSelect_SelectSignedShared
- (const Handle(IFSelect_Signature)& matcher,
- const Standard_CString signtext, const Standard_Boolean exact,
- const Standard_Integer level)
- : IFSelect_SelectExplore (level) ,
- thematcher (matcher) , thesigntext (signtext) , theexact (exact) { }
-
- Handle(IFSelect_Signature) IFSelect_SelectSignedShared::Signature () const
- { return thematcher; }
-
- const TCollection_AsciiString& IFSelect_SelectSignedShared::SignatureText () const
- { return thesigntext; }
-
- Standard_Boolean IFSelect_SelectSignedShared::IsExact () const
- { return theexact; }
-
-
- Standard_Boolean IFSelect_SelectSignedShared::Explore
- (const Standard_Integer level, const Handle(Standard_Transient)& ent,
- const Interface_Graph& G, Interface_EntityIterator& explored) const
-{
- if (thematcher->Matches (ent,G.Model(),thesigntext,theexact)) return Standard_True;
-
-// sinon, on fait le tri ici
- Interface_EntityIterator list = G.Shareds (ent);
-// Si plus de Shared, alors c est cuit
- if (list.NbEntities() == 0) return Standard_False;
-
-// Sinon, trier si on est au niveau
- if (level < Level()) { explored = list; return Standard_True; }
- for (list.Start(); list.More(); list.Next()) {
- if (thematcher->Matches (list.Value(),G.Model(),thesigntext,theexact))
- explored.AddItem (list.Value());
- }
- return Standard_True;
-}
-
-
- TCollection_AsciiString IFSelect_SelectSignedShared::ExploreLabel () const
-{
- TCollection_AsciiString lab("Shared,");
- lab.AssignCat (thematcher->Name());
- if (theexact) lab.AssignCat(" matching ");
- else lab.AssignCat(" containing ");
- lab.AssignCat(thesigntext);
- return lab;
-}
+++ /dev/null
-// Created on: 1996-09-25
-// 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_SelectSignedShared_HeaderFile
-#define _IFSelect_SelectSignedShared_HeaderFile
-
-#include <Standard.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <IFSelect_SelectExplore.hxx>
-#include <Standard_Integer.hxx>
-class IFSelect_Signature;
-class Standard_Transient;
-class Interface_Graph;
-class Interface_EntityIterator;
-
-
-class IFSelect_SelectSignedShared;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectSignedShared, IFSelect_SelectExplore)
-
-//! In the graph, explore the Shareds of the input entities,
-//! until it encounters some which match a given Signature
-//! (for a limited level, filters the returned list)
-//! By default, fitted for any level
-class IFSelect_SelectSignedShared : public IFSelect_SelectExplore
-{
-
-public:
-
-
- //! Creates a SelectSignedShared, defaulted for any level
- //! with a given Signature and text to match
- Standard_EXPORT IFSelect_SelectSignedShared(const Handle(IFSelect_Signature)& matcher, const Standard_CString signtext, const Standard_Boolean exact = Standard_True, const Standard_Integer level = 0);
-
- //! Returns the used Signature, then it is possible to access it,
- //! modify it as required
- Standard_EXPORT Handle(IFSelect_Signature) Signature() const;
-
- //! Returns Text used to Sort Entity on its Signature
- Standard_EXPORT const TCollection_AsciiString& SignatureText() const;
-
- //! Returns True if match must be exact
- Standard_EXPORT Standard_Boolean IsExact() const;
-
- //! Explores an entity : its Shared entities
- //! <ent> to take if it matches the Signature
- //! At level max, filters the result. Else gives all Shareds
- 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.
- //! (it refers to the text and exact flag to be matched, and is
- //! qualified by the Name provided by the Signature)
- Standard_EXPORT TCollection_AsciiString ExploreLabel() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectSignedShared,IFSelect_SelectExplore)
-
-protected:
-
-
-
-
-private:
-
-
- Handle(IFSelect_Signature) thematcher;
- TCollection_AsciiString thesigntext;
- Standard_Boolean theexact;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectSignedShared_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_SelectSignedSharing.hxx>
-#include <IFSelect_Signature.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectSignedSharing,IFSelect_SelectExplore)
-
-IFSelect_SelectSignedSharing::IFSelect_SelectSignedSharing
- (const Handle(IFSelect_Signature)& matcher,
- const Standard_CString signtext, const Standard_Boolean exact,
- const Standard_Integer level)
- : IFSelect_SelectExplore (level) ,
- thematcher (matcher) , thesigntext (signtext) , theexact (exact) { }
-
- Handle(IFSelect_Signature) IFSelect_SelectSignedSharing::Signature () const
- { return thematcher; }
-
- const TCollection_AsciiString& IFSelect_SelectSignedSharing::SignatureText () const
- { return thesigntext; }
-
- Standard_Boolean IFSelect_SelectSignedSharing::IsExact () const
- { return theexact; }
-
-
- Standard_Boolean IFSelect_SelectSignedSharing::Explore
- (const Standard_Integer level, const Handle(Standard_Transient)& ent,
- const Interface_Graph& G, Interface_EntityIterator& explored) const
-{
- if (thematcher->Matches (ent,G.Model(),thesigntext,theexact)) return Standard_True;
-
-// sinon, on fait le tri ici
- Interface_EntityIterator list = G.Sharings (ent);
-// Si plus de Sharing, alors c est cuit
- if (list.NbEntities() == 0) return Standard_False;
-
-// Sinon, trier si on est au niveau
- if (level < Level()) { explored = list; return Standard_True; }
- for (list.Start(); list.More(); list.Next()) {
- if (thematcher->Matches (list.Value(),G.Model(),thesigntext,theexact))
- explored.AddItem (list.Value());
- }
- return Standard_True;
-}
-
-
- TCollection_AsciiString IFSelect_SelectSignedSharing::ExploreLabel () const
-{
- TCollection_AsciiString lab("Sharing,");
- lab.AssignCat (thematcher->Name());
- if (theexact) lab.AssignCat(" matching ");
- else lab.AssignCat(" containing ");
- lab.AssignCat(thesigntext);
- return lab;
-}
+++ /dev/null
-// Created on: 1996-09-25
-// 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_SelectSignedSharing_HeaderFile
-#define _IFSelect_SelectSignedSharing_HeaderFile
-
-#include <Standard.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <IFSelect_SelectExplore.hxx>
-#include <Standard_Integer.hxx>
-class IFSelect_Signature;
-class Standard_Transient;
-class Interface_Graph;
-class Interface_EntityIterator;
-
-
-class IFSelect_SelectSignedSharing;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectSignedSharing, IFSelect_SelectExplore)
-
-//! In the graph, explore the sharings of the input entities,
-//! until it encounters some which match a given Signature
-//! (for a limited level, filters the returned list)
-//! By default, fitted for any level
-class IFSelect_SelectSignedSharing : public IFSelect_SelectExplore
-{
-
-public:
-
-
- //! Creates a SelectSignedSharing, defaulted for any level
- //! with a given Signature and text to match
- Standard_EXPORT IFSelect_SelectSignedSharing(const Handle(IFSelect_Signature)& matcher, const Standard_CString signtext, const Standard_Boolean exact = Standard_True, const Standard_Integer level = 0);
-
- //! Returns the used Signature, then it is possible to access it,
- //! modify it as required
- Standard_EXPORT Handle(IFSelect_Signature) Signature() const;
-
- //! Returns Text used to Sort Entity on its Signature
- Standard_EXPORT const TCollection_AsciiString& SignatureText() const;
-
- //! Returns True if match must be exact
- Standard_EXPORT Standard_Boolean IsExact() const;
-
- //! Explores an entity : its sharing entities
- //! <ent> to take if it matches the Signature
- //! At level max, filters the result. Else gives all sharings
- 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.
- //! (it refers to the text and exact flag to be matched, and is
- //! qualified by the Name provided by the Signature)
- Standard_EXPORT TCollection_AsciiString ExploreLabel() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectSignedSharing,IFSelect_SelectExplore)
-
-protected:
-
-
-
-
-private:
-
-
- Handle(IFSelect_Signature) thematcher;
- TCollection_AsciiString thesigntext;
- Standard_Boolean theexact;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectSignedSharing_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_SelectPointed.hxx>
-#include <IFSelect_SelectSuite.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectSuite,IFSelect_SelectDeduct)
-
-IFSelect_SelectSuite::IFSelect_SelectSuite () { }
-
- Standard_Boolean IFSelect_SelectSuite::AddInput
- (const Handle(IFSelect_Selection)& item)
-{
- if (item.IsNull()) return Standard_False;
- Handle(IFSelect_Selection) input = Input();
- if (!input.IsNull()) return Standard_False;
- Handle(IFSelect_SelectDeduct) first = Handle(IFSelect_SelectDeduct)::DownCast(item);
- if (first.IsNull()) SetInput(item);
- else thesel.Prepend (item);
- return Standard_True;
-}
-
- void IFSelect_SelectSuite::AddPrevious
- (const Handle(IFSelect_SelectDeduct)& item)
- { if (!item.IsNull()) thesel.Prepend (item); }
-
- void IFSelect_SelectSuite::AddNext
- (const Handle(IFSelect_SelectDeduct)& item)
- { if (!item.IsNull()) thesel.Append (item); }
-
- Standard_Integer IFSelect_SelectSuite::NbItems () const
- { return thesel.Length(); }
-
- Handle(IFSelect_SelectDeduct) IFSelect_SelectSuite::Item
- (const Standard_Integer num) const
- { return Handle(IFSelect_SelectDeduct)::DownCast(thesel.Value(num)); }
-
- void IFSelect_SelectSuite::SetLabel (const Standard_CString lab)
- { thelab.Clear(); thelab.AssignCat (lab); }
-
-
- Interface_EntityIterator IFSelect_SelectSuite::RootResult
- (const Interface_Graph& G) const
-{
- Interface_EntityIterator iter;
- Standard_Boolean firstin = (HasInput() || HasAlternate());
- if (firstin) iter = InputResult(G);
-// Demarrage : on prend l Input/Alternate SI un des 2 est mis
-// Sinon, on demarre sur la definition de base de la premiere selection
-
- Standard_Integer i, nb = NbItems();
- for (i = 1; i <= nb; i ++) {
- Handle(IFSelect_SelectDeduct) anitem = Item(i);
- if (firstin) anitem->Alternate()->SetList (iter.Content());
- firstin = Standard_True; // ensuite c est systematique
- iter = anitem->UniqueResult(G);
- }
- return iter;
-}
-
- TCollection_AsciiString IFSelect_SelectSuite::Label () const
-{
- if (thelab.Length() > 0) return thelab;
- char txt[100];
- sprintf (txt,"Suite of %d Selections",NbItems());
- TCollection_AsciiString lab(txt);
- return lab;
-}
+++ /dev/null
-// Created on: 1998-10-19
-// 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_SelectSuite_HeaderFile
-#define _IFSelect_SelectSuite_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_SequenceOfTransient.hxx>
-#include <IFSelect_SelectDeduct.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_CString.hxx>
-class IFSelect_Selection;
-class Interface_EntityIterator;
-class Interface_Graph;
-
-
-class IFSelect_SelectSuite;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectSuite, IFSelect_SelectDeduct)
-
-//! A SelectSuite can describe a suite of SelectDeduct as a unique
-//! one : in other words, it can be seen as a "macro selection"
-//!
-//! It works by applying each of its items (which is a
-//! SelectDeduct) on the result computed by the previous one
-//! (by using Alternate Input)
-//!
-//! But each of these Selections used as items may be used
-//! independently, it will then give its own result
-//!
-//! Hence, SelectSuite gives a way of defining a new Selection
-//! from existing ones, without having to do copies or saves
-class IFSelect_SelectSuite : public IFSelect_SelectDeduct
-{
-
-public:
-
-
- //! Creates an empty SelectSuite
- Standard_EXPORT IFSelect_SelectSuite();
-
- //! Adds an input selection. I.E. :
- //! If <item> is a SelectDeduct, adds it as Previous, not as Input
- //! Else, sets it as Input
- //! Returns True when done
- //! Returns False and refuses to work if Input is already defined
- Standard_EXPORT Standard_Boolean AddInput (const Handle(IFSelect_Selection)& item);
-
- //! Adds a new first item (prepends to the list). The Input is not
- //! touched
- //! If <item> is null, does nothing
- Standard_EXPORT void AddPrevious (const Handle(IFSelect_SelectDeduct)& item);
-
- //! Adds a new last item (prepends to the list)
- //! If <item> is null, does nothing
- Standard_EXPORT void AddNext (const Handle(IFSelect_SelectDeduct)& item);
-
- //! Returns the count of Items
- Standard_EXPORT Standard_Integer NbItems() const;
-
- //! Returns an item from its rank in the list
- //! (the Input is always apart)
- Standard_EXPORT Handle(IFSelect_SelectDeduct) Item (const Standard_Integer num) const;
-
- //! Sets a value for the Label
- Standard_EXPORT void SetLabel (const Standard_CString lab);
-
- //! Returns the list of selected entities
- //! To do this, once InputResult has been taken (if Input or
- //! Alternate has been defined, else the first Item gives it) :
- //! this result is set as alternate input for the first item,
- //! which computes its result : this result is set as alternate
- //! input for the second item, etc...
- Standard_EXPORT Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! Returns the Label
- //! Either it has been defined by SetLabel, or it will give
- //! "Suite of nn Selections"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectSuite,IFSelect_SelectDeduct)
-
-protected:
-
-
-
-
-private:
-
-
- TCollection_AsciiString thelab;
- TColStd_SequenceOfTransient thesel;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectSuite_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_SelectType.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectType,IFSelect_SelectAnyType)
-
-IFSelect_SelectType::IFSelect_SelectType ()
- { thetype = STANDARD_TYPE(Standard_Transient); }
-
- IFSelect_SelectType::IFSelect_SelectType (const Handle(Standard_Type)& atype)
- { thetype = atype; }
-
- void IFSelect_SelectType::SetType (const Handle(Standard_Type)& atype)
- { thetype = atype; }
-
- Handle(Standard_Type) IFSelect_SelectType::TypeForMatch () const
- { return thetype; }
-
- TCollection_AsciiString IFSelect_SelectType::ExtractLabel () const
- { return TCollection_AsciiString(thetype->Name()); }
+++ /dev/null
-// Created on: 1992-11-18
-// 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_SelectType_HeaderFile
-#define _IFSelect_SelectType_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Type.hxx>
-#include <IFSelect_SelectAnyType.hxx>
-class TCollection_AsciiString;
-
-
-class IFSelect_SelectType;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectType, IFSelect_SelectAnyType)
-
-//! A SelectType keeps or rejects Entities of which the Type
-//! is Kind of a given Cdl Type
-class IFSelect_SelectType : public IFSelect_SelectAnyType
-{
-
-public:
-
-
- //! Creates a SelectType. Default is no filter
- Standard_EXPORT IFSelect_SelectType();
-
- //! Creates a SelectType for a given Type
- Standard_EXPORT IFSelect_SelectType(const Handle(Standard_Type)& atype);
-
- //! Sets a TYpe for filter
- Standard_EXPORT void SetType (const Handle(Standard_Type)& atype);
-
- //! Returns the Type to be matched for select : this is the type
- //! given at instantiation time
- Standard_EXPORT Handle(Standard_Type) TypeForMatch() const Standard_OVERRIDE;
-
- //! Returns a text defining the criterium.
- //! (should by gotten from Type of Entity used for instantiation)
- Standard_EXPORT TCollection_AsciiString ExtractLabel() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectType,IFSelect_SelectAnyType)
-
-protected:
-
-
-
-
-private:
-
-
- Handle(Standard_Type) thetype;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectType_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_Cumulate.hxx>
-#include <IFSelect_SelectUnion.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectUnion,IFSelect_SelectCombine)
-
-IFSelect_SelectUnion::IFSelect_SelectUnion () { }
-
-
- Interface_EntityIterator IFSelect_SelectUnion::RootResult
- (const Interface_Graph& G) const
-{
- IFGraph_Cumulate GC(G);
- Standard_Integer nb = NbInputs();
- for (Standard_Integer i = 1; i <= nb; i ++)
- GC.GetFromIter(Input(i)->RootResult(G));
- return GC.Result();
-}
-
- TCollection_AsciiString IFSelect_SelectUnion::Label () const
- { return TCollection_AsciiString("Union (OR)"); }
+++ /dev/null
-// Created on: 1993-01-11
-// 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_SelectUnion_HeaderFile
-#define _IFSelect_SelectUnion_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectCombine.hxx>
-class Interface_EntityIterator;
-class Interface_Graph;
-class TCollection_AsciiString;
-
-
-class IFSelect_SelectUnion;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectUnion, IFSelect_SelectCombine)
-
-//! A SelectUnion cumulates the Entities issued from several other
-//! Selections (union of results : "OR" operator)
-class IFSelect_SelectUnion : public IFSelect_SelectCombine
-{
-
-public:
-
-
- //! Creates an empty SelectUnion
- Standard_EXPORT IFSelect_SelectUnion();
-
- //! Returns the list of selected Entities, which is the addition
- //! result from all input selections. Uniqueness is guaranteed.
- Standard_EXPORT Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! Returns a text defining the criterium : "Union (OR)"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectUnion,IFSelect_SelectCombine)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectUnion_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_SelectUnknownEntities.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SelectUnknownEntities,IFSelect_SelectExtract)
-
-IFSelect_SelectUnknownEntities::IFSelect_SelectUnknownEntities () { }
-
- Standard_Boolean IFSelect_SelectUnknownEntities::Sort
- (const Standard_Integer , const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& model) const
- { return model->IsUnknownEntity(model->Number(ent)); }
-
- TCollection_AsciiString IFSelect_SelectUnknownEntities::ExtractLabel () const
- { return TCollection_AsciiString("Unrecognized type Entities"); }
+++ /dev/null
-// Created on: 1992-11-18
-// 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_SelectUnknownEntities_HeaderFile
-#define _IFSelect_SelectUnknownEntities_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectExtract.hxx>
-#include <Standard_Integer.hxx>
-class Standard_Transient;
-class Interface_InterfaceModel;
-class TCollection_AsciiString;
-
-
-class IFSelect_SelectUnknownEntities;
-DEFINE_STANDARD_HANDLE(IFSelect_SelectUnknownEntities, IFSelect_SelectExtract)
-
-//! A SelectUnknownEntities sorts the Entities which are qualified
-//! as "Unknown" (their Type has not been recognized)
-class IFSelect_SelectUnknownEntities : public IFSelect_SelectExtract
-{
-
-public:
-
-
- //! Creates a SelectUnknownEntities
- Standard_EXPORT IFSelect_SelectUnknownEntities();
-
- //! Returns True for an Entity which is qualified as "Unknown",
- //! i.e. if <model> known <ent> (through its Number) as Unknown
- 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 Entities"
- Standard_EXPORT TCollection_AsciiString ExtractLabel() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SelectUnknownEntities,IFSelect_SelectExtract)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SelectUnknownEntities_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_Selection.hxx>
-#include <IFSelect_SelectionIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_GraphContent.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Selection,Standard_Transient)
-
-Standard_Boolean IFSelect_Selection::HasUniqueResult () const
- { return Standard_False; } // eminemment redefinissable
-
-// UniqueResult, c est RootResult passe par une Map (-> mis a plat)
-
- Interface_EntityIterator IFSelect_Selection::UniqueResult
- (const Interface_Graph& G) const
-{
- Interface_EntityIterator iter = RootResult(G);
- if (HasUniqueResult() || !G.ModeStat())
- return iter;
- Interface_Graph GG(G);
- GG.GetFromIter(iter,0);
- return Interface_GraphContent(GG); // EntityIterator specialise (meme taille)
-}
-
-// CompleteResult, c est RootResult + propagation du partage (Shareds)
-
- Interface_EntityIterator IFSelect_Selection::CompleteResult
- (const Interface_Graph& G) const
-{
- Interface_EntityIterator iter = RootResult(G);
-// On peut utiliser le Graphe a present
- Interface_Graph GG(G);
- for (iter.Start(); iter.More(); iter.Next()) {
- Handle(Standard_Transient) ent = iter.Value();
- GG.GetFromEntity(ent,Standard_True); // et voila
- }
- return Interface_GraphContent(GG); // EntityIterator specialise (meme taille)
-}
+++ /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_Selection_HeaderFile
-#define _IFSelect_Selection_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Transient.hxx>
-class Interface_EntityIterator;
-class Interface_Graph;
-class IFSelect_SelectionIterator;
-class TCollection_AsciiString;
-
-class IFSelect_Selection;
-DEFINE_STANDARD_HANDLE(IFSelect_Selection, Standard_Transient)
-
-//! A Selection allows to define a set of Interface Entities.
-//! Entities to be put on an output file should be identified in
-//! a way as independent from such or such execution as possible.
-//! This permits to handle comprehensive criteria, and to replay
-//! them when a new variant of an input file has to be processed.
-//!
-//! Its input can be, either an Interface Model (the very source),
-//! or another-other Selection(s) or any other output.
-//! All list computations start from an input Graph (from IFGraph)
-class IFSelect_Selection : public Standard_Transient
-{
-
-public:
-
- //! Returns the list of selected entities, computed from Input
- //! given as a Graph. Specific to each class of Selection
- //! Note that uniqueness of each entity is not required here
- //! This method can raise an exception as necessary
- Standard_EXPORT virtual Interface_EntityIterator RootResult (const Interface_Graph& G) const = 0;
-
- //! Returns the list of selected entities, each of them being
- //! unique. Default definition works from RootResult. According
- //! HasUniqueResult, UniqueResult returns directly RootResult,
- //! or build a Unique Result from it with a Graph.
- Standard_EXPORT Interface_EntityIterator UniqueResult (const Interface_Graph& G) const;
-
- //! Returns the list of entities involved by a Selection, i.e.
- //! UniqueResult plus the shared entities (directly or not)
- Standard_EXPORT virtual Interface_EntityIterator CompleteResult (const Interface_Graph& G) const;
-
- //! Puts in an Iterator the Selections from which "me" depends
- //! (there can be zero, or one, or a list).
- //! Specific to each class of Selection
- Standard_EXPORT virtual void FillIterator (IFSelect_SelectionIterator& iter) const = 0;
-
- //! Returns a text which defines the criterium applied by a
- //! Selection (can be used to be printed, displayed ...)
- //! Specific to each class
- Standard_EXPORT virtual TCollection_AsciiString Label() const = 0;
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_Selection,Standard_Transient)
-
-protected:
-
- //! Returns True if RootResult guarantees uniqueness for each
- //! Entity. Called by UniqueResult.
- //! Default answer is False. Can be redefined.
- Standard_EXPORT virtual Standard_Boolean HasUniqueResult() const;
-
-};
-
-#endif // _IFSelect_Selection_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_Selection.hxx>
-#include <IFSelect_SelectionIterator.hxx>
-#include <Standard_NoSuchObject.hxx>
-
-IFSelect_SelectionIterator::IFSelect_SelectionIterator ()
-{
- thecurr = 1;
- thelist = new IFSelect_HSeqOfSelection();
-}
-
- IFSelect_SelectionIterator::IFSelect_SelectionIterator
- (const Handle(IFSelect_Selection)& sel)
-{
- thecurr = 1;
- thelist = new IFSelect_HSeqOfSelection();
- sel->FillIterator(*this);
-}
-
- void IFSelect_SelectionIterator::AddFromIter (IFSelect_SelectionIterator& iter)
- { for (; iter.More(); iter.Next()) AddItem(iter.Value()); }
-
- void IFSelect_SelectionIterator::AddItem
- (const Handle(IFSelect_Selection)& sel)
- { if (!sel.IsNull()) thelist->Append(sel); }
-
- void IFSelect_SelectionIterator::AddList
- (const IFSelect_TSeqOfSelection& list)
-{
- Standard_Integer nb = list.Length(); // <list> Pas Handle <thelist> Handle
- for (Standard_Integer i = 1; i <= nb; i ++) thelist->Append(list.Value(i));
-}
-
- Standard_Boolean IFSelect_SelectionIterator::More () const
- { return (thecurr <= thelist->Length()); }
-
- void IFSelect_SelectionIterator::Next ()
- { thecurr ++; }
-
- const Handle(IFSelect_Selection)& IFSelect_SelectionIterator::Value () const
- { return thelist->Value(thecurr); }
+++ /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_SelectionIterator_HeaderFile
-#define _IFSelect_SelectionIterator_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Standard_Integer.hxx>
-#include <IFSelect_HSeqOfSelection.hxx>
-#include <IFSelect_TSeqOfSelection.hxx>
-class IFSelect_Selection;
-
-//! Defines an Iterator on a list of Selections
-class IFSelect_SelectionIterator
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
- //! Creates an empty iterator, ready to be filled
- Standard_EXPORT IFSelect_SelectionIterator();
-
- //! Creates an iterator from a Selection : it lists the Selections
- //! from which <sel> depends (given by its method FillIterator)
- Standard_EXPORT IFSelect_SelectionIterator(const Handle(IFSelect_Selection)& sel);
-
- //! Adds to an iterator the content of another one
- //! (each selection is present only once in the result)
- Standard_EXPORT void AddFromIter (IFSelect_SelectionIterator& iter);
-
- //! Adds a Selection to an iterator (if not yet noted)
- Standard_EXPORT void AddItem (const Handle(IFSelect_Selection)& sel);
-
- //! Adds a list of Selections to an iterator (this list comes
- //! from the description of a Selection or a Dispatch, etc...)
- Standard_EXPORT void AddList (const IFSelect_TSeqOfSelection& list);
-
- //! Returns True if there are more Selections to get
- Standard_EXPORT Standard_Boolean More() const;
-
- //! Sets iterator to the next item
- Standard_EXPORT void Next();
-
- //! Returns the current Selection being iterated
- //! Error if count of Selection has been passed
- Standard_EXPORT const Handle(IFSelect_Selection)& Value() const;
-
-private:
-
- Standard_Integer thecurr;
- Handle(IFSelect_HSeqOfSelection) thelist;
-
-};
-
-#endif // _IFSelect_SelectionIterator_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_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
-// 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_SequenceOfInterfaceModel_HeaderFile
-#define IFSelect_SequenceOfInterfaceModel_HeaderFile
-
-#include <Interface_InterfaceModel.hxx>
-#include <NCollection_Sequence.hxx>
-
-typedef NCollection_Sequence<Handle(Interface_InterfaceModel)> IFSelect_SequenceOfInterfaceModel;
-
-
-#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,Standard_Transient)
-
-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 <Standard_Transient.hxx>
-class IFSelect_SessionFile;
-class TCollection_AsciiString;
-
-
-class IFSelect_SessionDumper;
-DEFINE_STANDARD_HANDLE(IFSelect_SessionDumper, Standard_Transient)
-
-//! 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 Standard_Transient
-{
-
-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,Standard_Transient)
-
-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 <IFSelect_BasicDumper.hxx>
-#include <IFSelect_IntParam.hxx>
-#include <IFSelect_SelectAnyList.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)
-{
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
-
- SplitLine (headerline);
- if (theline.Length() != 4) { sout<<"File Form Incorrect"<<std::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"<<std::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.Clear();
- 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 ()
-{
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
-
- thedone = Standard_True;
-// ... Preparation Specifique
- thenums.Nullify();
- thenames.Clear();
-// .. Donnees generales, controle
- if (!ReadLine()) return 1;
- if (theline.Length() != 4) { sout<<"File Form Incorrect"<<std::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"<<std::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"<<std::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)<<std::endl; continue; }
- continue;
- }
- else sout<<"Lineno."<<thenl<<" : Unknown General Parameter : "<<ungen<<" , ignored"<<std::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"<<std::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"<<std::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"<<std::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"<<std::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"<<std::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"<<std::endl; continue; }
- DeclareAndCast(IFSelect_Selection,sel,ItemValue(1));
- if (sel.IsNull())
- { sout<<"Lineno."<<thenl<<" : A Source List is not for a Selection"<<std::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, following ignored"<<std::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, following ignored"<<std::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, following ignored"<<std::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"<<std::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"<<std::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"<<std::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"<<std::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"<<std::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"<<std::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"<<std::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"<<std::endl; return 1; }
-// if ( formod == 0 && ( theline.Length() != 1 ||
-// !theline.Value(1).IsEqual("!FILEMODIFIERS")) )
-// { sout<<"Lineno."<<thenl<<" : File Modifier List Incorrect"<<std::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"<<std::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"<<std::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 ()
-{
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if ( theline.Length() != 2 ||
- !theline.Value(1).IsEqual("!XSTEP") ||
- !theline.Value(2).IsEqual("END"))
- { sout<<"End of File Incorrect, lineno"<<thenl<<std::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)
-{
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
-
- 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"<<std::endl;
- return (!dumper.IsNull()); // IsNull -> echec
-}
-
-
- void IFSelect_SessionFile::AddItem
- (const Handle(Standard_Transient)& item, const Standard_Boolean active)
-{
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
-
- 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" << std::endl;
- thenames.Bind(name,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)
-{
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
-
- 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() << std::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
-{
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
-
- 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.Find(name, id)) {
- sout << " -- Item Unknown in File : " << name
- << " lineno " << thenl << " param." << nm << std::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 <NCollection_DataMap.hxx>
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <TColStd_HArray1OfInteger.hxx>
-#include <TColStd_SequenceOfAsciiString.hxx>
-#include <Standard_Integer.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <Standard_CString.hxx>
-
-class IFSelect_WorkSession;
-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 functionalities
-//! (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 Information (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 Information,
-//! 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 correctly 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 (preceded 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 preceded 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 preceded
- //! by ':', else a relative Ident Number is sent preceded 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 sequentially 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;
- NCollection_DataMap<TCollection_AsciiString, Standard_Integer> 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_Dispatch.hxx>
-#include <IFSelect_Modifier.hxx>
-#include <IFSelect_ShareOut.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_ShareOut,Standard_Transient)
-
-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[30],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 <Standard_Transient.hxx>
-class TCollection_HAsciiString;
-class IFSelect_Dispatch;
-class IFSelect_GeneralModifier;
-class IFSelect_Modifier;
-class TCollection_AsciiString;
-
-class IFSelect_ShareOut;
-DEFINE_STANDARD_HANDLE(IFSelect_ShareOut, Standard_Transient)
-
-//! This class gathers the information 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 Standard_Transient
-{
-
-public:
-
- //! Creates an empty ShareOut
- Standard_EXPORT IFSelect_ShareOut();
-
- //! Removes in one operation all the Dispatches with their Idents
- //! Also clears all information about Names, and all Results but
- //! naming information 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, information
- //! 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 value 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 recommended)
- 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,Standard_Transient)
-
-
-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_PacketList.hxx>
-#include <IFSelect_ShareOut.hxx>
-#include <IFSelect_ShareOutResult.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_GraphContent.hxx>
-#include <Interface_InterfaceModel.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
-// std::cout<<" ** ** IFSelect_ShareOutResult::Next, void dispatch ignored"<<std::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 ()
-{
-// IFGraph_Cumulate G(thegraph);
- 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_Integer.hxx>
-#include <Interface_Graph.hxx>
-#include <IFGraph_SubPartsIterator.hxx>
-class IFSelect_ShareOut;
-class IFSelect_Dispatch;
-class Interface_InterfaceModel;
-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 explicitly 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: 1999-02-17
-// Created by: Pavel DURANDIN
-// Copyright (c) 1999-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_SignAncestor.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SignAncestor,IFSelect_SignType)
-
-IFSelect_SignAncestor::IFSelect_SignAncestor (const Standard_Boolean nopk)
- : IFSelect_SignType (nopk) { }
-
-Standard_Boolean IFSelect_SignAncestor::Matches(const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& /*model*/,
- const TCollection_AsciiString& text,
- const Standard_Boolean /*exact*/) const
-{
- if (ent.IsNull()) return Standard_False;
- DeclareAndCast(Standard_Type,atype,ent);
- if (atype.IsNull()) atype = ent->DynamicType();
- return atype->SubType(text.ToCString());
-}
-
+++ /dev/null
-// Created on: 1999-02-17
-// Created by: Pavel DURANDIN
-// 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 _IFSelect_SignAncestor_HeaderFile
-#define _IFSelect_SignAncestor_HeaderFile
-
-#include <Standard.hxx>
-
-#include <IFSelect_SignType.hxx>
-class Standard_Transient;
-class Interface_InterfaceModel;
-class TCollection_AsciiString;
-
-
-class IFSelect_SignAncestor;
-DEFINE_STANDARD_HANDLE(IFSelect_SignAncestor, IFSelect_SignType)
-
-
-class IFSelect_SignAncestor : public IFSelect_SignType
-{
-
-public:
-
-
- Standard_EXPORT IFSelect_SignAncestor(const Standard_Boolean nopk = Standard_False);
-
- Standard_EXPORT virtual Standard_Boolean Matches (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model, const TCollection_AsciiString& text, const Standard_Boolean exact) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SignAncestor,IFSelect_SignType)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SignAncestor_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_SignCategory.hxx>
-#include <Interface_Category.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SignCategory,IFSelect_Signature)
-
-static Standard_CString nulsign = "";
-
-
- IFSelect_SignCategory::IFSelect_SignCategory ()
- : IFSelect_Signature ("Category")
-{
- Interface_Category::Init(); // si pas deja fait
- Standard_Integer i, nb = Interface_Category::NbCategories();
- for (i = 1; i <= nb; i ++) AddCase (Interface_Category::Name(i));
-}
-
-
- Standard_CString IFSelect_SignCategory::Value
- (const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& model) const
-{
- if (ent.IsNull() || model.IsNull()) return nulsign;
- return Interface_Category::Name(model->CategoryNumber (model->Number(ent)));
-}
+++ /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_SignCategory_HeaderFile
-#define _IFSelect_SignCategory_HeaderFile
-
-#include <Standard.hxx>
-
-#include <IFSelect_Signature.hxx>
-class Standard_Transient;
-class Interface_InterfaceModel;
-
-
-class IFSelect_SignCategory;
-DEFINE_STANDARD_HANDLE(IFSelect_SignCategory, IFSelect_Signature)
-
-//! This Signature returns the Category of an entity, as recorded
-//! in the model
-class IFSelect_SignCategory : public IFSelect_Signature
-{
-
-public:
-
-
- //! Returns a SignCategory
- Standard_EXPORT IFSelect_SignCategory();
-
- //! Returns the Signature for a Transient object, as its Category
- //! recorded in the model
- Standard_EXPORT Standard_CString Value (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SignCategory,IFSelect_Signature)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SignCategory_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_Selection.hxx>
-#include <IFSelect_Signature.hxx>
-#include <IFSelect_SignCounter.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SignCounter,IFSelect_SignatureList)
-
-IFSelect_SignCounter::IFSelect_SignCounter
- (const Standard_Boolean withmap, const Standard_Boolean withlist)
- : IFSelect_SignatureList (withlist)
-{
- themapstat = withmap; thenbcomp1 = thenbcomp2 = theselmode = 0;
-}
-
- IFSelect_SignCounter::IFSelect_SignCounter
- (const Handle(IFSelect_Signature)& matcher,
- const Standard_Boolean withmap, const Standard_Boolean withlist)
- : IFSelect_SignatureList (withlist) , thematcher (matcher)
-{
- themapstat = withmap; thenbcomp1 = thenbcomp2 = theselmode = 0;
- TCollection_AsciiString sign = thematcher->Name();
- SetName (sign.ToCString());
-}
-
- Handle(IFSelect_Signature) IFSelect_SignCounter::Signature () const
- { return thematcher; }
-
- void IFSelect_SignCounter::SetMap (const Standard_Boolean withmap)
- { themapstat = withmap; }
-
- Standard_Boolean IFSelect_SignCounter::AddEntity
- (const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& model)
-{
- if (themapstat && !ent.IsNull()) {
- if (themap.Contains(ent)) return Standard_False;
- themap.Add(ent);
- }
- AddSign (ent,model);
- return Standard_True;
-}
-
- void IFSelect_SignCounter::AddSign
- (const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& model)
-{
- char nulsign[2];
- nulsign[0] = '\0';
- if (ent.IsNull() || thematcher.IsNull())
- Add (ent, nulsign); // pour compter les Nuls
- else Add (ent, thematcher->Value(ent,model) );
-}
-
-
- void IFSelect_SignCounter::AddList
- (const Handle(TColStd_HSequenceOfTransient)& list,
- const Handle(Interface_InterfaceModel)& model)
-{
- if (list.IsNull()) return;
- Standard_Integer nb = list->Length();
- for (Standard_Integer i = 1; i <= nb; i ++) AddEntity(list->Value(i),model);
-}
-
- void IFSelect_SignCounter::AddWithGraph
- (const Handle(TColStd_HSequenceOfTransient)& list,
- const Interface_Graph& graph)
- { AddList (list,graph.Model()); }
-
-
- void IFSelect_SignCounter::AddModel
- (const Handle(Interface_InterfaceModel)& model)
-{
- if (model.IsNull()) return;
- Standard_Integer nb = model->NbEntities();
-// Si on part de vide, on sait que chque entite est unique dans le modele
- Standard_Boolean mapstat = themapstat;
- if (themap.Extent() == 0) themapstat = Standard_False;
- for (Standard_Integer i = 1; i <= nb; i ++) AddEntity(model->Value(i),model);
- themapstat = mapstat;
-}
-
- void IFSelect_SignCounter::AddFromSelection
- (const Handle(IFSelect_Selection)& sel, const Interface_Graph& G)
-{
- Interface_EntityIterator iter = sel->RootResult(G);
- AddWithGraph (iter.Content(),G);
-}
-
-// ############# SELECTION ##############
-
- void IFSelect_SignCounter::SetSelection
- (const Handle(IFSelect_Selection)& sel)
-{ theselect = sel; SetSelMode(-1); SetSelMode (sel.IsNull() ? 0 : 2); }
-
- Handle(IFSelect_Selection) IFSelect_SignCounter::Selection () const
- { return theselect; }
-
- void IFSelect_SignCounter::SetSelMode (const Standard_Integer selmode)
-{
- if (selmode < 0) thenbcomp1 = thenbcomp2 = 0;
- else theselmode = selmode;
- if (selmode == 0) theselect.Nullify();
-}
-
- Standard_Integer IFSelect_SignCounter::SelMode () const
- { return theselmode; }
-
- Standard_Boolean IFSelect_SignCounter::ComputeSelected
- (const Interface_Graph& G, const Standard_Boolean forced)
-{
- if (theselmode < 2 || theselect.IsNull()) return Standard_False;
- Standard_Boolean afaire = forced;
- Interface_EntityIterator iter = theselect->RootResult(G);
- Standard_Integer nb1 = G.Size();
- Standard_Integer nb2 = iter.NbEntities();
- if (!afaire) afaire = (nb1 != thenbcomp1 || nb2 != thenbcomp2);
- thenbcomp1 = nb1; thenbcomp2 = nb2;
- if (afaire) AddWithGraph (iter.Content(),G);
- return Standard_True;
-}
-
-
- Handle(TCollection_HAsciiString) IFSelect_SignCounter::Sign
- (const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& model) const
-{
- Handle(TCollection_HAsciiString) res;
- if (ent.IsNull() || thematcher.IsNull()) return res;
- res = new TCollection_HAsciiString (thematcher->Value(ent,model));
- return res;
-}
-
- Standard_CString IFSelect_SignCounter::ComputedSign
- (const Handle(Standard_Transient)& ent,
- const Interface_Graph& G)
-{
- Handle(TColStd_HSequenceOfTransient) list = new TColStd_HSequenceOfTransient();
- list->Append (ent);
- ModeSignOnly() = Standard_True;
- AddWithGraph (list,G);
- Standard_CString val = LastValue();
- ModeSignOnly() = Standard_False;
- return val;
-}
+++ /dev/null
-// Created on: 1994-11-07
-// 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_SignCounter_HeaderFile
-#define _IFSelect_SignCounter_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TColStd_MapOfTransient.hxx>
-#include <Standard_Integer.hxx>
-#include <IFSelect_SignatureList.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-class IFSelect_Signature;
-class IFSelect_Selection;
-class Standard_Transient;
-class Interface_InterfaceModel;
-class Interface_Graph;
-class TCollection_HAsciiString;
-
-class IFSelect_SignCounter;
-DEFINE_STANDARD_HANDLE(IFSelect_SignCounter, IFSelect_SignatureList)
-
-//! SignCounter gives the frame to count signatures associated
-//! with entities, deducted from them. Ex.: their Dynamic Type.
-//!
-//! It can sort a set of Entities according a signature, i.e. :
-//! - list of different values found for this Signature
-//! - for each one, count and list of entities
-//! Results are returned as a SignatureList, which can be queried
-//! on the count (list of strings, count per signature, or list of
-//! entities per signature)
-//!
-//! A SignCounter can be filled, either directly from lists, or
-//! from the result of a Selection : hence, its content can be
-//! automatically recomputed as desired
-//!
-//! SignCounter works by using a Signature in its method AddSign
-//!
-//! Methods can be redefined to, either
-//! - directly compute the value without a Signature
-//! - compute the value in the context of a Graph
-class IFSelect_SignCounter : public IFSelect_SignatureList
-{
-
-public:
-
- //! Creates a SignCounter, without proper Signature
- //! If <withmap> is True (default), added entities are counted
- //! only if they are not yet recorded in the map
- //! Map control can be set off if the input guarantees uniqueness of data
- //! <withlist> is transmitted to SignatureList (option to list
- //! entities, not only to count them).
- Standard_EXPORT IFSelect_SignCounter(const Standard_Boolean withmap = Standard_True, const Standard_Boolean withlist = Standard_False);
-
- //! Creates a SignCounter, with a predefined Signature
- //! Other arguments as for Create without Signature.
- Standard_EXPORT IFSelect_SignCounter(const Handle(IFSelect_Signature)& matcher, const Standard_Boolean withmap = Standard_True, const Standard_Boolean withlist = Standard_False);
-
- //! Returns the Signature used to count entities. It can be null.
- Standard_EXPORT Handle(IFSelect_Signature) Signature() const;
-
- //! Changes the control status. The map is not cleared, simply
- //! its use changes
- Standard_EXPORT void SetMap (const Standard_Boolean withmap);
-
- //! Adds an entity by considering its signature, which is given by
- //! call to method AddSign
- //! Returns True if added, False if already in the map (and
- //! map control status set)
- Standard_EXPORT virtual Standard_Boolean AddEntity (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model);
-
- //! Adds an entity (already filtered by Map) with its signature.
- //! This signature can be computed with the containing model.
- //! Its value is provided by the object Signature given at start,
- //! if no Signature is defined, it does nothing.
- //!
- //! Can be redefined (in this case, see also Sign)
- Standard_EXPORT virtual void AddSign (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model);
-
- //! Adds a list of entities by adding each of the items
- Standard_EXPORT void AddList (const Handle(TColStd_HSequenceOfTransient)& list, const Handle(Interface_InterfaceModel)& model);
-
- //! Adds a list of entities in the context given by the graph
- //! Default just call basic AddList
- //! Can be redefined to get a signature computed with the graph
- Standard_EXPORT virtual void AddWithGraph (const Handle(TColStd_HSequenceOfTransient)& list, const Interface_Graph& graph);
-
- //! Adds all the entities contained in a Model
- Standard_EXPORT void AddModel (const Handle(Interface_InterfaceModel)& model);
-
- //! Adds the result determined by a Selection from a Graph
- //! Remark : does not impact at all data from SetSelection & Co
- Standard_EXPORT void AddFromSelection (const Handle(IFSelect_Selection)& sel, const Interface_Graph& G);
-
- //! Sets a Selection as input : this causes content to be cleared
- //! then the Selection to be ready to compute (but not immediately)
- Standard_EXPORT void SetSelection (const Handle(IFSelect_Selection)& sel);
-
- //! Returns the selection, or a null Handle
- Standard_EXPORT Handle(IFSelect_Selection) Selection() const;
-
- //! Changes the mode of working with the selection :
- //! -1 just clears optimisation data and nothing else
- //! 0 clears it 1 inhibits it for computing (but no clearing)
- //! 2 sets it active for computing
- //! Default at creation is 0, after SetSelection (not null) is 2
- Standard_EXPORT void SetSelMode (const Standard_Integer selmode);
-
- //! Returns the mode of working with the selection
- Standard_EXPORT Standard_Integer SelMode() const;
-
- //! Computes from the selection result, if selection is active
- //! (mode 2). If selection is not defined (mode 0) or is inhibited
- //! (mode 1) does nothing.
- //! Returns True if computation is done (or optimised), False else
- //! This method is called by ComputeCounter from WorkSession
- //!
- //! If <forced> is True, recomputes systematically
- //! Else (D), if the counter was not cleared and if the former
- //! computed result started from the same total size of Graph and
- //! same count of selected entities : computation is not redone
- //! unless <forced> is given as True
- Standard_EXPORT Standard_Boolean ComputeSelected (const Interface_Graph& G, const Standard_Boolean forced = Standard_False);
-
- //! Determines and returns the value of the signature for an
- //! entity as an HAsciiString. This method works exactly as
- //! AddSign, which is optimized
- //!
- //! Can be redefined, accorded with AddSign
- Standard_EXPORT virtual Handle(TCollection_HAsciiString) Sign (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const;
-
- //! Applies AddWithGraph on one entity, and returns the Signature
- //! Value which has been recorded
- //! To do this, Add is called with SignOnly Mode True during the
- //! call, the returned value is LastValue
- Standard_EXPORT Standard_CString ComputedSign (const Handle(Standard_Transient)& ent, const Interface_Graph& G);
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SignCounter,IFSelect_SignatureList)
-
-private:
-
- Standard_Boolean themapstat;
- TColStd_MapOfTransient themap;
- Handle(IFSelect_Signature) thematcher;
- Handle(IFSelect_Selection) theselect;
- Standard_Integer theselmode;
- Standard_Integer thenbcomp1;
- Standard_Integer thenbcomp2;
-
-};
-
-#endif // _IFSelect_SignCounter_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_SignMultiple.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SignMultiple,IFSelect_Signature)
-
-static TCollection_AsciiString theval; // temporaire pour construire Value
-
- IFSelect_SignMultiple::IFSelect_SignMultiple (const Standard_CString name)
- : IFSelect_Signature (name) { }
-
- void IFSelect_SignMultiple::Add
- (const Handle(IFSelect_Signature)& subsign,
- const Standard_Integer tabul, const Standard_Boolean maxi)
-{
- if (subsign.IsNull()) return;
- thesubs.Append (subsign);
- thetabs.Append (maxi ? -tabul : tabul);
-}
-
- Standard_CString IFSelect_SignMultiple::Value
- (const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& model) const
-{
- theval.Clear();
- Standard_Integer i, nb = thesubs.Length();
- for (i = 1; i <= nb; i ++) {
- Standard_Integer tabul = thetabs.Value(i);
- Standard_Boolean maxi = (tabul < 0);
- if (maxi) tabul = -tabul;
- Handle(IFSelect_Signature) sign = Handle(IFSelect_Signature)::DownCast(thesubs.Value(i));
- Standard_CString val = sign->Value (ent,model);
- TCollection_AsciiString str(val);
- Standard_Integer sl = str.Length();
- str.LeftJustify (tabul,' ');
- if (sl > tabul && maxi) {
- str.Remove (sl+1,tabul-sl);
- str.SetValue (sl,'.');
- }
- str.AssignCat(" ");
- theval.AssignCat (str);
- }
- return theval.ToCString();
-}
-
-
- Standard_Boolean IFSelect_SignMultiple::Matches
- (const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& model,
- const TCollection_AsciiString& text, const Standard_Boolean exact) const
-{
- if (exact) return IFSelect_Signature::Matches (ent,model,text,exact);
- Standard_Integer i, nb = thesubs.Length();
- for (i = 1; i <= nb; i ++) {
- Handle(IFSelect_Signature) sign =
- Handle(IFSelect_Signature)::DownCast(thesubs.Value(i));
- if (sign->Matches (ent,model,text,exact)) return Standard_True;
- }
- return Standard_False;
-}
+++ /dev/null
-// Created on: 1998-01-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_SignMultiple_HeaderFile
-#define _IFSelect_SignMultiple_HeaderFile
-
-#include <Standard.hxx>
-
-#include <TColStd_SequenceOfTransient.hxx>
-#include <TColStd_SequenceOfInteger.hxx>
-#include <IFSelect_Signature.hxx>
-#include <Standard_Integer.hxx>
-class Standard_Transient;
-class Interface_InterfaceModel;
-class TCollection_AsciiString;
-
-
-class IFSelect_SignMultiple;
-DEFINE_STANDARD_HANDLE(IFSelect_SignMultiple, IFSelect_Signature)
-
-//! Multiple Signature : ordered list of other Signatures
-//! It concatenates on a same line the result of its sub-items
-//! separated by sets of 3 blanks
-//! It is possible to define tabulations between sub-items
-//! Moreover, match rules are specific
-class IFSelect_SignMultiple : public IFSelect_Signature
-{
-
-public:
-
-
- //! Creates an empty SignMultiple with a Name
- //! This name should take expected tabulations into account
- Standard_EXPORT IFSelect_SignMultiple(const Standard_CString name);
-
- //! Adds a Signature. Width, if given, gives the tabulation
- //! If <maxi> is True, it is a forced tabulation (overlength is
- //! replaced by a final dot)
- //! If <maxi> is False, just 3 blanks follow an overlength
- Standard_EXPORT void Add (const Handle(IFSelect_Signature)& subsign, const Standard_Integer width = 0, const Standard_Boolean maxi = Standard_False);
-
- //! Concatenates the values of sub-signatures, with their
- //! tabulations
- Standard_EXPORT Standard_CString Value (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
-
- //! Specialized Match Rule
- //! If <exact> is False, simply checks if at least one sub-item
- //! matches
- //! If <exact> is True, standard match with Value
- //! (i.e. tabulations must be respected)
- Standard_EXPORT virtual Standard_Boolean Matches (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model, const TCollection_AsciiString& text, const Standard_Boolean exact) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SignMultiple,IFSelect_Signature)
-
-protected:
-
-
-
-
-private:
-
-
- TColStd_SequenceOfTransient thesubs;
- TColStd_SequenceOfInteger thetabs;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SignMultiple_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_SignType.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SignType,IFSelect_Signature)
-
-static Standard_CString nulsign = "";
-
-
- IFSelect_SignType::IFSelect_SignType (const Standard_Boolean nopk)
- : IFSelect_Signature ((Standard_CString ) (nopk ? "Class Type" : "Dynamic Type") ) ,
- thenopk (nopk)
-{}
-
- Standard_CString IFSelect_SignType::Value
- (const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& /*model*/) const
-{
- if (ent.IsNull()) return nulsign;
- DeclareAndCast(Standard_Type,atype,ent);
- if (atype.IsNull()) atype = ent->DynamicType();
- Standard_CString tn = atype->Name();
- if (!thenopk) return tn;
- for (int i = 0; tn[i] != '\0'; i ++) {
- if (tn[i] == '_') return &tn[i+1];
- }
- return tn;
-}
+++ /dev/null
-// Created on: 1996-01-29
-// 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_SignType_HeaderFile
-#define _IFSelect_SignType_HeaderFile
-
-#include <Standard.hxx>
-
-#include <IFSelect_Signature.hxx>
-class Standard_Transient;
-class Interface_InterfaceModel;
-
-
-class IFSelect_SignType;
-DEFINE_STANDARD_HANDLE(IFSelect_SignType, IFSelect_Signature)
-
-//! This Signature returns the cdl Type of an entity, under two
-//! forms :
-//! - complete dynamic type (package and class)
-//! - class type, without package name
-class IFSelect_SignType : public IFSelect_Signature
-{
-
-public:
-
-
- //! Returns a SignType
- //! <nopk> false (D) : complete dynamic type (name = Dynamic Type)
- //! <nopk> true : class type without pk (name = Class Type)
- Standard_EXPORT IFSelect_SignType(const Standard_Boolean nopk = Standard_False);
-
- //! Returns the Signature for a Transient object, as its Dynamic
- //! Type, with or without package name, according starting option
- Standard_EXPORT Standard_CString Value (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SignType,IFSelect_Signature)
-
-protected:
-
-
-
-
-private:
-
-
- Standard_Boolean thenopk;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SignType_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_SignValidity.hxx>
-#include <Interface_Check.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SignValidity,IFSelect_Signature)
-
-static Standard_CString nulsign = "";
-
-
-//=======================================================================
-//function : IFSelect_SignValidity
-//purpose :
-//=======================================================================
-
-IFSelect_SignValidity::IFSelect_SignValidity() : IFSelect_Signature ("Validity")
-{
- AddCase ("UNKNOWN");
- AddCase ("UNLOADED");
- AddCase ("Load-Error");
- AddCase ("Data-Error");
- AddCase ("Load-Warning");
- AddCase ("Data-Warning");
- AddCase ("OK");
-}
-
-
-//=======================================================================
-//function : CVal
-//purpose :
-//=======================================================================
-
-Standard_CString IFSelect_SignValidity::CVal(const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& model)
-{
- if (ent.IsNull() || model.IsNull()) return nulsign;
- Standard_Integer num = model->Number(ent);
- Standard_Integer cas = 0;
- if (model->IsUnknownEntity(num)) return "UNKNOWN";
- if (model->IsRedefinedContent(num)) return "UNLOADED";
-
- const Handle(Interface_Check) ch1 = model->Check(num,Standard_True);
- const Handle(Interface_Check) ch2 = model->Check(num,Standard_False);
- if (ch1->NbFails() > 0) return "Load-Error";
- else if (ch1->NbWarnings() > 0) cas = 1;
-
- if (ch2->NbFails() > 0) return "Data-Error";
- else if (cas == 1) return "Load-Warning";
- else if (ch2->NbWarnings() > 0) return "Data-Warning";
-
- return "OK";
-}
-
-
-//=======================================================================
-//function : Value
-//purpose :
-//=======================================================================
-
-Standard_CString IFSelect_SignValidity::Value
- (const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& model) const
-{
- return IFSelect_SignValidity::CVal(ent,model);
-}
+++ /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_SignValidity_HeaderFile
-#define _IFSelect_SignValidity_HeaderFile
-
-#include <Standard.hxx>
-
-#include <IFSelect_Signature.hxx>
-class Standard_Transient;
-class Interface_InterfaceModel;
-
-
-class IFSelect_SignValidity;
-DEFINE_STANDARD_HANDLE(IFSelect_SignValidity, IFSelect_Signature)
-
-//! This Signature returns the Validity Status of an entity, as
-//! deducted from data in the model : it can be
-//! "OK" "Unknown" "Unloaded" "Syntactic Fail"(but loaded)
-//! "Syntactic Warning" "Semantic Fail" "Semantic Warning"
-class IFSelect_SignValidity : public IFSelect_Signature
-{
-
-public:
-
-
- //! Returns a SignValidity
- Standard_EXPORT IFSelect_SignValidity();
-
- //! Returns the Signature for a Transient object, as a validity
- //! deducted from data (reports) stored in the model.
- //! Class method, can be called by any one
- Standard_EXPORT static Standard_CString CVal (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model);
-
- //! Returns the Signature for a Transient object, as a validity
- //! deducted from data (reports) stored in the model
- //! Calls the class method CVal
- Standard_EXPORT Standard_CString Value (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SignValidity,IFSelect_Signature)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SignValidity_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_Signature.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Signature,Interface_SignType)
-
-// unused
-//static Standard_CString nulsign = "";
-static char intval[20];
-
-
- IFSelect_Signature::IFSelect_Signature (const Standard_CString name)
- : thename (name) { thecasi[0] = thecasi[1] = thecasi[2] = 0; }
-
- void IFSelect_Signature::SetIntCase
- (const Standard_Boolean hasmin, const Standard_Integer valmin,
- const Standard_Boolean hasmax, const Standard_Integer valmax)
-{
- thecasi[0] = 1;
- if (hasmin) { thecasi[0] += 2; thecasi[1] = valmin; }
- if (hasmax) { thecasi[0] += 4; thecasi[2] = valmax; }
-}
-
- Standard_Boolean IFSelect_Signature::IsIntCase
- (Standard_Boolean& hasmin, Standard_Integer& valmin,
- Standard_Boolean& hasmax, Standard_Integer& valmax) const
-{
- hasmin = hasmax = Standard_False;
- valmin = valmax = 0;
- if (!thecasi[0]) return Standard_False;
- if (thecasi[0] & 2) { hasmin = Standard_True; valmin = thecasi[1]; }
- if (thecasi[0] & 4) { hasmax = Standard_True; valmax = thecasi[2]; }
- return Standard_True;
-}
-
- void IFSelect_Signature::AddCase (const Standard_CString acase)
-{
- if (thecasl.IsNull()) thecasl = new TColStd_HSequenceOfAsciiString();
- TCollection_AsciiString scase(acase);
- thecasl->Append(scase);
-}
-
- Handle(TColStd_HSequenceOfAsciiString) IFSelect_Signature::CaseList () const
- { return thecasl; }
-
-
- Standard_CString IFSelect_Signature::Name () const
- { return thename.ToCString(); }
-
- TCollection_AsciiString IFSelect_Signature::Label () const
-{
- TCollection_AsciiString label("Signature : ");
- label.AssignCat(thename);
- return label;
-}
-
-
- Standard_Boolean IFSelect_Signature::Matches
- (const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& model,
- const TCollection_AsciiString& text, const Standard_Boolean exact) const
-
-{ return IFSelect_Signature::MatchValue ( Value(ent,model) , text, exact); }
-
-
- Standard_Boolean IFSelect_Signature::MatchValue
- (const Standard_CString val,
- const TCollection_AsciiString& text, const Standard_Boolean exact)
-{
- if (exact) return text.IsEqual (val);
- // NB: no regexp
- char cardeb = text.Value(1);
- Standard_Integer ln,lnt,i,j;
- ln = text.Length();
- lnt = (Standard_Integer)(strlen(val) - ln);
- for (i = 0; i <= lnt; i ++) {
- if (val[i] == cardeb) {
-// un candidat
- Standard_Boolean res = Standard_True;
- for (j = 1; j < ln; j ++) {
- if (val[i+j] != text.Value(j+1))
- { res = Standard_False; break; }
- }
- if (res) return res;
- }
- }
- return Standard_False;
-}
-
-
- Standard_CString IFSelect_Signature::IntValue
- (const Standard_Integer val)
-{
- switch (val) {
- case 0 : return "0";
- case 1 : return "1";
- case 2 : return "2";
- case 3 : return "3";
- case 4 : return "4";
- case 5 : return "5";
- case 6 : return "6";
- case 7 : return "7";
- case 8 : return "8";
- case 9 : return "9";
- default : break;
- }
- sprintf (intval,"%d",val);
- return intval;
-}
+++ /dev/null
-// Created on: 1994-04-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_Signature_HeaderFile
-#define _IFSelect_Signature_HeaderFile
-
-#include <Standard.hxx>
-
-#include <Standard_Integer.hxx>
-#include <TColStd_HSequenceOfAsciiString.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <Interface_SignType.hxx>
-class Standard_Transient;
-class Interface_InterfaceModel;
-
-
-class IFSelect_Signature;
-DEFINE_STANDARD_HANDLE(IFSelect_Signature, Interface_SignType)
-
-//! Signature provides the basic service used by the classes
-//! SelectSignature and Counter (i.e. Name, Value), which is :
-//! - for an entity in a model, give a characteristic string, its
-//! signature
-//! This string has not to be unique in the model, but gives a
-//! value for such or such important feature.
-//! Examples : Dynamic Type; Category; etc
-class IFSelect_Signature : public Interface_SignType
-{
-
-public:
-
-
- //! Sets the information data to tell "integer cases" with
- //! possible min and max values
- //! To be called when creating
- Standard_EXPORT void SetIntCase (const Standard_Boolean hasmin, const Standard_Integer valmin, const Standard_Boolean hasmax, const Standard_Integer valmax);
-
- //! Tells if this Signature gives integer values
- //! and returns values from SetIntCase if True
- Standard_EXPORT Standard_Boolean IsIntCase (Standard_Boolean& hasmin, Standard_Integer& valmin, Standard_Boolean& hasmax, Standard_Integer& valmax) const;
-
- //! Adds a possible case
- //! To be called when creating, IF the list of possible cases for
- //! Value is known when starting
- //! For instance, for CDL types, rather do not fill this,
- //! but for a specific enumeration (such as a status), can be used
- Standard_EXPORT void AddCase (const Standard_CString acase);
-
- //! Returns the predefined list of possible cases, filled by AddCase
- //! Null Handle if no predefined list (hence, to be counted)
- //! Useful to filter on really possible vase, for instance, or
- //! for a help
- Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) CaseList() const;
-
- //! Returns an identification of the Signature (a word), given at
- //! initialization time
- //! Returns the Signature for a Transient object. It is specific
- //! of each sub-class of Signature. For a Null Handle, it should
- //! provide ""
- //! It can work with the model which contains the entity
- Standard_EXPORT Standard_CString Name() const Standard_OVERRIDE;
-
- //! The label of a Signature uses its name as follow :
- //! "Signature : <name>"
- Standard_EXPORT TCollection_AsciiString Label() const;
-
- //! Tells if the value for <ent> in <model> matches a text, with
- //! a criterium <exact>.
- //! The default definition calls MatchValue
- //! Can be redefined
- Standard_EXPORT virtual Standard_Boolean Matches (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model, const TCollection_AsciiString& text, const Standard_Boolean exact) const;
-
- //! Default procedure to tell if a value <val> matches a text
- //! with a criterium <exact>. <exact> = True requires equality,
- //! else only contained (no reg-exp)
- Standard_EXPORT static Standard_Boolean MatchValue (const Standard_CString val, const TCollection_AsciiString& text, const Standard_Boolean exact);
-
- //! This procedure converts an Integer to a CString
- //! It is a convenient way when the value of a signature has the
- //! form of a simple integer value
- //! The value is to be used immediately (one buffer only, no copy)
- Standard_EXPORT static Standard_CString IntValue (const Standard_Integer val);
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_Signature,Interface_SignType)
-
-protected:
-
-
- //! Initializes a Signature with its name
- Standard_EXPORT IFSelect_Signature(const Standard_CString name);
-
- TCollection_AsciiString thename;
-
-
-private:
-
-
- Standard_Integer thecasi[3];
- Handle(TColStd_HSequenceOfAsciiString) thecasl;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_Signature_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_SignatureList.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Interface_MSG.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_HAsciiString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SignatureList,Standard_Transient)
-
-IFSelect_SignatureList::IFSelect_SignatureList
- (const Standard_Boolean withlist)
-{
- thesignonly = Standard_False;
- thelistat = withlist;
- thenbnuls = 0;
- SetName("...");
-}
-
- void IFSelect_SignatureList::SetList
- (const Standard_Boolean withlist)
- { thelistat = withlist; }
-
- Standard_Boolean& IFSelect_SignatureList::ModeSignOnly ()
- { return thesignonly; }
-
- void IFSelect_SignatureList::Clear ()
-{
- thelastval.Clear();
- thenbnuls = 0;
- thedicount.Clear();
- thediclist.Clear();
-}
-
- void IFSelect_SignatureList::Add
- (const Handle(Standard_Transient)& ent, const Standard_CString sign)
-{
- if (thesignonly) {
- thelastval.Clear();
- thelastval.AssignCat (sign);
- return;
- }
-
- if (sign[0] == '\0') { thenbnuls ++; return; }
-
- if (thedicount.Contains(sign))
- thedicount.ChangeFromKey(sign)++;
- else
- thedicount.Add(sign, 1);
-
- if (thelistat) {
- Handle(TColStd_HSequenceOfTransient) alist;
- if (thediclist.Contains(sign))
- alist = Handle(TColStd_HSequenceOfTransient)::DownCast(thediclist.FindFromKey(sign));
- else {
- alist = new TColStd_HSequenceOfTransient();
- thediclist.Add(sign, alist);
- }
- alist->Append(ent);
- }
-}
-
- Standard_CString IFSelect_SignatureList::LastValue () const
- { return thelastval.ToCString(); }
-
- void IFSelect_SignatureList::Init
- (const Standard_CString name,
- const NCollection_IndexedDataMap<TCollection_AsciiString, Standard_Integer>& theCount,
- const NCollection_IndexedDataMap<TCollection_AsciiString, Handle(Standard_Transient)>& list,
- const Standard_Integer nbnuls)
-{
- thelastval.Clear();
- thename = new TCollection_HAsciiString (name);
- thedicount = theCount;
- thediclist = list;
- thenbnuls = nbnuls;
- if (thediclist.IsEmpty()) thelistat = Standard_False;
-}
-
-
- Handle(TColStd_HSequenceOfHAsciiString) IFSelect_SignatureList::List
- (const Standard_CString root) const
-{
- Handle(TColStd_HSequenceOfHAsciiString) list =
- new TColStd_HSequenceOfHAsciiString();
- NCollection_IndexedDataMap<TCollection_AsciiString, Standard_Integer>::Iterator iter(thedicount);
- for (; iter.More(); iter.Next()) {
- if (!iter.Key().StartsWith(root)) continue;
-
- Handle(TCollection_HAsciiString) sign =
- new TCollection_HAsciiString (iter.Key());
- list->Append(sign);
- }
- return list;
-}
-
-
- Standard_Boolean IFSelect_SignatureList::HasEntities () const
- { return thelistat; }
-
- Standard_Integer IFSelect_SignatureList::NbNulls () const
- { return thenbnuls; }
-
- Standard_Integer IFSelect_SignatureList::NbTimes
- (const Standard_CString sign) const
-{
- Standard_Integer nb = 0;
- thedicount.FindFromKey(sign, nb);
- return nb;
-}
-
- Handle(TColStd_HSequenceOfTransient) IFSelect_SignatureList::Entities
- (const Standard_CString sign) const
-{
- Handle(TColStd_HSequenceOfTransient) list;
- Handle(Standard_Transient) aTList;
- if (!thelistat) return list;
- if (thediclist.FindFromKey(sign, aTList))
- list = Handle(TColStd_HSequenceOfTransient)::DownCast(aTList);
- else
- list = new TColStd_HSequenceOfTransient();
- return list;
-}
-
-
- void IFSelect_SignatureList::SetName (const Standard_CString name)
- { thename = new TCollection_HAsciiString (name); }
-
- Standard_CString IFSelect_SignatureList::Name () const
- { return thename->ToCString(); }
-
-
- void IFSelect_SignatureList::PrintCount (Standard_OStream& S) const
-{
- Standard_Integer nbtot = 0, nbsign = 0;
- NCollection_IndexedDataMap<TCollection_AsciiString, Standard_Integer>::Iterator iter(thedicount);
- S << " Count "<<thename->ToCString()<<"\n ----- -----------"<<std::endl;
- for (; iter.More(); iter.Next()) {
- Standard_Integer val = iter.Value();
- S << Interface_MSG::Blanks(val,6) << val <<" "<<iter.Key()<<std::endl;
- nbtot += val;
- nbsign ++;
- }
- if (thenbnuls > 0) S << thename->ToCString()<< " Nul : " << thenbnuls <<std::endl;
- S << " Nb Total:"<<nbtot<<" for "<<nbsign<<" items"<<std::endl;
-}
-
- void IFSelect_SignatureList::PrintList
- (Standard_OStream& S, const Handle(Interface_InterfaceModel)& model,
- const IFSelect_PrintCount mod) const
-{
- if (mod == IFSelect_ItemsByEntity) return;
- if (mod == IFSelect_CountByItem) { PrintCount (S); return; }
- if (mod == IFSelect_CountSummary) { PrintSum (S); return; }
- if (!HasEntities()) {
- S <<" SignatureList "<<Name()<<" : PrintList, list not available"<<std::endl;
- PrintCount(S);
- return;
- }
- Standard_Integer nbtot = 0, nbsign = 0;
- NCollection_IndexedDataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator iter(thediclist);
- for (; iter.More(); iter.Next()) {
- DeclareAndCast(TColStd_HSequenceOfTransient,list,iter.Value());
- S<<Name()<<" : "<<iter.Key()<<std::endl;
- if (list.IsNull()) { S<<" - (empty list)"<<std::endl; continue; }
- Standard_Integer nb = list->Length();
- S<<" - Nb: "<<nb<<" : ";
- Standard_Integer nc = nb; if (nb > 5 && mod == IFSelect_ShortByItem) nc = 5;
- for (Standard_Integer i = 1; i <= nc; i ++) {
- if (list->Value(i).IsNull()) {
- S << " 0";
- if (mod == IFSelect_EntitiesByItem) S<<":(Global)";
- continue;
- }
- Standard_Integer num = model->Number(list->Value(i));
- if (num == IFSelect_ShortByItem) { S<<" ??"; continue; }
- S<<" "<<num;
- if (mod == IFSelect_EntitiesByItem)
- { S<<":"; model->PrintLabel(list->Value(i), S); }
- }
- if (nc < nb) S<<" .. etc";
- S<<std::endl;
- nbtot += nb;
- nbsign ++;
- }
- S <<" Nb Total:"<<nbtot<<" for "<<nbsign<<" items"<<std::endl;
-}
-
-
- void IFSelect_SignatureList::PrintSum (Standard_OStream& S) const
-{
- NCollection_IndexedDataMap<TCollection_AsciiString, Standard_Integer>::Iterator iter(thedicount);
- S << " Summary "<<thename->ToCString()<<"\n ----- -----------"<<std::endl;
- Standard_Integer nbtot = 0, nbsign = 0, maxent = 0, nbval = 0, nbve = 0, minval = 0, maxval = 0, totval = 0;
- for (; iter.More(); iter.Next()) {
- Standard_Integer nbent = iter.Value();
- nbtot += nbent;
- nbsign ++;
- if (nbent > maxent) maxent = nbent;
- TCollection_AsciiString name = iter.Key();
-// if (!name.IsIntegerValue()) continue; pas bien fiable
- Standard_Integer ic, nc = name.Length();
- Standard_Boolean iaint = Standard_True;
- for (ic = 1; ic <= nc; ic ++) {
- char unc = name.Value(ic);
- if (ic == 1 && (unc == ' ' || unc == '+' || unc == '-')) continue;
- if (unc >= '0' && unc <= '9') continue;
- iaint = Standard_False; break;
- }
- if (!iaint) continue;
- Standard_Integer val = name.IntegerValue();
- if (nbval == 0) { minval = maxval = val; }
- if (minval > val) minval = val;
- if (maxval < val) maxval = val;
- nbval ++;
- nbve += nbent;
- totval += (val*nbent);
- }
- S << " Nb Total:"<<nbtot<<" for "<<nbsign<<" items"<<std::endl;
- S << " Highest count of entities : "<<maxent<<" on one item"<<std::endl;
- if (nbval > 0) {
- S<<" Summary on Integer Values"<<std::endl;
- S<<" Nb Integer Items : "<<nbval<<std::endl;
- S<<" For Nb Entities : "<<nbve<<std::endl;
- S<<" Cumulated Values : "<<totval<<std::endl;
- S <<" Maximum Value : "<<maxval<<std::endl;
- Standard_Integer avg1, avg2;
- avg1 = totval/nbve;
- avg2 = ((totval - (avg1*nbve)) * 10) / nbve;
- S <<" Average Value : "<<avg1<<" "<<avg2<<"/10"<<std::endl;
- S <<" Minimum Value : "<<minval<<std::endl;
- }
-}
+++ /dev/null
-// Created on: 1994-10-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_SignatureList_HeaderFile
-#define _IFSelect_SignatureList_HeaderFile
-
-#include <Standard.hxx>
-
-#include <Standard_Integer.hxx>
-#include <Standard_Transient.hxx>
-#include <TColStd_HSequenceOfHAsciiString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <IFSelect_PrintCount.hxx>
-#include <NCollection_IndexedDataMap.hxx>
-class TCollection_HAsciiString;
-class Interface_InterfaceModel;
-
-
-class IFSelect_SignatureList;
-DEFINE_STANDARD_HANDLE(IFSelect_SignatureList, Standard_Transient)
-
-//! A SignatureList is given as result from a Counter (any kind)
-//! It gives access to a list of signatures, with counts, and
-//! optionally with list of corresponding entities
-//!
-//! It can also be used only to give a signature, through SignOnly
-//! Mode. This can be useful for a specific counter (used in a
-//! Selection), while it remains better to use a Signature
-//! whenever possible
-class IFSelect_SignatureList : public Standard_Transient
-{
-
-public:
-
-
- //! Creates a SignatureList. If <withlist> is True, entities will
- //! be not only counted per signature, but also listed.
- Standard_EXPORT IFSelect_SignatureList(const Standard_Boolean withlist = Standard_False);
-
- //! Changes the record-list status. The list is not cleared but
- //! its use changes
- Standard_EXPORT void SetList (const Standard_Boolean withlist);
-
- //! Returns modifiable the SignOnly Mode
- //! If False (D), the counter normally counts
- //! If True, the counting work is turned off, Add only fills the
- //! LastValue, which can be used as signature, when a counter
- //! works from data which are not available from a Signature
- Standard_EXPORT Standard_Boolean& ModeSignOnly();
-
- Standard_EXPORT virtual void Clear();
-
- //! Adds an entity with its signature, i.e. :
- //! - counts an item more for <sign>
- //! - if record-list status is set, records the entity
- //! Accepts a null entity (the signature is then for the global
- //! model). But if the string is empty, counts a Null item.
- //!
- //! If SignOnly Mode is set, this work is replaced by just
- //! setting LastValue
- Standard_EXPORT void Add (const Handle(Standard_Transient)& ent, const Standard_CString sign);
-
- //! Returns the last value recorded by Add (only if SignMode set)
- //! Cleared by Clear or Init
- Standard_EXPORT Standard_CString LastValue() const;
-
- //! Aknowledges the list in once. Name identifies the Signature
- Standard_EXPORT void Init (const Standard_CString name, const NCollection_IndexedDataMap<TCollection_AsciiString, Standard_Integer>& count, const NCollection_IndexedDataMap<TCollection_AsciiString, Handle(Standard_Transient)>& list, const Standard_Integer nbnuls);
-
- //! Returns the list of signatures, as a sequence of strings
- //! (but without their respective counts). It is ordered.
- //! By default, for all the signatures.
- //! If <root> is given non empty, for the signatures which
- //! begin by <root>
- Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) List (const Standard_CString root = "") const;
-
- //! Returns True if the list of Entities is aknowledged, else
- //! the method Entities will always return a Null Handle
- Standard_EXPORT Standard_Boolean HasEntities() const;
-
- //! Returns the count of null entities
- Standard_EXPORT Standard_Integer NbNulls() const;
-
- //! Returns the number of times a signature was counted,
- //! 0 if it has not been recorded at all
- Standard_EXPORT Standard_Integer NbTimes (const Standard_CString sign) const;
-
- //! Returns the list of entities attached to a signature
- //! It is empty if <sign> has not been recorded
- //! It is a Null Handle if the list of entities is not known
- Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Entities (const Standard_CString sign) const;
-
- //! Defines a name for a SignatureList (used to print it)
- Standard_EXPORT void SetName (const Standard_CString name);
-
- //! Returns the recorded Name.
- //! Remark : default is "..." (no SetName called)
- Standard_EXPORT virtual Standard_CString Name() const;
-
- //! Prints the counts of items (not the list)
- Standard_EXPORT virtual void PrintCount (Standard_OStream& S) const;
-
- //! Prints the lists of items, if they are present (else, prints
- //! a message "no list available")
- //! Uses <model> to determine for each entity to be listed, its
- //! number, and its specific identifier (by PrintLabel)
- //! <mod> gives a mode for printing :
- //! - CountByItem : just count (as PrintCount)
- //! - ShortByItem : minimum i.e. count plus 5 first entity numbers
- //! - ShortByItem(D) complete list of entity numbers (0: "Global")
- //! - EntitiesByItem : list of (entity number/PrintLabel from the model)
- //! other modes are ignored
- Standard_EXPORT virtual void PrintList (Standard_OStream& S, const Handle(Interface_InterfaceModel)& model, const IFSelect_PrintCount mod = IFSelect_ListByItem) const;
-
- //! Prints a summary
- //! Item which has the greatest count of entities
- //! For items which are numeric values : their count, maximum,
- //! minimum values, cumul, average
- Standard_EXPORT virtual void PrintSum (Standard_OStream& S) const;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_SignatureList,Standard_Transient)
-
-protected:
-
-
-
-
-private:
-
-
- Standard_Boolean thesignonly;
- Standard_Boolean thelistat;
- Standard_Integer thenbnuls;
- Handle(TCollection_HAsciiString) thename;
- TCollection_AsciiString thelastval;
- NCollection_IndexedDataMap<TCollection_AsciiString, Standard_Integer> thedicount;
- NCollection_IndexedDataMap<TCollection_AsciiString, Handle(Standard_Transient)> thediclist;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_SignatureList_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
-// 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_TSeqOfSelection_HeaderFile
-#define IFSelect_TSeqOfSelection_HeaderFile
-
-#include <IFSelect_Selection.hxx>
-#include <NCollection_Sequence.hxx>
-
-typedef NCollection_Sequence<Handle(IFSelect_Selection)> IFSelect_TSeqOfSelection;
-
-
-#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
-{
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- 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<<std::endl;
- checklist.Print(sout,newmod,Standard_False);
- }
- if (!checklist.IsEmpty(Standard_True)) {
- sout<<" -- Abandon TransformStandard --"<<std::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 <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 sequentially.
- //! 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)
-
-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>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Transformer,Standard_Transient)
-
-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 <Standard_Transient.hxx>
-class Interface_Graph;
-class Interface_Protocol;
-class Interface_CheckIterator;
-class Interface_InterfaceModel;
-class TCollection_AsciiString;
-
-class IFSelect_Transformer;
-DEFINE_STANDARD_HANDLE(IFSelect_Transformer, Standard_Transient)
-
-//! 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 being
-//! rebuilt or converted; or converted from a protocol to another one)
-class IFSelect_Transformer : public Standard_Transient
-{
-
-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 information useful for
- //! the method Updated
- //!
- //! Returns True if Done, False if an Error occurred:
- //! 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,Standard_Transient)
-
-
-};
-
-#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 <IFSelect_ContextWrite.hxx>
-#include <IFSelect_WorkLibrary.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Protocol.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_WorkLibrary,Standard_Transient)
-
-// all deferred but Copy (virtual default)
-IFSelect_WorkLibrary::IFSelect_WorkLibrary () { thelevdef = 0; }
-
- 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,
- Standard_OStream& 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();
-}
-
-Standard_Integer IFSelect_WorkLibrary::ReadStream(const Standard_CString /*name*/,
- std::istream& /*istream*/,
- Handle(Interface_InterfaceModel)& /*model*/,
- const Handle(Interface_Protocol)& /*protocol*/) const
-{
- return 1;
-}
-
+++ /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>
-class Interface_InterfaceModel;
-class Interface_Protocol;
-class IFSelect_ContextWrite;
-class Interface_EntityIterator;
-class Interface_CopyTool;
-
-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 recommended 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 information 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;
-
- //! Interface to read a data from the specified stream.
- //! @param model is the resulting Model, which has to be created by this method.
- //! In case of error, model must be returned Null
- //! Return value is a status: 0 - OK, 1 - read failure, -1 - stream failure.
- //!
- //! Default implementation returns 1 (error).
- Standard_EXPORT virtual Standard_Integer ReadStream (const Standard_CString theName, std::istream& theIStream,
- Handle(Interface_InterfaceModel)& model,
- const Handle(Interface_Protocol)& protocol) const;
-
- //! Gives the way to Write a File from a Model.
- //! <ctx> contains all necessary information : 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, Standard_OStream& 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, Standard_OStream& 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
- Standard_EXPORT IFSelect_WorkLibrary();
-
-
-
-private:
-
-
- Standard_Integer thelevdef;
- Handle(Interface_HArray1OfHAsciiString) thelevhlp;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_WorkLibrary_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.
-
-//#1 svv 10.01.00 : porting on DEC
-//smh#14 17.03.2000 : FRA62479 Clearing of gtool
-
-#include <IFGraph_SubPartsIterator.hxx>
-#include <IFSelect_CheckCounter.hxx>
-#include <IFSelect_EditForm.hxx>
-#include <IFSelect_IntParam.hxx>
-#include <IFSelect_ModelCopier.hxx>
-#include <IFSelect_Modifier.hxx>
-#include <IFSelect_PacketList.hxx>
-#include <IFSelect_ParamEditor.hxx>
-#include <IFSelect_SelectDiff.hxx>
-#include <IFSelect_SelectIntersection.hxx>
-#include <IFSelect_Selection.hxx>
-#include <IFSelect_SelectionIterator.hxx>
-#include <IFSelect_SelectModelEntities.hxx>
-#include <IFSelect_SelectPointed.hxx>
-#include <IFSelect_SelectSignature.hxx>
-#include <IFSelect_ShareOut.hxx>
-#include <IFSelect_ShareOutResult.hxx>
-#include <IFSelect_SignatureList.hxx>
-#include <IFSelect_SignCounter.hxx>
-#include <IFSelect_SignValidity.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_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_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>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_WorkSession,Standard_Transient)
-
-#define Flag_Incorrect 2
-// (Bit Map n0 2)
-
-
-static Standard_Boolean errhand; // pb : un seul a la fois, mais ca va si vite
-static TCollection_AsciiString bufstr;
-
-
-// #################################################################
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-IFSelect_WorkSession::IFSelect_WorkSession ()
-{
- theshareout = new IFSelect_ShareOut;
- theerrhand = errhand = Standard_True;
- 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 :
-//purpose :
-//=======================================================================
-
-void IFSelect_WorkSession::SetSignType (const Handle(IFSelect_Signature)& signtype)
-{
- thegtool->SetSignType (signtype);
- if (signtype.IsNull()) thenames.UnBind("xst-sign-type");
- else thenames.Bind("xst-sign-type",signtype);
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Handle(IFSelect_Signature) IFSelect_WorkSession::SignType () const
-{
- return Handle(IFSelect_Signature)::DownCast (thegtool->SignType());
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-void IFSelect_WorkSession::SetShareOut
- (const Handle(IFSelect_ShareOut)& shareout)
-{
- theshareout = shareout;
- thecopier->SetShareOut (theshareout);
-// ... faudrait ajouter les Params, Dispatches, etc...
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-void IFSelect_WorkSession::SetModel
- (const Handle(Interface_InterfaceModel)& model,
- const Standard_Boolean clearpointed)
-{
- 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);
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-IFSelect_ReturnStatus IFSelect_WorkSession::ReadFile(const Standard_CString filename)
-{
- 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 const& anException) {
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- sout<<" **** Interruption ReadFile par Exception : ****\n";
- sout << anException.GetMessageString();
- sout<<"\n Abandon"<<std::endl;
- status = IFSelect_RetFail;
- }
- if (status != IFSelect_RetDone) return status;
- if (model.IsNull()) return IFSelect_RetVoid;
- SetModel (model);
- SetLoadedFile (filename);
- return status;
-}
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-IFSelect_ReturnStatus IFSelect_WorkSession::ReadStream(const Standard_CString theName,
- std::istream& theIStream)
-{
- 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->ReadStream(theName, theIStream, model, theprotocol);
- if (stat == 0) status = IFSelect_RetDone;
- else if (stat < 0) status = IFSelect_RetError;
- else status = IFSelect_RetFail;
- }
- catch (Standard_Failure const& anException) {
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- sout << " **** Interruption ReadFile par Exception : ****\n";
- sout << anException.GetMessageString();
- sout << "\n Abandon" << std::endl;
- status = IFSelect_RetFail;
- }
- if (status != IFSelect_RetDone) return status;
- if (model.IsNull()) return IFSelect_RetVoid;
- SetModel(model);
- SetLoadedFile(theName);
- return status;
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Standard_Integer IFSelect_WorkSession::NbStartingEntities () const
-{
- return (myModel.IsNull()? 0 : myModel->NbEntities());
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Handle(Standard_Transient) IFSelect_WorkSession::StartingEntity (const Standard_Integer num) const
-{
- Handle(Standard_Transient) res; // Null par defaut
- if (myModel.IsNull()) return res;
- if (num < 1 || num > myModel->NbEntities()) return res;
- return myModel->Value(num);
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Standard_Integer IFSelect_WorkSession::StartingNumber (const Handle(Standard_Transient)& ent) const
-{
- return (myModel.IsNull()? 0 : myModel->Number(ent));
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Standard_Integer IFSelect_WorkSession::NumberFromLabel
- (const Standard_CString val, const Standard_Integer afternum) const
-{
- Standard_Integer i, cnt = 0, num = atoi(val);
- if (num > 0 || myModel.IsNull()) return num; // un n0 direct : gagne !
-// Sinon, on considere que c est un label; a traiter en CaseNonSensitive ...
- if (num > myModel->NbEntities()) { num = 0; return num; }
- Standard_Boolean exact = Standard_False;
- Standard_Integer after = (afternum >= 0 ? afternum : -afternum);
- for (i = myModel->NextNumberForLabel (val, after, exact) ; i != 0;
- i = myModel->NextNumberForLabel (val, i, exact)) {
- cnt ++;
- if (num <= 0) num = i;
- }
- if (cnt == 1) return num;
- num = -num;
-
- return num;
-}
-
-
-//=======================================================================
-//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 :
-//=======================================================================
-
-Handle(TCollection_HAsciiString) IFSelect_WorkSession::EntityName (const Handle(Standard_Transient)& ent) const
-{
- if (myModel.IsNull() || ent.IsNull()) return 0;
- Interface_ShareTool sht(thegraph->Graph());
-
- Standard_Integer CN;
- Handle(Interface_GeneralModule) module;
- if (!thegtool->Select (ent,module,CN)) return 0;
- return module->Name (CN,ent,sht);
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Standard_Integer IFSelect_WorkSession::CategoryNumber (const Handle(Standard_Transient)& ent) const
-{
- return (myModel.IsNull()? -1 : myModel->CategoryNumber(StartingNumber(ent)));
-}
-
-
-//=======================================================================
-//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 :
-//=======================================================================
-
-void IFSelect_WorkSession::ClearData (const Standard_Integer mode)
-{
- 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;
- }
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Standard_Boolean IFSelect_WorkSession::ComputeGraph
- (const Standard_Boolean enforce)
-{
- 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;
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Handle(Interface_HGraph) IFSelect_WorkSession::HGraph ()
-{
- ComputeGraph();
- return thegraph;
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-const Interface_Graph& IFSelect_WorkSession::Graph ()
-{
- ComputeGraph();
- if (thegraph.IsNull()) throw Standard_DomainError("IFSelect WorkSession : Graph not available");
- return thegraph->Graph();
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::Shareds
- (const Handle(Standard_Transient)& ent)
-{
- Handle(TColStd_HSequenceOfTransient) list;
- if (!ComputeGraph()) return list;
- if (StartingNumber(ent) == 0) return list;
- return thegraph->Graph().Shareds(ent).Content();
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-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();
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Standard_Boolean IFSelect_WorkSession::IsLoaded () const
-{
- 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;
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Standard_Boolean IFSelect_WorkSession::ComputeCheck
- (const Standard_Boolean enforce)
-{
- 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);
- }
- for (num = 1; num <= nb; num ++)
- if (myModel->IsErrorEntity (num)) BM.SetTrue (num,Flag_Incorrect);
- }
- return Standard_True;
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Interface_CheckIterator IFSelect_WorkSession::ModelCheckList
- (const Standard_Boolean complete)
-{
- 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();
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Handle(Standard_Transient) IFSelect_WorkSession::Item
- (const Standard_Integer id) const
-{
- Handle(Standard_Transient) res;
- if (id <= 0 || id > MaxIdent()) return res;
- if (theitems.FindFromIndex(id).IsNull()) return res;
- return theitems.FindKey(id);
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Standard_Integer IFSelect_WorkSession::ItemIdent
- (const Handle(Standard_Transient)& item) const
-{
- if (item.IsNull()) return 0;
- Standard_Integer id = theitems.FindIndex(item);
- if (id == 0) return 0;
- if (theitems.FindFromIndex(id).IsNull()) return 0;
- return id;
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Handle(Standard_Transient) IFSelect_WorkSession::NamedItem
- (const Standard_CString name) const
-{
- Handle(Standard_Transient) res;
- if (name[0] == '\0') return res;
- if (name[0] == '#') { // #nnn : pas un nom mais un n0 id.
- Standard_Integer id = atoi( &name[1] );
- return Item(id);
- }
- if (!thenames.Find(name,res))
- res.Nullify();
- return res;
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Handle(Standard_Transient) IFSelect_WorkSession::NamedItem
- (const Handle(TCollection_HAsciiString)& name) const
-{
- Handle(Standard_Transient) res;
- if (!name.IsNull()) res = NamedItem (name->ToCString());
- return res;
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Standard_Integer IFSelect_WorkSession::NameIdent
- (const Standard_CString name) const
-{
- Handle(Standard_Transient) res;
- if (name[0] == '\0') return 0;
- if (name[0] == '#') { // #nnn : pas un nom mais un n0 id.
- Standard_Integer id = atoi( &name[1] );
- return id;
- }
- if (!thenames.Find(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')
- thenames.Bind(name, 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.UnBind(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.UnBind
- (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);
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Handle(TCollection_HAsciiString) IFSelect_WorkSession::ItemLabel
- (const Standard_Integer id) const
-{
- Handle(TCollection_HAsciiString) res;
- Handle(Standard_Transient) var = Item(id);
- if (var.IsNull()) return res;
- DeclareAndCast(TCollection_HAsciiString,text,var);
- if (!text.IsNull()) {
- res = new TCollection_HAsciiString("Text:");
- res->AssignCat(text);
- return res;
- }
- DeclareAndCast(IFSelect_IntParam,intpar,var);
- if (!intpar.IsNull()) {
- res = new TCollection_HAsciiString(intpar->Value());
- res->Insert(1,"Integer:");
- return res;
- }
- DeclareAndCast(IFSelect_Selection,sel,var);
- if (!sel.IsNull()) {
- res = new TCollection_HAsciiString("Selection:");
- 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(slc->Name());
- return res;
- }
- DeclareAndCast(IFSelect_Signature,sig,var);
- if (!sig.IsNull()) {
- res = new TCollection_HAsciiString("Signature:");
- 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;
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Handle(TColStd_HSequenceOfInteger) IFSelect_WorkSession::ItemIdents
- (const Handle(Standard_Type)& type) const
-{
- Handle(TColStd_HSequenceOfInteger) list =
- new TColStd_HSequenceOfInteger();
- Standard_Integer nb = theitems.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();
- NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator IT(thenames);
- for (; IT.More(); IT.Next()){
- if (IT.Value()->IsKind(type)) list->Append
- (new TCollection_HAsciiString(IT.Key()));
- }
- 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));
- }
- 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
-{ return Handle(IFSelect_IntParam)::DownCast(Item(id)); }
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Standard_Integer IFSelect_WorkSession::IntValue
- (const Handle(IFSelect_IntParam)& par) const
-{
- if (!par.IsNull()) return par->Value();
- else return 0;
-}
-
-
-//=======================================================================
-//function :
-//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)
-{
- if (ItemIdent(par) == 0) return Standard_False;
- par->SetValue(val);
- return Standard_True;
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Handle(TCollection_HAsciiString) IFSelect_WorkSession::TextParam
- (const Standard_Integer id) const
-{ return Handle(TCollection_HAsciiString)::DownCast(Item(id)); }
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-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)
-{
- if (ItemIdent(par) == 0) return Standard_False;
- par->Clear(); par->AssignCat(val);
- return Standard_True;
-}
-
-// ########################################################################
-// .... SIGNATURES ....
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-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
-{
- if (sign.IsNull() || myModel.IsNull()) return "";
- if (StartingNumber(ent) == 0) return "";
- return sign->Value (ent,myModel);
-}
-
-// ########################################################################
-// .... SELECTIONS & Cie ....
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Handle(IFSelect_Selection) IFSelect_WorkSession::Selection
- (const Standard_Integer id) const
-{ return GetCasted(IFSelect_Selection,Item(id)); }
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Interface_EntityIterator IFSelect_WorkSession::EvalSelection
- (const Handle(IFSelect_Selection)& sel) const
-{
- Interface_EntityIterator iter;
- if (errhand) {
- errhand = Standard_False;
- try {
- OCC_CATCH_SIGNALS
- iter = EvalSelection(sel); // appel normal (donc, code pas duplique)
- }
- catch (Standard_Failure const& anException) {
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- sout<<" **** Interruption EvalSelection par Exception : ****\n";
- sout<<anException.GetMessageString();
- sout<<"\n Abandon"<<std::endl;
- }
- errhand = theerrhand;
- return iter;
- }
-
- if (thegraph.IsNull()) return iter;
- iter = sel->UniqueResult(thegraph->Graph());
- return iter;
-}
-
-
-//=======================================================================
-//function :
-//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) res;
- if (errhand) {
- errhand = Standard_False;
- try {
- OCC_CATCH_SIGNALS
- res = SelectionResult(sel); // appel normal (->code unique)
- }
- catch (Standard_Failure const& anException) {
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- sout<<" **** Interruption SelectionResult par Exception : ****\n";
- sout<<anException.GetMessageString();
- sout<<"\n Abandon"<<std::endl;
- }
- errhand = theerrhand;
- return res;
- }
-
- if (!IsLoaded()) {
- std::cout<< " *** Data for Evaluation not available ***"<<std::endl;
- return new TColStd_HSequenceOfTransient();
- }
-// if (ItemIdent(sel) == 0)
- if (sel.IsNull())
- { std::cout << " Selection : Unknown"<<std::endl; return res; } //std::cout<<Handle
- return EvalSelection (sel).Content();
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::SelectionResultFromList
- (const Handle(IFSelect_Selection)& sel,
- const Handle(TColStd_HSequenceOfTransient)& list) const
-{
- if (list.IsNull()) return SelectionResult (sel);
- DeclareAndCast(IFSelect_SelectDeduct,deduct,sel);
- if (deduct.IsNull()) return SelectionResult (sel);
-
-// On va chercher la derniere deduction de la chaine des inputs
- Handle(IFSelect_Selection) ssel, newinput;
- ssel = sel;
- Standard_Integer i, nb = MaxIdent();
- for (i = 1; i <= nb * 2; i ++) {
- newinput = deduct->Input();
- deduct = GetCasted(IFSelect_SelectDeduct,newinput);
- if (deduct.IsNull()) break;
- ssel = newinput;
- }
-
-// on y est (enfin, on devrait)
-// ssel est la derniere selection auscultee, deduct son downcast
-// input son Input (nulle si sel pas une deduction)
- deduct = GetCasted(IFSelect_SelectDeduct,ssel);
-
- deduct->Alternate()->SetList (list);
-
-// On execute puis on nettoie
- Handle(TColStd_HSequenceOfTransient) res = SelectionResult (sel);
-//// deduct->SetInput (newinput);
- 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 ....
-
-//=======================================================================
-//function :
-//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)) {
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- sout<<" ** RunTransformer has produced Check Messages : **"<<std::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 :
-//=======================================================================
-
-Standard_CString IFSelect_WorkSession::GiveFileRoot
- (const Standard_CString file) const
-{
- OSD_Path path (file);
- if (!path.IsValid(TCollection_AsciiString(file))) return file; // tant pis ..
- bufstr = path.Name();
- return bufstr.ToCString();
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Standard_CString IFSelect_WorkSession::GiveFileComplete
- (const Standard_CString file) const
-{
-// ajouter si besoin : Prefix; Extension
- bufstr.Clear(); bufstr.AssignCat (file);
- Standard_Integer i,j = 0,nb = bufstr.Length();
- Handle(TCollection_HAsciiString) ext = FileExtension ();
- if (!ext.IsNull()) {
- char val0 = '\0'; if (ext->Length() > 0) val0 = ext->Value(1);
- for (i = nb; i > 0; i --) if (bufstr.Value(i) == val0) { j = 1; break; }
- if (j == 0) bufstr.AssignCat (ext->ToCString());
- }
- Handle(TCollection_HAsciiString) pre = FilePrefix ();
- if (!pre.IsNull()) {
- char val1 = '\0'; if (pre->Length() > 0) val1 = pre->Value(pre->Length());
- j = 0;
- for (i = nb; i > 0; i --) if (bufstr.Value(i) == val1) { j = 1; break; }
- if (j == 0) bufstr.Insert (1,pre->ToCString());
- }
-
- return bufstr.ToCString();
-}
-
-
-//=======================================================================
-//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 const& anException) {
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- sout<<" **** Interruption EvaluateFile par Exception : ****\n";
- sout<<anException.GetMessageString();
- sout<<"\n Abandon"<<std::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)) {
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- sout<<" ** EvaluateFile has produced Check Messages : **"<<std::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 const& anException) {
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- sout<<" **** Interruption SendSplit par Exception : ****\n";
- sout<<anException.GetMessageString();
- sout<<"\n Abandon"<<std::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()) {
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- sout<< " *** Data for SendSplit not available ***"<<std::endl;
- checks.CCheck(0)->AddFail("Data not available");
- thecheckrun = checks;
- return Standard_False;
- }
-
- if (NbFiles() > 0) checks = thecopier->SendCopied (thelibrary,theprotocol);
- else {
- /*
- IFSelect_ShareOutResult eval (ShareOut(), thegraph->Graph());
- checks = thecopier->Send (eval, thelibrary, theprotocol);
- thecopier->SetRemaining (thegraph->CGraph());
- */
-// Decomposer
- if (theshareout.IsNull()) return Standard_False;
- Standard_Integer i, nbd = theshareout->NbDispatches();
- Standard_Integer nf = 0;
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- 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) std::cout<<"File "<<filnam<<" failed"<<std::endl;
- }
- }
- sout<<" .. Files Written : "<<nf<<std::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)
-{
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- 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"<<std::endl; return Standard_False;
- } else if (newmod == myModel) {
- sout<<" Remaining causes all original data to be kept"<<std::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"<<std::endl; return Standard_True;
- }
- Interface_EntityIterator iter = SentList(0);
- nb = iter.NbEntities();
- if (nb == 0) {
- sout<<" - No recorded remaining entities"<<std::endl; return Standard_True;
- }
- sout <<" -- Recorded Remaining (not yet sent) Entities --"<<std::endl;
- ListEntities (iter, 2, sout);
- sout << " -- Maximum Sending Count (i.e. duplication in files) "<<
- MaxSendingCount() << std::endl;
-
-/*
- sout<< " - Now, dispatches are deactivated"<<std::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 const& anException) {
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- sout<<" **** Interruption SendAll par Exception : ****\n";
- sout<<anException.GetMessageString();
- sout<<"\n Abandon"<<std::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 const& anException) {
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- sout<<" **** Interruption SendSelected par Exception : ****\n";
- sout<<anException.GetMessageString();
- sout<<"\n Abandon"<<std::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;
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Handle(IFSelect_Selection) IFSelect_WorkSession::NewSelectPointed
- (const Handle(TColStd_HSequenceOfTransient)& list,
- const Standard_CString name)
-{
- Handle(IFSelect_SelectPointed) sel = new IFSelect_SelectPointed;
- if (!list.IsNull()) sel->AddList (list);
- if (AddNamedItem (name,sel) == 0) sel.Nullify();
- return sel;
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Standard_Boolean IFSelect_WorkSession::SetSelectPointed
- (const Handle(IFSelect_Selection)& sel,
- const Handle(TColStd_HSequenceOfTransient)& list,
- const Standard_Integer mode) const
-{
- DeclareAndCast(IFSelect_SelectPointed,sp,sel);
- if (sp.IsNull() || list.IsNull()) return Standard_False;
- if (mode == 0) sp->Clear();
- if (mode >= 0) sp->AddList(list);
- else sp->RemoveList(list);
- 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;
-}
-
-
-//=======================================================================
-//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 ...
-}
-
-// ###########################################################################
-// .... Dumps et Evaluations, pas faciles a passer en arguments ....
-
-// #### #### #### #### #### #### #### #### ####
-// .... DumpShare ....
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-void IFSelect_WorkSession::SetParams
- (const NCollection_Vector<Handle(Standard_Transient)>& params,
- const NCollection_Vector<Standard_Integer>& uselist)
-{
- 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);
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-void IFSelect_WorkSession::TraceStatics
- (const Standard_Integer use, const Standard_Integer mode) const
-{
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (use > 0) {
- if (mode == 0) sout<<"******************************************"<<std::endl;
- if (use == 1) {
- if (mode == 0) sout<<"***** General Parameters *****"<<std::endl;
- } else if (use == 2) {
- if (mode == 0) sout<<"***** Load File *****"<<std::endl;
- } else if (use == 3) {
- if (mode == 0) sout<<"***** Write File *****"<<std::endl;
- } else if (use == 4) {
- if (mode == 0) sout<<"***** Split File *****"<<std::endl;
- } else if (use == 5) {
- if (mode == 0) sout<<"***** Transfer (Read) *****"<<std::endl;
- } else if (use == 6) {
- if (mode == 0) sout<<"***** Transfer (Write) *****"<<std::endl;
- }
- if (mode == 0) sout<<"******************************************"<<std::endl<<std::endl;
- }
-
-// Echainements particuliers (use > 0)
- if (use == 5) {
- TraceStatics (-2,mode);
- if (mode == 0) sout<<std::endl;
- } else if (use == 4 || use == 6) {
- TraceStatics (-3,mode);
- if (mode == 0) sout<<std::endl;
- }
-
-// Valeurs particulieres
- if (use == 1 || use == -1) { // General : trace
- if (mode == 0) {
-// sout << "Trace Level : "<<Message_PrinterOStream::Default()->GetTraceLevel()<<std::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()<<std::endl;
- else sout << "Prefix not Defined" << std::endl;
- str = theshareout->DefaultRootName();
- if (!str.IsNull()) sout << "Default Root : "<<str->ToCString()<<std::endl;
- else sout << "Default Root not Defined" << std::endl;
- str = theshareout->Extension();
- if (!str.IsNull()) sout << "Extension : "<<str->ToCString()<<std::endl;
- else sout << "Extension not defined" << std::endl;
- }
- }
-
-// LISTER LES STATICS
-// Passer par les ParamEditor ...
-
-// Fin
- if (use > 0) {
- if (mode == 0) sout<<"******************************************"<<std::endl<<std::endl;
- }
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-void IFSelect_WorkSession::DumpShare () const
-{
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- sout<<" ********** Definition ShareOut (Complete) **********"<<std::endl;
-
- Handle(TCollection_HAsciiString) str = theshareout->Prefix();
- if (!str.IsNull()) sout << "Prefix : " << str->ToCString() << std::endl;
- else sout << "Prefix not Defined" << std::endl;
- str = theshareout->DefaultRootName();
- if (!str.IsNull()) sout << "Default Root : " << str->ToCString() << std::endl;
- else sout << "Default Root not Defined" << std::endl;
- str = theshareout->Extension();
- if (!str.IsNull()) sout << "Extension : " << str->ToCString() << std::endl;
- else sout << "Extension not defined" << std::endl;
-
- Standard_Integer lr = theshareout->LastRun();
- Standard_Integer nb = theshareout->NbDispatches();
- sout << "Nb Dispatches : " << nb <<" (Last Run : " << lr << ") : "<<std::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() << std::endl;
- Handle(IFSelect_Selection) sel = disp->FinalSelection();
- if (sel.IsNull()) sout << " No Final Selection Defined" << std::endl;
- else if (HasName(sel)) sout << " Final Selection : Name:"
- << Name(sel)->ToCString() << " Label:" << sel->Label() << std::endl;
- else sout << " Final Selection : " << sel->Label() << std::endl;
- if (disp->HasRootName())
- sout<<" File Root Name : "<<disp->RootName()->ToCString()<<std::endl;
- else sout<<" No specific file root name (see Default Root)"<<std::endl;
- }
- Standard_Integer nbm = theshareout->NbModifiers(Standard_True);
- if (nbm > 0) sout<<
- " *** "<<nbm<<" active Model Modifiers : see ListModifiers ***"<<std::endl;
- Standard_Integer nbf = theshareout->NbModifiers(Standard_False);
- if (nbf > 0) sout<<
- " *** "<<nbf<<" active File Modifiers : see ListModifiers ***"<<std::endl;
- if (nbm+nbf == 0) sout<<" *** No active Modifiers ***"<<std::endl;
-}
-
-// #### #### #### #### #### #### #### #### ####
-// .... ListItems ....
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-void IFSelect_WorkSession::ListItems (const Standard_CString lab) const
-{
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- sout<< " ********** Items in Session **********"<<std::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()<<std::endl<<" "<<label->ToCString()<<std::endl;
- }
-}
-
-// #### #### #### #### #### #### #### #### ####
-// .... ListModifiers
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-void IFSelect_WorkSession::ListFinalModifiers
- (const Standard_Boolean formodel) const
-{
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- Standard_Integer nb = theshareout->NbModifiers(formodel);
- sout<< " ********** Modifiers in Session ";
- sout<<(formodel ? "(For Model)" : "(For File)");
- sout<<": "<<nb<<" **********"<<std::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<<std::endl;
- }
-}
-
-// #### #### #### #### #### #### #### #### ####
-// .... DumpSelection ....
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-void IFSelect_WorkSession::DumpSelection
- (const Handle(IFSelect_Selection)& sel) const
-{
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (ItemIdent(sel) == 0) {
- sout << "Selection : Unknown"<<std::endl; //sout<<Handle
- return;
- }
- sout << " ********** Selection";
- if (HasName(sel)) sout << " , Name : " << Name(sel)->ToCString();
- sout <<" **********"<<std::endl;
- sout<< "Label : " << sel->Label() << " . Input(s) : "<< std::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()<<std::endl;
- }
- sout << " Nb Inputs:"<<nb<<std::endl;
-}
-
-
-// ##########################################
-// ######### Fonctions complementaires
-// ##########################################
-
-// #### #### #### #### #### #### #### #### ####
-// .... DumpModel ....
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Handle(IFSelect_Selection) IFSelect_WorkSession::GiveSelection
- (const Standard_CString selname) const
-{
- char nomsel[500];
- Standard_Integer np = -1, nf = -1, nivp = 0;
- for (Standard_Integer n = 0; selname[n] != '\0'; n ++) {
- nomsel[n] = selname[n]; nomsel[n+1] = '\0';
- if (selname[n] == '(') { np = n; nivp ++; }
- if (selname[n] == ')') { nivp --; if (nivp <= 0) nf = n; }
-//// if (selname[n] == ' ') { nb = n; break; }
- }
-
- Handle(IFSelect_Selection) sel;
- if (np >= 0)
- {
- nomsel[np] = 0;
- }
- if (nf >= 0)
- {
- nomsel[nf] = '\0';
- }
- Handle(Standard_Transient) item = NamedItem(nomsel);
-
-// Parentheses ? essayer Signature (plus tard : Selection parametree)
-// NB : on compte les niveaux de parentheses (imbrications repercutees)
- if (np > 0 && nf > 0) {
- Handle(IFSelect_SelectSignature) selsign;
- Standard_Integer debsign = np+1;
-
- DeclareAndCast(IFSelect_Signature,sign,item);
- DeclareAndCast(IFSelect_SignCounter,cnt,item);
- if (!sign.IsNull()) selsign =
- new IFSelect_SelectSignature (sign,&nomsel[debsign],Standard_False);
- else if (!cnt.IsNull()) selsign =
- new IFSelect_SelectSignature (cnt,&nomsel[debsign],Standard_False);
- else {
- std::cout<<selname<<" : neither Signature nor Counter"<<std::endl;
- return sel;
- }
-
- selsign->SetInput (new IFSelect_SelectModelEntities); // par defaut
- sel = selsign;
- }
-
- else sel = GetCasted(IFSelect_Selection,item);
-
- return sel;
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveList
- (const Handle(Standard_Transient)& obj) const
-{
-// Deja une liste
- DeclareAndCast(TColStd_HSequenceOfTransient,list,obj);
- if (!list.IsNull()) return list;
-
-// Rien du tout : retourne rien du tout
- if (obj.IsNull()) return list;
-
-// Une selection : son resultat (standard)
- DeclareAndCast(IFSelect_Selection,sel,obj);
- if (!sel.IsNull()) {
- Interface_EntityIterator iter = EvalSelection(sel);
- return iter.Content();
- }
-
-// Le modele : son contenu
- list = new TColStd_HSequenceOfTransient();
- if (obj == myModel) {
- Standard_Integer i, nb = myModel->NbEntities();
- for (i = 1; i <= nb; i ++) list->Append (myModel->Value(i));
- }
-
-// Une entite du modele : cette entite
- else if (StartingNumber(obj) > 0) list->Append (obj);
-
-// Un Texte : son interpretation
- else {
- DeclareAndCast(TCollection_HAsciiString,str,obj);
- if (!str.IsNull()) return GiveList (str->ToCString());
- }
-
-// Si c est pas tout ca : une liste vide
- return list;
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-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;
- if (first[0] == ' ') return GiveList (&first[1],second);
- if (second && second[0] == ' ') return GiveList (first,&second[1]);
-
-// list NULLE sera interpretee comme SelectionResult (selection toute crue)
-// sinon comme SelectionResultFromList
- if (second && second[0] != '\0') list = GiveList (second,"");
-
- list = GiveListFromList (first,list);
- return list;
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveListFromList
- (const Standard_CString selname, const Handle(Standard_Transient)& ent) const
-{
- Handle(TColStd_HSequenceOfTransient) list;
- Standard_Integer num;
-
-// LISTE DEFINIE D OFFICE (en ce cas, la liste d entree est ignoree)
- if (selname[0] == '(') {
-// liste d entites donnees a la queue leu leu : (ID,ID,ID...)
- char entid[50]; Standard_Integer i,j = 0;
- TColStd_MapOfInteger numap;
- list = new TColStd_HSequenceOfTransient();
- for (i = 1; selname[i] != '\0'; i ++) {
- if (selname[i] == ' ') continue;
- if (selname[i] == ',' || selname[i] == ')') {
- entid[j] = '\0';
- if (j == 0) continue;
- j = 0;
- num = NumberFromLabel (entid);
- if (num <= 0 || !numap.Add (num)) continue;
- Handle(Standard_Transient) anent = StartingEntity(num);
- if (!anent.IsNull()) list->Append (anent);
- if (selname[i] == ')') break;
- continue;
- }
- entid[j] = selname[i]; j ++;
- }
- return list;
- }
- num = NumberFromLabel (selname);
- if (num > 0) return GiveList(StartingEntity(num));
-
-// Autres cas : y atil une liste d entree.
-// Si OUI -> SelectionResultFromList. Si NON -> SelectionResult
-// Si une entite isolee -> on en fait une liste
-
- list = GiveList(ent); // ent NULL -> list NULL sinon intreprete
-
-// Decomposition term1 term2 ...
-
- char nomsel[500]; nomsel[0] = '\0';
- Standard_Integer n= 0 , nb = -1;
- for (n = 0; selname[n] != '\0'; n ++) {
- nomsel[n] = selname[n]; nomsel[n+1] = '\0';
-// if (selname[n] == '(') { np = n; nivp ++; }
-// if (selname[n] == ')') { nivp --; if (nivp <= 0) nf = n; }
- if (selname[n] == ' ') { nb = n; nomsel[n] = '\0'; break; }
- }
- if (nomsel[0] == '\0') return list;
-
- Handle(IFSelect_Selection) sel = GiveSelection (nomsel);
- if (sel.IsNull()) {
- std::cout<<"Neither Entity Number/Label nor Selection :"<<nomsel<<std::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 :
-//=======================================================================
-
-Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveListCombined
- (const Handle(TColStd_HSequenceOfTransient)& l1,
- const Handle(TColStd_HSequenceOfTransient)& l2,
- const Standard_Integer mode) 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);
- }
-
-// 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);
- }
- }
-
- list->Reverse();
- return list;
-}
-
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-void IFSelect_WorkSession::DumpModel
- (const Standard_Integer level, Standard_OStream& S)
-{
- if (!IsLoaded())
- { S << " *** Data for List not available ***"<<std::endl; return; }
- S << "\n *****************************************************************\n";
- if (theloaded.Length() > 0)
- S << " ******** Loaded File : "<<theloaded.ToCString()<<Interface_MSG::Blanks(32-theloaded.Length())<<" ********"<<std::endl;
- else S << " ******** No name for Loaded File"<<std::endl;
- if (level == 0) {
- S <<" ******** Short Dump of Header ********\n";
- S << " *****************************************************************\n\n";
- myModel->DumpHeader (S); S <<std::endl;
- }
-
- Standard_Integer nbent = myModel->NbEntities();
- Standard_Integer nbr = 0;
- Interface_ShareFlags shar(thegraph->Graph());
-
- for (Standard_Integer i = 1; i <= nbent; i ++) {
- if (!shar.IsShared(myModel->Value(i))) nbr ++;
- }
- S << " *****************************************************************\n"
- << " ******** Model : "<<nbent<<" Entities, of which "<<nbr<<" Root(s)\n"
- << " *****************************************************************\n"<<std::endl;
-
- if (level <= 0) return;
- else if (level == 1) {
- S <<" ******** Root Entities ******** ";
- ListEntities (shar.RootEntities(), 1, S);
- } else if (level == 2) {
- S <<" ******** Complete List ******** ";
- ListEntities (myModel->Entities(), 1, S);
- } else if (level > 2) {
- IFSelect_PrintCount mode = IFSelect_ItemsByEntity;
- if (level == 5 || level == 8) mode = IFSelect_CountByItem;
- if (level == 6 || level == 9) mode = IFSelect_ListByItem;
- if (level == 7 || level == 10) mode = IFSelect_EntitiesByItem;
- PrintCheckList (S, ModelCheckList(),Standard_False, mode);
- } else {
- if (level == 3) S << " ******** Check Model (Fails) ********"<<std::endl;
- else S << " ******** Check Model (Complete) ********"<<std::endl;
- Interface_CheckTool CT (Graph());
- Interface_CheckIterator C;
- if (theerrhand) {
- try {
- OCC_CATCH_SIGNALS
- if (level == 3) C = CT.CheckList();
- else C = CT.CompleteCheckList();
- }
- catch (Standard_Failure const&) {
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- sout<<" **** Interruption DumpModel (Check) par Exception ****\n";
- S <<" ** ** Exception Raised during Check ! ** **\n";
- S <<" --> what could be determined is listed"<<std::endl;
- }
- }
- else if (level == 3) C = CT.CheckList();
- else C = CT.CompleteCheckList();
-
-// Check List : si vide (pas demandee), naturellement passee
- try {
- OCC_CATCH_SIGNALS
- C.Print(S,myModel, (level == 3));
- }
- catch (Standard_Failure const& anException) {
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- sout<<" **** Interruption DumpModel par Exception : ****\n";
- sout<<anException.GetMessageString();
- sout<<"\n Abandon"<<std::endl;
- }
-
- }
- S <<std::endl<<"There are "<<nbent<<" Entities, of which "<<nbr<<" Root(s)"<<std::endl;
-}
-
-// .... TraceDumpModel .... (Model + CheckList)
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-void IFSelect_WorkSession::TraceDumpModel
- (const Standard_Integer mode)
-{
- Message_Messenger::StreamBuffer sout = Message::SendInfo(); // should it be changed to SendTrace()?
- 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,
- Standard_OStream& S) const
-{
- if (!IsLoaded())
- { S << " *** Data for List not available ***"<<std::endl; return; }
- Standard_Integer num = myModel->Number(ent);
- if (num == 0) { S <<" *** Entity to Dump not in the Model ***"<<std::endl; return; }
- if (thelibrary.IsNull()) { S <<" *** WorkLibrary not defined ***"<<std::endl; return; }
- S << " ******** Dumping Entity n0 "<<num
- <<" level:"<<level<<" ********"<<std::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
-{
- Message_Messenger::StreamBuffer sout = Message::SendInfo(); // should it be changed to SendTrace()?
- DumpEntity (ent, level, sout);
-}
-
-// .... PrintEntityStatus ....
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-void IFSelect_WorkSession::PrintEntityStatus
- (const Handle(Standard_Transient)& ent, Standard_OStream& S)
-{
- Standard_Integer i,nb;
- Standard_Integer num = StartingNumber(ent);
- if (num == 0) { std::cout<<" -- PrintEntityStatus : unknown"<<std::endl; return; }
-
- S <<" Ent. n0/id: ";
- myModel->Print (ent, S);
- Handle(TCollection_HAsciiString) hname = EntityName(ent);
- if (!hname.IsNull() && hname->Length() > 0) S <<" Name:"<<hname->ToCString();
- S <<std::endl;
- Handle(IFSelect_Signature) signtype = SignType();
- if (signtype.IsNull()) S <<" Type(CDL):"<<ent->DynamicType()->Name()<<std::endl;
- else S <<" Type:"<<signtype->Value (ent,myModel)<<std::endl;
- S <<" Category : " <<CategoryName (ent)
- <<" Validity : " <<ValidityName (ent) << std::endl;
- Interface_CheckIterator chl = CheckOne (ent);
- chl.Print (S,myModel,Standard_False,Standard_False);
-
- Handle(TColStd_HSequenceOfTransient) list = Sharings(ent);
- if (list.IsNull()) S <<" Root"<<std::endl;
- else {
- nb = list->Length();
- if (nb == 0) S <<" Root";
- else S <<" Super-entities:"<<nb<<" : (n0/id):";
- for (i = 1; i <= nb; i ++) { S <<" "; myModel->Print(list->Value(i), S); }
- S <<std::endl;
- }
- list = Shareds (ent);
- if (list.IsNull()) S <<" No sub-entity"<<std::endl;
- else {
- nb = list->Length();
- if (nb == 0) S <<" No sub-entity";
- else S <<" Sub-entities:"<<nb<<" , i.e. (n0/id):";
- for (i = 1; i <= nb; i ++) { S <<" "; myModel->Print(list->Value(i), S); }
- S <<std::endl;
- }
-}
-
-// .... PrintCheckList ....
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-void IFSelect_WorkSession::PrintCheckList (Standard_OStream& S,
- const Interface_CheckIterator& checklist,
- const Standard_Boolean failsonly,
- const IFSelect_PrintCount mode) const
-{
-// mode : 0 comptage 1 n0s entites 2 n0s+id ents
- if (mode == IFSelect_ItemsByEntity) checklist.Print (S,myModel,failsonly);
- else {
- Interface_CheckIterator chks = checklist;
- Handle(IFSelect_CheckCounter) counter =
- new IFSelect_CheckCounter (mode>1 && mode != IFSelect_CountSummary);
- counter->Analyse (chks,myModel,Standard_True,failsonly);
- counter->PrintList (S, myModel, mode);
- }
-}
-
-// .... PrintSignatureList ....
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-void IFSelect_WorkSession::PrintSignatureList (Standard_OStream& S,
- const Handle(IFSelect_SignatureList)& signlist,
- const IFSelect_PrintCount mode) const
-{
- if (signlist.IsNull()) return;
- signlist->PrintList (S, myModel, mode);
-}
-
-// #### #### #### #### #### #### #### #### ####
-// .... EvaluateSelection ....
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-void IFSelect_WorkSession::EvaluateSelection
- (const Handle(IFSelect_Selection)& sel) const
-{
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (errhand) {
- errhand = Standard_False;
- try {
- OCC_CATCH_SIGNALS
- EvaluateSelection(sel); // appel normal (->code unique)
- }
- catch (Standard_Failure const& anException) {
- sout<<" **** Interruption EvaluateSelection par Exception **** Intitule\n";
- sout<<anException.GetMessageString();
- sout<<"\n Abandon"<<std::endl;
- }
- errhand = theerrhand;
- return;
- }
-
- if (!IsLoaded())
- { sout<< " *** Data for Evaluation not available ***"<<std::endl; return; }
- if (ItemIdent(sel) == 0)
- { sout << " Selection : Unknown"<<std::endl; return; } //sout<<Handle
- Interface_EntityIterator iter = EvalSelection (sel);
- ListEntities (iter, 1, sout);
- sout << "**** (Unique) RootResult, Selection : "
- <<sel->Label()<<std::endl;
-}
-
-
-// #### #### #### #### #### #### #### #### ####
-// .... EvaluateDispatch ....
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-void IFSelect_WorkSession::EvaluateDispatch
- (const Handle(IFSelect_Dispatch)& disp, const Standard_Integer mode) const
-{
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (errhand) {
- errhand = Standard_False;
- try {
- OCC_CATCH_SIGNALS
- EvaluateDispatch(disp,mode); // appel normal (->code unique)
- }
- catch (Standard_Failure const& anException) {
- sout<<" **** Interruption EvaluateDispatch par Exception **** Intitule\n";
- sout<<anException.GetMessageString();
- sout<<"\n Abandon"<<std::endl;
- }
- errhand = theerrhand;
- return;
- }
-
- Standard_Integer numdisp = DispatchRank(disp);
- if (!IsLoaded())
- { sout<< " *** Data for List not available ***"<<std::endl; return; }
- if (theshareout->NbDispatches() < numdisp || numdisp <= 0)
- { sout<<"Dispatch : Unknown"<<std::endl; return; } //sout<<Handle
- if (disp->FinalSelection().IsNull())
- { sout<<"Dispatch : No Final Selection"<<std::endl; return; }//sout<<Handle
- sout<<" --- Dispatch Label : "<<disp->Label()<<std::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<<" :"<<std::endl;
- for (numpack = 1; numpack <= nbpack; numpack ++) {
- sout<<"\n **** Packet n0 : "<<numpack<<" ****"<<std::endl;
- if (!mode) std::cout<<"Root Entities :"<<std::endl;
- ListEntities (evres->Entities(numpack), (mode ? 2 : -1), sout);
- }
-
-//// Interface_EntityIterator iterem = disp->Remainder(thegraph->Graph());
- if (mode == 0) return;
- if (mode == 1 || mode == 3) {
- sout<<std::endl;
- if (evres->NbDuplicated(0,Standard_False) == 0)
- sout<<" **** All the Model is taken into account ****"<<std::endl;
- else {
- sout<<" **** Starting Entities not taken by this Dispatch ****"<<std::endl;
- ListEntities (evres->Duplicated(0,Standard_False), 2, sout);
- }
- }
- if (mode >= 2) {
- sout<<" **** Entites in more than one packet ****";
- Standard_Integer max = evres->HighestDuplicationCount();
- if (max < 2) sout<<" : There are none"<<std::endl;
- else {
- Standard_Integer newcount;
- sout<<std::endl;
- for (newcount = 2; newcount <= max; newcount ++) {
- if (evres->NbDuplicated(newcount,Standard_False) == 0) continue;
- sout<<" **** Entities put in "<<newcount<<" packets ****"<<std::endl;
- ListEntities (evres->Duplicated(newcount,Standard_False), 2, sout);
- }
- }
- }
-}
-
-
-// #### #### #### #### #### #### #### #### ####
-// .... EvaluateComplete ....
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-void IFSelect_WorkSession::EvaluateComplete
- (const Standard_Integer mode) const
-{
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- if (errhand) {
- errhand = Standard_False;
- try {
- OCC_CATCH_SIGNALS
- EvaluateComplete(mode); // appel normal (donc, code pas duplique)
- }
- catch (Standard_Failure const& anException) {
- sout<<" **** Interruption EvaluateComplete par Exception : ****\n";
- sout<<anException.GetMessageString();
- sout<<"\n Abandon"<<std::endl;
- }
- errhand = theerrhand;
- return;
- }
-
- if (!IsLoaded())
- { sout<< " *** Data for List not available ***"<<std::endl; return; }
- IFSelect_ShareOutResult eval(theshareout,thegraph->Graph());
- eval.Evaluate();
- sout<<"\n******** Evaluation ShareOutResult (Complete) ********\n";
- sout<<" **** List of Packets **** Count : "<<eval.NbPackets()<<std::endl;
- if (mode == 0) sout << " ** (for each one : Root Entities) **"<<std::endl;
- else sout << " ** (for each one : Evaluated Content) **"<<std::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<<" :"<<std::endl;
- for (numpack = 1; numpack <= nbpack; numpack ++) {
- sout<<"\n **** Packet n0 : "<<numpack<<" ****"<<std::endl;
- if (!mode) std::cout<<"Root Entities :"<<std::endl;
- ListEntities (evres->Entities(numpack), (mode ? 2: -1), sout);
- }
- if (mode == 0) return;
- if (mode == 1 || mode == 3) {
- sout<<std::endl;
- if (evres->NbDuplicated(0,Standard_False) == 0)
- sout<<" **** All the Model is taken into account ****"<<std::endl;
- else {
- sout<<" **** Starting Entities Forgotten ****"<<std::endl;
- ListEntities (evres->Duplicated(0,Standard_False), 2, sout);
- }
- }
- if (mode >= 2) {
- sout<<" **** Entites in more than one packet ****"<<std::endl;
- Standard_Integer max = evres->HighestDuplicationCount();
- if (max < 2) sout<<" : There are none"<<std::endl;
- else {
- Standard_Integer newcount;
- sout<<std::endl;
- for (newcount = 2; newcount <= max; newcount ++) {
- if (evres->NbDuplicated(newcount,Standard_False) == 0) continue;
- sout<<" **** Entities put in "<<newcount<<" packets ****"<<std::endl;
- ListEntities (evres->Duplicated(newcount,Standard_False), 2, sout);
- }
- }
- }
-}
-
-
-// #### #### #### #### #### #### #### #### ####
-// .... Routine Interne : ListEntities
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-void IFSelect_WorkSession::ListEntities
- (const Interface_EntityIterator& iter, const Standard_Integer mmode, Standard_OStream& sout) const
-{
- int titre = 0;
- Standard_Integer mode = (mmode < 0 ? -mmode : mmode);
- if (mmode >= 0) sout << " List of " << iter.NbEntities() << " Entities :"<<std::endl;
- if (!IsLoaded())
- { sout<< " *** Data for List not available ***"<<std::endl; return; }
- Interface_ShareFlags tool(thegraph->Graph());
-
- try {
- OCC_CATCH_SIGNALS
- int newcount = -1; int mods = 0; int cnt = 0;
- for (iter.Start(); iter.More(); iter.Next()) {
- if (!titre && mode == 1) sout
- << "Number/Id. Category Validity Type\n----------- ----...."<<std::endl;
-// 123456789 123456789 123456 123456789 123456789 123456
- if (!titre && mode == 0) sout<<" Keys : R Root ? Unknown * Unloaded"<<std::endl;
- if (!titre && mode == 2) sout<<"(";
- titre = 1;
- Handle(Standard_Transient) ent = iter.Value();
- Standard_Integer num = myModel->Number(ent);
- if (mode == 1) {
- // n0 id (root?) category validity tracetype
- sout<<Interface_MSG::Blanks (num,6);
- myModel->Print (ent, sout, 0);
- if (!tool.IsShared(ent)) sout << " #ROOT#";
- else sout << " ";
- Standard_Integer catnum = myModel->CategoryNumber(num);
- if (catnum > 0) sout<<" "<<Interface_Category::Name (catnum);
- sout << " (" << ValidityName (ent) << ") ";
-
- sout<<" Type:"<<myModel->TypeName (ent, Standard_False)<<std::endl;
- } else if (mode == 2) {
- newcount ++;
- if (newcount > 0) sout<<",";
- sout<<num;
- } else {
- newcount ++; mods = 0; cnt ++;
- if (newcount >= 10) { sout << std::endl<<"["<<cnt<<"]:"; newcount = 1; }
- if (newcount > 0) sout << " ";
- myModel->Print (ent, sout, 0);
- if (!tool.IsShared(ent)) { if(mods == 0) sout<<"("; sout<<"R"; mods++; }
- if (myModel->IsUnknownEntity(num)) { sout<<(mods==0 ? '(' : ' ')<<"?"; mods ++; }
- if (myModel->IsRedefinedContent(num)) { sout<<(mods==0 ? '(' : ' ')<<"*"; mods ++; }
- if (mods) { sout<<")"; newcount ++; }
- }
- }
- if (mode == 0) sout<<std::endl;
- if (mode == 2) sout<<")"<<std::endl;
- }
- catch (Standard_Failure const& anException) {
- sout<<" **** Interruption ListEntities par Exception : ****\n";
- sout<<anException.GetMessageString();
- sout<<"\n Abandon"<<std::endl;
- }
-}
+++ /dev/null
-// Created on: 1992-12-15
-// 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_WorkSession_HeaderFile
-#define _IFSelect_WorkSession_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <Interface_CheckIterator.hxx>
-#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
-#include <Standard_Transient.hxx>
-#include <NCollection_Vector.hxx>
-#include <NCollection_DataMap.hxx>
-#include <Standard_CString.hxx>
-#include <IFSelect_ReturnStatus.hxx>
-#include <Standard_Integer.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-#include <TColStd_HSequenceOfHAsciiString.hxx>
-#include <IFSelect_RemainMode.hxx>
-#include <IFSelect_PrintCount.hxx>
-class IFSelect_ShareOut;
-class IFSelect_WorkLibrary;
-class Interface_Protocol;
-class Interface_InterfaceModel;
-class Interface_HGraph;
-class Interface_GTool;
-
-class IFSelect_ModelCopier;
-class IFSelect_Signature;
-class TCollection_HAsciiString;
-class Interface_Graph;
-class IFSelect_IntParam;
-class IFSelect_Selection;
-class Interface_EntityIterator;
-class IFSelect_SelectionIterator;
-class IFSelect_SignCounter;
-class IFSelect_Dispatch;
-class IFSelect_GeneralModifier;
-class IFSelect_Modifier;
-class IFSelect_Transformer;
-class IFSelect_PacketList;
-class IFSelect_SignatureList;
-
-class IFSelect_WorkSession;
-DEFINE_STANDARD_HANDLE(IFSelect_WorkSession, Standard_Transient)
-
-//! 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 Standard_Transient
-{
-
-public:
-
- //! 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 presence 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 applications)
- 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; }
-
- //! Sets a specific Signature to be the SignType, i.e. the
- //! Signature which will determine TypeName from the Model
- //! (basic function). It is recorded in the GTool
- //! This Signature is also set as "xst-sign-type" (reserved name)
- Standard_EXPORT void SetSignType (const Handle(IFSelect_Signature)& signtype);
-
- //! 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);
-
- //! Reads a file from stream 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 ReadStream (const Standard_CString theName, std::istream& theIStream);
-
- //! Returns the count of Entities stored in the Model, or 0
- Standard_EXPORT Standard_Integer NbStartingEntities() const;
-
- //! Returns an Entity stored in the Model of the WorkSession
- //! (Null Handle is no Model or num out of range)
- Standard_EXPORT Handle(Standard_Transient) StartingEntity (const Standard_Integer num) const;
-
- //! Returns the Number of an Entity in the Model
- //! (0 if no Model set or <ent> not in the Model)
- Standard_EXPORT Standard_Integer StartingNumber (const Handle(Standard_Transient)& ent) const;
-
- //! From a given label in Model, returns the corresponding number
- //! Starts from first entity by Default, may start after a given
- //! number : this number may be given negative, its absolute value
- //! is then considered. Hence a loop on NumberFromLabel may be
- //! programmed (stop test is : returned value positive or null)
- //!
- //! Returns 0 if not found, < 0 if more than one found (first
- //! found in negative).
- //! 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
- Standard_EXPORT Handle(TCollection_HAsciiString) EntityName (const Handle(Standard_Transient)& ent) const;
-
- //! Returns the Category Number determined for an entity
- //! it is computed by the class Category
- //! 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 the list of entities sharing <ent> (can be empty)
- //! 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, queries ...
- //! 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
- //! Global Check, else the Check for the given entity
- //! <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 the Maximum Value for an Item Identifier. It can be
- //! greater to the count of known Items, because some can have
- //! been removed
- Standard_EXPORT Standard_Integer MaxIdent() const;
-
- //! Returns an Item, given its Ident. Returns a Null Handle if
- //! no Item corresponds to this Ident.
- Standard_EXPORT Handle(Standard_Transient) Item (const Standard_Integer id) const;
-
- //! Returns the Ident attached to an Item in the WorkSession, or
- //! Zero if it is unknown
- Standard_EXPORT Standard_Integer ItemIdent (const Handle(Standard_Transient)& item) const;
-
- //! Returns the Item which corresponds to a Variable, given its
- //! Name (whatever the type of this Item).
- //! Returns a Null Handle if this Name is not recorded
- Standard_EXPORT Handle(Standard_Transient) NamedItem (const Standard_CString name) const;
-
- //! Same as above, but <name> is given through a Handle
- //! Especially useful with methods SelectionNames, etc...
- Standard_EXPORT Handle(Standard_Transient) NamedItem (const Handle(TCollection_HAsciiString)& name) const;
-
- //! 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();
-
- //! Returns a Label which illustrates the content of an Item,
- //! given its Ident. This Label is :
- //! - for a Text Parameter, "Text:<text value>"
- //! - for an Integer Parameter, "Integer:<integer value>"
- //! - for a Selection, a Dispatch or a Modifier, its Label
- //! (see these classes)
- //! - for any other kind of Variable, its cdl type
- Standard_EXPORT Handle(TCollection_HAsciiString) ItemLabel (const Standard_Integer id) const;
-
- //! Fills a Sequence with the List of Idents attached to the Items
- //! of which Type complies with (IsKind) <type> (alphabetic order)
- //! Remark : <type> = TYPE(Standard_Transient) gives all the
- //! 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)
- Standard_EXPORT Handle(IFSelect_IntParam) IntParam (const Standard_Integer id) const;
-
- //! 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);
-
- //! Returns a TextParam, given its Ident in the Session
- //! Null result if <id> is not suitable for a TextParam
- //! (undefined, or defined for another kind of variable)
- Standard_EXPORT Handle(TCollection_HAsciiString) TextParam (const Standard_Integer id) const;
-
- //! Returns Text Value of a TextParam (a String)
- //! 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);
-
- //! Returns a Signature, given its Ident in the Session
- //! Null result if <id> is not suitable for a Signature
- //! (undefined, or defined for another kind of variable)
- Standard_EXPORT Handle(IFSelect_Signature) Signature (const Standard_Integer id) const;
-
- //! Returns the Value computed by a Signature for an Entity
- //! Returns an empty string if the entity does not belong to the
- //! loaded model
- Standard_EXPORT Standard_CString SignValue (const Handle(IFSelect_Signature)& sign, const Handle(Standard_Transient)& ent) const;
-
- //! Returns a Selection, given its Ident in the Session
- //! Null result if <id> is not suitable for a Selection
- //! (undefined, or defined for another kind of variable)
- Standard_EXPORT Handle(IFSelect_Selection) Selection (const Standard_Integer id) const;
-
- //! Evaluates the effect of a Selection applied on the input Model
- //! 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
- //! Returns a Null Handle if <sel> is not in the WorkSession
- Standard_EXPORT Handle(TColStd_HSequenceOfTransient) SelectionResult (const Handle(IFSelect_Selection)& sel) const;
-
- //! Returns the result of a Selection, by forcing its input with
- //! a given list <list> (unless <list> is Null).
- //! RULES :
- //! <list> applies only for a SelectDeduct kind Selection :
- //! its Input is considered : if it is a SelectDeduct kind
- //! Selection, its Input is considered, etc... until an Input
- //! is not a Deduct/Extract : its result is replaced by <list>
- //! 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 sequentially 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 recommended)
- //! -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);
-
- //! Extracts File Root Name from a given complete file name
- //! (uses OSD_Path)
- Standard_EXPORT Standard_CString GiveFileRoot (const Standard_CString file) const;
-
- //! Completes a file name as required, with Prefix and Extension
- //! (if defined; for a non-defined item, completes nothing)
- Standard_EXPORT Standard_CString GiveFileComplete (const Standard_CString file) const;
-
- //! Erases all stored data from the File Evaluation
- //! (i.e. ALL former naming information 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 conditioned
- //! (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
- //! <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
- //! (the ideal case)
- //! Remaining Data are computed on each Sending/Copying output
- //! files (see methods EvaluateFile and SendSplit)
- //! 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 occurred (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;
-
- //! Toggles the Sense (Direct <-> Reversed) of a SelectExtract
- //! Returns True if Done, False if <sel> is not a SelectExtract or
- //! is not in the WorkSession
- Standard_EXPORT Standard_Boolean ToggleSelectExtract (const Handle(IFSelect_Selection)& sel);
-
- //! Sets an Input Selection (as <input>) to a SelectExtract or
- //! a SelectDeduct (as <sel>).
- //! Returns True if Done, False if <sel> is neither a
- //! SelectExtract nor a SelectDeduct, or not in the WorkSession
- Standard_EXPORT Standard_Boolean SetInputSelection (const Handle(IFSelect_Selection)& sel, const Handle(IFSelect_Selection)& input);
-
- //! Sets an Input Selection, Main if <formain> is True, Second else
- //! (as <sc>) to a SelectControl (as <sel>). Returns True if Done,
- //! False if <sel> is not a SelectControl, or <sc> or <sel> is not
- //! in the WorkSession
- Standard_EXPORT Standard_Boolean SetControl (const Handle(IFSelect_Selection)& sel, const Handle(IFSelect_Selection)& sc, const Standard_Boolean formain = Standard_True);
-
- //! Adds an input selection to a SelectCombine (Union or Inters.).
- //! Returns new count of inputs for this SelectCombine if Done or
- //! 0 if <sel> is not kind of SelectCombine, or if <seladd> or
- //! <sel> is not in the WorkSession
- //! By default, adding is done at the end of the list
- //! Else, it is an insertion to rank <atnum> (useful for Un-ReDo)
- Standard_EXPORT Standard_Integer CombineAdd (const Handle(IFSelect_Selection)& selcomb, const Handle(IFSelect_Selection)& seladd, const Standard_Integer atnum = 0);
-
- //! Removes an input selection from a SelectCombine (Union or
- //! Intersection). Returns True if done, False if <selcomb> is not
- //! kind of SelectCombine or <selrem> is not source of <selcomb>
- Standard_EXPORT Standard_Boolean CombineRemove (const Handle(IFSelect_Selection)& selcomb, const Handle(IFSelect_Selection)& selrem);
-
- //! Creates a new Selection, of type SelectPointed, its content
- //! starts with <list>. A name must be given (can be empty)
- Standard_EXPORT Handle(IFSelect_Selection) NewSelectPointed (const Handle(TColStd_HSequenceOfTransient)& list, const Standard_CString name);
-
- //! Changes the content of a Selection of type SelectPointed
- //! According <mode> : 0 set <list> as new content (clear former)
- //! 1 : adds <list> to actual content
- //! -1 : removes <list> from actual content
- //! Returns True if done, False if <sel> is not a SelectPointed
- Standard_EXPORT Standard_Boolean SetSelectPointed (const Handle(IFSelect_Selection)& sel, const Handle(TColStd_HSequenceOfTransient)& list, const Standard_Integer mode) const;
-
- //! Returns a Selection from a Name :
- //! - the name of a Selection : this Selection
- //! - the name of a Signature + criteria between (..) : a new
- //! Selection from this Signature
- //! - an entity or a list of entities : a new SelectPointed
- //! Else, returns a Null Handle
- Standard_EXPORT Handle(IFSelect_Selection) GiveSelection (const Standard_CString selname) const;
-
- //! Determines a list of entities from an object :
- //! <obj> already HSequenceOfTransient : returned itself
- //! <obj> Selection : its Result of Evaluation is returned
- //! <obj> an entity of the Model : a HSequence which contains it
- //! else, an empty HSequence
- //! <obj> the Model it self : ALL its content (not only the roots)
- Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GiveList (const Handle(Standard_Transient)& obj) const;
-
- //! Computes a List of entities from two alphanums,
- //! first and second, as follows :
- //! if <first> is a Number or Label of an entity : this entity
- //! if <first> is a list of Numbers/Labels : the list of entities
- //! if <first> is the name of a Selection in <WS>, and <second>
- //! not defined, the standard result of this Selection
- //! else, let's consider "first second" : this whole phrase is
- //! split by blanks, as follows (RECURSIVE CALL) :
- //! - the leftest term is the final selection
- //! - the other terms define the result of the selection
- //! - and so on (the "leftest minus one" is a selection, of which
- //! the input is given by the remaining ...)
- Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GiveList (const Standard_CString first, const Standard_CString second = "") const;
-
- //! Computes a List of entities from the model as follows
- //! <first> being a Selection or a combination of Selections,
- //! <ent> being an entity or a list
- //! of entities (as a HSequenceOfTransient) :
- //! the standard result of this selection applied to this list
- //! if <ent> is Null, the standard definition of the selection is
- //! used (which contains a default input selection)
- //! if <selname> is erroneous, a null handle is returned
- //!
- //! REMARK : selname is processed as <first second> of preceding
- //! 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
- //! If <use> is negative, just values are printed
- //! (this allows to make compositions)
- //! Remark : use number 5 commands use -2 to be traced
- //! 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;
-
- //! Lists the content of the Input Model (if there is one)
- //! According level : 0 -> gives only count of Entities and Roots
- //! 1 -> Lists also Roots; 2 -> Lists all Entities (by TraceType)
- //! 3 -> Performs a call to CheckList (Fails) and lists the result
- //! 4 -> as 3 but all CheckList (Fails + Warnings)
- //! 5,6,7 : as 3 but resp. Count,List,Labels by Fail
- //! 8,9,10 : as 4 but resp. Count,List,Labels by message
- Standard_EXPORT void DumpModel (const Standard_Integer level, Standard_OStream& S);
-
- //! Dumps the current Model (as inherited DumpModel), on currently
- //! 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, Standard_OStream& S) const;
-
- //! Prints main information 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, Standard_OStream& 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>
- //! <mode> defines the mode of printing
- //! 0 : sequential, according entities; else with a CheckCounter
- //! 1 : according messages, count of entities
- //! 2 : id but with list of entities, designated by their numbers
- //! 3 : as 2 but with labels of entities
- Standard_EXPORT void PrintCheckList (Standard_OStream& S,
- 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 (Standard_OStream& S,
- 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, Standard_OStream& S) const;
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_WorkSession,Standard_Transient)
-
- protected:
-
- Handle(Interface_HGraph) thegraph;
- Interface_CheckIterator thecheckrun;
- TColStd_IndexedDataMapOfTransientTransient theitems;
- NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thenames;
-
- private:
-
- 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;
-};
-
-#endif // _IFSelect_WorkSession_HeaderFile
aReader.SetNameMode(aNode->InternalParameters.ReadName);
aReader.SetLayerMode(aNode->InternalParameters.ReadLayer);
- IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid;
+ XSControl_ReturnStatus aReadStat = XSControl_RetVoid;
if (!toUseLoaded)
{
aReadStat = aReader.ReadFile(thePath.ToCString());
}
else if (theWS->NbStartingEntities() > 0)
{
- aReadStat = IFSelect_RetDone;
+ aReadStat = XSControl_RetDone;
}
- if (aReadStat != IFSelect_RetDone)
+ if (aReadStat != XSControl_RetDone)
{
Message::SendFail() << "Error: IGESCAFControl_Provider : ["
<< aFile << "] : abandon, no model loaded";
IGESControl_Reader aReader;
aReader.SetWS(theWS);
aReader.SetReadVisible(aNode->InternalParameters.ReadOnlyVisible);
- IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid;
+ XSControl_ReturnStatus aReadStat = XSControl_RetVoid;
aReadStat = aReader.ReadFile(thePath.ToCString());
- if (aReadStat != IFSelect_RetDone)
+ if (aReadStat != XSControl_RetDone)
{
Message::SendFail() << "Error: IGESCAFControl_Provider : [" <<
thePath << "] : Could not read file, no model loaded";
const Handle(TDocStd_Document) &doc,
const Message_ProgressRange& theProgress)
{
- if ( ReadFile ( filename ) != IFSelect_RetDone ) return Standard_False;
+ if ( ReadFile ( filename ) != XSControl_RetDone ) return Standard_False;
return Transfer ( doc, theProgress );
}
const Message_ProgressRange& theProgress)
{
if ( ! Transfer ( doc, theProgress ) ) return Standard_False;
- return Write ( filename ) == IFSelect_RetDone;
+ return Write ( filename ) == XSControl_RetDone;
}
//=======================================================================
const Message_ProgressRange& theProgress)
{
if ( ! Transfer ( doc, theProgress ) ) return Standard_False;
- return Write ( filename.ToCString() ) == IFSelect_RetDone;
+ return Write ( filename.ToCString() ) == XSControl_RetDone;
}
//=======================================================================
//#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 <IFSelect_EditForm.hxx>
-#include <IFSelect_SelectModelEntities.hxx>
-#include <IFSelect_SelectModelRoots.hxx>
-#include <IFSelect_SelectType.hxx>
-#include <IFSelect_SignMultiple.hxx>
-#include <IFSelect_SignType.hxx>
#include <IGESAppli.hxx>
#include <IGESBasic_SubfigureDef.hxx>
#include <IGESControl_ActorWrite.hxx>
#include <IGESData_Protocol.hxx>
#include <IGESSelect_AutoCorrect.hxx>
#include <IGESSelect_ComputeStatus.hxx>
-#include <IGESSelect_CounterOfLevelNumber.hxx>
#include <IGESSelect_EditDirPart.hxx>
#include <IGESSelect_EditHeader.hxx>
#include <IGESSelect_FloatFormat.hxx>
IGESAppli::Init();
init = Standard_True;
}
- //AddSessionItem (new IGESSelect_RemoveCurves(Standard_True) ,"iges-remove-pcurves");
- //AddSessionItem (new IGESSelect_RemoveCurves(Standard_False),"iges-remove-curves-3d");
- //AddSessionItem (new IGESSelect_SetLabel (0,Standard_True) ,"iges-clear-label");
- //AddSessionItem (new IGESSelect_SetLabel (1,Standard_False),"iges-set-label-dnum");
-
- //AddSessionItem (new IGESSelect_AutoCorrect,"iges-auto-correct",Standard_True);
- //AddSessionItem (new IGESSelect_ComputeStatus,"iges-compute-status",Standard_True);
-
- //Handle(IGESSelect_FloatFormat) flf = new IGESSelect_FloatFormat;
- //flf->SetDefault (12);
- //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);
- //AddSessionItem (pa3, "iges-header-val-sender");
- //AddSessionItem (set3,"iges-header-set-sender",Standard_True);
-
- //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);
- //AddSessionItem (pa12, "iges-header-val-receiver");
- //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);
- //AddSessionItem (pa21, "iges-header-val-author");
- //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);
- //AddSessionItem (pa22, "iges-header-val-company");
- //AddSessionItem (set22,"iges-header-set-company",Standard_True);
-
- //// -- STATICS
-
- //TraceStatic ("read.iges.bspline.approxd1.mode",5);
- //TraceStatic ("read.iges.bspline.continuity",5);
-
- //TraceStatic ("write.iges.header.receiver",2);
- //TraceStatic ("write.iges.header.author",2);
- //TraceStatic ("write.iges.header.company",2);
- //TraceStatic ("write.iges.unit",6);
- //TraceStatic ("write.iges.brep.mode",6);
myAdaptorLibrary = new IGESSelect_WorkLibrary(themode);
myAdaptorProtocol = IGESSelect_WorkLibrary::DefineProtocol();
myAdaptorRead = anactiges;
myAdaptorWrite = new IGESControl_ActorWrite;
-
- //SetModeWrite (0,1);
- //SetModeWriteHelp (0,"Faces");
- //SetModeWriteHelp (1,"BRep");
}
-void IGESControl_Controller::Customise(Handle(XSControl_WorkSession)& WS)
-{
- XSControl_Controller::Customise(WS);
-
- //// --- SELECTIONS, SIGNATURES, COMPTEURS, EDITEURS
- //// -- BypassGroup / xst-model-roots
-
- //// Should be already set by the above call to Customise
- //Handle(IFSelect_SelectModelEntities) xma;
- //Handle(Standard_Transient) xma1 = WS->NamedItem("xst-model-all");
- //if (xma1.IsNull()) xma = new IFSelect_SelectModelEntities;
- //else {
- // xma = Handle(IFSelect_SelectModelEntities)::DownCast(xma1);
- // WS->AddNamedItem ("xst-model-all",xma);
- //}
- //
- //Handle(IFSelect_SelectModelRoots) xmr;
- //Handle(Standard_Transient) xmr1 = WS->NamedItem("xst-model-roots");
- //if (!xmr1.IsNull())
- // xmr = Handle(IFSelect_SelectModelRoots)::DownCast(xmr1);
- //else {
- // xmr = new IFSelect_SelectModelRoots;
- // WS->AddNamedItem ("xst-model-roots",xmr);
- //}
-
- //Handle(XSControl_SelectForTransfer) xtr;
- //Handle(Standard_Transient) xtr1 = WS->NamedItem("xst-transferrable-roots");
- //if (!xtr1.IsNull())
- // xtr = Handle(XSControl_SelectForTransfer)::DownCast(xtr1);
- //else {
- // xtr = new XSControl_SelectForTransfer;
- // xtr->SetReader (WS->TransferReader());
- // WS->AddNamedItem ("xst-transferrable-roots",xtr);
- //}
-
- //if (!xmr.IsNull()) {
- // Handle(IGESSelect_SelectVisibleStatus) visa = new IGESSelect_SelectVisibleStatus;
- // visa->SetInput(xmr);
- // WS->AddNamedItem ("iges-visible-roots",visa);
- // Handle(IGESSelect_SelectVisibleStatus) vist = new IGESSelect_SelectVisibleStatus;
- // vist->SetInput(xtr);
- // WS->AddNamedItem ("iges-visible-transf-roots",vist);
- // Handle(IGESSelect_SelectVisibleStatus) blka = new IGESSelect_SelectVisibleStatus;
- // blka->SetDirect (Standard_False);
- // blka->SetInput(xmr);
- // WS->AddNamedItem ("iges-blanked-roots",blka);
- // Handle(IGESSelect_SelectVisibleStatus) blkt = new IGESSelect_SelectVisibleStatus;
- // blkt->SetDirect (Standard_False);
- // blkt->SetInput(xtr);
- // WS->AddNamedItem ("iges-blanked-transf-roots",blkt);
- // Handle(IGESSelect_SelectSubordinate) indp = new IGESSelect_SelectSubordinate (0);
- // indp->SetInput (xma);
- // WS->AddNamedItem ("iges-status-independant",indp);
-
- // Handle(IGESSelect_SelectBypassGroup) sb = new IGESSelect_SelectBypassGroup;
- // sb->SetInput(xmr);
- // WS->AddNamedItem ("iges-bypass-group",sb);
- // Handle(IGESSelect_SelectBypassSubfigure) sfi = new IGESSelect_SelectBypassSubfigure;
- // sfi->SetInput(xmr);
- // WS->AddNamedItem ("iges-bypass-subfigure",sfi);
- // Handle(IGESSelect_SelectBypassGroup) sfb = new IGESSelect_SelectBypassGroup;
- // sfb->SetInput(sfi);
- // WS->AddNamedItem ("iges-bypass-group-subfigure",sfb);
- // Handle(IGESSelect_SelectBasicGeom) sc3d = new IGESSelect_SelectBasicGeom(1);
- // sc3d->SetInput(sfi);
- // WS->AddNamedItem ("iges-curves-3d",sc3d);
- // Handle(IGESSelect_SelectBasicGeom) sb3d = new IGESSelect_SelectBasicGeom(2);
- // sb3d->SetInput(sfi);
- // WS->AddNamedItem ("iges-basic-curves-3d",sb3d);
- // Handle(IGESSelect_SelectBasicGeom) sbg = new IGESSelect_SelectBasicGeom(0);
- // sbg->SetInput(sfi);
- // WS->AddNamedItem ("iges-basic-geom",sbg);
- // Handle(IGESSelect_SelectBasicGeom) srf = new IGESSelect_SelectBasicGeom(-1);
- // srf->SetInput(sfi);
- // WS->AddNamedItem ("iges-surfaces",srf);
- // Handle(IGESSelect_SelectFaces) sfa = new IGESSelect_SelectFaces;
- // sfa->SetInput(sfi);
- // WS->AddNamedItem ("iges-faces",sfa );
- // Handle(IGESSelect_SelectPCurves) spc = new IGESSelect_SelectPCurves(Standard_True);
- // spc->SetInput(sfa);
- // WS->AddNamedItem ("iges-pcurves",spc);
-
- // Handle(IFSelect_SelectType) snosub = new IFSelect_SelectType
- // (STANDARD_TYPE(IGESBasic_SubfigureDef));
- // snosub->SetDirect(Standard_False);
- // snosub->SetInput(xmr);
- // WS->AddNamedItem ("iges-no-indep-subfigure-def",snosub);
-
- // Handle(IGESSelect_IGESTypeForm) itf = new IGESSelect_IGESTypeForm(Standard_True);
- // WS->AddNamedItem ("iges-type",itf);
-
- // Handle(IGESSelect_SignStatus) sigst = new IGESSelect_SignStatus;
- // Handle(IFSelect_SignMultiple) typsta = new IFSelect_SignMultiple
- // ("IGES Type Form Status");
- // typsta->Add (itf,15);
- // typsta->Add (sigst);
- // WS->AddNamedItem ("iges-type-status",typsta);
-
- // Handle(IFSelect_SignMultiple) typnam = new IFSelect_SignMultiple
- // ("IGES Type Form TypeName");
- // typnam->Add (itf,4);
- // typnam->Add (new IFSelect_SignType(Standard_True));
- // WS->AddNamedItem ("iges-type-name",typnam);
-
- // Handle(IFSelect_SignCounter) itfs = new IFSelect_SignCounter
- // (itf,Standard_False,Standard_True);
- // WS->AddNamedItem ("iges-types",itfs);
- // Handle(IGESSelect_CounterOfLevelNumber) levs =
- // new IGESSelect_CounterOfLevelNumber;
- // WS->AddNamedItem ("iges-levels",levs);
-
- // Handle(IGESSelect_SignLevelNumber) slev = new IGESSelect_SignLevelNumber(Standard_False);
- // WS->AddNamedItem ("iges-level-number",slev);
- // Handle(IGESSelect_IGESName) igna = new IGESSelect_IGESName;
- // WS->AddNamedItem ("iges-name",igna);
-
- // Handle(IGESSelect_SignColor) scol1 = new IGESSelect_SignColor (1);
- // WS->AddNamedItem ("iges-color-number",scol1);
- // Handle(IGESSelect_SignColor) scol2 = new IGESSelect_SignColor (2);
- // WS->AddNamedItem ("iges-color-name",scol2);
- // Handle(IGESSelect_SignColor) scol3 = new IGESSelect_SignColor (3);
- // WS->AddNamedItem ("iges-color-rgb",scol3);
- // Handle(IGESSelect_SignColor) scol4 = new IGESSelect_SignColor (4);
- // WS->AddNamedItem ("iges-color-red",scol4);
- // Handle(IGESSelect_SignColor) scol5 = new IGESSelect_SignColor (5);
- // WS->AddNamedItem ("iges-color-green",scol5);
- // 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);
-
- // //szv:mySignType = typnam;
- // WS->SetSignType( typnam );
- //}
-}
-
-
//=======================================================================
//function : NewModel
//purpose :
//purpose :
//=======================================================================
-IFSelect_ReturnStatus IGESControl_Controller::TransferWriteShape (const TopoDS_Shape& shape,
+XSControl_ReturnStatus IGESControl_Controller::TransferWriteShape (const TopoDS_Shape& shape,
const Handle(Transfer_FinderProcess)& FP,
const Handle(Interface_InterfaceModel)& model,
const Standard_Integer modetrans,
#include <Standard_Type.hxx>
#include <XSControl_Controller.hxx>
-#include <IFSelect_ReturnStatus.hxx>
+#include <XSControl_ReturnStatus.hxx>
#include <Standard_Integer.hxx>
class Interface_InterfaceModel;
class Transfer_ActorOfTransientProcess;
//! -2 bad model (requires an IGESModel)
//! modeshape : 0 groupe of face (version < 5.1)
//! 1 BREP-version 5.1 of IGES
- Standard_EXPORT virtual IFSelect_ReturnStatus TransferWriteShape
+ Standard_EXPORT virtual XSControl_ReturnStatus TransferWriteShape
(const TopoDS_Shape& shape,
const Handle(Transfer_FinderProcess)& FP,
const Handle(Interface_InterfaceModel)& model,
//! Returns True when done, False if could not be done
//! Also, it creates and records an Adaptor for FNES
Standard_EXPORT static Standard_Boolean Init();
-
- Standard_EXPORT virtual void Customise (Handle(XSControl_WorkSession)& WS) Standard_OVERRIDE;
+++ /dev/null
-IGESSelect_AddFileComment.cxx
-IGESSelect_AddFileComment.hxx
-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_FileModifier.hxx
-IGESSelect_FileModifier_0.cxx
-IGESSelect_FloatFormat.cxx
-IGESSelect_FloatFormat.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_SelectFromDrawing.hxx
-IGESSelect_SelectFromSingleView.cxx
-IGESSelect_SelectFromSingleView.hxx
-IGESSelect_SelectLevelNumber.cxx
-IGESSelect_SelectLevelNumber.hxx
-IGESSelect_SelectName.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
-IGESSelect_WorkLibrary.cxx
-IGESSelect_WorkLibrary.hxx
+++ /dev/null
-// Created on: 1994-08-26
-// 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_ContextWrite.hxx>
-#include <IGESData_IGESWriter.hxx>
-#include <IGESSelect_AddFileComment.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_AddFileComment,IGESSelect_FileModifier)
-
-IGESSelect_AddFileComment::IGESSelect_AddFileComment ()
- { thelist = new TColStd_HSequenceOfHAsciiString(); }
-
- void IGESSelect_AddFileComment::Clear ()
- { thelist->Clear(); }
-
-
- void IGESSelect_AddFileComment::AddLine (const Standard_CString line)
- { thelist->Append (new TCollection_HAsciiString(line)); }
-
- void IGESSelect_AddFileComment::AddLines
- (const Handle(TColStd_HSequenceOfHAsciiString)& lines)
- { thelist->Append (lines); }
-
- Standard_Integer IGESSelect_AddFileComment::NbLines () const
- { return thelist->Length(); }
-
- Standard_CString IGESSelect_AddFileComment::Line
- (const Standard_Integer num) const
- { return thelist->Value(num)->ToCString(); }
-
- Handle(TColStd_HSequenceOfHAsciiString) IGESSelect_AddFileComment::Lines
- () const
- { return thelist; }
-
- void IGESSelect_AddFileComment::Perform
- (IFSelect_ContextWrite& ,
- IGESData_IGESWriter& writer) const
-{
- Standard_Integer i, nb = NbLines();
- for (i = 1; i <= nb; i ++) {
- writer.SendStartLine (Line(i));
- }
-}
-
- TCollection_AsciiString IGESSelect_AddFileComment::Label () const
-{
- Standard_Integer nb = NbLines();
- char labl[80];
- sprintf (labl, "Add %d Comment Lines (Start Section)",nb);
- return TCollection_AsciiString (labl);
-}
+++ /dev/null
-// Created on: 1994-08-26
-// 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_AddFileComment_HeaderFile
-#define _IGESSelect_AddFileComment_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TColStd_HSequenceOfHAsciiString.hxx>
-#include <IGESSelect_FileModifier.hxx>
-#include <Standard_Integer.hxx>
-class IFSelect_ContextWrite;
-class IGESData_IGESWriter;
-class TCollection_AsciiString;
-
-
-class IGESSelect_AddFileComment;
-DEFINE_STANDARD_HANDLE(IGESSelect_AddFileComment, IGESSelect_FileModifier)
-
-//! This class allows to add comment lines on writing an IGES File
-//! These lines are added to Start Section, instead of the only
-//! one blank line written by default.
-class IGESSelect_AddFileComment : public IGESSelect_FileModifier
-{
-
-public:
-
-
- //! Creates a new empty AddFileComment. Use AddLine to complete it
- Standard_EXPORT IGESSelect_AddFileComment();
-
- //! Clears the list of file comment lines already stored
- Standard_EXPORT void Clear();
-
- //! Adds a line for file comment
- //! Remark : Lines are limited to 72 useful char.s . A line of more than
- //! 72 char.s will be splited into several ones of 72 max each.
- Standard_EXPORT void AddLine (const Standard_CString line);
-
- //! Adds a list of lines for file comment
- //! Each of them must comply with demand of AddLine
- Standard_EXPORT void AddLines (const Handle(TColStd_HSequenceOfHAsciiString)& lines);
-
- //! Returns the count of stored lines
- Standard_EXPORT Standard_Integer NbLines() const;
-
- //! Returns a stored line given its rank
- Standard_EXPORT Standard_CString Line (const Standard_Integer num) const;
-
- //! Returns the complete list of lines in once
- Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) Lines() const;
-
- //! Sends the comment lines to the file (Start Section)
- Standard_EXPORT void Perform (IFSelect_ContextWrite& ctx, IGESData_IGESWriter& writer) const Standard_OVERRIDE;
-
- //! Returns specific Label, which is
- //! "Add <nn> Comment Lines (Start Section)"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_AddFileComment,IGESSelect_FileModifier)
-
-protected:
-
-
-
-
-private:
-
-
- Handle(TColStd_HSequenceOfHAsciiString) thelist;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_AddFileComment_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 <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_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>
-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_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>
-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 <IGESData_IGESEntity.hxx>
-#include <IGESGraph_DefinitionLevel.hxx>
-#include <IGESSelect_CounterOfLevelNumber.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_CounterOfLevelNumber,IFSelect_SignCounter)
-
-IGESSelect_CounterOfLevelNumber::IGESSelect_CounterOfLevelNumber
- (const Standard_Boolean withmap, const Standard_Boolean withlist)
- : IFSelect_SignCounter (withmap,withlist)
- { thehigh = thenblists = 0; SetName("IGES Level Number"); }
-
- void IGESSelect_CounterOfLevelNumber::Clear ()
- { IFSelect_SignCounter::Clear();
- thelevels.Nullify(); thehigh = thenblists = 0; }
-
-
- void IGESSelect_CounterOfLevelNumber::AddSign
- (const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& /*model*/)
-{
- DeclareAndCast(IGESData_IGESEntity,igesent,ent);
- if (igesent.IsNull()) return;
- DeclareAndCast(IGESGraph_DefinitionLevel,levelist,igesent->LevelList());
- Standard_Integer level = igesent->Level();
- if (levelist.IsNull() && level < 0) return;
-
-// Enregistrer ce/ces niveau(x)
- if (levelist.IsNull()) AddLevel(ent,level);
- else {
- Standard_Integer nb = levelist->NbPropertyValues();
- for (Standard_Integer i = 1; i <= nb; i ++) {
- level = levelist->LevelNumber(i);
- AddLevel(ent,level);
- }
- AddLevel(ent,-1);
- }
-}
-
-
- void IGESSelect_CounterOfLevelNumber::AddLevel
- (const Handle(Standard_Transient)& ent, const Standard_Integer level)
-{
- if (level < 0) {
- thenblists ++;
- Add (ent,"LEVEL LIST");
- return;
- }
- if (thelevels.IsNull()) { thelevels =
- new TColStd_HArray1OfInteger ( 0, (level > 100 ? level : 100) );
- thelevels->Init(0); }
- Standard_Integer upper = thelevels->Upper();
- if (level > upper) {
- Handle(TColStd_HArray1OfInteger) levels =
- new TColStd_HArray1OfInteger (0,level + 100); levels->Init(0);
- for (Standard_Integer i = 1; i <= upper; i ++)
- levels->SetValue(i,thelevels->Value(i));
- thelevels = levels;
- }
- thelevels->SetValue (level,thelevels->Value(level)+1);
- if (level > thehigh) thehigh = level;
-
-// if (level == 0) Add(ent," NO LEVEL");
-// else {
- char signature[30];
- sprintf (signature,"%7d",level);
- Add (ent,signature);
-// }
-}
-
-
- Standard_Integer IGESSelect_CounterOfLevelNumber::HighestLevel () const
- { return thehigh; }
-
- Standard_Integer IGESSelect_CounterOfLevelNumber::NbTimesLevel
- (const Standard_Integer level) const
-{
- if (level < 0) return thenblists;
- if (level > thehigh) return 0;
- return thelevels->Value(level);
-}
-
-
- Handle(TColStd_HSequenceOfInteger) IGESSelect_CounterOfLevelNumber::Levels
- () const
-{
- Handle(TColStd_HSequenceOfInteger) list = new TColStd_HSequenceOfInteger ();
- for (Standard_Integer i = 1; i <= thehigh; i ++) {
- if (thelevels->Value(i) > 0) list->Append(i);
- }
- return list;
-}
-
-
- Handle(TCollection_HAsciiString) IGESSelect_CounterOfLevelNumber::Sign
- (const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& /*model*/) const
-{
- Handle(TCollection_HAsciiString) res;
-// reprend les termes de AddSign pour la preparation (lecture du level) ...
- DeclareAndCast(IGESData_IGESEntity,igesent,ent);
- if (igesent.IsNull()) return res;
- DeclareAndCast(IGESGraph_DefinitionLevel,levelist,igesent->LevelList());
- Standard_Integer level = igesent->Level();
- if (levelist.IsNull() && level < 0) return res;
-
-// puis ceux de AddLevel pour calculer la signature
- if (level < 0) return new TCollection_HAsciiString ("LEVEL LIST");
- char signature[30];
- sprintf (signature,"%7d",level);
- return new TCollection_HAsciiString (signature);
-}
-
-
- void IGESSelect_CounterOfLevelNumber::PrintCount
- (Standard_OStream& S) const
-{
- IFSelect_SignatureList::PrintCount (S);
- S <<" Highest value : " << thehigh << std::endl;
- if (thenblists > 0) S <<"REMARK for LEVEL LIST : Entities are counted in"
- <<" <LEVEL LIST>\n, and in each Level value of their list"<<std::endl;
-}
+++ /dev/null
-// Created on: 1994-05-31
-// 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_CounterOfLevelNumber_HeaderFile
-#define _IGESSelect_CounterOfLevelNumber_HeaderFile
-
-#include <TColStd_HArray1OfInteger.hxx>
-#include <IFSelect_SignCounter.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-
-class Interface_InterfaceModel;
-class TCollection_HAsciiString;
-
-class IGESSelect_CounterOfLevelNumber;
-DEFINE_STANDARD_HANDLE(IGESSelect_CounterOfLevelNumber, IFSelect_SignCounter)
-
-//! This class gives information about Level Number. It counts
-//! entities according level number, considering also the
-//! multiple level (see the class LevelList) for which an entity
-//! is attached to each of the listed levels.
-//!
-//! Data are available, as level number, or as their alphanumeric
-//! counterparts ("LEVEL nnnnnnn", " NO LEVEL", " LEVEL LIST")
-class IGESSelect_CounterOfLevelNumber : public IFSelect_SignCounter
-{
-
-public:
-
-
- //! Creates a CounterOfLevelNumber, clear, ready to work
- //! <withmap> and <withlist> are transmitted to SignCounter
- Standard_EXPORT IGESSelect_CounterOfLevelNumber(const Standard_Boolean withmap = Standard_True, const Standard_Boolean withlist = Standard_False);
-
- //! Resets already memorized information : also numeric data
- Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
-
- //! Adds an entity by considering its lrvrl number(s)
- //! A level is added both in numeric and alphanumeric form,
- //! i.e. LevelList gives "LEVEL LIST", others (no level or
- //! positive level) displays level number on 7 digits (C : %7d)
- //! Remark : an entity attached to a Level List is added for
- //! " LEVEL LIST", and for each of its constituent levels
- Standard_EXPORT virtual void AddSign (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) Standard_OVERRIDE;
-
- //! The internal action to record a new level number, positive,
- //! null (no level) or negative (level list)
- Standard_EXPORT void AddLevel (const Handle(Standard_Transient)& ent, const Standard_Integer level);
-
- //! Returns the highest value found for a level number
- Standard_EXPORT Standard_Integer HighestLevel() const;
-
- //! Returns the number of times a level is used,
- //! 0 if it has not been recorded at all
- //! <level> = 0 counts entities attached to no level
- //! <level> < 0 counts entities attached to a LevelList
- Standard_EXPORT Standard_Integer NbTimesLevel (const Standard_Integer level) const;
-
- //! Returns the ordered list of used positive Level numbers
- Standard_EXPORT Handle(TColStd_HSequenceOfInteger) Levels() const;
-
- //! Determines and returns the value of the signature for an
- //! entity as an HAsciiString. Redefined, gives the same result
- //! as AddSign, see this method ("LEVEL LIST" or "nnnnnnn")
- Standard_EXPORT virtual Handle(TCollection_HAsciiString) Sign (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
-
- //! Prints the counts of items (not the list) then the Highest
- //! Level Number recorded
- Standard_EXPORT virtual void PrintCount (Standard_OStream& S) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_CounterOfLevelNumber,IFSelect_SignCounter)
-
-protected:
-
-
-
-
-private:
-
-
- Standard_Integer thehigh;
- Standard_Integer thenblists;
- Handle(TColStd_HArray1OfInteger) thelevels;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_CounterOfLevelNumber_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>
-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>
-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 <IGESSelect_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)
-
-//#include <IGESSelect_SelectIGESTypeForm.hxx>
-IGESSelect_Dumper::IGESSelect_Dumper () { }
-
-
- 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(IGESSelect_FloatFormat)) {
- DeclareAndCast(IGESSelect_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("IGESSelect_FloatFormat")) {
- if (file.NbParams() < 2) return Standard_False;
- Handle(IGESSelect_FloatFormat) ff = new IGESSelect_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 Standard_Transient;
-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
- Standard_EXPORT 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)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#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_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_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_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_FileModifier_HeaderFile
-#define _IGESSelect_FileModifier_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_GeneralModifier.hxx>
-class IGESData_IGESWriter;
-class IFSelect_ContextWrite;
-
-
-class IGESSelect_FileModifier;
-DEFINE_STANDARD_HANDLE(IGESSelect_FileModifier, IFSelect_GeneralModifier)
-
-
-class IGESSelect_FileModifier : public IFSelect_GeneralModifier
-{
-
-public:
-
-
- //! Perform the action specific to each class of File Modifier
- //! <ctx> is the ContextWrite, which brings : the model, the
- //! protocol, the file name, plus the object AppliedModifiers
- //! (not used here) and the CheckList
- //! Remark that the model has to be casted for specific access
- //!
- //! <writer> is the Writer and is specific to each norm, on which
- //! to act
- Standard_EXPORT virtual void Perform (IFSelect_ContextWrite& ctx, IGESData_IGESWriter& writer) const = 0;
-
-
-
-
- DEFINE_STANDARD_RTTI_INLINE(IGESSelect_FileModifier,IFSelect_GeneralModifier)
-
-protected:
-
-
- //! Sets a File Modifier to keep the graph of dependences
- //! unchanges (because it works on the model already produced)
- Standard_EXPORT IGESSelect_FileModifier();
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_FileModifier_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_FileModifier.hxx>
-
-#include <Standard_Type.hxx>
-
-#include <IGESData_IGESWriter.hxx>
-#include <IFSelect_ContextWrite.hxx>
-
-
-
-
-
-
-
-
-
-
-#define Writer IGESData_IGESWriter
-#define Writer_hxx <IGESData_IGESWriter.hxx>
-#define IFSelect_FileModifier IGESSelect_FileModifier
-#define IFSelect_FileModifier_hxx <IGESSelect_FileModifier.hxx>
-#define Handle_IFSelect_FileModifier Handle(IGESSelect_FileModifier)
-#include <IFSelect_FileModifier.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 <IFSelect_ContextWrite.hxx>
-#include <IGESData_IGESWriter.hxx>
-#include <IGESSelect_FloatFormat.hxx>
-#include <Interface_FloatWriter.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_FloatFormat,IGESSelect_FileModifier)
-
-IGESSelect_FloatFormat::IGESSelect_FloatFormat ()
- : thezerosup (Standard_True) , themainform ("%E") ,
- theformrange ("%f") , therangemin (0.1) , therangemax (1000.)
- { }
-
- void IGESSelect_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 IGESSelect_FloatFormat::SetZeroSuppress (const Standard_Boolean mode)
- { thezerosup = mode; }
-
- void IGESSelect_FloatFormat::SetFormat (const Standard_CString format)
- { themainform.Clear(); themainform.AssignCat(format); }
-
-
- void IGESSelect_FloatFormat::SetFormatForRange
- (const Standard_CString form, const Standard_Real R1, const Standard_Real R2)
-{
- theformrange.Clear(); theformrange.AssignCat(form);
- therangemin = R1; therangemax = R2;
-}
-
- void IGESSelect_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 IGESSelect_FloatFormat::Perform
- (IFSelect_ContextWrite& /*ctx*/,
- 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 IGESSelect_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 _IGESSelect_FloatFormat_HeaderFile
-#define _IGESSelect_FloatFormat_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <IGESSelect_FileModifier.hxx>
-#include <Standard_Integer.hxx>
-class IFSelect_ContextWrite;
-class IGESData_IGESWriter;
-
-
-class IGESSelect_FloatFormat;
-DEFINE_STANDARD_HANDLE(IGESSelect_FloatFormat, IGESSelect_FileModifier)
-
-//! 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 IGESSelect_FloatFormat : public IGESSelect_FileModifier
-{
-
-public:
-
-
- //! Creates a new FloatFormat, with standard options :
- //! ZeroSuppress, Main Format = %E,
- //! Format between 0.001 and 1000. = %f
- Standard_EXPORT IGESSelect_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
- Standard_EXPORT void SetZeroSuppress (const Standard_Boolean mode);
-
- //! Sets Main Format to a new value
- //! Remark : SetFormat, SetZeroSuppress and SetFormatForRange are
- //! independent
- 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 (IFSelect_ContextWrite& ctx, IGESData_IGESWriter& writer) const Standard_OVERRIDE;
-
- //! 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(IGESSelect_FloatFormat,IGESSelect_FileModifier)
-
-protected:
-
-
-
-
-private:
-
-
- Standard_Boolean thezerosup;
- TCollection_AsciiString themainform;
- TCollection_AsciiString theformrange;
- Standard_Real therangemin;
- Standard_Real therangemax;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_FloatFormat_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_IGESName.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_IGESName,IFSelect_Signature)
-
-static char falsetype [] = "?";
-static char voidlabel [] = "";
-
-
-
- IGESSelect_IGESName::IGESSelect_IGESName ()
- : IFSelect_Signature ("IGES Name (Short Label)") { }
-
- Standard_CString IGESSelect_IGESName::Value
- (const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& /*model*/) const
-{
- DeclareAndCast(IGESData_IGESEntity,igesent,ent);
- if (igesent.IsNull()) return &falsetype[0];
- Handle(TCollection_HAsciiString) label = igesent->ShortLabel();
- if (label.IsNull()) return &voidlabel[0];
- return label->ToCString();
-}
+++ /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 _IGESSelect_IGESName_HeaderFile
-#define _IGESSelect_IGESName_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Signature.hxx>
-#include <Standard_CString.hxx>
-class Standard_Transient;
-class Interface_InterfaceModel;
-
-
-class IGESSelect_IGESName;
-DEFINE_STANDARD_HANDLE(IGESSelect_IGESName, IFSelect_Signature)
-
-//! IGESName is a Signature specific to IGESNorm :
-//! it considers the Name of an IGESEntity as being its ShortLabel
-//! (some sending systems use name, not to identify entities, but
-//! ratjer to classify them)
-class IGESSelect_IGESName : public IFSelect_Signature
-{
-
-public:
-
-
- //! Creates a Signature for IGES Name (reduced to ShortLabel,
- //! without SubscriptLabel or Long Name)
- Standard_EXPORT IGESSelect_IGESName();
-
- //! Returns the ShortLabel as being the Name of an IGESEntity
- //! If <ent> has no name, it returns empty string ""
- Standard_EXPORT Standard_CString Value (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_IGESName,IFSelect_Signature)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_IGESName_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_UndefinedEntity.hxx>
-#include <IGESSelect_IGESTypeForm.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_IGESTypeForm,IFSelect_Signature)
-
-static char falsetype [] = "?";
-static char typeval [30]; // une seule reponse a la fois ...
-
-
-
- IGESSelect_IGESTypeForm::IGESSelect_IGESTypeForm
- (const Standard_Boolean withform)
-//JR/Hp
-: IFSelect_Signature ((Standard_CString ) (withform ? "IGES Type & Form Numbers" : "IGES Type Number"))
-//: IFSelect_Signature (withform ? "IGES Type & Form Numbers" : "IGES Type Number")
- { theform = withform; }
-
- void IGESSelect_IGESTypeForm::SetForm (const Standard_Boolean withform)
- { theform = withform; thename.Clear();
-//JR/Hp
- Standard_CString astr = (Standard_CString ) (withform ? "IGES Type & Form Numbers" : "IGES Type Number") ;
- thename.AssignCat ( astr ); }
-// thename.AssignCat (withform ? "IGES Type & Form Numbers" : "IGES Type Number") ;
-
- Standard_CString IGESSelect_IGESTypeForm::Value
- (const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& /*model*/) const
-{
- DeclareAndCast(IGESData_IGESEntity,igesent,ent);
- if (igesent.IsNull()) return &falsetype[0];
- Standard_Boolean unk = ent->IsKind(STANDARD_TYPE(IGESData_UndefinedEntity));
- Standard_Integer typenum = igesent->TypeNumber();
- Standard_Integer formnum = igesent->FormNumber();
- if (unk) {
- if (theform) sprintf (typeval,"%d %d (?)",typenum,formnum);
- else sprintf (typeval,"%d (?)",typenum);
- } else {
- if (theform) sprintf (typeval,"%d %d",typenum,formnum);
- else sprintf (typeval,"%d", typenum);
- }
- return &typeval[0];
-}
+++ /dev/null
-// Created on: 1994-05-31
-// 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_IGESTypeForm_HeaderFile
-#define _IGESSelect_IGESTypeForm_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Signature.hxx>
-#include <Standard_CString.hxx>
-class Standard_Transient;
-class Interface_InterfaceModel;
-
-// Avoid possible conflict with SetForm macro defined by windows.h
-#ifdef SetForm
-#undef SetForm
-#endif
-
-class IGESSelect_IGESTypeForm;
-DEFINE_STANDARD_HANDLE(IGESSelect_IGESTypeForm, IFSelect_Signature)
-
-//! IGESTypeForm is a Signature specific to the IGES Norm :
-//! it gives the signature under two possible forms :
-//! - as "mmm nnn", with "mmm" as IGES Type Number, and "nnn"
-//! as IGES From Number (even if = 0) [Default]
-//! - as "mmm" alone, which gives only the IGES Type Number
-class IGESSelect_IGESTypeForm : public IFSelect_Signature
-{
-
-public:
-
-
- //! Creates a Signature for IGES Type & Form Numbers
- //! If <withform> is False, for IGES Type Number only
- Standard_EXPORT IGESSelect_IGESTypeForm(const Standard_Boolean withform = Standard_True);
-
- //! Changes the mode for giving the Form Number
- Standard_EXPORT void SetForm (const Standard_Boolean withform);
-
- //! Returns the signature for IGES, "mmm nnn" or "mmm" according
- //! creation choice (Type & Form or Type only)
- Standard_EXPORT Standard_CString Value (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_IGESTypeForm,IFSelect_Signature)
-
-protected:
-
-
-
-
-private:
-
-
- Standard_Boolean theform;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_IGESTypeForm_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>
-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 <IFSelect_ContextModif.hxx>
-#include <IFSelect_PacketList.hxx>
-#include <IGESData_IGESModel.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_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_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, "WithoutBackP"
-//! 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_BoundedSurface.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 <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 <IGESBasic_Group.hxx>
-#include <IGESBasic_SingleParent.hxx>
-#include <IGESData_IGESEntity.hxx>
-#include <IGESGeom_BoundedSurface.hxx>
-#include <IGESGeom_CompositeCurve.hxx>
-#include <IGESGeom_Plane.hxx>
-#include <IGESGeom_TrimmedSurface.hxx>
-#include <IGESSelect_SelectBasicGeom.hxx>
-#include <IGESSolid_EdgeList.hxx>
-#include <IGESSolid_ManifoldSolid.hxx>
-#include <IGESSolid_Shell.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_SelectBasicGeom,IFSelect_SelectExplore)
-
-IGESSelect_SelectBasicGeom::IGESSelect_SelectBasicGeom
- (const Standard_Integer mode)
- : IFSelect_SelectExplore (-1) { thegeom = mode; }
-
- Standard_Boolean IGESSelect_SelectBasicGeom::Explore
- (const Standard_Integer /*level*/, const Handle(Standard_Transient)& ent,
- const Interface_Graph& /*G*/, Interface_EntityIterator& explored) const
-{
-// thegeom > 0 : curves3d < 0 : surfaces == 0 : curves3d + surfaces libres
-
- DeclareAndCast(IGESData_IGESEntity,igesent,ent);
- if (igesent.IsNull()) return Standard_False;
- Standard_Integer igt = igesent->TypeNumber();
-
-// CompositeCurve : a decomposer ?
- if (igt == 102 && thegeom == 2) {
- DeclareAndCast(IGESGeom_CompositeCurve,cmc,ent);
- Standard_Integer i, nb = cmc->NbCurves();
- for (i = 1; i <= nb; i ++) explored.AddItem (cmc->Curve(i));
- return Standard_True;
- }
-
-// Lignes en general. Attention CopiousData, aux variantes "habillage"
- if (igt == 106) return (igesent->FormNumber() < 20);
- if ( (igt >= 100 && igt <= 106) || igt == 110 || igt == 112 || igt == 116 ||
- igt == 126 || igt == 130) return (thegeom >= 0);
-
-// Surfaces LIBRES, car il n y a pas d autre moyen de les reperer
-// (l ideal serait de prendre les bords naturels)
-// Ou surfaces debarassees de leurs contours
- if (igt == 114 || igt == 118 || igt == 120 || igt == 122 || igt == 128 || igt == 140 || igt == 190)
- return (thegeom <= 0);
-
-// Plan 108
-// mode surface : on retourne tout le Plane sinon c est inexploitable
- if (igt == 108) {
- DeclareAndCast(IGESGeom_Plane,pln,ent);
- if (thegeom >= 0) explored.AddItem(pln->BoundingCurve());
- return pln->HasBoundingCurve();
- }
-
- if (igt == 116) return (thegeom >= 0); // on point, ca va bien ...
-
-// TrimmedSurface 144
- if (igt == 144) {
- DeclareAndCast(IGESGeom_TrimmedSurface,trs,ent);
- if (thegeom >= 0) {
- explored.AddItem(trs->OuterContour());
- Standard_Integer i, nb = trs->NbInnerContours();
- for (i = 1; i <= nb; i ++) explored.AddItem (trs->InnerContour(i));
- }
- else explored.AddItem (trs->Surface());
- return Standard_True;
- }
-
-// CurveOnSurface 142
- if (igt == 142 && thegeom >= 0) {
- DeclareAndCast(IGESGeom_CurveOnSurface,crf,ent);
- explored.AddItem(crf->Curve3D());
- return Standard_True;
- }
-
-// Boundary 141
- if (igt == 141 && thegeom >= 0) {
- DeclareAndCast(IGESGeom_Boundary,bnd,ent);
- Standard_Integer i, nb = bnd->NbModelSpaceCurves();
- for (i = 1; i <= nb; i ++) explored.AddItem (bnd->ModelSpaceCurve(i));
- return (nb > 0);
- }
-
-// BoundedSurface 143
- if (igt == 143) {
- DeclareAndCast(IGESGeom_BoundedSurface,bns,ent);
- Standard_Integer i, nb = 0;
- if (thegeom >= 0) {
- nb = bns->NbBoundaries();
- for (i = 1; i <= nb; i ++) explored.AddItem (bns->Boundary(i));
- return (nb != 0);
- }
- else explored.AddItem (bns->Surface());
- return Standard_True;
- }
-
-// SingleParent
- if (igt == 402 && igesent->FormNumber() == 9) {
- DeclareAndCast(IGESBasic_SingleParent,sp,ent);
- if (sp.IsNull()) return Standard_False;
- explored.AddItem (sp->SingleParent());
- Standard_Integer i,nb = sp->NbChildren();
- for (i = 1; i <= nb; i ++) explored.AddItem (sp->Child(i));
- return Standard_True;
- }
-
-// Groups ... en dernier de la serie 402
- if (igt == 402) {
- DeclareAndCast(IGESBasic_Group,gr,ent);
- if (gr.IsNull()) return Standard_False;
- Standard_Integer i, nb = gr->NbEntities();
- for (i = 1; i <= nb; i ++) explored.AddItem (gr->Entity(i));
- return Standard_True;
- }
-
-// ManifoldSolid 186 -> Shells
- if (igt == 186) {
- DeclareAndCast(IGESSolid_ManifoldSolid,msb,ent);
- explored.AddItem (msb->Shell());
- Standard_Integer i, nb = msb->NbVoidShells();
- for (i = 1; i <= nb; i ++) explored.AddItem (msb->VoidShell(i));
- return Standard_True;
- }
-
-// Shell 514 -> Faces
- if (igt == 514) {
- DeclareAndCast(IGESSolid_Shell,sh,ent);
- Standard_Integer i, nb = sh->NbFaces();
- for (i = 1; i <= nb; i ++) explored.AddItem (sh->Face(i));
- return Standard_True;
- }
-
-// Face 510 -> Loops
- if (igt == 510) {
- DeclareAndCast(IGESSolid_Face,fc,ent);
- if (thegeom >= 0) {
- Standard_Integer i, nb = fc->NbLoops();
- for (i = 1; i <= nb; i ++) explored.AddItem (fc->Loop(i));
- }
- else explored.AddItem (fc->Surface());
- return Standard_True;
- }
-
-// Loop 508 -> Curves 3D (enfin !) mais via EdgeList ...
- if (igt == 508 && thegeom >= 0) {
- DeclareAndCast(IGESSolid_Loop,lp,ent);
- Standard_Integer i, nb = lp->NbEdges();
- for (i = 1; i <= nb; i ++) {
- DeclareAndCast(IGESSolid_EdgeList,edl,lp->Edge(i));
- Standard_Integer ind = lp->ListIndex(i);
- if (edl.IsNull()) continue;
- explored.AddItem(edl->Curve(ind));
- }
- return Standard_True;
- }
-
-// Pas trouve
- return Standard_False;
-}
-
-
- TCollection_AsciiString IGESSelect_SelectBasicGeom::ExploreLabel () const
-{
- if (thegeom == 2) return TCollection_AsciiString ("Basic Curves 3d");
- else if (thegeom > 0) return TCollection_AsciiString ("Curves 3d");
- else if (thegeom < 0) return TCollection_AsciiString ("Surfaces");
- else return TCollection_AsciiString ("Basic Geometry");
-}
-
-
- Standard_Boolean IGESSelect_SelectBasicGeom::SubCurves
- (const Handle(IGESData_IGESEntity)& ent,
- Interface_EntityIterator& explored)
-{
- if (ent.IsNull()) return Standard_False;
- Standard_Integer igt = ent->TypeNumber();
-
-// CompositeCurve : a decomposer ?
- if (igt == 102) {
- DeclareAndCast(IGESGeom_CompositeCurve,cmc,ent);
- Standard_Integer i, nb = cmc->NbCurves();
- for (i = 1; i <= nb; i ++) explored.AddItem (cmc->Curve(i));
- return Standard_True;
- }
-
-// Lignes en general. Attention CopiousData, aux variantes "habillage"
- if (igt == 106) return (ent->FormNumber() < 20);
- if ( (igt >= 100 && igt <= 106) || igt == 110 || igt == 112 || igt == 116 ||
- igt == 126 || igt == 130) return Standard_True;
-
-// Sinon
- return Standard_False;
-}
+++ /dev/null
-// Created on: 1997-04-14
-// Created by: Christian CAILLET
-// Copyright (c) 1997-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_SelectBasicGeom_HeaderFile
-#define _IGESSelect_SelectBasicGeom_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Integer.hxx>
-#include <IFSelect_SelectExplore.hxx>
-class Standard_Transient;
-class Interface_Graph;
-class Interface_EntityIterator;
-class TCollection_AsciiString;
-class IGESData_IGESEntity;
-
-
-class IGESSelect_SelectBasicGeom;
-DEFINE_STANDARD_HANDLE(IGESSelect_SelectBasicGeom, IFSelect_SelectExplore)
-
-//! This selection returns the basic geometric elements
-//! contained in an IGES Entity
-//! Intended to run a "quick" transfer. I.E. :
-//! - for a Group, considers its Elements
-//! - for a Trimmed or Bounded Surface or a Face (BREP),
-//! considers the 3D curves of each of its loops
-//! - for a Plane (108), considers its Bounding Curve
-//! - for a Curve itself, takes it
-//!
-//! Also, FREE surfaces are taken, because curve 3d is known for
-//! them. (the ideal should be to have their natural bounds)
-//!
-//! If <curvesonly> is set, ONLY curves-3d are returned
-class IGESSelect_SelectBasicGeom : public IFSelect_SelectExplore
-{
-
-public:
-
-
- //! Creates a SelectBasicGeom, which always works recursively
- //! mode = -1 : Returns Surfaces (without trimming)
- //! mode = +1 : Returns Curves 3D (free or bound of surface)
- //! mode = +2 : Returns Basic Curves 3D : as 1 but CompositeCurves
- //! are returned in detail
- //! mode = 0 : both
- Standard_EXPORT IGESSelect_SelectBasicGeom(const Standard_Integer mode);
-
- Standard_EXPORT Standard_Boolean CurvesOnly() const;
-
- //! Explores an entity, to take its contained Curves 3d
- //! Works recursively
- 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 : "Curves 3d" or
- //! "Basic Geometry"
- Standard_EXPORT TCollection_AsciiString ExploreLabel() const Standard_OVERRIDE;
-
- //! This method can be called from everywhere to get the curves
- //! as sub-elements of a given curve :
- //! CompositeCurve : explored lists its subs + returns True
- //! Any Curve : explored is not filled but returned is True
- //! Other : returned is False
- Standard_EXPORT static Standard_Boolean SubCurves (const Handle(IGESData_IGESEntity)& ent, Interface_EntityIterator& explored);
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_SelectBasicGeom,IFSelect_SelectExplore)
-
-protected:
-
-
-
-
-private:
-
-
- Standard_Integer thegeom;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_SelectBasicGeom_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 <IGESBasic_GroupWithoutBackP.hxx>
-#include <IGESSelect_SelectBypassGroup.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_SelectBypassGroup,IFSelect_SelectExplore)
-
-#define TypePourGroup 402
-
-
-IGESSelect_SelectBypassGroup::IGESSelect_SelectBypassGroup
- (const Standard_Integer level)
- : IFSelect_SelectExplore (level) { }
-
-
- Standard_Boolean IGESSelect_SelectBypassGroup::Explore
- (const Standard_Integer /*level*/, const Handle(Standard_Transient)& ent,
- const Interface_Graph& /*G*/, Interface_EntityIterator& explored) const
-{
- DeclareAndCast(IGESBasic_Group,gr,ent); // Group les regroupe tous
- if (gr.IsNull()) return Standard_True;
-
- Standard_Integer i, nb = gr->NbEntities();
- for (i = 1; i <= nb; i ++) explored.AddItem (gr->Entity(i));
- return Standard_True;
-}
-
-
- TCollection_AsciiString IGESSelect_SelectBypassGroup::ExploreLabel () const
- { return TCollection_AsciiString ("Content of 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_SelectBypassGroup_HeaderFile
-#define _IGESSelect_SelectBypassGroup_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectExplore.hxx>
-#include <Standard_Integer.hxx>
-class Standard_Transient;
-class Interface_Graph;
-class Interface_EntityIterator;
-class TCollection_AsciiString;
-
-
-class IGESSelect_SelectBypassGroup;
-DEFINE_STANDARD_HANDLE(IGESSelect_SelectBypassGroup, IFSelect_SelectExplore)
-
-//! Selects a list built as follows :
-//! Groups are entities type 402, forms 1,7,14,15 (Group,
-//! Ordered or not, "WithoutBackPointer" or not)
-//!
-//! Entities which are not GROUP are taken as such
-//! For Groups, their list of Elements is explore
-//! Hence, level 0 (D) recursively explores a Group if some of
-//! its Elements are Groups. level 1 explores just at first level
-class IGESSelect_SelectBypassGroup : public IFSelect_SelectExplore
-{
-
-public:
-
-
- //! Creates a SelectBypassGroup, by default all level
- //! (level = 1 explores at first level)
- Standard_EXPORT IGESSelect_SelectBypassGroup(const Standard_Integer level = 0);
-
- //! Explores an entity : for a Group, gives its elements
- //! Else, takes the entity 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 : "Content of Group"
- Standard_EXPORT TCollection_AsciiString ExploreLabel() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_SelectBypassGroup,IFSelect_SelectExplore)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_SelectBypassGroup_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 <IGESBasic_SingularSubfigure.hxx>
-#include <IGESBasic_SubfigureDef.hxx>
-#include <IGESData_IGESEntity.hxx>
-#include <IGESDraw_CircArraySubfigure.hxx>
-#include <IGESDraw_NetworkSubfigure.hxx>
-#include <IGESDraw_NetworkSubfigureDef.hxx>
-#include <IGESDraw_RectArraySubfigure.hxx>
-#include <IGESSelect_SelectBypassSubfigure.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_SelectBypassSubfigure,IFSelect_SelectExplore)
-
-IGESSelect_SelectBypassSubfigure::IGESSelect_SelectBypassSubfigure
- (const Standard_Integer level)
- : IFSelect_SelectExplore (level) { }
-
-
- Standard_Boolean IGESSelect_SelectBypassSubfigure::Explore
- (const Standard_Integer /*level*/, const Handle(Standard_Transient)& ent,
- const Interface_Graph& /*G*/, Interface_EntityIterator& explored) const
-{
- DeclareAndCast(IGESData_IGESEntity,igesent,ent);
- if (igesent.IsNull()) return Standard_False;
- Standard_Integer igt = igesent->TypeNumber();
-
-// SingularSubfigure
- if (igt == 308) {
- DeclareAndCast(IGESBasic_SubfigureDef,subf,ent);
- if (subf.IsNull()) return Standard_True;
- Standard_Integer i,nb = subf->NbEntities();
- for (i = 1; i <= nb; i ++) explored.AddItem (subf->AssociatedEntity(i));
- return Standard_True;
- }
- if (igt == 408) {
- DeclareAndCast(IGESBasic_SingularSubfigure,subf,ent);
- explored.AddItem (subf->Subfigure());
- }
-
-// NetworkSubfigure
- if (igt == 320) {
- DeclareAndCast(IGESDraw_NetworkSubfigureDef,subf,ent);
- if (subf.IsNull()) return Standard_True;
- Standard_Integer i,nb = subf->NbEntities();
- for (i = 1; i <= nb; i ++) explored.AddItem (subf->Entity(i));
- return Standard_True;
- }
- if (igt == 420) {
- DeclareAndCast(IGESDraw_NetworkSubfigure,subf,ent);
- explored.AddItem (subf->SubfigureDefinition());
- }
-
-// (Pattern)Subfigure
- if (igt == 412) {
- DeclareAndCast(IGESDraw_RectArraySubfigure,subf,ent);
- explored.AddItem (subf->BaseEntity());
- }
- if (igt == 414) {
- DeclareAndCast(IGESDraw_CircArraySubfigure,subf,ent);
- explored.AddItem (subf->BaseEntity());
- }
-
-// Si c est pas tout ca, c est un objet de base et on le prend tel quel
- return Standard_True;
-}
-
-
- TCollection_AsciiString IGESSelect_SelectBypassSubfigure::ExploreLabel () const
- { return TCollection_AsciiString ("Content of Subfigures"); }
+++ /dev/null
-// Created on: 1998-01-13
-// 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_SelectBypassSubfigure_HeaderFile
-#define _IGESSelect_SelectBypassSubfigure_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectExplore.hxx>
-#include <Standard_Integer.hxx>
-class Standard_Transient;
-class Interface_Graph;
-class Interface_EntityIterator;
-class TCollection_AsciiString;
-
-
-class IGESSelect_SelectBypassSubfigure;
-DEFINE_STANDARD_HANDLE(IGESSelect_SelectBypassSubfigure, IFSelect_SelectExplore)
-
-//! Selects a list built as follows :
-//! Subfigures correspond to
-//! * Definition (basic : type 308, or Network : type 320)
-//! * Instance (Singular : type 408, or Network : 420, or
-//! patterns : 412,414)
-//!
-//! Entities which are not Subfigure are taken as such
-//! For Subfigures Instances, their definition is taken, then
-//! explored itself
-//! For Subfigures Definitions, the list of "Associated Entities"
-//! is explored
-//! Hence, level 0 (D) recursively explores a Subfigure if some of
-//! its Elements are Subfigures. level 1 explores just at first
-//! level (i.e. for an instance, returns its definition)
-class IGESSelect_SelectBypassSubfigure : public IFSelect_SelectExplore
-{
-
-public:
-
-
- //! Creates a SelectBypassSubfigure, by default all level
- //! (level = 1 explores at first level)
- Standard_EXPORT IGESSelect_SelectBypassSubfigure(const Standard_Integer level = 0);
-
- //! Explores an entity : for a Subfigure, gives its elements
- //! Else, takes the entity 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 : "Content of Subfigure"
- Standard_EXPORT TCollection_AsciiString ExploreLabel() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_SelectBypassSubfigure,IFSelect_SelectExplore)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_SelectBypassSubfigure_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_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>
-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 <IGESBasic_Group.hxx>
-#include <IGESBasic_SingleParent.hxx>
-#include <IGESData_IGESEntity.hxx>
-#include <IGESGeom_Plane.hxx>
-#include <IGESSelect_SelectFaces.hxx>
-#include <IGESSolid_ManifoldSolid.hxx>
-#include <IGESSolid_Shell.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_SelectFaces,IFSelect_SelectExplore)
-
-IGESSelect_SelectFaces::IGESSelect_SelectFaces ()
- : IFSelect_SelectExplore (-1) { }
-
-
- Standard_Boolean IGESSelect_SelectFaces::Explore
- (const Standard_Integer /*level*/, const Handle(Standard_Transient)& ent,
- const Interface_Graph& /*G*/, Interface_EntityIterator& explored) const
-{
- DeclareAndCast(IGESData_IGESEntity,igesent,ent);
- if (igesent.IsNull()) return Standard_False;
- Standard_Integer igt = igesent->TypeNumber();
-
-// Cas clairs et nets : Faces typees comme telles
-
- if (igt == 510 || igt == 144 || igt == 143) return Standard_True;
-
-// Surfaces Libres
- if (igt == 114 || igt == 118 || igt == 120 || igt == 122 || igt == 128 || igt == 140)
- return Standard_True;
-
-// Cas du Plane
- if (igt == 108) {
- DeclareAndCast(IGESGeom_Plane,pln,ent);
- return pln->HasBoundingCurve();
- }
-
-// A present, contenants possibles
-
-// SingleParent
- if (igt == 402 && igesent->FormNumber() == 9) {
- DeclareAndCast(IGESBasic_SingleParent,sp,ent);
- if (sp.IsNull()) return Standard_False;
- explored.AddItem (sp->SingleParent());
- Standard_Integer i,nb = sp->NbChildren();
- for (i = 1; i <= nb; i ++) explored.AddItem (sp->Child(i));
- return Standard_True;
- }
-
-// Groups ... en dernier de la serie 402
- if (igt == 402) {
- DeclareAndCast(IGESBasic_Group,gr,ent);
- if (gr.IsNull()) return Standard_False;
- Standard_Integer i, nb = gr->NbEntities();
- for (i = 1; i <= nb; i ++) explored.AddItem (gr->Entity(i));
- return Standard_True;
- }
-
-// ManifoldSolid 186 -> Shells
- if (igt == 186) {
- DeclareAndCast(IGESSolid_ManifoldSolid,msb,ent);
- explored.AddItem (msb->Shell());
- Standard_Integer i, nb = msb->NbVoidShells();
- for (i = 1; i <= nb; i ++) explored.AddItem (msb->VoidShell(i));
- return Standard_True;
- }
-
-// Shell 514 -> Faces
- if (igt == 514) {
- DeclareAndCast(IGESSolid_Shell,sh,ent);
- Standard_Integer i, nb = sh->NbFaces();
- for (i = 1; i <= nb; i ++) explored.AddItem (sh->Face(i));
- return Standard_True;
- }
-
-// Pas trouve
- return Standard_False;
-}
-
- TCollection_AsciiString IGESSelect_SelectFaces::ExploreLabel () const
- { return TCollection_AsciiString ("Faces"); }
+++ /dev/null
-// Created on: 1997-10-01
-// Created by: Christian CAILLET
-// Copyright (c) 1997-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_SelectFaces_HeaderFile
-#define _IGESSelect_SelectFaces_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectExplore.hxx>
-#include <Standard_Integer.hxx>
-class Standard_Transient;
-class Interface_Graph;
-class Interface_EntityIterator;
-class TCollection_AsciiString;
-
-
-class IGESSelect_SelectFaces;
-DEFINE_STANDARD_HANDLE(IGESSelect_SelectFaces, IFSelect_SelectExplore)
-
-//! This selection returns the faces contained in an IGES Entity
-//! or itself if it is a Face
-//! Face means :
-//! - Face (510) of a ManifoldSolidBrep
-//! - TrimmedSurface (144)
-//! - BoundedSurface (143)
-//! - Plane with a Bounding Curve (108, form not 0)
-//! - Also, any Surface which is not in a TrimmedSurface, a
-//! BoundedSurface, or a Face (FREE Surface)
-//! -> i.e. a Face for which Natural Bounds will be considered
-class IGESSelect_SelectFaces : public IFSelect_SelectExplore
-{
-
-public:
-
-
- Standard_EXPORT IGESSelect_SelectFaces();
-
- //! Explores an entity, to take its faces
- //! Works recursively
- 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 : "Faces"
- Standard_EXPORT TCollection_AsciiString ExploreLabel() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_SelectFaces,IFSelect_SelectExplore)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_SelectFaces_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_ViewKindEntity.hxx>
-#include <IGESSelect_SelectFromDrawing.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_SelectFromDrawing,IFSelect_SelectDeduct)
-
-#define PourDrawing 404
-
-
-IGESSelect_SelectFromDrawing::IGESSelect_SelectFromDrawing () { }
-
-
- Interface_EntityIterator IGESSelect_SelectFromDrawing::RootResult
- (const Interface_Graph& G) const
-{
- Interface_EntityIterator list, views;
- Interface_EntityIterator draws = InputResult(G);
- if (draws.NbEntities() == 0) return list;
- Standard_Integer nb = G.Size();
- Standard_Integer i; // svv Jan11 2000 : porting on DEC
-
-// Pour chaque Drawing : prendre d une part l integralite de son contenu,
-// (c-a-d avec le "Frame"), d autre part les entites attachees a ses vues
- for (draws.Start(); draws.More(); draws.Next()) {
- DeclareAndCast(IGESData_IGESEntity,igesent,draws.Value());
- if (igesent.IsNull()) continue;
- if (igesent->TypeNumber() != PourDrawing) continue;
- list.GetOneItem (igesent);
- Interface_EntityIterator someviews = G.Shareds (draws.Value());
- list.AddList (someviews.Content());
- }
- for (i = 1; i <= nb; i ++) {
-// if (!G.IsPresent(i)) continue;
- DeclareAndCast(IGESData_IGESEntity,igesent,G.Entity(i));
- if (igesent.IsNull()) continue;
- Standard_Integer nv = G.EntityNumber (igesent->View());
- if (nv > 0 && nv <= nb) list.GetOneItem(igesent);
- }
- return list;
-}
-
-
- TCollection_AsciiString IGESSelect_SelectFromDrawing::Label () const
-{ return TCollection_AsciiString ("Entities attached to a Drawing"); }
+++ /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_SelectFromDrawing_HeaderFile
-#define _IGESSelect_SelectFromDrawing_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectDeduct.hxx>
-class Interface_EntityIterator;
-class Interface_Graph;
-class TCollection_AsciiString;
-
-
-class IGESSelect_SelectFromDrawing;
-DEFINE_STANDARD_HANDLE(IGESSelect_SelectFromDrawing, IFSelect_SelectDeduct)
-
-//! This selection gets in all the model, the entities which are
-//! attached to the drawing(s) given as input. This includes :
-//! - Drawing Frame (Annotations directky referenced by Drawings)
-//! - Entities attached to the single Views referenced by Drawings
-class IGESSelect_SelectFromDrawing : public IFSelect_SelectDeduct
-{
-
-public:
-
-
- //! Creates a SelectFromDrawing
- Standard_EXPORT IGESSelect_SelectFromDrawing();
-
- //! Selects the Entities which are attached to the Drawing(s)
- //! present in the Input
- Standard_EXPORT Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! Returns the label, with is "Entities attached to Drawing"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_SelectFromDrawing,IFSelect_SelectDeduct)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_SelectFromDrawing_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_ViewKindEntity.hxx>
-#include <IGESSelect_SelectFromSingleView.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_SelectFromSingleView,IFSelect_SelectDeduct)
-
-IGESSelect_SelectFromSingleView::IGESSelect_SelectFromSingleView () { }
-
-
- Interface_EntityIterator IGESSelect_SelectFromSingleView::RootResult
- (const Interface_Graph& G) const
-{
- Interface_EntityIterator list;
- Interface_EntityIterator views = InputResult(G);
- if (views.NbEntities() == 0) return list;
- Standard_Integer nb = G.Size();
- Standard_Integer i; // svv Jan11 2000 : porting on DEC
- for (i = 1; i <= nb; i ++) {
-// if (!G.IsPresent(i)) continue;
- DeclareAndCast(IGESData_IGESEntity,igesent,G.Entity(i));
- if (igesent.IsNull()) continue;
- Standard_Integer nv = G.EntityNumber (igesent->View());
- if (nv > 0 && nv <= nb) list.GetOneItem(igesent);
- }
- return list;
-}
-
-
- TCollection_AsciiString IGESSelect_SelectFromSingleView::Label () const
-{ return TCollection_AsciiString ("Entities attached to a single View"); }
+++ /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_SelectFromSingleView_HeaderFile
-#define _IGESSelect_SelectFromSingleView_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectDeduct.hxx>
-class Interface_EntityIterator;
-class Interface_Graph;
-class TCollection_AsciiString;
-
-
-class IGESSelect_SelectFromSingleView;
-DEFINE_STANDARD_HANDLE(IGESSelect_SelectFromSingleView, IFSelect_SelectDeduct)
-
-//! This selection gets in all the model, the entities which are
-//! attached to the views given as input. Only Single Views are
-//! considered. This information is kept from Directory Part
-//! (View Item).
-class IGESSelect_SelectFromSingleView : public IFSelect_SelectDeduct
-{
-
-public:
-
-
- //! Creates a SelectFromSingleView
- Standard_EXPORT IGESSelect_SelectFromSingleView();
-
- //! Selects the Entities which are attached to the Single View(s)
- //! present in the Input
- Standard_EXPORT Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- //! Returns the label, with is "Entities attached to single View"
- Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_SelectFromSingleView,IFSelect_SelectDeduct)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_SelectFromSingleView_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 <IGESGraph_DefinitionLevel.hxx>
-#include <IGESSelect_SelectLevelNumber.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_SelectLevelNumber,IFSelect_SelectExtract)
-
-IGESSelect_SelectLevelNumber::IGESSelect_SelectLevelNumber () { }
-
-
- void IGESSelect_SelectLevelNumber::SetLevelNumber
- (const Handle(IFSelect_IntParam)& levnum)
- { thelevnum = levnum; }
-
- Handle(IFSelect_IntParam) IGESSelect_SelectLevelNumber::LevelNumber () const
- { return thelevnum; }
-
-
- Standard_Boolean IGESSelect_SelectLevelNumber::Sort
- (const Standard_Integer /*rank*/,
- const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& /*model*/) const
-{
- DeclareAndCast(IGESData_IGESEntity,igesent,ent);
- if (igesent.IsNull()) return Standard_False;
- Standard_Integer numlev = 0;
- if (!thelevnum.IsNull()) numlev = thelevnum->Value();
- DeclareAndCast(IGESGraph_DefinitionLevel,levelist,igesent->LevelList());
- Standard_Integer level = igesent->Level();
- if (levelist.IsNull()) return (level == numlev);
-// Cas d une liste
- if (numlev == 0) return Standard_False;
- Standard_Integer nb = levelist->NbPropertyValues();
- for (Standard_Integer i = 1; i <= nb; i ++) {
- level = levelist->LevelNumber(i);
- if (level == numlev) return Standard_True;
- }
- return Standard_False;
-}
-
-
- TCollection_AsciiString IGESSelect_SelectLevelNumber::ExtractLabel
- () const
-{
- char labl [50];
- Standard_Integer numlev = 0;
- if (!thelevnum.IsNull()) numlev = thelevnum->Value();
- if (numlev == 0) return TCollection_AsciiString
- ("IGES Entity attached to no Level");
-
- sprintf(labl,"IGES Entity, Level Number admitting %d",numlev);
- return TCollection_AsciiString (labl);
-}
+++ /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_SelectLevelNumber_HeaderFile
-#define _IGESSelect_SelectLevelNumber_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectExtract.hxx>
-#include <Standard_Integer.hxx>
-class IFSelect_IntParam;
-class Standard_Transient;
-class Interface_InterfaceModel;
-class TCollection_AsciiString;
-
-
-class IGESSelect_SelectLevelNumber;
-DEFINE_STANDARD_HANDLE(IGESSelect_SelectLevelNumber, IFSelect_SelectExtract)
-
-//! This selection looks at Level Number of IGES Entities :
-//! it considers items attached, either to a single level with a
-//! given value, or to a level list which contains this value
-//!
-//! Level = 0 means entities not attached to any level
-//!
-//! Remark : the class CounterOfLevelNumber gives information
-//! about present levels in a file.
-class IGESSelect_SelectLevelNumber : public IFSelect_SelectExtract
-{
-
-public:
-
-
- //! Creates a SelectLevelNumber, with no Level criterium : see
- //! SetLevelNumber. Empty, this selection filters nothing.
- Standard_EXPORT IGESSelect_SelectLevelNumber();
-
- //! Sets a Parameter as Level criterium
- Standard_EXPORT void SetLevelNumber (const Handle(IFSelect_IntParam)& levnum);
-
- //! Returns the Level criterium. NullHandle if not yet set
- //! (interpreted as Level = 0 : no level number attached)
- Standard_EXPORT Handle(IFSelect_IntParam) LevelNumber() const;
-
- //! Returns True if <ent> is an IGES Entity with Level Number
- //! admits the criterium (= value if single level, or one of the
- //! attached level numbers = value if level list)
- Standard_EXPORT Standard_Boolean Sort (const Standard_Integer rank, const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
-
- //! Returns the Selection criterium :
- //! "IGES Entity, Level Number admits <nn>" (if nn > 0) or
- //! "IGES Entity attached to no Level" (if nn = 0)
- Standard_EXPORT TCollection_AsciiString ExtractLabel() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_SelectLevelNumber,IFSelect_SelectExtract)
-
-protected:
-
-
-
-
-private:
-
-
- Handle(IFSelect_IntParam) thelevnum;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_SelectLevelNumber_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_SelectName.hxx>
-#include <Interface_InterfaceModel.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_SelectName,IFSelect_SelectExtract)
-
-IGESSelect_SelectName::IGESSelect_SelectName () { }
-
-
- void IGESSelect_SelectName::SetName
- (const Handle(TCollection_HAsciiString)& levnum)
- { thename = levnum; }
-
- Handle(TCollection_HAsciiString) IGESSelect_SelectName::Name () const
- { return thename; }
-
-
- Standard_Boolean IGESSelect_SelectName::Sort
- (const Standard_Integer /*rank*/,
- const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& /*model*/) const
-{
- DeclareAndCast(IGESData_IGESEntity,igesent,ent);
- if (igesent.IsNull()) return Standard_False;
- if (!igesent->HasName()) return Standard_False;
- if (thename.IsNull()) return Standard_False;
- Handle(TCollection_HAsciiString) name = igesent->NameValue();
-// std::cout<<"SelectName:"<<thename->ToCString()<<",with:"<<name->ToCString()<<",IsSameString="<<thename->IsSameString (name,Standard_False)<<std::endl;
- Standard_Integer nb0 = thename->Length();
- Standard_Integer nb1 = name->Length();
- Standard_Integer nbf = (nb1 <= nb0 ? nb1 : nb0);
- Standard_Integer nbt = (nb1 >= nb0 ? nb1 : nb0);
- Standard_Integer i; // svv Jan11 2000 : porting on DEC
- for (i = 1; i <= nbf; i ++) {
- if (name->Value(i) != thename->Value(i)) return Standard_False;
- }
- if (nb0 > nb1) name = thename;
- for (i = nbf+1; i <= nbt; i ++) {
- if (name->Value(i) != ' ') return Standard_False;
- }
- return Standard_True;
-}
-
-
- TCollection_AsciiString IGESSelect_SelectName::ExtractLabel () const
-{
- char labl [50];
- if (!thename.IsNull()) {
- sprintf (labl,"IGES Entity, Name : %s",thename->ToCString());
- return TCollection_AsciiString(labl);
- }
- else return TCollection_AsciiString ("IGES Entity, Name : (undefined)");
-}
+++ /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_SelectName_HeaderFile
-#define _IGESSelect_SelectName_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectExtract.hxx>
-#include <Standard_Integer.hxx>
-class TCollection_HAsciiString;
-class Standard_Transient;
-class Interface_InterfaceModel;
-class TCollection_AsciiString;
-
-
-class IGESSelect_SelectName;
-DEFINE_STANDARD_HANDLE(IGESSelect_SelectName, IFSelect_SelectExtract)
-
-//! Selects Entities which have a given name.
-//! Consider Property Name if present, else Short Label, but
-//! not the Subscript Number
-//! First version : keeps exact name
-//! Later : regular expression
-class IGESSelect_SelectName : public IFSelect_SelectExtract
-{
-
-public:
-
-
- //! Creates an empty SelectName : every entity is considered
- //! good (no filter active)
- Standard_EXPORT IGESSelect_SelectName();
-
- //! Returns True if Name of Entity complies with Name Filter
- Standard_EXPORT Standard_Boolean Sort (const Standard_Integer rank, const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
-
- //! Sets a Name as a criterium : IGES Entities which have this name
- //! are kept (without regular expression, there should be at most
- //! one). <name> can be regarded as a Text Parameter
- Standard_EXPORT void SetName (const Handle(TCollection_HAsciiString)& name);
-
- //! Returns the Name used as Filter
- Standard_EXPORT Handle(TCollection_HAsciiString) Name() const;
-
- //! Returns the Selection criterium : "IGES Entity, Name : <name>"
- Standard_EXPORT TCollection_AsciiString ExtractLabel() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_SelectName,IFSelect_SelectExtract)
-
-protected:
-
-
-
-
-private:
-
-
- Handle(TCollection_HAsciiString) thename;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_SelectName_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 <IGESBasic_Group.hxx>
-#include <IGESData_IGESEntity.hxx>
-#include <IGESGeom_BoundedSurface.hxx>
-#include <IGESGeom_TrimmedSurface.hxx>
-#include <IGESSelect_SelectBasicGeom.hxx>
-#include <IGESSelect_SelectPCurves.hxx>
-#include <IGESSolid_ManifoldSolid.hxx>
-#include <IGESSolid_Shell.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_SelectPCurves,IFSelect_SelectExplore)
-
-IGESSelect_SelectPCurves::IGESSelect_SelectPCurves
- (const Standard_Boolean basic)
- : IFSelect_SelectExplore (-1) , thebasic (basic) { }
-
-
- Standard_Boolean IGESSelect_SelectPCurves::Explore
- (const Standard_Integer level, const Handle(Standard_Transient)& ent,
- const Interface_Graph& /*G*/, Interface_EntityIterator& explored) const
-{
- DeclareAndCast(IGESData_IGESEntity,igesent,ent);
- if (igesent.IsNull()) return Standard_False;
- Standard_Integer igt = igesent->TypeNumber();
-
-// TrimmedSurface 144
- if (igt == 144) {
- DeclareAndCast(IGESGeom_TrimmedSurface,trs,ent);
- explored.AddItem(trs->OuterContour());
- Standard_Integer i, nb = trs->NbInnerContours();
- for (i = 1; i <= nb; i ++) explored.AddItem (trs->InnerContour(i));
- return Standard_True;
- }
-
-// CurveOnSurface 142
- if (igt == 142) {
- DeclareAndCast(IGESGeom_CurveOnSurface,crf,ent);
- explored.AddItem(crf->CurveUV());
- if (thebasic) IGESSelect_SelectBasicGeom::SubCurves (crf->CurveUV(),explored);
- return Standard_True;
- }
-
-// Boundary 141
- if (igt == 141) {
- DeclareAndCast(IGESGeom_Boundary,bnd,ent);
- Standard_Integer i, nb = bnd->NbModelSpaceCurves();
- for (i = 1; i <= nb; i ++) {
- Standard_Integer j,np = bnd->NbParameterCurves(i);
- for (j = 1; j <= np; j ++) {
- explored.AddItem (bnd->ParameterCurve(i,j));
- }
- }
- return (nb > 0);
- }
-
-// BoundedSurface 143
- if (igt == 143) {
- DeclareAndCast(IGESGeom_BoundedSurface,bns,ent);
- Standard_Integer i, nb = bns->NbBoundaries(); //szv#4:S4163:12Mar99 optimized
- for (i = 1; i <= nb; i ++) explored.AddItem (bns->Boundary(i));
- return (nb != 0);
- //return Standard_True; //szv#4:S4163:12Mar99 unreached
- }
-
-
-// Groups ... en dernier de la serie 402
- if (igt == 402) {
- DeclareAndCast(IGESBasic_Group,gr,ent);
- if (gr.IsNull()) return Standard_False;
- Standard_Integer i, nb = gr->NbEntities();
- for (i = 1; i <= nb; i ++) explored.AddItem (gr->Entity(i));
- return Standard_True;
- }
-
-
-// ManifoldSolid 186 -> Shells
- if (igt == 186) {
- DeclareAndCast(IGESSolid_ManifoldSolid,msb,ent);
- explored.AddItem (msb->Shell());
- Standard_Integer i, nb = msb->NbVoidShells();
- for (i = 1; i <= nb; i ++) explored.AddItem (msb->VoidShell(i));
- return Standard_True;
- }
-
-// Shell 514 -> Faces
- if (igt == 514) {
- DeclareAndCast(IGESSolid_Shell,sh,ent);
- Standard_Integer i, nb = sh->NbFaces();
- for (i = 1; i <= nb; i ++) explored.AddItem (sh->Face(i));
- return Standard_True;
- }
-
-// Face 510 -> Loops
- if (igt == 510) {
- DeclareAndCast(IGESSolid_Face,fc,ent);
- Standard_Integer i, nb = fc->NbLoops();
- for (i = 1; i <= nb; i ++) explored.AddItem (fc->Loop(i));
- return Standard_True;
- }
-
-// Loop 508 -> PCurves (enfin !)
- if (igt == 508) {
- DeclareAndCast(IGESSolid_Loop,lp,ent);
- Standard_Integer i, nb = lp->NbEdges();
- for (i = 1; i <= nb; i ++) {
- Standard_Integer j, np = lp->NbParameterCurves(i);
- for (j = 1; j <= np; j ++) //szv#4:S4163:12Mar99 was bug
- explored.AddItem(lp->ParametricCurve(i,j));
- }
- return Standard_True;
- }
-
-// LES LIGNES : seult si en tant que pcurve : donc level >= 3
-// Lignes en general. Attention CopiousData, aux variantes "habillage"
- if (level < 3) return Standard_False;
-
- if (igt == 106) return (igesent->FormNumber() < 20);
- if ( (igt >= 100 && igt <= 106) || igt == 110 || igt == 112 || igt == 116 ||
- igt == 126 || igt == 130) return Standard_True;
-
-// Pas trouve
- return Standard_False;
-}
-
-
- TCollection_AsciiString IGESSelect_SelectPCurves::ExploreLabel () const
-{
- if (thebasic) return TCollection_AsciiString ("Basic PCurves");
- else return TCollection_AsciiString ("Global PCurves");
-}
+++ /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_SelectPCurves_HeaderFile
-#define _IGESSelect_SelectPCurves_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectExplore.hxx>
-#include <Standard_Integer.hxx>
-class Standard_Transient;
-class Interface_Graph;
-class Interface_EntityIterator;
-class TCollection_AsciiString;
-
-
-class IGESSelect_SelectPCurves;
-DEFINE_STANDARD_HANDLE(IGESSelect_SelectPCurves, IFSelect_SelectExplore)
-
-//! This Selection returns the pcurves which lie on a face
-//! In two modes : global (i.e. a CompositeCurve is not explored)
-//! or basic (all the basic curves are listed)
-class IGESSelect_SelectPCurves : public IFSelect_SelectExplore
-{
-
-public:
-
-
- //! Creates a SelectPCurves
- //! basic True : lists all the components of pcurves
- //! basic False : lists the uppest level definitions
- //! (i.e. stops at CompositeCurve)
- Standard_EXPORT IGESSelect_SelectPCurves(const Standard_Boolean basic);
-
- //! Explores an entity, to take its contained PCurves
- //! An independent curve is IGNORED : only faces are explored
- 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 : "Basic PCurves" or
- //! "Global PCurves"
- Standard_EXPORT TCollection_AsciiString ExploreLabel() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_SelectPCurves,IFSelect_SelectExplore)
-
-protected:
-
-
-
-
-private:
-
-
- Standard_Boolean thebasic;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_SelectPCurves_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_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>
-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 <IGESData_IGESEntity.hxx>
-#include <IGESSelect_SelectSubordinate.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_SelectSubordinate,IFSelect_SelectExtract)
-
-IGESSelect_SelectSubordinate::IGESSelect_SelectSubordinate
- (const Standard_Integer status) { thestatus = status; }
-
- Standard_Integer IGESSelect_SelectSubordinate::Status () const
- { return thestatus; }
-
- Standard_Boolean IGESSelect_SelectSubordinate::Sort
- (const Standard_Integer, const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& /*model*/) const
-{
- DeclareAndCast(IGESData_IGESEntity,igesent,ent);
- if (igesent.IsNull()) return Standard_False;
- Standard_Integer sub = igesent->SubordinateStatus();
- if (sub == thestatus) return Standard_True;
- if (thestatus == 4 && (sub == 1 || sub == 3)) return Standard_True;
- if (thestatus == 5 && (sub == 2 || sub == 3)) return Standard_True;
- if (thestatus == 6 && sub != 0) return Standard_True;
- return Standard_False;
-}
-
- TCollection_AsciiString IGESSelect_SelectSubordinate::ExtractLabel () const
-{
- TCollection_AsciiString lab("IGESEntity, Subordinate ");
- if (thestatus == 0) lab.AssignCat("Independant (0)");
- if (thestatus == 1) lab.AssignCat("Physically only Dependant (1)");
- if (thestatus == 2) lab.AssignCat("Logically only Dependant (2) ");
- if (thestatus == 3) lab.AssignCat("Both Phys. and Log. Dependant (3)");
- if (thestatus == 4) lab.AssignCat("Physically Dependant (1 or 3)");
- if (thestatus == 5) lab.AssignCat("Logically Dependant (2 or 3)");
- if (thestatus == 6) lab.AssignCat("Dependant in any way (1 or 2 or 3)");
- return lab;
-}
+++ /dev/null
-// Created on: 1996-10-11
-// 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 _IGESSelect_SelectSubordinate_HeaderFile
-#define _IGESSelect_SelectSubordinate_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Integer.hxx>
-#include <IFSelect_SelectExtract.hxx>
-class Standard_Transient;
-class Interface_InterfaceModel;
-class TCollection_AsciiString;
-
-// resolve name collisions with X11 headers
-#ifdef Status
- #undef Status
-#endif
-
-class IGESSelect_SelectSubordinate;
-DEFINE_STANDARD_HANDLE(IGESSelect_SelectSubordinate, IFSelect_SelectExtract)
-
-//! This selections uses Subordinate Status as sort criterium
-//! It is an integer number which can be :
-//! 0 Independent
-//! 1 Physically Dependent
-//! 2 Logically Dependent
-//! 3 Both (recorded)
-//! + to sort :
-//! 4 : 1 or 3 -> at least Physically
-//! 5 : 2 or 3 -> at least Logically
-//! 6 : 1 or 2 or 3 -> any kind of dependence
-//! (corresponds to 0 reversed)
-class IGESSelect_SelectSubordinate : public IFSelect_SelectExtract
-{
-
-public:
-
-
- //! Creates a SelectSubordinate with a status to be sorted
- Standard_EXPORT IGESSelect_SelectSubordinate(const Standard_Integer status);
-
- //! Returns the status used for sorting
- Standard_EXPORT Standard_Integer Status() const;
-
- //! Returns True if <ent> is an IGES Entity with Subordinate
- //! Status matching the criterium
- Standard_EXPORT Standard_Boolean Sort (const Standard_Integer rank, const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
-
- //! Returns the Selection criterium : "IGES Entity, Independent"
- //! etc...
- Standard_EXPORT TCollection_AsciiString ExtractLabel() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_SelectSubordinate,IFSelect_SelectExtract)
-
-protected:
-
-
-
-
-private:
-
-
- Standard_Integer thestatus;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_SelectSubordinate_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_SelectVisibleStatus.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_SelectVisibleStatus,IFSelect_SelectExtract)
-
-IGESSelect_SelectVisibleStatus::IGESSelect_SelectVisibleStatus () { }
-
-
- Standard_Boolean IGESSelect_SelectVisibleStatus::Sort
- (const Standard_Integer /*rank*/,
- const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& /*model*/) const
-{
- DeclareAndCast(IGESData_IGESEntity,igesent,ent);
- if (igesent.IsNull()) return Standard_False;
- return (igesent->BlankStatus() == 0);
-}
-
- TCollection_AsciiString IGESSelect_SelectVisibleStatus::ExtractLabel
- () const
- { return TCollection_AsciiString ("IGES Entity, Status Visible"); }
+++ /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_SelectVisibleStatus_HeaderFile
-#define _IGESSelect_SelectVisibleStatus_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectExtract.hxx>
-#include <Standard_Integer.hxx>
-class Standard_Transient;
-class Interface_InterfaceModel;
-class TCollection_AsciiString;
-
-
-class IGESSelect_SelectVisibleStatus;
-DEFINE_STANDARD_HANDLE(IGESSelect_SelectVisibleStatus, IFSelect_SelectExtract)
-
-//! This selection looks at Blank Status of IGES Entities
-//! Direct selection keeps Visible Entities (Blank = 0),
-//! Reverse selection keeps Blanked Entities (Blank = 1)
-class IGESSelect_SelectVisibleStatus : public IFSelect_SelectExtract
-{
-
-public:
-
-
- //! Creates a SelectVisibleStatus
- Standard_EXPORT IGESSelect_SelectVisibleStatus();
-
- //! Returns True if <ent> is an IGES Entity with Blank Status = 0
- Standard_EXPORT Standard_Boolean Sort (const Standard_Integer rank, const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
-
- //! Returns the Selection criterium : "IGES Entity, Status Visible"
- Standard_EXPORT TCollection_AsciiString ExtractLabel() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_SelectVisibleStatus,IFSelect_SelectExtract)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_SelectVisibleStatus_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_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 <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_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 <IGESGraph_Color.hxx>
-#include <IGESSelect_SignColor.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_SignColor,IFSelect_Signature)
-
-static TCollection_AsciiString valbuf; // to prepare value and keep some time
-
-static Standard_CString ColName (const Standard_Integer mode)
-{
- switch (mode) {
- case 2 : return "IGES Color Name";
- case 3 : return "IGES Color R,G,B";
- case 4 : return "IGES Color RED Value";
- case 5 : return "IGES Color GREEN Value";
- case 6 : return "IGES Color BLUE Value";
- default : return "IGES Color Number";
- }
-}
-
-IGESSelect_SignColor::IGESSelect_SignColor (const Standard_Integer mode)
-: IFSelect_Signature (ColName(mode)) , themode(mode)
-{ if (mode == 4 || mode == 5 || mode == 6) SetIntCase (Standard_True,0,Standard_True,0); }
-
-Standard_CString IGESSelect_SignColor::Value
- (const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& model) const
-{
- Standard_Real red = -1 , green = -1 , blue = -1;
- DeclareAndCast(IGESData_IGESEntity,igesent,ent);
- if (igesent.IsNull()) return "";
- Standard_Integer rank = igesent->RankColor();
- DeclareAndCast(IGESGraph_Color,color,igesent->Color());
- valbuf.Clear();
-
-// Color Number
- if (themode < 2 || themode > 6) {
- if (rank == 0) return "(none)";
- if (rank > 0) {
- valbuf.AssignCat ("S");
- valbuf.AssignCat (IFSelect_Signature::IntValue (rank));
- } else {
- Standard_Integer num = (model.IsNull() ? 0 : 2 * model->Number(color) - 1);
- valbuf.AssignCat ("D");
- valbuf.AssignCat (IFSelect_Signature::IntValue (num));
- }
-
-// Color Name
- } else if (themode == 2) {
- switch (rank) {
- case 0 : return "(none)";
- case 1 : return "BLACK";
- case 2 : return "RED";
- case 3 : return "GREEN";
- case 4 : return "BLUE";
- case 5 : return "YELLOW";
- case 6 : return "MAGENTA";
- case 7 : return "CYAN";
- case 8 : return "WHITE";
- default : if (rank > 0) return "Unknown Number";
- }
- Handle(TCollection_HAsciiString) name;
- if (!color.IsNull()) name = color->ColorName();
- if (!name.IsNull()) return name->ToCString();
- Standard_Integer num = (model.IsNull() ? 0 : 2 * model->Number(color) - 1);
- valbuf.AssignCat ("D");
- valbuf.AssignCat (IFSelect_Signature::IntValue (num));
-
-// RGB
- } else if (themode == 3) {
- switch (rank) {
- case 0 : return "";
- case 1 : return "0,0,0";
- case 2 : return "100,0,0";
- case 3 : return "0,100,0";
- case 4 : return "0,0,100";
- case 5 : return "100,100,0";
- case 6 : return "100,0,100";
- case 7 : return "0,100,100";
- case 8 : return "100,100,100";
- default : if (rank > 0) return "";
- }
- if (!color.IsNull()) color->RGBIntensity (red,green,blue);
- if (red >= 0) valbuf.AssignCat ( IFSelect_Signature::IntValue (int(red)) );
- valbuf.AssignCat (",");
- if (green >= 0) valbuf.AssignCat (IFSelect_Signature::IntValue (int(green)) );
- valbuf.AssignCat (",");
- if (blue >= 0) valbuf.AssignCat ( IFSelect_Signature::IntValue (int(blue)) );
-
-// RED value
- } else if (themode == 4) {
- switch (rank) {
- case 0 : return "";
- case 1 : return "0";
- case 2 : return "100";
- case 3 : return "0";
- case 4 : return "0";
- case 5 : return "100";
- case 6 : return "100";
- case 7 : return "0";
- case 8 : return "100";
- default : if (rank > 0) return "";
- }
- if (!color.IsNull()) color->RGBIntensity (red,green,blue);
- if (red >= 0) return IFSelect_Signature::IntValue (int(red));
-
-// GREEN Value
- } else if (themode == 5) {
- switch (rank) {
- case 0 : return "";
- case 1 : return "0";
- case 2 : return "0";
- case 3 : return "100";
- case 4 : return "0";
- case 5 : return "100";
- case 6 : return "0";
- case 7 : return "100";
- case 8 : return "100";
- default : if (rank > 0) return "";
- }
- if (!color.IsNull()) color->RGBIntensity (red,green,blue);
- if (green >= 0) return IFSelect_Signature::IntValue (int(green));
-
-// BLUE Value
- } else if (themode == 6) {
- switch (rank) {
- case 0 : return "";
- case 1 : return "0";
- case 2 : return "0";
- case 3 : return "0";
- case 4 : return "100";
- case 5 : return "0";
- case 6 : return "100";
- case 7 : return "100";
- case 8 : return "100";
- default : if (rank > 0) return "";
- }
- if (!color.IsNull()) color->RGBIntensity (red,green,blue);
- if (blue >= 0) return IFSelect_Signature::IntValue (int(blue));
- }
-
- return valbuf.ToCString();
-}
+++ /dev/null
-// Created on: 2001-03-06
-// Created by: Christian CAILLET
-// Copyright (c) 2001-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_SignColor_HeaderFile
-#define _IGESSelect_SignColor_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Integer.hxx>
-#include <IFSelect_Signature.hxx>
-#include <Standard_CString.hxx>
-class Standard_Transient;
-class Interface_InterfaceModel;
-
-
-class IGESSelect_SignColor;
-DEFINE_STANDARD_HANDLE(IGESSelect_SignColor, IFSelect_Signature)
-
-//! Gives Color attached to an entity
-//! Several forms are possible, according to <mode>
-//! 1 : number : "Dnn" for entity, "Snn" for standard, "(none)" for 0
-//! 2 : name : Of standard color, or of the color entity, or "(none)"
-//! (if the color entity has no name, its label is taken)
-//! 3 : RGB values, form R:nn,G:nn,B:nn
-//! 4 : RED value : an integer
-//! 5 : GREEN value : an integer
-//! 6 : BLUE value : an integer
-//! Other computable values can be added if needed :
-//! CMY values, Percentages for Hue, Lightness, Saturation
-class IGESSelect_SignColor : public IFSelect_Signature
-{
-
-public:
-
-
- //! Creates a SignColor
- //! mode : see above for the meaning
- //! modes 4,5,6 give a numeric integer value
- //! Name is initialised according to the mode
- Standard_EXPORT IGESSelect_SignColor(const Standard_Integer mode);
-
- //! Returns the value (see above)
- Standard_EXPORT Standard_CString Value (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_SignColor,IFSelect_Signature)
-
-protected:
-
-
-
-
-private:
-
-
- Standard_Integer themode;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_SignColor_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 <IGESGraph_DefinitionLevel.hxx>
-#include <IGESSelect_SignLevelNumber.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_SignLevelNumber,IFSelect_Signature)
-
-static TCollection_AsciiString laval;
-
-
- IGESSelect_SignLevelNumber::IGESSelect_SignLevelNumber
- (const Standard_Boolean countmode)
- : IFSelect_Signature ("Level Number") ,
- thecountmode (countmode) { }
-
- Standard_CString IGESSelect_SignLevelNumber::Value
- (const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& /* model */) const
-{
- char carlev[20];
- DeclareAndCast(IGESData_IGESEntity,igesent,ent);
-//JR/Hp
- if (igesent.IsNull()) {
- Standard_CString astr ;
- astr = (Standard_CString ) (thecountmode ? " NO LEVEL" : "/0/");
- return astr ;
- }
-// if (igesent.IsNull()) return (thecountmode ? " NO LEVEL" : "/0/");
- DeclareAndCast(IGESGraph_DefinitionLevel,levelist,igesent->LevelList());
- Standard_Integer level = igesent->Level();
-
- if (levelist.IsNull()) {
-//JR/Hp
- if (level < 0) {
- Standard_CString astr ;
- astr = (Standard_CString ) (thecountmode ? " NO LEVEL" : "/0/") ;
- return astr ;
- }
-// if (level < 0) return (thecountmode ? " NO LEVEL" : "/0/");
- laval.Clear();
- if (thecountmode) sprintf (carlev,"%7d",level);
- else sprintf (carlev,"/%d/",level);
- laval.AssignCat (carlev);
- }
- else if (thecountmode) return "LEVEL LIST";
- else {
- Standard_Integer i, nblev = levelist->NbLevelNumbers();
- laval.Clear();
- laval.AssignCat("LIST:/");
- for (i = 1; i <= nblev; i ++) {
- sprintf(carlev,"%d/",levelist->LevelNumber(i));
- laval.AssignCat(carlev);
- }
- }
- return laval.ToCString();
-}
+++ /dev/null
-// Created on: 1998-04-02
-// 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_SignLevelNumber_HeaderFile
-#define _IGESSelect_SignLevelNumber_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Signature.hxx>
-#include <Standard_CString.hxx>
-class Standard_Transient;
-class Interface_InterfaceModel;
-
-
-class IGESSelect_SignLevelNumber;
-DEFINE_STANDARD_HANDLE(IGESSelect_SignLevelNumber, IFSelect_Signature)
-
-//! Gives D.E. Level Number under two possible forms :
-//! * for counter : "LEVEL nnnnnnn", " NO LEVEL", " LEVEL LIST"
-//! * for selection : "/nnn/", "/0/", "/1/2/nnn/"
-//!
-//! For matching, giving /nn/ gets any entity attached to level nn
-//! whatever simple or in a level list
-class IGESSelect_SignLevelNumber : public IFSelect_Signature
-{
-
-public:
-
-
- //! Creates a SignLevelNumber
- //! <countmode> True : values are naturally displayed
- //! <countmode> False: values are separated by slashes
- //! in order to allow selection by signature by Draw or C++
- Standard_EXPORT IGESSelect_SignLevelNumber(const Standard_Boolean countmode);
-
- //! Returns the value (see above)
- Standard_EXPORT Standard_CString Value (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_SignLevelNumber,IFSelect_Signature)
-
-protected:
-
-
-
-
-private:
-
-
- Standard_Boolean thecountmode;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_SignLevelNumber_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_SignStatus.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_SignStatus,IFSelect_Signature)
-
-static char theval[10];
-
- IGESSelect_SignStatus::IGESSelect_SignStatus ()
- : IFSelect_Signature ("D.E. Status") { }
-
- Standard_CString IGESSelect_SignStatus::Value
- (const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& /*model*/) const
-{
- Handle(IGESData_IGESEntity) igesent = Handle(IGESData_IGESEntity)::DownCast(ent);
- if (igesent.IsNull()) return "";
- Standard_Integer i,j,k,l;
- i = igesent->BlankStatus ();
- j = igesent->SubordinateStatus ();
- k = igesent->UseFlag ();
- l = igesent->HierarchyStatus ();
- sprintf (theval,"%d,%d,%d,%d",i,j,k,l);
- return theval;
-}
-
- Standard_Boolean IGESSelect_SignStatus::Matches
- (const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& /*model*/,
- const TCollection_AsciiString& text, const Standard_Boolean exact) const
-{
- Handle(IGESData_IGESEntity) igesent = Handle(IGESData_IGESEntity)::DownCast(ent);
- if (igesent.IsNull()) return Standard_False;
- Standard_Integer i,j,k,l;
- i = igesent->BlankStatus ();
- j = igesent->SubordinateStatus ();
- k = igesent->UseFlag ();
- l = igesent->HierarchyStatus ();
- Standard_Integer n,nb = text.Length();
- if (nb > 9) nb = 9;
- for (n = 1; n <= nb; n ++) theval[n-1] = text.Value(n);
- theval[nb] = '\0';
-
- Standard_Integer vir = 0, val = 0;
- for (n = 0; n < nb; n ++) {
- char car = theval[n];
- if (car == ',') { vir ++; continue; }
- val = Standard_Integer (car-48);
- if (car == 'V' && vir == 0) val = 0;
- if (car == 'B' && vir == 0) val = 1;
- if (car == 'I' && vir == 1) val = 0;
- if (car == 'P' && vir == 1) val = 1;
- if (car == 'L' && vir == 1) val = 2;
- if (car == 'D' && vir == 1) val = 3;
-// Matches ?
- if (vir == 0) { // Blank
- if (i == val && !exact) return Standard_True;
- if (i != val && exact) return Standard_False;
- }
- if (vir == 1) { // Subord.
- if (j == val && !exact) return Standard_True;
- if (j != val && exact) return Standard_False;
- }
- if (vir == 2) { // UseFlag
- if (k == val && !exact) return Standard_True;
- if (k != val && exact) return Standard_False;
- }
- if (vir == 3) { // Hierarchy
- if (l == val && !exact) return Standard_True;
- if (l != val && exact) return Standard_False;
- }
- }
- return exact; // un brin de reflexion pour arriver
-}
+++ /dev/null
-// Created on: 1998-01-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 _IGESSelect_SignStatus_HeaderFile
-#define _IGESSelect_SignStatus_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Signature.hxx>
-#include <Standard_CString.hxx>
-class Standard_Transient;
-class Interface_InterfaceModel;
-class TCollection_AsciiString;
-
-
-class IGESSelect_SignStatus;
-DEFINE_STANDARD_HANDLE(IGESSelect_SignStatus, IFSelect_Signature)
-
-//! Gives D.E. Status under the form i,j,k,l (4 figures)
-//! i for BlankStatus
-//! j for SubordinateStatus
-//! k for UseFlag
-//! l for Hierarchy
-//!
-//! For matching, allowed shortcuts
-//! B(Blanked) or V(Visible) are allowed instead of i
-//! I(Independant=0), P(Physically Dep.=1), L(Logically Dep.=2) or
-//! D(Dependant=3) are allowed instead of j
-//! These letters must be given in their good position
-//! For non-exact matching :
-//! a letter (see above), no comma : only this status is checked
-//! nothing or a star between commas : this status is OK
-class IGESSelect_SignStatus : public IFSelect_Signature
-{
-
-public:
-
-
- Standard_EXPORT IGESSelect_SignStatus();
-
- //! Returns the value (see above)
- Standard_EXPORT Standard_CString Value (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
-
- //! Performs the match rule (see above)
- Standard_EXPORT virtual Standard_Boolean Matches (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model, const TCollection_AsciiString& text, const Standard_Boolean exact) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_SignStatus,IFSelect_Signature)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_SignStatus_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_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
- std::cout<<"IGESSelect_SplineToBSpline : n0."<<i
- << (it == 112 ? ", Curve" : ", Surface")<<" to convert"<<std::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 <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_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>
-
-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_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_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>
-
-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_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,Standard_Transient)
-
-#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 <Standard_Transient.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <Standard_Integer.hxx>
-class IGESData_IGESModel;
-class IGESData_IGESEntity;
-class Interface_InterfaceModel;
-class Interface_Graph;
-class IFSelect_PacketList;
-
-
-class IGESSelect_ViewSorter;
-DEFINE_STANDARD_HANDLE(IGESSelect_ViewSorter, Standard_Transient)
-
-//! 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 Standard_Transient
-{
-
-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,Standard_Transient)
-
-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
+++ /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 <IGESAppli.hxx>
-#include <IGESAppli_Protocol.hxx>
-#include <IGESData_FileProtocol.hxx>
-#include <IGESData_IGESDumper.hxx>
-#include <IGESData_IGESEntity.hxx>
-#include <IGESData_IGESWriter.hxx>
-#include <IGESData_Protocol.hxx>
-#include <IGESDefs.hxx>
-#include <IGESFile_Read.hxx>
-#include <IGESSelect_Dumper.hxx>
-#include <IGESSelect_FileModifier.hxx>
-#include <IGESSelect_WorkLibrary.hxx>
-#include <IGESSolid.hxx>
-#include <IGESSolid_Protocol.hxx>
-#include <Interface_Check.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Interface_Protocol.hxx>
-#include <Interface_ReportEntity.hxx>
-#include <Message.hxx>
-#include <Message_Messenger.hxx>
-#include <OSD_FileSystem.hxx>
-#include <Standard_ErrorHandler.hxx>
-#include <Standard_Stream.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-
-#include <errno.h>
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_WorkLibrary,IFSelect_WorkLibrary)
-
-static int deja = 0;
-static Handle(IGESData_FileProtocol) IGESProto;
-
-
- IGESSelect_WorkLibrary::IGESSelect_WorkLibrary
- (const Standard_Boolean modefnes)
- : themodefnes (modefnes)
-{
- IGESSolid::Init();
- IGESAppli::Init();
- IGESDefs::Init();
-
- if (!deja) {
- Handle(IGESSelect_Dumper) sesdump = new IGESSelect_Dumper; // ainsi,cestfait
- deja = 1;
- }
- SetDumpLevels (4,6);
- SetDumpHelp (0,"Only DNum");
- SetDumpHelp (1,"DNum, IGES Type & Form");
- SetDumpHelp (2,"Main Directory Information");
- 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 IGESSelect_WorkLibrary::ReadFile
- (const Standard_CString name,
- Handle(Interface_InterfaceModel)& model,
- const Handle(Interface_Protocol)& protocol) const
-{
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- 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<<std::endl;
- if (status > 0) sout<<"Error when reading file : "<<name<<std::endl;
- if (status == 0) model = igesmod;
- else model.Nullify();
- return status;
-}
-
-
- Standard_Boolean IGESSelect_WorkLibrary::WriteFile
- (IFSelect_ContextWrite& ctx) const
-{
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
-// Preparation
- DeclareAndCast(IGESData_IGESModel,igesmod,ctx.Model());
- DeclareAndCast(IGESData_Protocol,prot,ctx.Protocol());
-
- if (igesmod.IsNull() || prot.IsNull()) return Standard_False;
- const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
- std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (ctx.FileName(), std::ios::out | std::ios::binary);
- if (aStream.get() == NULL)
- {
- ctx.CCheck(0)->AddFail("IGES File could not be created");
- sout<<" - IGES File could not be created : " << ctx.FileName() << std::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(IGESSelect_FileModifier,filemod,ctx.FileModifier());
- if (!filemod.IsNull()) filemod->Perform(ctx,VW);
-// (impressions de mise au point)
- sout << " .. FileMod." << numod <<" "<< filemod->Label();
- if (ctx.IsForAll()) sout << " (all model)";
- else sout << " (" << ctx.NbEntities() << " entities)";
-// sout << std::flush;
- }
-
-// Envoi
- VW.SendModel(prot);
- sout<<" Write ";
- if (themodefnes) VW.WriteMode() = 10;
- Standard_Boolean status = VW.Print (*aStream); sout<<" Done"<<std::endl;
-
- errno = 0;
- aStream->flush();
- status = aStream->good() && status && !errno;
- aStream.reset();
- if(errno)
- sout << strerror(errno) << std::endl;
-
- return status;
-}
-
- Handle(IGESData_Protocol) IGESSelect_WorkLibrary::DefineProtocol ()
-{
- if (!IGESProto.IsNull()) return IGESProto;
- Handle(IGESData_Protocol) IGESProto1 = IGESSolid::Protocol();
- Handle(IGESData_Protocol) IGESProto2 = IGESAppli::Protocol();
-// Handle(IGESData_FileProtocol) IGESProto = new IGESData_FileProtocol;
- IGESProto = new IGESData_FileProtocol;
- IGESProto->Add(IGESProto1);
- IGESProto->Add(IGESProto2);
- return IGESProto;
-}
-
-
- void IGESSelect_WorkLibrary::DumpEntity
- (const Handle(Interface_InterfaceModel)& model,
- const Handle(Interface_Protocol)& protocol,
- const Handle(Standard_Transient)& entity,
- Standard_OStream& 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"<<std::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)" << std::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 const&) {
- S << " ** Dump Interrupt **" << std::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 _IGESSelect_WorkLibrary_HeaderFile
-#define _IGESSelect_WorkLibrary_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_WorkLibrary.hxx>
-#include <Standard_Integer.hxx>
-class Interface_InterfaceModel;
-class Interface_Protocol;
-class IFSelect_ContextWrite;
-class IGESData_Protocol;
-class Standard_Transient;
-
-class IGESSelect_WorkLibrary;
-DEFINE_STANDARD_HANDLE(IGESSelect_WorkLibrary, IFSelect_WorkLibrary)
-
-//! Performs Read and Write an IGES File with an IGES Model
-class IGESSelect_WorkLibrary : public IFSelect_WorkLibrary
-{
-
-public:
-
-
- //! Creates a IGES WorkLibrary
- //! If <modefnes> is given as True, it will work for FNES
- Standard_EXPORT IGESSelect_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;
-
- //! Defines a protocol to be adequate for IGES
- //! (encompasses ALL the IGES norm including IGESSolid, IGESAppli)
- Standard_EXPORT static Handle(IGESData_Protocol) DefineProtocol();
-
- //! 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, Standard_OStream& S, const Standard_Integer level) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_WorkLibrary,IFSelect_WorkLibrary)
-
-protected:
-
-
-
-
-private:
-
-
- Standard_Boolean themodefnes;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_WorkLibrary_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.
-
-//szv#4 S4163
-//svv#1 11.01.00 : porting on DEC
-//svv#2 21.02.00 : porting on SIL
-//smh#14 17.03.2000 : FRA62479 Clearing of gtool.
-
-#include <Interface_Check.hxx>
-#include <Interface_CheckIterator.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_GeneralModule.hxx>
-#include <Interface_GTool.hxx>
-#include <Interface_InterfaceMismatch.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Protocol.hxx>
-#include <Interface_ReportEntity.hxx>
-#include <Interface_SignType.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_HAsciiString.hxx>
-#include <TColStd_Array1OfTransient.hxx>
-#include <TColStd_DataMapIteratorOfDataMapOfIntegerTransient.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(Interface_InterfaceModel, Standard_Transient)
-
-// Un Modele d`Interface est un ensemble ferme d`Entites d`interface : chacune
-// est dans un seul modele a la fois; elle y a un numero (Number) qui permet de
-// verifier qu`une entite est bien dans un seul modele, de definir des Map tres
-// performantes, de fournir un identifieur numerique
-// Il est a meme d`etre utilise dans des traitements de Graphe
-// STATICS : les TEMPLATES
-static NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> atemp;
-
-static const Handle(Standard_Type)& typerep()
-{
- static Handle(Standard_Type) tr = STANDARD_TYPE(Interface_ReportEntity);
- return tr;
-}
-
-
-static const Handle(Interface_Check)& nulch()
-{
- static Handle(Interface_Check) anulch = new Interface_Check;
- return anulch;
-}
-
-
-//=======================================================================
-//function : Interface_InterfaceModel
-//purpose :
-//=======================================================================
-
-Interface_InterfaceModel::Interface_InterfaceModel ()
- : haschecksem (Standard_False), isdispatch (Standard_False)
-{
- thecheckstx = new Interface_Check;
- thechecksem = new Interface_Check;
-}
-
-
-//=======================================================================
-//function : Destroy
-//purpose :
-//=======================================================================
-
-void Interface_InterfaceModel::Destroy () // on fait un mimumum
-{
-// Moins que Clear que, lui, est adapte a chaque norme
- ClearEntities();
- thecheckstx->Clear();
- thechecksem->Clear();
- thecategory.Nullify();
-}
-
-
-//=======================================================================
-//function : SetProtocol
-//purpose :
-//=======================================================================
-
-void Interface_InterfaceModel::SetProtocol(const Handle(Interface_Protocol)& proto)
-{
- thegtool = new Interface_GTool(proto);
-}
-
-
-//=======================================================================
-//function : Protocol
-//purpose :
-//=======================================================================
-
-Handle(Interface_Protocol) Interface_InterfaceModel::Protocol () const
-{
- Handle(Interface_Protocol) proto;
- if (!thegtool.IsNull()) return thegtool->Protocol();
- return proto;
-}
-
-
-//=======================================================================
-//function : SetGTool
-//purpose :
-//=======================================================================
-
-void Interface_InterfaceModel::SetGTool(const Handle(Interface_GTool)& gtool)
-{
- thegtool = gtool;
-}
-
-
-//=======================================================================
-//function : GTool
-//purpose :
-//=======================================================================
-
-Handle(Interface_GTool) Interface_InterfaceModel::GTool () const
-{
- return thegtool;
-}
-
-
-//=======================================================================
-//function : Clear
-//purpose :
-//=======================================================================
-
-void Interface_InterfaceModel::Clear ()
-{
- ClearEntities();
- thecheckstx->Clear();
- thechecksem->Clear();
- ClearHeader();
- ClearLabels();
- thecategory.Nullify();
-}
-
-
-//=======================================================================
-//function : DispatchStatus
-//purpose :
-//=======================================================================
-
-Standard_Boolean& Interface_InterfaceModel::DispatchStatus ()
-{
- return isdispatch;
-}
-
-
-//=======================================================================
-//function : ClearEntities
-//purpose :
-//=======================================================================
-
-void Interface_InterfaceModel::ClearEntities ()
-{
- thereports.Clear();
- therepch.Clear();
- haschecksem = Standard_False;
-
- if (!thegtool.IsNull()) {
-// WhenDeleteCase is not applicable
-/* Handle(Interface_GeneralModule) module; Standard_Integer CN;
- Standard_Integer nb = NbEntities();
- for (Standard_Integer i = 1; i <= nb ; i ++) {
- Handle(Standard_Transient) anent = Value(i);
- if (thegtool->Select (anent,module,CN))
- module->WhenDeleteCase (CN,anent,isdispatch);
- }*/
- thegtool->ClearEntities(); //smh#14 FRA62479
- }
- isdispatch = Standard_False;
- theentities.Clear();
-}
-
-
-// .... ACCES AUX ENTITES ....
-
-
-//=======================================================================
-//function : NbEntities
-//purpose :
-//=======================================================================
-
-Standard_Integer Interface_InterfaceModel::NbEntities () const
-{
- return theentities.Extent();
-}
-
-
-//=======================================================================
-//function : Contains
-//purpose :
-//=======================================================================
-
-Standard_Boolean Interface_InterfaceModel::Contains
- (const Handle(Standard_Transient)& anentity) const
-{
- if (theentities.Contains(anentity)) return Standard_True;
- Handle(Interface_ReportEntity) rep =
- Handle(Interface_ReportEntity)::DownCast(anentity);
- if (!rep.IsNull()) return Contains(rep->Concerned());
- return Standard_False;
-}
-
-
-//=======================================================================
-//function : Number
-//purpose :
-//=======================================================================
-
-Standard_Integer Interface_InterfaceModel::Number
- (const Handle(Standard_Transient)& anentity) const
-{
- if (anentity.IsNull()) return 0;
- Standard_Integer num = theentities.FindIndex(anentity);
- if (num > 0) return num;
- if (anentity->IsKind(typerep())) {
- Handle(Interface_ReportEntity) rep =
- Handle(Interface_ReportEntity)::DownCast(anentity);
- if (!rep.IsNull()) return Number(rep->Concerned());
- }
- return 0;
-}
-
-/*
-Standard_Integer Interface_InterfaceModel::DENumber
- (const Handle(Standard_Transient)& anentity) const
-{
- if (anentity.IsNull()) return 0;
- Standard_Integer num = theentities.FindIndex(anentity);
- if (num > 0) return (2*num-1);
- if (anentity->IsKind(typerep())) {
- Handle(Interface_ReportEntity) rep =
- Handle(Interface_ReportEntity)::DownCast(anentity);
- if (!rep.IsNull()) return (Number(rep->Concerned())*2-1);
- }
- return 0;
-}
-*/
-
-// .. Acces Speciaux (Report, etc...) ..
-
-
-//=======================================================================
-//function : Value
-//purpose :
-//=======================================================================
-
-const Handle(Standard_Transient)& Interface_InterfaceModel::Value
- (const Standard_Integer num) const
-{
- return theentities.FindKey(num);
-}
-
-
-//=======================================================================
-//function : NbTypes
-//purpose :
-//=======================================================================
-
-Standard_Integer Interface_InterfaceModel::NbTypes
- (const Handle(Standard_Transient)& ent) const
-{
- if (Protocol().IsNull()) return 1;
- return Protocol()->NbTypes(ent);
-}
-
-
-//=======================================================================
-//function : Type
-//purpose :
-//=======================================================================
-
-Handle(Standard_Type) Interface_InterfaceModel::Type
- (const Handle(Standard_Transient)& ent, const Standard_Integer nt) const
-{
- if (Protocol().IsNull()) return ent->DynamicType();
- return Protocol()->Type(ent,nt);
-}
-
-
-//=======================================================================
-//function : TypeName
-//purpose :
-//=======================================================================
-
-Standard_CString Interface_InterfaceModel::TypeName
- (const Handle(Standard_Transient)& ent, const Standard_Boolean complet) const
-{
- if (!thegtool.IsNull()) return thegtool->SignValue (ent,this);
- Standard_CString tn = ent->DynamicType()->Name();
- if (complet) return tn;
- return Interface_InterfaceModel::ClassName(tn);
-}
-
-
-//=======================================================================
-//function : ClassName
-//purpose :
-//=======================================================================
-
-Standard_CString Interface_InterfaceModel::ClassName(const Standard_CString typnam)
-{
- return Interface_SignType::ClassName (typnam);
-}
-
-
-//=======================================================================
-//function : EntityState
-//purpose :
-//=======================================================================
-
-Interface_DataState Interface_InterfaceModel::EntityState
- (const Standard_Integer num) const
-{
- Handle(Interface_ReportEntity) rep;
- if (!thereports.IsBound(num)) {
- if (!therepch.IsBound(num)) return Interface_StateOK;
- rep = Handle(Interface_ReportEntity)::DownCast(therepch.Find(num));
- if (rep->IsError()) return Interface_DataFail;
- return Interface_DataWarning;
- }
- rep = Handle(Interface_ReportEntity)::DownCast(thereports.Find(num));
- if (rep.IsNull()) return Interface_StateUnknown;
- if (rep->IsUnknown()) return Interface_StateUnknown;
- if (rep->HasNewContent()) return Interface_StateUnloaded;
- if (rep->IsError()) return Interface_LoadFail;
-
- if (!therepch.IsBound(num)) return Interface_LoadWarning;
- rep = Handle(Interface_ReportEntity)::DownCast(therepch.Find(num));
- if (rep->IsError()) return Interface_DataFail;
- return Interface_DataWarning;
-}
-
-
-//=======================================================================
-//function : IsReportEntity
-//purpose :
-//=======================================================================
-
-Standard_Boolean Interface_InterfaceModel::IsReportEntity
- (const Standard_Integer num, const Standard_Boolean semantic) const
-{
- return (semantic ? therepch.IsBound(num) : thereports.IsBound(num));
-}
-
-
-//=======================================================================
-//function : ReportEntity
-//purpose :
-//=======================================================================
-
-Handle(Interface_ReportEntity) Interface_InterfaceModel::ReportEntity
- (const Standard_Integer num, const Standard_Boolean semantic) const
-{
- Handle(Interface_ReportEntity) rep;
- if (!IsReportEntity(num,semantic)) return rep;
- if (semantic) rep = Handle(Interface_ReportEntity)::DownCast(therepch.Find(num));
- else rep = Handle(Interface_ReportEntity)::DownCast(thereports.Find(num));
- return rep;
-}
-
-
-//=======================================================================
-//function : IsErrorEntity
-//purpose :
-//=======================================================================
-
-Standard_Boolean Interface_InterfaceModel::IsErrorEntity
- (const Standard_Integer num) const
-{
- Handle(Interface_ReportEntity) rep = ReportEntity(num);
- if (rep.IsNull()) return Standard_False;
- return rep->IsError();
-}
-
-
-//=======================================================================
-//function : IsRedefinedContent
-//purpose :
-//=======================================================================
-
-Standard_Boolean Interface_InterfaceModel::IsRedefinedContent
- (const Standard_Integer num) const
-{
- Handle(Interface_ReportEntity) rep = ReportEntity(num);
- if (rep.IsNull()) return Standard_False;
- return rep->HasNewContent();
-}
-
-
-//=======================================================================
-//function : ClearReportEntity
-//purpose :
-//=======================================================================
-
-Standard_Boolean Interface_InterfaceModel::ClearReportEntity
- (const Standard_Integer num)
-{
- if (!thereports.IsBound(num)) return Standard_False;
- thereports.UnBind (num);
- return Standard_True;
-}
-
-
-//=======================================================================
-//function : SetReportEntity
-//purpose :
-//=======================================================================
-
-Standard_Boolean Interface_InterfaceModel::SetReportEntity
- (const Standard_Integer num, const Handle(Interface_ReportEntity)& rep)
-{
- Standard_Integer nm = num;
- Handle(Standard_Transient) ent;
- if (num > 0) {
- ent = Value(nm);
- if (! (ent == rep->Concerned()) ) throw Interface_InterfaceMismatch("InterfaceModel : SetReportEntity");
- } else if (num < 0) {
- nm = -num;
- ent = Value(nm);
- if (! (ent == rep->Concerned()) ) throw Interface_InterfaceMismatch("InterfaceModel : SetReportEntity");
- } else {
- ent = rep->Concerned();
- nm = Number (ent);
- if (nm == 0) throw Interface_InterfaceMismatch("InterfaceModel : SetReportEntity");
- }
- if (!thereports.IsBound(nm)) {
- Standard_Integer maxrep = thereports.NbBuckets();
- if (thereports.Extent() > maxrep - 10) thereports.ReSize(maxrep*3/2);
- }
- if (nm <= 0) return Standard_False;
- return thereports.Bind (nm,rep);
-}
-
-
-//=======================================================================
-//function : AddReportEntity
-//purpose :
-//=======================================================================
-
-Standard_Boolean Interface_InterfaceModel::AddReportEntity
- (const Handle(Interface_ReportEntity)& rep, const Standard_Boolean semantic)
-{
- if (rep.IsNull()) return Standard_False;
- Handle(Standard_Transient) ent = rep->Concerned();
- if (ent.IsNull()) return Standard_False;
- Standard_Integer num = Number(ent);
- if (num == 0) return Standard_False;
- if (semantic) return thereports.Bind (num,rep);
- else return therepch.Bind (num,rep);
-}
-
-
-//=======================================================================
-//function : IsUnknownEntity
-//purpose :
-//=======================================================================
-
-Standard_Boolean Interface_InterfaceModel::IsUnknownEntity
- (const Standard_Integer num) const
-{
- Handle(Interface_ReportEntity) rep = ReportEntity(num);
- if (rep.IsNull()) return Standard_False;
- return rep->IsUnknown();
-}
-
-
-// .... Checks semantiques .... //
-
-
-//=======================================================================
-//function : FillSemanticChecks
-//purpose :
-//=======================================================================
-
-void Interface_InterfaceModel::FillSemanticChecks
- (const Interface_CheckIterator& checks, const Standard_Boolean clear)
-{
- if (!checks.Model().IsNull()) {
- Handle(Standard_Transient) t1 = checks.Model();
- Handle(Standard_Transient) t2 = this;
- if (t2 != t1) return;
- }
- if (clear) { therepch.Clear(); thechecksem->Clear(); }
- Standard_Integer nb = 0;
- for (checks.Start(); checks.More(); checks.Next()) nb ++;
- therepch.ReSize (therepch.Extent() + nb + 2);
- for (checks.Start(); checks.More(); checks.Next()) {
- const Handle(Interface_Check) ach = checks.Value();
- Standard_Integer num = checks.Number();
-// global check : ok si MEME MODELE
- if (num == 0) thechecksem->GetMessages(ach);
- else {
- Handle(Standard_Transient) ent = Value(num);
- Handle(Interface_ReportEntity) rep = new Interface_ReportEntity(ach,ent);
- therepch.Bind (num,rep);
- }
- }
- haschecksem = Standard_True;
-}
-
-
-//=======================================================================
-//function : HasSemanticChecks
-//purpose :
-//=======================================================================
-
-Standard_Boolean Interface_InterfaceModel::HasSemanticChecks () const
-{
- return haschecksem;
-}
-
-
-//=======================================================================
-//function : Check
-//purpose :
-//=======================================================================
-
-const Handle(Interface_Check)& Interface_InterfaceModel::Check
- (const Standard_Integer num, const Standard_Boolean syntactic) const
-{
- if (num == 0) {
- if (syntactic) return thecheckstx;
- else return thechecksem;
- }
- if (! (syntactic ? thereports.IsBound(num) : therepch.IsBound(num)) )
- return nulch();
- Handle(Standard_Transient) trep;
- if (syntactic) trep = thereports.Find(num);
- else trep = therepch.Find(num);
- Handle(Interface_ReportEntity) rep = Handle(Interface_ReportEntity)::DownCast(trep);
- if (rep.IsNull()) return nulch();
- return rep->Check();
-}
-
-
-// .... Chargement des donnees du Modele .... //
-
-
-//=======================================================================
-//function : Reservate
-//purpose :
-//=======================================================================
-
-void Interface_InterfaceModel::Reservate (const Standard_Integer nbent)
-{
- if (nbent > theentities.NbBuckets()) theentities.ReSize (nbent);
- if (nbent < -thereports.NbBuckets()) thereports.ReSize (-nbent);
-}
-
-
-//=======================================================================
-//function : AddEntity
-//purpose :
-//=======================================================================
-
-void Interface_InterfaceModel::AddEntity(const Handle(Standard_Transient)& anentity)
-{
- //Standard_Integer newnum; svv #2
- if (!anentity->IsKind(typerep())) theentities.Add(anentity);
-// Report : Ajouter Concerned, mais noter presence Report et sa valeur
- else {
- Handle(Interface_ReportEntity) rep =
- Handle(Interface_ReportEntity)::DownCast(anentity);
- AddEntity(rep->Concerned());
- Standard_Integer maxrep = thereports.NbBuckets();
- if (thereports.Extent() > maxrep - 10) thereports.ReSize(maxrep*3/2);
- thereports.Bind (Number(rep->Concerned()),rep);
- }
-}
-
-
-// AddWithRefs itere sur les Entities referencees pour charger une Entite
-// au complet, avec tout ce dont elle a besoin
-
-
-//=======================================================================
-//function : AddWithRefs
-//purpose :
-//=======================================================================
-
-void Interface_InterfaceModel::AddWithRefs(const Handle(Standard_Transient)& anent,
- const Handle(Interface_Protocol)& proto,
- const Standard_Integer level,
- const Standard_Boolean listall)
-{
- if (anent.IsNull()) return;
- if (theentities.FindIndex(anent) != 0) {
- if (!listall) return;
- }
- Interface_GeneralLib lib(proto);
- AddWithRefs (anent,lib,level,listall);
- if (Protocol().IsNull() && !proto.IsNull()) SetProtocol(proto);
-}
-
-
-//=======================================================================
-//function : AddWithRefs
-//purpose :
-//=======================================================================
-
-void Interface_InterfaceModel::AddWithRefs(const Handle(Standard_Transient)& anent,
- const Standard_Integer level,
- const Standard_Boolean listall)
-{
- Handle(Interface_Protocol) proto = Protocol();
- if (proto.IsNull()) throw Interface_InterfaceMismatch("InterfaceModel : AddWithRefs");
- AddWithRefs (anent,proto,level,listall);
-}
-
-
-//=======================================================================
-//function : AddWithRefs
-//purpose :
-//=======================================================================
-
-void Interface_InterfaceModel::AddWithRefs(const Handle(Standard_Transient)& anent,
- const Interface_GeneralLib& lib,
- const Standard_Integer level,
- const Standard_Boolean listall)
-{
- if (anent.IsNull()) return;
- if (theentities.FindIndex(anent) != 0) {
- if (!listall) return;
- }
- else AddEntity(anent);
-
- Interface_EntityIterator iter;
- Handle(Interface_GeneralModule) module; Standard_Integer CN;
- if (lib.Select (anent,module,CN)) {
- module->FillSharedCase (CN,anent,iter);
-// FillShared tout court : supposerait que le modele soit deja pret
-// or justement, on est en train de le construire ...
- module->ListImpliedCase (CN,anent,iter);
- }
- Standard_Integer lev1 = level-1;
- if (lev1 == 0) return; // level = 0 -> tous niveaux; sinon encore n-1
- for (iter.Start(); iter.More(); iter.Next())
- AddWithRefs(iter.Value(),lib,lev1,listall);
-}
-
-
-//=======================================================================
-//function : ReplaceEntity
-//purpose :
-//=======================================================================
-
-void Interface_InterfaceModel::ReplaceEntity(const Standard_Integer nument,
- const Handle(Standard_Transient)& anent)
-{
- theentities.Substitute(nument,anent);
-}
-
-// ReverseOrders permet de mieux controler la numeration des Entites :
-// Souvent, les fichiers mettent les racines en fin, tandis que AddWithRefs
-// les met en tete.
-
-
-//=======================================================================
-//function : ReverseOrders
-//purpose :
-//=======================================================================
-
-void Interface_InterfaceModel::ReverseOrders (const Standard_Integer after)
-{
- Standard_Integer nb = NbEntities(); //Standard_Integer num; svv #2
- if (nb < 2 || after >= nb) return;
- TColStd_Array1OfTransient ents(1,nb);
- Standard_Integer i; // svv #1
- for (i = 1; i <= nb; i ++)
- ents.SetValue (i, theentities.FindKey(i));
-// On va vider la Map, puis la recharger : dans l ordre jusqua after
-// en ordre inverse apres
- theentities.Clear();
- Reservate (nb);
- for (i = 1; i <= after; i ++) theentities.Add (ents(i));// svv #2
- for (i = nb; i > after; i --) theentities.Add (ents(i));
-// Faudra aussi s occuper des Reports
- for (i = nb; i > after; i --) {
- Standard_Integer i2 = nb+after-i;
- Handle(Standard_Transient) rep1,rep2;
- if (thereports.IsBound(i)) rep1 = thereports.Find(i);
- if (thereports.IsBound(i2)) rep2 = thereports.Find(i2);
- if (!rep1.IsNull()) thereports.Bind (i2,rep1);
- else thereports.UnBind (i2);
- if (!rep2.IsNull()) thereports.Bind (i,rep2);
- else thereports.UnBind (i);
- }
-}
-
-
-//=======================================================================
-//function : ChangeOrder
-//purpose :
-//=======================================================================
-
-void Interface_InterfaceModel::ChangeOrder(const Standard_Integer oldnum,
- const Standard_Integer newnum,
- const Standard_Integer cnt) //szv#4:S4163:12Mar99 `count` hid one from this
-{
- Standard_Integer nb = NbEntities(); Standard_Integer i; //, num; svv #2
- if (nb < 2 || newnum >= nb || cnt<= 0) return;
- TColStd_Array1OfTransient ents(1,nb);
- // On va preparer le changement
- Standard_Integer minum = (oldnum > newnum ? newnum : oldnum);
- Standard_Integer mxnum = (oldnum < newnum ? newnum : oldnum);
- Standard_Integer kount = (oldnum > newnum ? cnt : -cnt);
- if (cnt <= 0 || cnt > mxnum - minum) throw Interface_InterfaceMismatch("InterfaceModel : ChangeOrder, Overlap");
- for (i = 1; i < minum; i ++) ents.SetValue (i,theentities.FindKey(i));
- for (i = mxnum+cnt; i <= nb; i ++) ents.SetValue (i,theentities.FindKey(i));
- for (i = minum; i < mxnum; i ++)
- ents.SetValue( i + kount, theentities.FindKey(i) );
- for (i = oldnum; i < oldnum+cnt; i ++)
- ents.SetValue( i + (newnum-oldnum), theentities.FindKey(i) );
-
- theentities.Clear();
- Reservate (nb);
- for (i = 1; i <= nb; i ++) theentities.Add (ents(i)); // svv #2
-
- Standard_Integer difnum = mxnum - minum;
- for (i = minum; i < minum+cnt; i ++) {
- Handle(Standard_Transient) rep1, rep2;
- if (thereports.IsBound(i)) rep1 = thereports.Find(i);
- if (thereports.IsBound(i+difnum)) rep1 = thereports.Find(i+difnum);
- if (!rep1.IsNull()) thereports.Bind (i+difnum,rep1);
- else thereports.UnBind (i+difnum);
- if (!rep2.IsNull()) thereports.Bind (i,rep2);
- else thereports.UnBind (i);
- }
-}
-
-
-// GetFromTransfer permet de recuperer un resultat prepare par ailleurs
-// Le Modele demarre a zero. Les entites doivent etre libres (cf AddEntity)
-
-
-//=======================================================================
-//function : GetFromTransfer
-//purpose :
-//=======================================================================
-
-void Interface_InterfaceModel::GetFromTransfer
- (const Interface_EntityIterator& aniter)
-{
- theentities.Clear(); theentities.ReSize (aniter.NbEntities());
- for (aniter.Start(); aniter.More(); aniter.Next()) {
- Handle(Standard_Transient) ent = aniter.Value(); AddEntity(ent);
- }
-}
-
-
-// .... Interrogations .... //
-
-
-//=======================================================================
-//function : SetCategoryNumber
-//purpose :
-//=======================================================================
-
-Standard_Boolean Interface_InterfaceModel::SetCategoryNumber
- (const Standard_Integer num, const Standard_Integer val)
-{
- Standard_Integer i,nb = NbEntities();
- if (num < 1 || num > nb) return Standard_False;
- if (thecategory.IsNull()) thecategory = new TCollection_HAsciiString(nb,' ');
- else if (thecategory->Length() < nb) {
- Handle(TCollection_HAsciiString) c = new TCollection_HAsciiString(nb,' ');
- for (i = thecategory->Length(); i > 0; i --)
- c->SetValue(i,thecategory->Value(i));
- thecategory = c;
- }
- Standard_Character cval = (Standard_Character)(val + 32);
- thecategory->SetValue(num,cval);
- return Standard_True;
-}
-
-
-//=======================================================================
-//function : CategoryNumber
-//purpose :
-//=======================================================================
-
-Standard_Integer Interface_InterfaceModel::CategoryNumber
- (const Standard_Integer num) const
-{
- if (thecategory.IsNull()) return 0;
- if (num < 1 || num > thecategory->Length()) return 0;
- Standard_Integer val = thecategory->Value(num);
- return val-32;
-}
-
-
-//=======================================================================
-//function : FillIterator
-//purpose :
-//=======================================================================
-
-void Interface_InterfaceModel::FillIterator(Interface_EntityIterator& iter) const
-{
- Standard_Integer nb = NbEntities();
- for (Standard_Integer i = 1; i <= nb; i ++)
- iter.GetOneItem (theentities.FindKey(i));
-}
-
-
-//=======================================================================
-//function : Entities
-//purpose :
-//=======================================================================
-
-Interface_EntityIterator Interface_InterfaceModel::Entities () const
-{
- Interface_EntityIterator iter;
- FillIterator(iter);
- return iter;
-}
-
-
-//=======================================================================
-//function : Reports
-//purpose :
-//=======================================================================
-
-Interface_EntityIterator Interface_InterfaceModel::Reports
- (const Standard_Boolean semantic) const
-{
- Interface_EntityIterator iter;
- if (semantic) {
- TColStd_DataMapIteratorOfDataMapOfIntegerTransient itmap (therepch);
- for (; itmap.More(); itmap.Next()) iter.AddItem (itmap.Value());
- } else {
- TColStd_DataMapIteratorOfDataMapOfIntegerTransient itmap (thereports);
- for (; itmap.More(); itmap.Next()) iter.AddItem (itmap.Value());
- }
- return iter;
-}
-
-
-//=======================================================================
-//function : Redefineds
-//purpose :
-//=======================================================================
-
-Interface_EntityIterator Interface_InterfaceModel::Redefineds () const
-{
- Interface_EntityIterator iter;
- TColStd_DataMapIteratorOfDataMapOfIntegerTransient itmap (thereports);
- for (; itmap.More(); itmap.Next()) {
- Handle(Interface_ReportEntity) rep =
- Handle(Interface_ReportEntity)::DownCast(itmap.Value());
- if (rep.IsNull()) continue;
- if (!rep->HasNewContent()) continue;
- iter.AddItem (rep);
- }
- return iter;
-}
-
-//#include <limits.h>
-//#include <TColStd_MapTransientHasher.hxx>
-
-
-//=======================================================================
-//function : GlobalCheck
-//purpose :
-//=======================================================================
-
-const Handle(Interface_Check)& Interface_InterfaceModel::GlobalCheck
- (const Standard_Boolean syntactic) const
-{
- if (syntactic) return thecheckstx;
- else return thechecksem;
-}
-
-
-//=======================================================================
-//function : SetGlobalCheck
-//purpose :
-//=======================================================================
-
-void Interface_InterfaceModel::SetGlobalCheck(const Handle(Interface_Check)& ach)
-{
- thecheckstx = ach;
-}
-
-
-//=======================================================================
-//function : VerifyCheck
-//purpose :
-//=======================================================================
-
-void Interface_InterfaceModel::VerifyCheck (Handle(Interface_Check)& /*ach*/) const
-{
-}
-
-
-//=======================================================================
-//function : Print
-//purpose :
-//=======================================================================
-
-void Interface_InterfaceModel::Print(const Handle(Standard_Transient)& ent,
- Standard_OStream& S,
- const Standard_Integer mode) const
-{
- if (ent.IsNull()) { S << "NULL" ; return; }
- Standard_Integer num = Number(ent);
- if (mode <= 0) S <<num;
- if (mode == 0) S <<":";
- if (mode >= 0) {
- if (num > 0)
- PrintToLog(ent,S);
-// PrintLabel (ent,S);
- else S <<"??";
- }
-}
-
-
-//=======================================================================
-//function : PrintToLog
-//purpose :
-//=======================================================================
-
-void Interface_InterfaceModel::PrintToLog(const Handle(Standard_Transient)& ent,
- Standard_OStream& S) const
-{
- PrintLabel (ent,S);
-}
-
-
-// .... TEMPLATES .... //
-
-
-//=======================================================================
-//function : NextNumberForLabel
-//purpose :
-//=======================================================================
-
-Standard_Integer Interface_InterfaceModel::NextNumberForLabel
- (const Standard_CString label, const Standard_Integer fromnum,
- const Standard_Boolean exact) const
-{
- Standard_Integer n = NbEntities();
- Handle(TCollection_HAsciiString) labs = new TCollection_HAsciiString(label);
- Standard_Integer lnb = labs->Length();
- labs->LowerCase();
-
- Standard_Integer i; // svv #1
- for (i = fromnum+1; i <= n; i ++) {
- Handle(TCollection_HAsciiString) lab = StringLabel (Value(i));
- if (lab.IsNull()) continue;
- if (exact) {
- if (lab->IsSameString(labs,Standard_False)) return i;
- } else {
- if (lab->Length() < lnb) continue;
- lab->LowerCase();
- if (lab->SearchFromEnd(labs) == lab->Length() - lnb + 1) return i;
- }
- }
-
-// En "non exact", on admet de recevoir le numero entre 1 et n
- if (exact) return 0;
- i = 0;
- if (labs->IsIntegerValue()) i = atoi (labs->ToCString());
- if (i <= 0 || i > n) i = 0;
- return i;
-}
-
-
-//=======================================================================
-//function : HasTemplate
-//purpose :
-//=======================================================================
-
-Standard_Boolean Interface_InterfaceModel::HasTemplate
- (const Standard_CString name)
-{
- return atemp.IsBound(name);
-}
-
-
-//=======================================================================
-//function : Template
-//purpose :
-//=======================================================================
-
-Handle(Interface_InterfaceModel) Interface_InterfaceModel::Template
- (const Standard_CString name)
-{
- Handle(Interface_InterfaceModel) model,newmod;
- if (!HasTemplate(name)) return model;
- model = Handle(Interface_InterfaceModel)::DownCast(atemp.ChangeFind(name));
- newmod = model->NewEmptyModel();
- newmod->GetFromAnother (model);
- return newmod;
-}
-
-
-//=======================================================================
-//function : SetTemplate
-//purpose :
-//=======================================================================
-
-Standard_Boolean Interface_InterfaceModel::SetTemplate
- (const Standard_CString name, const Handle(Interface_InterfaceModel)& model)
-{
- return atemp.Bind(name, model);
-}
-
-
-//=======================================================================
-//function : ListTemplates
-//purpose :
-//=======================================================================
-
-Handle(TColStd_HSequenceOfHAsciiString) Interface_InterfaceModel::ListTemplates ()
-{
- Handle(TColStd_HSequenceOfHAsciiString) list = new
- TColStd_HSequenceOfHAsciiString();
- if (atemp.IsEmpty()) return list;
- NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator iter(atemp);
- for (; iter.More(); iter.Next()) {
- list->Append (new TCollection_HAsciiString (iter.Key()) );
- }
- return list;
-}
+++ /dev/null
-// Created by: Christian CAILLET <cky@phobox>
-// 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_InterfaceModel_HeaderFile
-#define _Interface_InterfaceModel_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TColStd_IndexedMapOfTransient.hxx>
-#include <TColStd_DataMapOfIntegerTransient.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Integer.hxx>
-#include <Interface_DataState.hxx>
-#include <TColStd_HSequenceOfHAsciiString.hxx>
-class Interface_Check;
-class TCollection_HAsciiString;
-class Interface_GTool;
-class Interface_Protocol;
-class Interface_ReportEntity;
-class Interface_CheckIterator;
-class Interface_GeneralLib;
-class Interface_EntityIterator;
-
-
-class Interface_InterfaceModel;
-DEFINE_STANDARD_HANDLE(Interface_InterfaceModel, Standard_Transient)
-
-//! Defines an (Indexed) Set of data corresponding to a complete
-//! Transfer by a File Interface, i.e. File Header and Transient
-//! Entities (Objects) contained in a File. Contained Entities are
-//! identified in the Model by unique and consecutive Numbers.
-//!
-//! In addition, a Model can attach to each entity, a specific
-//! Label according to the norm (e.g. Name for VDA, #ident for
-//! Step ...), intended to be output on a string or a stream
-//! (remark : labels are not obliged to be unique)
-//!
-//! InterfaceModel itself is not Transient, it is intended to
-//! work on a set of Transient Data. The services offered are
-//! basic Listing and Identification operations on Transient
-//! Entities, storage of Error Reports, Copying.
-//!
-//! Moreovere, it is possible to define and use templates. These
-//! are empty Models, from which copies can be obtained in order
-//! to be filled with effective data. This allows to record
-//! standard definitions for headers, avoiding to recreate them
-//! for each sendings, and assuring customisation of produced
-//! files for a given site.
-//! A template is attached to a name. It is possible to define a
-//! template from another one (get it, edit it then record it
-//! under another name).
-//!
-//! See also Graph, ShareTool, CheckTool for more
-class Interface_InterfaceModel : public Standard_Transient
-{
-
-public:
-
-
- //! Clears the list of entities (service WhenDelete)
- Standard_EXPORT void Destroy();
-~Interface_InterfaceModel()
-{
- Destroy();
-}
-
- //! Sets a Protocol for this Model
- //! It is also set by a call to AddWithRefs with Protocol
- //! It is used for : DumpHeader (as required), ClearEntities ...
- Standard_EXPORT void SetProtocol (const Handle(Interface_Protocol)& proto);
-
- //! Returns the Protocol which has been set by SetProtocol, or
- //! AddWithRefs with Protocol
- Standard_EXPORT virtual Handle(Interface_Protocol) Protocol() const;
-
- //! Sets a GTool for this model, which already defines a Protocol
- Standard_EXPORT void SetGTool (const Handle(Interface_GTool)& gtool);
-
- //! Returns the GTool, set by SetProtocol or by SetGTool
- Standard_EXPORT Handle(Interface_GTool) GTool() const;
-
- //! Returns the Dispatch Status, either for get or set
- //! A Model which is produced from Dispatch may share entities
- //! with the original (according to the Protocol), hence these
- //! non-copied entities should not be deleted
- Standard_EXPORT Standard_Boolean& DispatchStatus();
-
- //! Erases contained data; used when a Model is copied to others :
- //! the new copied ones begin from clear
- //! Clear calls specific method ClearHeader (see below)
- Standard_EXPORT virtual void Clear();
-
- //! Clears the entities; uses the general service WhenDelete, in
- //! addition to the standard Memory Manager; can be redefined
- Standard_EXPORT virtual void ClearEntities();
-
- //! Erases information about labels, if any : specific to each
- //! norm
- Standard_EXPORT virtual void ClearLabels() = 0;
-
- //! Clears Model's header : specific to each norm
- Standard_EXPORT virtual void ClearHeader() = 0;
-
- //! Returns count of contained Entities
- Standard_EXPORT Standard_Integer NbEntities() const;
-
- //! Returns True if a Model contains an Entity (for a ReportEntity,
- //! looks for the ReportEntity itself AND its Concerned Entity)
- Standard_EXPORT Standard_Boolean Contains (const Handle(Standard_Transient)& anentity) const;
-
- //! Returns the Number of an Entity in the Model if it contains it.
- //! Else returns 0. For a ReportEntity, looks at Concerned Entity.
- //! Returns the Directory entry Number of an Entity in
- //! the Model if it contains it. Else returns 0. For a
- //! ReportEntity, looks at Concerned Entity.
- Standard_EXPORT Standard_Integer Number (const Handle(Standard_Transient)& anentity) const;
-
- //! Returns an Entity identified by its number in the Model
- //! Each sub-class of InterfaceModel can define its own method
- //! Entity to return its specific class of Entity (e.g. for VDA,
- //! VDAModel returns a VDAEntity), working by calling Value
- //! Remark : For a Reported Entity, (Erroneous, Corrected, Unknown), this
- //! method returns this Reported Entity.
- //! See ReportEntity for other questions.
- Standard_EXPORT const Handle(Standard_Transient)& Value (const Standard_Integer num) const;
-
- //! Returns the count of DISTINCT types under which an entity may
- //! be processed. Defined by the Protocol, which gives default as
- //! 1 (dynamic Type).
- Standard_EXPORT Standard_Integer NbTypes (const Handle(Standard_Transient)& ent) const;
-
- //! Returns a type, given its rank : defined by the Protocol
- //! (by default, the first one)
- Standard_EXPORT Handle(Standard_Type) Type (const Handle(Standard_Transient)& ent, const Standard_Integer num = 1) const;
-
- //! Returns the type name of an entity, from the list of types
- //! (one or more ...)
- //! <complete> True (D) gives the complete type, else packages are
- //! removed
- //! WARNING : buffered, to be immediately copied or printed
- Standard_EXPORT Standard_CString TypeName (const Handle(Standard_Transient)& ent, const Standard_Boolean complete = Standard_True) const;
-
- //! From a CDL Type Name, returns the Class part (package dropped)
- //! WARNING : buffered, to be immediately copied or printed
- Standard_EXPORT static Standard_CString ClassName (const Standard_CString typnam);
-
- //! Returns the State of an entity, given its number
- Standard_EXPORT Interface_DataState EntityState (const Standard_Integer num) const;
-
- //! Returns True if <num> identifies a ReportEntity in the Model
- //! Hence, ReportEntity can be called.
- //!
- //! By default, queries main report, if <semantic> is True, it
- //! queries report for semantic check
- //!
- //! Remember that a Report Entity can be defined for an Unknown
- //! Entity, or a Corrected or Erroneous (at read time) Entity.
- //! The ReportEntity is defined before call to method AddEntity.
- Standard_EXPORT Standard_Boolean IsReportEntity (const Standard_Integer num, const Standard_Boolean semantic = Standard_False) const;
-
- //! Returns a ReportEntity identified by its number in the Model,
- //! or a Null Handle If <num> does not identify a ReportEntity.
- //!
- //! By default, queries main report, if <semantic> is True, it
- //! queries report for semantic check
- Standard_EXPORT Handle(Interface_ReportEntity) ReportEntity (const Standard_Integer num, const Standard_Boolean semantic = Standard_False) const;
-
- //! Returns True if <num> identifies an Error Entity : in this
- //! case, a ReportEntity brings Fail Messages and possibly an
- //! "undefined" Content, see IsRedefinedEntity
- Standard_EXPORT Standard_Boolean IsErrorEntity (const Standard_Integer num) const;
-
- //! Returns True if <num> identifies an Entity which content is
- //! redefined through a ReportEntity (i.e. with literal data only)
- //! This happens when an entity is syntactically erroneous in the
- //! way that its basic content remains empty.
- //! For more details (such as content itself), see ReportEntity
- Standard_EXPORT Standard_Boolean IsRedefinedContent (const Standard_Integer num) const;
-
- //! Removes the ReportEntity attached to Entity <num>. Returns
- //! True if done, False if no ReportEntity was attached to <num>.
- //! Warning : the caller must assume that this clearing is meaningful
- Standard_EXPORT Standard_Boolean ClearReportEntity (const Standard_Integer num);
-
- //! Sets or Replaces a ReportEntity for the Entity <num>. Returns
- //! True if Report is replaced, False if it has been replaced
- //! Warning : the caller must assume that this setting is meaningful
- Standard_EXPORT Standard_Boolean SetReportEntity (const Standard_Integer num, const Handle(Interface_ReportEntity)& rep);
-
- //! Adds a ReportEntity as such. Returns False if the concerned
- //! entity is not recorded in the Model
- //! Else, adds it into, either the main report list or the
- //! list for semantic checks, then returns True
- Standard_EXPORT Standard_Boolean AddReportEntity (const Handle(Interface_ReportEntity)& rep, const Standard_Boolean semantic = Standard_False);
-
- //! Returns True if <num> identifies an Unknown Entity : in this
- //! case, a ReportEntity with no Check Messages designates it.
- Standard_EXPORT Standard_Boolean IsUnknownEntity (const Standard_Integer num) const;
-
- //! Fills the list of semantic checks.
- //! This list is computed (by CheckTool). Hence, it can be stored
- //! in the model for later queries
- //! <clear> True (D) : new list replaces
- //! <clear> False : new list is cumulated
- Standard_EXPORT void FillSemanticChecks (const Interface_CheckIterator& checks, const Standard_Boolean clear = Standard_True);
-
- //! Returns True if semantic checks have been filled
- Standard_EXPORT Standard_Boolean HasSemanticChecks() const;
-
- //! Returns the check attached to an entity, designated by its
- //! Number. 0 for global check
- //! <semantic> True : recorded semantic check
- //! <semantic> False : recorded syntactic check (see ReportEntity)
- //! If no check is recorded for <num>, returns an empty Check
- Standard_EXPORT const Handle(Interface_Check)& Check (const Standard_Integer num, const Standard_Boolean syntactic) const;
-
- //! Does a reservation for the List of Entities (for optimized
- //! storage management). If it is not called, storage management
- //! can be less efficient. <nbent> is the expected count of
- //! Entities to store
- Standard_EXPORT virtual void Reservate (const Standard_Integer nbent);
-
- //! Internal method for adding an Entity. Used by file reading
- //! (defined by each Interface) and Transfer tools. It adds the
- //! entity required to be added, not its refs : see AddWithRefs.
- //! If <anentity> is a ReportEntity, it is added to the list of
- //! Reports, its Concerned Entity (Erroneous or Corrected, else
- //! Unknown) is added to the list of Entities.
- //! That is, the ReportEntity must be created before Adding
- Standard_EXPORT virtual void AddEntity (const Handle(Standard_Transient)& anentity);
-
- //! Adds to the Model, an Entity with all its References, as they
- //! are defined by General Services FillShared and ListImplied.
- //! Process is recursive (any sub-levels) if <level> = 0 (Default)
- //! Else, adds sub-entities until the required sub-level.
- //! Especially, if <level> = 1, adds immediate subs and that's all
- //!
- //! If <listall> is False (Default), an entity (<anentity> itself
- //! or one of its subs at any level) which is already recorded in
- //! the Model is not analysed, only the newly added ones are.
- //! If <listall> is True, all items are analysed (this allows to
- //! ensure the consistency of an adding made by steps)
- Standard_EXPORT void AddWithRefs (const Handle(Standard_Transient)& anent, const Handle(Interface_Protocol)& proto, const Standard_Integer level = 0, const Standard_Boolean listall = Standard_False);
-
- //! Same as above, but works with the Protocol of the Model
- Standard_EXPORT void AddWithRefs (const Handle(Standard_Transient)& anent, const Standard_Integer level = 0, const Standard_Boolean listall = Standard_False);
-
- //! Same as above, but works with an already created GeneralLib
- Standard_EXPORT void AddWithRefs (const Handle(Standard_Transient)& anent, const Interface_GeneralLib& lib, const Standard_Integer level = 0, const Standard_Boolean listall = Standard_False);
-
- //! Replace Entity with Number=nument on other entity - "anent"
- Standard_EXPORT void ReplaceEntity (const Standard_Integer nument, const Handle(Standard_Transient)& anent);
-
- //! Reverses the Numbers of the Entities, between <after> and the
- //! total count of Entities. Thus, the entities :
- //! 1,2 ... after, after+1 ... nb-1, nb become numbered as :
- //! 1,2 ... after, nb, nb-1 ... after+1
- //! By default (after = 0) the whole list of Entities is reversed
- Standard_EXPORT void ReverseOrders (const Standard_Integer after = 0);
-
- //! Changes the Numbers of some Entities : <oldnum> is moved to
- //! <newnum>, same for <count> entities. Thus :
- //! 1,2 ... newnum-1 newnum ... oldnum .. oldnum+count oldnum+count+1 .. gives
- //! 1,2 ... newnum-1 oldnum .. oldnum+count newnum ... oldnum+count+1
- //! (can be seen as a circular permutation)
- Standard_EXPORT void ChangeOrder (const Standard_Integer oldnum, const Standard_Integer newnum, const Standard_Integer count = 1);
-
- //! Gets contents from an EntityIterator, prepared by a
- //! Transfer tool (e.g TransferCopy). Starts from clear
- Standard_EXPORT void GetFromTransfer (const Interface_EntityIterator& aniter);
-
- //! Gets header (data specific of a defined Interface) from
- //! another InterfaceModel; called from TransferCopy
- Standard_EXPORT virtual void GetFromAnother (const Handle(Interface_InterfaceModel)& other) = 0;
-
- //! Returns a New Empty Model, same type as <me> (whatever its
- //! Type); called to Copy parts a Model into other ones, then
- //! followed by a call to GetFromAnother (Header) then filling
- //! with specified Entities, themselves copied
- Standard_EXPORT virtual Handle(Interface_InterfaceModel) NewEmptyModel() const = 0;
-
- //! Records a category number for an entity number
- //! Returns True when done, False if <num> is out of range
- Standard_EXPORT Standard_Boolean SetCategoryNumber (const Standard_Integer num, const Standard_Integer val);
-
- //! Returns the recorded category number for a given entity number
- //! 0 if none was defined for this entity
- Standard_EXPORT Standard_Integer CategoryNumber (const Standard_Integer num) const;
-
- //! Allows an EntityIterator to get a list of Entities
- Standard_EXPORT void FillIterator (Interface_EntityIterator& iter) const;
-
- //! Returns the list of all Entities, as an Iterator on Entities
- //! (the Entities themselves, not the Reports)
- Standard_EXPORT Interface_EntityIterator Entities() const;
-
- //! Returns the list of all ReportEntities, i.e. data about
- //! Entities read with Error or Warning information
- //! (each item has to be casted to Report Entity then it can be
- //! queried for Concerned Entity, Content, Check ...)
- //! By default, returns the main reports, is <semantic> is True it
- //! returns the list for semantic checks
- Standard_EXPORT Interface_EntityIterator Reports (const Standard_Boolean semantic = Standard_False) const;
-
- //! Returns the list of ReportEntities which redefine data
- //! (generally, if concerned entity is "Error", a literal content
- //! is added to it : this is a "redefined entity"
- Standard_EXPORT Interface_EntityIterator Redefineds() const;
-
- //! Returns the GlobalCheck, which memorizes messages global to
- //! the file (not specific to an Entity), especially Header
- Standard_EXPORT const Handle(Interface_Check)& GlobalCheck (const Standard_Boolean syntactic = Standard_True) const;
-
- //! Allows to modify GlobalCheck, after getting then completing it
- //! Remark : it is SYNTACTIC check. Semantics, see FillChecks
- Standard_EXPORT void SetGlobalCheck (const Handle(Interface_Check)& ach);
-
- //! Minimum Semantic Global Check on data in model (header)
- //! Can only check basic Data. See also GlobalCheck from Protocol
- //! for a check which takes the Graph into account
- //! Default does nothing, can be redefined
- Standard_EXPORT virtual void VerifyCheck (Handle(Interface_Check)& ach) const;
-
- //! Dumps Header in a short, easy to read, form, onto a Stream
- //! <level> allows to print more or less parts of the header,
- //! if necessary. 0 for basic print
- Standard_EXPORT virtual void DumpHeader (Standard_OStream& S, const Standard_Integer level = 0) const = 0;
-
- //! Prints identification of a given entity in <me>, in order to
- //! be printed in a list or phrase
- //! <mode> < 0 : prints only its number
- //! <mode> = 1 : just calls PrintLabel
- //! <mode> = 0 (D) : prints its number plus '/' plus PrintLabel
- //! If <ent> == <me>, simply prints "Global"
- //! If <ent> is unknown, prints "??/its type"
- Standard_EXPORT void Print (const Handle(Standard_Transient)& ent, Standard_OStream& s, const Standard_Integer mode = 0) const;
-
- //! Prints label specific to each norm, for a given entity.
- //! Must only print label itself, in order to be included in a
- //! phrase. Can call the result of StringLabel, but not obliged.
- Standard_EXPORT virtual void PrintLabel (const Handle(Standard_Transient)& ent, Standard_OStream& S) const = 0;
-
- //! Prints label specific to each norm in log format, for
- //! a given entity.
- //! By default, just calls PrintLabel, can be redefined
- Standard_EXPORT virtual void PrintToLog (const Handle(Standard_Transient)& ent, Standard_OStream& S) const;
-
- //! Returns a string with the label attached to a given entity.
- //! Warning : While this string may be edited on the spot, if it is a read
- //! field, the returned value must be copied before.
- Standard_EXPORT virtual Handle(TCollection_HAsciiString) StringLabel (const Handle(Standard_Transient)& ent) const = 0;
-
- //! Searches a label which matches with one entity.
- //! Begins from <lastnum>+1 (default:1) and scans the entities
- //! until <NbEntities>. For the first which matches <label>,
- //! this method returns its Number. Returns 0 if nothing found
- //! Can be called recursively (labels are not specified as unique)
- //! <exact> : if True (default), exact match is required
- //! else, checks the END of entity label
- //!
- //! This method is virtual, hence it can be redefined for a more
- //! efficient search (if exact is true).
- Standard_EXPORT virtual Standard_Integer NextNumberForLabel (const Standard_CString label, const Standard_Integer lastnum = 0, const Standard_Boolean exact = Standard_True) const;
-
- //! Returns true if a template is attached to a given name
- Standard_EXPORT static Standard_Boolean HasTemplate (const Standard_CString name);
-
- //! Returns the template model attached to a name, or a Null Handle
- Standard_EXPORT static Handle(Interface_InterfaceModel) Template (const Standard_CString name);
-
- //! Records a new template model with a name. If the name was
- //! already recorded, the corresponding template is replaced by
- //! the new one. Then, WARNING : test HasTemplate to avoid
- //! surprises
- Standard_EXPORT static Standard_Boolean SetTemplate (const Standard_CString name, const Handle(Interface_InterfaceModel)& model);
-
- //! Returns the complete list of names attached to template models
- Standard_EXPORT static Handle(TColStd_HSequenceOfHAsciiString) ListTemplates();
-
-
-
- DEFINE_STANDARD_RTTIEXT(Interface_InterfaceModel,Standard_Transient)
-
-protected:
-
-
- //! Defines empty InterfaceModel, ready to be filled
- Standard_EXPORT Interface_InterfaceModel();
-
-
-
-private:
-
-
- TColStd_IndexedMapOfTransient theentities;
- TColStd_DataMapOfIntegerTransient thereports;
- TColStd_DataMapOfIntegerTransient therepch;
- Handle(Interface_Check) thecheckstx;
- Handle(Interface_Check) thechecksem;
- Standard_Boolean haschecksem;
- Standard_Boolean isdispatch;
- Handle(TCollection_HAsciiString) thecategory;
- Handle(Interface_GTool) thegtool;
-
-
-};
-
-
-
-
-
-
-
-#endif // _Interface_InterfaceModel_HeaderFile
//purpose :
//=======================================================================
STEPCAFControl_ExternFile::STEPCAFControl_ExternFile ()
- : myLoadStatus(IFSelect_RetVoid), myTransferStatus(Standard_False),
- myWriteStatus(IFSelect_RetVoid)
+ : myLoadStatus(XSControl_RetVoid), myTransferStatus(Standard_False),
+ myWriteStatus(XSControl_RetVoid)
{
}
#include <Standard.hxx>
-#include <IFSelect_ReturnStatus.hxx>
+#include <XSControl_ReturnStatus.hxx>
#include <Standard_Boolean.hxx>
#include <TDF_Label.hxx>
#include <Standard_Transient.hxx>
Handle(XSControl_WorkSession) GetWS() const;
- void SetLoadStatus (const IFSelect_ReturnStatus stat);
+ void SetLoadStatus (const XSControl_ReturnStatus stat);
- IFSelect_ReturnStatus GetLoadStatus() const;
+ XSControl_ReturnStatus GetLoadStatus() const;
void SetTransferStatus (const Standard_Boolean isok);
Standard_Boolean GetTransferStatus() const;
- void SetWriteStatus (const IFSelect_ReturnStatus stat);
+ void SetWriteStatus (const XSControl_ReturnStatus stat);
- IFSelect_ReturnStatus GetWriteStatus() const;
+ XSControl_ReturnStatus GetWriteStatus() const;
void SetName (const Handle(TCollection_HAsciiString)& name);
Handle(XSControl_WorkSession) myWS;
- IFSelect_ReturnStatus myLoadStatus;
+ XSControl_ReturnStatus myLoadStatus;
Standard_Boolean myTransferStatus;
- IFSelect_ReturnStatus myWriteStatus;
+ XSControl_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 XSControl_ReturnStatus stat)
{
myLoadStatus = stat;
}
//purpose :
//=======================================================================
-inline IFSelect_ReturnStatus STEPCAFControl_ExternFile::GetLoadStatus () const
+inline XSControl_ReturnStatus STEPCAFControl_ExternFile::GetLoadStatus () const
{
return myLoadStatus;
}
//purpose :
//=======================================================================
-inline void STEPCAFControl_ExternFile::SetWriteStatus (const IFSelect_ReturnStatus stat)
+inline void STEPCAFControl_ExternFile::SetWriteStatus (const XSControl_ReturnStatus stat)
{
myWriteStatus = stat;
}
//purpose :
//=======================================================================
-inline IFSelect_ReturnStatus STEPCAFControl_ExternFile::GetWriteStatus () const
+inline XSControl_ReturnStatus STEPCAFControl_ExternFile::GetWriteStatus () const
{
return myWriteStatus;
}
aReader.SetNameMode(aNode->InternalParameters.ReadName);
aReader.SetLayerMode(aNode->InternalParameters.ReadLayer);
aReader.SetPropsMode(aNode->InternalParameters.ReadProps);
- IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid;
+ XSControl_ReturnStatus aReadStat = XSControl_RetVoid;
if (!toUseLoaded)
{
aReadStat = aReader.ReadFile(thePath.ToCString());
}
else if (theWS->NbStartingEntities() > 0)
{
- aReadStat = IFSelect_RetDone;
+ aReadStat = XSControl_RetDone;
}
- if (aReadStat != IFSelect_RetDone)
+ if (aReadStat != XSControl_RetDone)
{
Message::SendFail() << "Error: STEPCAFControl_Provider : ["
<< aFile << "] : abandon, no model loaded";
aReader.SetNameMode(aNode->InternalParameters.ReadName);
aReader.SetLayerMode(aNode->InternalParameters.ReadLayer);
aReader.SetPropsMode(aNode->InternalParameters.ReadProps);
- IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid;
+ XSControl_ReturnStatus aReadStat = XSControl_RetVoid;
aReadStat = aReader.ReadStream(theName.ToCString(), theIStream);
- if (aReadStat != IFSelect_RetDone)
+ if (aReadStat != XSControl_RetDone)
{
Message::SendFail() << "Error: STEPCAFControl_Provider : "
<< "Abandon, no model loaded via stream";
Message::SendInfo() << "Document has been translated into the session";
return true;
}
- if (aWriter.Write(thePath.ToCString()) != IFSelect_RetDone)
+ if (aWriter.Write(thePath.ToCString()) != XSControl_RetDone)
{
Message::SendFail() << "Error: STEPCAFControl_Provider : [" <<
thePath << "] : Write failed";
resetStatic();
return false;
}
- if (aWriter.WriteStream(theOStream) != IFSelect_RetDone)
+ if (aWriter.WriteStream(theOStream) != XSControl_RetDone)
{
Message::SendFail() << "Error: STEPCAFControl_Provider : Write to stream failed";
resetStatic();
initStatic(aNode);
personizeWS(theWS);
STEPControl_Reader aReader(theWS);
- if (aReader.ReadFile(thePath.ToCString()) != IFSelect_RetDone)
+ if (aReader.ReadFile(thePath.ToCString()) != XSControl_RetDone)
{
Message::SendFail() << "Error: STEPCAFControl_Provider : ["
<< thePath << "] : abandon, no model loaded";
initStatic(aNode);
personizeWS(theWS);
STEPControl_Reader aReader(theWS);
- if (aReader.ReadStream(theName.ToCString(), theIStream) != IFSelect_RetDone)
+ if (aReader.ReadStream(theName.ToCString(), theIStream) != XSControl_RetDone)
{
Message::SendFail() << "Error: STEPCAFControl_Provider : "
<< "Abandon, no model loaded from STEP stream";
aModel->SetWriteLengthUnit(UnitsMethods::GetLengthUnitScale(
aNode->InternalParameters.WriteUnit,
UnitsMethods_LengthUnit_Millimeter));
- IFSelect_ReturnStatus aWritestat =
+ XSControl_ReturnStatus aWritestat =
aWriter.Transfer(theShape, aNode->InternalParameters.WriteModelType, true, theProgress);
if (aNbEntities > 0)
{
Message::SendTrace() << "STEPCAFControl_Provider : Model not empty before transferring";
}
- if (aWritestat != IFSelect_RetDone)
+ if (aWritestat != XSControl_RetDone)
{
Message::SendFail() << "Error: STEPCAFControl_Provider : "
<< "Can't translate shape to STEP model";
Message::SendInfo() << "Step model has been translated into the session";
return true;
}
- if (aWriter.Write(thePath.ToCString()) != IFSelect_RetDone)
+ if (aWriter.Write(thePath.ToCString()) != XSControl_RetDone)
{
Message::SendFail() << "Error: STEPCAFControl_Provider : "
<< "Can't write STEP file " << thePath;
aModel->SetWriteLengthUnit(UnitsMethods::GetLengthUnitScale(
aNode->InternalParameters.WriteUnit,
UnitsMethods_LengthUnit_Millimeter));
- IFSelect_ReturnStatus aWritestat =
+ XSControl_ReturnStatus aWritestat =
aWriter.Transfer(theShape, aNode->InternalParameters.WriteModelType, true, theProgress);
if (aNbEntities > 0)
{
Message::SendTrace() << "STEPCAFControl_Provider : Model not empty before transferring";
}
- if (aWritestat != IFSelect_RetDone)
+ if (aWritestat != XSControl_RetDone)
{
Message::SendFail() << "Error: STEPCAFControl_Provider : "
<< "Can't translate shape to STEP model";
resetStatic();
return false;
}
- if (aWriter.WriteStream(theOStream) != IFSelect_RetDone)
+ if (aWriter.WriteStream(theOStream) != XSControl_RetDone)
{
Message::SendFail() << "Error: STEPCAFControl_Provider : "
<< "Can't write STEP to stream";
//function : ReadFile
//purpose :
//=======================================================================
-IFSelect_ReturnStatus STEPCAFControl_Reader::ReadFile (const Standard_CString theFileName)
+XSControl_ReturnStatus STEPCAFControl_Reader::ReadFile (const Standard_CString theFileName)
{
return myReader.ReadFile (theFileName);
}
//function : ReadStream
//purpose :
//=======================================================================
-IFSelect_ReturnStatus STEPCAFControl_Reader::ReadStream (const Standard_CString theName,
+XSControl_ReturnStatus STEPCAFControl_Reader::ReadStream (const Standard_CString theName,
std::istream& theIStream)
{
return myReader.ReadStream (theName, theIStream);
const Handle(TDocStd_Document) &doc,
const Message_ProgressRange& theProgress)
{
- if (ReadFile (filename) != IFSelect_RetDone)
+ if (ReadFile (filename) != XSControl_RetDone)
{
return Standard_False;
}
const Handle(TDocStd_Document) &doc,
const Message_ProgressRange& theProgress)
{
- if ( ReadFile (filename.ToCString()) != IFSelect_RetDone)
+ if ( ReadFile (filename.ToCString()) != XSControl_RetDone)
{
return Standard_False;
}
EF->SetLoadStatus(sr.ReadFile(fullname));
// transfer in single-result mode
- if (EF->GetLoadStatus() == IFSelect_RetDone) {
+ if (EF->GetLoadStatus() == XSControl_RetDone) {
TDF_LabelSequence labels;
EF->SetTransferStatus (Transfer (sr, 0, doc, labels, Standard_False, theProgress));
if (labels.Length() > 0) EF->SetLabel (labels.Value(1));
#define _STEPCAFControl_Reader_HeaderFile
#include <STEPControl_Reader.hxx>
-#include <IFSelect_ReturnStatus.hxx>
+#include <XSControl_ReturnStatus.hxx>
#include <TDF_LabelSequence.hxx>
#include <TopTools_MapOfShape.hxx>
#include <STEPCAFControl_DataMapOfShapePD.hxx>
//! Provided for use like single-file reader.
//! @param theFileName [in] file to open
//! @return read status
- Standard_EXPORT IFSelect_ReturnStatus ReadFile (const Standard_CString theFileName);
+ Standard_EXPORT XSControl_ReturnStatus ReadFile (const Standard_CString theFileName);
//! Loads a file from stream and returns the read status.
//! @param theName [in] auxiliary stream name
//! @param theIStream [in] stream to read from
//! @return read status
- Standard_EXPORT IFSelect_ReturnStatus ReadStream (const Standard_CString theName,
+ Standard_EXPORT XSControl_ReturnStatus ReadStream (const Standard_CString theName,
std::istream& theIStream);
//! Returns number of roots recognized for transfer
//function : Write
//purpose :
//=======================================================================
-IFSelect_ReturnStatus STEPCAFControl_Writer::Write (const Standard_CString theFileName)
+XSControl_ReturnStatus STEPCAFControl_Writer::Write (const Standard_CString theFileName)
{
- IFSelect_ReturnStatus aStatus = myWriter.Write (theFileName);
- if (aStatus != IFSelect_RetDone)
+ XSControl_ReturnStatus aStatus = myWriter.Write (theFileName);
+ if (aStatus != XSControl_RetDone)
{
return aStatus;
}
anExtFileIter.More(); anExtFileIter.Next())
{
Handle(STEPCAFControl_ExternFile) anExtFile = anExtFileIter.Value();
- if (anExtFile->GetWriteStatus() != IFSelect_RetVoid)
+ if (anExtFile->GetWriteStatus() != XSControl_RetVoid)
{
continue;
}
std::cout << "Writing external file: " << aFileName << std::endl;
#endif
- const IFSelect_ReturnStatus anExtStatus = anExtFile->GetWS()->SendAll (aFileName.ToCString());
+ const XSControl_ReturnStatus anExtStatus = anExtFile->GetWS()->SendAll (aFileName.ToCString());
anExtFile->SetWriteStatus (anExtStatus);
- if (anExtStatus != IFSelect_RetDone)
+ if (anExtStatus != XSControl_RetDone)
{
aStatus = anExtStatus;
}
//function : WriteStream
//purpose :
//=======================================================================
-IFSelect_ReturnStatus STEPCAFControl_Writer::WriteStream (std::ostream& theStream)
+XSControl_ReturnStatus STEPCAFControl_Writer::WriteStream (std::ostream& theStream)
{
if (!myFiles.IsEmpty())
{
// writing external files is unsupported via stream interface
- return IFSelect_RetError;
+ return XSControl_RetError;
}
return myWriter.WriteStream (theStream);
const Message_ProgressRange& theProgress)
{
if (!Transfer(doc, STEPControl_AsIs, 0L, theProgress)) return Standard_False;
- return Write ( filename ) == IFSelect_RetDone;
+ return Write ( filename ) == XSControl_RetDone;
}
const Message_ProgressRange& theProgress)
{
if ( ! Transfer ( doc, STEPControl_AsIs, 0L, theProgress ) ) return Standard_False;
- return Write ( filename.ToCString() ) == IFSelect_RetDone;
+ return Write ( filename.ToCString() ) == XSControl_RetDone;
}
//! 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 theFileName);
+ Standard_EXPORT XSControl_ReturnStatus Write (const Standard_CString theFileName);
//! Writes all the produced models into the stream.
//! Provided for use like single-file writer
- Standard_EXPORT IFSelect_ReturnStatus WriteStream (std::ostream& theStream);
+ Standard_EXPORT XSControl_ReturnStatus WriteStream (std::ostream& theStream);
//! Transfers a document (or single label) to a STEP model
//! The mode of translation of shape is AsIs
#include <Standard_Handle.hxx>
#include <TColStd_SequenceOfTransient.hxx>
+#include <TColStd_SequenceOfInteger.hxx>
+
#include <STEPConstruct_Tool.hxx>
#include <Standard_Integer.hxx>
#include <Standard_CString.hxx>
// commercial license or contractual agreement.
-#include <APIHeaderSection_MakeHeader.hxx>
+#include <HeaderSection_MakeHeader.hxx>
#include <Interface_EntityIterator.hxx>
#include <Interface_Static.hxx>
#include <Quantity_Color.hxx>
// for AP203, add subschema name
if ( Interface_Static::IVal("write.step.schema") ==3 ) {
- APIHeaderSection_MakeHeader mkHdr ( Handle(StepData_StepModel)::DownCast ( Model() ) );
+ HeaderSection_MakeHeader mkHdr ( Handle(StepData_StepModel)::DownCast ( Model() ) );
Handle(TCollection_HAsciiString) subSchema =
new TCollection_HAsciiString ( "SHAPE_APPEARANCE_LAYER_MIM" );
mkHdr.AddSchemaIdentifier ( subSchema );
// commercial license or contractual agreement.
-#include <APIHeaderSection_MakeHeader.hxx>
+#include <HeaderSection_MakeHeader.hxx>
#include <gp_Pnt.hxx>
#include <Interface_EntityIterator.hxx>
#include <Interface_Macros.hxx>
// for AP203, add subschema name
if ( Interface_Static::IVal("write.step.schema") ==3 ) {
- APIHeaderSection_MakeHeader mkHdr ( Handle(StepData_StepModel)::DownCast ( Model() ) );
+ HeaderSection_MakeHeader mkHdr ( Handle(StepData_StepModel)::DownCast ( Model() ) );
Handle(TCollection_HAsciiString) subSchema =
new TCollection_HAsciiString ( "GEOMETRIC_VALIDATION_PROPERTIES_MIM" );
mkHdr.AddSchemaIdentifier ( subSchema );
//:j4 gka 16.03.99 S4134
// gka 05.04.99 S4136: parameters definitions changed
-#include <APIHeaderSection_EditHeader.hxx>
-#include <APIHeaderSection_MakeHeader.hxx>
-#include <IFSelect_EditForm.hxx>
-#include <IFSelect_SelectModelRoots.hxx>
-#include <IFSelect_SelectSignature.hxx>
-#include <IFSelect_SignAncestor.hxx>
-#include <IFSelect_SignCounter.hxx>
#include <Interface_Macros.hxx>
#include <Interface_Static.hxx>
#include <RWHeaderSection.hxx>
myAdaptorLibrary = swl;
myAdaptorProtocol = STEPEdit::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);
-
- //// --- SELECTIONS, SIGNATURES, COMPTEURS, EDITEURS
-
- //DeclareAndCast(IFSelect_Selection,xmr,SessionItem("xst-model-roots"));
- //if (!xmr.IsNull()) {
- // Handle(IFSelect_Signature) sty = STEPEdit::SignType();
- // AddSessionItem (sty,"step-type");
- // Handle(IFSelect_SignCounter) tys = new IFSelect_SignCounter(sty,Standard_False,Standard_True);
- // AddSessionItem (tys,"step-types");
-
- // //szv:mySignType = sty;
- //
- // //pdn S4133 18.02.99
- // AddSessionItem (new IFSelect_SignAncestor(),"xst-derived");
-
- // Handle(STEPSelections_SelectDerived) stdvar = new STEPSelections_SelectDerived();
- // stdvar->SetProtocol(STEPEdit::Protocol());
- // AddSessionItem (stdvar,"step-derived");
- //
- // Handle(IFSelect_SelectSignature) selsdr = STEPEdit::NewSelectSDR();
- // selsdr->SetInput (xmr);
- // AddSessionItem (selsdr,"step-shape-def-repr");
-
- // AddSessionItem (STEPEdit::NewSelectPlacedItem(),"step-placed-items");
- // // input deja pret avec ModelAll
- // AddSessionItem (STEPEdit::NewSelectShapeRepr(),"step-shape-repr");
- //}
- //
- ////pdn
- //Handle(STEPSelections_SelectFaces) stfaces = new STEPSelections_SelectFaces;
- //stfaces->SetInput (xmr);
- //AddSessionItem (stfaces,"step-faces");
- //
- //Handle(STEPSelections_SelectInstances) stinst = new STEPSelections_SelectInstances;
- //AddSessionItem (stinst,"step-instances");
- //
- //Handle(STEPSelections_SelectGSCurves) stcurves = new STEPSelections_SelectGSCurves;
- //stcurves->SetInput (xmr);
- //AddSessionItem (stcurves,"step-GS-curves");
- //
- //Handle(STEPSelections_SelectAssembly) assembly = new STEPSelections_SelectAssembly;
- //assembly->SetInput (xmr);
- //AddSessionItem (assembly,"step-assembly");
- //
- //Handle(APIHeaderSection_EditHeader) edhead = new APIHeaderSection_EditHeader;
- //Handle(IFSelect_EditForm) edheadf = new IFSelect_EditForm (edhead,Standard_False,Standard_True,"Step Header");
- //AddSessionItem (edhead,"step-header-edit");
- //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");
- //AddSessionItem (edctx,"step-context-edit");
- //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)");
- //AddSessionItem (edsdr,"step-SDR-edit");
- //AddSessionItem (edsdrf,"step-SDR-data");
}
Handle(Interface_InterfaceModel) STEPControl_Controller::NewModel () const
// #### PROVISOIRE ??? ####
-IFSelect_ReturnStatus STEPControl_Controller::TransferWriteShape
+XSControl_ReturnStatus STEPControl_Controller::TransferWriteShape
(const TopoDS_Shape& shape,
const Handle(Transfer_FinderProcess)& FP,
const Handle(Interface_InterfaceModel)& model,
const Standard_Integer modeshape,
const Message_ProgressRange& theProgress) const
{
- if (modeshape < 0 || modeshape > 4) return IFSelect_RetError;
+ if (modeshape < 0 || modeshape > 4) return XSControl_RetError;
Handle(STEPControl_ActorWrite) ActWrite =
Handle(STEPControl_ActorWrite)::DownCast(myAdaptorWrite);
// A PRESENT ON PASSE PAR LE PROFILE
}
return Standard_True;
}
-//=======================================================================
-//function : Customise
-//purpose :
-//=======================================================================
-
-void STEPControl_Controller::Customise(Handle(XSControl_WorkSession)& WS)
-{
- XSControl_Controller::Customise(WS);
-
- // Handle(IFSelect_SelectModelRoots) slr;
- // Handle(Standard_Transient) slr1 = WS->NamedItem("xst-model-roots");
- // if(!slr1.IsNull())
- // slr = Handle(IFSelect_SelectModelRoots)::DownCast(slr1);
- // else {
- // slr = new IFSelect_SelectModelRoots;
- // WS->AddNamedItem ("xst-model-roots",slr);
- // }
-
- // Handle(STEPSelections_SelectForTransfer) st1= new STEPSelections_SelectForTransfer;
- // st1->SetReader (WS->TransferReader());
- // WS->AddNamedItem ("xst-transferrable-roots",st1);
-
- // if (!slr.IsNull()) {
- // Handle(IFSelect_Signature) sty = STEPEdit::SignType();
- // WS->AddNamedItem ("step-type",sty);
- //
- // Handle(IFSelect_SignCounter) tys = new IFSelect_SignCounter(sty,Standard_False,Standard_True);
- // WS->AddNamedItem ("step-types",tys);
-
- ////szv:mySignType = sty;
- // WS->SetSignType( sty );
- //
- // //pdn S4133 18.02.99
- // WS->AddNamedItem ("xst-derived",new IFSelect_SignAncestor());
- // Handle(STEPSelections_SelectDerived) stdvar = new STEPSelections_SelectDerived();
- // stdvar->SetProtocol(STEPEdit::Protocol());
- // WS->AddNamedItem ("step-derived",stdvar);
- //
- // Handle(IFSelect_SelectSignature) selsdr = STEPEdit::NewSelectSDR();
- // selsdr->SetInput (slr);
- // WS->AddNamedItem ("step-shape-def-repr",selsdr);
- // Handle(IFSelect_SelectSignature) selrrs = STEPEdit::NewSelectPlacedItem();
- // WS->AddNamedItem ("step-placed-items",selrrs);
- // Handle(IFSelect_SelectSignature) selsr = STEPEdit::NewSelectShapeRepr();
- // // input deja pret avec ModelAll
- // WS->AddNamedItem ("step-shape-repr",selsr);
- // }
- //
- // //pdn
- // Handle(STEPSelections_SelectFaces) stfaces = new STEPSelections_SelectFaces;
- // stfaces->SetInput (slr);
- // WS->AddNamedItem ("step-faces",stfaces);
- //
- // Handle(STEPSelections_SelectInstances) stinst = new STEPSelections_SelectInstances;
- // WS->AddNamedItem ("step-instances",stinst);
- //
- // Handle(STEPSelections_SelectGSCurves) stcurves = new STEPSelections_SelectGSCurves;
- // stcurves->SetInput (slr);
- // WS->AddNamedItem ("step-GS-curves",stcurves);
- //
- // Handle(STEPSelections_SelectAssembly) assembly = new STEPSelections_SelectAssembly;
- // assembly->SetInput (slr);
- // WS->AddNamedItem ("step-assembly",assembly);
- //
- // Handle(APIHeaderSection_EditHeader) edhead = new APIHeaderSection_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);
-
- //
- //
-}
#include <Standard_Type.hxx>
#include <XSControl_Controller.hxx>
-#include <IFSelect_ReturnStatus.hxx>
+#include <XSControl_ReturnStatus.hxx>
#include <Standard_Integer.hxx>
class Interface_InterfaceModel;
class XSControl_WorkSession;
//! It is taken from STEP Template Model
Standard_EXPORT Handle(Interface_InterfaceModel) NewModel() const Standard_OVERRIDE;
- Standard_EXPORT virtual void Customise (Handle(XSControl_WorkSession)& WS) 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
+ Standard_EXPORT virtual XSControl_ReturnStatus TransferWriteShape
(const TopoDS_Shape& shape,
const Handle(Transfer_FinderProcess)& FP,
const Handle(Interface_InterfaceModel)& model,
// 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 <Interface_Static.hxx>
#include <StepBasic_ApplicationContext.hxx>
#include <StepBasic_ConversionBasedUnit.hxx>
#include <StepBasic_DocumentProductEquivalence.hxx>
STEPControl_Reader::STEPControl_Reader ()
{
STEPControl_Controller::Init();
- 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");
}
//=======================================================================
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
-#include <XSControl_Reader.hxx>
#include <Standard_Integer.hxx>
#include <TColStd_SequenceOfAsciiString.hxx>
#include <TColStd_Array1OfAsciiString.hxx>
#include <TColStd_Array1OfReal.hxx>
+#include <TopTools_SequenceOfShape.hxx>
+#include <Message_ProgressRange.hxx>
+#include <DE_ReturnStatus.hxx>
+
class XSControl_WorkSession;
class StepData_StepModel;
class StepRepr_RepresentationContext;
//! WS = reader.WS();
//! if ( WS->TransferReader()->HasResult(ent) )
//! TopoDS_Shape shape = WS->TransferReader()->ShapeResult(ent);
-class STEPControl_Reader : public XSControl_Reader
+class STEPControl_Reader : public Standard_Transient
{
-public:
-
DEFINE_STANDARD_ALLOC
+public:
-
//! Creates a reader object with an empty STEP model.
Standard_EXPORT STEPControl_Reader();
-
+
//! Creates a Reader for STEP from an already existing Session
//! Clears the session if it was not yet set for STEP
Standard_EXPORT STEPControl_Reader(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
-
+
//! Returns the model as a StepModel.
//! It can then be consulted (header, product)
Standard_EXPORT Handle(StepData_StepModel) StepModel() const;
-
+
//! Transfers a root given its rank in the list of candidate roots
//! Default is the first one
//! Returns True if a shape has resulted, false else
//! Same as inherited TransferOneRoot, kept for compatibility
- Standard_EXPORT Standard_Boolean TransferRoot (const Standard_Integer num = 1,
- const Message_ProgressRange& theProgress = Message_ProgressRange());
-
+ Standard_EXPORT Standard_Boolean TransferRoot(const Standard_Integer num = 1,
+ const Message_ProgressRange& theProgress = Message_ProgressRange());
+
//! Determines the list of root entities from Model which are candidate for
//! a transfer to a Shape (type of entities is PRODUCT)
- Standard_EXPORT virtual Standard_Integer NbRootsForTransfer() Standard_OVERRIDE;
-
+ Standard_EXPORT virtual Standard_Integer NbRootsForTransfer();
+
//! Returns sequence of all unit names for shape representations
//! found in file
- Standard_EXPORT void FileUnits (TColStd_SequenceOfAsciiString& theUnitLengthNames, TColStd_SequenceOfAsciiString& theUnitAngleNames, TColStd_SequenceOfAsciiString& theUnitSolidAngleNames);
+ Standard_EXPORT void FileUnits(TColStd_SequenceOfAsciiString& theUnitLengthNames, TColStd_SequenceOfAsciiString& theUnitAngleNames, TColStd_SequenceOfAsciiString& theUnitSolidAngleNames);
//! Sets system length unit used by transfer process
Standard_EXPORT void SetSystemLengthUnit(const Standard_Real theLengthUnit);
//! Returns system length unit used by transfer process
Standard_EXPORT Standard_Real SystemLengthUnit() const;
+ //! Loads a file and returns the read status
+//! Zero for a Model which compies with the Controller
+ Standard_EXPORT XSControl_ReturnStatus ReadFile(const Standard_CString filename);
+
+ //! Loads a file from stream and returns the read status
+ Standard_EXPORT XSControl_ReturnStatus ReadStream(const Standard_CString theName, std::istream& theIStream);
+
+ //! Determines the list of root entities which are candidate for
+//! a transfer to a Shape, and returns the number
+//! of entities in the list
+ Standard_EXPORT virtual Standard_Integer NbRootsForTransfer();
+
+ //! Returns an IGES or STEP root
+ //! entity for translation. The entity is identified by its
+ //! rank in a list.
+ Standard_EXPORT Handle(Standard_Transient) RootForTransfer(const Standard_Integer num = 1);
+
+ //! Translates a root identified by the rank num in the model.
+ //! false is returned if no shape is produced.
+ Standard_EXPORT Standard_Boolean TransferOneRoot(const Standard_Integer num = 1,
+ const Message_ProgressRange& theProgress = Message_ProgressRange());
+
+ //! 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,
+ const Message_ProgressRange& theProgress = Message_ProgressRange());
+
+ //! Translates an IGES or STEP
+ //! entity in the model. true is returned if a shape is
+ //! produced; otherwise, false is returned.
+ Standard_EXPORT Standard_Boolean TransferEntity(const Handle(Standard_Transient)& start,
+ const Message_ProgressRange& theProgress = Message_ProgressRange());
+
+ //! Translates a list of entities.
+ //! Returns the number of IGES or STEP entities that were
+ //! successfully translated. The list can be produced with GiveList.
+ //! Warning - This function does not clear the existing output shapes.
+ Standard_EXPORT Standard_Integer TransferList(const Handle(TColStd_HSequenceOfTransient)& list,
+ const Message_ProgressRange& theProgress = Message_ProgressRange());
protected:
-
-
-
-
-private:
-
-
//! Returns units for length , angle and solidangle for shape representations
- Standard_EXPORT Standard_Boolean findUnits (const Handle(StepRepr_RepresentationContext)& theReprContext, TColStd_Array1OfAsciiString& theNameUnits, TColStd_Array1OfReal& theFactorUnits);
+ Standard_EXPORT Standard_Boolean findUnits(const Handle(StepRepr_RepresentationContext)& theReprContext, TColStd_Array1OfAsciiString& theNameUnits, TColStd_Array1OfReal& theFactorUnits);
+ //! Returns a sequence of produced shapes
+ Standard_EXPORT TopTools_SequenceOfShape& Shapes();
+private:
+ Standard_Boolean therootsta;
+ TColStd_SequenceOfTransient theroots;
+ Handle(XSControl_WorkSession) thesession;
+ TopTools_SequenceOfShape theshapes;
};
-
-
-
-
-
-
#endif // _STEPControl_Reader_HeaderFile
//purpose :
//=======================================================================
-IFSelect_ReturnStatus STEPControl_Writer::Transfer
+XSControl_ReturnStatus STEPControl_Writer::Transfer
(const TopoDS_Shape& sh,
const STEPControl_StepModelType mode,
const Standard_Boolean compgraph,
case STEPControl_GeometricCurveSet : mws = 4; break;
default : break;
}
- if (mws < 0) return IFSelect_RetError; // cas non reconnu
+ if (mws < 0) return XSControl_RetError; // cas non reconnu
thesession->TransferWriter()->SetTransferMode (mws);
if (!Model()->IsInitializedUnit())
{
//function : Write
//purpose :
//=======================================================================
-IFSelect_ReturnStatus STEPControl_Writer::Write (const Standard_CString theFileName)
+XSControl_ReturnStatus STEPControl_Writer::Write (const Standard_CString theFileName)
{
return thesession->SendAll (theFileName);
}
//function : WriteStream
//purpose :
//=======================================================================
-IFSelect_ReturnStatus STEPControl_Writer::WriteStream (std::ostream& theOStream)
+XSControl_ReturnStatus STEPControl_Writer::WriteStream (std::ostream& theOStream)
{
Handle(StepData_StepModel) aModel = Model();
if (aModel.IsNull())
{
- return IFSelect_RetFail;
+ return XSControl_RetFail;
}
Handle(StepData_Protocol) aProtocol = Handle(StepData_Protocol)::DownCast (aModel->Protocol());
if (aProtocol.IsNull())
{
- return IFSelect_RetFail;
+ return XSControl_RetFail;
}
StepData_StepWriter aWriter (aModel);
aWriter.SendModel (aProtocol);
return aWriter.Print (theOStream)
- ? IFSelect_RetDone
- : IFSelect_RetFail;
+ ? XSControl_RetDone
+ : XSControl_RetFail;
}
//=======================================================================
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
-#include <IFSelect_ReturnStatus.hxx>
+#include <XSControl_ReturnStatus.hxx>
#include <STEPControl_StepModelType.hxx>
#include <Standard_Integer.hxx>
#include <Message_ProgressRange.hxx>
//! shell_based_surface_model entity.
//! - STEPControlStd_GeometricCurveSet translates a shape into a STEP
//! geometric_curve_set entity.
- Standard_EXPORT IFSelect_ReturnStatus Transfer
+ Standard_EXPORT XSControl_ReturnStatus Transfer
(const TopoDS_Shape& sh,
const STEPControl_StepModelType mode,
const Standard_Boolean compgraph = Standard_True,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Writes a STEP model in the file identified by filename.
- Standard_EXPORT IFSelect_ReturnStatus Write (const Standard_CString theFileName);
+ Standard_EXPORT XSControl_ReturnStatus Write (const Standard_CString theFileName);
//! Writes a STEP model in the std::ostream.
- Standard_EXPORT IFSelect_ReturnStatus WriteStream (std::ostream& theOStream);
+ Standard_EXPORT XSControl_ReturnStatus WriteStream (std::ostream& theOStream);
//! Displays the statistics for the
//! last translation. what defines the kind of statistics that are displayed:
#include <STEPEdit.hxx>
-#include <APIHeaderSection_MakeHeader.hxx>
+#include <HeaderSection_MakeHeader.hxx>
#include <IFSelect_SelectModelEntities.hxx>
#include <IFSelect_SelectModelRoots.hxx>
#include <IFSelect_SelectSignature.hxx>
Handle(StepData_StepModel) STEPEdit::NewModel ()
{
- APIHeaderSection_MakeHeader head;
+ HeaderSection_MakeHeader head;
return head.NewModel(STEPEdit::Protocol());
}
+++ /dev/null
-STEPSelections_AssemblyComponent.cxx
-STEPSelections_AssemblyComponent.hxx
-STEPSelections_AssemblyComponent.lxx
-STEPSelections_AssemblyExplorer.cxx
-STEPSelections_AssemblyExplorer.hxx
-STEPSelections_AssemblyExplorer.lxx
-STEPSelections_AssemblyLink.cxx
-STEPSelections_AssemblyLink.hxx
-STEPSelections_AssemblyLink.lxx
-STEPSelections_Counter.cxx
-STEPSelections_Counter.hxx
-STEPSelections_Counter.lxx
-STEPSelections_HSequenceOfAssemblyLink.hxx
-STEPSelections_SelectAssembly.cxx
-STEPSelections_SelectAssembly.hxx
-STEPSelections_SelectDerived.cxx
-STEPSelections_SelectDerived.hxx
-STEPSelections_SelectFaces.cxx
-STEPSelections_SelectFaces.hxx
-STEPSelections_SelectForTransfer.cxx
-STEPSelections_SelectForTransfer.hxx
-STEPSelections_SelectGSCurves.cxx
-STEPSelections_SelectGSCurves.hxx
-STEPSelections_SelectInstances.cxx
-STEPSelections_SelectInstances.hxx
-STEPSelections_SequenceOfAssemblyComponent.hxx
-STEPSelections_SequenceOfAssemblyLink.hxx
+++ /dev/null
-// Created on: 1999-03-24
-// Created by: data exchange team
-// Copyright (c) 1999-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 <STEPSelections_AssemblyComponent.hxx>
-#include <StepShape_ShapeDefinitionRepresentation.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(STEPSelections_AssemblyComponent,Standard_Transient)
-
-STEPSelections_AssemblyComponent::STEPSelections_AssemblyComponent()
-{
-}
-
-STEPSelections_AssemblyComponent::STEPSelections_AssemblyComponent(const Handle(StepShape_ShapeDefinitionRepresentation)& sdr,
- const Handle(STEPSelections_HSequenceOfAssemblyLink)& list)
-{
- mySDR = sdr;
- myList = list;
-}
+++ /dev/null
-// Created on: 1999-03-24
-// Created by: data exchange team
-// 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 _STEPSelections_AssemblyComponent_HeaderFile
-#define _STEPSelections_AssemblyComponent_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <STEPSelections_HSequenceOfAssemblyLink.hxx>
-#include <Standard_Transient.hxx>
-class StepShape_ShapeDefinitionRepresentation;
-
-
-class STEPSelections_AssemblyComponent;
-DEFINE_STANDARD_HANDLE(STEPSelections_AssemblyComponent, Standard_Transient)
-
-
-class STEPSelections_AssemblyComponent : public Standard_Transient
-{
-
-public:
-
-
- Standard_EXPORT STEPSelections_AssemblyComponent();
-
- Standard_EXPORT STEPSelections_AssemblyComponent(const Handle(StepShape_ShapeDefinitionRepresentation)& sdr, const Handle(STEPSelections_HSequenceOfAssemblyLink)& list);
-
- Handle(StepShape_ShapeDefinitionRepresentation) GetSDR() const;
-
- Handle(STEPSelections_HSequenceOfAssemblyLink) GetList() const;
-
- void SetSDR (const Handle(StepShape_ShapeDefinitionRepresentation)& sdr);
-
- void SetList (const Handle(STEPSelections_HSequenceOfAssemblyLink)& list);
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(STEPSelections_AssemblyComponent,Standard_Transient)
-
-protected:
-
-
-
-
-private:
-
-
- Handle(StepShape_ShapeDefinitionRepresentation) mySDR;
- Handle(STEPSelections_HSequenceOfAssemblyLink) myList;
-
-
-};
-
-
-#include <STEPSelections_AssemblyComponent.lxx>
-
-
-
-
-
-#endif // _STEPSelections_AssemblyComponent_HeaderFile
+++ /dev/null
-// Created on: 1999-03-24
-// Created by: data exchange team
-// Copyright (c) 1999-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.
-
-//=======================================================================
-//function : GetSDR
-//purpose :
-//=======================================================================
-
-inline Handle(StepShape_ShapeDefinitionRepresentation) STEPSelections_AssemblyComponent::GetSDR() const
-{
- return mySDR;
-}
-
-//=======================================================================
-//function : GetList
-//purpose :
-//=======================================================================
-
-inline Handle(STEPSelections_HSequenceOfAssemblyLink) STEPSelections_AssemblyComponent::GetList() const
-{
- return myList;
-}
-
-//=======================================================================
-//function : SetSDR
-//purpose :
-//=======================================================================
-
-inline void STEPSelections_AssemblyComponent::SetSDR(const Handle(StepShape_ShapeDefinitionRepresentation)& sdr)
-{
- mySDR = sdr;
-}
-
-inline void STEPSelections_AssemblyComponent::SetList(const Handle(STEPSelections_HSequenceOfAssemblyLink)& list)
-{
- myList = list;
-}
+++ /dev/null
-// Created on: 1999-03-24
-// Created by: data exchange team
-// Copyright (c) 1999-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 <Interface_EntityIterator.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <StepBasic_Product.hxx>
-#include <StepBasic_ProductDefinition.hxx>
-#include <StepBasic_ProductDefinitionFormation.hxx>
-#include <StepRepr_MappedItem.hxx>
-#include <StepRepr_NextAssemblyUsageOccurrence.hxx>
-#include <StepRepr_ProductDefinitionShape.hxx>
-#include <StepRepr_PropertyDefinition.hxx>
-#include <STEPSelections_AssemblyExplorer.hxx>
-#include <STEPSelections_AssemblyLink.hxx>
-#include <STEPSelections_HSequenceOfAssemblyLink.hxx>
-#include <StepShape_ContextDependentShapeRepresentation.hxx>
-#include <StepShape_ShapeDefinitionRepresentation.hxx>
-#include <StepShape_ShapeRepresentation.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-STEPSelections_AssemblyExplorer::STEPSelections_AssemblyExplorer(const Interface_Graph &G):myGraph(G)
-{
- Init(G);
-}
-
-Handle(Standard_Transient) STEPSelections_AssemblyExplorer::
- FindItemWithNAUO(const Handle(StepRepr_NextAssemblyUsageOccurrence)& nauo) const
-{
- Handle(Standard_Transient) item;
- Handle(StepRepr_ProductDefinitionShape) pds;
- Interface_EntityIterator subs = myGraph.Sharings(nauo);
- for(subs.Start(); subs.More()&&pds.IsNull(); subs.Next())
- if(subs.Value()->IsKind(STANDARD_TYPE(StepRepr_ProductDefinitionShape)))
- pds = Handle(StepRepr_ProductDefinitionShape)::DownCast(subs.Value());
- if(pds.IsNull()) return item;
-
- subs = myGraph.Sharings(pds);
- Handle(StepShape_ContextDependentShapeRepresentation) cdsr;
- Handle(StepShape_ShapeDefinitionRepresentation) shdefrep;
- Handle(Standard_Transient) itmp;
- for(subs.Start(); subs.More()&&shdefrep.IsNull(); subs.Next()) {
- itmp = subs.Value();
- if(itmp->IsKind(STANDARD_TYPE(StepShape_ContextDependentShapeRepresentation)))
- return itmp;
- if(itmp->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation)))
- shdefrep = Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(itmp);
- }
- if(shdefrep.IsNull()) return shdefrep ;
- Handle(StepShape_ShapeRepresentation) srep = Handle(StepShape_ShapeRepresentation)::DownCast(shdefrep->UsedRepresentation());
- if(srep.IsNull()) return srep;
- for(Standard_Integer i = 1; i <= srep->NbItems(); i++) {
- Handle(StepRepr_RepresentationItem) repitem = srep->ItemsValue(i);
- if(repitem->IsKind(STANDARD_TYPE(StepRepr_MappedItem)))
- return repitem;
- }
- return item;
-}
-
-Handle(StepShape_ShapeDefinitionRepresentation) STEPSelections_AssemblyExplorer::
- FindSDRWithProduct(const Handle(StepBasic_ProductDefinition)& product) const
-{
- Interface_EntityIterator subs = myGraph.Sharings(product);
- for(subs.Start(); subs.More(); subs.Next())
- if(subs.Value()->IsKind(STANDARD_TYPE(StepRepr_PropertyDefinition))) {
- Interface_EntityIterator subs1 = myGraph.Sharings(subs.Value());
- for(subs1.Start(); subs1.More(); subs1.Next())
- if(subs1.Value()->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation))) {
- DeclareAndCast(StepShape_ShapeDefinitionRepresentation,SDR,subs1.Value());
- return SDR;
- }
- }
- Handle(StepShape_ShapeDefinitionRepresentation) sdr;
- return sdr;
-}
-
-void STEPSelections_AssemblyExplorer::FillListWithGraph(const Handle(STEPSelections_AssemblyComponent)& cmp)
-{
- Handle(StepShape_ShapeDefinitionRepresentation) SDR = cmp->GetSDR();
- Handle(STEPSelections_HSequenceOfAssemblyLink) list = cmp->GetList();
- Handle(StepRepr_ProductDefinitionShape) pdsh =
- Handle(StepRepr_ProductDefinitionShape)::DownCast ( SDR->Definition().PropertyDefinition() );
- if(pdsh.IsNull()) return;
- Handle(StepBasic_ProductDefinition) pdf = pdsh->Definition().ProductDefinition();
- if(pdf.IsNull()) return;
- Interface_EntityIterator subs = myGraph.Sharings(pdf);
- for(subs.Start(); subs.More(); subs.Next())
- if(subs.Value()->IsKind(STANDARD_TYPE(StepRepr_NextAssemblyUsageOccurrence))) {
- DeclareAndCast(StepRepr_NextAssemblyUsageOccurrence,nauo,subs.Value());
- if(pdf==nauo->RelatingProductDefinition()) {
- Handle(STEPSelections_AssemblyLink) link = new STEPSelections_AssemblyLink;
- link->SetNAUO(nauo);
- link->SetItem(FindItemWithNAUO(nauo));
- Handle(StepBasic_ProductDefinition) pdrComponent = nauo->RelatedProductDefinition();
- if(pdrComponent.IsNull()) continue;
- Handle(StepShape_ShapeDefinitionRepresentation) subSDR = FindSDRWithProduct(pdrComponent);
- if(subSDR.IsNull()) continue;
- Standard_Integer index = myMap.FindIndex(subSDR);
- if(index)
- link->SetComponent(Handle(STEPSelections_AssemblyComponent)::DownCast(myMap.FindFromIndex(index)));
- else {
- Handle(STEPSelections_HSequenceOfAssemblyLink) sublist = new STEPSelections_HSequenceOfAssemblyLink;
- Handle(STEPSelections_AssemblyComponent) subCmp = new STEPSelections_AssemblyComponent(subSDR,sublist);
- FillListWithGraph(subCmp);
- link->SetComponent(subCmp);
- myMap.Add(subSDR,subCmp);
- }
- list->Append(link);
- }
- }
-}
-
-
-void STEPSelections_AssemblyExplorer::Init(const Interface_Graph &G)
-{
- myGraph = G;
- myRoots.Clear();
- myMap.Clear();
- Interface_EntityIterator roots = myGraph.RootEntities();
- for(roots.Start(); roots.More(); roots.Next())
- if(roots.Value()->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation))) {
- Handle(STEPSelections_AssemblyComponent) cmp = new STEPSelections_AssemblyComponent;
- cmp->SetSDR(Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(roots.Value()));
- cmp->SetList(new STEPSelections_HSequenceOfAssemblyLink);
- FillListWithGraph(cmp);
- myRoots.Append(cmp);
- }
-}
-
-
-static Standard_CString GetProductName(const Handle(StepShape_ShapeDefinitionRepresentation) &SDR)
-{
- Standard_CString str = "";
- Handle(StepBasic_Product) empty;
- Handle(StepRepr_PropertyDefinition) PropDf = SDR->Definition().PropertyDefinition();
- if ( PropDf.IsNull() ) return str;
- Handle(StepBasic_ProductDefinition) PD = PropDf->Definition().ProductDefinition();
- if ( PD.IsNull() ) return str;
- Handle(StepBasic_ProductDefinitionFormation) PDF = PD->Formation();
- if ( PDF.IsNull() ) return str;
- return PDF->OfProduct()->Name()->ToCString();
-}
-
-static void PrintSubAssembly(Standard_OStream &os,
- const Handle(STEPSelections_AssemblyComponent)& cmp,
- const Handle(Interface_InterfaceModel) &Model,
- Standard_Integer level)
-{
- //for ( Standard_Integer j=0; j < level; j++ ) os << "\t";
- os << "SDR: " <<Model->StringLabel(cmp->GetSDR())->ToCString()<<"\t";
-
- os << "Product: "<<GetProductName(cmp->GetSDR())<<std::endl;
- for ( Standard_Integer i = 1; i <= cmp->GetList()->Length(); i++) {
- for ( Standard_Integer j=0; j < level+1; j++ ) os << "\t";
- os << "NAUO :"<<Model->StringLabel(cmp->GetList()->Value(i)->GetNAUO())->ToCString()<<";\t";
- if(cmp->GetList()->Value(i)->GetItem()->IsKind(STANDARD_TYPE(StepRepr_MappedItem)))
- os <<"MI ";
- else
- if(cmp->GetList()->Value(i)->GetItem()->IsKind(STANDARD_TYPE(StepShape_ContextDependentShapeRepresentation)))
- os <<"CDSR ";
- else
- os <<"UNKNOWN LINK!!!";
- PrintSubAssembly(os,cmp->GetList()->Value(i)->GetComponent(),Model,level+1);
- }
-}
-
-
-void STEPSelections_AssemblyExplorer::Dump(Standard_OStream &os) const
-{
- Handle(Interface_InterfaceModel) model = myGraph.Model();
- for(Standard_Integer i = 1 ; i <=myRoots.Length(); i++) {
- os<<"Assembly N: "<<i<<std::endl<<std::endl;
- PrintSubAssembly(os,myRoots.Value(i),model,0);
- }
-}
+++ /dev/null
-// Created on: 1999-03-24
-// Created by: data exchange team
-// 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 _STEPSelections_AssemblyExplorer_HeaderFile
-#define _STEPSelections_AssemblyExplorer_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <STEPSelections_SequenceOfAssemblyComponent.hxx>
-#include <Interface_Graph.hxx>
-#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
-#include <Standard_OStream.hxx>
-#include <Standard_Integer.hxx>
-class StepShape_ShapeDefinitionRepresentation;
-class StepBasic_ProductDefinition;
-class STEPSelections_AssemblyComponent;
-class Standard_Transient;
-class StepRepr_NextAssemblyUsageOccurrence;
-
-
-
-class STEPSelections_AssemblyExplorer
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- Standard_EXPORT STEPSelections_AssemblyExplorer(const Interface_Graph& G);
-
- Standard_EXPORT void Init (const Interface_Graph& G);
-
- Standard_EXPORT void Dump (Standard_OStream& os) const;
-
- Standard_EXPORT Handle(StepShape_ShapeDefinitionRepresentation) FindSDRWithProduct (const Handle(StepBasic_ProductDefinition)& product) const;
-
- Standard_EXPORT void FillListWithGraph (const Handle(STEPSelections_AssemblyComponent)& cmp);
-
- Standard_EXPORT Handle(Standard_Transient) FindItemWithNAUO (const Handle(StepRepr_NextAssemblyUsageOccurrence)& nauo) const;
-
- //! Returns the number of root assemblies;
- Standard_Integer NbAssemblies() const;
-
- //! Returns root of assenbly by its rank;
- Handle(STEPSelections_AssemblyComponent) Root (const Standard_Integer rank = 1) const;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
- STEPSelections_SequenceOfAssemblyComponent myRoots;
- Interface_Graph myGraph;
- TColStd_IndexedDataMapOfTransientTransient myMap;
-
-
-};
-
-
-#include <STEPSelections_AssemblyExplorer.lxx>
-
-
-
-
-
-#endif // _STEPSelections_AssemblyExplorer_HeaderFile
+++ /dev/null
-// Created on: 1999-03-26
-// Created by: data exchange team
-// Copyright (c) 1999-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.
-
-//=======================================================================
-//function : NbAssemblies
-//purpose :
-//=======================================================================
-
-inline Standard_Integer STEPSelections_AssemblyExplorer::NbAssemblies() const
-{
- return myRoots.Length();
-}
-
-//=======================================================================
-//function : Root
-//purpose :
-//=======================================================================
-
-inline Handle(STEPSelections_AssemblyComponent) STEPSelections_AssemblyExplorer::Root(const Standard_Integer rank) const
-{
- return myRoots.Value(rank);
-}
+++ /dev/null
-// Created on: 1999-03-24
-// Created by: data exchange team
-// Copyright (c) 1999-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 <Standard_Transient.hxx>
-#include <StepRepr_NextAssemblyUsageOccurrence.hxx>
-#include <STEPSelections_AssemblyComponent.hxx>
-#include <STEPSelections_AssemblyLink.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(STEPSelections_AssemblyLink,Standard_Transient)
-
-STEPSelections_AssemblyLink::STEPSelections_AssemblyLink()
-{
-}
-
-STEPSelections_AssemblyLink::STEPSelections_AssemblyLink(const Handle(StepRepr_NextAssemblyUsageOccurrence)& nauo,
- const Handle(Standard_Transient)& item,
- const Handle(STEPSelections_AssemblyComponent)& part)
-{
- myNAUO = nauo;
- myItem = item;
- myComponent = part;
-}
+++ /dev/null
-// Created on: 1999-03-24
-// Created by: data exchange team
-// 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 _STEPSelections_AssemblyLink_HeaderFile
-#define _STEPSelections_AssemblyLink_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Transient.hxx>
-class StepRepr_NextAssemblyUsageOccurrence;
-class STEPSelections_AssemblyComponent;
-
-
-class STEPSelections_AssemblyLink;
-DEFINE_STANDARD_HANDLE(STEPSelections_AssemblyLink, Standard_Transient)
-
-
-class STEPSelections_AssemblyLink : public Standard_Transient
-{
-
-public:
-
-
- Standard_EXPORT STEPSelections_AssemblyLink();
-
- Standard_EXPORT STEPSelections_AssemblyLink(const Handle(StepRepr_NextAssemblyUsageOccurrence)& nauo, const Handle(Standard_Transient)& item, const Handle(STEPSelections_AssemblyComponent)& part);
-
- Handle(StepRepr_NextAssemblyUsageOccurrence) GetNAUO() const;
-
- Handle(Standard_Transient) GetItem() const;
-
- Handle(STEPSelections_AssemblyComponent) GetComponent() const;
-
- void SetNAUO (const Handle(StepRepr_NextAssemblyUsageOccurrence)& nauo);
-
- void SetItem (const Handle(Standard_Transient)& item);
-
- void SetComponent (const Handle(STEPSelections_AssemblyComponent)& part);
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(STEPSelections_AssemblyLink,Standard_Transient)
-
-protected:
-
-
-
-
-private:
-
-
- Handle(StepRepr_NextAssemblyUsageOccurrence) myNAUO;
- Handle(Standard_Transient) myItem;
- Handle(STEPSelections_AssemblyComponent) myComponent;
-
-
-};
-
-
-#include <STEPSelections_AssemblyLink.lxx>
-
-
-
-
-
-#endif // _STEPSelections_AssemblyLink_HeaderFile
+++ /dev/null
-// Created on: 1999-03-24
-// Created by: data exchange team
-// Copyright (c) 1999-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.
-
-//=======================================================================
-//function : GetNAUO
-//purpose :
-//=======================================================================
-
-inline Handle(StepRepr_NextAssemblyUsageOccurrence) STEPSelections_AssemblyLink::GetNAUO() const
-{
- return myNAUO;
-}
-
-//=======================================================================
-//function : GetSDSR
-//purpose :
-//=======================================================================
-
-inline Handle(Standard_Transient) STEPSelections_AssemblyLink::GetItem() const
-{
- return myItem;
-}
-
-//=======================================================================
-//function : GetComponent
-//purpose :
-//=======================================================================
-
-inline Handle(STEPSelections_AssemblyComponent) STEPSelections_AssemblyLink::GetComponent() const
-{
- return myComponent;
-}
-
-//=======================================================================
-//function : SetNAUO
-//purpose :
-//=======================================================================
-
-inline void STEPSelections_AssemblyLink::SetNAUO(const Handle(StepRepr_NextAssemblyUsageOccurrence)& nauo)
-{
- myNAUO = nauo;
-}
-
-//=======================================================================
-//function : SetCDSR
-//purpose :
-//=======================================================================
-
-inline void STEPSelections_AssemblyLink::SetItem(const Handle(Standard_Transient)& item)
-{
- myItem = item;
-}
-
-//=======================================================================
-//function : SetComponent
-//purpose :
-//=======================================================================
-
-inline void STEPSelections_AssemblyLink::SetComponent(const Handle(STEPSelections_AssemblyComponent)& part)
-{
- myComponent = part;
-}
+++ /dev/null
-// Created on: 1999-02-11
-// Created by: Pavel DURANDIN
-// Copyright (c) 1999-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 <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <StepBasic_ProductRelatedProductCategory.hxx>
-#include <STEPConstruct_Assembly.hxx>
-#include <StepGeom_CompositeCurve.hxx>
-#include <StepGeom_CompositeCurveSegment.hxx>
-#include <StepGeom_Curve.hxx>
-#include <StepGeom_Surface.hxx>
-#include <StepRepr_MappedItem.hxx>
-#include <StepRepr_RepresentationMap.hxx>
-#include <StepRepr_ShapeRepresentationRelationship.hxx>
-#include <STEPSelections_Counter.hxx>
-#include <StepShape_BrepWithVoids.hxx>
-#include <StepShape_ClosedShell.hxx>
-#include <StepShape_ConnectedFaceSet.hxx>
-#include <StepShape_ContextDependentShapeRepresentation.hxx>
-#include <StepShape_FaceSurface.hxx>
-#include <StepShape_FacetedBrep.hxx>
-#include <StepShape_FacetedBrepAndBrepWithVoids.hxx>
-#include <StepShape_GeometricSet.hxx>
-#include <StepShape_GeometricSetSelect.hxx>
-#include <StepShape_ManifoldSolidBrep.hxx>
-#include <StepShape_OpenShell.hxx>
-#include <StepShape_ShapeDefinitionRepresentation.hxx>
-#include <StepShape_ShapeRepresentation.hxx>
-#include <StepShape_ShellBasedSurfaceModel.hxx>
-
-STEPSelections_Counter::STEPSelections_Counter()
-{
- myNbFaces = 0;
- myNbShells = 0;
- myNbSolids = 0;
- myNbWires = 0;
- myNbEdges =0;
-}
-
-void STEPSelections_Counter::Count(const Interface_Graph& graph,
- const Handle(Standard_Transient)& start)
-{
- if(start.IsNull()) return;
-
- if (start->IsKind(STANDARD_TYPE(StepBasic_ProductRelatedProductCategory))) return;
-
- if (start->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation))) {
- DeclareAndCast(StepShape_ShapeDefinitionRepresentation,sdr,start);
- Count(graph,sdr->UsedRepresentation());
- Interface_EntityIterator subs = graph.Shareds(start);
- for (subs.Start(); subs.More(); subs.Next()) {
- DeclareAndCast(StepShape_ContextDependentShapeRepresentation,anitem,subs.Value());
- if (anitem.IsNull()) continue;
- Count(graph,anitem);
- }
- return;
- }
-
- if (start->IsKind(STANDARD_TYPE(StepShape_ShapeRepresentation))) {
- DeclareAndCast(StepShape_ShapeRepresentation,sr,start);
- Standard_Integer nb = sr->NbItems();
- for (Standard_Integer i = 1; i <= nb; i++) {
- Handle(StepRepr_RepresentationItem) anitem = sr->ItemsValue(i);
- Count(graph,anitem);
- }
- return;
- }
-
- if (start->IsKind(STANDARD_TYPE(StepShape_FacetedBrep))) {
- DeclareAndCast(StepShape_FacetedBrep,fbr,start);
- myMapOfSolids.Add(start);
- myNbSolids++;
- AddShell(fbr->Outer());
- return;
- }
-
- if (start->IsKind(STANDARD_TYPE(StepShape_BrepWithVoids))) {
- DeclareAndCast(StepShape_BrepWithVoids,brwv,start);
- myMapOfSolids.Add(start);
- myNbSolids++;
- AddShell(brwv->Outer());
- Standard_Integer nbvoids = brwv->NbVoids();
- for(Standard_Integer i = 1; i <= nbvoids; i++)
- AddShell(brwv->VoidsValue(i));
- return;
- }
-
- if (start->IsKind(STANDARD_TYPE(StepShape_ManifoldSolidBrep))) {
- DeclareAndCast(StepShape_ManifoldSolidBrep,msbr,start);
- myMapOfSolids.Add(start);
- myNbSolids++;
- AddShell(msbr->Outer());
- return;
- }
-
- if (start->IsKind(STANDARD_TYPE(StepShape_ShellBasedSurfaceModel))) {
- DeclareAndCast(StepShape_ShellBasedSurfaceModel,sbsm,start);
- Standard_Integer nbItems = sbsm->NbSbsmBoundary();
- for(Standard_Integer i = 1; i <= nbItems; i++) {
- Handle(StepShape_OpenShell) osh = sbsm->SbsmBoundaryValue(i).OpenShell();
- if(!osh.IsNull()) AddShell(osh);
- Handle(StepShape_ClosedShell) csh = sbsm->SbsmBoundaryValue(i).ClosedShell();
- if(!csh.IsNull()) AddShell(csh);
- }
- return;
- }
-
- if (start->IsKind(STANDARD_TYPE(StepShape_FacetedBrepAndBrepWithVoids))) {
- DeclareAndCast(StepShape_FacetedBrepAndBrepWithVoids,fbwv,start);
- myMapOfSolids.Add(start);
- myNbSolids++;
- AddShell(fbwv->Outer());
- Standard_Integer nbvoids = fbwv->NbVoids();
- for(Standard_Integer i = 1; i <= nbvoids; i++)
- AddShell(fbwv->VoidsValue(i));
- return;
- }
-
- if (start->IsKind(STANDARD_TYPE(StepShape_GeometricSet))) {
- DeclareAndCast(StepShape_GeometricSet,gs,start);
- Standard_Integer nbElem = gs->NbElements();
- for (Standard_Integer i = 1; i <= nbElem ; i++) {
- StepShape_GeometricSetSelect aGSS = gs->ElementsValue(i);
- Handle(Standard_Transient) ent = aGSS.Value();
- Handle(StepGeom_CompositeCurve) ccurve = Handle(StepGeom_CompositeCurve)::DownCast(ent);
- if(!ccurve.IsNull()) {
- myNbWires++;
- myMapOfWires.Add(ccurve);
- AddCompositeCurve(ccurve);
- } else
- if(ent->IsKind(STANDARD_TYPE(StepGeom_Curve))) {
- myNbEdges++;
- myMapOfEdges.Add(ent);
- } else
- if(ent->IsKind(STANDARD_TYPE(StepGeom_Surface))) {
- myNbFaces++;
- myMapOfFaces.Add(ent);
- }
- }
- }
-
-
- if (start->IsKind(STANDARD_TYPE(StepRepr_MappedItem))) {
- DeclareAndCast(StepRepr_MappedItem,mi,start);
- Count(graph,mi->MappingTarget());
- Handle(StepRepr_RepresentationMap) map = mi->MappingSource();
- if(map.IsNull()) return;
- Count(graph,map->MappedRepresentation());
- return;
- }
-
- if (start->IsKind(STANDARD_TYPE(StepShape_FaceSurface))) {
- myNbFaces++;
- myMapOfFaces.Add(start);
- return;
- }
-
- if (start->IsKind(STANDARD_TYPE(StepShape_ContextDependentShapeRepresentation))) {
- DeclareAndCast(StepShape_ContextDependentShapeRepresentation,CDSR,start);
- Handle(StepRepr_RepresentationRelationship) SRR = CDSR->RepresentationRelation();
- if ( SRR.IsNull() ) return ;
-
- Handle(StepRepr_Representation) rep;
- Standard_Boolean SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( graph, CDSR );
- if(SRRReversed)
- rep = SRR->Rep2();
- else
- rep = SRR->Rep1();
-
- Interface_EntityIterator subs = graph.Sharings(rep);
- for (subs.Start(); subs.More(); subs.Next())
- if ( subs.Value()->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation))) {
- DeclareAndCast(StepShape_ShapeDefinitionRepresentation,SDR,subs.Value());
- Count(graph,SDR);
- }
- //???
- return;
- }
-
- if (start->IsKind (STANDARD_TYPE(StepRepr_ShapeRepresentationRelationship)) ) {
- DeclareAndCast(StepRepr_ShapeRepresentationRelationship,und,start);
- for (Standard_Integer i = 1; i <= 2; i ++) {
- Handle(Standard_Transient) anitem;
- if (i == 1) anitem = und->Rep1();
- if (i == 2) anitem = und->Rep2();
- Count(graph,anitem);
- }
- return;
- }
-}
-
-void STEPSelections_Counter::Clear()
-{
- myMapOfFaces.Clear();
- myMapOfShells.Clear();
- myMapOfSolids.Clear();
- myMapOfWires.Clear();
- myMapOfEdges.Clear();
- myNbFaces = 0;
- myNbShells = 0;
- myNbSolids = 0;
- myNbWires = 0;
- myNbEdges =0;
-}
-
-void STEPSelections_Counter::AddShell(const Handle(StepShape_ConnectedFaceSet)& cfs)
-{
- myMapOfShells.Add(cfs);
- myNbShells++;
- Standard_Integer nbf = cfs->NbCfsFaces();
- for(Standard_Integer i =1; i <= nbf; i++)
- myMapOfFaces.Add(cfs->CfsFacesValue(i));
- myNbFaces+=nbf;
- return;
-}
-
-void STEPSelections_Counter::AddCompositeCurve(const Handle(StepGeom_CompositeCurve)& ccurve)
-{
- Standard_Integer nbs = ccurve->NbSegments();
- for ( Standard_Integer i=1; i <= nbs; i++ ) {
-// #ifdef AIX CKY : common code for all platforms: Handle() not Handle()&
- Handle(StepGeom_CompositeCurveSegment) ccs = ccurve->SegmentsValue ( i );
- Handle(StepGeom_Curve) crv = ccs->ParentCurve();
-
- if(crv->IsKind(STANDARD_TYPE(StepGeom_CompositeCurve)))
- AddCompositeCurve(Handle(StepGeom_CompositeCurve)::DownCast(crv));
- else {
- myNbEdges++;
- myMapOfEdges.Add(crv);
- }
- }
-}
+++ /dev/null
-// Created on: 1999-02-11
-// Created by: Pavel DURANDIN
-// 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 _STEPSelections_Counter_HeaderFile
-#define _STEPSelections_Counter_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Standard_Integer.hxx>
-#include <TColStd_MapOfTransient.hxx>
-class Interface_Graph;
-class Standard_Transient;
-class StepShape_ConnectedFaceSet;
-class StepGeom_CompositeCurve;
-
-
-
-class STEPSelections_Counter
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- Standard_EXPORT STEPSelections_Counter();
-
- Standard_EXPORT void Count (const Interface_Graph& graph, const Handle(Standard_Transient)& start);
-
- Standard_EXPORT void Clear();
-
- Standard_Integer NbInstancesOfFaces() const;
-
- Standard_Integer POP() const;
-
- Standard_Integer POP2() const;
-
- Standard_Integer NbInstancesOfShells() const;
-
- Standard_Integer NbInstancesOfSolids() const;
-
- Standard_Integer NbInstancesOfEdges() const;
-
- Standard_Integer NbInstancesOfWires() const;
-
- Standard_Integer NbSourceFaces() const;
-
- Standard_Integer NbSourceShells() const;
-
- Standard_Integer NbSourceSolids() const;
-
- Standard_Integer NbSourceEdges() const;
-
- Standard_Integer NbSourceWires() const;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
- Standard_EXPORT void AddShell (const Handle(StepShape_ConnectedFaceSet)& cfs);
-
- Standard_EXPORT void AddCompositeCurve (const Handle(StepGeom_CompositeCurve)& ccurve);
-
-
- Standard_Integer myNbFaces;
- Standard_Integer myNbShells;
- Standard_Integer myNbSolids;
- Standard_Integer myNbEdges;
- Standard_Integer myNbWires;
- TColStd_MapOfTransient myMapOfFaces;
- TColStd_MapOfTransient myMapOfShells;
- TColStd_MapOfTransient myMapOfSolids;
- TColStd_MapOfTransient myMapOfEdges;
- TColStd_MapOfTransient myMapOfWires;
-
-
-};
-
-
-#include <STEPSelections_Counter.lxx>
-
-
-
-
-
-#endif // _STEPSelections_Counter_HeaderFile
+++ /dev/null
-// Created on: 1999-02-11
-// Created by: Pavel DURANDIN
-// Copyright (c) 1999-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.
-
-inline Standard_Integer STEPSelections_Counter::NbInstancesOfFaces() const
-{
- return myNbFaces;
-}
-
-inline Standard_Integer STEPSelections_Counter::NbInstancesOfShells() const
-{
- return myNbShells;
-}
-
-inline Standard_Integer STEPSelections_Counter::NbInstancesOfSolids() const
-{
- return myNbSolids;
-}
-
-inline Standard_Integer STEPSelections_Counter::NbInstancesOfEdges() const
-{
- return myNbEdges;
-}
-
-inline Standard_Integer STEPSelections_Counter::NbInstancesOfWires() const
-{
- return myNbWires;
-}
-
-
-inline Standard_Integer STEPSelections_Counter::NbSourceFaces() const
-{
- return myMapOfFaces.Extent();
-}
-
-inline Standard_Integer STEPSelections_Counter::NbSourceShells() const
-{
- return myMapOfShells.Extent();
-}
-
-inline Standard_Integer STEPSelections_Counter::NbSourceSolids() const
-{
- return myMapOfSolids.Extent();
-}
-
-inline Standard_Integer STEPSelections_Counter::NbSourceEdges() const
-{
- return myMapOfEdges.Extent();
-}
-
-inline Standard_Integer STEPSelections_Counter::NbSourceWires() const
-{
- return myMapOfWires.Extent();
-}
+++ /dev/null
-// Created on: 1994-12-22
-// 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 STEPSelections_HSequenceOfAssemblyLink_HeaderFile
-#define STEPSelections_HSequenceOfAssemblyLink_HeaderFile
-
-#include <STEPSelections_SequenceOfAssemblyLink.hxx>
-#include <NCollection_DefineHSequence.hxx>
-
-DEFINE_HSEQUENCE(STEPSelections_HSequenceOfAssemblyLink, STEPSelections_SequenceOfAssemblyLink)
-
-
-#endif
+++ /dev/null
-// Created on: 1999-03-25
-// Created by: data exchange team
-// Copyright (c) 1999-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 <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <StepRepr_MappedItem.hxx>
-#include <StepRepr_NextAssemblyUsageOccurrence.hxx>
-#include <StepRepr_ProductDefinitionShape.hxx>
-#include <STEPSelections_SelectAssembly.hxx>
-#include <StepShape_ContextDependentShapeRepresentation.hxx>
-#include <StepShape_ShapeDefinitionRepresentation.hxx>
-#include <StepShape_ShapeRepresentation.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(STEPSelections_SelectAssembly,IFSelect_SelectExplore)
-
-STEPSelections_SelectAssembly::STEPSelections_SelectAssembly():IFSelect_SelectExplore (-1){ }
-
-Standard_Boolean STEPSelections_SelectAssembly::Explore(const Standard_Integer /*level*/,
- const Handle(Standard_Transient)& start,
- const Interface_Graph& G,
- Interface_EntityIterator& explored) const
-{
- if(start.IsNull()) return Standard_False;
-
- if(start->IsKind(STANDARD_TYPE(StepShape_ContextDependentShapeRepresentation))) {
- DeclareAndCast(StepShape_ContextDependentShapeRepresentation,sdsr,start);
- Handle(StepRepr_ProductDefinitionShape) pds = sdsr->RepresentedProductRelation();
- if(pds.IsNull()) return Standard_False;
- Handle(Standard_Transient) ent = pds->Definition().ProductDefinitionRelationship();
- if(ent.IsNull()) return Standard_False;
- return (ent->IsKind(STANDARD_TYPE(StepRepr_NextAssemblyUsageOccurrence)));
- }
-
- if(start->IsKind(STANDARD_TYPE(StepRepr_MappedItem))) {
- DeclareAndCast(StepRepr_MappedItem,mapped,start);
- Interface_EntityIterator subs = G.Sharings(mapped);
- Handle(StepShape_ShapeRepresentation) shrep;
- for(subs.Start(); subs.More()&&shrep.IsNull(); subs.Next())
- if(subs.Value()->IsKind(STANDARD_TYPE(StepShape_ShapeRepresentation)))
- shrep = Handle(StepShape_ShapeRepresentation)::DownCast(subs.Value());
- if(shrep.IsNull()) return Standard_False;
-
- subs = G.Sharings(shrep);
- Handle(StepShape_ShapeDefinitionRepresentation) shdefrep;
- for(subs.Start(); subs.More()&&shdefrep.IsNull(); subs.Next())
- if(subs.Value()->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation)))
- shdefrep = Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(subs.Value());
- if(shdefrep.IsNull()) return Standard_False;
-
- Handle(StepRepr_ProductDefinitionShape) pds =
- Handle(StepRepr_ProductDefinitionShape)::DownCast ( shdefrep->Definition().PropertyDefinition() );
- if(pds.IsNull()) return Standard_False;
- Handle(Standard_Transient) ent = pds->Definition().ProductDefinitionRelationship();
- if(ent.IsNull()) return Standard_False;
- return (ent->IsKind(STANDARD_TYPE(StepRepr_NextAssemblyUsageOccurrence)));
- }
-
- Interface_EntityIterator subs = G.Shareds(start);
- subs.Start();
- Standard_Boolean isSome = subs.More();
- for (; subs.More(); subs.Next())
- explored.AddItem (subs.Value());
-
- return isSome;
-}
-
-TCollection_AsciiString STEPSelections_SelectAssembly::ExploreLabel() const
-{
- return TCollection_AsciiString ("Assembly components");
-}
-
-
-
-
-
-
-
+++ /dev/null
-// Created on: 1999-03-25
-// Created by: data exchange team
-// 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 _STEPSelections_SelectAssembly_HeaderFile
-#define _STEPSelections_SelectAssembly_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectExplore.hxx>
-#include <Standard_Integer.hxx>
-class Standard_Transient;
-class Interface_Graph;
-class Interface_EntityIterator;
-class TCollection_AsciiString;
-
-
-class STEPSelections_SelectAssembly;
-DEFINE_STANDARD_HANDLE(STEPSelections_SelectAssembly, IFSelect_SelectExplore)
-
-
-class STEPSelections_SelectAssembly : public IFSelect_SelectExplore
-{
-
-public:
-
-
- Standard_EXPORT STEPSelections_SelectAssembly();
-
- //! Explores an entity, to take its faces
- //! Works recursively
- 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 : "Assembly structures"
- Standard_EXPORT TCollection_AsciiString ExploreLabel() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(STEPSelections_SelectAssembly,IFSelect_SelectExplore)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _STEPSelections_SelectAssembly_HeaderFile
+++ /dev/null
-// Created on: 1999-02-18
-// Created by: Pavel DURANDIN
-// Copyright (c) 1999-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 <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <RWStepAP214_GeneralModule.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <StepData_ReadWriteModule.hxx>
-#include <STEPSelections_SelectDerived.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_SequenceOfAsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(STEPSelections_SelectDerived,StepSelect_StepType)
-
-STEPSelections_SelectDerived::STEPSelections_SelectDerived():StepSelect_StepType()
-{
-}
-
-static Handle(Standard_Type) GetStepType(const Handle(StepData_ReadWriteModule)& module,
- const TCollection_AsciiString& type)
-{
- Handle(Standard_Type) atype;
- if(module.IsNull()) return atype;
- Standard_Integer num = module->CaseStep(type);
- if(num == 0) return atype;
- Handle(Standard_Transient) ent;
- RWStepAP214_GeneralModule genModul;
- genModul.NewVoid(num,ent);
- atype = ent->DynamicType();
- return atype;
-}
-
-
-Standard_Boolean STEPSelections_SelectDerived::Matches(const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& /*model*/,
- const TCollection_AsciiString& text,
- const Standard_Boolean /*exact*/) const
-{
- Standard_Integer CN;
- Handle(StepData_ReadWriteModule) module;
- Standard_Boolean ok = thelib.Select (ent,module,CN);
- if(!ok) return Standard_False;
- Handle(Standard_Type) checker = GetStepType(module,text);
- if(checker.IsNull()) return Standard_False;
-
- Standard_Boolean plex = module->IsComplex(CN);
- if (!plex) {
- DeclareAndCast(Standard_Type,atype,ent);
- if (atype.IsNull()) atype = ent->DynamicType();
- return atype->SubType(checker);
- } else {
- TColStd_SequenceOfAsciiString list;
- module->ComplexType (CN,list);
- Standard_Integer nb = list.Length();
- for (Standard_Integer i = 1; i <= nb; i ++) {
- Handle(Standard_Type) atype = GetStepType(module,list.Value(i));
- if(atype->SubType(checker)) return Standard_True;
- }
- }
- return Standard_False;
-}
+++ /dev/null
-// Created on: 1999-02-18
-// Created by: Pavel DURANDIN
-// 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 _STEPSelections_SelectDerived_HeaderFile
-#define _STEPSelections_SelectDerived_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <StepSelect_StepType.hxx>
-class Standard_Transient;
-class Interface_InterfaceModel;
-class TCollection_AsciiString;
-
-
-class STEPSelections_SelectDerived;
-DEFINE_STANDARD_HANDLE(STEPSelections_SelectDerived, StepSelect_StepType)
-
-
-class STEPSelections_SelectDerived : public StepSelect_StepType
-{
-
-public:
-
-
- Standard_EXPORT STEPSelections_SelectDerived();
-
- Standard_EXPORT virtual Standard_Boolean Matches (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model, const TCollection_AsciiString& text, const Standard_Boolean exact) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(STEPSelections_SelectDerived,StepSelect_StepType)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _STEPSelections_SelectDerived_HeaderFile
+++ /dev/null
-// Created on: 1999-02-11
-// Created by: Pavel DURANDIN
-// Copyright (c) 1999-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 <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <StepGeom_Surface.hxx>
-#include <STEPSelections_SelectFaces.hxx>
-#include <StepShape_FaceSurface.hxx>
-#include <StepShape_GeometricSet.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(STEPSelections_SelectFaces,IFSelect_SelectExplore)
-
-STEPSelections_SelectFaces::STEPSelections_SelectFaces():IFSelect_SelectExplore (-1){ }
-
-Standard_Boolean STEPSelections_SelectFaces::Explore(const Standard_Integer /*level*/,
- const Handle(Standard_Transient)& start,
- const Interface_Graph& G,
- Interface_EntityIterator& explored) const
-{
- if(start.IsNull()) return Standard_False;
-
- if (start->IsKind(STANDARD_TYPE(StepShape_FaceSurface))) return Standard_True;
-
- Standard_Boolean isInFaceOfInSurface = Standard_False;
- if (start->IsKind(STANDARD_TYPE(StepGeom_Surface))) {
- Interface_EntityIterator subs = G.Sharings(start);
- for (subs.Start(); subs.More(); subs.Next()) {
- if(subs.Value()->IsKind(STANDARD_TYPE(StepShape_GeometricSet)))
- return Standard_True;
- if(subs.Value()->IsKind(STANDARD_TYPE(StepGeom_Surface)))
- isInFaceOfInSurface = Standard_True;
- if(subs.Value()->IsKind(STANDARD_TYPE(StepShape_FaceSurface)))
- isInFaceOfInSurface = Standard_True;
- }
- return !isInFaceOfInSurface;
- }
- Interface_EntityIterator subs = G.Shareds(start);
- subs.Start();
- Standard_Boolean isSome = subs.More();
- for (; subs.More(); subs.Next())
- explored.AddItem (subs.Value());
-
- return isSome;
-}
-
-TCollection_AsciiString STEPSelections_SelectFaces::ExploreLabel() const
-{
- return TCollection_AsciiString ("Faces");
-}
+++ /dev/null
-// Created on: 1999-02-11
-// Created by: Pavel DURANDIN
-// 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 _STEPSelections_SelectFaces_HeaderFile
-#define _STEPSelections_SelectFaces_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectExplore.hxx>
-#include <Standard_Integer.hxx>
-class Standard_Transient;
-class Interface_Graph;
-class Interface_EntityIterator;
-class TCollection_AsciiString;
-
-
-class STEPSelections_SelectFaces;
-DEFINE_STANDARD_HANDLE(STEPSelections_SelectFaces, IFSelect_SelectExplore)
-
-//! This selection returns "STEP faces"
-class STEPSelections_SelectFaces : public IFSelect_SelectExplore
-{
-
-public:
-
-
- Standard_EXPORT STEPSelections_SelectFaces();
-
- //! Explores an entity, to take its faces
- //! Works recursively
- 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 : "Faces"
- Standard_EXPORT TCollection_AsciiString ExploreLabel() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(STEPSelections_SelectFaces,IFSelect_SelectExplore)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _STEPSelections_SelectFaces_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_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Standard_Type.hxx>
-#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);
-}
-
-//=======================================================================
-//function : RootResult
-//purpose :
-//=======================================================================
-
- Interface_EntityIterator STEPSelections_SelectForTransfer::RootResult(const Interface_Graph& /*G*/) const
-{
- Interface_EntityIterator iter;
- Handle(TColStd_HSequenceOfTransient) roots = Reader()->TransientProcess()->RootsForTransfer();
- Standard_Integer nb = roots->Length();
- for(Standard_Integer i = 1; i <= nb ; i++)
- iter.GetOneItem(roots->Value(i));
- return iter;
-}
-
+++ /dev/null
-// Created on: 2003-06-02
-// Created by: Galina KULIKOVA
-// Copyright (c) 2003-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 _STEPSelections_SelectForTransfer_HeaderFile
-#define _STEPSelections_SelectForTransfer_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <XSControl_SelectForTransfer.hxx>
-class XSControl_TransferReader;
-class Interface_EntityIterator;
-class Interface_Graph;
-
-
-class STEPSelections_SelectForTransfer;
-DEFINE_STANDARD_HANDLE(STEPSelections_SelectForTransfer, XSControl_SelectForTransfer)
-
-
-class STEPSelections_SelectForTransfer : public XSControl_SelectForTransfer
-{
-
-public:
-
-
- Standard_EXPORT STEPSelections_SelectForTransfer();
-
- Standard_EXPORT STEPSelections_SelectForTransfer(const Handle(XSControl_TransferReader)& TR);
-
- Standard_EXPORT virtual Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(STEPSelections_SelectForTransfer,XSControl_SelectForTransfer)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _STEPSelections_SelectForTransfer_HeaderFile
+++ /dev/null
-// Created on: 1999-03-22
-// Created by: data exchange team
-// Copyright (c) 1999-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 <Interface_EntityIterator.hxx>
-#include <Interface_Graph.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <StepGeom_CompositeCurve.hxx>
-#include <StepGeom_CompositeCurveSegment.hxx>
-#include <StepGeom_Curve.hxx>
-#include <STEPSelections_SelectGSCurves.hxx>
-#include <StepShape_GeometricSet.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(STEPSelections_SelectGSCurves,IFSelect_SelectExplore)
-
-static Standard_Integer flag;
-
-STEPSelections_SelectGSCurves::STEPSelections_SelectGSCurves():IFSelect_SelectExplore (-1){ flag = 1;}
-
-Standard_Boolean STEPSelections_SelectGSCurves::Explore(const Standard_Integer /*level*/,
- const Handle(Standard_Transient)& start,
- const Interface_Graph& G,
- Interface_EntityIterator& explored) const
-{
- if(start.IsNull()) return Standard_False;
-
- if (start->IsKind(STANDARD_TYPE(StepGeom_Curve))) {
- if(start->IsKind(STANDARD_TYPE(StepGeom_CompositeCurve))) {
- Interface_EntityIterator subs = G.Sharings(start);
- Standard_Boolean isInGeomSet = Standard_False;
- for (subs.Start(); subs.More()&&!isInGeomSet; subs.Next())
- if(subs.Value()->IsKind(STANDARD_TYPE(StepShape_GeometricSet))){
- if(flag) {
- explored.AddItem (subs.Value());
- flag =0;
- }
- isInGeomSet = Standard_True;
- }
- if(isInGeomSet) {
- Interface_EntityIterator aSubsShareds = G.Shareds(start);
- aSubsShareds.Start();
- Standard_Boolean isSome = aSubsShareds.More();
- for (; aSubsShareds.More(); aSubsShareds.Next())
- explored.AddItem (aSubsShareds.Value());
- return isSome;
- } else
- return Standard_False;
- } else {
- Interface_EntityIterator subs = G.Sharings(start);
- for (subs.Start(); subs.More(); subs.Next()) {
- if(subs.Value()->IsKind(STANDARD_TYPE(StepShape_GeometricSet))||
- subs.Value()->IsKind(STANDARD_TYPE(StepGeom_CompositeCurveSegment)))
- return Standard_True;
- }
- }
- }
-
- Interface_EntityIterator subs = G.Shareds(start);
- subs.Start();
- Standard_Boolean isSome = subs.More();
- for (; subs.More(); subs.Next())
- explored.AddItem (subs.Value());
-
- return isSome;
-}
-
-TCollection_AsciiString STEPSelections_SelectGSCurves::ExploreLabel() const
-{
- return TCollection_AsciiString ("Curves in GS");
-}
+++ /dev/null
-// Created on: 1999-03-22
-// Created by: data exchange team
-// 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 _STEPSelections_SelectGSCurves_HeaderFile
-#define _STEPSelections_SelectGSCurves_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectExplore.hxx>
-#include <Standard_Integer.hxx>
-class Standard_Transient;
-class Interface_Graph;
-class Interface_EntityIterator;
-class TCollection_AsciiString;
-
-
-class STEPSelections_SelectGSCurves;
-DEFINE_STANDARD_HANDLE(STEPSelections_SelectGSCurves, IFSelect_SelectExplore)
-
-//! This selection returns "curves in the geometric_set (except composite curves)"
-class STEPSelections_SelectGSCurves : public IFSelect_SelectExplore
-{
-
-public:
-
-
- Standard_EXPORT STEPSelections_SelectGSCurves();
-
- 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 : "Curves"
- Standard_EXPORT TCollection_AsciiString ExploreLabel() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(STEPSelections_SelectGSCurves,IFSelect_SelectExplore)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _STEPSelections_SelectGSCurves_HeaderFile
+++ /dev/null
-// Created on: 1999-03-23
-// Created by: data exchange team
-// Copyright (c) 1999-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 <Interface_EntityIterator.hxx>
-#include <Interface_HGraph.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <STEPConstruct_Assembly.hxx>
-#include <StepRepr_MappedItem.hxx>
-#include <StepRepr_RepresentationItem.hxx>
-#include <StepRepr_ShapeRepresentationRelationship.hxx>
-#include <STEPSelections_SelectInstances.hxx>
-#include <StepShape_BrepWithVoids.hxx>
-#include <StepShape_ContextDependentShapeRepresentation.hxx>
-#include <StepShape_FaceSurface.hxx>
-#include <StepShape_FacetedBrep.hxx>
-#include <StepShape_FacetedBrepAndBrepWithVoids.hxx>
-#include <StepShape_GeometricSet.hxx>
-#include <StepShape_ManifoldSolidBrep.hxx>
-#include <StepShape_ShapeDefinitionRepresentation.hxx>
-#include <StepShape_ShapeRepresentation.hxx>
-#include <StepShape_ShellBasedSurfaceModel.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_IndexedMapOfTransient.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(STEPSelections_SelectInstances,IFSelect_SelectExplore)
-
-static Handle(Interface_HGraph) myGraph;
-static Interface_EntityIterator myEntities;
-
-STEPSelections_SelectInstances::STEPSelections_SelectInstances():IFSelect_SelectExplore (-1){ }
-
-static void AddAllSharings(const Handle(Standard_Transient)& start,
- const Interface_Graph& graph,
- Interface_EntityIterator& explored)
-{
- if(start.IsNull()) return;
- Interface_EntityIterator subs = graph.Shareds(start);
- for (subs.Start(); subs.More(); subs.Next()) {
- explored.AddItem(subs.Value());
- AddAllSharings(subs.Value(), graph, explored);
- }
-}
-
-
-static void AddInstances(const Handle(Standard_Transient)& start,
- const Interface_Graph& graph,
- Interface_EntityIterator& explored)
-{
- if(start.IsNull()) return;
-
- explored.AddItem(start);
- if (start->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation))) {
- DeclareAndCast(StepShape_ShapeDefinitionRepresentation,sdr,start);
- AddInstances(sdr->UsedRepresentation(),graph,explored);
- Interface_EntityIterator subs = graph.Shareds(start);
- for (subs.Start(); subs.More(); subs.Next()) {
- DeclareAndCast(StepShape_ContextDependentShapeRepresentation,anitem,subs.Value());
- if (anitem.IsNull()) continue;
- AddInstances(anitem,graph,explored);
- }
- return;
- }
-
- if (start->IsKind(STANDARD_TYPE(StepShape_ShapeRepresentation))) {
- DeclareAndCast(StepShape_ShapeRepresentation,sr,start);
- Standard_Integer nb = sr->NbItems();
- for (Standard_Integer i = 1; i <= nb; i++) {
- Handle(StepRepr_RepresentationItem) anitem = sr->ItemsValue(i);
- AddInstances(anitem,graph,explored);
- }
- return;
- }
-
- if (start->IsKind(STANDARD_TYPE(StepShape_FacetedBrep))||
- start->IsKind(STANDARD_TYPE(StepShape_BrepWithVoids))||
- start->IsKind(STANDARD_TYPE(StepShape_ManifoldSolidBrep))||
- start->IsKind(STANDARD_TYPE(StepShape_ShellBasedSurfaceModel))||
- start->IsKind(STANDARD_TYPE(StepShape_FacetedBrepAndBrepWithVoids))||
- start->IsKind(STANDARD_TYPE(StepShape_GeometricSet))||
- start->IsKind(STANDARD_TYPE(StepShape_FaceSurface))||
- start->IsKind(STANDARD_TYPE(StepRepr_MappedItem))) {
- AddAllSharings(start, graph, explored);
- return;
- }
-
- if (start->IsKind(STANDARD_TYPE(StepShape_ContextDependentShapeRepresentation))) {
- DeclareAndCast(StepShape_ContextDependentShapeRepresentation,CDSR,start);
- Handle(StepRepr_RepresentationRelationship) SRR = CDSR->RepresentationRelation();
- if ( SRR.IsNull() ) return ;
-
- Handle(StepRepr_Representation) rep;
- Standard_Boolean SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( graph, CDSR );
- if(SRRReversed)
- rep = SRR->Rep2();
- else
- rep = SRR->Rep1();
-
- Interface_EntityIterator subs = graph.Sharings(rep);
- for (subs.Start(); subs.More(); subs.Next())
- if ( subs.Value()->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation))) {
- DeclareAndCast(StepShape_ShapeDefinitionRepresentation,SDR,subs.Value());
- AddInstances(SDR,graph,explored);
- }
- //???
- return;
- }
-
- if (start->IsKind (STANDARD_TYPE(StepRepr_ShapeRepresentationRelationship)) ) {
- DeclareAndCast(StepRepr_ShapeRepresentationRelationship,und,start);
- for (Standard_Integer i = 1; i <= 2; i ++) {
- Handle(Standard_Transient) anitem;
- if (i == 1) anitem = und->Rep1();
- if (i == 2) anitem = und->Rep2();
- AddInstances(anitem,graph,explored);
- }
- return;
- }
-
-}
-
-
-Interface_EntityIterator STEPSelections_SelectInstances::RootResult(const Interface_Graph &G) const
-{
- if(myGraph.IsNull()||(G.Model()!=myGraph->Graph().Model()))
- {
-
- Interface_EntityIterator roots = G.RootEntities();
- myGraph = new Interface_HGraph(G);
- myEntities.Destroy();
- for (roots.Start(); roots.More(); roots.Next())
- AddInstances(roots.Value(), G, myEntities);
- }
-
- if(HasInput()||HasAlternate()) {
- Interface_EntityIterator select = InputResult(G);
- Standard_Integer nbSelected = select.NbEntities();
- TColStd_IndexedMapOfTransient filter (nbSelected);
- for(select.Start(); select.More(); select.Next())
- filter.Add(select.Value());
- Interface_EntityIterator result;
- for(myEntities.Start(); myEntities.More(); myEntities.Next())
- if(filter.Contains(myEntities.Value()))
- result.AddItem(myEntities.Value());
- return result;
- }
- else
- return myEntities;
-}
-
-
-Standard_Boolean STEPSelections_SelectInstances::Explore(const Standard_Integer,
- const Handle(Standard_Transient)&,
- const Interface_Graph&,
- Interface_EntityIterator&) const
-{
- return Standard_False;
-}
-
-Standard_Boolean STEPSelections_SelectInstances::HasUniqueResult() const
-{
- return Standard_True;
-}
-
-TCollection_AsciiString STEPSelections_SelectInstances::ExploreLabel() const
-{
- return TCollection_AsciiString ("Instances");
-}
+++ /dev/null
-// Created on: 1999-03-23
-// Created by: data exchange team
-// 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 _STEPSelections_SelectInstances_HeaderFile
-#define _STEPSelections_SelectInstances_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_SelectExplore.hxx>
-#include <Standard_Integer.hxx>
-class Interface_EntityIterator;
-class Interface_Graph;
-class Standard_Transient;
-class TCollection_AsciiString;
-
-
-class STEPSelections_SelectInstances;
-DEFINE_STANDARD_HANDLE(STEPSelections_SelectInstances, IFSelect_SelectExplore)
-
-
-class STEPSelections_SelectInstances : public IFSelect_SelectExplore
-{
-
-public:
-
-
- Standard_EXPORT STEPSelections_SelectInstances();
-
- Standard_EXPORT Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
-
- 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 : "Instances"
- Standard_EXPORT TCollection_AsciiString ExploreLabel() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(STEPSelections_SelectInstances,IFSelect_SelectExplore)
-
-protected:
-
-
- Standard_EXPORT virtual Standard_Boolean HasUniqueResult() const Standard_OVERRIDE;
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _STEPSelections_SelectInstances_HeaderFile
+++ /dev/null
-// Created on: 1994-12-22
-// 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 STEPSelections_SequenceOfAssemblyComponent_HeaderFile
-#define STEPSelections_SequenceOfAssemblyComponent_HeaderFile
-
-#include <STEPSelections_AssemblyComponent.hxx>
-#include <NCollection_Sequence.hxx>
-
-typedef NCollection_Sequence<Handle(STEPSelections_AssemblyComponent)> STEPSelections_SequenceOfAssemblyComponent;
-
-
-#endif
+++ /dev/null
-// Created on: 1994-12-22
-// 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 STEPSelections_SequenceOfAssemblyLink_HeaderFile
-#define STEPSelections_SequenceOfAssemblyLink_HeaderFile
-
-#include <STEPSelections_AssemblyLink.hxx>
-#include <NCollection_Sequence.hxx>
-
-typedef NCollection_Sequence<Handle(STEPSelections_AssemblyLink)> STEPSelections_SequenceOfAssemblyLink;
-
-
-#endif
+++ /dev/null
-StepSelect_FileModifier.hxx
-StepSelect_FileModifier_0.cxx
-StepSelect_FloatFormat.cxx
-StepSelect_FloatFormat.hxx
-StepSelect_ModelModifier.hxx
-StepSelect_ModelModifier_0.cxx
-StepSelect_StepType.cxx
-StepSelect_StepType.hxx
-StepSelect_WorkLibrary.cxx
-StepSelect_WorkLibrary.hxx
+++ /dev/null
-// Created on: 1994-12-22
-// 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 _StepSelect_FileModifier_HeaderFile
-#define _StepSelect_FileModifier_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_GeneralModifier.hxx>
-class StepData_StepWriter;
-class IFSelect_ContextWrite;
-
-
-class StepSelect_FileModifier;
-DEFINE_STANDARD_HANDLE(StepSelect_FileModifier, IFSelect_GeneralModifier)
-
-
-class StepSelect_FileModifier : public IFSelect_GeneralModifier
-{
-
-public:
-
-
- //! Perform the action specific to each class of File Modifier
- //! <ctx> is the ContextWrite, which brings : the model, the
- //! protocol, the file name, plus the object AppliedModifiers
- //! (not used here) and the CheckList
- //! Remark that the model has to be casted for specific access
- //!
- //! <writer> is the Writer and is specific to each norm, on which
- //! to act
- Standard_EXPORT virtual void Perform (IFSelect_ContextWrite& ctx, StepData_StepWriter& writer) const = 0;
-
-
-
-
- DEFINE_STANDARD_RTTI_INLINE(StepSelect_FileModifier,IFSelect_GeneralModifier)
-
-protected:
-
-
- //! Sets a File Modifier to keep the graph of dependences
- //! unchanges (because it works on the model already produced)
- Standard_EXPORT StepSelect_FileModifier();
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _StepSelect_FileModifier_HeaderFile
+++ /dev/null
-// Created on: 1994-12-22
-// 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 <StepSelect_FileModifier.hxx>
-
-#include <Standard_Type.hxx>
-
-#include <StepData_StepWriter.hxx>
-#include <IFSelect_ContextWrite.hxx>
-
-
-
-
-
-
-
-
-
-
-#define Writer StepData_StepWriter
-#define Writer_hxx <StepData_StepWriter.hxx>
-#define IFSelect_FileModifier StepSelect_FileModifier
-#define IFSelect_FileModifier_hxx <StepSelect_FileModifier.hxx>
-#define Handle_IFSelect_FileModifier Handle(StepSelect_FileModifier)
-#include <IFSelect_FileModifier.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 <IFSelect_ContextWrite.hxx>
-#include <Standard_Type.hxx>
-#include <StepData_StepWriter.hxx>
-#include <StepSelect_FloatFormat.hxx>
-#include <TCollection_AsciiString.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(StepSelect_FloatFormat,StepSelect_FileModifier)
-
-StepSelect_FloatFormat::StepSelect_FloatFormat ()
- : thezerosup (Standard_True) , themainform ("%E") ,
- theformrange ("%f") , therangemin (0.1) , therangemax (1000.)
- { }
-
- void StepSelect_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 StepSelect_FloatFormat::SetZeroSuppress (const Standard_Boolean mode)
- { thezerosup = mode; }
-
- void StepSelect_FloatFormat::SetFormat (const Standard_CString format)
- { themainform.Clear(); themainform.AssignCat(format); }
-
-
- void StepSelect_FloatFormat::SetFormatForRange
- (const Standard_CString form, const Standard_Real R1, const Standard_Real R2)
-{
- theformrange.Clear(); theformrange.AssignCat(form);
- therangemin = R1; therangemax = R2;
-}
-
- void StepSelect_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 StepSelect_FloatFormat::Perform
- (IFSelect_ContextWrite& /*ctx*/,
- 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 StepSelect_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 _StepSelect_FloatFormat_HeaderFile
-#define _StepSelect_FloatFormat_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <StepSelect_FileModifier.hxx>
-#include <Standard_Integer.hxx>
-class IFSelect_ContextWrite;
-class StepData_StepWriter;
-
-
-class StepSelect_FloatFormat;
-DEFINE_STANDARD_HANDLE(StepSelect_FloatFormat, StepSelect_FileModifier)
-
-//! 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 StepSelect_FloatFormat : public StepSelect_FileModifier
-{
-
-public:
-
-
- //! Creates a new FloatFormat, with standard options :
- //! ZeroSuppress, Main Format = %E,
- //! Format between 0.001 and 1000. = %f
- Standard_EXPORT StepSelect_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
- Standard_EXPORT void SetZeroSuppress (const Standard_Boolean mode);
-
- //! Sets Main Format to a new value
- //! Remark : SetFormat, SetZeroSuppress and SetFormatForRange are
- //! independent
- 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 (IFSelect_ContextWrite& ctx, StepData_StepWriter& writer) const Standard_OVERRIDE;
-
- //! 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(StepSelect_FloatFormat,StepSelect_FileModifier)
-
-protected:
-
-
-
-
-private:
-
-
- Standard_Boolean thezerosup;
- TCollection_AsciiString themainform;
- TCollection_AsciiString theformrange;
- Standard_Real therangemin;
- Standard_Real therangemax;
-
-
-};
-
-
-
-
-
-
-
-#endif // _StepSelect_FloatFormat_HeaderFile
+++ /dev/null
-// Created on: 1994-12-22
-// 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 _StepSelect_ModelModifier_HeaderFile
-#define _StepSelect_ModelModifier_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Modifier.hxx>
-#include <Standard_Boolean.hxx>
-class StepData_StepModel;
-class StepData_Protocol;
-class IFSelect_ContextModif;
-class Interface_InterfaceModel;
-class Interface_Protocol;
-class Interface_CopyTool;
-
-
-class StepSelect_ModelModifier;
-DEFINE_STANDARD_HANDLE(StepSelect_ModelModifier, IFSelect_Modifier)
-
-
-class StepSelect_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(StepData_StepModel)& target, const Handle(StepData_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(StepData_StepModel)& target, Interface_CopyTool& TC) const = 0;
-
-
-
-
- DEFINE_STANDARD_RTTI_INLINE(StepSelect_ModelModifier,IFSelect_Modifier)
-
-protected:
-
-
- //! Calls inherited Initialize, transmits to it the information
- //! <maychangegraph>
- Standard_EXPORT StepSelect_ModelModifier(const Standard_Boolean maychangegraph);
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _StepSelect_ModelModifier_HeaderFile
+++ /dev/null
-// Created on: 1994-12-22
-// 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 <StepSelect_ModelModifier.hxx>
-
-#include <Standard_Type.hxx>
-
-#include <StepData_StepModel.hxx>
-#include <StepData_Protocol.hxx>
-#include <IFSelect_ContextModif.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Protocol.hxx>
-#include <Interface_CopyTool.hxx>
-
-
-
-
-
-
-
-
-
-
-#define Handle_Model Handle(StepData_StepModel)
-#define Model StepData_StepModel
-#define Model_hxx <StepData_StepModel.hxx>
-#define Handle_Proto Handle(StepData_Protocol)
-#define Proto StepData_Protocol
-#define Proto_hxx <StepData_Protocol.hxx>
-#define IFSelect_ModelModifier StepSelect_ModelModifier
-#define IFSelect_ModelModifier_hxx <StepSelect_ModelModifier.hxx>
-#define Handle_IFSelect_ModelModifier Handle(StepSelect_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 <Interface_InterfaceError.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <StepData_Protocol.hxx>
-#include <StepData_ReadWriteModule.hxx>
-#include <StepData_UndefinedEntity.hxx>
-#include <StepSelect_StepType.hxx>
-#include <TColStd_SequenceOfAsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(StepSelect_StepType,IFSelect_Signature)
-
-static TCollection_AsciiString lastvalue;
-
-
- StepSelect_StepType::StepSelect_StepType ()
- : IFSelect_Signature ("Step Type") { }
-
- void StepSelect_StepType::SetProtocol
- (const Handle(Interface_Protocol)& proto)
-{
- DeclareAndCast(StepData_Protocol,newproto,proto);
- if (newproto.IsNull()) throw Interface_InterfaceError("StepSelect_StepType");
- theproto = newproto;
- thelib.Clear();
- thelib.AddProtocol (theproto);
- thename.Clear();
- thename.AssignCat ("Step Type (Schema ");
- thename.AssignCat (theproto->SchemaName());
- thename.AssignCat (")");
-}
-
- Standard_CString StepSelect_StepType::Value
- (const Handle(Standard_Transient)& ent,
- const Handle(Interface_InterfaceModel)& /*model*/) const
-{
- lastvalue.Clear();
- Handle(StepData_ReadWriteModule) module;
- Standard_Integer CN;
- Standard_Boolean ok = thelib.Select (ent,module,CN);
- if (!ok) {
- lastvalue.AssignCat ("..NOT FROM SCHEMA ");
- lastvalue.AssignCat (theproto->SchemaName());
- lastvalue.AssignCat ("..");
- } else {
- Standard_Boolean plex = module->IsComplex(CN);
- if (!plex) lastvalue = module->StepType(CN);
- else {
- lastvalue.AssignCat ("(");
- TColStd_SequenceOfAsciiString list;
- module->ComplexType (CN,list);
- Standard_Integer nb = list.Length();
- if (nb == 0) lastvalue.AssignCat ("..COMPLEX TYPE..");
- for (Standard_Integer i = 1; i <= nb; i ++) {
- if (i > 1) lastvalue.AssignCat (",");
- lastvalue.AssignCat (list.Value(i).ToCString());
- }
- lastvalue.AssignCat (")");
- }
- }
- if (lastvalue.Length() > 0) return lastvalue.ToCString();
-
- DeclareAndCast(StepData_UndefinedEntity,und,ent);
- if (und.IsNull()) return lastvalue.ToCString();
- if (und->IsComplex()) {
- lastvalue.AssignCat("(");
- while (!und.IsNull()) {
- lastvalue.AssignCat (und->StepType());
- und = und->Next();
- if (!und.IsNull()) lastvalue.AssignCat(",");
- }
- lastvalue.AssignCat(")");
- }
- else return und->StepType();
- return lastvalue.ToCString();
-}
+++ /dev/null
-// Created on: 1994-12-22
-// 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 _StepSelect_StepType_HeaderFile
-#define _StepSelect_StepType_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <StepData_WriterLib.hxx>
-#include <IFSelect_Signature.hxx>
-#include <Standard_CString.hxx>
-class StepData_Protocol;
-class Interface_Protocol;
-class Standard_Transient;
-class Interface_InterfaceModel;
-
-
-class StepSelect_StepType;
-DEFINE_STANDARD_HANDLE(StepSelect_StepType, IFSelect_Signature)
-
-//! StepType is a Signature specific to Step definitions : it
-//! considers the type as defined in STEP Schemas, the same which
-//! is used in files.
-//! For a Complex Type, if its definition is known, StepType
-//! produces the list of basic types, separated by commas, the
-//! whole between brackets : "(TYPE1,TYPE2..)".
-//! If its precise definition is not known (simply it is known as
-//! Complex, it can be recognised, but the list is produced at
-//! Write time only), StepType produces : "(..COMPLEX TYPE..)"
-class StepSelect_StepType : public IFSelect_Signature
-{
-
-public:
-
-
- //! Creates a Signature for Step Type. Protocol is undefined here,
- //! hence no Signature may yet be produced. The StepType signature
- //! requires a Protocol before working
- Standard_EXPORT StepSelect_StepType();
-
- //! Sets the StepType signature to work with a Protocol : this
- //! initialises the library
- Standard_EXPORT void SetProtocol (const Handle(Interface_Protocol)& proto);
-
- //! Returns the Step Type defined from the Protocol (see above).
- //! If <ent> is not recognised, produces "..NOT FROM SCHEMA <name>.."
- Standard_EXPORT Standard_CString Value (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(StepSelect_StepType,IFSelect_Signature)
-
-protected:
-
-
- StepData_WriterLib thelib;
-
-
-private:
-
-
- Handle(StepData_Protocol) theproto;
-
-
-};
-
-
-
-
-
-
-
-#endif // _StepSelect_StepType_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 <Interface_Check.hxx>
-#include <Interface_CheckIterator.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Macros.hxx>
-#include <Interface_ReportEntity.hxx>
-#include <Message.hxx>
-#include <Message_Messenger.hxx>
-#include <OSD_FileSystem.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 <StepFile_Read.hxx>
-#include <StepSelect_FileModifier.hxx>
-#include <StepSelect_WorkLibrary.hxx>
-
-#include <errno.h>
-IMPLEMENT_STANDARD_RTTIEXT(StepSelect_WorkLibrary,IFSelect_WorkLibrary)
-
-StepSelect_WorkLibrary::StepSelect_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
-
-
-void StepSelect_WorkLibrary::SetDumpLabel (const Standard_Integer mode)
-{
- thelabmode = mode;
-}
-
-
-Standard_Integer StepSelect_WorkLibrary::ReadFile
- (const Standard_CString name,
- Handle(Interface_InterfaceModel)& model,
- const Handle(Interface_Protocol)& protocol) const
-{
- DeclareAndCast(StepData_Protocol,stepro,protocol);
- if (stepro.IsNull()) return 1;
- Handle(StepData_StepModel) stepmodel = new StepData_StepModel;
- model = stepmodel;
- Standard_Integer aStatus = StepFile_Read(name, 0, stepmodel, stepro);
- return aStatus;
-}
-
-Standard_Integer StepSelect_WorkLibrary::ReadStream (const Standard_CString theName,
- std::istream& theIStream,
- Handle(Interface_InterfaceModel)& model,
- const Handle(Interface_Protocol)& protocol) const
-{
- DeclareAndCast(StepData_Protocol, stepro, protocol);
- if (stepro.IsNull()) return 1;
- Handle(StepData_StepModel) stepmodel = new StepData_StepModel;
- model = stepmodel;
- Standard_Integer aStatus = StepFile_Read(theName, &theIStream, stepmodel, stepro);
- return aStatus;
-}
-
-
-Standard_Boolean StepSelect_WorkLibrary::WriteFile
- (IFSelect_ContextWrite& ctx) const
-{
-// Preparation
- Message_Messenger::StreamBuffer sout = Message::SendInfo();
- DeclareAndCast(StepData_StepModel,stepmodel,ctx.Model());
- DeclareAndCast(StepData_Protocol,stepro,ctx.Protocol());
- if (stepmodel.IsNull() || stepro.IsNull()) return Standard_False;
-
- const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
- std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (ctx.FileName(), std::ios::out | std::ios::binary | std::ios::trunc);
-
- if (aStream.get() == NULL) {
- ctx.CCheck(0)->AddFail("Step File could not be created");
- sout<<" Step File could not be created : " << ctx.FileName() << std::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(StepSelect_FileModifier,filemod,ctx.FileModifier());
- if (!filemod.IsNull()) filemod->Perform(ctx,SW);
-// (impressions de mise au point)
- sout << " .. FileMod." << numod << filemod->Label();
- if (ctx.IsForAll()) sout << " (all model)";
- else sout << " (" << ctx.NbEntities() << " entities)";
-// sout << std::flush;
- }
-
-// 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 (*aStream);
- sout<<" Done"<<std::endl;
-
- errno = 0;
- aStream->flush();
- isGood = aStream->good() && isGood && !errno;
- aStream.reset();
- if(errno)
- sout << strerror(errno) << std::endl;
- return isGood;
-}
-
-
-Standard_Boolean StepSelect_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 StepSelect_WorkLibrary::DumpEntity
- (const Handle(Interface_InterfaceModel)& model,
- const Handle(Interface_Protocol)& protocol,
- const Handle(Standard_Transient)& entity,
- Standard_OStream& 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"<<std::endl; return; }
-
-// On attaque le dump : d abord cas de l Erreur
- S << " Type cdl : " << entity->DynamicType()->Name() << std::endl;
- if (iserr)
- S <<" *** NOT WELL LOADED : CONTENT FROM FILE ***"<<std::endl;
- else if (model->IsUnknownEntity(nument))
- S <<" *** UNKNOWN TYPE ***"<<std::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 _StepSelect_WorkLibrary_HeaderFile
-#define _StepSelect_WorkLibrary_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Integer.hxx>
-#include <IFSelect_WorkLibrary.hxx>
-class Interface_InterfaceModel;
-class Interface_Protocol;
-class IFSelect_ContextWrite;
-class Interface_EntityIterator;
-class Interface_CopyTool;
-
-class StepSelect_WorkLibrary;
-DEFINE_STANDARD_HANDLE(StepSelect_WorkLibrary, IFSelect_WorkLibrary)
-
-//! Performs Read and Write a STEP File with a STEP Model
-//! Following the protocols, Copy may be implemented or not
-class StepSelect_WorkLibrary : public IFSelect_WorkLibrary
-{
-
-public:
-
-
- //! Creates a STEP WorkLibrary
- //! <copymode> precises whether Copy is implemented or not
- Standard_EXPORT StepSelect_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
- Standard_EXPORT void SetDumpLabel (const Standard_Integer 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;
-
- //! Reads a STEP File from stream 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 ReadStream(const Standard_CString theName,
- std::istream& theIStream,
- 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 virtual void DumpEntity (const Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol, const Handle(Standard_Transient)& entity, Standard_OStream& S, const Standard_Integer level) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(StepSelect_WorkLibrary,IFSelect_WorkLibrary)
-
-protected:
-
-
-
-
-private:
-
-
- Standard_Boolean thecopymode;
- Standard_Integer thelabmode;
-
-
-};
-
-
-
-
-
-
-
-#endif // _StepSelect_WorkLibrary_HeaderFile
IGESDefs
IGESAppli
IGESConvGeom
-IGESSelect
IGESToBRep
GeomToIGES
Geom2dToIGES
StepToTopoDS
TopoDSToStep
STEPControl
-STEPSelections
StepAP209
RWStepAP242
StepAP242
RWStepGeom
StepShape
RWStepShape
-StepSelect
StepData
StepFile
RWHeaderSection
-APIHeaderSection
HeaderSection
\ No newline at end of file
-Interface
-Transfer
-IFGraph
-IFSelect
-TransferBRep
-XSControl
-XSAlgo
-MoniTool
+IFSelect_WorkLibrary.cxx
+IFSelect_WorkLibrary.hxx
+IFSelect_WorkSession.cxx
+IFSelect_WorkSession.hxx
XSControl_ConnectedShapes.cxx
XSControl_ConnectedShapes.hxx
XSControl_Controller.cxx
XSControl_Controller.hxx
XSControl_Reader.cxx
XSControl_Reader.hxx
+XSControl_ReturnStatus.hxx
XSControl_SelectForTransfer.cxx
XSControl_SelectForTransfer.hxx
XSControl_SignTransferStatus.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 <IFSelect_ContextWrite.hxx>
+#include <IFSelect_WorkLibrary.hxx>
+#include <Interface_CopyTool.hxx>
+#include <Interface_EntityIterator.hxx>
+#include <Interface_InterfaceModel.hxx>
+#include <Interface_Protocol.hxx>
+#include <Standard_Transient.hxx>
+#include <Standard_Type.hxx>
+#include <TCollection_HAsciiString.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(IFSelect_WorkLibrary,Standard_Transient)
+
+// all deferred but Copy (virtual default)
+IFSelect_WorkLibrary::IFSelect_WorkLibrary () { thelevdef = 0; }
+
+ 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,
+ Standard_OStream& 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();
+}
+
+Standard_Integer IFSelect_WorkLibrary::ReadStream(const Standard_CString /*name*/,
+ std::istream& /*istream*/,
+ Handle(Interface_InterfaceModel)& /*model*/,
+ const Handle(Interface_Protocol)& /*protocol*/) const
+{
+ return 1;
+}
+
--- /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>
+class Interface_InterfaceModel;
+class Interface_Protocol;
+class IFSelect_ContextWrite;
+class Interface_EntityIterator;
+class Interface_CopyTool;
+
+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 recommended 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 information 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;
+
+ //! Interface to read a data from the specified stream.
+ //! @param model is the resulting Model, which has to be created by this method.
+ //! In case of error, model must be returned Null
+ //! Return value is a status: 0 - OK, 1 - read failure, -1 - stream failure.
+ //!
+ //! Default implementation returns 1 (error).
+ Standard_EXPORT virtual Standard_Integer ReadStream (const Standard_CString theName, std::istream& theIStream,
+ Handle(Interface_InterfaceModel)& model,
+ const Handle(Interface_Protocol)& protocol) const;
+
+ //! Gives the way to Write a File from a Model.
+ //! <ctx> contains all necessary information : 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, Standard_OStream& 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, Standard_OStream& 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
+ Standard_EXPORT IFSelect_WorkLibrary();
+
+
+
+private:
+
+
+ Standard_Integer thelevdef;
+ Handle(Interface_HArray1OfHAsciiString) thelevhlp;
+
+
+};
+
+
+
+
+
+
+
+#endif // _IFSelect_WorkLibrary_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.
+
+//#1 svv 10.01.00 : porting on DEC
+//smh#14 17.03.2000 : FRA62479 Clearing of gtool
+
+#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_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_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>
+
+IMPLEMENT_STANDARD_RTTIEXT(IFSelect_WorkSession,Standard_Transient)
+
+//=======================================================================
+//function : IFSelect_WorkSession
+//purpose :
+//=======================================================================
+IFSelect_WorkSession::IFSelect_WorkSession ()
+{
+ 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 :
+//purpose :
+//=======================================================================
+
+void IFSelect_WorkSession::SetSignType (const Handle(IFSelect_Signature)& signtype)
+{
+ thegtool->SetSignType (signtype);
+ if (signtype.IsNull()) thenames.UnBind("xst-sign-type");
+ else thenames.Bind("xst-sign-type",signtype);
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Handle(IFSelect_Signature) IFSelect_WorkSession::SignType () const
+{
+ return Handle(IFSelect_Signature)::DownCast (thegtool->SignType());
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void IFSelect_WorkSession::SetShareOut
+ (const Handle(IFSelect_ShareOut)& shareout)
+{
+ theshareout = shareout;
+ thecopier->SetShareOut (theshareout);
+// ... faudrait ajouter les Params, Dispatches, etc...
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void IFSelect_WorkSession::SetModel
+ (const Handle(Interface_InterfaceModel)& model,
+ const Standard_Boolean clearpointed)
+{
+ 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);
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+IFSelect_ReturnStatus IFSelect_WorkSession::ReadFile(const Standard_CString filename)
+{
+ 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 const& anException) {
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ sout<<" **** Interruption ReadFile par Exception : ****\n";
+ sout << anException.GetMessageString();
+ sout<<"\n Abandon"<<std::endl;
+ status = IFSelect_RetFail;
+ }
+ if (status != IFSelect_RetDone) return status;
+ if (model.IsNull()) return IFSelect_RetVoid;
+ SetModel (model);
+ SetLoadedFile (filename);
+ return status;
+}
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+IFSelect_ReturnStatus IFSelect_WorkSession::ReadStream(const Standard_CString theName,
+ std::istream& theIStream)
+{
+ 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->ReadStream(theName, theIStream, model, theprotocol);
+ if (stat == 0) status = IFSelect_RetDone;
+ else if (stat < 0) status = IFSelect_RetError;
+ else status = IFSelect_RetFail;
+ }
+ catch (Standard_Failure const& anException) {
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ sout << " **** Interruption ReadFile par Exception : ****\n";
+ sout << anException.GetMessageString();
+ sout << "\n Abandon" << std::endl;
+ status = IFSelect_RetFail;
+ }
+ if (status != IFSelect_RetDone) return status;
+ if (model.IsNull()) return IFSelect_RetVoid;
+ SetModel(model);
+ SetLoadedFile(theName);
+ return status;
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Standard_Integer IFSelect_WorkSession::NbStartingEntities () const
+{
+ return (myModel.IsNull()? 0 : myModel->NbEntities());
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Handle(Standard_Transient) IFSelect_WorkSession::StartingEntity (const Standard_Integer num) const
+{
+ Handle(Standard_Transient) res; // Null par defaut
+ if (myModel.IsNull()) return res;
+ if (num < 1 || num > myModel->NbEntities()) return res;
+ return myModel->Value(num);
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Standard_Integer IFSelect_WorkSession::StartingNumber (const Handle(Standard_Transient)& ent) const
+{
+ return (myModel.IsNull()? 0 : myModel->Number(ent));
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Standard_Integer IFSelect_WorkSession::NumberFromLabel
+ (const Standard_CString val, const Standard_Integer afternum) const
+{
+ Standard_Integer i, cnt = 0, num = atoi(val);
+ if (num > 0 || myModel.IsNull()) return num; // un n0 direct : gagne !
+// Sinon, on considere que c est un label; a traiter en CaseNonSensitive ...
+ if (num > myModel->NbEntities()) { num = 0; return num; }
+ Standard_Boolean exact = Standard_False;
+ Standard_Integer after = (afternum >= 0 ? afternum : -afternum);
+ for (i = myModel->NextNumberForLabel (val, after, exact) ; i != 0;
+ i = myModel->NextNumberForLabel (val, i, exact)) {
+ cnt ++;
+ if (num <= 0) num = i;
+ }
+ if (cnt == 1) return num;
+ num = -num;
+
+ return num;
+}
+
+
+//=======================================================================
+//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 :
+//=======================================================================
+
+Handle(TCollection_HAsciiString) IFSelect_WorkSession::EntityName (const Handle(Standard_Transient)& ent) const
+{
+ if (myModel.IsNull() || ent.IsNull()) return 0;
+ Interface_ShareTool sht(thegraph->Graph());
+
+ Standard_Integer CN;
+ Handle(Interface_GeneralModule) module;
+ if (!thegtool->Select (ent,module,CN)) return 0;
+ return module->Name (CN,ent,sht);
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Standard_Integer IFSelect_WorkSession::CategoryNumber (const Handle(Standard_Transient)& ent) const
+{
+ return (myModel.IsNull()? -1 : myModel->CategoryNumber(StartingNumber(ent)));
+}
+
+
+//=======================================================================
+//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 :
+//=======================================================================
+
+void IFSelect_WorkSession::ClearData (const Standard_Integer mode)
+{
+ 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; }
+ default : break;
+ }
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Standard_Boolean IFSelect_WorkSession::ComputeGraph
+ (const Standard_Boolean enforce)
+{
+ 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;
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Handle(Interface_HGraph) IFSelect_WorkSession::HGraph ()
+{
+ ComputeGraph();
+ return thegraph;
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+const Interface_Graph& IFSelect_WorkSession::Graph ()
+{
+ ComputeGraph();
+ if (thegraph.IsNull()) throw Standard_DomainError("IFSelect WorkSession : Graph not available");
+ return thegraph->Graph();
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::Shareds
+ (const Handle(Standard_Transient)& ent)
+{
+ Handle(TColStd_HSequenceOfTransient) list;
+ if (!ComputeGraph()) return list;
+ if (StartingNumber(ent) == 0) return list;
+ return thegraph->Graph().Shareds(ent).Content();
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+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();
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Standard_Boolean IFSelect_WorkSession::IsLoaded () const
+{
+ 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;
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Standard_Boolean IFSelect_WorkSession::ComputeCheck
+ (const Standard_Boolean enforce)
+{
+ 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);
+ }
+ for (num = 1; num <= nb; num ++)
+ if (myModel->IsErrorEntity (num)) BM.SetTrue (num,Flag_Incorrect);
+ }
+ return Standard_True;
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Interface_CheckIterator IFSelect_WorkSession::ModelCheckList
+ (const Standard_Boolean complete)
+{
+ 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();
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Handle(Standard_Transient) IFSelect_WorkSession::Item
+ (const Standard_Integer id) const
+{
+ Handle(Standard_Transient) res;
+ if (id <= 0 || id > MaxIdent()) return res;
+ if (theitems.FindFromIndex(id).IsNull()) return res;
+ return theitems.FindKey(id);
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Standard_Integer IFSelect_WorkSession::ItemIdent
+ (const Handle(Standard_Transient)& item) const
+{
+ if (item.IsNull()) return 0;
+ Standard_Integer id = theitems.FindIndex(item);
+ if (id == 0) return 0;
+ if (theitems.FindFromIndex(id).IsNull()) return 0;
+ return id;
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Handle(Standard_Transient) IFSelect_WorkSession::NamedItem
+ (const Standard_CString name) const
+{
+ Handle(Standard_Transient) res;
+ if (name[0] == '\0') return res;
+ if (name[0] == '#') { // #nnn : pas un nom mais un n0 id.
+ Standard_Integer id = atoi( &name[1] );
+ return Item(id);
+ }
+ if (!thenames.Find(name,res))
+ res.Nullify();
+ return res;
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Handle(Standard_Transient) IFSelect_WorkSession::NamedItem
+ (const Handle(TCollection_HAsciiString)& name) const
+{
+ Handle(Standard_Transient) res;
+ if (!name.IsNull()) res = NamedItem (name->ToCString());
+ return res;
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Standard_Integer IFSelect_WorkSession::NameIdent
+ (const Standard_CString name) const
+{
+ Handle(Standard_Transient) res;
+ if (name[0] == '\0') return 0;
+ if (name[0] == '#') { // #nnn : pas un nom mais un n0 id.
+ Standard_Integer id = atoi( &name[1] );
+ return id;
+ }
+ if (!thenames.Find(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')
+ thenames.Bind(name, 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.UnBind(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.UnBind
+ (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);
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Handle(TCollection_HAsciiString) IFSelect_WorkSession::ItemLabel
+ (const Standard_Integer id) const
+{
+ Handle(TCollection_HAsciiString) res;
+ Handle(Standard_Transient) var = Item(id);
+ if (var.IsNull()) return res;
+ DeclareAndCast(TCollection_HAsciiString,text,var);
+ if (!text.IsNull()) {
+ res = new TCollection_HAsciiString("Text:");
+ res->AssignCat(text);
+ return res;
+ }
+ DeclareAndCast(IFSelect_IntParam,intpar,var);
+ if (!intpar.IsNull()) {
+ res = new TCollection_HAsciiString(intpar->Value());
+ res->Insert(1,"Integer:");
+ return res;
+ }
+ DeclareAndCast(IFSelect_Selection,sel,var);
+ if (!sel.IsNull()) {
+ res = new TCollection_HAsciiString("Selection:");
+ 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(slc->Name());
+ return res;
+ }
+ DeclareAndCast(IFSelect_Signature,sig,var);
+ if (!sig.IsNull()) {
+ res = new TCollection_HAsciiString("Signature:");
+ 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;
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Handle(TColStd_HSequenceOfInteger) IFSelect_WorkSession::ItemIdents
+ (const Handle(Standard_Type)& type) const
+{
+ Handle(TColStd_HSequenceOfInteger) list =
+ new TColStd_HSequenceOfInteger();
+ Standard_Integer nb = theitems.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();
+ NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator IT(thenames);
+ for (; IT.More(); IT.Next()){
+ if (IT.Value()->IsKind(type)) list->Append
+ (new TCollection_HAsciiString(IT.Key()));
+ }
+ 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));
+ }
+ 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
+{ return Handle(IFSelect_IntParam)::DownCast(Item(id)); }
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Standard_Integer IFSelect_WorkSession::IntValue
+ (const Handle(IFSelect_IntParam)& par) const
+{
+ if (!par.IsNull()) return par->Value();
+ else return 0;
+}
+
+
+//=======================================================================
+//function :
+//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)
+{
+ if (ItemIdent(par) == 0) return Standard_False;
+ par->SetValue(val);
+ return Standard_True;
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Handle(TCollection_HAsciiString) IFSelect_WorkSession::TextParam
+ (const Standard_Integer id) const
+{ return Handle(TCollection_HAsciiString)::DownCast(Item(id)); }
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+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)
+{
+ if (ItemIdent(par) == 0) return Standard_False;
+ par->Clear(); par->AssignCat(val);
+ return Standard_True;
+}
+
+// ########################################################################
+// .... SIGNATURES ....
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+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
+{
+ if (sign.IsNull() || myModel.IsNull()) return "";
+ if (StartingNumber(ent) == 0) return "";
+ return sign->Value (ent,myModel);
+}
+
+// ########################################################################
+// .... SELECTIONS & Cie ....
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Handle(IFSelect_Selection) IFSelect_WorkSession::Selection
+ (const Standard_Integer id) const
+{ return GetCasted(IFSelect_Selection,Item(id)); }
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Interface_EntityIterator IFSelect_WorkSession::EvalSelection
+ (const Handle(IFSelect_Selection)& sel) const
+{
+ Interface_EntityIterator iter;
+ if (errhand) {
+ errhand = Standard_False;
+ try {
+ OCC_CATCH_SIGNALS
+ iter = EvalSelection(sel); // appel normal (donc, code pas duplique)
+ }
+ catch (Standard_Failure const& anException) {
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ sout<<" **** Interruption EvalSelection par Exception : ****\n";
+ sout<<anException.GetMessageString();
+ sout<<"\n Abandon"<<std::endl;
+ }
+ errhand = theerrhand;
+ return iter;
+ }
+
+ if (thegraph.IsNull()) return iter;
+ iter = sel->UniqueResult(thegraph->Graph());
+ return iter;
+}
+
+
+//=======================================================================
+//function :
+//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) res;
+ if (errhand) {
+ errhand = Standard_False;
+ try {
+ OCC_CATCH_SIGNALS
+ res = SelectionResult(sel); // appel normal (->code unique)
+ }
+ catch (Standard_Failure const& anException) {
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ sout<<" **** Interruption SelectionResult par Exception : ****\n";
+ sout<<anException.GetMessageString();
+ sout<<"\n Abandon"<<std::endl;
+ }
+ errhand = theerrhand;
+ return res;
+ }
+
+ if (!IsLoaded()) {
+ std::cout<< " *** Data for Evaluation not available ***"<<std::endl;
+ return new TColStd_HSequenceOfTransient();
+ }
+// if (ItemIdent(sel) == 0)
+ if (sel.IsNull())
+ { std::cout << " Selection : Unknown"<<std::endl; return res; } //std::cout<<Handle
+ return EvalSelection (sel).Content();
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::SelectionResultFromList
+ (const Handle(IFSelect_Selection)& sel,
+ const Handle(TColStd_HSequenceOfTransient)& list) const
+{
+ if (list.IsNull()) return SelectionResult (sel);
+ DeclareAndCast(IFSelect_SelectDeduct,deduct,sel);
+ if (deduct.IsNull()) return SelectionResult (sel);
+
+// On va chercher la derniere deduction de la chaine des inputs
+ Handle(IFSelect_Selection) ssel, newinput;
+ ssel = sel;
+ Standard_Integer i, nb = MaxIdent();
+ for (i = 1; i <= nb * 2; i ++) {
+ newinput = deduct->Input();
+ deduct = GetCasted(IFSelect_SelectDeduct,newinput);
+ if (deduct.IsNull()) break;
+ ssel = newinput;
+ }
+
+// on y est (enfin, on devrait)
+// ssel est la derniere selection auscultee, deduct son downcast
+// input son Input (nulle si sel pas une deduction)
+ deduct = GetCasted(IFSelect_SelectDeduct,ssel);
+
+ deduct->Alternate()->SetList (list);
+
+// On execute puis on nettoie
+ Handle(TColStd_HSequenceOfTransient) res = SelectionResult (sel);
+//// deduct->SetInput (newinput);
+ 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 ....
+
+//=======================================================================
+//function :
+//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)) {
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ sout<<" ** RunTransformer has produced Check Messages : **"<<std::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 :
+//=======================================================================
+
+Standard_CString IFSelect_WorkSession::GiveFileRoot
+ (const Standard_CString file) const
+{
+ OSD_Path path (file);
+ if (!path.IsValid(TCollection_AsciiString(file))) return file; // tant pis ..
+ bufstr = path.Name();
+ return bufstr.ToCString();
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Standard_CString IFSelect_WorkSession::GiveFileComplete
+ (const Standard_CString file) const
+{
+// ajouter si besoin : Prefix; Extension
+ bufstr.Clear(); bufstr.AssignCat (file);
+ Standard_Integer i,j = 0,nb = bufstr.Length();
+ Handle(TCollection_HAsciiString) ext = FileExtension ();
+ if (!ext.IsNull()) {
+ char val0 = '\0'; if (ext->Length() > 0) val0 = ext->Value(1);
+ for (i = nb; i > 0; i --) if (bufstr.Value(i) == val0) { j = 1; break; }
+ if (j == 0) bufstr.AssignCat (ext->ToCString());
+ }
+ Handle(TCollection_HAsciiString) pre = FilePrefix ();
+ if (!pre.IsNull()) {
+ char val1 = '\0'; if (pre->Length() > 0) val1 = pre->Value(pre->Length());
+ j = 0;
+ for (i = nb; i > 0; i --) if (bufstr.Value(i) == val1) { j = 1; break; }
+ if (j == 0) bufstr.Insert (1,pre->ToCString());
+ }
+
+ return bufstr.ToCString();
+}
+
+
+//=======================================================================
+//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 const& anException) {
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ sout<<" **** Interruption EvaluateFile par Exception : ****\n";
+ sout<<anException.GetMessageString();
+ sout<<"\n Abandon"<<std::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)) {
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ sout<<" ** EvaluateFile has produced Check Messages : **"<<std::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 const& anException) {
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ sout<<" **** Interruption SendSplit par Exception : ****\n";
+ sout<<anException.GetMessageString();
+ sout<<"\n Abandon"<<std::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()) {
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ sout<< " *** Data for SendSplit not available ***"<<std::endl;
+ checks.CCheck(0)->AddFail("Data not available");
+ thecheckrun = checks;
+ return Standard_False;
+ }
+
+ if (NbFiles() > 0) checks = thecopier->SendCopied (thelibrary,theprotocol);
+ else {
+ /*
+ IFSelect_ShareOutResult eval (ShareOut(), thegraph->Graph());
+ checks = thecopier->Send (eval, thelibrary, theprotocol);
+ thecopier->SetRemaining (thegraph->CGraph());
+ */
+// Decomposer
+ if (theshareout.IsNull()) return Standard_False;
+ Standard_Integer i, nbd = theshareout->NbDispatches();
+ Standard_Integer nf = 0;
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ 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) std::cout<<"File "<<filnam<<" failed"<<std::endl;
+ }
+ }
+ sout<<" .. Files Written : "<<nf<<std::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)
+{
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ 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"<<std::endl; return Standard_False;
+ } else if (newmod == myModel) {
+ sout<<" Remaining causes all original data to be kept"<<std::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"<<std::endl; return Standard_True;
+ }
+ Interface_EntityIterator iter = SentList(0);
+ nb = iter.NbEntities();
+ if (nb == 0) {
+ sout<<" - No recorded remaining entities"<<std::endl; return Standard_True;
+ }
+ sout <<" -- Recorded Remaining (not yet sent) Entities --"<<std::endl;
+ ListEntities (iter, 2, sout);
+ sout << " -- Maximum Sending Count (i.e. duplication in files) "<<
+ MaxSendingCount() << std::endl;
+
+/*
+ sout<< " - Now, dispatches are deactivated"<<std::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 const& anException) {
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ sout<<" **** Interruption SendAll par Exception : ****\n";
+ sout<<anException.GetMessageString();
+ sout<<"\n Abandon"<<std::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 const& anException) {
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ sout<<" **** Interruption SendSelected par Exception : ****\n";
+ sout<<anException.GetMessageString();
+ sout<<"\n Abandon"<<std::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;
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Handle(IFSelect_Selection) IFSelect_WorkSession::NewSelectPointed
+ (const Handle(TColStd_HSequenceOfTransient)& list,
+ const Standard_CString name)
+{
+ Handle(IFSelect_SelectPointed) sel = new IFSelect_SelectPointed;
+ if (!list.IsNull()) sel->AddList (list);
+ if (AddNamedItem (name,sel) == 0) sel.Nullify();
+ return sel;
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Standard_Boolean IFSelect_WorkSession::SetSelectPointed
+ (const Handle(IFSelect_Selection)& sel,
+ const Handle(TColStd_HSequenceOfTransient)& list,
+ const Standard_Integer mode) const
+{
+ DeclareAndCast(IFSelect_SelectPointed,sp,sel);
+ if (sp.IsNull() || list.IsNull()) return Standard_False;
+ if (mode == 0) sp->Clear();
+ if (mode >= 0) sp->AddList(list);
+ else sp->RemoveList(list);
+ 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;
+}
+
+
+//=======================================================================
+//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 ...
+}
+
+// ###########################################################################
+// .... Dumps et Evaluations, pas faciles a passer en arguments ....
+
+// #### #### #### #### #### #### #### #### ####
+// .... DumpShare ....
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void IFSelect_WorkSession::SetParams
+ (const NCollection_Vector<Handle(Standard_Transient)>& params,
+ const NCollection_Vector<Standard_Integer>& uselist)
+{
+ 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);
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void IFSelect_WorkSession::TraceStatics
+ (const Standard_Integer use, const Standard_Integer mode) const
+{
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ if (use > 0) {
+ if (mode == 0) sout<<"******************************************"<<std::endl;
+ if (use == 1) {
+ if (mode == 0) sout<<"***** General Parameters *****"<<std::endl;
+ } else if (use == 2) {
+ if (mode == 0) sout<<"***** Load File *****"<<std::endl;
+ } else if (use == 3) {
+ if (mode == 0) sout<<"***** Write File *****"<<std::endl;
+ } else if (use == 4) {
+ if (mode == 0) sout<<"***** Split File *****"<<std::endl;
+ } else if (use == 5) {
+ if (mode == 0) sout<<"***** Transfer (Read) *****"<<std::endl;
+ } else if (use == 6) {
+ if (mode == 0) sout<<"***** Transfer (Write) *****"<<std::endl;
+ }
+ if (mode == 0) sout<<"******************************************"<<std::endl<<std::endl;
+ }
+
+// Echainements particuliers (use > 0)
+ if (use == 5) {
+ TraceStatics (-2,mode);
+ if (mode == 0) sout<<std::endl;
+ } else if (use == 4 || use == 6) {
+ TraceStatics (-3,mode);
+ if (mode == 0) sout<<std::endl;
+ }
+
+// Valeurs particulieres
+ if (use == 1 || use == -1) { // General : trace
+ if (mode == 0) {
+// sout << "Trace Level : "<<Message_PrinterOStream::Default()->GetTraceLevel()<<std::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()<<std::endl;
+ else sout << "Prefix not Defined" << std::endl;
+ str = theshareout->DefaultRootName();
+ if (!str.IsNull()) sout << "Default Root : "<<str->ToCString()<<std::endl;
+ else sout << "Default Root not Defined" << std::endl;
+ str = theshareout->Extension();
+ if (!str.IsNull()) sout << "Extension : "<<str->ToCString()<<std::endl;
+ else sout << "Extension not defined" << std::endl;
+ }
+ }
+
+// LISTER LES STATICS
+// Passer par les ParamEditor ...
+
+// Fin
+ if (use > 0) {
+ if (mode == 0) sout<<"******************************************"<<std::endl<<std::endl;
+ }
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void IFSelect_WorkSession::DumpShare () const
+{
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ sout<<" ********** Definition ShareOut (Complete) **********"<<std::endl;
+
+ Handle(TCollection_HAsciiString) str = theshareout->Prefix();
+ if (!str.IsNull()) sout << "Prefix : " << str->ToCString() << std::endl;
+ else sout << "Prefix not Defined" << std::endl;
+ str = theshareout->DefaultRootName();
+ if (!str.IsNull()) sout << "Default Root : " << str->ToCString() << std::endl;
+ else sout << "Default Root not Defined" << std::endl;
+ str = theshareout->Extension();
+ if (!str.IsNull()) sout << "Extension : " << str->ToCString() << std::endl;
+ else sout << "Extension not defined" << std::endl;
+
+ Standard_Integer lr = theshareout->LastRun();
+ Standard_Integer nb = theshareout->NbDispatches();
+ sout << "Nb Dispatches : " << nb <<" (Last Run : " << lr << ") : "<<std::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() << std::endl;
+ Handle(IFSelect_Selection) sel = disp->FinalSelection();
+ if (sel.IsNull()) sout << " No Final Selection Defined" << std::endl;
+ else if (HasName(sel)) sout << " Final Selection : Name:"
+ << Name(sel)->ToCString() << " Label:" << sel->Label() << std::endl;
+ else sout << " Final Selection : " << sel->Label() << std::endl;
+ if (disp->HasRootName())
+ sout<<" File Root Name : "<<disp->RootName()->ToCString()<<std::endl;
+ else sout<<" No specific file root name (see Default Root)"<<std::endl;
+ }
+ Standard_Integer nbm = theshareout->NbModifiers(Standard_True);
+ if (nbm > 0) sout<<
+ " *** "<<nbm<<" active Model Modifiers : see ListModifiers ***"<<std::endl;
+ Standard_Integer nbf = theshareout->NbModifiers(Standard_False);
+ if (nbf > 0) sout<<
+ " *** "<<nbf<<" active File Modifiers : see ListModifiers ***"<<std::endl;
+ if (nbm+nbf == 0) sout<<" *** No active Modifiers ***"<<std::endl;
+}
+
+// #### #### #### #### #### #### #### #### ####
+// .... ListItems ....
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void IFSelect_WorkSession::ListItems (const Standard_CString lab) const
+{
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ sout<< " ********** Items in Session **********"<<std::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()<<std::endl<<" "<<label->ToCString()<<std::endl;
+ }
+}
+
+// #### #### #### #### #### #### #### #### ####
+// .... ListModifiers
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void IFSelect_WorkSession::ListFinalModifiers
+ (const Standard_Boolean formodel) const
+{
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ Standard_Integer nb = theshareout->NbModifiers(formodel);
+ sout<< " ********** Modifiers in Session ";
+ sout<<(formodel ? "(For Model)" : "(For File)");
+ sout<<": "<<nb<<" **********"<<std::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<<std::endl;
+ }
+}
+
+// #### #### #### #### #### #### #### #### ####
+// .... DumpSelection ....
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void IFSelect_WorkSession::DumpSelection
+ (const Handle(IFSelect_Selection)& sel) const
+{
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ if (ItemIdent(sel) == 0) {
+ sout << "Selection : Unknown"<<std::endl; //sout<<Handle
+ return;
+ }
+ sout << " ********** Selection";
+ if (HasName(sel)) sout << " , Name : " << Name(sel)->ToCString();
+ sout <<" **********"<<std::endl;
+ sout<< "Label : " << sel->Label() << " . Input(s) : "<< std::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()<<std::endl;
+ }
+ sout << " Nb Inputs:"<<nb<<std::endl;
+}
+
+
+// ##########################################
+// ######### Fonctions complementaires
+// ##########################################
+
+// #### #### #### #### #### #### #### #### ####
+// .... DumpModel ....
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Handle(IFSelect_Selection) IFSelect_WorkSession::GiveSelection
+ (const Standard_CString selname) const
+{
+ char nomsel[500];
+ Standard_Integer np = -1, nf = -1, nivp = 0;
+ for (Standard_Integer n = 0; selname[n] != '\0'; n ++) {
+ nomsel[n] = selname[n]; nomsel[n+1] = '\0';
+ if (selname[n] == '(') { np = n; nivp ++; }
+ if (selname[n] == ')') { nivp --; if (nivp <= 0) nf = n; }
+//// if (selname[n] == ' ') { nb = n; break; }
+ }
+
+ Handle(IFSelect_Selection) sel;
+ if (np >= 0)
+ {
+ nomsel[np] = 0;
+ }
+ if (nf >= 0)
+ {
+ nomsel[nf] = '\0';
+ }
+ Handle(Standard_Transient) item = NamedItem(nomsel);
+
+// Parentheses ? essayer Signature (plus tard : Selection parametree)
+// NB : on compte les niveaux de parentheses (imbrications repercutees)
+ if (np > 0 && nf > 0) {
+ Handle(IFSelect_SelectSignature) selsign;
+ Standard_Integer debsign = np+1;
+
+ DeclareAndCast(IFSelect_Signature,sign,item);
+ DeclareAndCast(IFSelect_SignCounter,cnt,item);
+ if (!sign.IsNull()) selsign =
+ new IFSelect_SelectSignature (sign,&nomsel[debsign],Standard_False);
+ else if (!cnt.IsNull()) selsign =
+ new IFSelect_SelectSignature (cnt,&nomsel[debsign],Standard_False);
+ else {
+ std::cout<<selname<<" : neither Signature nor Counter"<<std::endl;
+ return sel;
+ }
+
+ selsign->SetInput (new IFSelect_SelectModelEntities); // par defaut
+ sel = selsign;
+ }
+
+ else sel = GetCasted(IFSelect_Selection,item);
+
+ return sel;
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveList
+ (const Handle(Standard_Transient)& obj) const
+{
+// Deja une liste
+ DeclareAndCast(TColStd_HSequenceOfTransient,list,obj);
+ if (!list.IsNull()) return list;
+
+// Rien du tout : retourne rien du tout
+ if (obj.IsNull()) return list;
+
+// Une selection : son resultat (standard)
+ DeclareAndCast(IFSelect_Selection,sel,obj);
+ if (!sel.IsNull()) {
+ Interface_EntityIterator iter = EvalSelection(sel);
+ return iter.Content();
+ }
+
+// Le modele : son contenu
+ list = new TColStd_HSequenceOfTransient();
+ if (obj == myModel) {
+ Standard_Integer i, nb = myModel->NbEntities();
+ for (i = 1; i <= nb; i ++) list->Append (myModel->Value(i));
+ }
+
+// Une entite du modele : cette entite
+ else if (StartingNumber(obj) > 0) list->Append (obj);
+
+// Un Texte : son interpretation
+ else {
+ DeclareAndCast(TCollection_HAsciiString,str,obj);
+ if (!str.IsNull()) return GiveList (str->ToCString());
+ }
+
+// Si c est pas tout ca : une liste vide
+ return list;
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+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;
+ if (first[0] == ' ') return GiveList (&first[1],second);
+ if (second && second[0] == ' ') return GiveList (first,&second[1]);
+
+// list NULLE sera interpretee comme SelectionResult (selection toute crue)
+// sinon comme SelectionResultFromList
+ if (second && second[0] != '\0') list = GiveList (second,"");
+
+ list = GiveListFromList (first,list);
+ return list;
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveListFromList
+ (const Standard_CString selname, const Handle(Standard_Transient)& ent) const
+{
+ Handle(TColStd_HSequenceOfTransient) list;
+ Standard_Integer num;
+
+// LISTE DEFINIE D OFFICE (en ce cas, la liste d entree est ignoree)
+ if (selname[0] == '(') {
+// liste d entites donnees a la queue leu leu : (ID,ID,ID...)
+ char entid[50]; Standard_Integer i,j = 0;
+ TColStd_MapOfInteger numap;
+ list = new TColStd_HSequenceOfTransient();
+ for (i = 1; selname[i] != '\0'; i ++) {
+ if (selname[i] == ' ') continue;
+ if (selname[i] == ',' || selname[i] == ')') {
+ entid[j] = '\0';
+ if (j == 0) continue;
+ j = 0;
+ num = NumberFromLabel (entid);
+ if (num <= 0 || !numap.Add (num)) continue;
+ Handle(Standard_Transient) anent = StartingEntity(num);
+ if (!anent.IsNull()) list->Append (anent);
+ if (selname[i] == ')') break;
+ continue;
+ }
+ entid[j] = selname[i]; j ++;
+ }
+ return list;
+ }
+ num = NumberFromLabel (selname);
+ if (num > 0) return GiveList(StartingEntity(num));
+
+// Autres cas : y atil une liste d entree.
+// Si OUI -> SelectionResultFromList. Si NON -> SelectionResult
+// Si une entite isolee -> on en fait une liste
+
+ list = GiveList(ent); // ent NULL -> list NULL sinon intreprete
+
+// Decomposition term1 term2 ...
+
+ char nomsel[500]; nomsel[0] = '\0';
+ Standard_Integer n= 0 , nb = -1;
+ for (n = 0; selname[n] != '\0'; n ++) {
+ nomsel[n] = selname[n]; nomsel[n+1] = '\0';
+// if (selname[n] == '(') { np = n; nivp ++; }
+// if (selname[n] == ')') { nivp --; if (nivp <= 0) nf = n; }
+ if (selname[n] == ' ') { nb = n; nomsel[n] = '\0'; break; }
+ }
+ if (nomsel[0] == '\0') return list;
+
+ Handle(IFSelect_Selection) sel = GiveSelection (nomsel);
+ if (sel.IsNull()) {
+ std::cout<<"Neither Entity Number/Label nor Selection :"<<nomsel<<std::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 :
+//=======================================================================
+
+Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveListCombined
+ (const Handle(TColStd_HSequenceOfTransient)& l1,
+ const Handle(TColStd_HSequenceOfTransient)& l2,
+ const Standard_Integer mode) 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);
+ }
+
+// 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);
+ }
+ }
+
+ list->Reverse();
+ return list;
+}
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void IFSelect_WorkSession::DumpModel
+ (const Standard_Integer level, Standard_OStream& S)
+{
+ if (!IsLoaded())
+ { S << " *** Data for List not available ***"<<std::endl; return; }
+ S << "\n *****************************************************************\n";
+ if (theloaded.Length() > 0)
+ S << " ******** Loaded File : "<<theloaded.ToCString()<<Interface_MSG::Blanks(32-theloaded.Length())<<" ********"<<std::endl;
+ else S << " ******** No name for Loaded File"<<std::endl;
+ if (level == 0) {
+ S <<" ******** Short Dump of Header ********\n";
+ S << " *****************************************************************\n\n";
+ myModel->DumpHeader (S); S <<std::endl;
+ }
+
+ Standard_Integer nbent = myModel->NbEntities();
+ Standard_Integer nbr = 0;
+ Interface_ShareFlags shar(thegraph->Graph());
+
+ for (Standard_Integer i = 1; i <= nbent; i ++) {
+ if (!shar.IsShared(myModel->Value(i))) nbr ++;
+ }
+ S << " *****************************************************************\n"
+ << " ******** Model : "<<nbent<<" Entities, of which "<<nbr<<" Root(s)\n"
+ << " *****************************************************************\n"<<std::endl;
+
+ if (level <= 0) return;
+ else if (level == 1) {
+ S <<" ******** Root Entities ******** ";
+ ListEntities (shar.RootEntities(), 1, S);
+ } else if (level == 2) {
+ S <<" ******** Complete List ******** ";
+ ListEntities (myModel->Entities(), 1, S);
+ } else if (level > 2) {
+ IFSelect_PrintCount mode = IFSelect_ItemsByEntity;
+ if (level == 5 || level == 8) mode = IFSelect_CountByItem;
+ if (level == 6 || level == 9) mode = IFSelect_ListByItem;
+ if (level == 7 || level == 10) mode = IFSelect_EntitiesByItem;
+ PrintCheckList (S, ModelCheckList(),Standard_False, mode);
+ } else {
+ if (level == 3) S << " ******** Check Model (Fails) ********"<<std::endl;
+ else S << " ******** Check Model (Complete) ********"<<std::endl;
+ Interface_CheckTool CT (Graph());
+ Interface_CheckIterator C;
+ if (theerrhand) {
+ try {
+ OCC_CATCH_SIGNALS
+ if (level == 3) C = CT.CheckList();
+ else C = CT.CompleteCheckList();
+ }
+ catch (Standard_Failure const&) {
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ sout<<" **** Interruption DumpModel (Check) par Exception ****\n";
+ S <<" ** ** Exception Raised during Check ! ** **\n";
+ S <<" --> what could be determined is listed"<<std::endl;
+ }
+ }
+ else if (level == 3) C = CT.CheckList();
+ else C = CT.CompleteCheckList();
+
+// Check List : si vide (pas demandee), naturellement passee
+ try {
+ OCC_CATCH_SIGNALS
+ C.Print(S,myModel, (level == 3));
+ }
+ catch (Standard_Failure const& anException) {
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ sout<<" **** Interruption DumpModel par Exception : ****\n";
+ sout<<anException.GetMessageString();
+ sout<<"\n Abandon"<<std::endl;
+ }
+
+ }
+ S <<std::endl<<"There are "<<nbent<<" Entities, of which "<<nbr<<" Root(s)"<<std::endl;
+}
+
+// .... TraceDumpModel .... (Model + CheckList)
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void IFSelect_WorkSession::TraceDumpModel
+ (const Standard_Integer mode)
+{
+ Message_Messenger::StreamBuffer sout = Message::SendInfo(); // should it be changed to SendTrace()?
+ 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,
+ Standard_OStream& S) const
+{
+ if (!IsLoaded())
+ { S << " *** Data for List not available ***"<<std::endl; return; }
+ Standard_Integer num = myModel->Number(ent);
+ if (num == 0) { S <<" *** Entity to Dump not in the Model ***"<<std::endl; return; }
+ if (thelibrary.IsNull()) { S <<" *** WorkLibrary not defined ***"<<std::endl; return; }
+ S << " ******** Dumping Entity n0 "<<num
+ <<" level:"<<level<<" ********"<<std::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
+{
+ Message_Messenger::StreamBuffer sout = Message::SendInfo(); // should it be changed to SendTrace()?
+ DumpEntity (ent, level, sout);
+}
+
+// .... PrintEntityStatus ....
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void IFSelect_WorkSession::PrintEntityStatus
+ (const Handle(Standard_Transient)& ent, Standard_OStream& S)
+{
+ Standard_Integer i,nb;
+ Standard_Integer num = StartingNumber(ent);
+ if (num == 0) { std::cout<<" -- PrintEntityStatus : unknown"<<std::endl; return; }
+
+ S <<" Ent. n0/id: ";
+ myModel->Print (ent, S);
+ Handle(TCollection_HAsciiString) hname = EntityName(ent);
+ if (!hname.IsNull() && hname->Length() > 0) S <<" Name:"<<hname->ToCString();
+ S <<std::endl;
+ Handle(IFSelect_Signature) signtype = SignType();
+ if (signtype.IsNull()) S <<" Type(CDL):"<<ent->DynamicType()->Name()<<std::endl;
+ else S <<" Type:"<<signtype->Value (ent,myModel)<<std::endl;
+ S <<" Category : " <<CategoryName (ent)
+ <<" Validity : " <<ValidityName (ent) << std::endl;
+ Interface_CheckIterator chl = CheckOne (ent);
+ chl.Print (S,myModel,Standard_False,Standard_False);
+
+ Handle(TColStd_HSequenceOfTransient) list = Sharings(ent);
+ if (list.IsNull()) S <<" Root"<<std::endl;
+ else {
+ nb = list->Length();
+ if (nb == 0) S <<" Root";
+ else S <<" Super-entities:"<<nb<<" : (n0/id):";
+ for (i = 1; i <= nb; i ++) { S <<" "; myModel->Print(list->Value(i), S); }
+ S <<std::endl;
+ }
+ list = Shareds (ent);
+ if (list.IsNull()) S <<" No sub-entity"<<std::endl;
+ else {
+ nb = list->Length();
+ if (nb == 0) S <<" No sub-entity";
+ else S <<" Sub-entities:"<<nb<<" , i.e. (n0/id):";
+ for (i = 1; i <= nb; i ++) { S <<" "; myModel->Print(list->Value(i), S); }
+ S <<std::endl;
+ }
+}
+
+// .... PrintCheckList ....
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void IFSelect_WorkSession::PrintCheckList (Standard_OStream& S,
+ const Interface_CheckIterator& checklist,
+ const Standard_Boolean failsonly,
+ const IFSelect_PrintCount mode) const
+{
+// mode : 0 comptage 1 n0s entites 2 n0s+id ents
+ if (mode == IFSelect_ItemsByEntity) checklist.Print (S,myModel,failsonly);
+ else {
+ Interface_CheckIterator chks = checklist;
+ Handle(IFSelect_CheckCounter) counter =
+ new IFSelect_CheckCounter (mode>1 && mode != IFSelect_CountSummary);
+ counter->Analyse (chks,myModel,Standard_True,failsonly);
+ counter->PrintList (S, myModel, mode);
+ }
+}
+
+// .... PrintSignatureList ....
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void IFSelect_WorkSession::PrintSignatureList (Standard_OStream& S,
+ const Handle(IFSelect_SignatureList)& signlist,
+ const IFSelect_PrintCount mode) const
+{
+ if (signlist.IsNull()) return;
+ signlist->PrintList (S, myModel, mode);
+}
+
+// #### #### #### #### #### #### #### #### ####
+// .... EvaluateSelection ....
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void IFSelect_WorkSession::EvaluateSelection
+ (const Handle(IFSelect_Selection)& sel) const
+{
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ if (errhand) {
+ errhand = Standard_False;
+ try {
+ OCC_CATCH_SIGNALS
+ EvaluateSelection(sel); // appel normal (->code unique)
+ }
+ catch (Standard_Failure const& anException) {
+ sout<<" **** Interruption EvaluateSelection par Exception **** Intitule\n";
+ sout<<anException.GetMessageString();
+ sout<<"\n Abandon"<<std::endl;
+ }
+ errhand = theerrhand;
+ return;
+ }
+
+ if (!IsLoaded())
+ { sout<< " *** Data for Evaluation not available ***"<<std::endl; return; }
+ if (ItemIdent(sel) == 0)
+ { sout << " Selection : Unknown"<<std::endl; return; } //sout<<Handle
+ Interface_EntityIterator iter = EvalSelection (sel);
+ ListEntities (iter, 1, sout);
+ sout << "**** (Unique) RootResult, Selection : "
+ <<sel->Label()<<std::endl;
+}
+
+
+// #### #### #### #### #### #### #### #### ####
+// .... EvaluateDispatch ....
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void IFSelect_WorkSession::EvaluateDispatch
+ (const Handle(IFSelect_Dispatch)& disp, const Standard_Integer mode) const
+{
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ if (errhand) {
+ errhand = Standard_False;
+ try {
+ OCC_CATCH_SIGNALS
+ EvaluateDispatch(disp,mode); // appel normal (->code unique)
+ }
+ catch (Standard_Failure const& anException) {
+ sout<<" **** Interruption EvaluateDispatch par Exception **** Intitule\n";
+ sout<<anException.GetMessageString();
+ sout<<"\n Abandon"<<std::endl;
+ }
+ errhand = theerrhand;
+ return;
+ }
+
+ Standard_Integer numdisp = DispatchRank(disp);
+ if (!IsLoaded())
+ { sout<< " *** Data for List not available ***"<<std::endl; return; }
+ if (theshareout->NbDispatches() < numdisp || numdisp <= 0)
+ { sout<<"Dispatch : Unknown"<<std::endl; return; } //sout<<Handle
+ if (disp->FinalSelection().IsNull())
+ { sout<<"Dispatch : No Final Selection"<<std::endl; return; }//sout<<Handle
+ sout<<" --- Dispatch Label : "<<disp->Label()<<std::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<<" :"<<std::endl;
+ for (numpack = 1; numpack <= nbpack; numpack ++) {
+ sout<<"\n **** Packet n0 : "<<numpack<<" ****"<<std::endl;
+ if (!mode) std::cout<<"Root Entities :"<<std::endl;
+ ListEntities (evres->Entities(numpack), (mode ? 2 : -1), sout);
+ }
+
+//// Interface_EntityIterator iterem = disp->Remainder(thegraph->Graph());
+ if (mode == 0) return;
+ if (mode == 1 || mode == 3) {
+ sout<<std::endl;
+ if (evres->NbDuplicated(0,Standard_False) == 0)
+ sout<<" **** All the Model is taken into account ****"<<std::endl;
+ else {
+ sout<<" **** Starting Entities not taken by this Dispatch ****"<<std::endl;
+ ListEntities (evres->Duplicated(0,Standard_False), 2, sout);
+ }
+ }
+ if (mode >= 2) {
+ sout<<" **** Entites in more than one packet ****";
+ Standard_Integer max = evres->HighestDuplicationCount();
+ if (max < 2) sout<<" : There are none"<<std::endl;
+ else {
+ Standard_Integer newcount;
+ sout<<std::endl;
+ for (newcount = 2; newcount <= max; newcount ++) {
+ if (evres->NbDuplicated(newcount,Standard_False) == 0) continue;
+ sout<<" **** Entities put in "<<newcount<<" packets ****"<<std::endl;
+ ListEntities (evres->Duplicated(newcount,Standard_False), 2, sout);
+ }
+ }
+ }
+}
+
+
+// #### #### #### #### #### #### #### #### ####
+// .... EvaluateComplete ....
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void IFSelect_WorkSession::EvaluateComplete
+ (const Standard_Integer mode) const
+{
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ if (errhand) {
+ errhand = Standard_False;
+ try {
+ OCC_CATCH_SIGNALS
+ EvaluateComplete(mode); // appel normal (donc, code pas duplique)
+ }
+ catch (Standard_Failure const& anException) {
+ sout<<" **** Interruption EvaluateComplete par Exception : ****\n";
+ sout<<anException.GetMessageString();
+ sout<<"\n Abandon"<<std::endl;
+ }
+ errhand = theerrhand;
+ return;
+ }
+
+ if (!IsLoaded())
+ { sout<< " *** Data for List not available ***"<<std::endl; return; }
+ IFSelect_ShareOutResult eval(theshareout,thegraph->Graph());
+ eval.Evaluate();
+ sout<<"\n******** Evaluation ShareOutResult (Complete) ********\n";
+ sout<<" **** List of Packets **** Count : "<<eval.NbPackets()<<std::endl;
+ if (mode == 0) sout << " ** (for each one : Root Entities) **"<<std::endl;
+ else sout << " ** (for each one : Evaluated Content) **"<<std::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<<" :"<<std::endl;
+ for (numpack = 1; numpack <= nbpack; numpack ++) {
+ sout<<"\n **** Packet n0 : "<<numpack<<" ****"<<std::endl;
+ if (!mode) std::cout<<"Root Entities :"<<std::endl;
+ ListEntities (evres->Entities(numpack), (mode ? 2: -1), sout);
+ }
+ if (mode == 0) return;
+ if (mode == 1 || mode == 3) {
+ sout<<std::endl;
+ if (evres->NbDuplicated(0,Standard_False) == 0)
+ sout<<" **** All the Model is taken into account ****"<<std::endl;
+ else {
+ sout<<" **** Starting Entities Forgotten ****"<<std::endl;
+ ListEntities (evres->Duplicated(0,Standard_False), 2, sout);
+ }
+ }
+ if (mode >= 2) {
+ sout<<" **** Entites in more than one packet ****"<<std::endl;
+ Standard_Integer max = evres->HighestDuplicationCount();
+ if (max < 2) sout<<" : There are none"<<std::endl;
+ else {
+ Standard_Integer newcount;
+ sout<<std::endl;
+ for (newcount = 2; newcount <= max; newcount ++) {
+ if (evres->NbDuplicated(newcount,Standard_False) == 0) continue;
+ sout<<" **** Entities put in "<<newcount<<" packets ****"<<std::endl;
+ ListEntities (evres->Duplicated(newcount,Standard_False), 2, sout);
+ }
+ }
+ }
+}
+
+
+// #### #### #### #### #### #### #### #### ####
+// .... Routine Interne : ListEntities
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void IFSelect_WorkSession::ListEntities
+ (const Interface_EntityIterator& iter, const Standard_Integer mmode, Standard_OStream& sout) const
+{
+ int titre = 0;
+ Standard_Integer mode = (mmode < 0 ? -mmode : mmode);
+ if (mmode >= 0) sout << " List of " << iter.NbEntities() << " Entities :"<<std::endl;
+ if (!IsLoaded())
+ { sout<< " *** Data for List not available ***"<<std::endl; return; }
+ Interface_ShareFlags tool(thegraph->Graph());
+
+ try {
+ OCC_CATCH_SIGNALS
+ int newcount = -1; int mods = 0; int cnt = 0;
+ for (iter.Start(); iter.More(); iter.Next()) {
+ if (!titre && mode == 1) sout
+ << "Number/Id. Category Validity Type\n----------- ----...."<<std::endl;
+// 123456789 123456789 123456 123456789 123456789 123456
+ if (!titre && mode == 0) sout<<" Keys : R Root ? Unknown * Unloaded"<<std::endl;
+ if (!titre && mode == 2) sout<<"(";
+ titre = 1;
+ Handle(Standard_Transient) ent = iter.Value();
+ Standard_Integer num = myModel->Number(ent);
+ if (mode == 1) {
+ // n0 id (root?) category validity tracetype
+ sout<<Interface_MSG::Blanks (num,6);
+ myModel->Print (ent, sout, 0);
+ if (!tool.IsShared(ent)) sout << " #ROOT#";
+ else sout << " ";
+ Standard_Integer catnum = myModel->CategoryNumber(num);
+ if (catnum > 0) sout<<" "<<Interface_Category::Name (catnum);
+ sout << " (" << ValidityName (ent) << ") ";
+
+ sout<<" Type:"<<myModel->TypeName (ent, Standard_False)<<std::endl;
+ } else if (mode == 2) {
+ newcount ++;
+ if (newcount > 0) sout<<",";
+ sout<<num;
+ } else {
+ newcount ++; mods = 0; cnt ++;
+ if (newcount >= 10) { sout << std::endl<<"["<<cnt<<"]:"; newcount = 1; }
+ if (newcount > 0) sout << " ";
+ myModel->Print (ent, sout, 0);
+ if (!tool.IsShared(ent)) { if(mods == 0) sout<<"("; sout<<"R"; mods++; }
+ if (myModel->IsUnknownEntity(num)) { sout<<(mods==0 ? '(' : ' ')<<"?"; mods ++; }
+ if (myModel->IsRedefinedContent(num)) { sout<<(mods==0 ? '(' : ' ')<<"*"; mods ++; }
+ if (mods) { sout<<")"; newcount ++; }
+ }
+ }
+ if (mode == 0) sout<<std::endl;
+ if (mode == 2) sout<<")"<<std::endl;
+ }
+ catch (Standard_Failure const& anException) {
+ sout<<" **** Interruption ListEntities par Exception : ****\n";
+ sout<<anException.GetMessageString();
+ sout<<"\n Abandon"<<std::endl;
+ }
+}
--- /dev/null
+// Created on: 1992-12-15
+// 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_WorkSession_HeaderFile
+#define _IFSelect_WorkSession_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <TCollection_AsciiString.hxx>
+#include <Interface_CheckIterator.hxx>
+#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
+#include <Standard_Transient.hxx>
+#include <NCollection_Vector.hxx>
+#include <NCollection_DataMap.hxx>
+#include <Standard_CString.hxx>
+#include <XSControl_ReturnStatus.hxx>
+#include <Standard_Integer.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+class IFSelect_WorkLibrary;
+class Interface_Protocol;
+class Interface_InterfaceModel;
+class Interface_HGraph;
+class Interface_GTool;
+
+class TCollection_HAsciiString;
+class Interface_Graph;
+class Interface_EntityIterator;
+
+class IFSelect_WorkSession;
+DEFINE_STANDARD_HANDLE(IFSelect_WorkSession, Standard_Transient)
+
+//! 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 Standard_Transient
+{
+
+public:
+
+ //! 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; }
+
+ //! Set value of mode responsible for presence 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 applications)
+ 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; }
+
+ //! 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 XSControl_ReturnStatus ReadFile (const Standard_CString filename);
+
+ //! Reads a file from stream 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 XSControl_ReturnStatus ReadStream (const Standard_CString theName, std::istream& theIStream);
+
+ //! Returns the count of Entities stored in the Model, or 0
+ Standard_EXPORT Standard_Integer NbStartingEntities() const;
+
+ //! Returns an Entity stored in the Model of the WorkSession
+ //! (Null Handle is no Model or num out of range)
+ Standard_EXPORT Handle(Standard_Transient) StartingEntity (const Standard_Integer num) const;
+
+ //! Returns the Number of an Entity in the Model
+ //! (0 if no Model set or <ent> not in the Model)
+ Standard_EXPORT Standard_Integer StartingNumber (const Handle(Standard_Transient)& ent) const;
+
+ //! From a given label in Model, returns the corresponding number
+ //! Starts from first entity by Default, may start after a given
+ //! number : this number may be given negative, its absolute value
+ //! is then considered. Hence a loop on NumberFromLabel may be
+ //! programmed (stop test is : returned value positive or null)
+ //!
+ //! Returns 0 if not found, < 0 if more than one found (first
+ //! found in negative).
+ //! 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
+ Standard_EXPORT Handle(TCollection_HAsciiString) EntityName (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 the list of entities sharing <ent> (can be empty)
+ //! Returns a null Handle if <ent> is unknown
+ Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Sharings (const Handle(Standard_Transient)& ent);
+
+ DEFINE_STANDARD_RTTIEXT(IFSelect_WorkSession,Standard_Transient)
+
+ protected:
+
+ Handle(Interface_HGraph) thegraph;
+ Interface_CheckIterator thecheckrun;
+ NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thenames;
+
+ private:
+
+ Standard_Boolean theerrhand;
+ 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(Interface_InterfaceModel) theoldel;
+ Standard_Boolean themodelstat;
+};
+
+#endif // _IFSelect_WorkSession_HeaderFile
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-
-#include <IFSelect_DispPerCount.hxx>
-#include <IFSelect_DispPerFiles.hxx>
-#include <IFSelect_DispPerOne.hxx>
-#include <IFSelect_DispPerSignature.hxx>
-#include <IFSelect_EditForm.hxx>
-#include <IFSelect_GraphCounter.hxx>
-#include <IFSelect_IntParam.hxx>
-#include <IFSelect_ParamEditor.hxx>
-#include <IFSelect_SelectModelEntities.hxx>
-#include <IFSelect_SelectModelRoots.hxx>
-#include <IFSelect_SelectPointed.hxx>
-#include <IFSelect_SelectShared.hxx>
-#include <IFSelect_SelectSharing.hxx>
-#include <IFSelect_ShareOut.hxx>
-#include <IFSelect_SignAncestor.hxx>
-#include <IFSelect_Signature.hxx>
-#include <IFSelect_SignCategory.hxx>
-#include <IFSelect_SignCounter.hxx>
-#include <IFSelect_SignType.hxx>
-#include <IFSelect_SignValidity.hxx>
#include <Interface_Macros.hxx>
#include <Interface_Static.hxx>
#include <Standard_DomainError.hxx>
//purpose : internal function
//=======================================================================
-static IFSelect_ReturnStatus TransferFinder
+static XSControl_ReturnStatus TransferFinder
(const Handle(Transfer_ActorOfFinderProcess)& theActor,
const Handle(Transfer_Finder)& theMapper,
const Handle(Transfer_FinderProcess)& theFP,
const Standard_Integer theModeTrans,
const Message_ProgressRange& theProgress)
{
- if (theActor.IsNull()) return IFSelect_RetError;
- if (theModel.IsNull()) return IFSelect_RetError;
+ if (theActor.IsNull()) return XSControl_RetError;
+ if (theModel.IsNull()) return XSControl_RetError;
theActor->ModeTrans() = theModeTrans;
theFP->SetModel (theModel);
theFP->SetActor (theActor);
theFP->Transfer (theMapper, theProgress);
- IFSelect_ReturnStatus stat = IFSelect_RetFail;
+ XSControl_ReturnStatus stat = XSControl_RetFail;
Handle(Transfer_Binder) binder = theFP->Find (theMapper);
Handle(Transfer_SimpleBinderOfTransient) bindtr;
while (!binder.IsNull()) {
if (!bindtr.IsNull()) {
Handle(Standard_Transient) ent = bindtr->Result();
if (!ent.IsNull()) {
- stat = IFSelect_RetDone;
+ stat = XSControl_RetDone;
theModel->AddWithRefs (ent);
}
}
//purpose :
//=======================================================================
-IFSelect_ReturnStatus XSControl_Controller::TransferWriteTransient
+XSControl_ReturnStatus XSControl_Controller::TransferWriteTransient
(const Handle(Standard_Transient)& theObj,
const Handle(Transfer_FinderProcess)& theFP,
const Handle(Interface_InterfaceModel)& theModel,
const Standard_Integer theModeTrans,
const Message_ProgressRange& theProgress) const
{
- if (theObj.IsNull()) return IFSelect_RetVoid;
+ if (theObj.IsNull()) return XSControl_RetVoid;
return TransferFinder
(myAdaptorWrite,new Transfer_TransientMapper(theObj),theFP,theModel,theModeTrans, theProgress);
}
//purpose :
//=======================================================================
-IFSelect_ReturnStatus XSControl_Controller::TransferWriteShape
+XSControl_ReturnStatus XSControl_Controller::TransferWriteShape
(const TopoDS_Shape& shape,
const Handle(Transfer_FinderProcess)& FP,
const Handle(Interface_InterfaceModel)& model,
const Standard_Integer modetrans,
const Message_ProgressRange& theProgress) const
{
- if (shape.IsNull()) return IFSelect_RetVoid;
+ if (shape.IsNull()) return XSControl_RetVoid;
- IFSelect_ReturnStatus theReturnStat = TransferFinder
+ XSControl_ReturnStatus theReturnStat = TransferFinder
(myAdaptorWrite,new TransferBRep_ShapeMapper(shape),FP,model,modetrans, theProgress);
return theReturnStat;
}
-
-// ###########################
-// Cutomisation ! On enregistre des Items pour une WorkSession
-// (annule et remplace)
-// Ensuite, on les remet en place a la demande
-
-//=======================================================================
-//function : AddSessionItem
-//purpose :
-//=======================================================================
-
-void XSControl_Controller::AddSessionItem
- (const Handle(Standard_Transient)& theItem, const Standard_CString theName, const Standard_Boolean toApply)
-{
- if (theItem.IsNull() || theName[0] == '\0') return;
- myAdaptorSession.Bind(theName,theItem);
- if (toApply && theItem->IsKind(STANDARD_TYPE(IFSelect_GeneralModifier)))
- myAdaptorApplied.Append(theItem);
-}
-
-//=======================================================================
-//function : SessionItem
-//purpose :
-//=======================================================================
-
-Handle(Standard_Transient) XSControl_Controller::SessionItem (const Standard_CString theName) const
-{
- Handle(Standard_Transient) item;
- if (!myAdaptorSession.IsEmpty())
- item = myAdaptorSession.Find(theName);
- return item;
-}
-
-//=======================================================================
-//function : Customise
-//purpose :
-//=======================================================================
-
-void XSControl_Controller::Customise (Handle(XSControl_WorkSession)& WS)
-{
- //WS->SetParams (myParams,myParamUses);
-
- //// General
- //if (!myAdaptorSession.IsEmpty()) {
- // NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator iter(myAdaptorSession);
- // for (; iter.More(); iter.Next())
- // WS->AddNamedItem (iter.Key().ToCString(), iter.ChangeValue());
- //}
-
- //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);
-
- // //szv:mySignType = stp;
- // 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
-
- //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);
-}
#include <Interface_HArray1OfHAsciiString.hxx>
#include <Standard_Transient.hxx>
#include <NCollection_Vector.hxx>
-#include <IFSelect_ReturnStatus.hxx>
+#include <XSControl_ReturnStatus.hxx>
#include <NCollection_DataMap.hxx>
#include <Message_ProgressRange.hxx>
//! 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;
-
+
//! Tells if <obj> (an application object) is a valid candidate
//! for a transfer to a Model.
//! By default, asks the ActorWrite if known (through a
//! 0 OK , 1 No Result , 2 Fail (e.g. exception raised)
//! -1 bad conditions , -2 bad model or null model
//! For type of object not recognized : should return 1
- Standard_EXPORT virtual IFSelect_ReturnStatus TransferWriteTransient
+ Standard_EXPORT virtual XSControl_ReturnStatus TransferWriteTransient
(const Handle(Standard_Transient)& obj,
const Handle(Transfer_FinderProcess)& FP,
const Handle(Interface_InterfaceModel)& model,
//! 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
+ Standard_EXPORT virtual XSControl_ReturnStatus TransferWriteShape
(const TopoDS_Shape& shape,
const Handle(Transfer_FinderProcess)& FP,
const Handle(Interface_InterfaceModel)& model,
const Standard_Integer modetrans = 0,
const Message_ProgressRange& theProgress = Message_ProgressRange()) 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;
-
- //! Customises a WorkSession, by adding to it the recorded items (by AddSessionItem)
- Standard_EXPORT virtual void Customise (Handle(XSControl_WorkSession)& WS);
-
const NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> & AdaptorSession() const
{ return myAdaptorSession; }
Handle(Transfer_ActorOfTransientProcess) myAdaptorRead;
Handle(Transfer_ActorOfFinderProcess) myAdaptorWrite;
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> myAdaptorSession;
-
- private:
-
- TColStd_SequenceOfTransient myAdaptorApplied;
- NCollection_Vector<Handle(Standard_Transient)> myParams;
- NCollection_Vector<Standard_Integer> myParamUses;
- Handle(Interface_HArray1OfHAsciiString) myModeWriteShapeN;
};
#endif // _XSControl_Controller_HeaderFile
//purpose :
//=======================================================================
-IFSelect_ReturnStatus XSControl_Reader::ReadFile (const Standard_CString filename)
+XSControl_ReturnStatus XSControl_Reader::ReadFile (const Standard_CString filename)
{
- IFSelect_ReturnStatus stat = thesession->ReadFile(filename);
+ XSControl_ReturnStatus stat = thesession->ReadFile(filename);
thesession->InitTransferReader(4);
return stat;
}
//purpose :
//=======================================================================
-IFSelect_ReturnStatus XSControl_Reader::ReadStream(const Standard_CString theName,
+XSControl_ReturnStatus XSControl_Reader::ReadStream(const Standard_CString theName,
std::istream& theIStream)
{
- IFSelect_ReturnStatus stat = thesession->ReadStream(theName, theIStream);
+ XSControl_ReturnStatus stat = thesession->ReadStream(theName, theIStream);
thesession->InitTransferReader(4);
return stat;
}
#include <TColStd_SequenceOfTransient.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <Standard_CString.hxx>
-#include <IFSelect_ReturnStatus.hxx>
+#include <XSControl_ReturnStatus.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <Standard_Integer.hxx>
-#include <IFSelect_PrintCount.hxx>
#include <Message_ProgressRange.hxx>
class XSControl_WorkSession;
//! initialize the transfer norm first, as shown in the example below.
//! Example:
//! Control_Reader reader;
-//! IFSelect_ReturnStatus status = reader.ReadFile (filename.);
+//! XSControl_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
//! 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 XSControl_ReturnStatus ReadFile (const Standard_CString filename);
//! Loads a file from stream and returns the read status
- Standard_EXPORT IFSelect_ReturnStatus ReadStream(const Standard_CString theName, std::istream& theIStream);
+ Standard_EXPORT XSControl_ReturnStatus ReadStream(const Standard_CString theName, std::istream& theIStream);
//! Returns the model. It can then be consulted (header, product)
Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
//! - a compound containing the resulting shapes if there are more than one.
Standard_EXPORT TopoDS_Shape OneShape() const;
- //! Prints the check list attached to loaded data, on the Standard
- //! Trace File (starts at std::cout)
- //! All messages or fails only, according to <failsonly>
- //! mode = 0 : per entity, prints messages
- //! mode = 1 : per message, just gives count of entities per check
- //! mode = 2 : also gives entity numbers
- Standard_EXPORT void PrintCheckLoad (const Standard_Boolean failsonly, const IFSelect_PrintCount mode) const;
-
- //! Prints the check list attached to loaded data.
- Standard_EXPORT void PrintCheckLoad (Standard_OStream& theStream, const Standard_Boolean failsonly, const IFSelect_PrintCount mode) const;
-
- //! Displays check results for the
- //! last translation of IGES or STEP entities to Open CASCADE
- //! entities. Only fail messages are displayed if failsonly is
- //! true. All messages are displayed if failsonly is
- //! false. mode determines the contents and the order of the
- //! messages according to the terms of the IFSelect_PrintCount enumeration.
- Standard_EXPORT void PrintCheckTransfer (const Standard_Boolean failsonly, const IFSelect_PrintCount mode) const;
-
- //! Displays check results for the last translation of IGES or STEP entities to Open CASCADE entities.
- Standard_EXPORT void PrintCheckTransfer (Standard_OStream& theStream, const Standard_Boolean failsonly, const IFSelect_PrintCount mode) const;
-
//! Displays the statistics for
//! the last translation. what defines the kind of
//! statistics that are displayed as follows:
--- /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 XSControl_ReturnStatus
+{
+XSControl_RetVoid,
+XSControl_RetDone,
+XSControl_RetError,
+XSControl_RetFail,
+XSControl_RetStop
+};
+
+#endif // _IFSelect_ReturnStatus_HeaderFile
//purpose :
//=======================================================================
-IFSelect_ReturnStatus XSControl_TransferWriter::TransferWriteTransient
+XSControl_ReturnStatus XSControl_TransferWriter::TransferWriteTransient
(const Handle(Interface_InterfaceModel)& model,
const Handle(Standard_Transient)& obj,
const Message_ProgressRange& theProgress)
{
- IFSelect_ReturnStatus status = IFSelect_RetVoid;
- if (myController.IsNull()) return IFSelect_RetError;
- if (model.IsNull()) return IFSelect_RetVoid;
+ XSControl_ReturnStatus status = XSControl_RetVoid;
+ if (myController.IsNull()) return XSControl_RetError;
+ if (model.IsNull()) return XSControl_RetVoid;
if (myTransferWriter.IsNull()) myTransferWriter = new Transfer_FinderProcess;
Handle(Transfer_ActorOfFinderProcess) nulact;
sout<<"**** **** TransferWriteShape, EXCEPTION : ";
sout<<anException.GetMessageString();
sout<<std::endl;
- status = IFSelect_RetFail;
+ status = XSControl_RetFail;
}
return status;
}
//purpose :
//=======================================================================
-IFSelect_ReturnStatus XSControl_TransferWriter::TransferWriteShape
+XSControl_ReturnStatus XSControl_TransferWriter::TransferWriteShape
(const Handle(Interface_InterfaceModel)& theModel,
const TopoDS_Shape& theShape,
const Message_ProgressRange& theProgress)
{
- IFSelect_ReturnStatus status = IFSelect_RetVoid;
- if (myController.IsNull()) return IFSelect_RetError;
- if (theModel.IsNull()) return IFSelect_RetVoid;
+ XSControl_ReturnStatus status = XSControl_RetVoid;
+ if (myController.IsNull()) return XSControl_RetError;
+ if (theModel.IsNull()) return XSControl_RetVoid;
TopoDS_Shape aShape = theShape;
Standard_Boolean isNMMode = Interface_Static::IVal("write.step.nonmanifold") != 0;
sout<<"**** **** TransferWriteShape, EXCEPTION : ";
sout<<anException.GetMessageString();
sout<<std::endl;
- status = IFSelect_RetFail;
+ status = XSControl_RetFail;
}
return status;
}
#include <Standard_Type.hxx>
#include <Standard_Transient.hxx>
-#include <IFSelect_ReturnStatus.hxx>
+#include <XSControl_ReturnStatus.hxx>
#include <Transfer_FinderProcess.hxx>
class XSControl_Controller;
class Interface_InterfaceModel;
//! Works by calling the Controller
//! Returns status : =0 if OK, >0 if error during transfer, <0 if
//! transfer badly initialised
- Standard_EXPORT IFSelect_ReturnStatus TransferWriteTransient
+ Standard_EXPORT XSControl_ReturnStatus TransferWriteTransient
(const Handle(Interface_InterfaceModel)& theModel,
const Handle(Standard_Transient)& theObj,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! 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
+ Standard_EXPORT XSControl_ReturnStatus TransferWriteShape
(const Handle(Interface_InterfaceModel)& theModel,
const TopoDS_Shape& theShape,
const Message_ProgressRange& theProgress = Message_ProgressRange());
#include <XSControl_TransferReader.hxx>
#include <XSControl_TransferWriter.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(XSControl_WorkSession, IFSelect_WorkSession)
+IMPLEMENT_STANDARD_RTTIEXT(XSControl_WorkSession, Standard_Transient)
//=======================================================================
//function : XSControl_WorkSession
ClearShareOut(Standard_False);
ClearFile();
- // Set worksession parameters from teh controller
- Handle(XSControl_WorkSession) aWorkSession(this);
- myController->Customise(aWorkSession);
-
myTransferReader->SetController(myController);
myTransferWriter->SetController(myController);
}
//function : TransferWriteShape
//purpose :
//=======================================================================
-IFSelect_ReturnStatus XSControl_WorkSession::TransferWriteShape(const TopoDS_Shape& shape,
+XSControl_ReturnStatus XSControl_WorkSession::TransferWriteShape(const TopoDS_Shape& shape,
const Standard_Boolean compgraph,
const Message_ProgressRange& theProgress)
{
- IFSelect_ReturnStatus status;
- if (myController.IsNull()) return IFSelect_RetError;
+ XSControl_ReturnStatus status;
+ if (myController.IsNull()) return XSControl_RetError;
const Handle(Interface_InterfaceModel)& model = Model();
if (model.IsNull() || shape.IsNull())
{
- return IFSelect_RetVoid;
+ return XSControl_RetVoid;
}
status = myTransferWriter->TransferWriteShape(model, shape, theProgress);
if (theProgress.UserBreak())
- return IFSelect_RetStop;
+ return XSControl_RetStop;
// qui s occupe de tout, try/catch inclus
//skl insert param compgraph for XDE writing 10.12.2003
#include <Standard_Type.hxx>
#include <IFSelect_WorkSession.hxx>
-#include <IFSelect_ReturnStatus.hxx>
#include <Message_ProgressRange.hxx>
class XSControl_Controller;
//! 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,
+ Standard_EXPORT XSControl_ReturnStatus TransferWriteShape(const TopoDS_Shape& theShape,
const Standard_Boolean theCompGraph = Standard_True,
const Message_ProgressRange& theProgress = Message_ProgressRange());
return model;
}
- IFSelect_ReturnStatus XSControl_Writer::TransferShape
+ XSControl_ReturnStatus XSControl_Writer::TransferShape
(const TopoDS_Shape& sh, const Standard_Integer mode, const Message_ProgressRange& theProgress)
{
thesession->TransferWriter()->SetTransferMode (mode);
return thesession->TransferWriteShape (sh, Standard_True, theProgress);
}
- IFSelect_ReturnStatus XSControl_Writer::WriteFile
+ XSControl_ReturnStatus XSControl_Writer::WriteFile
(const Standard_CString filename)
{ return thesession->SendAll(filename); }
#include <Standard_Handle.hxx>
#include <Standard_CString.hxx>
-#include <IFSelect_ReturnStatus.hxx>
+#include <XSControl_ReturnStatus.hxx>
#include <Standard_Integer.hxx>
#include <Message_ProgressRange.hxx>
Standard_EXPORT Handle(Interface_InterfaceModel) Model (const Standard_Boolean newone = Standard_False);
//! Transfers a Shape according to the mode
- Standard_EXPORT IFSelect_ReturnStatus TransferShape (const TopoDS_Shape& sh,
+ Standard_EXPORT XSControl_ReturnStatus TransferShape (const TopoDS_Shape& sh,
const Standard_Integer mode = 0,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Writes the produced model
- Standard_EXPORT IFSelect_ReturnStatus WriteFile (const Standard_CString filename);
+ Standard_EXPORT XSControl_ReturnStatus WriteFile (const Standard_CString filename);
//! Prints Statistics about Transfer
Standard_EXPORT void PrintStatsTransfer (const Standard_Integer what, const Standard_Integer mode = 0) const;
-// Copyright (c) 2023 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_FunctionsSession.hxx>
-
-#include <IFSelect_CheckCounter.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 <XSDRAW_FunctionsSession.hxx>
-#include <IFSelect_GraphCounter.hxx>
-#include <IFSelect_IntParam.hxx>
-#include <IFSelect_ListEditor.hxx>
-#include <IFSelect_ModifReorder.hxx>
-#include <IFSelect_SelectDiff.hxx>
-#include <IFSelect_SelectEntityNumber.hxx>
-#include <IFSelect_SelectErrorEntities.hxx>
-#include <IFSelect_SelectIncorrectEntities.hxx>
-#include <IFSelect_SelectIntersection.hxx>
-#include <IFSelect_Selection.hxx>
-#include <IFSelect_SelectModelEntities.hxx>
-#include <IFSelect_SelectModelRoots.hxx>
-#include <IFSelect_SelectPointed.hxx>
-#include <IFSelect_SelectRange.hxx>
-#include <IFSelect_SelectRoots.hxx>
-#include <IFSelect_SelectShared.hxx>
-#include <IFSelect_SelectSharing.hxx>
-#include <IFSelect_SelectSignature.hxx>
-#include <IFSelect_SelectSuite.hxx>
-#include <IFSelect_SelectUnion.hxx>
-#include <IFSelect_SelectUnknownEntities.hxx>
-#include <IFSelect_SessionFile.hxx>
-#include <IFSelect_ShareOut.hxx>
-#include <IFSelect_SignatureList.hxx>
-#include <IFSelect_SignCounter.hxx>
-#include <IFSelect_SignType.hxx>
-#include <IFSelect_Transformer.hxx>
-#include <IFSelect_WorkLibrary.hxx>
-#include <XSControl_WorkSession.hxx>
-#include <Interface_Category.hxx>
-#include <Interface_CheckIterator.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Interface_MSG.hxx>
-#include <Interface_Static.hxx>
-#include <Interface_Version.hxx>
-#include <Message.hxx>
-#include <Message_Messenger.hxx>
-#include <Standard_Transient.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-#include <TColStd_HSequenceOfAsciiString.hxx>
-#include <TColStd_HSequenceOfHAsciiString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <XSDRAW.hxx>
-#include <XSDRAWBase.hxx>
-
-//=======================================================================
-//function : GiveList
-//purpose :
-//=======================================================================
-Handle(TColStd_HSequenceOfTransient) GiveList(const Handle(XSControl_WorkSession)& WS,
- const Standard_CString first,
- const Standard_CString second)
-{
- return WS->GiveList(first, second);
-}
-
-// 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
-
-// Functions definit un certain nombre de commandes
-// enregistrees dans le Dictionnaire de Activator (par des Act unitaires)
-// Les actions elles-memes sont regroupees en fin de fichier
-
-// Les definitions
-
-//=======================================================================
-//function : funstatus
-//purpose :
-//=======================================================================
-static Standard_Integer funstatus(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- (void)theNbArgs;
- (void)theArgVec;
- // **** Version & cie ****
- //#58 rln
- aSSC.SStream() << "Processor Version : " << XSTEP_PROCESSOR_VERSION;
- aSSC.SStream() << "OL Version : " << XSTEP_SYSTEM_VERSION;
- aSSC.SStream() << "Configuration : " << XSTEP_Config;
- aSSC.SStream() << "UL Names : " << XSTEP_ULNames;
- return 0;
-}
-
-//=======================================================================
-//function : fun1
-//purpose :
-//=======================================================================
-static Standard_Integer fun1(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- (void)theNbArgs;
- (void)theArgVec;
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- // **** ToggleHandler ****
- Standard_Boolean hand = !WS->ErrorHandle();
- if (hand) aSSC.SStream() << " -- Mode Catch Error now Active";
- else aSSC.SStream() << " -- Mode Catch Error now Inactive";
- WS->SetErrorHandle(hand);
- return 0;
-}
-
-//=======================================================================
-//function : fun3
-//purpose :
-//=======================================================================
-static Standard_Integer fun3(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** XRead / Load ****
- if (theNbArgs < 2)
- {
- aSSC.SStream() << "Read/Load : give file name !";
- return 1;
- }
- if (WS->Protocol().IsNull())
- {
- aSSC.SStream() << "Protocol not defined";
- return 1;
- }
- if (WS->WorkLibrary().IsNull())
- {
- aSSC.SStream() << "WorkLibrary not defined";
- return 1;
- }
- IFSelect_ReturnStatus status = WS->ReadFile(arg1);
- // status : 0 OK, 1 erreur lecture, 2 Fail(try/catch),
- // -1 fichier non trouve, -2 lecture faite mais resultat vide
- switch (status)
- {
- case IFSelect_RetVoid: aSSC.SStream() << "file:" << arg1 << " gives empty result"; break;
- case IFSelect_RetError: aSSC.SStream() << "file:" << arg1 << " could not be opened"; break;
- case IFSelect_RetDone: aSSC.SStream() << "file:" << arg1 << " read"; break;
- case IFSelect_RetFail: aSSC.SStream() << "file:" << arg1 << " : error while reading"; break;
- case IFSelect_RetStop: aSSC.SStream() << "file:" << arg1 << " : EXCEPTION while reading"; break;
- default: aSSC.SStream() << "file:" << arg1 << " could not be read"; break;
- }
- if (status != IFSelect_RetDone)
- return 1;
- // aSSC.SStream()<<" - clearing list of already written files"<<std::endl;
- WS->BeginSentFiles(Standard_True);
- return 0;
-}
-
-//=======================================================================
-//function : fun4
-//purpose :
-//=======================================================================
-static Standard_Integer fun4(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** Write All ****
- if (theNbArgs < 2)
- {
- aSSC.SStream() << "Write All : give file name !";
- return 1;
- }
- return (WS->SendAll(arg1) == IFSelect_RetDone ? 0 : 1);
-}
-
-//=======================================================================
-//function : fun6
-//purpose :
-//=======================================================================
-static Standard_Integer fun6(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** Write Entite(s) ****
- if (theNbArgs < 3)
- {
- aSSC.SStream() << "Write Entitie(s) : give file name + n0s entitie(s)!";
- return 1;
- }
- int ko = 0;
- Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
- for (Standard_Integer ia = 2; ia < theNbArgs; ia++)
- {
- Standard_Integer id = WS->NumberFromLabel(theArgVec[ia]);
- if (id > 0)
- {
- Handle(Standard_Transient) item = WS->StartingEntity(id);
- if (sp->Add(item)) aSSC.SStream() << "Added:no." << id;
- else
- {
- aSSC.SStream() << " Fail Add n0." << id; ko++;
- }
- }
- else
- {
- aSSC.SStream() << "Not an entity number:" << theArgVec[ia]; ko++;
- }
- }
- if (ko > 0)
- {
- aSSC.SStream() << ko << " bad arguments, abandon";
- return 1;
- }
- return (WS->SendSelected(arg1, sp) == IFSelect_RetDone ? 0 : 1);
-}
-
-//=======================================================================
-//function : fun7
-//purpose :
-//=======================================================================
-static Standard_Integer fun7(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** Entity Label ****
- if (theNbArgs < 2)
- {
- aSSC.SStream() << "Give entity number";
- return 1;
- }
- if (!WS->HasModel())
- {
- aSSC.SStream() << "No loaded model, abandon";
- return 1;
- }
- Standard_Integer nument = WS->NumberFromLabel(arg1);
- if (nument <= 0 || nument > WS->NbStartingEntities())
- {
- aSSC.SStream() << "Not a suitable number: " << arg1;
- return 1;
- }
- aSSC.SStream() << "N0." << nument << " ->Label in Model : ";
- WS->Model()->PrintLabel(WS->StartingEntity(nument), aSSC.SStream());
-
- return 0;
-}
-
-//=======================================================================
-//function : fun8
-//purpose :
-//=======================================================================
-static Standard_Integer fun8(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** Entity Number ****
- if (theNbArgs < 2)
- {
- aSSC.SStream() << "Give label to search";
- return 1;
- }
- if (!WS->HasModel())
- {
- aSSC.SStream() << "No loaded model, abandon";
- return 1;
- }
- const Handle(Interface_InterfaceModel)& model = WS->Model();
- Standard_Integer i, cnt = 0;
- Standard_Boolean exact = Standard_False;
- aSSC.SStream() << " ** Search Entity Number for Label : " << arg1;
- for (i = model->NextNumberForLabel(arg1, 0, exact); i != 0;
- i = model->NextNumberForLabel(arg1, i, exact))
- {
- cnt++;
- aSSC.SStream() << " ** Found n0/id:";
- model->Print(model->Value(i), aSSC.SStream());
-
- }
-
- if (cnt == 0) aSSC.SStream() << " ** No Match";
- else if (cnt == 1) aSSC.SStream() << " ** 1 Match";
- else aSSC.SStream() << cnt << " Matches";
- return 0;
-}
-
-//=======================================================================
-//function : funsigntype
-//purpose :
-//=======================================================================
-static Standard_Integer fun9(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(IFSelect_WorkSession) WS = XSDRAWBase::Session();
- Handle(IFSelect_Signature) signtype = WS->SignType();
- if (signtype.IsNull()) signtype = new IFSelect_SignType;
- Handle(IFSelect_SignCounter) aCounter =
- new IFSelect_SignCounter(signtype, Standard_False);
- if (theNbArgs == 1)
- {
- aCounter->AddModel(WS->Model());
- }
- else
- {
- // on demande un givelist
- Handle(TColStd_HSequenceOfTransient) list = WS->GiveList(theArgVec[1]);
- if (list.IsNull())
- {
- theDI << "Error: Nothing selected from : " << theArgVec[1] << "\n";
- return 1;
- }
- aCounter->AddWithGraph(list, WS->Graph());
- }
- aCounter->PrintList(aSSC.SStream(), WS->Model(), IFSelect_CountByItem);
- return 0;
-}
-
-//=======================================================================
-//function : funsigntype
-//purpose :
-//=======================================================================
-static Standard_Integer funsigntype(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** Sign Type ****
- Handle(IFSelect_Signature) signtype = WS->SignType();
- if (signtype.IsNull()) aSSC.SStream() << "signtype actually undefined";
- else
- {
- Handle(TCollection_HAsciiString) str = WS->Name(signtype);
- Standard_Integer id = WS->ItemIdent(signtype);
- aSSC.SStream() << signtype->Label();
- if (str.IsNull())
- {
- if (id > 0) aSSC.SStream() << "signtype : item n0 " << id;
- }
- else
- {
- aSSC.SStream() << "signtype : also named as " << str->ToCString();
- }
- }
- if (theNbArgs < 2) aSSC.SStream() << "signtype newitem to change, signtype . to clear";
- else
- {
- if (arg1[0] == '.' && arg1[1] == '\0')
- {
- signtype.Nullify();
- aSSC.SStream() << "signtype now cleared";
- }
- else
- {
- signtype = GetCasted(IFSelect_Signature, WS->NamedItem(arg1));
- if (signtype.IsNull())
- {
- aSSC.SStream() << "Not a Signature : " << arg1;
- return 1;
- }
- else aSSC.SStream() << "signtype now set to " << arg1;
- }
- WS->SetSignType(signtype);
- return 0;
- }
- return 0;
-}
-
-//=======================================================================
-//function : funsigncase
-//purpose :
-//=======================================================================
-static Standard_Integer funsigncase(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- (void)theNbArgs;
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- const Standard_CString arg1 = theArgVec[1];
- // **** Sign Case ****
- Handle(IFSelect_Signature) signcase = GetCasted(IFSelect_Signature, WS->NamedItem(arg1));
- if (signcase.IsNull()) aSSC.SStream() << "Not a Signature : " << arg1;
- else
- {
- Standard_Boolean hasmin, hasmax; Standard_Integer valmin, valmax;
- if (signcase->IsIntCase(hasmin, valmin, hasmax, valmax))
- {
- aSSC.SStream() << "Signature " << arg1 << " : Integer Case";
- if (hasmin) aSSC.SStream() << " - Mini:" << valmin;
- if (hasmax) aSSC.SStream() << " - Maxi:" << valmax;
-
- }
- Handle(TColStd_HSequenceOfAsciiString) caselist = signcase->CaseList();
- if (caselist.IsNull()) aSSC.SStream() << "Signature " << arg1 << " : no predefined case, see command count " << arg1;
- else
- {
- Standard_Integer i, nb = caselist->Length();
- aSSC.SStream() << "Signature " << arg1 << " : " << nb << " basic cases :";
- for (i = 1; i <= nb; i++) aSSC.SStream() << " " << caselist->Value(i);
-
- }
- }
- return 0;
-}
-
-//=======================================================================
-//function : fun10
-//purpose :
-//=======================================================================
-static Standard_Integer fun10(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** Entity Status ****
- Standard_Integer i, nb;
- if (theNbArgs < 2)
- {
- nb = Interface_Category::NbCategories();
- aSSC.SStream() << " Categories defined :" << nb << " i.e. :\n";
- for (i = 0; i <= nb; i++)
- aSSC.SStream() << "Cat." << i << " : " << Interface_Category::Name(i) << "\n";
- aSSC.SStream() << " On a given entity : give its number";
- return 0;
- }
- Standard_Integer num = WS->NumberFromLabel(arg1);
- if (num <= 0 || num > WS->NbStartingEntities())
- {
- aSSC.SStream() << "Not a suitable entity number : " << arg1;
- return 1;
- }
- Handle(Standard_Transient) ent = WS->StartingEntity(num);
- WS->PrintEntityStatus(ent, aSSC.SStream());
- return 0;
-}
-
-//=======================================================================
-//function : fun11
-//purpose :
-//=======================================================================
-static Standard_Integer fun11(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- if (theNbArgs < 2)
- {
- aSSC.SStream() << "Error: Empty Mode\n";
- return 1;
- }
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- //
- const Standard_CString arg1 = theArgVec[1];
- // **** DumpModel (Data) ****
- Standard_Integer niv = 0;
- // char arg10 = arg1[0];
- // if (theNbArgs < 2) arg10 = '?';
- switch (arg1[0])
- {
- case '?':
- aSSC.SStream() << "? for this help, else give a listing mode (first letter suffices) :\n"
- << " general General Statistics\n roots Roots\n"
- << " entities All Entities\n"
- << " listfails CheckList (fails) per entity\n"
- << " messages CheckList (complete) per entity\n"
- << " fails CheckList (fails) per message (counting)\n"
- << " check CheckList (complete) per message (counting)\n"
- << " totalcheck CheckList (complete) per message (listing n0 ents)\n"
- << " FAILS CheckList (fails) per message (listing complete)\n"
- << " TOTALCHECK CheckList (complete) per message (listing complete)";
- return 0;
- case 'g': niv = 0; break;
- case 'r': niv = 1; break;
- case 'e': niv = 2; break;
- case 'l': niv = 3; break;
- case 'm': niv = 4; break;
- case 'c': niv = 5; break;
- case 't': niv = 6; break;
- case 'T': niv = 7; break;
- case 'f': niv = 8; break;
- case 'F': niv = 10; break;
- default: aSSC.SStream() << "Unknown Mode . tout court pour help";
- return 1;
- }
- WS->DumpModel(niv, aSSC.SStream());
- return 0;
-}
-
-//=======================================================================
-//function : fundumpent
-//purpose :
-//=======================================================================
-static Standard_Integer fundumpent(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- Handle(IFSelect_WorkLibrary) WL = WS->WorkLibrary();
- Standard_Integer levdef = 0, levmax = 10, level;
- WL->DumpLevels(levdef, levmax);
- if (theNbArgs < 2 || (theNbArgs == 2 && levmax < 0))
- {
- aSSC.SStream() << "Give n0 or id of entity";
- if (levmax < 0)
- aSSC.SStream() << " and dump level";
- else
- aSSC.SStream() << " + optional, dump level in [0 - " << levmax << "] , default = " << levdef;
- for (level = 0; level <= levmax; level++)
- {
- Standard_CString help = WL->DumpHelp(level);
- if (help[0] != '\0')
- aSSC.SStream() << level << " : " << help;
- }
- return 1;
- }
-
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- Standard_Integer num = WS->NumberFromLabel(arg1);
- if (num == 0)
- return 1;
- level = levdef;
- if (theNbArgs > 2)
- level = atoi(arg2);
- Handle(Standard_Transient) ent = WS->StartingEntity(num);
- if (ent.IsNull())
- {
- aSSC.SStream() << "No entity with given id " << arg1 << " (" << num << ") is found in the current model";
- }
- else
- {
- aSSC.SStream() << " -- DUMP Entity n0 " << num << " level " << level;
- WL->DumpEntity(WS->Model(), WS->Protocol(), ent, aSSC.SStream(), level);
-
- Interface_CheckIterator chl = WS->CheckOne(ent);
- if (!chl.IsEmpty(Standard_False))
- chl.Print(aSSC.SStream(), WS->Model(), Standard_False);
- }
- return 0;
-}
-
-//=======================================================================
-//function : funsign
-//purpose :
-//=======================================================================
-static Standard_Integer funsign(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- if (theNbArgs < 3)
- {
- aSSC.SStream() << " Give signature name + n0 or id of entity";
- return 1;
- }
- DeclareAndCast(IFSelect_Signature, sign, WS->NamedItem(arg1));
- if (sign.IsNull())
- {
- aSSC.SStream() << "Not a signature : " << arg1;
- return 1;
- }
- Standard_Integer num = WS->NumberFromLabel(arg2);
- Handle(Standard_Transient) ent = WS->StartingEntity(num);
- if (num == 0)
- return 1;
- aSSC.SStream() << "Entity n0 " << num << " : " << WS->SignValue(sign, ent);
- return 0;
-}
-
-//=======================================================================
-//function : funqp
-//purpose :
-//=======================================================================
-static Standard_Integer funqp(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- if (theNbArgs < 3)
- {
- aSSC.SStream() << " Give 2 numeros or labels : dad son";
- return 1;
- }
- Standard_Integer n1 = WS->NumberFromLabel(arg1);
- Standard_Integer n2 = WS->NumberFromLabel(arg2);
- aSSC.SStream() << "QueryParent for dad:" << arg1 << ":" << n1 << " and son:" << arg2 << ":" << n2;
- Standard_Integer qp = WS->QueryParent(WS->StartingEntity(n1), WS->StartingEntity(n2));
- if (qp < 0) aSSC.SStream() << arg1 << " is not super-entity of " << arg2;
- else if (qp == 0) aSSC.SStream() << arg1 << " is same as " << arg2;
- else aSSC.SStream() << arg1 << " is super-entity of " << arg2 << " , max level found=" << qp;
- // aSSC.SStream()<<" Trouve "<<qp<<std::endl;
- return 0;
-}
-
-//=======================================================================
-//function : fun12
-//purpose :
-//=======================================================================
-static Standard_Integer fun12(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- (void)theNbArgs;
- (void)theArgVec;
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- // **** DumpShare ****
- WS->DumpShare();
- return 0;
-}
-
-//=======================================================================
-//function : fun13
-//purpose :
-//=======================================================================
-static Standard_Integer fun13(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- (void)theNbArgs;
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- // **** ListItems ****
- WS->ListItems(theArgVec[1]);
- return 0;
-}
-
-//=======================================================================
-//function : fun15
-//purpose :
-//=======================================================================
-static Standard_Integer fun15(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- // **** SetInt ****
- if (theNbArgs < 3)
- {
- aSSC.SStream() << "Donner 2 arguments : nom Parametre et Valeur";
- return 1;
- }
- Standard_Integer val = atoi(arg2);
- DeclareAndCast(IFSelect_IntParam, par, WS->NamedItem(arg1));
- if (!WS->SetIntValue(par, val))
- return 1;
- return 0;
-}
-
-//=======================================================================
-//function : fun17
-//purpose :
-//=======================================================================
-static Standard_Integer fun17(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- // **** SetText ****
- if (theNbArgs < 3)
- {
- aSSC.SStream() << "Donner 2 arguments : nom Parametre et Valeur";
- return 1;
- }
- DeclareAndCast(TCollection_HAsciiString, par, WS->NamedItem(arg1));
- if (!WS->SetTextValue(par, arg2))
- return 1;
- return 0;
-}
-
-//=======================================================================
-//function : fun19
-//purpose :
-//=======================================================================
-static Standard_Integer fun19(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** DumpSel ****
- if (theNbArgs < 2)
- {
- aSSC.SStream() << "Give 1 argument : Selection Name";
- return 1;
- }
- WS->DumpSelection(GetCasted(IFSelect_Selection, WS->NamedItem(arg1)));
- return 0;
-}
-
-//=======================================================================
-//function : fun21
-//purpose :
-//=======================================================================
-static Standard_Integer fun21(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- (void)theNbArgs;
- (void)theArgVec;
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- // **** ClearItems ****
- WS->ClearItems(); WS->ClearFinalModifiers(); WS->ClearShareOut(Standard_False);
- return 0;
-}
-
-static Standard_Integer fun22(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** ClearData ****
- Standard_Integer mode = -1;
- if (theNbArgs >= 2)
- {
- if (arg1[0] == 'a') mode = 1;
- if (arg1[0] == 'g') mode = 2;
- if (arg1[0] == 'c') mode = 3;
- if (arg1[0] == 'p') mode = 4;
- if (arg1[0] == '?') mode = -1;
- }
- else mode = 0;
- if (mode <= 0)
- {
- if (mode < 0) aSSC.SStream() << "Give a suitable mode";
- aSSC.SStream() << " Available Modes :\n"
- << " a : all g : graph+check c : check p : selectpointed";
- return 1;
- }
- WS->ClearData(mode);
- return 0;
-}
-
-//=======================================================================
-//function : fun24
-//purpose :
-//=======================================================================
-static Standard_Integer fun24(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- // **** Item Label ****
- TCollection_AsciiString label;
- if (theNbArgs < 2)
- {
- aSSC.SStream() << " Give label to search";
- return 1;
- }
- for (int i = 1; i < theNbArgs; i++)
- {
- label.AssignCat(theArgVec[i]);
- if (i < theNbArgs - 1) label.AssignCat(" ");
- }
- for (int mode = 0; mode <= 2; mode++)
- {
- int nbitems = 0; int id;
- aSSC.SStream() << "Searching label : " << label << ". in mode ";
- if (mode == 0) aSSC.SStream() << " exact";
- if (mode == 1) aSSC.SStream() << " same head";
- if (mode == 2) aSSC.SStream() << " search if present";
- for (id = WS->NextIdentForLabel(label.ToCString(), 0, mode); id != 0;
- id = WS->NextIdentForLabel(label.ToCString(), id, mode))
- {
- aSSC.SStream() << " " << id; nbitems++;
- }
- aSSC.SStream() << " -- giving " << nbitems << " found";
- }
- return 0;
-}
-
-//=======================================================================
-//function : fun25
-//purpose :
-//=======================================================================
-static Standard_Integer fun25(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** Save (Dump) ****
- if (theNbArgs < 2)
- {
- aSSC.SStream() << "Donner nom du Fichier";
- return 1;
- }
- IFSelect_SessionFile dumper(WS, arg1);
- if (!dumper.IsDone())
- return 1;
- return 0;
-}
-
-//=======================================================================
-//function : fun26
-//purpose :
-//=======================================================================
-static Standard_Integer fun26(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** Restore (Dump) ****
- if (theNbArgs < 2)
- {
- aSSC.SStream() << "Donner nom du Fichier";
- return 1;
- }
- IFSelect_SessionFile dumper(WS);
- Standard_Integer readstat = dumper.Read(arg1);
- if (readstat == 0)
- return 0;
- else if (readstat > 0) aSSC.SStream() << "-- Erreur Lecture Fichier " << arg1;
- else aSSC.SStream() << "-- Pas pu ouvrir Fichier " << arg1;
- return 0;
-}
-
-//=======================================================================
-//function : fun27
-//purpose :
-//=======================================================================
-static Standard_Integer fun27(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- const Standard_CString arg1 = theArgVec[1];
- Standard_CString arg2 = theArgVec[2];
- const Standard_CString anEmptyStr = "";
- if (arg2 && strlen(arg2) == 2 && arg2[0] == '"' && arg2[1] == '"')
- {
- arg2 = anEmptyStr;
- }
- // **** Param(Value) ****
- if (theNbArgs < 2 || (theNbArgs == 3 && strcmp(arg1, "-p") == 0))
- {
- Handle(TColStd_HSequenceOfHAsciiString) li = Interface_Static::Items();
- Standard_Integer i, nb = li->Length(), aPatternNb = 0;
- size_t aPatternLen = strlen(arg2);
- if (theNbArgs == 3)
- {
- for (i = 1; i <= nb; i++)
- {
- if (strncmp(li->Value(i)->String().ToCString(), arg2, aPatternLen) == 0)
- {
- aPatternNb++;
- }
- }
- }
- else
- {
- aPatternNb = nb;
- }
- aSSC.SStream() << " List of parameters : " << aPatternNb << " items : ";
- for (i = 1; i <= nb; i++)
- {
- if (theNbArgs == 3 && strncmp(li->Value(i)->String().ToCString(), arg2, aPatternLen) != 0)
- {
- continue;
- }
- aSSC.SStream() << li->Value(i)->String();
- aSSC.SStream() << " : " << Interface_Static::CVal(li->Value(i)->ToCString());
- }
- return 0;
- }
- else if (atoi(arg1) > 0)
- {
- Standard_Integer use = atoi(arg1);
- WS->TraceStatics(use);
- }
- else
- {
- if (theNbArgs > 2) aSSC.SStream() << " FORMER STATUS of Static Parameter " << arg1;
- else aSSC.SStream() << " ACTUAL STATUS of Static Parameter " << arg1;
- if (!Interface_Static::IsPresent(arg1))
- {
- aSSC.SStream() << " Parameter " << arg1 << " undefined";
- return 1;
- }
- if (!Interface_Static::IsSet(arg1)) aSSC.SStream() << " Parameter " << arg1 << " not valued";
- else if (theNbArgs == 2) Interface_Static::Static(arg1)->Print(aSSC.SStream());
- else aSSC.SStream() << " Value : " << Interface_Static::CVal(arg1);
-
- if (theNbArgs == 2) aSSC.SStream() << "To modify, param name_param new_val";
- else
- {
- if (strlen(arg2) != 0)
- {
- aSSC.SStream() << " New demanded value : " << arg2;
- }
- else
- {
- aSSC.SStream() << " New demanded value : not valued";
- }
- if (Interface_Static::SetCVal(arg1, arg2))
- {
- aSSC.SStream() << " OK";
- return 0;
- }
- else
- {
- aSSC.SStream() << " , refused";
- return 1;
- }
- }
- }
- return 0;
-}
-
-//=======================================================================
-//function : fun29
-//purpose :
-//=======================================================================
-static Standard_Integer fun29(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- (void)theNbArgs;
- (void)theArgVec;
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- // **** SentFiles ****
- Handle(TColStd_HSequenceOfHAsciiString) list = WS->SentFiles();
- if (list.IsNull())
- {
- aSSC.SStream() << "List of Sent Files not enabled";
- return 0;
- }
- Standard_Integer i, nb = list->Length();
- aSSC.SStream() << " Sent Files : " << nb << " : ";
- for (i = 1; i <= nb; i++)
- aSSC.SStream() << list->Value(i)->ToCString();
- return 0;
-}
-
-//=======================================================================
-//function : fun30
-//purpose :
-//=======================================================================
-static Standard_Integer fun30(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** FilePrefix ****
- if (theNbArgs < 2)
- {
- if (WS->FilePrefix().IsNull()) aSSC.SStream() << "Pas de prefixe defini";
- else aSSC.SStream() << "Prefixe : " << WS->FilePrefix()->ToCString();
- aSSC.SStream() << "Pour changer : filepref newprefix";
- return 0;
- }
- WS->SetFilePrefix(arg1);
- return 0;
-}
-
-//=======================================================================
-//function : fun31
-//purpose :
-//=======================================================================
-static Standard_Integer fun31(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** FileExtension ****
- if (theNbArgs < 2)
- {
- if (WS->FileExtension().IsNull()) aSSC.SStream() << "Pas d extension definie";
- else aSSC.SStream() << "Extension : " << WS->FileExtension()->ToCString();
- aSSC.SStream() << "Pour changer : fileext newext";
- return 0;
- }
- WS->SetFileExtension(arg1);
- return 0;
-}
-
-//=======================================================================
-//function : fun32
-//purpose :
-//=======================================================================
-static Standard_Integer fun32(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- // **** FileRoot ****
- if (theNbArgs < 2)
- {
- aSSC.SStream() << "Donner Dispatch et nom de Root";
- return 1;
- }
- DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(arg1));
- if (theNbArgs < 3)
- {
- if (WS->FileRoot(disp).IsNull()) aSSC.SStream() << "Pas de racine definie pour " << arg1;
- else aSSC.SStream() << "Racine pour " << arg1 << " : " << WS->FileRoot(disp)->ToCString();
- aSSC.SStream() << "Pour changer : fileroot nomdisp newroot";
- return 0;
- }
- if (!WS->SetFileRoot(disp, arg2))
- return 1;
- return 0;
-}
-
-//=======================================================================
-//function : fun33
-//purpose :
-//=======================================================================
-static Standard_Integer fun33(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** Default File Root ****
- if (theNbArgs < 2)
- {
- if (WS->DefaultFileRoot().IsNull()) aSSC.SStream() << "Pas de racine par defaut definie";
- else aSSC.SStream() << "Racine par defaut : " << WS->DefaultFileRoot()->ToCString();
- aSSC.SStream() << "Pour changer : filedef newdef";
- return 0;
- }
- WS->SetDefaultFileRoot(arg1);
- return 0;
-}
-
-//=======================================================================
-//function : fun34
-//purpose :
-//=======================================================================
-static Standard_Integer fun34(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- (void)theNbArgs;
- (void)theArgVec;
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- // **** EvalFile ****
- if (!WS->HasModel())
- {
- aSSC.SStream() << "Pas de Modele charge, abandon";
- return 1;
- }
-
- aSSC.SStream() << "Evaluation avec Memorisation des resultats";
- 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())
- {
- aSSC.SStream() << "Modele " << i << " Model non genere ..."; continue;
- }
- TCollection_AsciiString name = WS->FileName(i);
- aSSC.SStream() << "Fichier n0 " << i << " Nb Entites : " << mod->NbEntities() << " Nom: ";
- aSSC.SStream() << name;
- }
- return 0;
-}
-
-//=======================================================================
-//function : fun35
-//purpose :
-//=======================================================================
-static Standard_Integer fun35(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- (void)theNbArgs;
- (void)theArgVec;
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- // **** ClearFile ****
- WS->ClearFile();
- return 0;
-}
-
-//=======================================================================
-//function : fun36
-//purpose :
-//=======================================================================
-static Standard_Integer fun36(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- // **** Split ****
- IFSelect_ReturnStatus stat = IFSelect_RetVoid;
- if (theNbArgs < 2) aSSC.SStream() << "Split : derniere liste de dispatches definie";
- else
- {
- WS->ClearShareOut(Standard_True);
- for (Standard_Integer i = 1; i < theNbArgs; i++)
- {
- DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(theArgVec[i]));
- if (disp.IsNull())
- {
- aSSC.SStream() << "Pas un dispatch:" << theArgVec[i] << ", Splitt abandonne";
- stat = IFSelect_RetError;
- }
- else WS->SetActive(disp, Standard_True);
- }
- }
- if (stat == IFSelect_RetError)
- return stat;
- WS->BeginSentFiles(Standard_True);
- if (!WS->SendSplit())
- return 1;
- return 0;
-}
-
-//=======================================================================
-//function : fun37
-//purpose :
-//=======================================================================
-static Standard_Integer fun37(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** Remaining Data ****
- char mode = '?'; IFSelect_RemainMode numod = IFSelect_RemainDisplay;
- if (theNbArgs >= 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
- {
- if (theNbArgs < 2) aSSC.SStream() << "Donner un Mode - ";
- aSSC.SStream() << "Modes possibles : l list, c compute, u undo, f forget";
- if (mode == '?')
- return 0;
- else
- return 1;
- }
- if (!WS->SetRemaining(numod))
- return 0;
- return 0;
-}
-
-//=======================================================================
-//function : fun38
-//purpose :
-//=======================================================================
-static Standard_Integer fun38(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- // **** SetModelContent ****
- if (theNbArgs < 3)
- {
- aSSC.SStream() << "Donner nom selection et mode (k=keep,r=remove)";
- return 1;
- }
- Standard_Boolean keepmode;
- DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
- if (sel.IsNull())
- {
- aSSC.SStream() << "Pas de Selection de Nom : " << arg1;
- return 1;
- }
- if (arg2[0] == 'k')
- {
- aSSC.SStream() << " -- SetContent keep ..."; keepmode = Standard_True;
- }
- else if (arg2[0] == 'r')
- {
- aSSC.SStream() << " -- SetContent remove ..."; keepmode = Standard_False;
- }
- else
- {
- aSSC.SStream() << "Donner nom selection et mode (k=keep,r=remove)";
- return 1;
- }
-
- if (WS->SetModelContent(sel, keepmode)) aSSC.SStream() << " Done";
- else aSSC.SStream() << " Result empty, ignored";
- return 0;
-}
-
-//=======================================================================
-//function : fun40
-//purpose :
-//=======================================================================
-static Standard_Integer fun40(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- (void)theNbArgs;
- (void)theArgVec;
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- // **** ListModif ****
- WS->ListFinalModifiers(Standard_True);
- WS->ListFinalModifiers(Standard_False);
- return 0;
-}
-
-//=======================================================================
-//function : fun41
-//purpose :
-//=======================================================================
-static Standard_Integer fun41(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** Modifier ****
- if (theNbArgs < 2)
- {
- aSSC.SStream() << "Donner Nom du Modifier";
- return 1;
- }
- DeclareAndCast(IFSelect_GeneralModifier, modif, WS->NamedItem(arg1));
- if (modif.IsNull())
- {
- aSSC.SStream() << "Pas de Modifier de Nom : " << arg1;
- return 0;
- }
- Handle(IFSelect_IntParam) low, up;
-
- Handle(IFSelect_Dispatch) disp = modif->Dispatch();
- aSSC.SStream() << "Modifier : " << arg1 << " Label : " << modif->Label();
- Standard_Integer rank = WS->ModifierRank(modif);
- if (modif->IsKind(STANDARD_TYPE(IFSelect_Modifier)))
- aSSC.SStream() << "Model Modifier n0." << rank;
- else aSSC.SStream() << "File Modifier n0." << rank;
- if (disp.IsNull()) aSSC.SStream() << " Applique a tous les Dispatchs";
- else
- {
- aSSC.SStream() << " Dispatch : " << disp->Label();
- if (WS->HasName(disp)) aSSC.SStream() << " - Nom:" << WS->Name(disp)->ToCString();
-
- }
-
- Handle(IFSelect_Selection) sel = modif->Selection();
- if (!sel.IsNull()) aSSC.SStream() << " Selection : " << sel->Label();
- if (WS->HasName(sel)) aSSC.SStream() << " - Nom:" << WS->Name(sel)->ToCString();
-
- return 0;
-}
-
-//=======================================================================
-//function : fun42
-//purpose :
-//=======================================================================
-static Standard_Integer fun42(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- // **** ModifSel ****
- if (theNbArgs < 2)
- {
- aSSC.SStream() << "Donner Nom Modifier; + Nom Selection optionnel\n"
- << "Selection pour Mettre une Selection, sinon Annule";
- return 1;
- }
- DeclareAndCast(IFSelect_GeneralModifier, modif, WS->NamedItem(arg1));
- if (modif.IsNull())
- {
- aSSC.SStream() << "Pas un nom de Modifier : " << arg1;
- return 1;
- }
- Handle(IFSelect_Selection) sel;
- if (arg2[0] != '\0')
- {
- sel = GetCasted(IFSelect_Selection, WS->NamedItem(arg2));
- if (sel.IsNull())
- {
- aSSC.SStream() << "Pas un nom de Selection : " << arg2;
- return 1;
- }
- }
- if (!WS->SetItemSelection(modif, sel))
- return 1;
- return 0;
-}
-
-//=======================================================================
-//function : fun43
-//purpose :
-//=======================================================================
-static Standard_Integer fun43(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- // **** SetAppliedModifier ****
- if (theNbArgs < 2)
- {
- aSSC.SStream() << "Donner Nom Modifier; + Nom Dispatch ou Transformer optionnel :\n"
- << " - rien : tous Dispatches\n - Dispatch : ce Dispatch seul\n"
- << " - Transformer : pas un Dispatch mais un Transformer";
- return 1;
- }
- DeclareAndCast(IFSelect_GeneralModifier, modif, WS->NamedItem(arg1));
- if (modif.IsNull())
- {
- aSSC.SStream() << "Pas un nom de Modifier : " << arg1;
- return 1;
- }
- Handle(Standard_Transient) item;
- if (arg2[0] != '\0')
- {
- item = WS->NamedItem(arg2);
- if (item.IsNull())
- {
- aSSC.SStream() << "Pas un nom connu : " << arg2;
- return 1;
- }
- }
- else item = WS->ShareOut();
- if (!WS->SetAppliedModifier(modif, item))
- return 1;
- return 0;
-}
-
-//=======================================================================
-//function : fun44
-//purpose :
-//=======================================================================
-static Standard_Integer fun44(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** ResetApplied (modifier) ****
- if (theNbArgs < 2)
- {
- aSSC.SStream() << "Designer un modifier";
- return 1;
- }
- DeclareAndCast(IFSelect_GeneralModifier, modif, WS->NamedItem(arg1));
- if (modif.IsNull())
- {
- aSSC.SStream() << "Pas un nom de Modifier : " << arg1;
- return 1;
- }
- if (!WS->ResetAppliedModifier(modif))
- return 1;
- return 0;
-}
-
-//=======================================================================
-//function : fun45
-//purpose :
-//=======================================================================
-static Standard_Integer fun45(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- const Standard_CString arg3 = theArgVec[3];
- // **** ModifMove ****
- if (theNbArgs < 4)
- {
- aSSC.SStream() << "modifmove MF rang1 rang2, M pour Model F pour File";
- return 1;
- }
- 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
- {
- aSSC.SStream() << "preciser M pour Model, F pour File";
- return 1;
- }
- Standard_Integer before = atoi(arg2);
- Standard_Integer after = atoi(arg3);
- if (before == 0 || after == 0)
- {
- aSSC.SStream() << "Donner 2 Entiers Positifs";
- return 1;
- }
- if (!WS->ChangeModifierRank(formodel, before, after))
- return 1;
- return 0;
-}
-
-//=======================================================================
-//function : fun51
-//purpose :
-//=======================================================================
-static Standard_Integer fun51(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- // **** DispSel ****
- if (theNbArgs < 3)
- {
- aSSC.SStream() << "Donner Noms Dispatch et Selection Finale";
- return 1;
- }
- DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(arg1));
- if (disp.IsNull())
- {
- aSSC.SStream() << "Pas un nom de Dispatch : " << arg1;
- return 1;
- }
- DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg2));
- if (sel.IsNull())
- {
- aSSC.SStream() << "Pas un nom de Selection : " << arg2;
- return 1;
- }
- if (!WS->SetItemSelection(disp, sel))
- return 1;
- return 0;
-}
-
-//=======================================================================
-//function : fun56
-//purpose :
-//=======================================================================
-static Standard_Integer fun56(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** Dispatch ****
- if (theNbArgs < 2)
- {
- aSSC.SStream() << "Donner Nom du Dispatch";
- return 1;
- }
- DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(arg1));
- if (disp.IsNull())
- {
- aSSC.SStream() << "Pas un dispatch : " << arg1;
- return 1;
- }
- Standard_Integer num = WS->DispatchRank(disp);
- aSSC.SStream() << "Dispatch de Nom : " << arg1 << " , en ShareOut, Numero " << num << " : ";
- Handle(IFSelect_Selection) sel = WS->ItemSelection(disp);
- Handle(TCollection_HAsciiString) selname = WS->Name(sel);
- if (sel.IsNull()) aSSC.SStream() << "Pas de Selection Finale";
- else if (selname.IsNull()) aSSC.SStream() << "Selection Finale : #" << WS->ItemIdent(sel);
- else aSSC.SStream() << "Selection Finale : " << selname->ToCString();
- if (disp->HasRootName()) aSSC.SStream() << "-- Racine nom de fichier : "
- << disp->RootName()->ToCString();
- return 0;
-}
-
-//=======================================================================
-//function : fun57
-//purpose :
-//=======================================================================
-static Standard_Integer fun57(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** Remove ****
- if (theNbArgs < 2)
- {
- aSSC.SStream() << "Give Name to Remove !";
- return 1;
- }
- if (!WS->RemoveNamedItem(arg1))
- return 1;
- return 0;
-}
-
-//=======================================================================
-//function : fun58
-//purpose :
-//=======================================================================
-static Standard_Integer fun58(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** EvalDisp ****
- if (theNbArgs < 3)
- {
- aSSC.SStream() << "evaldisp mode disp [disp ...] : Mode + Name(s) of Dispatch(es). Mode:\n"
- << " 0 brief 1 +forgotten ents 2 +duplicata 3 1+2"
- << "See also : evaladisp writedisp xsplit";
- return 0;
- }
- Standard_Boolean OK = Standard_True;
- Standard_Integer i, mode = atoi(arg1); aSSC.SStream() << " Mode " << mode << "\n";
- for (i = 2; i < theNbArgs; i++)
- {
- DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(theArgVec[i]));
- if (disp.IsNull())
- {
- aSSC.SStream() << "Not a dispatch:" << theArgVec[i]; OK = Standard_False;
- }
- }
- if (!OK)
- {
- aSSC.SStream() << "Some of the parameters are not correct";
- return 1;
- }
-
- WS->ClearShareOut(Standard_True);
- for (i = 2; i < theNbArgs; i++)
- {
- DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(theArgVec[i]));
- WS->SetActive(disp, Standard_True);
- }
- // WS->EvaluateDispatch(disp,mode);
- WS->EvaluateComplete(mode);
- return 0;
-}
-
-//=======================================================================
-//function : fun59
-//purpose :
-//=======================================================================
-static Standard_Integer fun59(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** EvalComplete ****
- Standard_Integer mode = 0;
- if (theNbArgs < 2) aSSC.SStream() << " -- mode par defaut 0\n";
- else
- {
- mode = atoi(arg1); aSSC.SStream() << " -- mode : " << mode;
- }
- WS->EvaluateComplete(mode);
- return 0;
-}
-
-//=======================================================================
-//function : fun60
-//purpose :
-//=======================================================================
-static Standard_Integer fun60(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- (void)theNbArgs;
- (void)theArgVec;
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- // **** LastRunCheckList ****
- Interface_CheckIterator chlist = WS->LastRunCheckList();
- Handle(IFSelect_CheckCounter) counter = new IFSelect_CheckCounter(0);
- counter->Analyse(chlist, WS->Model(), Standard_False);
- counter->PrintCount(aSSC.SStream());
- return 0;
-}
-
-//=======================================================================
-//function : fun61
-//purpose :
-//=======================================================================
-static Standard_Integer fun61(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** RunTransformer ****
- if (theNbArgs < 2)
- {
- aSSC.SStream() << "Donner Nom de Transformer";
- return 1;
- }
- DeclareAndCast(IFSelect_Transformer, tsf, WS->NamedItem(arg1));
- Standard_Integer effect = WS->RunTransformer(tsf);
- switch (effect)
- {
- case -4: aSSC.SStream() << "Edition sur place, nouveau Protocole, erreur recalcul graphe"; break;
- case -3: aSSC.SStream() << "Erreur, Transformation ignoree"; break;
- case -2: aSSC.SStream() << "Erreur sur edition sur place, risque de corruption (verifier)"; break;
- case -1: aSSC.SStream() << "Erreur sur edition locale, risque de corruption (verifier)"; break;
- case 0:
- if (tsf.IsNull()) aSSC.SStream() << "Erreur, pas un Transformer: " << arg1;
- else aSSC.SStream() << "Execution non faite";
- break;
- case 1: aSSC.SStream() << "Transformation locale (graphe non touche)"; break;
- case 2: aSSC.SStream() << "Edition sur place (graphe recalcule)"; break;
- case 3: aSSC.SStream() << "Modele reconstruit"; break;
- case 4: aSSC.SStream() << "Edition sur place, nouveau Protocole"; break;
- case 5: aSSC.SStream() << "Nouveau Modele avec nouveau Protocole"; break;
- default: break;
- }
- return ((effect > 0) ? IFSelect_RetDone : IFSelect_RetFail);
-}
-
-//=======================================================================
-//function : fun70
-//purpose :
-//=======================================================================
-static Standard_Integer fun70(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** SelToggle ****
- if (theNbArgs < 2)
- {
- aSSC.SStream() << "Donner Nom de Selection";
- return 1;
- }
- DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
- if (!WS->ToggleSelectExtract(sel))
- {
- aSSC.SStream() << "Pas une SelectExtract : " << arg1;
- return 1;
- }
- if (WS->IsReversedSelectExtract(sel)) aSSC.SStream() << arg1 << " a present Reversed";
- else aSSC.SStream() << arg1 << " a present Directe";
- return 0;
-}
-
-//=======================================================================
-//function : fun71
-//purpose :
-//=======================================================================
-static Standard_Integer fun71(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- // **** SelInput ****
- if (theNbArgs < 3)
- {
- aSSC.SStream() << "Donner Noms Selections cible et input";
- return 1;
- }
- DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
- DeclareAndCast(IFSelect_Selection, sou, WS->NamedItem(arg2));
- if (sel.IsNull() || sou.IsNull())
- {
- aSSC.SStream() << "Incorrect : " << arg1 << "," << arg2;
- return 1;
- }
- if (!WS->SetInputSelection(sel, sou))
- {
- aSSC.SStream() << "Nom incorrect ou Selection " << arg1 << " ni Extract ni Deduct";
- return 1;
- }
- return 0;
-}
-
-//=======================================================================
-//function : fun77
-//purpose :
-//=======================================================================
-static Standard_Integer fun77(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- // **** SelControlMain ****
- if (theNbArgs < 3)
- {
- aSSC.SStream() << "Donner Noms de Control et MainInput";
- return 1;
- }
- DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
- DeclareAndCast(IFSelect_Selection, selmain, WS->NamedItem(arg2));
- if (WS->SetControl(sel, selmain, Standard_True))
- return 0;
- aSSC.SStream() << "Nom incorrect ou Selection " << arg1 << " pas de type Control";
- return 1;
-}
-
-//=======================================================================
-//function : fun78
-//purpose :
-//=======================================================================
-static Standard_Integer fun78(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- // **** SelControlSecond ****
- if (theNbArgs < 3)
- {
- aSSC.SStream() << "Donner Noms de Control et SecondInput";
- return 1;
- }
- DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
- DeclareAndCast(IFSelect_Selection, seldif, WS->NamedItem(arg2));
- if (WS->SetControl(sel, seldif, Standard_False)) return 0;
- aSSC.SStream() << "Nom incorrect ou Selection " << arg1 << " pas de type Control";
- return 1;
-}
-
-//=======================================================================
-//function : fun80
-//purpose :
-//=======================================================================
-static Standard_Integer fun80(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- // **** SelCombAdd ****
- if (theNbArgs < 3)
- {
- aSSC.SStream() << "Donner n0 Combine et une Input";
- return 1;
- }
- DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
- DeclareAndCast(IFSelect_Selection, seladd, WS->NamedItem(arg2));
- if (WS->CombineAdd(sel, seladd))
- return 0;
- aSSC.SStream() << "Nom incorrect ou Selection " << arg1 << " pas Combine";
- return 1;
-}
-
-//=======================================================================
-//function : fun81
-//purpose :
-//=======================================================================
-static Standard_Integer fun81(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- // **** SelCombRem ****
- if (theNbArgs < 3)
- {
- aSSC.SStream() << "Donner n0 Combine et RANG a supprimer";
- return 1;
- }
- DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
- DeclareAndCast(IFSelect_Selection, inp, WS->NamedItem(arg2));
- if (WS->CombineRemove(sel, inp))
- return 0;
- aSSC.SStream() << "Nom incorrect ou Selection " << arg1 << " ni Union ni Intersection";
- return 1;
-}
-
-//=======================================================================
-//function : fun91
-//purpose :
-//=======================================================================
-static Standard_Integer fun91(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- const Standard_CString arg1 = theArgVec[1];
- // **** SetPointed (edit) / SetList (edit) ****
- if (theNbArgs < 2)
- {
- aSSC.SStream() << "Donner NOM SelectPointed + Option(s) :\n"
- << " aucune : liste des entites pointees\n"
- << " 0: Clear +nn ajout entite nn -nn enleve nn /nn toggle nn";
- return 1;
- }
- DeclareAndCast(IFSelect_SelectPointed, sp, WS->NamedItem(arg1));
- if (sp.IsNull())
- {
- aSSC.SStream() << "Pas une SelectPointed:" << arg1;
- return 1;
- }
- const Handle(Interface_InterfaceModel)& model = WS->Model(); // pour Print
- if (theNbArgs == 2)
- { // listage simple
- Standard_Integer nb = sp->NbItems();
- aSSC.SStream() << " SelectPointed : " << arg1 << " : " << nb << " Items :";
- for (Standard_Integer i = 1; i <= nb; i++)
- {
- Handle(Standard_Transient) pointed = sp->Item(i);
- Standard_Integer id = WS->StartingNumber(pointed);
- if (id == 0) aSSC.SStream() << " (inconnu)";
- else
- {
- aSSC.SStream() << " "; model->Print(pointed, aSSC.SStream());
- }
- }
- return 0;
- }
-
- for (Standard_Integer ia = 2; ia < theNbArgs; ia++)
- {
- const TCollection_AsciiString argi = theArgVec[ia];
- Standard_Integer id = WS->NumberFromLabel(&(argi.ToCString())[1]);
- if (id == 0)
- {
- if (!argi.IsEqual("0")) aSSC.SStream() << "Incorrect,ignore:" << argi;
- else
- {
- aSSC.SStream() << "Clear SelectPointed"; sp->Clear();
- }
- }
- else if (argi.Value(1) == '-')
- {
- Handle(Standard_Transient) item = WS->StartingEntity(id);
- if (sp->Remove(item)) aSSC.SStream() << "Removed:no." << id;
- else aSSC.SStream() << " Echec Remove " << id;
- aSSC.SStream() << ": ";
- model->Print(item, aSSC.SStream());
- }
- else if (argi.Value(1) == '/')
- {
- Handle(Standard_Transient) item = WS->StartingEntity(id);
- if (sp->Remove(item)) aSSC.SStream() << "Toggled:n0." << id;
- else aSSC.SStream() << " Echec Toggle " << id;
- aSSC.SStream() << ": ";
- model->Print(item, aSSC.SStream());
- }
- else if (argi.Value(1) == '+')
- {
- Handle(Standard_Transient) item = WS->StartingEntity(id);
- if (sp->Add(item)) aSSC.SStream() << "Added:no." << id;
- else aSSC.SStream() << " Echec Add " << id;
- aSSC.SStream() << ": ";
- model->Print(item, aSSC.SStream());
- }
- else
- {
- aSSC.SStream() << "Ignore:" << argi << " , donner n0 PRECEDE de + ou - ou /";
- }
- }
- return 0;
-}
-
-//=======================================================================
-//function : fun_editlist
-//purpose :
-//=======================================================================
-static Standard_Integer fun_editlist(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- if (theNbArgs < 2)
- {
- aSSC.SStream() << "Give the name of an EditForm or an Editor";
- return 1;
- }
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
-
- // EditForm
-
- DeclareAndCast(IFSelect_EditForm, edf, WS->NamedItem(arg1));
- Handle(IFSelect_Editor) edt;
- if (!edf.IsNull())
- {
- aSSC.SStream() << "Print EditForm " << arg1;
- edt = edf->Editor();
- if (theNbArgs < 3)
- {
- // DEFINITIONS : Editor (direct ou via EditForm)
-
- if (edt.IsNull()) edt = GetCasted(IFSelect_Editor, WS->NamedItem(arg1));
- if (edt.IsNull())
- return 0;
-
- aSSC.SStream() << "Editor, Label : " << edt->Label();
- aSSC.SStream() << " -- Names (short - complete) + Labels of Values";
- edt->PrintNames(aSSC.SStream());
- aSSC.SStream() << " -- Definitions --";
- edt->PrintDefs(aSSC.SStream());
- if (!edf.IsNull())
- {
- edf->PrintDefs(aSSC.SStream());
- aSSC.SStream() << "To display values, add an option : o original f final m modified";
- }
-
- return 0;
-
- }
- else
- {
- char opt = arg2[0];
- Standard_Integer what = 0;
- if (opt == 'o') what = -1;
- else if (opt == 'f') what = 1;
-
- edf->PrintValues(aSSC.SStream(), what, Standard_False);
- }
- }
-
- return 0;
-}
-
-//=======================================================================
-//function : fun_editclear
-//purpose :
-//=======================================================================
-static Standard_Integer fun_editclear(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- if (theNbArgs < 2)
- {
- aSSC.SStream() << "Give the name of an EditForm [+ name of Value else all]";
- return 1;
- }
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- DeclareAndCast(IFSelect_EditForm, edf, WS->NamedItem(arg1));
- if (edf.IsNull())
- {
- aSSC.SStream() << "Not an EditForm : " << arg1;
- return 1;
- }
- if (theNbArgs < 3)
- {
- edf->ClearEdit(); aSSC.SStream() << "All Modifications Cleared";
- }
- else
- {
- Standard_Integer num = edf->NameNumber(arg2);
- if (num == 0) aSSC.SStream() << "Unknown Value Name : " << arg2;
- if (num < 0) aSSC.SStream() << "Not Extracted Value Name : " << arg2;
- if (num <= 0)
- return 1;
- if (!edf->IsModified(num))
- {
- aSSC.SStream() << "Value " << arg2 << " was not modified";
- return 0;
- }
- edf->ClearEdit(num);
- aSSC.SStream() << "Modification on Value " << arg2 << " Cleared";
- }
- return 0;
-}
-
-//=======================================================================
-//function : fun_editapply
-//purpose :
-//=======================================================================
-static Standard_Integer fun_editapply(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- if (theNbArgs < 2)
- {
- aSSC.SStream() << "Give the name of an EditForm [+ option keep to re-apply edited values]";
- return 1;
- }
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- DeclareAndCast(IFSelect_EditForm, edf, WS->NamedItem(arg1));
- if (edf.IsNull())
- {
- aSSC.SStream() << "Not an EditForm : " << arg1;
- return 1;
- }
-
- Handle(Standard_Transient) ent = edf->Entity();
- Handle(Interface_InterfaceModel) model = edf->Model();
- if (!model.IsNull())
- {
- if (ent.IsNull()) aSSC.SStream() << "Applying modifications on loaded model";
- else
- {
- aSSC.SStream() << "Applying modifications on loaded entity : ";
- model->PrintLabel(ent, aSSC.SStream());
- }
- }
- else aSSC.SStream() << "Applying modifications";
-
- if (!edf->ApplyData(edf->Entity(), edf->Model()))
- {
- aSSC.SStream() << "Modifications could not be applied";
- return 1;
- }
- aSSC.SStream() << "Modifications have been applied";
-
- Standard_Boolean stat = Standard_True;
- if (theNbArgs > 2 && arg2[0] == 'k') stat = Standard_False;
- if (stat)
- {
- edf->ClearEdit();
- aSSC.SStream() << "Edited values are cleared";
- }
- else aSSC.SStream() << "Edited values are kept for another loading/applying";
-
- return 0;
-}
-
-//=======================================================================
-//function : fun_editload
-//purpose :
-//=======================================================================
-static Standard_Integer fun_editload(Draw_Interpretor& theDI,
- Standard_Integer theNbArgs,
- const char** theArgVec)
-{
- XSDRAW::StreamContainer aSSC(theDI);
- if (theNbArgs < 2)
- {
- aSSC.SStream() << "Give the name of an EditForm [+ Entity-Ident]";
- return 1;
- }
- const Standard_CString arg1 = theArgVec[1];
- const Standard_CString arg2 = theArgVec[2];
- Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
- DeclareAndCast(IFSelect_EditForm, edf, WS->NamedItem(arg1));
- if (edf.IsNull())
- {
- aSSC.SStream() << "Not an EditForm : " << arg1;
- return 1;
- }
-
- Standard_Integer num = (theNbArgs < 3 ? 0 : WS->NumberFromLabel(arg2));
- Standard_Boolean stat = Standard_False;
- if (theNbArgs < 3)
- {
- aSSC.SStream() << "EditForm " << arg1 << " : Loading Model";
- stat = edf->LoadModel(WS->Model());
- }
- else if (num <= 0)
- {
- aSSC.SStream() << "Not an entity ident : " << arg2;
- return 1;
- }
- else
- {
- aSSC.SStream() << "EditForm " << arg1 << " : Loading Entity " << arg2;
- stat = edf->LoadData(WS->StartingEntity(num), WS->Model());
- }
-
- if (!stat)
- {
- aSSC.SStream() << "Loading not done";
- return 1;
- }
- aSSC.SStream() << "Loading done";
- return 0;
-}
-
-//=======================================================================
-//function : Init
-//purpose :
-//=======================================================================
-void XSDRAW_FunctionsSession::Init(Draw_Interpretor& theDI)
-{
- static int THE_XSDRAW_FunctionsSession_initactor = 0;
- if (THE_XSDRAW_FunctionsSession_initactor)
- {
- return;
- }
-
- THE_XSDRAW_FunctionsSession_initactor = 1;
- Standard_CString aGroup = "DE: General";
- theDI.Add("xstatus", "Lists XSTEP Status : Version, System Name ...", __FILE__, funstatus, aGroup);
- theDI.Add("handler", "Toggle status catch Handler Error of the session", __FILE__, fun1, aGroup);
- theDI.Add("xload", "file:string : Read File -> Load Model", __FILE__, fun3, aGroup);
- theDI.Add("xread", "file:string : Read File -> Load Model", __FILE__, fun3, aGroup);
- theDI.Add("writeall", "file:string : Write all model (no split)", __FILE__, fun4, aGroup);
- //theDI.Add("writesel", "file:string sel:Selection : Write Selected (no split)", __FILE__, fun5, aGroup);
- theDI.Add("writeent", "file:string n1ent n2ent...:integer : Write Entite(s) (no split)", __FILE__, fun6, aGroup);
- theDI.Add("writent", "file:string n1ent n2ent...:integer : Write Entite(s) (no split)", __FILE__, fun6, aGroup);
- theDI.Add("elabel", "nument:integer : Displays Label Model of an entity", __FILE__, fun7, aGroup);
- theDI.Add("enum", "label:string : Displays entities n0.s of which Label Model ends by..", __FILE__, fun8, aGroup);
-
- theDI.Add("listtypes", "List nb entities per type. Optional selection name else all model", __FILE__, fun9, aGroup);
- //theDI.Add("count", "Count : counter [selection]", __FILE__, funcount, aGroup);
- //theDI.Add("listcount", "List Counted : counter [selection [nument]]", __FILE__, funcount, aGroup);
- //theDI.Add("sumcount", "Summary Counted : counter [selection [nument]]", __FILE__, funcount, aGroup);
- theDI.Add("signtype", "Sign Type [newone]", __FILE__, funsigntype, aGroup);
- theDI.Add("signcase", "signature : displays possible cases", __FILE__, funsigncase, aGroup);
-
- theDI.Add("estatus", "ent/nument : displays status of an entity", __FILE__, fun10, aGroup);
- theDI.Add("data", "Data (DumpModel); whole help : data tout court", __FILE__, fun11, aGroup);
- theDI.Add("entity", "give n0 ou id of entity [+ level]", __FILE__, fundumpent, aGroup);
- theDI.Add("signature", "signature name + n0/ident entity", __FILE__, funsign, aGroup);
- theDI.Add("queryparent", " give 2 n0s/labels of entities : dad son", __FILE__, funqp, aGroup);
-
- theDI.Add("dumpshare", "Dump Share (dispatches, IntParams)", __FILE__, fun12, aGroup);
- theDI.Add("listitems", "List Items [label else all] ->Type,Label[,Name]", __FILE__, fun13, aGroup);
- //theDI.Add("integer", "value:integer : cree un IntParam", __FILE__, fun14, aGroup);
- theDI.Add("setint", "name:IntParam newValue:integer : Change valeur IntParam", __FILE__, fun15, aGroup);
- //theDI.Add("text", "value:string : cree un TextParam", __FILE__, fun16, aGroup);
- theDI.Add("settext", "Name:TextParam newValue:string : Change valeur TextParam", __FILE__, fun17, aGroup);
- theDI.Add("dumpsel", "Dump Selection suivi du Nom de la Selection a dumper", __FILE__, fun19, aGroup);
- //theDI.Add("evalsel", "name:Selection [num/sel] : Evalue une Selection", __FILE__, fun20, aGroup);
- //theDI.Add("givelist", "num/sel [num/sel ...] : Evaluates GiveList", __FILE__, fun20, aGroup);
- //theDI.Add("giveshort", "num/sel [num/sel ...] : GiveList in short form", __FILE__, fun20, aGroup);
- //theDI.Add("givepointed", "num/sel [num/sel ...] : GiveList to fill a SelectPointed", __FILE__, fun20, aGroup);
- //theDI.Add("makelist", "listname [givelist] : Makes a List(SelectPointed) from GiveList", __FILE__, fun20, aGroup);
- //theDI.Add("givecount", "num/sel [num/sel ...] : Counts GiveList", __FILE__, fun20c, aGroup);
- //theDI.Add("selsuite", "sel sel ... : Creates a SelectSuite", __FILE__, funselsuite, aGroup);
- theDI.Add("clearitems", "Clears all items (selections, dispatches, etc)", __FILE__, fun21, aGroup);
- theDI.Add("cleardata", "mode:a-g-c-p : Clears all or some data (model, check...)", __FILE__, fun22, aGroup);
-
- theDI.Add("itemlabel", "xxx xxx : liste items having this label", __FILE__, fun24, aGroup);
- theDI.Add("xsave", "filename:string : sauve items-session", __FILE__, fun25, aGroup);
- theDI.Add("xrestore", "filename:string : restaure items-session", __FILE__, fun26, aGroup);
- theDI.Add("param", "[-p Pattern] - displays all parameters or filtered by pattern;\n"
- "par_name - displays parameter;\n"
- "par_name par_value - changes parameter's value", __FILE__, fun27, aGroup);
-
- theDI.Add("sentfiles", "Lists files sent from last Load", __FILE__, fun29, aGroup);
- theDI.Add("fileprefix", "prefix:string : definit File Prefix", __FILE__, fun30, aGroup);
- theDI.Add("fileext", "extent:string : definit File Extension", __FILE__, fun31, aGroup);
- theDI.Add("fileroot", "disp:Dispatch root:string : definit File Root sur un Dispatch", __FILE__, fun32, aGroup);
- theDI.Add("filedef", "defroot:string : definit File DefaultRoot", __FILE__, fun33, aGroup);
- theDI.Add("evalfile", "Evaluation du FileNaming et memorisation", __FILE__, fun34, aGroup);
- theDI.Add("clearfile", "Efface la liste d'EvalFile", __FILE__, fun35, aGroup);
- theDI.Add("xsplit", "[disp:Dispatch sinon tout] : Split, la grande affaire !", __FILE__, fun36, aGroup);
- theDI.Add("remaining", "options... : Remaining Entities, help complet par remaining ?", __FILE__, fun37, aGroup);
- theDI.Add("setcontent", "sel:Selection mode:k ou r : Restreint contenu du modele", __FILE__, fun38, aGroup);
-
- theDI.Add("listmodif", "List Final Modifiers", __FILE__, fun40, aGroup);
- theDI.Add("dumpmodif", "modif:Modifier : Affiche le Statut d'un Modifier", __FILE__, fun41, aGroup);
- theDI.Add("modifsel", "modif:Modifier [sel:Selection] : Change/Annule Selection de Modifier", __FILE__, fun42, aGroup);
- theDI.Add("setapplied", "modif:Modifier [name:un item sinon sortie fichier] : Applique un Modifier", __FILE__, fun43, aGroup);
- theDI.Add("resetapplied", "modif:Modifier : Enleve un Modifier de la sortie fichier", __FILE__, fun44, aGroup);
- theDI.Add("modifmove", "modif:Modifier M(model)/F(file) avant,apres:integer : Deplace un Modifier (sortie fichier)", __FILE__, fun45, aGroup);
-
- theDI.Add("dispsel", "disp:Dispatch sel:Selection -> Selection Finale de Dispatch", __FILE__, fun51, aGroup);
- //theDI.Add("dispone", "cree DispPerOne", __FILE__, fun_dispone, aGroup);
- //theDI.Add("dispglob", "cree DispGlobal", __FILE__, fun_dispglob, aGroup);
- //theDI.Add("dispcount", "count:IntParam : cree DispPerCount", __FILE__, fun_dispcount, aGroup);
- //theDI.Add("dispfile", "files:IntParam : cree DispPerFiles", __FILE__, fun_dispfiles, aGroup);
- //theDI.Add("dispsign", "sign:Signature : cree DispPerSignature", __FILE__, fun_dispsign, aGroup);
- theDI.Add("dumpdisp", "disp:Dispatch : Affiche le Statut d'un Dispatch", __FILE__, fun56, aGroup);
-
- theDI.Add("xremove", "nom : Remove a Control Item de la Session", __FILE__, fun57, aGroup);
- theDI.Add("evaldisp", "mode=[0-3] disp:Dispatch : Evaluates one or more Dispatch(es)", __FILE__, fun58, aGroup);
- //theDI.Add("evaladisp", "mode=[0-3] disp:Dispatch [givelist] : Evaluates a Dispatch (on a GiveList)", __FILE__, fun_evaladisp, aGroup);
- //theDI.Add("writedisp", "filepattern disp:Dispatch [givelist] : Writes Entities by Splitting by a Dispatch", __FILE__, fun_writedisp, aGroup);
- theDI.Add("evalcomplete", "Evaluation Complete de la Repartition", __FILE__, fun59, aGroup);
-
- theDI.Add("runcheck", "affiche LastRunCheckList (write,modif)", __FILE__, fun60, aGroup);
- theDI.Add("runtranformer", "transf:Transformer : Applique un Transformer", __FILE__, fun61, aGroup);
- //theDI.Add("copy", "cree TransformStandard, option Copy, vide", __FILE__, fun62, aGroup);
- //theDI.Add("onthespot", "cree TransformStandard, option OntheSpot, vide", __FILE__, fun63, aGroup);
- //theDI.Add("runcopy", "modif:ModelModifier [givelist] : Run <modif> via TransformStandard option Copy", __FILE__, fun6465, aGroup);
- //theDI.Add("runonthespot", "modif:ModelModifier [givelist] : Run <modif> via TransformStandard option OnTheSpot", __FILE__, fun6465, aGroup);
- //theDI.Add("reorder", "[f ou t] reordonne le modele", __FILE__, fun66, aGroup);
-
- theDI.Add("toggle", "sel:Selection genre Extract : Toggle Direct/Reverse", __FILE__, fun70, aGroup);
- theDI.Add("input", "sel:Selection genre Deduct ou Extract input:Selection : Set Input", __FILE__, fun71, aGroup);
- //theDI.Add("modelroots", "cree SelectModelRoots", __FILE__, fun72, aGroup);
- //theDI.Add("range", "options... : cree SelectRange ...; tout court pour help", __FILE__, fun73, aGroup);
- //theDI.Add("roots", "cree SelectRoots (local roots)", __FILE__, fun74, aGroup);
- //theDI.Add("shared", "cree SelectShared", __FILE__, fun75, aGroup);
- //theDI.Add("diff", "[main:Selection diff:Selection] : cree SelectDiff", __FILE__, fun76, aGroup);
- theDI.Add("selmain", "sel:Selection genre Control main:Selection : Set Main Input", __FILE__, fun77, aGroup);
- theDI.Add("selsecond", "sel:Selection genre Control sec:Selection : Set Second Input", __FILE__, fun78, aGroup);
- //theDI.Add("modelall", "cree SelectModelAll", __FILE__, fun79, aGroup);
- theDI.Add("seladd", "sel:Selection genre Combine input:Selection : Add Selection", __FILE__, fun80, aGroup);
- theDI.Add("selrem", "sel:Selection genre Combine input:Selection : Remove Selection", __FILE__, fun81, aGroup);
- //theDI.Add("number", "num:IntParam : Cree SelectEntityNumber", __FILE__, fun82, aGroup);
-
- //theDI.Add("union", "cree SelectUnion (vide), cf aussi combadd, combrem", __FILE__, fun83, aGroup);
- //theDI.Add("intersect", "cree SelectIntersection (vide), cf aussi combadd, combrem", __FILE__, fun84, aGroup);
- //theDI.Add("typexact", "type:string : cree SelectTextType Exact", __FILE__, fun85, aGroup);
- //theDI.Add("errors", "cree SelectErrorEntities (from file)", __FILE__, fun86, aGroup);
- //theDI.Add("unknown", "cree SelectUnknownEntities", __FILE__, fun87, aGroup);
- //theDI.Add("sharing", "cree SelectSharing", __FILE__, fun88, aGroup);
- //theDI.Add("typecontain", "type:string : cree SelectTextType Contains", __FILE__, fun89, aGroup);
- //theDI.Add("pointed", "cree SelectPointed [num/sel num/sel]", __FILE__, fun90, aGroup);
- theDI.Add("setpointed", "sel:SelectPointed : edition SelectPointed. tout court pour help", __FILE__, fun91, aGroup);
- theDI.Add("setlist", "sel:SelectPointed : edition SelectPointed. tout court pour help", __FILE__, fun91, aGroup);
- //theDI.Add("incorrect", "cree SelectIncorrectEntities (computed)", __FILE__, fun92, aGroup);
-
- //theDI.Add("signsel", "sign:Signature|cnt:Counter text:string [e(D)|c] : cree SelectSignature", __FILE__, fun93, aGroup);
- //theDI.Add("signcounter", "sign:Signature : cree SignCounter", __FILE__, fun94, aGroup);
- //theDI.Add("nbselected", "applied:Selection : cree GraphCounter(=NbSelected)", __FILE__, funbselected, aGroup);
-
- theDI.Add("editlist", "editor or editform : lists defs + values", __FILE__, fun_editlist, aGroup);
- //theDI.Add("editvalue", "editform paramname [newval or .] : lists-changes a value", __FILE__, fun_editvalue, aGroup);
- theDI.Add("editclear", "editform [paramname] : clears edition on all or one param", __FILE__, fun_editclear, aGroup);
- theDI.Add("editload", "editform [entity-id] : loads from model or an entity", __FILE__, fun_editload, aGroup);
- theDI.Add("editapply", "editform [keep] : applies on loaded data", __FILE__, fun_editapply, aGroup);
-}
+//// Copyright (c) 2023 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_FunctionsSession.hxx>
+//
+//#include <IFSelect_CheckCounter.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 <XSDRAW_FunctionsSession.hxx>
+//#include <IFSelect_GraphCounter.hxx>
+//#include <IFSelect_IntParam.hxx>
+//#include <IFSelect_ListEditor.hxx>
+//#include <IFSelect_ModifReorder.hxx>
+//#include <IFSelect_SelectDiff.hxx>
+//#include <IFSelect_SelectEntityNumber.hxx>
+//#include <IFSelect_SelectErrorEntities.hxx>
+//#include <IFSelect_SelectIncorrectEntities.hxx>
+//#include <IFSelect_SelectIntersection.hxx>
+//#include <IFSelect_Selection.hxx>
+//#include <IFSelect_SelectModelEntities.hxx>
+//#include <IFSelect_SelectModelRoots.hxx>
+//#include <IFSelect_SelectPointed.hxx>
+//#include <IFSelect_SelectRange.hxx>
+//#include <IFSelect_SelectRoots.hxx>
+//#include <IFSelect_SelectShared.hxx>
+//#include <IFSelect_SelectSharing.hxx>
+//#include <IFSelect_SelectSignature.hxx>
+//#include <IFSelect_SelectSuite.hxx>
+//#include <IFSelect_SelectUnion.hxx>
+//#include <IFSelect_SelectUnknownEntities.hxx>
+//#include <IFSelect_SessionFile.hxx>
+//#include <IFSelect_ShareOut.hxx>
+//#include <IFSelect_SignatureList.hxx>
+//#include <IFSelect_SignCounter.hxx>
+//#include <IFSelect_SignType.hxx>
+//#include <IFSelect_Transformer.hxx>
+//#include <IFSelect_WorkLibrary.hxx>
+//#include <XSControl_WorkSession.hxx>
+//#include <Interface_Category.hxx>
+//#include <Interface_CheckIterator.hxx>
+//#include <Interface_EntityIterator.hxx>
+//#include <Interface_InterfaceModel.hxx>
+//#include <Interface_Macros.hxx>
+//#include <Interface_MSG.hxx>
+//#include <Interface_Static.hxx>
+//#include <Interface_Version.hxx>
+//#include <Message.hxx>
+//#include <Message_Messenger.hxx>
+//#include <Standard_Transient.hxx>
+//#include <TCollection_AsciiString.hxx>
+//#include <TCollection_HAsciiString.hxx>
+//#include <TColStd_HSequenceOfAsciiString.hxx>
+//#include <TColStd_HSequenceOfHAsciiString.hxx>
+//#include <TColStd_HSequenceOfTransient.hxx>
+//#include <XSDRAW.hxx>
+//#include <XSDRAWBase.hxx>
+//
+////=======================================================================
+////function : GiveList
+////purpose :
+////=======================================================================
+//Handle(TColStd_HSequenceOfTransient) GiveList(const Handle(XSControl_WorkSession)& WS,
+// const Standard_CString first,
+// const Standard_CString second)
+//{
+// return WS->GiveList(first, second);
+//}
+//
+//// 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
+//
+//// Functions definit un certain nombre de commandes
+//// enregistrees dans le Dictionnaire de Activator (par des Act unitaires)
+//// Les actions elles-memes sont regroupees en fin de fichier
+//
+//// Les definitions
+//
+////=======================================================================
+////function : funstatus
+////purpose :
+////=======================================================================
+//static Standard_Integer funstatus(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// (void)theNbArgs;
+// (void)theArgVec;
+// // **** Version & cie ****
+// //#58 rln
+// aSSC.SStream() << "Processor Version : " << XSTEP_PROCESSOR_VERSION;
+// aSSC.SStream() << "OL Version : " << XSTEP_SYSTEM_VERSION;
+// aSSC.SStream() << "Configuration : " << XSTEP_Config;
+// aSSC.SStream() << "UL Names : " << XSTEP_ULNames;
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun1
+////purpose :
+////=======================================================================
+//static Standard_Integer fun1(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// (void)theNbArgs;
+// (void)theArgVec;
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+// // **** ToggleHandler ****
+// Standard_Boolean hand = !WS->ErrorHandle();
+// if (hand) aSSC.SStream() << " -- Mode Catch Error now Active";
+// else aSSC.SStream() << " -- Mode Catch Error now Inactive";
+// WS->SetErrorHandle(hand);
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun3
+////purpose :
+////=======================================================================
+//static Standard_Integer fun3(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** XRead / Load ****
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << "Read/Load : give file name !";
+// return 1;
+// }
+// if (WS->Protocol().IsNull())
+// {
+// aSSC.SStream() << "Protocol not defined";
+// return 1;
+// }
+// if (WS->WorkLibrary().IsNull())
+// {
+// aSSC.SStream() << "WorkLibrary not defined";
+// return 1;
+// }
+// XSControl_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 XSControl_RetVoid: aSSC.SStream() << "file:" << arg1 << " gives empty result"; break;
+// case XSControl_RetError: aSSC.SStream() << "file:" << arg1 << " could not be opened"; break;
+// case XSControl_RetDone: aSSC.SStream() << "file:" << arg1 << " read"; break;
+// case XSControl_RetFail: aSSC.SStream() << "file:" << arg1 << " : error while reading"; break;
+// case XSControl_RetStop: aSSC.SStream() << "file:" << arg1 << " : EXCEPTION while reading"; break;
+// default: aSSC.SStream() << "file:" << arg1 << " could not be read"; break;
+// }
+// if (status != XSControl_RetDone)
+// return 1;
+// // aSSC.SStream()<<" - clearing list of already written files"<<std::endl;
+// WS->BeginSentFiles(Standard_True);
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun4
+////purpose :
+////=======================================================================
+//static Standard_Integer fun4(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** Write All ****
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << "Write All : give file name !";
+// return 1;
+// }
+// return (WS->SendAll(arg1) == XSControl_RetDone ? 0 : 1);
+//}
+//
+////=======================================================================
+////function : fun6
+////purpose :
+////=======================================================================
+//static Standard_Integer fun6(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** Write Entite(s) ****
+// if (theNbArgs < 3)
+// {
+// aSSC.SStream() << "Write Entitie(s) : give file name + n0s entitie(s)!";
+// return 1;
+// }
+// int ko = 0;
+// Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
+// for (Standard_Integer ia = 2; ia < theNbArgs; ia++)
+// {
+// Standard_Integer id = WS->NumberFromLabel(theArgVec[ia]);
+// if (id > 0)
+// {
+// Handle(Standard_Transient) item = WS->StartingEntity(id);
+// if (sp->Add(item)) aSSC.SStream() << "Added:no." << id;
+// else
+// {
+// aSSC.SStream() << " Fail Add n0." << id; ko++;
+// }
+// }
+// else
+// {
+// aSSC.SStream() << "Not an entity number:" << theArgVec[ia]; ko++;
+// }
+// }
+// if (ko > 0)
+// {
+// aSSC.SStream() << ko << " bad arguments, abandon";
+// return 1;
+// }
+// return (WS->SendSelected(arg1, sp) == XSControl_RetDone ? 0 : 1);
+//}
+//
+////=======================================================================
+////function : fun7
+////purpose :
+////=======================================================================
+//static Standard_Integer fun7(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** Entity Label ****
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << "Give entity number";
+// return 1;
+// }
+// if (!WS->HasModel())
+// {
+// aSSC.SStream() << "No loaded model, abandon";
+// return 1;
+// }
+// Standard_Integer nument = WS->NumberFromLabel(arg1);
+// if (nument <= 0 || nument > WS->NbStartingEntities())
+// {
+// aSSC.SStream() << "Not a suitable number: " << arg1;
+// return 1;
+// }
+// aSSC.SStream() << "N0." << nument << " ->Label in Model : ";
+// WS->Model()->PrintLabel(WS->StartingEntity(nument), aSSC.SStream());
+//
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun8
+////purpose :
+////=======================================================================
+//static Standard_Integer fun8(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** Entity Number ****
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << "Give label to search";
+// return 1;
+// }
+// if (!WS->HasModel())
+// {
+// aSSC.SStream() << "No loaded model, abandon";
+// return 1;
+// }
+// const Handle(Interface_InterfaceModel)& model = WS->Model();
+// Standard_Integer i, cnt = 0;
+// Standard_Boolean exact = Standard_False;
+// aSSC.SStream() << " ** Search Entity Number for Label : " << arg1;
+// for (i = model->NextNumberForLabel(arg1, 0, exact); i != 0;
+// i = model->NextNumberForLabel(arg1, i, exact))
+// {
+// cnt++;
+// aSSC.SStream() << " ** Found n0/id:";
+// model->Print(model->Value(i), aSSC.SStream());
+//
+// }
+//
+// if (cnt == 0) aSSC.SStream() << " ** No Match";
+// else if (cnt == 1) aSSC.SStream() << " ** 1 Match";
+// else aSSC.SStream() << cnt << " Matches";
+// return 0;
+//}
+//
+////=======================================================================
+////function : funsigntype
+////purpose :
+////=======================================================================
+//static Standard_Integer fun9(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(IFSelect_WorkSession) WS = XSDRAWBase::Session();
+// Handle(IFSelect_Signature) signtype = WS->SignType();
+// if (signtype.IsNull()) signtype = new IFSelect_SignType;
+// Handle(IFSelect_SignCounter) aCounter =
+// new IFSelect_SignCounter(signtype, Standard_False);
+// if (theNbArgs == 1)
+// {
+// aCounter->AddModel(WS->Model());
+// }
+// else
+// {
+// // on demande un givelist
+// Handle(TColStd_HSequenceOfTransient) list = WS->GiveList(theArgVec[1]);
+// if (list.IsNull())
+// {
+// theDI << "Error: Nothing selected from : " << theArgVec[1] << "\n";
+// return 1;
+// }
+// aCounter->AddWithGraph(list, WS->Graph());
+// }
+// aCounter->PrintList(aSSC.SStream(), WS->Model(), IFSelect_CountByItem);
+// return 0;
+//}
+//
+////=======================================================================
+////function : funsigntype
+////purpose :
+////=======================================================================
+//static Standard_Integer funsigntype(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** Sign Type ****
+// Handle(IFSelect_Signature) signtype = WS->SignType();
+// if (signtype.IsNull()) aSSC.SStream() << "signtype actually undefined";
+// else
+// {
+// Handle(TCollection_HAsciiString) str = WS->Name(signtype);
+// Standard_Integer id = WS->ItemIdent(signtype);
+// aSSC.SStream() << signtype->Label();
+// if (str.IsNull())
+// {
+// if (id > 0) aSSC.SStream() << "signtype : item n0 " << id;
+// }
+// else
+// {
+// aSSC.SStream() << "signtype : also named as " << str->ToCString();
+// }
+// }
+// if (theNbArgs < 2) aSSC.SStream() << "signtype newitem to change, signtype . to clear";
+// else
+// {
+// if (arg1[0] == '.' && arg1[1] == '\0')
+// {
+// signtype.Nullify();
+// aSSC.SStream() << "signtype now cleared";
+// }
+// else
+// {
+// signtype = GetCasted(IFSelect_Signature, WS->NamedItem(arg1));
+// if (signtype.IsNull())
+// {
+// aSSC.SStream() << "Not a Signature : " << arg1;
+// return 1;
+// }
+// else aSSC.SStream() << "signtype now set to " << arg1;
+// }
+// WS->SetSignType(signtype);
+// return 0;
+// }
+// return 0;
+//}
+//
+////=======================================================================
+////function : funsigncase
+////purpose :
+////=======================================================================
+//static Standard_Integer funsigncase(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// (void)theNbArgs;
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+// const Standard_CString arg1 = theArgVec[1];
+// // **** Sign Case ****
+// Handle(IFSelect_Signature) signcase = GetCasted(IFSelect_Signature, WS->NamedItem(arg1));
+// if (signcase.IsNull()) aSSC.SStream() << "Not a Signature : " << arg1;
+// else
+// {
+// Standard_Boolean hasmin, hasmax; Standard_Integer valmin, valmax;
+// if (signcase->IsIntCase(hasmin, valmin, hasmax, valmax))
+// {
+// aSSC.SStream() << "Signature " << arg1 << " : Integer Case";
+// if (hasmin) aSSC.SStream() << " - Mini:" << valmin;
+// if (hasmax) aSSC.SStream() << " - Maxi:" << valmax;
+//
+// }
+// Handle(TColStd_HSequenceOfAsciiString) caselist = signcase->CaseList();
+// if (caselist.IsNull()) aSSC.SStream() << "Signature " << arg1 << " : no predefined case, see command count " << arg1;
+// else
+// {
+// Standard_Integer i, nb = caselist->Length();
+// aSSC.SStream() << "Signature " << arg1 << " : " << nb << " basic cases :";
+// for (i = 1; i <= nb; i++) aSSC.SStream() << " " << caselist->Value(i);
+//
+// }
+// }
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun10
+////purpose :
+////=======================================================================
+//static Standard_Integer fun10(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** Entity Status ****
+// Standard_Integer i, nb;
+// if (theNbArgs < 2)
+// {
+// nb = Interface_Category::NbCategories();
+// aSSC.SStream() << " Categories defined :" << nb << " i.e. :\n";
+// for (i = 0; i <= nb; i++)
+// aSSC.SStream() << "Cat." << i << " : " << Interface_Category::Name(i) << "\n";
+// aSSC.SStream() << " On a given entity : give its number";
+// return 0;
+// }
+// Standard_Integer num = WS->NumberFromLabel(arg1);
+// if (num <= 0 || num > WS->NbStartingEntities())
+// {
+// aSSC.SStream() << "Not a suitable entity number : " << arg1;
+// return 1;
+// }
+// Handle(Standard_Transient) ent = WS->StartingEntity(num);
+// WS->PrintEntityStatus(ent, aSSC.SStream());
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun11
+////purpose :
+////=======================================================================
+//static Standard_Integer fun11(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << "Error: Empty Mode\n";
+// return 1;
+// }
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+// //
+// const Standard_CString arg1 = theArgVec[1];
+// // **** DumpModel (Data) ****
+// Standard_Integer niv = 0;
+// // char arg10 = arg1[0];
+// // if (theNbArgs < 2) arg10 = '?';
+// switch (arg1[0])
+// {
+// case '?':
+// aSSC.SStream() << "? for this help, else give a listing mode (first letter suffices) :\n"
+// << " general General Statistics\n roots Roots\n"
+// << " entities All Entities\n"
+// << " listfails CheckList (fails) per entity\n"
+// << " messages CheckList (complete) per entity\n"
+// << " fails CheckList (fails) per message (counting)\n"
+// << " check CheckList (complete) per message (counting)\n"
+// << " totalcheck CheckList (complete) per message (listing n0 ents)\n"
+// << " FAILS CheckList (fails) per message (listing complete)\n"
+// << " TOTALCHECK CheckList (complete) per message (listing complete)";
+// return 0;
+// case 'g': niv = 0; break;
+// case 'r': niv = 1; break;
+// case 'e': niv = 2; break;
+// case 'l': niv = 3; break;
+// case 'm': niv = 4; break;
+// case 'c': niv = 5; break;
+// case 't': niv = 6; break;
+// case 'T': niv = 7; break;
+// case 'f': niv = 8; break;
+// case 'F': niv = 10; break;
+// default: aSSC.SStream() << "Unknown Mode . tout court pour help";
+// return 1;
+// }
+// WS->DumpModel(niv, aSSC.SStream());
+// return 0;
+//}
+//
+////=======================================================================
+////function : fundumpent
+////purpose :
+////=======================================================================
+//static Standard_Integer fundumpent(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+// Handle(IFSelect_WorkLibrary) WL = WS->WorkLibrary();
+// Standard_Integer levdef = 0, levmax = 10, level;
+// WL->DumpLevels(levdef, levmax);
+// if (theNbArgs < 2 || (theNbArgs == 2 && levmax < 0))
+// {
+// aSSC.SStream() << "Give n0 or id of entity";
+// if (levmax < 0)
+// aSSC.SStream() << " and dump level";
+// else
+// aSSC.SStream() << " + optional, dump level in [0 - " << levmax << "] , default = " << levdef;
+// for (level = 0; level <= levmax; level++)
+// {
+// Standard_CString help = WL->DumpHelp(level);
+// if (help[0] != '\0')
+// aSSC.SStream() << level << " : " << help;
+// }
+// return 1;
+// }
+//
+// const Standard_CString arg1 = theArgVec[1];
+// const Standard_CString arg2 = theArgVec[2];
+// Standard_Integer num = WS->NumberFromLabel(arg1);
+// if (num == 0)
+// return 1;
+// level = levdef;
+// if (theNbArgs > 2)
+// level = atoi(arg2);
+// Handle(Standard_Transient) ent = WS->StartingEntity(num);
+// if (ent.IsNull())
+// {
+// aSSC.SStream() << "No entity with given id " << arg1 << " (" << num << ") is found in the current model";
+// }
+// else
+// {
+// aSSC.SStream() << " -- DUMP Entity n0 " << num << " level " << level;
+// WL->DumpEntity(WS->Model(), WS->Protocol(), ent, aSSC.SStream(), level);
+//
+// Interface_CheckIterator chl = WS->CheckOne(ent);
+// if (!chl.IsEmpty(Standard_False))
+// chl.Print(aSSC.SStream(), WS->Model(), Standard_False);
+// }
+// return 0;
+//}
+//
+////=======================================================================
+////function : funsign
+////purpose :
+////=======================================================================
+//static Standard_Integer funsign(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// const Standard_CString arg2 = theArgVec[2];
+// if (theNbArgs < 3)
+// {
+// aSSC.SStream() << " Give signature name + n0 or id of entity";
+// return 1;
+// }
+// DeclareAndCast(IFSelect_Signature, sign, WS->NamedItem(arg1));
+// if (sign.IsNull())
+// {
+// aSSC.SStream() << "Not a signature : " << arg1;
+// return 1;
+// }
+// Standard_Integer num = WS->NumberFromLabel(arg2);
+// Handle(Standard_Transient) ent = WS->StartingEntity(num);
+// if (num == 0)
+// return 1;
+// aSSC.SStream() << "Entity n0 " << num << " : " << WS->SignValue(sign, ent);
+// return 0;
+//}
+//
+////=======================================================================
+////function : funqp
+////purpose :
+////=======================================================================
+//static Standard_Integer funqp(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// const Standard_CString arg2 = theArgVec[2];
+// if (theNbArgs < 3)
+// {
+// aSSC.SStream() << " Give 2 numeros or labels : dad son";
+// return 1;
+// }
+// Standard_Integer n1 = WS->NumberFromLabel(arg1);
+// Standard_Integer n2 = WS->NumberFromLabel(arg2);
+// aSSC.SStream() << "QueryParent for dad:" << arg1 << ":" << n1 << " and son:" << arg2 << ":" << n2;
+// Standard_Integer qp = WS->QueryParent(WS->StartingEntity(n1), WS->StartingEntity(n2));
+// if (qp < 0) aSSC.SStream() << arg1 << " is not super-entity of " << arg2;
+// else if (qp == 0) aSSC.SStream() << arg1 << " is same as " << arg2;
+// else aSSC.SStream() << arg1 << " is super-entity of " << arg2 << " , max level found=" << qp;
+// // aSSC.SStream()<<" Trouve "<<qp<<std::endl;
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun12
+////purpose :
+////=======================================================================
+//static Standard_Integer fun12(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// (void)theNbArgs;
+// (void)theArgVec;
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+// // **** DumpShare ****
+// WS->DumpShare();
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun13
+////purpose :
+////=======================================================================
+//static Standard_Integer fun13(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// (void)theNbArgs;
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+// // **** ListItems ****
+// WS->ListItems(theArgVec[1]);
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun15
+////purpose :
+////=======================================================================
+//static Standard_Integer fun15(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// const Standard_CString arg2 = theArgVec[2];
+// // **** SetInt ****
+// if (theNbArgs < 3)
+// {
+// aSSC.SStream() << "Donner 2 arguments : nom Parametre et Valeur";
+// return 1;
+// }
+// Standard_Integer val = atoi(arg2);
+// DeclareAndCast(IFSelect_IntParam, par, WS->NamedItem(arg1));
+// if (!WS->SetIntValue(par, val))
+// return 1;
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun17
+////purpose :
+////=======================================================================
+//static Standard_Integer fun17(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// const Standard_CString arg2 = theArgVec[2];
+// // **** SetText ****
+// if (theNbArgs < 3)
+// {
+// aSSC.SStream() << "Donner 2 arguments : nom Parametre et Valeur";
+// return 1;
+// }
+// DeclareAndCast(TCollection_HAsciiString, par, WS->NamedItem(arg1));
+// if (!WS->SetTextValue(par, arg2))
+// return 1;
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun19
+////purpose :
+////=======================================================================
+//static Standard_Integer fun19(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** DumpSel ****
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << "Give 1 argument : Selection Name";
+// return 1;
+// }
+// WS->DumpSelection(GetCasted(IFSelect_Selection, WS->NamedItem(arg1)));
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun21
+////purpose :
+////=======================================================================
+//static Standard_Integer fun21(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// (void)theNbArgs;
+// (void)theArgVec;
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+// // **** ClearItems ****
+// WS->ClearItems(); WS->ClearFinalModifiers(); WS->ClearShareOut(Standard_False);
+// return 0;
+//}
+//
+//static Standard_Integer fun22(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** ClearData ****
+// Standard_Integer mode = -1;
+// if (theNbArgs >= 2)
+// {
+// if (arg1[0] == 'a') mode = 1;
+// if (arg1[0] == 'g') mode = 2;
+// if (arg1[0] == 'c') mode = 3;
+// if (arg1[0] == 'p') mode = 4;
+// if (arg1[0] == '?') mode = -1;
+// }
+// else mode = 0;
+// if (mode <= 0)
+// {
+// if (mode < 0) aSSC.SStream() << "Give a suitable mode";
+// aSSC.SStream() << " Available Modes :\n"
+// << " a : all g : graph+check c : check p : selectpointed";
+// return 1;
+// }
+// WS->ClearData(mode);
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun24
+////purpose :
+////=======================================================================
+//static Standard_Integer fun24(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// // **** Item Label ****
+// TCollection_AsciiString label;
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << " Give label to search";
+// return 1;
+// }
+// for (int i = 1; i < theNbArgs; i++)
+// {
+// label.AssignCat(theArgVec[i]);
+// if (i < theNbArgs - 1) label.AssignCat(" ");
+// }
+// for (int mode = 0; mode <= 2; mode++)
+// {
+// int nbitems = 0; int id;
+// aSSC.SStream() << "Searching label : " << label << ". in mode ";
+// if (mode == 0) aSSC.SStream() << " exact";
+// if (mode == 1) aSSC.SStream() << " same head";
+// if (mode == 2) aSSC.SStream() << " search if present";
+// for (id = WS->NextIdentForLabel(label.ToCString(), 0, mode); id != 0;
+// id = WS->NextIdentForLabel(label.ToCString(), id, mode))
+// {
+// aSSC.SStream() << " " << id; nbitems++;
+// }
+// aSSC.SStream() << " -- giving " << nbitems << " found";
+// }
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun25
+////purpose :
+////=======================================================================
+//static Standard_Integer fun25(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** Save (Dump) ****
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << "Donner nom du Fichier";
+// return 1;
+// }
+// IFSelect_SessionFile dumper(WS, arg1);
+// if (!dumper.IsDone())
+// return 1;
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun26
+////purpose :
+////=======================================================================
+//static Standard_Integer fun26(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** Restore (Dump) ****
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << "Donner nom du Fichier";
+// return 1;
+// }
+// IFSelect_SessionFile dumper(WS);
+// Standard_Integer readstat = dumper.Read(arg1);
+// if (readstat == 0)
+// return 0;
+// else if (readstat > 0) aSSC.SStream() << "-- Erreur Lecture Fichier " << arg1;
+// else aSSC.SStream() << "-- Pas pu ouvrir Fichier " << arg1;
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun27
+////purpose :
+////=======================================================================
+//static Standard_Integer fun27(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+// const Standard_CString arg1 = theArgVec[1];
+// Standard_CString arg2 = theArgVec[2];
+// const Standard_CString anEmptyStr = "";
+// if (arg2 && strlen(arg2) == 2 && arg2[0] == '"' && arg2[1] == '"')
+// {
+// arg2 = anEmptyStr;
+// }
+// // **** Param(Value) ****
+// if (theNbArgs < 2 || (theNbArgs == 3 && strcmp(arg1, "-p") == 0))
+// {
+// Handle(TColStd_HSequenceOfHAsciiString) li = Interface_Static::Items();
+// Standard_Integer i, nb = li->Length(), aPatternNb = 0;
+// size_t aPatternLen = strlen(arg2);
+// if (theNbArgs == 3)
+// {
+// for (i = 1; i <= nb; i++)
+// {
+// if (strncmp(li->Value(i)->String().ToCString(), arg2, aPatternLen) == 0)
+// {
+// aPatternNb++;
+// }
+// }
+// }
+// else
+// {
+// aPatternNb = nb;
+// }
+// aSSC.SStream() << " List of parameters : " << aPatternNb << " items : ";
+// for (i = 1; i <= nb; i++)
+// {
+// if (theNbArgs == 3 && strncmp(li->Value(i)->String().ToCString(), arg2, aPatternLen) != 0)
+// {
+// continue;
+// }
+// aSSC.SStream() << li->Value(i)->String();
+// aSSC.SStream() << " : " << Interface_Static::CVal(li->Value(i)->ToCString());
+// }
+// return 0;
+// }
+// else if (atoi(arg1) > 0)
+// {
+// Standard_Integer use = atoi(arg1);
+// WS->TraceStatics(use);
+// }
+// else
+// {
+// if (theNbArgs > 2) aSSC.SStream() << " FORMER STATUS of Static Parameter " << arg1;
+// else aSSC.SStream() << " ACTUAL STATUS of Static Parameter " << arg1;
+// if (!Interface_Static::IsPresent(arg1))
+// {
+// aSSC.SStream() << " Parameter " << arg1 << " undefined";
+// return 1;
+// }
+// if (!Interface_Static::IsSet(arg1)) aSSC.SStream() << " Parameter " << arg1 << " not valued";
+// else if (theNbArgs == 2) Interface_Static::Static(arg1)->Print(aSSC.SStream());
+// else aSSC.SStream() << " Value : " << Interface_Static::CVal(arg1);
+//
+// if (theNbArgs == 2) aSSC.SStream() << "To modify, param name_param new_val";
+// else
+// {
+// if (strlen(arg2) != 0)
+// {
+// aSSC.SStream() << " New demanded value : " << arg2;
+// }
+// else
+// {
+// aSSC.SStream() << " New demanded value : not valued";
+// }
+// if (Interface_Static::SetCVal(arg1, arg2))
+// {
+// aSSC.SStream() << " OK";
+// return 0;
+// }
+// else
+// {
+// aSSC.SStream() << " , refused";
+// return 1;
+// }
+// }
+// }
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun29
+////purpose :
+////=======================================================================
+//static Standard_Integer fun29(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// (void)theNbArgs;
+// (void)theArgVec;
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+// // **** SentFiles ****
+// Handle(TColStd_HSequenceOfHAsciiString) list = WS->SentFiles();
+// if (list.IsNull())
+// {
+// aSSC.SStream() << "List of Sent Files not enabled";
+// return 0;
+// }
+// Standard_Integer i, nb = list->Length();
+// aSSC.SStream() << " Sent Files : " << nb << " : ";
+// for (i = 1; i <= nb; i++)
+// aSSC.SStream() << list->Value(i)->ToCString();
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun30
+////purpose :
+////=======================================================================
+//static Standard_Integer fun30(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** FilePrefix ****
+// if (theNbArgs < 2)
+// {
+// if (WS->FilePrefix().IsNull()) aSSC.SStream() << "Pas de prefixe defini";
+// else aSSC.SStream() << "Prefixe : " << WS->FilePrefix()->ToCString();
+// aSSC.SStream() << "Pour changer : filepref newprefix";
+// return 0;
+// }
+// WS->SetFilePrefix(arg1);
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun31
+////purpose :
+////=======================================================================
+//static Standard_Integer fun31(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** FileExtension ****
+// if (theNbArgs < 2)
+// {
+// if (WS->FileExtension().IsNull()) aSSC.SStream() << "Pas d extension definie";
+// else aSSC.SStream() << "Extension : " << WS->FileExtension()->ToCString();
+// aSSC.SStream() << "Pour changer : fileext newext";
+// return 0;
+// }
+// WS->SetFileExtension(arg1);
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun32
+////purpose :
+////=======================================================================
+//static Standard_Integer fun32(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// const Standard_CString arg2 = theArgVec[2];
+// // **** FileRoot ****
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << "Donner Dispatch et nom de Root";
+// return 1;
+// }
+// DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(arg1));
+// if (theNbArgs < 3)
+// {
+// if (WS->FileRoot(disp).IsNull()) aSSC.SStream() << "Pas de racine definie pour " << arg1;
+// else aSSC.SStream() << "Racine pour " << arg1 << " : " << WS->FileRoot(disp)->ToCString();
+// aSSC.SStream() << "Pour changer : fileroot nomdisp newroot";
+// return 0;
+// }
+// if (!WS->SetFileRoot(disp, arg2))
+// return 1;
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun33
+////purpose :
+////=======================================================================
+//static Standard_Integer fun33(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** Default File Root ****
+// if (theNbArgs < 2)
+// {
+// if (WS->DefaultFileRoot().IsNull()) aSSC.SStream() << "Pas de racine par defaut definie";
+// else aSSC.SStream() << "Racine par defaut : " << WS->DefaultFileRoot()->ToCString();
+// aSSC.SStream() << "Pour changer : filedef newdef";
+// return 0;
+// }
+// WS->SetDefaultFileRoot(arg1);
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun34
+////purpose :
+////=======================================================================
+//static Standard_Integer fun34(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// (void)theNbArgs;
+// (void)theArgVec;
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+// // **** EvalFile ****
+// if (!WS->HasModel())
+// {
+// aSSC.SStream() << "Pas de Modele charge, abandon";
+// return 1;
+// }
+//
+// aSSC.SStream() << "Evaluation avec Memorisation des resultats";
+// 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())
+// {
+// aSSC.SStream() << "Modele " << i << " Model non genere ..."; continue;
+// }
+// TCollection_AsciiString name = WS->FileName(i);
+// aSSC.SStream() << "Fichier n0 " << i << " Nb Entites : " << mod->NbEntities() << " Nom: ";
+// aSSC.SStream() << name;
+// }
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun35
+////purpose :
+////=======================================================================
+//static Standard_Integer fun35(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// (void)theNbArgs;
+// (void)theArgVec;
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+// // **** ClearFile ****
+// WS->ClearFile();
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun36
+////purpose :
+////=======================================================================
+//static Standard_Integer fun36(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// // **** Split ****
+// XSControl_ReturnStatus stat = XSControl_RetVoid;
+// if (theNbArgs < 2) aSSC.SStream() << "Split : derniere liste de dispatches definie";
+// else
+// {
+// WS->ClearShareOut(Standard_True);
+// for (Standard_Integer i = 1; i < theNbArgs; i++)
+// {
+// DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(theArgVec[i]));
+// if (disp.IsNull())
+// {
+// aSSC.SStream() << "Pas un dispatch:" << theArgVec[i] << ", Splitt abandonne";
+// stat = XSControl_RetError;
+// }
+// else WS->SetActive(disp, Standard_True);
+// }
+// }
+// if (stat == XSControl_RetError)
+// return stat;
+// WS->BeginSentFiles(Standard_True);
+// if (!WS->SendSplit())
+// return 1;
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun37
+////purpose :
+////=======================================================================
+//static Standard_Integer fun37(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** Remaining Data ****
+// char mode = '?'; IFSelect_RemainMode numod = IFSelect_RemainDisplay;
+// if (theNbArgs >= 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
+// {
+// if (theNbArgs < 2) aSSC.SStream() << "Donner un Mode - ";
+// aSSC.SStream() << "Modes possibles : l list, c compute, u undo, f forget";
+// if (mode == '?')
+// return 0;
+// else
+// return 1;
+// }
+// if (!WS->SetRemaining(numod))
+// return 0;
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun38
+////purpose :
+////=======================================================================
+//static Standard_Integer fun38(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// const Standard_CString arg2 = theArgVec[2];
+// // **** SetModelContent ****
+// if (theNbArgs < 3)
+// {
+// aSSC.SStream() << "Donner nom selection et mode (k=keep,r=remove)";
+// return 1;
+// }
+// Standard_Boolean keepmode;
+// DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
+// if (sel.IsNull())
+// {
+// aSSC.SStream() << "Pas de Selection de Nom : " << arg1;
+// return 1;
+// }
+// if (arg2[0] == 'k')
+// {
+// aSSC.SStream() << " -- SetContent keep ..."; keepmode = Standard_True;
+// }
+// else if (arg2[0] == 'r')
+// {
+// aSSC.SStream() << " -- SetContent remove ..."; keepmode = Standard_False;
+// }
+// else
+// {
+// aSSC.SStream() << "Donner nom selection et mode (k=keep,r=remove)";
+// return 1;
+// }
+//
+// if (WS->SetModelContent(sel, keepmode)) aSSC.SStream() << " Done";
+// else aSSC.SStream() << " Result empty, ignored";
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun40
+////purpose :
+////=======================================================================
+//static Standard_Integer fun40(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// (void)theNbArgs;
+// (void)theArgVec;
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+// // **** ListModif ****
+// WS->ListFinalModifiers(Standard_True);
+// WS->ListFinalModifiers(Standard_False);
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun41
+////purpose :
+////=======================================================================
+//static Standard_Integer fun41(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** Modifier ****
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << "Donner Nom du Modifier";
+// return 1;
+// }
+// DeclareAndCast(IFSelect_GeneralModifier, modif, WS->NamedItem(arg1));
+// if (modif.IsNull())
+// {
+// aSSC.SStream() << "Pas de Modifier de Nom : " << arg1;
+// return 0;
+// }
+// Handle(IFSelect_IntParam) low, up;
+//
+// Handle(IFSelect_Dispatch) disp = modif->Dispatch();
+// aSSC.SStream() << "Modifier : " << arg1 << " Label : " << modif->Label();
+// Standard_Integer rank = WS->ModifierRank(modif);
+// if (modif->IsKind(STANDARD_TYPE(IFSelect_Modifier)))
+// aSSC.SStream() << "Model Modifier n0." << rank;
+// else aSSC.SStream() << "File Modifier n0." << rank;
+// if (disp.IsNull()) aSSC.SStream() << " Applique a tous les Dispatchs";
+// else
+// {
+// aSSC.SStream() << " Dispatch : " << disp->Label();
+// if (WS->HasName(disp)) aSSC.SStream() << " - Nom:" << WS->Name(disp)->ToCString();
+//
+// }
+//
+// Handle(IFSelect_Selection) sel = modif->Selection();
+// if (!sel.IsNull()) aSSC.SStream() << " Selection : " << sel->Label();
+// if (WS->HasName(sel)) aSSC.SStream() << " - Nom:" << WS->Name(sel)->ToCString();
+//
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun42
+////purpose :
+////=======================================================================
+//static Standard_Integer fun42(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// const Standard_CString arg2 = theArgVec[2];
+// // **** ModifSel ****
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << "Donner Nom Modifier; + Nom Selection optionnel\n"
+// << "Selection pour Mettre une Selection, sinon Annule";
+// return 1;
+// }
+// DeclareAndCast(IFSelect_GeneralModifier, modif, WS->NamedItem(arg1));
+// if (modif.IsNull())
+// {
+// aSSC.SStream() << "Pas un nom de Modifier : " << arg1;
+// return 1;
+// }
+// Handle(IFSelect_Selection) sel;
+// if (arg2[0] != '\0')
+// {
+// sel = GetCasted(IFSelect_Selection, WS->NamedItem(arg2));
+// if (sel.IsNull())
+// {
+// aSSC.SStream() << "Pas un nom de Selection : " << arg2;
+// return 1;
+// }
+// }
+// if (!WS->SetItemSelection(modif, sel))
+// return 1;
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun43
+////purpose :
+////=======================================================================
+//static Standard_Integer fun43(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// const Standard_CString arg2 = theArgVec[2];
+// // **** SetAppliedModifier ****
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << "Donner Nom Modifier; + Nom Dispatch ou Transformer optionnel :\n"
+// << " - rien : tous Dispatches\n - Dispatch : ce Dispatch seul\n"
+// << " - Transformer : pas un Dispatch mais un Transformer";
+// return 1;
+// }
+// DeclareAndCast(IFSelect_GeneralModifier, modif, WS->NamedItem(arg1));
+// if (modif.IsNull())
+// {
+// aSSC.SStream() << "Pas un nom de Modifier : " << arg1;
+// return 1;
+// }
+// Handle(Standard_Transient) item;
+// if (arg2[0] != '\0')
+// {
+// item = WS->NamedItem(arg2);
+// if (item.IsNull())
+// {
+// aSSC.SStream() << "Pas un nom connu : " << arg2;
+// return 1;
+// }
+// }
+// else item = WS->ShareOut();
+// if (!WS->SetAppliedModifier(modif, item))
+// return 1;
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun44
+////purpose :
+////=======================================================================
+//static Standard_Integer fun44(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** ResetApplied (modifier) ****
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << "Designer un modifier";
+// return 1;
+// }
+// DeclareAndCast(IFSelect_GeneralModifier, modif, WS->NamedItem(arg1));
+// if (modif.IsNull())
+// {
+// aSSC.SStream() << "Pas un nom de Modifier : " << arg1;
+// return 1;
+// }
+// if (!WS->ResetAppliedModifier(modif))
+// return 1;
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun45
+////purpose :
+////=======================================================================
+//static Standard_Integer fun45(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// const Standard_CString arg2 = theArgVec[2];
+// const Standard_CString arg3 = theArgVec[3];
+// // **** ModifMove ****
+// if (theNbArgs < 4)
+// {
+// aSSC.SStream() << "modifmove MF rang1 rang2, M pour Model F pour File";
+// return 1;
+// }
+// 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
+// {
+// aSSC.SStream() << "preciser M pour Model, F pour File";
+// return 1;
+// }
+// Standard_Integer before = atoi(arg2);
+// Standard_Integer after = atoi(arg3);
+// if (before == 0 || after == 0)
+// {
+// aSSC.SStream() << "Donner 2 Entiers Positifs";
+// return 1;
+// }
+// if (!WS->ChangeModifierRank(formodel, before, after))
+// return 1;
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun51
+////purpose :
+////=======================================================================
+//static Standard_Integer fun51(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+// const Standard_CString arg1 = theArgVec[1];
+// const Standard_CString arg2 = theArgVec[2];
+// // **** DispSel ****
+// if (theNbArgs < 3)
+// {
+// aSSC.SStream() << "Donner Noms Dispatch et Selection Finale";
+// return 1;
+// }
+// DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(arg1));
+// if (disp.IsNull())
+// {
+// aSSC.SStream() << "Pas un nom de Dispatch : " << arg1;
+// return 1;
+// }
+// DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg2));
+// if (sel.IsNull())
+// {
+// aSSC.SStream() << "Pas un nom de Selection : " << arg2;
+// return 1;
+// }
+// if (!WS->SetItemSelection(disp, sel))
+// return 1;
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun56
+////purpose :
+////=======================================================================
+//static Standard_Integer fun56(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** Dispatch ****
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << "Donner Nom du Dispatch";
+// return 1;
+// }
+// DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(arg1));
+// if (disp.IsNull())
+// {
+// aSSC.SStream() << "Pas un dispatch : " << arg1;
+// return 1;
+// }
+// Standard_Integer num = WS->DispatchRank(disp);
+// aSSC.SStream() << "Dispatch de Nom : " << arg1 << " , en ShareOut, Numero " << num << " : ";
+// Handle(IFSelect_Selection) sel = WS->ItemSelection(disp);
+// Handle(TCollection_HAsciiString) selname = WS->Name(sel);
+// if (sel.IsNull()) aSSC.SStream() << "Pas de Selection Finale";
+// else if (selname.IsNull()) aSSC.SStream() << "Selection Finale : #" << WS->ItemIdent(sel);
+// else aSSC.SStream() << "Selection Finale : " << selname->ToCString();
+// if (disp->HasRootName()) aSSC.SStream() << "-- Racine nom de fichier : "
+// << disp->RootName()->ToCString();
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun57
+////purpose :
+////=======================================================================
+//static Standard_Integer fun57(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** Remove ****
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << "Give Name to Remove !";
+// return 1;
+// }
+// if (!WS->RemoveNamedItem(arg1))
+// return 1;
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun58
+////purpose :
+////=======================================================================
+//static Standard_Integer fun58(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** EvalDisp ****
+// if (theNbArgs < 3)
+// {
+// aSSC.SStream() << "evaldisp mode disp [disp ...] : Mode + Name(s) of Dispatch(es). Mode:\n"
+// << " 0 brief 1 +forgotten ents 2 +duplicata 3 1+2"
+// << "See also : evaladisp writedisp xsplit";
+// return 0;
+// }
+// Standard_Boolean OK = Standard_True;
+// Standard_Integer i, mode = atoi(arg1); aSSC.SStream() << " Mode " << mode << "\n";
+// for (i = 2; i < theNbArgs; i++)
+// {
+// DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(theArgVec[i]));
+// if (disp.IsNull())
+// {
+// aSSC.SStream() << "Not a dispatch:" << theArgVec[i]; OK = Standard_False;
+// }
+// }
+// if (!OK)
+// {
+// aSSC.SStream() << "Some of the parameters are not correct";
+// return 1;
+// }
+//
+// WS->ClearShareOut(Standard_True);
+// for (i = 2; i < theNbArgs; i++)
+// {
+// DeclareAndCast(IFSelect_Dispatch, disp, WS->NamedItem(theArgVec[i]));
+// WS->SetActive(disp, Standard_True);
+// }
+// // WS->EvaluateDispatch(disp,mode);
+// WS->EvaluateComplete(mode);
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun59
+////purpose :
+////=======================================================================
+//static Standard_Integer fun59(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** EvalComplete ****
+// Standard_Integer mode = 0;
+// if (theNbArgs < 2) aSSC.SStream() << " -- mode par defaut 0\n";
+// else
+// {
+// mode = atoi(arg1); aSSC.SStream() << " -- mode : " << mode;
+// }
+// WS->EvaluateComplete(mode);
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun60
+////purpose :
+////=======================================================================
+//static Standard_Integer fun60(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// (void)theNbArgs;
+// (void)theArgVec;
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+// // **** LastRunCheckList ****
+// Interface_CheckIterator chlist = WS->LastRunCheckList();
+// Handle(IFSelect_CheckCounter) counter = new IFSelect_CheckCounter(0);
+// counter->Analyse(chlist, WS->Model(), Standard_False);
+// counter->PrintCount(aSSC.SStream());
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun61
+////purpose :
+////=======================================================================
+//static Standard_Integer fun61(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** RunTransformer ****
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << "Donner Nom de Transformer";
+// return 1;
+// }
+// DeclareAndCast(IFSelect_Transformer, tsf, WS->NamedItem(arg1));
+// Standard_Integer effect = WS->RunTransformer(tsf);
+// switch (effect)
+// {
+// case -4: aSSC.SStream() << "Edition sur place, nouveau Protocole, erreur recalcul graphe"; break;
+// case -3: aSSC.SStream() << "Erreur, Transformation ignoree"; break;
+// case -2: aSSC.SStream() << "Erreur sur edition sur place, risque de corruption (verifier)"; break;
+// case -1: aSSC.SStream() << "Erreur sur edition locale, risque de corruption (verifier)"; break;
+// case 0:
+// if (tsf.IsNull()) aSSC.SStream() << "Erreur, pas un Transformer: " << arg1;
+// else aSSC.SStream() << "Execution non faite";
+// break;
+// case 1: aSSC.SStream() << "Transformation locale (graphe non touche)"; break;
+// case 2: aSSC.SStream() << "Edition sur place (graphe recalcule)"; break;
+// case 3: aSSC.SStream() << "Modele reconstruit"; break;
+// case 4: aSSC.SStream() << "Edition sur place, nouveau Protocole"; break;
+// case 5: aSSC.SStream() << "Nouveau Modele avec nouveau Protocole"; break;
+// default: break;
+// }
+// return ((effect > 0) ? XSControl_RetDone : XSControl_RetFail);
+//}
+//
+////=======================================================================
+////function : fun70
+////purpose :
+////=======================================================================
+//static Standard_Integer fun70(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** SelToggle ****
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << "Donner Nom de Selection";
+// return 1;
+// }
+// DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
+// if (!WS->ToggleSelectExtract(sel))
+// {
+// aSSC.SStream() << "Pas une SelectExtract : " << arg1;
+// return 1;
+// }
+// if (WS->IsReversedSelectExtract(sel)) aSSC.SStream() << arg1 << " a present Reversed";
+// else aSSC.SStream() << arg1 << " a present Directe";
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun71
+////purpose :
+////=======================================================================
+//static Standard_Integer fun71(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// const Standard_CString arg2 = theArgVec[2];
+// // **** SelInput ****
+// if (theNbArgs < 3)
+// {
+// aSSC.SStream() << "Donner Noms Selections cible et input";
+// return 1;
+// }
+// DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
+// DeclareAndCast(IFSelect_Selection, sou, WS->NamedItem(arg2));
+// if (sel.IsNull() || sou.IsNull())
+// {
+// aSSC.SStream() << "Incorrect : " << arg1 << "," << arg2;
+// return 1;
+// }
+// if (!WS->SetInputSelection(sel, sou))
+// {
+// aSSC.SStream() << "Nom incorrect ou Selection " << arg1 << " ni Extract ni Deduct";
+// return 1;
+// }
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun77
+////purpose :
+////=======================================================================
+//static Standard_Integer fun77(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// const Standard_CString arg2 = theArgVec[2];
+// // **** SelControlMain ****
+// if (theNbArgs < 3)
+// {
+// aSSC.SStream() << "Donner Noms de Control et MainInput";
+// return 1;
+// }
+// DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
+// DeclareAndCast(IFSelect_Selection, selmain, WS->NamedItem(arg2));
+// if (WS->SetControl(sel, selmain, Standard_True))
+// return 0;
+// aSSC.SStream() << "Nom incorrect ou Selection " << arg1 << " pas de type Control";
+// return 1;
+//}
+//
+////=======================================================================
+////function : fun78
+////purpose :
+////=======================================================================
+//static Standard_Integer fun78(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// const Standard_CString arg2 = theArgVec[2];
+// // **** SelControlSecond ****
+// if (theNbArgs < 3)
+// {
+// aSSC.SStream() << "Donner Noms de Control et SecondInput";
+// return 1;
+// }
+// DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
+// DeclareAndCast(IFSelect_Selection, seldif, WS->NamedItem(arg2));
+// if (WS->SetControl(sel, seldif, Standard_False)) return 0;
+// aSSC.SStream() << "Nom incorrect ou Selection " << arg1 << " pas de type Control";
+// return 1;
+//}
+//
+////=======================================================================
+////function : fun80
+////purpose :
+////=======================================================================
+//static Standard_Integer fun80(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// const Standard_CString arg2 = theArgVec[2];
+// // **** SelCombAdd ****
+// if (theNbArgs < 3)
+// {
+// aSSC.SStream() << "Donner n0 Combine et une Input";
+// return 1;
+// }
+// DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
+// DeclareAndCast(IFSelect_Selection, seladd, WS->NamedItem(arg2));
+// if (WS->CombineAdd(sel, seladd))
+// return 0;
+// aSSC.SStream() << "Nom incorrect ou Selection " << arg1 << " pas Combine";
+// return 1;
+//}
+//
+////=======================================================================
+////function : fun81
+////purpose :
+////=======================================================================
+//static Standard_Integer fun81(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// const Standard_CString arg2 = theArgVec[2];
+// // **** SelCombRem ****
+// if (theNbArgs < 3)
+// {
+// aSSC.SStream() << "Donner n0 Combine et RANG a supprimer";
+// return 1;
+// }
+// DeclareAndCast(IFSelect_Selection, sel, WS->NamedItem(arg1));
+// DeclareAndCast(IFSelect_Selection, inp, WS->NamedItem(arg2));
+// if (WS->CombineRemove(sel, inp))
+// return 0;
+// aSSC.SStream() << "Nom incorrect ou Selection " << arg1 << " ni Union ni Intersection";
+// return 1;
+//}
+//
+////=======================================================================
+////function : fun91
+////purpose :
+////=======================================================================
+//static Standard_Integer fun91(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// const Standard_CString arg1 = theArgVec[1];
+// // **** SetPointed (edit) / SetList (edit) ****
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << "Donner NOM SelectPointed + Option(s) :\n"
+// << " aucune : liste des entites pointees\n"
+// << " 0: Clear +nn ajout entite nn -nn enleve nn /nn toggle nn";
+// return 1;
+// }
+// DeclareAndCast(IFSelect_SelectPointed, sp, WS->NamedItem(arg1));
+// if (sp.IsNull())
+// {
+// aSSC.SStream() << "Pas une SelectPointed:" << arg1;
+// return 1;
+// }
+// const Handle(Interface_InterfaceModel)& model = WS->Model(); // pour Print
+// if (theNbArgs == 2)
+// { // listage simple
+// Standard_Integer nb = sp->NbItems();
+// aSSC.SStream() << " SelectPointed : " << arg1 << " : " << nb << " Items :";
+// for (Standard_Integer i = 1; i <= nb; i++)
+// {
+// Handle(Standard_Transient) pointed = sp->Item(i);
+// Standard_Integer id = WS->StartingNumber(pointed);
+// if (id == 0) aSSC.SStream() << " (inconnu)";
+// else
+// {
+// aSSC.SStream() << " "; model->Print(pointed, aSSC.SStream());
+// }
+// }
+// return 0;
+// }
+//
+// for (Standard_Integer ia = 2; ia < theNbArgs; ia++)
+// {
+// const TCollection_AsciiString argi = theArgVec[ia];
+// Standard_Integer id = WS->NumberFromLabel(&(argi.ToCString())[1]);
+// if (id == 0)
+// {
+// if (!argi.IsEqual("0")) aSSC.SStream() << "Incorrect,ignore:" << argi;
+// else
+// {
+// aSSC.SStream() << "Clear SelectPointed"; sp->Clear();
+// }
+// }
+// else if (argi.Value(1) == '-')
+// {
+// Handle(Standard_Transient) item = WS->StartingEntity(id);
+// if (sp->Remove(item)) aSSC.SStream() << "Removed:no." << id;
+// else aSSC.SStream() << " Echec Remove " << id;
+// aSSC.SStream() << ": ";
+// model->Print(item, aSSC.SStream());
+// }
+// else if (argi.Value(1) == '/')
+// {
+// Handle(Standard_Transient) item = WS->StartingEntity(id);
+// if (sp->Remove(item)) aSSC.SStream() << "Toggled:n0." << id;
+// else aSSC.SStream() << " Echec Toggle " << id;
+// aSSC.SStream() << ": ";
+// model->Print(item, aSSC.SStream());
+// }
+// else if (argi.Value(1) == '+')
+// {
+// Handle(Standard_Transient) item = WS->StartingEntity(id);
+// if (sp->Add(item)) aSSC.SStream() << "Added:no." << id;
+// else aSSC.SStream() << " Echec Add " << id;
+// aSSC.SStream() << ": ";
+// model->Print(item, aSSC.SStream());
+// }
+// else
+// {
+// aSSC.SStream() << "Ignore:" << argi << " , donner n0 PRECEDE de + ou - ou /";
+// }
+// }
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun_editlist
+////purpose :
+////=======================================================================
+//static Standard_Integer fun_editlist(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << "Give the name of an EditForm or an Editor";
+// return 1;
+// }
+// const Standard_CString arg1 = theArgVec[1];
+// const Standard_CString arg2 = theArgVec[2];
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+//
+// // EditForm
+//
+// DeclareAndCast(IFSelect_EditForm, edf, WS->NamedItem(arg1));
+// Handle(IFSelect_Editor) edt;
+// if (!edf.IsNull())
+// {
+// aSSC.SStream() << "Print EditForm " << arg1;
+// edt = edf->Editor();
+// if (theNbArgs < 3)
+// {
+// // DEFINITIONS : Editor (direct ou via EditForm)
+//
+// if (edt.IsNull()) edt = GetCasted(IFSelect_Editor, WS->NamedItem(arg1));
+// if (edt.IsNull())
+// return 0;
+//
+// aSSC.SStream() << "Editor, Label : " << edt->Label();
+// aSSC.SStream() << " -- Names (short - complete) + Labels of Values";
+// edt->PrintNames(aSSC.SStream());
+// aSSC.SStream() << " -- Definitions --";
+// edt->PrintDefs(aSSC.SStream());
+// if (!edf.IsNull())
+// {
+// edf->PrintDefs(aSSC.SStream());
+// aSSC.SStream() << "To display values, add an option : o original f final m modified";
+// }
+//
+// return 0;
+//
+// }
+// else
+// {
+// char opt = arg2[0];
+// Standard_Integer what = 0;
+// if (opt == 'o') what = -1;
+// else if (opt == 'f') what = 1;
+//
+// edf->PrintValues(aSSC.SStream(), what, Standard_False);
+// }
+// }
+//
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun_editclear
+////purpose :
+////=======================================================================
+//static Standard_Integer fun_editclear(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << "Give the name of an EditForm [+ name of Value else all]";
+// return 1;
+// }
+// const Standard_CString arg1 = theArgVec[1];
+// const Standard_CString arg2 = theArgVec[2];
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+// DeclareAndCast(IFSelect_EditForm, edf, WS->NamedItem(arg1));
+// if (edf.IsNull())
+// {
+// aSSC.SStream() << "Not an EditForm : " << arg1;
+// return 1;
+// }
+// if (theNbArgs < 3)
+// {
+// edf->ClearEdit(); aSSC.SStream() << "All Modifications Cleared";
+// }
+// else
+// {
+// Standard_Integer num = edf->NameNumber(arg2);
+// if (num == 0) aSSC.SStream() << "Unknown Value Name : " << arg2;
+// if (num < 0) aSSC.SStream() << "Not Extracted Value Name : " << arg2;
+// if (num <= 0)
+// return 1;
+// if (!edf->IsModified(num))
+// {
+// aSSC.SStream() << "Value " << arg2 << " was not modified";
+// return 0;
+// }
+// edf->ClearEdit(num);
+// aSSC.SStream() << "Modification on Value " << arg2 << " Cleared";
+// }
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun_editapply
+////purpose :
+////=======================================================================
+//static Standard_Integer fun_editapply(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << "Give the name of an EditForm [+ option keep to re-apply edited values]";
+// return 1;
+// }
+// const Standard_CString arg1 = theArgVec[1];
+// const Standard_CString arg2 = theArgVec[2];
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+// DeclareAndCast(IFSelect_EditForm, edf, WS->NamedItem(arg1));
+// if (edf.IsNull())
+// {
+// aSSC.SStream() << "Not an EditForm : " << arg1;
+// return 1;
+// }
+//
+// Handle(Standard_Transient) ent = edf->Entity();
+// Handle(Interface_InterfaceModel) model = edf->Model();
+// if (!model.IsNull())
+// {
+// if (ent.IsNull()) aSSC.SStream() << "Applying modifications on loaded model";
+// else
+// {
+// aSSC.SStream() << "Applying modifications on loaded entity : ";
+// model->PrintLabel(ent, aSSC.SStream());
+// }
+// }
+// else aSSC.SStream() << "Applying modifications";
+//
+// if (!edf->ApplyData(edf->Entity(), edf->Model()))
+// {
+// aSSC.SStream() << "Modifications could not be applied";
+// return 1;
+// }
+// aSSC.SStream() << "Modifications have been applied";
+//
+// Standard_Boolean stat = Standard_True;
+// if (theNbArgs > 2 && arg2[0] == 'k') stat = Standard_False;
+// if (stat)
+// {
+// edf->ClearEdit();
+// aSSC.SStream() << "Edited values are cleared";
+// }
+// else aSSC.SStream() << "Edited values are kept for another loading/applying";
+//
+// return 0;
+//}
+//
+////=======================================================================
+////function : fun_editload
+////purpose :
+////=======================================================================
+//static Standard_Integer fun_editload(Draw_Interpretor& theDI,
+// Standard_Integer theNbArgs,
+// const char** theArgVec)
+//{
+// XSDRAW::StreamContainer aSSC(theDI);
+// if (theNbArgs < 2)
+// {
+// aSSC.SStream() << "Give the name of an EditForm [+ Entity-Ident]";
+// return 1;
+// }
+// const Standard_CString arg1 = theArgVec[1];
+// const Standard_CString arg2 = theArgVec[2];
+// Handle(XSControl_WorkSession) WS = XSDRAWBase::Session();
+// DeclareAndCast(IFSelect_EditForm, edf, WS->NamedItem(arg1));
+// if (edf.IsNull())
+// {
+// aSSC.SStream() << "Not an EditForm : " << arg1;
+// return 1;
+// }
+//
+// Standard_Integer num = (theNbArgs < 3 ? 0 : WS->NumberFromLabel(arg2));
+// Standard_Boolean stat = Standard_False;
+// if (theNbArgs < 3)
+// {
+// aSSC.SStream() << "EditForm " << arg1 << " : Loading Model";
+// stat = edf->LoadModel(WS->Model());
+// }
+// else if (num <= 0)
+// {
+// aSSC.SStream() << "Not an entity ident : " << arg2;
+// return 1;
+// }
+// else
+// {
+// aSSC.SStream() << "EditForm " << arg1 << " : Loading Entity " << arg2;
+// stat = edf->LoadData(WS->StartingEntity(num), WS->Model());
+// }
+//
+// if (!stat)
+// {
+// aSSC.SStream() << "Loading not done";
+// return 1;
+// }
+// aSSC.SStream() << "Loading done";
+// return 0;
+//}
+//
+////=======================================================================
+////function : Init
+////purpose :
+////=======================================================================
+//void XSDRAW_FunctionsSession::Init(Draw_Interpretor& theDI)
+//{
+// static int THE_XSDRAW_FunctionsSession_initactor = 0;
+// if (THE_XSDRAW_FunctionsSession_initactor)
+// {
+// return;
+// }
+//
+// THE_XSDRAW_FunctionsSession_initactor = 1;
+// Standard_CString aGroup = "DE: General";
+// theDI.Add("xstatus", "Lists XSTEP Status : Version, System Name ...", __FILE__, funstatus, aGroup);
+// theDI.Add("handler", "Toggle status catch Handler Error of the session", __FILE__, fun1, aGroup);
+// theDI.Add("xload", "file:string : Read File -> Load Model", __FILE__, fun3, aGroup);
+// theDI.Add("xread", "file:string : Read File -> Load Model", __FILE__, fun3, aGroup);
+// theDI.Add("writeall", "file:string : Write all model (no split)", __FILE__, fun4, aGroup);
+// //theDI.Add("writesel", "file:string sel:Selection : Write Selected (no split)", __FILE__, fun5, aGroup);
+// theDI.Add("writeent", "file:string n1ent n2ent...:integer : Write Entite(s) (no split)", __FILE__, fun6, aGroup);
+// theDI.Add("writent", "file:string n1ent n2ent...:integer : Write Entite(s) (no split)", __FILE__, fun6, aGroup);
+// theDI.Add("elabel", "nument:integer : Displays Label Model of an entity", __FILE__, fun7, aGroup);
+// theDI.Add("enum", "label:string : Displays entities n0.s of which Label Model ends by..", __FILE__, fun8, aGroup);
+//
+// theDI.Add("listtypes", "List nb entities per type. Optional selection name else all model", __FILE__, fun9, aGroup);
+// //theDI.Add("count", "Count : counter [selection]", __FILE__, funcount, aGroup);
+// //theDI.Add("listcount", "List Counted : counter [selection [nument]]", __FILE__, funcount, aGroup);
+// //theDI.Add("sumcount", "Summary Counted : counter [selection [nument]]", __FILE__, funcount, aGroup);
+// theDI.Add("signtype", "Sign Type [newone]", __FILE__, funsigntype, aGroup);
+// theDI.Add("signcase", "signature : displays possible cases", __FILE__, funsigncase, aGroup);
+//
+// theDI.Add("estatus", "ent/nument : displays status of an entity", __FILE__, fun10, aGroup);
+// theDI.Add("data", "Data (DumpModel); whole help : data tout court", __FILE__, fun11, aGroup);
+// theDI.Add("entity", "give n0 ou id of entity [+ level]", __FILE__, fundumpent, aGroup);
+// theDI.Add("signature", "signature name + n0/ident entity", __FILE__, funsign, aGroup);
+// theDI.Add("queryparent", " give 2 n0s/labels of entities : dad son", __FILE__, funqp, aGroup);
+//
+// theDI.Add("dumpshare", "Dump Share (dispatches, IntParams)", __FILE__, fun12, aGroup);
+// theDI.Add("listitems", "List Items [label else all] ->Type,Label[,Name]", __FILE__, fun13, aGroup);
+// //theDI.Add("integer", "value:integer : cree un IntParam", __FILE__, fun14, aGroup);
+// theDI.Add("setint", "name:IntParam newValue:integer : Change valeur IntParam", __FILE__, fun15, aGroup);
+// //theDI.Add("text", "value:string : cree un TextParam", __FILE__, fun16, aGroup);
+// theDI.Add("settext", "Name:TextParam newValue:string : Change valeur TextParam", __FILE__, fun17, aGroup);
+// theDI.Add("dumpsel", "Dump Selection suivi du Nom de la Selection a dumper", __FILE__, fun19, aGroup);
+// //theDI.Add("evalsel", "name:Selection [num/sel] : Evalue une Selection", __FILE__, fun20, aGroup);
+// //theDI.Add("givelist", "num/sel [num/sel ...] : Evaluates GiveList", __FILE__, fun20, aGroup);
+// //theDI.Add("giveshort", "num/sel [num/sel ...] : GiveList in short form", __FILE__, fun20, aGroup);
+// //theDI.Add("givepointed", "num/sel [num/sel ...] : GiveList to fill a SelectPointed", __FILE__, fun20, aGroup);
+// //theDI.Add("makelist", "listname [givelist] : Makes a List(SelectPointed) from GiveList", __FILE__, fun20, aGroup);
+// //theDI.Add("givecount", "num/sel [num/sel ...] : Counts GiveList", __FILE__, fun20c, aGroup);
+// //theDI.Add("selsuite", "sel sel ... : Creates a SelectSuite", __FILE__, funselsuite, aGroup);
+// theDI.Add("clearitems", "Clears all items (selections, dispatches, etc)", __FILE__, fun21, aGroup);
+// theDI.Add("cleardata", "mode:a-g-c-p : Clears all or some data (model, check...)", __FILE__, fun22, aGroup);
+//
+// theDI.Add("itemlabel", "xxx xxx : liste items having this label", __FILE__, fun24, aGroup);
+// theDI.Add("xsave", "filename:string : sauve items-session", __FILE__, fun25, aGroup);
+// theDI.Add("xrestore", "filename:string : restaure items-session", __FILE__, fun26, aGroup);
+// theDI.Add("param", "[-p Pattern] - displays all parameters or filtered by pattern;\n"
+// "par_name - displays parameter;\n"
+// "par_name par_value - changes parameter's value", __FILE__, fun27, aGroup);
+//
+// theDI.Add("sentfiles", "Lists files sent from last Load", __FILE__, fun29, aGroup);
+// theDI.Add("fileprefix", "prefix:string : definit File Prefix", __FILE__, fun30, aGroup);
+// theDI.Add("fileext", "extent:string : definit File Extension", __FILE__, fun31, aGroup);
+// theDI.Add("fileroot", "disp:Dispatch root:string : definit File Root sur un Dispatch", __FILE__, fun32, aGroup);
+// theDI.Add("filedef", "defroot:string : definit File DefaultRoot", __FILE__, fun33, aGroup);
+// theDI.Add("evalfile", "Evaluation du FileNaming et memorisation", __FILE__, fun34, aGroup);
+// theDI.Add("clearfile", "Efface la liste d'EvalFile", __FILE__, fun35, aGroup);
+// theDI.Add("xsplit", "[disp:Dispatch sinon tout] : Split, la grande affaire !", __FILE__, fun36, aGroup);
+// theDI.Add("remaining", "options... : Remaining Entities, help complet par remaining ?", __FILE__, fun37, aGroup);
+// theDI.Add("setcontent", "sel:Selection mode:k ou r : Restreint contenu du modele", __FILE__, fun38, aGroup);
+//
+// theDI.Add("listmodif", "List Final Modifiers", __FILE__, fun40, aGroup);
+// theDI.Add("dumpmodif", "modif:Modifier : Affiche le Statut d'un Modifier", __FILE__, fun41, aGroup);
+// theDI.Add("modifsel", "modif:Modifier [sel:Selection] : Change/Annule Selection de Modifier", __FILE__, fun42, aGroup);
+// theDI.Add("setapplied", "modif:Modifier [name:un item sinon sortie fichier] : Applique un Modifier", __FILE__, fun43, aGroup);
+// theDI.Add("resetapplied", "modif:Modifier : Enleve un Modifier de la sortie fichier", __FILE__, fun44, aGroup);
+// theDI.Add("modifmove", "modif:Modifier M(model)/F(file) avant,apres:integer : Deplace un Modifier (sortie fichier)", __FILE__, fun45, aGroup);
+//
+// theDI.Add("dispsel", "disp:Dispatch sel:Selection -> Selection Finale de Dispatch", __FILE__, fun51, aGroup);
+// //theDI.Add("dispone", "cree DispPerOne", __FILE__, fun_dispone, aGroup);
+// //theDI.Add("dispglob", "cree DispGlobal", __FILE__, fun_dispglob, aGroup);
+// //theDI.Add("dispcount", "count:IntParam : cree DispPerCount", __FILE__, fun_dispcount, aGroup);
+// //theDI.Add("dispfile", "files:IntParam : cree DispPerFiles", __FILE__, fun_dispfiles, aGroup);
+// //theDI.Add("dispsign", "sign:Signature : cree DispPerSignature", __FILE__, fun_dispsign, aGroup);
+// theDI.Add("dumpdisp", "disp:Dispatch : Affiche le Statut d'un Dispatch", __FILE__, fun56, aGroup);
+//
+// theDI.Add("xremove", "nom : Remove a Control Item de la Session", __FILE__, fun57, aGroup);
+// theDI.Add("evaldisp", "mode=[0-3] disp:Dispatch : Evaluates one or more Dispatch(es)", __FILE__, fun58, aGroup);
+// //theDI.Add("evaladisp", "mode=[0-3] disp:Dispatch [givelist] : Evaluates a Dispatch (on a GiveList)", __FILE__, fun_evaladisp, aGroup);
+// //theDI.Add("writedisp", "filepattern disp:Dispatch [givelist] : Writes Entities by Splitting by a Dispatch", __FILE__, fun_writedisp, aGroup);
+// theDI.Add("evalcomplete", "Evaluation Complete de la Repartition", __FILE__, fun59, aGroup);
+//
+// theDI.Add("runcheck", "affiche LastRunCheckList (write,modif)", __FILE__, fun60, aGroup);
+// theDI.Add("runtranformer", "transf:Transformer : Applique un Transformer", __FILE__, fun61, aGroup);
+// //theDI.Add("copy", "cree TransformStandard, option Copy, vide", __FILE__, fun62, aGroup);
+// //theDI.Add("onthespot", "cree TransformStandard, option OntheSpot, vide", __FILE__, fun63, aGroup);
+// //theDI.Add("runcopy", "modif:ModelModifier [givelist] : Run <modif> via TransformStandard option Copy", __FILE__, fun6465, aGroup);
+// //theDI.Add("runonthespot", "modif:ModelModifier [givelist] : Run <modif> via TransformStandard option OnTheSpot", __FILE__, fun6465, aGroup);
+// //theDI.Add("reorder", "[f ou t] reordonne le modele", __FILE__, fun66, aGroup);
+//
+// theDI.Add("toggle", "sel:Selection genre Extract : Toggle Direct/Reverse", __FILE__, fun70, aGroup);
+// theDI.Add("input", "sel:Selection genre Deduct ou Extract input:Selection : Set Input", __FILE__, fun71, aGroup);
+// //theDI.Add("modelroots", "cree SelectModelRoots", __FILE__, fun72, aGroup);
+// //theDI.Add("range", "options... : cree SelectRange ...; tout court pour help", __FILE__, fun73, aGroup);
+// //theDI.Add("roots", "cree SelectRoots (local roots)", __FILE__, fun74, aGroup);
+// //theDI.Add("shared", "cree SelectShared", __FILE__, fun75, aGroup);
+// //theDI.Add("diff", "[main:Selection diff:Selection] : cree SelectDiff", __FILE__, fun76, aGroup);
+// theDI.Add("selmain", "sel:Selection genre Control main:Selection : Set Main Input", __FILE__, fun77, aGroup);
+// theDI.Add("selsecond", "sel:Selection genre Control sec:Selection : Set Second Input", __FILE__, fun78, aGroup);
+// //theDI.Add("modelall", "cree SelectModelAll", __FILE__, fun79, aGroup);
+// theDI.Add("seladd", "sel:Selection genre Combine input:Selection : Add Selection", __FILE__, fun80, aGroup);
+// theDI.Add("selrem", "sel:Selection genre Combine input:Selection : Remove Selection", __FILE__, fun81, aGroup);
+// //theDI.Add("number", "num:IntParam : Cree SelectEntityNumber", __FILE__, fun82, aGroup);
+//
+// //theDI.Add("union", "cree SelectUnion (vide), cf aussi combadd, combrem", __FILE__, fun83, aGroup);
+// //theDI.Add("intersect", "cree SelectIntersection (vide), cf aussi combadd, combrem", __FILE__, fun84, aGroup);
+// //theDI.Add("typexact", "type:string : cree SelectTextType Exact", __FILE__, fun85, aGroup);
+// //theDI.Add("errors", "cree SelectErrorEntities (from file)", __FILE__, fun86, aGroup);
+// //theDI.Add("unknown", "cree SelectUnknownEntities", __FILE__, fun87, aGroup);
+// //theDI.Add("sharing", "cree SelectSharing", __FILE__, fun88, aGroup);
+// //theDI.Add("typecontain", "type:string : cree SelectTextType Contains", __FILE__, fun89, aGroup);
+// //theDI.Add("pointed", "cree SelectPointed [num/sel num/sel]", __FILE__, fun90, aGroup);
+// theDI.Add("setpointed", "sel:SelectPointed : edition SelectPointed. tout court pour help", __FILE__, fun91, aGroup);
+// theDI.Add("setlist", "sel:SelectPointed : edition SelectPointed. tout court pour help", __FILE__, fun91, aGroup);
+// //theDI.Add("incorrect", "cree SelectIncorrectEntities (computed)", __FILE__, fun92, aGroup);
+//
+// //theDI.Add("signsel", "sign:Signature|cnt:Counter text:string [e(D)|c] : cree SelectSignature", __FILE__, fun93, aGroup);
+// //theDI.Add("signcounter", "sign:Signature : cree SignCounter", __FILE__, fun94, aGroup);
+// //theDI.Add("nbselected", "applied:Selection : cree GraphCounter(=NbSelected)", __FILE__, funbselected, aGroup);
+//
+// theDI.Add("editlist", "editor or editform : lists defs + values", __FILE__, fun_editlist, aGroup);
+// //theDI.Add("editvalue", "editform paramname [newval or .] : lists-changes a value", __FILE__, fun_editvalue, aGroup);
+// theDI.Add("editclear", "editform [paramname] : clears edition on all or one param", __FILE__, fun_editclear, aGroup);
+// theDI.Add("editload", "editform [entity-id] : loads from model or an entity", __FILE__, fun_editload, aGroup);
+// theDI.Add("editapply", "editform [keep] : applies on loaded data", __FILE__, fun_editapply, aGroup);
+//}
if (modfic) theDI << " File IGES to read : " << fnom.ToCString() << "\n";
else theDI << " Model taken from the session : " << fnom.ToCString() << "\n";
theDI << " -- Names of variables BREP-DRAW prefixed by : " << rnom.ToCString() << "\n";
- IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
+ XSControl_ReturnStatus readstat = XSControl_RetVoid;
#ifdef CHRONOMESURE
OSD_Timer Chr; Chr.Reset();
progress->Show(aPSRoot);
if (modfic) readstat = Reader.ReadFile(fnom.ToCString());
- else if (XSDRAWBase::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
+ else if (XSDRAWBase::Session()->NbStartingEntities() > 0) readstat = XSControl_RetDone;
aPSRoot.Next(20); // On average loading takes 20%
if (aPSRoot.UserBreak())
return 1;
- if (readstat != IFSelect_RetDone)
+ if (readstat != XSControl_RetDone)
{
if (modfic) theDI << "Could not read file " << fnom.ToCString() << " , abandon\n";
else theDI << "No model loaded\n";
}
IGESControl_Reader Reader;
Standard_CString filename = theArgVec[1];
- IFSelect_ReturnStatus readstat = Reader.ReadFile(filename);
+ XSControl_ReturnStatus readstat = Reader.ReadFile(filename);
theDI << "Status from reading IGES file " << filename << " : ";
switch (readstat)
{
- case IFSelect_RetVoid: { theDI << "empty file\n"; return 1; }
- case IFSelect_RetDone: { theDI << "file read\n"; break; }
- case IFSelect_RetError: { theDI << "file not found\n"; return 1; }
- case IFSelect_RetFail: { theDI << "error during read\n"; return 1; }
+ case XSControl_RetVoid: { theDI << "empty file\n"; return 1; }
+ case XSControl_RetDone: { theDI << "file read\n"; break; }
+ case XSControl_RetError: { theDI << "file not found\n"; return 1; }
+ case XSControl_RetFail: { theDI << "error during read\n"; return 1; }
default: { theDI << "failure\n"; return 1; }
}
Reader.TransferRoots();
if (modfic) theDI << " File STEP to read : " << fnom.ToCString() << "\n";
else theDI << " Model taken from the session : " << fnom.ToCString() << "\n";
theDI << " -- Names of variables BREP-DRAW prefixed by : " << rnom.ToCString() << "\n";
- IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
+ XSControl_ReturnStatus readstat = XSControl_RetVoid;
aPSRoot.SetName("Loading");
progress->Show(aPSRoot);
sr.WS()->SetModeStat(aFullMode);
if (modfic) readstat = sr.ReadFile(fnom.ToCString());
- else if (XSDRAWBase::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
+ else if (XSDRAWBase::Session()->NbStartingEntities() > 0) readstat = XSControl_RetDone;
aPSRoot.Next(20); // On average loading takes 20%
if (aPSRoot.UserBreak())
return 1;
- if (readstat != IFSelect_RetDone)
+ if (readstat != XSControl_RetDone)
{
if (modfic) theDI << "Could not read file " << fnom.ToCString() << " , abandon\n";
else theDI << "No model loaded\n";
STEPControl_Reader Reader;
Standard_CString filename = theArgVec[1];
- IFSelect_ReturnStatus readstat;
+ XSControl_ReturnStatus readstat;
if (useStream)
{
std::ifstream aStream;
theDI << "Status from reading STEP file " << filename << " : ";
switch (readstat)
{
- case IFSelect_RetVoid: { theDI << "empty file\n"; return 1; }
- case IFSelect_RetDone: { theDI << "file read\n"; break; }
- case IFSelect_RetError: { theDI << "file not found\n"; return 1; }
- case IFSelect_RetFail: { theDI << "error during read\n"; return 1; }
+ case XSControl_RetVoid: { theDI << "empty file\n"; return 1; }
+ case XSControl_RetDone: { theDI << "file read\n"; break; }
+ case XSControl_RetError: { theDI << "file not found\n"; return 1; }
+ case XSControl_RetFail: { theDI << "error during read\n"; return 1; }
default: { theDI << "failure\n"; return 1; }
}
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
progress->Show(aPSRoot);
Standard_Integer stat = sw.Transfer(shape, mode, Standard_True, aPSRoot.Next(90));
- if (stat == IFSelect_RetDone)
+ if (stat == XSControl_RetDone)
{
theDI << "Translation: OK\n";
}
stat = sw.Write(nomfic);
switch (stat)
{
- case IFSelect_RetVoid: theDI << "Error: No file written\n"; return 1;
- case IFSelect_RetDone: theDI << "File " << nomfic << " written\n"; break;
- case IFSelect_RetStop: theDI << "Error on writing file: no space on disk or destination is write protected\n"; return 1;
+ case XSControl_RetVoid: theDI << "Error: No file written\n"; return 1;
+ case XSControl_RetDone: theDI << "File " << nomfic << " written\n"; break;
+ case XSControl_RetStop: theDI << "Error on writing file: no space on disk or destination is write protected\n"; return 1;
default: theDI << "Error: File " << nomfic << " written with fail messages\n"; return 1;
}
XSDRAWBase::CollectActiveWorkSessions(aWS, nomfic, XSDRAWBase::WorkSessionList());
}
STEPControl_Writer aWriter;
- IFSelect_ReturnStatus aStat = aWriter.Transfer(aShape, STEPControl_AsIs);
- if (aStat != IFSelect_RetDone)
+ XSControl_ReturnStatus aStat = aWriter.Transfer(aShape, STEPControl_AsIs);
+ if (aStat != XSControl_RetDone)
{
theDI << "Error on transferring shape\n";
return 1;
aStat = aWriter.WriteStream(aStream);
aStream.close();
if (!aStream.good()
- && aStat == IFSelect_RetDone)
+ && aStat == XSControl_RetDone)
{
- aStat = IFSelect_RetFail;
+ aStat = XSControl_RetFail;
}
}
else
{
aStat = aWriter.Write(aFilePath.ToCString());
}
- if (aStat != IFSelect_RetDone)
+ if (aStat != XSControl_RetDone)
{
theDI << "Error on writing file\n";
return 1;
return 1;
}
STEPControl_Reader aStepReader;
- IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
+ XSControl_ReturnStatus readstat = XSControl_RetVoid;
readstat = aStepReader.ReadFile(theArgVec[1]);
- if (readstat != IFSelect_RetDone)
+ if (readstat != XSControl_RetDone)
{
theDI << "No model loaded\n";
return 1;
STEPCAFControl_Reader aStepReader;
const TCollection_AsciiString aStr (theFileName);
- IFSelect_ReturnStatus aStatus = aStepReader.ReadFile (aStr.ToCString());
- if (aStatus != IFSelect_RetDone)
+ XSControl_ReturnStatus aStatus = aStepReader.ReadFile (aStr.ToCString());
+ if (aStatus != XSControl_RetDone)
return Handle(TDocStd_Application)();
aStepReader.SetColorMode (Standard_True);