#include <TopoDS_Wire.hxx>
#include <Transfer_FinderProcess.hxx>
#include <Transfer_SimpleBinderOfTransient.hxx>
-//szv_c1:#include <Transfer_TransientMapper.hxx>
#include <TransferBRep_ShapeMapper.hxx>
char Name[100];
(const Handle(Standard_Transient)& start,
const Standard_CString amess)
{
- /*szv_c1:Handle(Transfer_TransientMapper) Mapper = new Transfer_TransientMapper(start);
- TheMap->AddFail(Mapper, amess);*/
TheMap->AddFail(start, amess);
}
(const Handle(Standard_Transient)& start,
const Standard_CString amess)
{
- /*szv_c1:Handle(Transfer_TransientMapper) Mapper = new Transfer_TransientMapper(start);
- TheMap->AddWarning(Mapper, amess);*/
TheMap->AddWarning(start, amess);
}
Standard_Boolean BRepToIGES_BREntity::HasShapeResult
(const Handle(Standard_Transient)& start) const
{
- /*szv_c1:Handle(Transfer_TransientMapper) Mapper = new Transfer_TransientMapper(start);
- DeclareAndCast(Transfer_SimpleBinderOfTransient, binder, TheMap->Find(Mapper));*/
DeclareAndCast(Transfer_SimpleBinderOfTransient, binder, TheMap->Find(start));
if (binder.IsNull()) return Standard_False;
return binder->HasResult();
{
Handle(Standard_Transient) res;
- /*szv_c1:Handle(Transfer_TransientMapper) Mapper = new Transfer_TransientMapper(start);
- DeclareAndCast(Transfer_SimpleBinderOfTransient, binder, TheMap->Find(Mapper));*/
DeclareAndCast(Transfer_SimpleBinderOfTransient, binder, TheMap->Find(start));
if (binder.IsNull()) return res;
if (binder->HasResult())
const Handle(Standard_Transient)& result)
{
Handle(Transfer_SimpleBinderOfTransient) binder = new Transfer_SimpleBinderOfTransient;
- /*szv_c1:Handle(Transfer_TransientMapper) Mapper = new Transfer_TransientMapper(start);
- TheMap->Bind(Mapper,binder);*/
TheMap->Bind(start,binder);
binder->SetResult(result);
}
#include <HeaderSection.hxx>
#include <HeaderSection_Protocol.hxx>
-#include <Interface_Statics.hxx>
-StaticHandle(HeaderSection_Protocol, proto);
-
-Handle(HeaderSection_Protocol) HeaderSection::Protocol()
-
- {
- InitHandleVoid(HeaderSection_Protocol, proto);
- return proto;
- }
+//szv_c1:StaticHandle(HeaderSection_Protocol, proto);
+static Handle(HeaderSection_Protocol) proto;
+const Handle(HeaderSection_Protocol) & HeaderSection::Protocol()
+{
+ //szv_c1:InitHandleVoid(HeaderSection_Protocol, proto)
+ if (proto.IsNull()) proto = new HeaderSection_Protocol;
+ return proto;
+}
#define _HeaderSection_HeaderFile
#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
-
-class HeaderSection_Protocol;
class HeaderSection_Protocol;
-class HeaderSection_FileName;
-class HeaderSection_FileDescription;
-class HeaderSection_FileSchema;
-class HeaderSection_HeaderRecognizer;
-
-
class HeaderSection
{
-public:
+ public:
- DEFINE_STANDARD_ALLOC
-
-
//! creates a Protocol
- Standard_EXPORT static Handle(HeaderSection_Protocol) Protocol();
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-friend class HeaderSection_Protocol;
-friend class HeaderSection_FileName;
-friend class HeaderSection_FileDescription;
-friend class HeaderSection_FileSchema;
-friend class HeaderSection_HeaderRecognizer;
-
+ Standard_EXPORT static const Handle(HeaderSection_Protocol) & Protocol();
};
-
-
-
-
-
-
#endif // _HeaderSection_HeaderFile
IFGraph_AllConnected.hxx
IFGraph_AllShared.cxx
IFGraph_AllShared.hxx
-IFGraph_Articulations.cxx
-IFGraph_Articulations.hxx
IFGraph_Compare.cxx
IFGraph_Compare.hxx
IFGraph_ConnectedComponants.cxx
#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)
+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)
+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); }
+void IFGraph_AllShared::Evaluate()
+{
+ Reset();
+ GetFromGraph(thegraph);
+}
#include <Interface_Graph.hxx>
#include <Interface_GraphContent.hxx>
-class Interface_Graph;
-class Standard_Transient;
class Interface_EntityIterator;
//! for instance)
class IFGraph_AllShared : public Interface_GraphContent
{
-public:
+ public:
DEFINE_STANDARD_ALLOC
-
//! creates an AllShared from a graph, empty ready to be filled
- Standard_EXPORT IFGraph_AllShared(const Interface_Graph& agraph);
+ IFGraph_AllShared(const Interface_Graph& agraph)
+ : thegraph (agraph)
+ {}
//! creates an AllShared which memrizes Entities shared by a given
//! one, at any level, including itself
//! 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);
+ void GetFromEntity (const Handle(Standard_Transient)& ent) { thegraph.GetFromEntity(ent,Standard_True); }
//! 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();
-
+ void ResetData() { Reset(); thegraph.Reset(); }
+
//! does the specific evaluation (shared entities atall levels)
Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
+ 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 Interface_Graph;
-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 spliting 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;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
- //! basic routine of computation
- //! (see book Sedgewick "Algorithms", p 392)
- Standard_EXPORT Standard_Integer Visit (const Standard_Integer num);
-
-
- Interface_Graph thegraph;
- Standard_Integer thenow;
- Handle(TColStd_HSequenceOfInteger) thelist;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFGraph_Articulations_HeaderFile
#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)
+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)
+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 ()
+void IFGraph_Compare::Merge ()
{
thegraph.ChangeStatus (2,1);
thegraph.ChangeStatus (3,1);
}
- void IFGraph_Compare::RemoveSecond ()
+void IFGraph_Compare::RemoveSecond ()
{
thegraph.ChangeStatus (3,1);
thegraph.RemoveStatus (2);
}
- void IFGraph_Compare::KeepCommon ()
+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 ()
+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); }
#include <Interface_Graph.hxx>
#include <Interface_GraphContent.hxx>
-#include <Standard_Boolean.hxx>
-class Interface_Graph;
-class Standard_Transient;
class Interface_EntityIterator;
//! Basic Iteration gives Cumulation (union)
class IFGraph_Compare : public Interface_GraphContent
{
-public:
+ public:
DEFINE_STANDARD_ALLOC
-
//! creates empty Compare, ready to work
- Standard_EXPORT IFGraph_Compare(const Interface_Graph& agraph);
+ IFGraph_Compare(const Interface_Graph& agraph)
+ : thegraph (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 KeepCommon();
//! Allows to restart on a new data set
- Standard_EXPORT void ResetData();
+ void ResetData() { Reset(); thegraph.Reset(); }
//! 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:
-
-
-
+ Interface_EntityIterator Common() const { return Interface_GraphContent(thegraph,3); }
+ //! returns entities which are exclusively in the first list
+ Interface_EntityIterator FirstOnly() const { return Interface_GraphContent(thegraph,1); }
-private:
-
+ //! returns entities which are exclusively in the second part
+ Interface_EntityIterator SecondOnly() const { return Interface_GraphContent(thegraph,2); }
+ private:
Interface_Graph thegraph;
-
-
};
-
-
-
-
-
-
#endif // _IFGraph_Compare_HeaderFile
// 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()
+void IFGraph_ConnectedComponants::Evaluate()
{
// On part des "loaded"
// Pour chacun : s il est note dans le graphe, on passe
#include <Standard_Handle.hxx>
#include <IFGraph_SubPartsIterator.hxx>
-#include <Standard_Boolean.hxx>
class Interface_Graph;
-
//! determines Connected Componants 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);
+ IFGraph_ConnectedComponants(const Interface_Graph& agraph, const Standard_Boolean whole)
+ : IFGraph_SubPartsIterator (agraph, whole)
+ {}
//! does the computation
Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-
};
-
-
-
-
-
-
#endif // _IFGraph_ConnectedComponants_HeaderFile
// 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)
+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)
+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 ()
+void IFGraph_Cumulate::Evaluate ()
{
Reset(); GetFromGraph(thegraph); // evaluation deja faite dans le graphe
}
- Interface_EntityIterator IFGraph_Cumulate::Overlapped () const
+Interface_EntityIterator IFGraph_Cumulate::Overlapped () const
{
Interface_EntityIterator iter;
Standard_Integer nb = thegraph.Size();
return iter;
}
- Interface_EntityIterator IFGraph_Cumulate::Forgotten () const
+Interface_EntityIterator IFGraph_Cumulate::Forgotten () const
{
Interface_EntityIterator iter;
Standard_Integer nb = thegraph.Size();
return iter;
}
- Interface_EntityIterator IFGraph_Cumulate::PerCount
- (const Standard_Integer count) const
+Interface_EntityIterator IFGraph_Cumulate::PerCount (const Standard_Integer count) const
{
Interface_EntityIterator iter;
Standard_Integer nb = thegraph.Size();
return iter;
}
-
- Standard_Integer IFGraph_Cumulate::NbTimes
- (const Handle(Standard_Transient)& ent) const
+Standard_Integer IFGraph_Cumulate::NbTimes (const Handle(Standard_Transient)& ent) const
{
Standard_Integer num = thegraph.EntityNumber(ent);
if (num == 0) return 0;
return stat-1;
}
- Standard_Integer IFGraph_Cumulate::HighestNbTimes () const
+Standard_Integer IFGraph_Cumulate::HighestNbTimes () const
{
Standard_Integer max = 0;
Standard_Integer nb = thegraph.Size();
#include <Interface_Graph.hxx>
#include <Interface_GraphContent.hxx>
-#include <Standard_Integer.hxx>
-class Interface_Graph;
-class Standard_Transient;
class Interface_EntityIterator;
//! Basic Iteration gives entities which are part of Cumulation
class IFGraph_Cumulate : public Interface_GraphContent
{
-public:
+ public:
DEFINE_STANDARD_ALLOC
-
//! creates empty Cumulate, ready to work
- Standard_EXPORT IFGraph_Cumulate(const Interface_Graph& agraph);
-
+ IFGraph_Cumulate(const Interface_Graph& agraph)
+ : thegraph (agraph)
+ {}
+
//! adds an entity and its shared ones to the list
Standard_EXPORT void GetFromEntity (const Handle(Standard_Transient)& ent);
Standard_EXPORT void GetFromIter (const Interface_EntityIterator& iter);
//! Allows to restart on a new data set
- Standard_EXPORT void ResetData();
-
+ void ResetData() { Reset(); thegraph.Reset(); }
+
//! Evaluates the result of cumulation
Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
//! (0 means empty, 1 means no overlap)
Standard_EXPORT Standard_Integer HighestNbTimes() const;
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
+ private:
Interface_Graph thegraph;
-
-
};
-
-
-
-
-
-
#endif // _IFGraph_Cumulate_HeaderFile
// 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 ()
+void IFGraph_ExternalSources::Evaluate ()
{
Reset();
thegraph.RemoveStatus(1);
GetFromGraph(thegraph,1);
}
- Standard_Boolean IFGraph_ExternalSources::IsEmpty ()
+Standard_Boolean IFGraph_ExternalSources::IsEmpty ()
{
Evaluate();
Standard_Integer nb = thegraph.Size();
#include <Interface_Graph.hxx>
#include <Interface_GraphContent.hxx>
-#include <Standard_Boolean.hxx>
-class Interface_Graph;
-class Standard_Transient;
class Interface_EntityIterator;
//! a sub-part, but are not contained by this sub-part
class IFGraph_ExternalSources : public Interface_GraphContent
{
-public:
+ public:
DEFINE_STANDARD_ALLOC
-
//! creates empty ExternalSources, ready to work
- Standard_EXPORT IFGraph_ExternalSources(const Interface_Graph& agraph);
+ IFGraph_ExternalSources(const Interface_Graph& agraph)
+ : thegraph (agraph)
+ {}
//! adds an entity and its shared ones to the list
- Standard_EXPORT void GetFromEntity (const Handle(Standard_Transient)& ent);
-
+ void GetFromEntity (const Handle(Standard_Transient)& ent)
+ { thegraph.GetFromEntity(ent,Standard_True); }
+
//! adds a list of entities (as an iterator) with shared ones
- Standard_EXPORT void GetFromIter (const Interface_EntityIterator& iter);
-
+ void GetFromIter (const Interface_EntityIterator& iter)
+ { thegraph.GetFromIter(iter,0); }
+
//! Allows to restart on a new data set
- Standard_EXPORT void ResetData();
-
+ void ResetData() { Reset(); thegraph.Reset(); }
+
//! Evaluates external sources of a set of entities
Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
//! (performs an Evaluation as necessary)
Standard_EXPORT Standard_Boolean IsEmpty();
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
+ private:
Interface_Graph thegraph;
-
-
};
-
-
-
-
-
-
#endif // _IFGraph_ExternalSources_HeaderFile
#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 ()
+void IFGraph_SCRoots::Evaluate ()
{
IFGraph_StrongComponants complist (Model(),Standard_False);
complist.GetFromIter(Loaded());
-// Interface_Graph G(Model());
Interface_Graph G(thegraph);
#ifdef OCCT_DEBUG
cout<<" SCRoots:"<<endl;
}
}
}
-
-/* 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);
- }
- }
-}
-*/
#include <Standard_Handle.hxx>
#include <IFGraph_StrongComponants.hxx>
-#include <Standard_Boolean.hxx>
class Interface_Graph;
-class IFGraph_StrongComponants;
//! determines strong componants in a graph which are Roots
//! 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);
-
+ IFGraph_SCRoots(const Interface_Graph& agraph, const Standard_Boolean whole)
+ : IFGraph_StrongComponants (agraph,whole)
+ {}
+
//! creates from a StrongComponants which was already computed
- Standard_EXPORT IFGraph_SCRoots(IFGraph_StrongComponants& subparts);
-
+ IFGraph_SCRoots(IFGraph_StrongComponants& subparts)
+ : IFGraph_StrongComponants (subparts)
+ {}
+
//! does the computation
Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-
};
-
-
-
-
-
-
#endif // _IFGraph_SCRoots_HeaderFile
#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 ()
+void IFGraph_StrongComponants::Evaluate ()
{
- Interface_GraphContent iter = Loaded();
- Interface_Graph G(thegraph); G.GetFromIter(iter,0);
+ Interface_Graph G(thegraph); G.GetFromIter(Loaded(),0);
Standard_Integer nb = G.Size();
for (Standard_Integer i = 1; i <= nb; i ++) {
if (!G.IsPresent(i)) continue;
#include <Standard_Handle.hxx>
#include <IFGraph_SubPartsIterator.hxx>
-#include <Standard_Boolean.hxx>
class Interface_Graph;
//! isolated entities (single componants) or loops
class IFGraph_StrongComponants : public IFGraph_SubPartsIterator
{
-public:
+ 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);
-
+ IFGraph_StrongComponants(const Interface_Graph& agraph, const Standard_Boolean whole)
+ : IFGraph_SubPartsIterator (agraph, whole)
+ {}
+
//! does the computation
Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-
};
-
-
-
-
-
-
#endif // _IFGraph_StrongComponants_HeaderFile
// 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)
+IFGraph_SubPartsIterator::IFGraph_SubPartsIterator (const Interface_Graph& agraph, const Standard_Boolean whole)
+: thegraph (agraph)
{
if (whole) thegraph.GetFromModel();
theparts = new TColStd_HSequenceOfInteger();
thecurr = 0;
}
- IFGraph_SubPartsIterator::IFGraph_SubPartsIterator
- (IFGraph_SubPartsIterator& other)
- : thegraph (other.Graph())
+IFGraph_SubPartsIterator::IFGraph_SubPartsIterator (IFGraph_SubPartsIterator& other)
+: thegraph (other.thegraph)
{
Standard_Integer nb = thegraph.Size();
theparts = new TColStd_HSequenceOfInteger();
thecurr = 1;
}
- void IFGraph_SubPartsIterator::GetParts
- (IFGraph_SubPartsIterator& other)
+void IFGraph_SubPartsIterator::GetParts (IFGraph_SubPartsIterator& other)
{
if (Model() != other.Model()) Interface_InterfaceError::Raise
("SubPartsIterator : GetParts");
}
}
- const Interface_Graph& IFGraph_SubPartsIterator::Graph () const
- { return thegraph; }
-
// .... Gestion Interne (remplissage, etc...) .... //
- Handle(Interface_InterfaceModel) IFGraph_SubPartsIterator::Model() const
- { return thegraph.Model(); }
+Handle(Interface_InterfaceModel) IFGraph_SubPartsIterator::Model() const
+{ return thegraph.Model(); }
- void IFGraph_SubPartsIterator::AddPart ()
+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::NbParts () const
+{ return theparts->Length(); }
- Standard_Integer IFGraph_SubPartsIterator::PartNum () const
- { return thepart; }
+Standard_Integer IFGraph_SubPartsIterator::PartNum () const
+{ return thepart; }
- void IFGraph_SubPartsIterator::SetLoad ()
- { thepart = 0; }
+void IFGraph_SubPartsIterator::SetLoad ()
+{ thepart = 0; }
- void IFGraph_SubPartsIterator::SetPartNum (const Standard_Integer num)
+void IFGraph_SubPartsIterator::SetPartNum (const Standard_Integer num)
{
if (num <= 0 || num > theparts->Length()) Standard_OutOfRange::Raise
("IFGraph_SubPartsIterator : SetPartNum");
thepart = num;
}
- void IFGraph_SubPartsIterator::GetFromEntity
- (const Handle(Standard_Transient)& ent, const Standard_Boolean shared)
+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)
+void IFGraph_SubPartsIterator::GetFromIter (const Interface_EntityIterator& iter)
{
thegraph.GetFromIter(iter, thepart,thepart, Standard_False);
}
- void IFGraph_SubPartsIterator::Reset ()
+void IFGraph_SubPartsIterator::Reset ()
{
thegraph.Reset();
theparts->Clear();
}
return iter;
}
-
-//=======================================================================
-//function : ~IFGraph_SubPartsIterator
-//purpose :
-//=======================================================================
-
-IFGraph_SubPartsIterator::~IFGraph_SubPartsIterator()
-{}
#include <Interface_Graph.hxx>
#include <TColStd_HSequenceOfInteger.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Boolean.hxx>
-class Standard_OutOfRange;
-class Standard_NoSuchObject;
-class Interface_InterfaceError;
-class Interface_Graph;
+class TColStd_HSequenceOfTransient;
class Interface_InterfaceModel;
-class Standard_Transient;
class Interface_EntityIterator;
class Interface_GraphContent;
//! (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
+ //! 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 : same as above (end of iteration)
Standard_EXPORT Interface_EntityIterator Entities() const;
- Standard_EXPORT virtual ~IFGraph_SubPartsIterator();
-
-protected:
-
+ 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;
-
+ private:
Handle(TColStd_HSequenceOfInteger) theparts;
Handle(TColStd_HSequenceOfInteger) thefirsts;
Standard_Integer thepart;
Standard_Integer thecurr;
-
-
};
-
-
-
-
-
-
#endif // _IFGraph_SubPartsIterator_HeaderFile
-IFSelect.cxx
-IFSelect.hxx
-IFSelect_Act.cxx
-IFSelect_Act.hxx
-IFSelect_ActFunc.hxx
IFSelect_Activator.cxx
IFSelect_Activator.hxx
IFSelect_AppliedModifiers.cxx
IFSelect_Editor.cxx
IFSelect_Editor.hxx
IFSelect_EditValue.hxx
-IFSelect_FileModifier.gxx
-IFSelect_Functions.cxx
-IFSelect_Functions.hxx
IFSelect_GeneralModifier.cxx
IFSelect_GeneralModifier.hxx
IFSelect_GraphCounter.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.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>
-#include <Standard_CString.hxx>
-class IFSelect_WorkSession;
-class IFSelect_Signature;
-class IFSelect_SignMultiple;
-class IFSelect_SignType;
-class IFSelect_SignCategory;
-class IFSelect_SignValidity;
-class IFSelect_SignAncestor;
-class IFSelect_ShareOut;
-class IFSelect_AppliedModifiers;
-class IFSelect_ShareOutResult;
-class IFSelect_PacketList;
-class IFSelect_Dispatch;
-class IFSelect_DispGlobal;
-class IFSelect_DispPerOne;
-class IFSelect_DispPerCount;
-class IFSelect_DispPerSignature;
-class IFSelect_DispPerFiles;
-class IFSelect_SelectionIterator;
-class IFSelect_Selection;
-class IFSelect_SelectBase;
-class IFSelect_SelectModelRoots;
-class IFSelect_SelectModelEntities;
-class IFSelect_SelectEntityNumber;
-class IFSelect_SelectPointed;
-class IFSelect_SelectCombine;
-class IFSelect_SelectUnion;
-class IFSelect_SelectIntersection;
-class IFSelect_SelectControl;
-class IFSelect_SelectDiff;
-class IFSelect_SelectDeduct;
-class IFSelect_SelectShared;
-class IFSelect_SelectSharing;
-class IFSelect_SelectAnyList;
-class IFSelect_SelectInList;
-class IFSelect_SelectSuite;
-class IFSelect_SelectExtract;
-class IFSelect_SelectUnknownEntities;
-class IFSelect_SelectErrorEntities;
-class IFSelect_SelectIncorrectEntities;
-class IFSelect_SelectRoots;
-class IFSelect_SelectRootComps;
-class IFSelect_SelectRange;
-class IFSelect_SelectAnyType;
-class IFSelect_SelectType;
-class IFSelect_SelectSignature;
-class IFSelect_SelectFlag;
-class IFSelect_SelectSent;
-class IFSelect_SelectExplore;
-class IFSelect_SelectSignedShared;
-class IFSelect_SelectSignedSharing;
-class IFSelect_IntParam;
-class IFSelect_SignatureList;
-class IFSelect_CheckCounter;
-class IFSelect_SignCounter;
-class IFSelect_GraphCounter;
-class IFSelect_Editor;
-class IFSelect_ParamEditor;
-class IFSelect_EditForm;
-class IFSelect_ListEditor;
-class IFSelect_ContextModif;
-class IFSelect_ContextWrite;
-class IFSelect_Transformer;
-class IFSelect_TransformStandard;
-class IFSelect_ModelCopier;
-class IFSelect_GeneralModifier;
-class IFSelect_Modifier;
-class IFSelect_ModifReorder;
-class IFSelect_ModifEditForm;
-class IFSelect_FileModifier;
-class IFSelect_ModelModifier;
-class IFSelect_WorkSession;
-class IFSelect_WorkLibrary;
-class IFSelect_SessionFile;
-class IFSelect_SessionDumper;
-class IFSelect_BasicDumper;
-class IFSelect_Activator;
-class IFSelect_SessionPilot;
-class IFSelect_Act;
-class IFSelect_Functions;
-
-
-//! 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);
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-friend class IFSelect_Signature;
-friend class IFSelect_SignMultiple;
-friend class IFSelect_SignType;
-friend class IFSelect_SignCategory;
-friend class IFSelect_SignValidity;
-friend class IFSelect_SignAncestor;
-friend class IFSelect_ShareOut;
-friend class IFSelect_AppliedModifiers;
-friend class IFSelect_ShareOutResult;
-friend class IFSelect_PacketList;
-friend class IFSelect_Dispatch;
-friend class IFSelect_DispGlobal;
-friend class IFSelect_DispPerOne;
-friend class IFSelect_DispPerCount;
-friend class IFSelect_DispPerSignature;
-friend class IFSelect_DispPerFiles;
-friend class IFSelect_SelectionIterator;
-friend class IFSelect_Selection;
-friend class IFSelect_SelectBase;
-friend class IFSelect_SelectModelRoots;
-friend class IFSelect_SelectModelEntities;
-friend class IFSelect_SelectEntityNumber;
-friend class IFSelect_SelectPointed;
-friend class IFSelect_SelectCombine;
-friend class IFSelect_SelectUnion;
-friend class IFSelect_SelectIntersection;
-friend class IFSelect_SelectControl;
-friend class IFSelect_SelectDiff;
-friend class IFSelect_SelectDeduct;
-friend class IFSelect_SelectShared;
-friend class IFSelect_SelectSharing;
-friend class IFSelect_SelectAnyList;
-friend class IFSelect_SelectInList;
-friend class IFSelect_SelectSuite;
-friend class IFSelect_SelectExtract;
-friend class IFSelect_SelectUnknownEntities;
-friend class IFSelect_SelectErrorEntities;
-friend class IFSelect_SelectIncorrectEntities;
-friend class IFSelect_SelectRoots;
-friend class IFSelect_SelectRootComps;
-friend class IFSelect_SelectRange;
-friend class IFSelect_SelectAnyType;
-friend class IFSelect_SelectType;
-friend class IFSelect_SelectSignature;
-friend class IFSelect_SelectFlag;
-friend class IFSelect_SelectSent;
-friend class IFSelect_SelectExplore;
-friend class IFSelect_SelectSignedShared;
-friend class IFSelect_SelectSignedSharing;
-friend class IFSelect_IntParam;
-friend class IFSelect_SignatureList;
-friend class IFSelect_CheckCounter;
-friend class IFSelect_SignCounter;
-friend class IFSelect_GraphCounter;
-friend class IFSelect_Editor;
-friend class IFSelect_ParamEditor;
-friend class IFSelect_EditForm;
-friend class IFSelect_ListEditor;
-friend class IFSelect_ContextModif;
-friend class IFSelect_ContextWrite;
-friend class IFSelect_Transformer;
-friend class IFSelect_TransformStandard;
-friend class IFSelect_ModelCopier;
-friend class IFSelect_GeneralModifier;
-friend class IFSelect_Modifier;
-friend class IFSelect_ModifReorder;
-friend class IFSelect_ModifEditForm;
-friend class IFSelect_FileModifier;
-friend class IFSelect_ModelModifier;
-friend class IFSelect_WorkSession;
-friend class IFSelect_WorkLibrary;
-friend class IFSelect_SessionFile;
-friend class IFSelect_SessionDumper;
-friend class IFSelect_BasicDumper;
-friend class IFSelect_Activator;
-friend class IFSelect_SessionPilot;
-friend class IFSelect_Act;
-friend class IFSelect_Functions;
-
-};
-
-
-
-
-
-
-
-#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_Act.hxx>
-#include <IFSelect_SessionPilot.hxx>
-#include <Standard_DomainError.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Act,IFSelect_Activator)
-
-static TCollection_AsciiString thedefgr, thedefil;
-
-
-
- IFSelect_Act::IFSelect_Act
- (const Standard_CString name, const Standard_CString help,
- const IFSelect_ActFunc func)
- : thename (name) , thehelp (help) , thefunc (func) { }
-
- IFSelect_ReturnStatus IFSelect_Act::Do
- (const Standard_Integer, const Handle(IFSelect_SessionPilot)& pilot)
-{
- if (!thefunc) return IFSelect_RetVoid;
- return thefunc (pilot);
-}
-
- Standard_CString IFSelect_Act::Help (const Standard_Integer) const
- { return thehelp.ToCString(); }
-
-
- void IFSelect_Act::SetGroup
- (const Standard_CString group, const Standard_CString file)
-{ thedefgr.Clear(); if (group[0] != '\0') thedefgr.AssignCat(group);
- thedefil.Clear(); if (file [0] != '\0') thedefil.AssignCat(file); }
-
- void IFSelect_Act::AddFunc
- (const Standard_CString name, const Standard_CString help,
- const IFSelect_ActFunc func)
-{
- Handle(IFSelect_Act) act = new IFSelect_Act (name,help,func);
- if (thedefgr.Length() > 0) act->SetForGroup (thedefgr.ToCString());
- act->Add (1,name);
-}
-
- void IFSelect_Act::AddFSet
- (const Standard_CString name, const Standard_CString help,
- const IFSelect_ActFunc func)
-{
- Handle(IFSelect_Act) act = new IFSelect_Act (name,help,func);
- if (thedefgr.Length() > 0)
- act->SetForGroup (thedefgr.ToCString(),thedefil.ToCString());
- act->AddSet (1,name);
-}
+++ /dev/null
-// Created on: 1996-03-05
-// 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_Act_HeaderFile
-#define _IFSelect_Act_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <IFSelect_ActFunc.hxx>
-#include <IFSelect_Activator.hxx>
-#include <Standard_CString.hxx>
-#include <IFSelect_ReturnStatus.hxx>
-#include <Standard_Integer.hxx>
-class Standard_DomainError;
-class IFSelect_SessionPilot;
-
-
-class IFSelect_Act;
-DEFINE_STANDARD_HANDLE(IFSelect_Act, IFSelect_Activator)
-
-//! Act gives a simple way to define and add functions to be ran
-//! from a SessionPilot, as follows :
-//!
-//! Define a function as
-//! static IFSelect_RetStatus myfunc
-//! (const Standard_CString name,
-//! const Handle(IFSelect_SessionPilot)& pilot)
-//! { ... }
-//! When ran, it receives the exact name (string) of the called
-//! function, and the SessionPilot which brings other infos
-//!
-//! Add it by
-//! IFSelect_Act::AddFunc (name,help,myfunc);
-//! for a normal function, or
-//! IFSelect_Act::AddFSet (name,help,myfunc);
-//! for a function which is intended to create a control item
-//! name and help are given as CString
-//!
-//! Then, it is available for run
-class IFSelect_Act : public IFSelect_Activator
-{
-
-public:
-
-
- //! Creates an Act with a name, help and a function
- //! mode (Add or AddSet) is given when recording
- Standard_EXPORT IFSelect_Act(const Standard_CString name, const Standard_CString help, const IFSelect_ActFunc func);
-
- //! Execution of Command Line. remark that <number> is senseless
- //! because each Act brings one and only one function
- Standard_EXPORT IFSelect_ReturnStatus Do (const Standard_Integer number, const Handle(IFSelect_SessionPilot)& pilot) Standard_OVERRIDE;
-
- //! Short Help for commands : returns the help given to create
- Standard_EXPORT Standard_CString Help (const Standard_Integer number) const Standard_OVERRIDE;
-
- //! Changes the default group name for the following Acts
- //! group empty means to come back to default from Activator
- //! Also a file name can be precised (to query by getsource)
- Standard_EXPORT static void SetGroup (const Standard_CString group, const Standard_CString file = "");
-
- //! Adds a function with its name and help : creates an Act then
- //! records it as normal function
- Standard_EXPORT static void AddFunc (const Standard_CString name, const Standard_CString help, const IFSelect_ActFunc func);
-
- //! Adds a function with its name and help : creates an Act then
- //! records it as function for XSET (i.e. to create control item)
- Standard_EXPORT static void AddFSet (const Standard_CString name, const Standard_CString help, const IFSelect_ActFunc func);
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IFSelect_Act,IFSelect_Activator)
-
-protected:
-
-
-
-
-private:
-
-
- TCollection_AsciiString thename;
- TCollection_AsciiString thehelp;
- IFSelect_ActFunc thefunc;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_Act_HeaderFile
+++ /dev/null
-// Created on: 2000-02-29
-// Created by: data exchange team
-// Copyright (c) 2000-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _IFSelect_ActFunc_HeaderFile
-#define _IFSelect_ActFunc_HeaderFile
-
-#include <IFSelect_SessionPilot.hxx>
-#include <IFSelect_ReturnStatus.hxx>
-
-typedef IFSelect_ReturnStatus (*IFSelect_ActFunc) (const Handle(IFSelect_SessionPilot)&);
-
-#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_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.
-
-//#58 rln 28.12.98 Versioning
-
-#include <IFSelect_Act.hxx>
-#include <IFSelect_CheckCounter.hxx>
-#include <IFSelect_Dispatch.hxx>
-#include <IFSelect_DispGlobal.hxx>
-#include <IFSelect_DispPerCount.hxx>
-#include <IFSelect_DispPerFiles.hxx>
-#include <IFSelect_DispPerOne.hxx>
-#include <IFSelect_DispPerSignature.hxx>
-#include <IFSelect_EditForm.hxx>
-#include <IFSelect_Editor.hxx>
-#include <IFSelect_Functions.hxx>
-#include <IFSelect_GeneralModifier.hxx>
-#include <IFSelect_GraphCounter.hxx>
-#include <IFSelect_IntParam.hxx>
-#include <IFSelect_ListEditor.hxx>
-#include <IFSelect_Modifier.hxx>
-#include <IFSelect_ModifReorder.hxx>
-#include <IFSelect_SelectDeduct.hxx>
-#include <IFSelect_SelectDiff.hxx>
-#include <IFSelect_SelectEntityNumber.hxx>
-#include <IFSelect_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_SessionPilot.hxx>
-#include <IFSelect_ShareOut.hxx>
-#include <IFSelect_Signature.hxx>
-#include <IFSelect_SignatureList.hxx>
-#include <IFSelect_SignCounter.hxx>
-#include <IFSelect_SignType.hxx>
-#include <IFSelect_Transformer.hxx>
-#include <IFSelect_WorkLibrary.hxx>
-#include <IFSelect_WorkSession.hxx>
-#include <Interface_Category.hxx>
-#include <Interface_CheckIterator.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <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 <TColStd_MapOfInteger.hxx>
-
-#include <stdio.h>
-// Decomposition of a file name in its parts : prefix, root, suffix
-static void SplitFileName
- (const Standard_CString filename,
- TCollection_AsciiString& prefix,
- TCollection_AsciiString& fileroot,
- TCollection_AsciiString& suffix)
-{
- Standard_Integer nomdeb, nomfin, nomlon;
- TCollection_AsciiString resfile (filename);
- nomlon = resfile.Length();
- nomdeb = resfile.SearchFromEnd ("/");
- if (nomdeb <= 0) nomdeb = resfile.SearchFromEnd("\\"); // pour NT
- if (nomdeb < 0) nomdeb = 0;
- nomfin = resfile.SearchFromEnd (".");
- if (nomfin < nomdeb) nomfin = nomlon + 1;
-
- if (nomdeb > 0) prefix = resfile.SubString (1,nomdeb);
- fileroot = resfile.SubString(nomdeb+1,nomfin-1);
- if (nomfin <= nomlon) suffix = resfile.SubString (nomfin,nomlon);
-}
-
-
-
-// Functions definit un certain nombre de commandes
-// enregistrees dans le Dictionnaire de Activator (par des Act unitaires)
-// Les actions elles-memes sont regroupees en fin de fichier
-
-// Les definitions
-
-static IFSelect_ReturnStatus funstatus
- (const Handle(IFSelect_SessionPilot)& )
-{
-// **** Version & cie ****
- //#58 rln
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- sout<<"Processor Version : "<<XSTEP_PROCESSOR_VERSION<<endl;
- sout<<"OL Version : "<<XSTEP_SYSTEM_VERSION<<endl;
- sout<<"Configuration : "<<XSTEP_Config<<endl;
- sout<<"UL Names : "<<XSTEP_ULNames<<endl;
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun1
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** ToggleHandler ****
- Standard_Boolean hand = !WS->ErrorHandle();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (hand) sout << " -- Mode Catch Error now Active" <<endl;
- else sout << " -- Mode Catch Error now Inactive" <<endl;
- WS->SetErrorHandle(hand);
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun3
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** XRead / Load ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Read/Load : give file name !"<<endl; return IFSelect_RetError; }
- if (WS->Protocol().IsNull()) { sout<<"Protocol not defined"<<endl; return IFSelect_RetError; }
- if (WS->WorkLibrary().IsNull()) { sout<<"WorkLibrary not defined"<<endl; return IFSelect_RetError; }
-
- 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 : sout<<"file:"<<arg1<<" gives empty result"<<endl; break;
- case IFSelect_RetError : sout<<"file:"<<arg1<<" could not be opened"<<endl; break;
- case IFSelect_RetDone : sout<<"file:"<<arg1<<" read"<<endl; break;
- case IFSelect_RetFail : sout<<"file:"<<arg1<<" : error while reading"<<endl; break;
- case IFSelect_RetStop : sout<<"file:"<<arg1<<" : EXCEPTION while reading"<<endl; break;
- default : sout<<"file:"<<arg1<<" could not be read"<<endl; break;
- }
- if (status != IFSelect_RetDone) return status;
-// sout<<" - clearing list of already written files"<<endl;
- WS->BeginSentFiles(Standard_True);
- return status;
-}
-
-static IFSelect_ReturnStatus fun4
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Write All ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Write All : give file name !"<<endl; return IFSelect_RetError; }
- return WS->SendAll (arg1);
-}
-
-static IFSelect_ReturnStatus fun5
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// const Standard_CString arg2 = pilot->Arg(2);
-// **** Write Selected ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"Write Selected : give file name + givelist !"<<endl; return IFSelect_RetError; }
- Handle(TColStd_HSequenceOfTransient) result =
- IFSelect_Functions::GiveList (WS,pilot->CommandPart( 2));
- if (result.IsNull()) { sout<<"No entity selected"<<endl; return IFSelect_RetError; }
- else sout<<"Nb Entities selected : "<<result->Length()<<endl;
- Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
- sp->SetList (result);
- return WS->SendSelected (arg1,sp);
-}
-
-static IFSelect_ReturnStatus fun6
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Write Entite(s) ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"Write Entitie(s) : give file name + n0s entitie(s)!"<<endl; return IFSelect_RetError; }
- int ko = 0;
- Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
- for (Standard_Integer ia = 2; ia < argc ; ia ++) {
- Standard_Integer id = pilot->Number(pilot->Arg(ia));
- if (id > 0) {
- Handle(Standard_Transient) item = WS->StartingEntity(id);
- if (sp->Add(item)) sout<<"Added:no."<<id<<endl;
- else { sout<<" Fail Add n0."<<id<<endl; ko ++; }
- }
- else { sout<<"Not an entity number:"<<pilot->Arg(ia)<<endl; ko ++; }
- }
- if (ko > 0) { sout<<ko<<" bad arguments, abandon"<<endl; return IFSelect_RetError; }
- return WS->SendSelected (arg1,sp);
-}
-
-static IFSelect_ReturnStatus fun7
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Entity Label ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give entity number"<<endl; return IFSelect_RetError; }
- if (!WS->HasModel()) { sout<<"No loaded model, abandon"<<endl; return IFSelect_RetError; }
- Standard_Integer nument = WS->NumberFromLabel (arg1);
- if (nument <= 0 || nument > WS->NbStartingEntities())
- { sout<<"Not a suitable number: "<<arg1<<endl; return IFSelect_RetError; }
- sout<<"N0."<<nument<<" ->Label in Model : ";
- WS->Model()->PrintLabel(WS->StartingEntity(nument),sout);
- sout<<endl;
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun8
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Entity Number ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give label to search"<<endl; return IFSelect_RetError; }
- if (!WS->HasModel()) { sout<<"No loaded model, abandon"<<endl; return IFSelect_RetError; }
- const Handle(Interface_InterfaceModel) &model = WS->Model();
- Standard_Integer i, cnt = 0;
- Standard_Boolean exact = Standard_False;
- sout<<" ** Search Entity Number for Label : "<<arg1<<endl;
- for (i = model->NextNumberForLabel (arg1, 0, exact) ; i != 0;
- i = model->NextNumberForLabel (arg1, i, exact)) {
- cnt ++;
- sout<<" ** Found n0/id:"; model->Print (model->Value(i),sout); sout<<endl;
- }
-
- if (cnt == 0) sout<<" ** No Match"<<endl;
- else if (cnt == 1) sout<<" ** 1 Match"<<endl;
- else sout<<cnt<<" Matches"<<endl;
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun9
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
-// **** List Types ****
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Handle(IFSelect_Signature) signtype = WS->SignType();
- if (signtype.IsNull()) signtype = new IFSelect_SignType;
- Handle(IFSelect_SignCounter) counter =
- new IFSelect_SignCounter(signtype,Standard_False);
- return pilot->ExecuteCounter (counter,1);
-}
-
-static IFSelect_ReturnStatus funcount
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg0 = pilot->Arg(0);
- const Standard_CString arg1 = pilot->Arg(1);
- Standard_Boolean listmode = (arg0[0] == 'l');
-// **** List Counter ****
-
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) {
- sout<<"Designer signature ou compteur, + facultatif selection + facultatif entite"<<endl;
- sout<<" signature/compteur seul -> tout le modele"<<endl
- << " sign/compteur + selection -> cette selection, evaluation normale"<<endl
- <<" sign/compteur + sel + num -> cette selection evaluee sur entite n0 num"<<endl;
- return IFSelect_RetError;
- }
- DeclareAndCast(IFSelect_SignCounter,counter,WS->NamedItem(arg1));
- if (counter.IsNull()) {
- DeclareAndCast(IFSelect_Signature,signa,WS->NamedItem(arg1));
- if (!signa.IsNull()) counter = new IFSelect_SignCounter(signa,Standard_False,listmode);
- }
-// Handle(IFSelect_Selection) sel;
-// Standard_Integer n3 = 0; if (argc > 3) n3 = WS->NumberFromLabel(arg3);
-// if (argc > 2) sel = GetCasted(IFSelect_Selection,WS->NamedItem(arg2));
-// if (counter.IsNull() || (argc > 2 && n3 <= 0 && sel.IsNull()) ) {
-// sout<<"Nom:"<<arg1; if (argc > 2) sout<<" et/ou "<<arg2;
-// sout<<" incorrect (demande: compteur ou signature [selection])"<<endl;
-// return IFSelect_RetError;
-// }
-
-// Ajout : si Selection, on applique un GraphCounter
-// Et en ce cas, on peut en avoir plusieurs : la limite est le mot-cle "on"
- Standard_Integer onflag = 0;
- Standard_Integer i; // svv Jan11 2000 : porting on DEC
- for (i = 2; i < argc; i ++) {
- if (!strcmp (pilot->Arg(i),"on")) { onflag = i; break; }
- }
-
- Handle(IFSelect_Selection) sel = WS->GiveSelection(arg1);
- DeclareAndCast(IFSelect_SelectDeduct,seld,sel);
- if (!seld.IsNull()) {
-// Si onflag, faire une SelectSuite
- if (onflag > 2) {
- Handle(IFSelect_SelectSuite) suite = new IFSelect_SelectSuite;
- for (i = 1; i < onflag; i ++) {
- sel = WS->GiveSelection(pilot->Arg(i));
- if (!suite->AddInput(sel)) {
- sout<<"Incorrect definition for applied selection"<<endl;
- return IFSelect_RetError;
- }
- }
- seld = suite;
- }
-
- Handle(IFSelect_GraphCounter) gc = new IFSelect_GraphCounter(Standard_False,listmode);
- gc->SetApplied (seld);
- counter = gc;
- }
-
- if (counter.IsNull()) {
- sout<<"Neither Counter nor Signature : "<<arg1<<endl;
- return IFSelect_RetError;
- }
-
- if (onflag == 0) onflag = 1;
- IFSelect_PrintCount pcm = IFSelect_ListByItem;
- if (arg0[0] == 'c') pcm = IFSelect_CountByItem;
- if (arg0[0] == 's') pcm = IFSelect_CountSummary;
- return pilot->ExecuteCounter (counter,onflag+1, pcm);
-}
-
-static IFSelect_ReturnStatus funsigntype
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Sign Type ****
- Handle(IFSelect_Signature) signtype = WS->SignType();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (signtype.IsNull()) sout<<"signtype actually undefined"<<endl;
- else {
- Handle(TCollection_HAsciiString) str = WS->Name (signtype);
- Standard_Integer id = WS->ItemIdent (signtype);
- sout<<signtype->Label()<<endl;
- if (str.IsNull()) {
- if (id > 0) sout<<"signtype : item n0 "<<id<<endl;
- } else {
- sout<<"signtype : also named as "<<str->ToCString()<<endl;
- }
- }
- if (argc < 2) sout<<"signtype newitem to change, signtype . to clear"<<endl;
- else {
- if (arg1[0] == '.' && arg1[1] == '\0') {
- signtype.Nullify();
- sout<<"signtype now cleared"<<endl;
- } else {
- signtype = GetCasted(IFSelect_Signature,WS->NamedItem(arg1));
- if (signtype.IsNull()) { sout<<"Not a Signature : "<<arg1<<endl; return IFSelect_RetError; }
- else sout<<"signtype now set to "<<arg1<<endl;
- }
- WS->SetSignType(signtype);
- return IFSelect_RetDone;
- }
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus funsigncase
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Sign Case ****
- Handle(IFSelect_Signature) signcase = GetCasted(IFSelect_Signature,WS->NamedItem(arg1));
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (signcase.IsNull()) sout<<"Not a Signature : "<<arg1<<endl;
- else {
- Standard_Boolean hasmin,hasmax; Standard_Integer valmin,valmax;
- if (signcase->IsIntCase(hasmin,valmin,hasmax,valmax)) {
- sout<<"Signature "<<arg1<<" : Integer Case";
- if (hasmin) sout<<" - Mini:"<<valmin;
- if (hasmax) sout<<" - Maxi:"<<valmax;
- sout<<endl;
- }
- Handle(TColStd_HSequenceOfAsciiString) caselist = signcase->CaseList();
- if (caselist.IsNull()) sout<<"Signature "<<arg1<<" : no predefined case, see command count "<<arg1<<endl;
- else {
- Standard_Integer i, nb = caselist->Length();
- sout<<"Signature "<<arg1<<" : "<<nb<<" basic cases :"<<endl;
- for (i = 1; i <= nb; i ++) sout<<" "<<caselist->Value(i);
- sout<<endl;
- }
- }
- return IFSelect_RetVoid;
-}
-
-
-static IFSelect_ReturnStatus fun10
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Entity Status ****
- Standard_Integer i,nb;
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) {
- nb = Interface_Category::NbCategories();
- sout<<" Categories defined :"<<nb<<" i.e. :\n";
- for (i = 0; i <= nb; i ++)
- sout<<"Cat."<<i<<" : "<<Interface_Category::Name(i)<<"\n";
- sout<<" On a given entity : give its number"<<endl;
- return IFSelect_RetVoid;
- }
- Standard_Integer num = pilot->Number(arg1);
- if (num <= 0 || num > WS->NbStartingEntities())
- { sout<<"Not a suitable entity number : "<<arg1<<endl; return IFSelect_RetError; }
- Handle(Standard_Transient) ent = WS->StartingEntity(num);
- WS->PrintEntityStatus(ent,sout);
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun11
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** DumpModel (Data) ****
- Standard_Integer niv = 0;
-// char arg10 = arg1[0];
-// if (argc < 2) arg10 = '?';
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- switch (arg1[0]) {
- case '?' :
- sout<<"? 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)"<<endl;
- return IFSelect_RetVoid;
- 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 : sout<<"Unknown Mode . data tout court pour help"<<endl; return IFSelect_RetError;
- }
- WS->TraceDumpModel(niv);
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fundumpent
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- Handle(IFSelect_WorkLibrary) WL = WS->WorkLibrary();
- Standard_Integer levdef=0,levmax=10,level;
- WL->DumpLevels (levdef,levmax);
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2 || (argc == 2 && levmax < 0)) {
- sout<<"Give n0 or id of entity";
- if (levmax < 0) sout<<" and dump level"<<endl;
- else sout<<" + optinal, dump level in [0 - "<<levmax<<"] , default = "<<levdef<<endl;
- for (level = 0; level <= levmax; level ++) {
- Standard_CString help = WL->DumpHelp (level);
- if (help[0] != '\0') sout<<level<<" : "<<help<<endl;
- }
- return IFSelect_RetError;
- }
-
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
- Standard_Integer num = pilot->Number(arg1);
- if (num == 0) return IFSelect_RetError;
- level = levdef;
- if (argc > 2) level = atoi(arg2);
- Handle(Standard_Transient) ent = WS->StartingEntity(num);
- if ( ent.IsNull() ) {
- sout << "No entity with given id " << arg1 << " (" << num << ") is found in the current model" << endl;
- }
- else {
- sout << " -- DUMP Entity n0 " << num << " level " << level << endl;
- WL->DumpEntity (WS->Model(),WS->Protocol(),ent,sout,level);
-
- Interface_CheckIterator chl = WS->CheckOne (ent);
- if (!chl.IsEmpty(Standard_False)) chl.Print(sout,WS->Model(),Standard_False);
- }
-// sout << flush;
-
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus funsign
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<" Give signature name + n0 or id of entity"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_Signature,sign,WS->NamedItem(arg1));
- if (sign.IsNull()) { sout<<"Not a signature : "<<arg1<<endl; return IFSelect_RetError; }
- Standard_Integer num = pilot->Number(arg2);
- Handle(Standard_Transient) ent = WS->StartingEntity (num);
- if (num == 0) return IFSelect_RetError;
- sout<<"Entity n0 "<<num<<" : "<<WS->SignValue(sign,ent)<<endl;
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus funqp
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<" Give 2 numeros or labels : dad son"<<endl; return IFSelect_RetError; }
- Standard_Integer n1 = WS->NumberFromLabel(arg1);
- Standard_Integer n2 = WS->NumberFromLabel(arg2);
- sout<<"QueryParent for dad:"<<arg1<<":"<<n1<<" and son:"<<arg2<<":"<<n2<<endl;
- Standard_Integer qp = WS->QueryParent(WS->StartingEntity(n1),WS->StartingEntity(n2));
- if (qp < 0) sout<<arg1<<" is not super-entity of "<<arg2<<endl;
- else if (qp == 0) sout<<arg1<<" is same as "<<arg2<<endl;
- else sout<<arg1<<" is super-entity of "<<arg2<<" , max level found="<<qp<<endl;
-// sout<<" Trouve "<<qp<<endl;
- return IFSelect_RetVoid;
-}
-
-
-static IFSelect_ReturnStatus fun12
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** DumpShare ****
- WS->DumpShare(); return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun13
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** ListItems ****
- WS->ListItems(pilot->Arg(1)); return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun14
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** NewInt ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 1) { sout<<"Donner la valeur entiere pour IntParam"<<endl; return IFSelect_RetError; }
- Handle(IFSelect_IntParam) intpar = new IFSelect_IntParam;
- if (argc >= 1) intpar->SetValue(atoi(arg1));
- return pilot->RecordItem (intpar);
-}
-
-static IFSelect_ReturnStatus fun15
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
-// **** SetInt ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3)
- { sout<<"Donner 2 arguments : nom Parametre et Valeur"<<endl; return IFSelect_RetError; }
- Standard_Integer val = atoi(arg2);
- DeclareAndCast(IFSelect_IntParam,par,WS->NamedItem(arg1));
- if (!WS->SetIntValue(par,val)) return IFSelect_RetFail;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun16
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** NewText ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 1) { sout<<"Donner la valeur texte pour TextParam"<<endl; return IFSelect_RetError; }
- Handle(TCollection_HAsciiString) textpar = new TCollection_HAsciiString();
- if (argc >= 1) textpar->AssignCat(arg1);
- return pilot->RecordItem (textpar);
-}
-
-static IFSelect_ReturnStatus fun17
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
-// **** SetText ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3)
- { sout<<"Donner 2 arguments : nom Parametre et Valeur"<<endl; return IFSelect_RetError; }
- DeclareAndCast(TCollection_HAsciiString,par,WS->NamedItem(arg1));
- if (!WS->SetTextValue(par,arg2)) return IFSelect_RetFail;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun19
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** DumpSel ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give 1 argument : Selection Name"<<endl; return IFSelect_RetError; }
- WS->DumpSelection (GetCasted(IFSelect_Selection,WS->NamedItem(arg1)));
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun20
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
-// **** EvalSel ****
-// **** GiveList ****
-// **** GiveShort GivePointed ****
-// **** MakeList ****
- char mode = pilot->Arg(0)[0]; // givelist/makelist
- if (mode == 'g') mode = pilot->Arg(0)[4]; // l list s short p pointed
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give Entity ID, or Selection Name [+ optional other selection or entity]"<<endl; return IFSelect_RetError; }
-
-// MakeList : sur Pointed existante ou a creer
- Handle(IFSelect_SelectPointed) pnt;
- if (mode == 'm') {
- const Standard_CString arg1 = pilot->Arg(1);
- Handle(Standard_Transient) item = WS->NamedItem (arg1);
- pnt = GetCasted(IFSelect_SelectPointed,item);
- if (!pnt.IsNull()) {
- sout<<arg1<<":Already existing Selection for List, cleared then filled"<<endl;
- pnt->Clear();
- } else if (!item.IsNull()) {
- sout<<arg1<<":Already existing Item not for a List, command ignored"<<endl;
- return IFSelect_RetFail;
- } else {
- pnt = new IFSelect_SelectPointed;
- WS->AddNamedItem (arg1,pnt);
- }
- }
-
- Handle(TColStd_HSequenceOfTransient) result =
- IFSelect_Functions::GiveList (WS,pilot->CommandPart( (mode == 'm' ? 2 : 1) ));
- if (result.IsNull()) return IFSelect_RetError;
- Interface_EntityIterator iter (result);
- sout<<pilot->CommandPart( (mode == 'm' ? 2 : 1) )<<" : ";
- if (mode == 'l') WS->ListEntities (iter,0);
- else if (mode == 's' || mode == 'm') WS->ListEntities (iter,2);
- else if (mode == 'p') {
- sout<<iter.NbEntities()<<" Entities : ";
- for (iter.Start(); iter.More(); iter.Next())
- sout<<" +"<<WS->StartingNumber (iter.Value());
- sout<<endl;
- }
-
- if (!pnt.IsNull()) {
- pnt->SetList (result);
- sout<<"List set to a SelectPointed : "<<pilot->Arg(1)<<endl;
- sout<<"Later editable by command setlist"<<endl;
- }
-
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun20c
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
-// **** GiveCount ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give Entity ID, or Selection Name [+ optional other selection or entity]"<<endl; return IFSelect_RetError; }
-// WS->EvaluateSelection(GetCasted(IFSelect_Selection,WS->NamedItem(arg1)));
- Handle(TColStd_HSequenceOfTransient) result =
- IFSelect_Functions::GiveList (WS,pilot->CommandPart(1));
- if (result.IsNull()) return IFSelect_RetError;
- sout<<pilot->CommandPart(1)<<" : List of "<<result->Length()<<" Entities"<<endl;
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus funselsuite
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
-// **** SelSuite ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give Entity ID, or Selection Name [+ optional other selection or entity]"<<endl; return IFSelect_RetError; }
-// WS->EvaluateSelection(GetCasted(IFSelect_Selection,WS->NamedItem(arg1)));
- Handle(IFSelect_SelectSuite) selsuite = new IFSelect_SelectSuite;
-
- for (Standard_Integer i = 1; i < argc; i ++) {
- Handle(IFSelect_Selection) sel = WS->GiveSelection(pilot->Arg(i));
- if (!selsuite->AddInput(sel)) {
- sout<<pilot->Arg(i-1)<<" : not a SelectDeduct, no more can be added. Abandon"<<endl;
- return IFSelect_RetError;
- }
- }
- selsuite->SetLabel (pilot->CommandPart(1));
- return pilot->RecordItem (selsuite);
-}
-
-
-static IFSelect_ReturnStatus fun21
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** ClearItems ****
- WS->ClearItems(); WS->ClearFinalModifiers(); WS->ClearShareOut(Standard_False);
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun22
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** ClearData ****
- Standard_Integer mode = -1;
- if (argc >= 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;
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (mode <= 0) {
- if (mode < 0) sout<<"Give a suitable mode";
- sout<<" Available Modes :\n"
- <<" a : all data g : graph+check c : check p : selectpointed"<<endl;
- return (mode < 0 ? IFSelect_RetError : IFSelect_RetVoid);
- }
- WS->ClearData (mode);
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun24
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
-// **** Item Label ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- TCollection_AsciiString label;
- if (argc < 2) { sout<<" Give label to search"<<endl; return IFSelect_RetError; }
- for (int i = 1; i < argc; i ++) {
- label.AssignCat(pilot->Arg(i));
- if (i < argc-1) label.AssignCat(" ");
- }
- for (int mode = 0; mode <= 2; mode ++) {
- int nbitems = 0; int id;
- sout<<"Searching label : "<<label<<". in mode ";
- if (mode == 0) sout <<" exact" << endl;
- if (mode == 1) sout <<" same head" << endl;
- if (mode == 2) sout <<" search if present" << endl;
- for (id = WS->NextIdentForLabel(label.ToCString(), 0,mode) ; id != 0;
- id = WS->NextIdentForLabel(label.ToCString(),id,mode)) {
- sout<<" "<<id; nbitems ++;
- }
- sout<<" -- giving " << nbitems << " found" << endl;
- }
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun25
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Save (Dump) ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner nom du Fichier"<<endl; return IFSelect_RetError; }
- IFSelect_SessionFile dumper(WS,arg1);
- if (!dumper.IsDone()) return IFSelect_RetFail;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun26
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Restore (Dump) ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner nom du Fichier"<<endl; return IFSelect_RetError; }
- IFSelect_SessionFile dumper(WS);
- Standard_Integer readstat = dumper.Read(arg1);
- if (readstat == 0) return IFSelect_RetDone;
- else if (readstat > 0) sout << "-- Erreur Lecture Fichier "<<arg1<<endl;
- else sout << "-- Pas pu ouvrir Fichier "<<arg1<<endl;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun27
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
-// **** Param(Value) ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) {
- Handle(TColStd_HSequenceOfHAsciiString) li = Interface_Static::Items();
- Standard_Integer i,nb = li->Length();
- sout<<" List of parameters : "<<nb<<" items : "<<endl;
- for (i = 1; i <= nb; i ++) {
- sout<<li->Value(i);
- sout<<" : "<<Interface_Static::CVal(li->Value(i)->ToCString())<<endl;
- }
- return IFSelect_RetVoid;
- } else if (atoi(arg1) > 0) {
- Standard_Integer use = atoi (arg1);
- WS->TraceStatics (use);
- } else {
- if (argc > 2) sout<<" FORMER STATUS of Static Parameter "<<arg1<<endl;
- else sout<<" ACTUAL STATUS of Static Parameter "<<arg1<<endl;
- if (!Interface_Static::IsPresent(arg1)) { sout<<" Parameter "<<arg1<<" undefined"<<endl; return IFSelect_RetError; }
- if (!Interface_Static::IsSet(arg1)) sout<<" Parameter "<<arg1<<" not valued"<<endl;
- else if (argc == 2) Interface_Static::Static (arg1) -> Print(sout);
- else sout<<" Value : "<<Interface_Static::CVal(arg1)<<endl;
-
- if (argc == 2) sout<<"To modify, param name_param new_val"<<endl;
- else {
- sout<<" New demanded value : "<<arg2;
- if (Interface_Static::SetCVal (arg1,arg2))
- { sout<<" OK"<<endl; return IFSelect_RetDone; }
- else { sout <<" , refused"<<endl; return IFSelect_RetError; }
- }
- }
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun28
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
- const Standard_CString arg3 = pilot->Arg(3);
-// **** DefParam ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) {
- Handle(TColStd_HSequenceOfHAsciiString) li = Interface_Static::Items();
- Standard_Integer i,nb = li->Length();
- sout<<" List of parameters : "<<nb<<" items :"<<endl;
- for (i = 1; i <= nb; i ++) sout<<" "<<li->Value(i)->ToCString();
- sout<<endl<<" defparam name_param to known more about one"<<endl;
- sout<<" defparam nom_param e options to edit a definition"<<endl;
-
- } else if (argc == 2) {
- sout<<" Definition of Parameter : "<<arg1<<endl;
- Handle(Interface_Static) unst = Interface_Static::Static (arg1);
- if (unst.IsNull()) sout<<" undefined"<<endl;
- else unst->Print(sout);
- return IFSelect_RetVoid;
-
- } else if (arg2[0] == 'i') {
-// initialisation : arg1=nompar a2='i' a3=family a4=type [a5=val]
- if (argc < 5) { sout<<" name init family type [valinit]"<<endl; return IFSelect_RetVoid; }
- char typ = (pilot->Arg(4))[0];
- Standard_Boolean ok= (argc==5 ? Interface_Static::Init(arg3,arg1,typ) :
- Interface_Static::Init(arg3,arg1,typ,pilot->Arg(5)));
- return (ok ? IFSelect_RetDone : IFSelect_RetFail);
-
- } else if (arg2[0] == 'e') {
-// edition : arg1=nompar arg2='e' arg3=option arg4...=parametres option
- char comm[100];
- if (argc < 4) {
- sout<<" give name and options ! Options (according type), 1 a time\n"
- <<" imin ival / imax ival / rmin rval / rmax rval /\n"
- <<" enum stnum / enum stnum match / eval e1 e2 e3 ... (maxi 10)\n"
- <<endl;
- return IFSelect_RetVoid;
- }
- if (argc > 4) sout<<"Only the command and ONE more arg are considered"<<endl;
- sprintf(comm,"%s %s",pilot->Arg(3),pilot->Arg(4));
- sout<<"Editing parameter : "<<arg1<<" , by command : "<<comm<<endl;
-
- Handle(Interface_Static) unst = Interface_Static::Static (arg1);
- if (unst.IsNull()) { sout<<arg1<<" undefined"<<endl; return IFSelect_RetError; }
- if (Interface_Static::Init(unst->Family(),arg1,'&',comm))
- { sout<<"Editing done"<<endl; return IFSelect_RetDone; }
- else { sout<<"Command not processed : "<<comm<<endl; return IFSelect_RetFail; }
- }
- sout<<"Unknown Option : "<<arg2<<endl;
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun29
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** SentFiles ****
- Handle(TColStd_HSequenceOfHAsciiString) list = WS->SentFiles();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (list.IsNull())
- { sout<<"List of Sent Files not enabled"<<endl; return IFSelect_RetVoid; }
- Standard_Integer i, nb = list->Length();
- sout<<" Sent Files : "<<nb<<" : "<<endl;
- for (i = 1; i <= nb; i ++)
- sout<<list->Value(i)->ToCString()<<endl;
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun30
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** FilePrefix ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) {
- if (WS->FilePrefix().IsNull()) sout<<"Pas de prefixe defini"<<endl;
- else sout<<"Prefixe : "<<WS->FilePrefix()->ToCString()<<endl;
- sout<<"Pour changer : filepref newprefix"<<endl;
- return IFSelect_RetVoid;
- }
- WS->SetFilePrefix(arg1);
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun31
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** FileExtension ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) {
- if (WS->FileExtension().IsNull()) sout<<"Pas d extension definie"<<endl;
- else sout<<"Extension : "<<WS->FileExtension()->ToCString()<<endl;
- sout<<"Pour changer : fileext newext"<<endl;
- return IFSelect_RetVoid;
- }
- WS->SetFileExtension(arg1);
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun32
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
-// **** FileRoot ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner Dispatch et nom de Root"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(arg1));
- if (argc < 3) {
- if (WS->FileRoot(disp).IsNull()) sout<<"Pas de racine definie pour "<<arg1<<endl;
- else sout<<"Racine pour "<<arg1<<" : "<<WS->FileRoot(disp)->ToCString()<<endl;
- sout<<"Pour changer : fileroot nomdisp newroot"<<endl;
- return IFSelect_RetVoid;
- }
- if (!WS->SetFileRoot(disp,arg2)) return IFSelect_RetFail;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun33
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Default File Root ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) {
- if (WS->DefaultFileRoot().IsNull()) sout<<"Pas de racine par defaut definie"<<endl;
- else sout<<"Racine par defaut : "<<WS->DefaultFileRoot()->ToCString()<<endl;
- sout<<"Pour changer : filedef newdef"<<endl;
- return IFSelect_RetVoid;
- }
- WS->SetDefaultFileRoot(arg1);
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun34
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** EvalFile ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (!WS->HasModel())
- { sout<<"Pas de Modele charge, abandon"<<endl; return IFSelect_RetFail; }
-
- sout<<"Evaluation avec Memorisation des resultats"<<endl;
- WS->EvaluateFile();
- Standard_Integer nbf = WS->NbFiles();
- for (Standard_Integer i = 1; i <= nbf; i ++) {
- Handle(Interface_InterfaceModel) mod = WS->FileModel(i);
- if (mod.IsNull())
- { sout<<"Modele "<<i<<" Model non genere ..."<<endl; continue; }
- TCollection_AsciiString name = WS->FileName(i);
- sout<<"Fichier n0 "<<i<<" Nb Entites : "<<mod->NbEntities()<<" Nom: ";
- sout<<name<<endl;
- }
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun35
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** ClearFile ****
- WS->ClearFile(); return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun36
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
-// **** Split ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- IFSelect_ReturnStatus stat = IFSelect_RetVoid;
- if (argc < 2) sout<<"Split : derniere liste de dispatches definie"<<endl;
- else {
- WS->ClearShareOut(Standard_True);
- for (Standard_Integer i = 1; i < argc; i ++) {
- DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(pilot->Arg(i)));
- if (disp.IsNull()) {
- sout<<"Pas un dispatch:"<<pilot->Arg(i)<<", Splitt abandonne"<<endl;
- stat = IFSelect_RetError;
- }
- else WS->SetActive(disp,Standard_True);
- }
- }
- if (stat == IFSelect_RetError) return stat;
- WS->BeginSentFiles(Standard_True);
- if (!WS->SendSplit()) return IFSelect_RetFail;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun37
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Remaining Data ****
- char mode = '?'; IFSelect_RemainMode numod = IFSelect_RemainDisplay;
- if (argc >= 2) mode = arg1[0];
- if (mode == 'u') numod = IFSelect_RemainUndo;
- else if (mode == 'l') numod = IFSelect_RemainDisplay;
- else if (mode == 'c') numod = IFSelect_RemainCompute;
- else if (mode == 'f') numod = IFSelect_RemainForget;
- else {
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc<2) sout<<"Donner un Mode - ";
- sout<<"Modes possibles : l list, c compute, u undo, f forget"<<endl;
- if (mode == '?') return IFSelect_RetDone; else return IFSelect_RetError;
- }
- if (!WS->SetRemaining(numod)) return IFSelect_RetVoid;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun38
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
-// **** SetModelContent ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"Donner nom selection et mode (k=keep,r=remove)"<<endl; return IFSelect_RetError; }
- Standard_Boolean keepmode;
- DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1));
- if (sel.IsNull())
- { sout<<"Pas de Selection de Nom : "<<arg1<<endl; return IFSelect_RetError; }
- if (arg2[0] == 'k') { sout<<" -- SetContent keep ..."; keepmode = Standard_True; }
- else if (arg2[0] == 'r') { sout<<" -- SetContent remove ..."; keepmode = Standard_False; }
- else { sout<<"Donner nom selection et mode (k=keep,r=remove)"<<endl; return IFSelect_RetError; }
-
- if (WS->SetModelContent(sel,keepmode)) sout<<" Done"<<endl;
- else sout<<" Result empty, ignored"<<endl;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun40
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** ListModif ****
- WS->ListFinalModifiers(Standard_True);
- WS->ListFinalModifiers(Standard_False); return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun41
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Modifier ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner Nom du Modifier"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_GeneralModifier,modif,WS->NamedItem(arg1));
- if (modif.IsNull())
- { sout<<"Pas de Modifier de Nom : "<<arg1<<endl; return IFSelect_RetVoid; }
- Handle(IFSelect_IntParam) low,up;
-
- Handle(IFSelect_Dispatch) disp = modif->Dispatch();
- sout<<"Modifier : "<<arg1<<" Label : "<<modif->Label()<<endl;
- Standard_Integer rank = WS->ModifierRank(modif);
- if (modif->IsKind(STANDARD_TYPE(IFSelect_Modifier)))
- sout<< "Model Modifier n0." << rank;
- else sout<< "File Modifier n0." << rank;
- if (disp.IsNull()) sout<<" Applique a tous les Dispatchs" << endl;
- else {
- sout << " Dispatch : "<<disp->Label();
- if (WS->HasName(disp)) sout << " - Nom:"<<WS->Name(disp)->ToCString();
- sout<<endl;
- }
-
- Handle(IFSelect_Selection) sel = modif->Selection();
- if (!sel.IsNull()) sout<<" Selection : "<< sel->Label();
- if (WS->HasName(sel)) sout<<" - Nom:"<< WS->Name(sel)->ToCString();
- sout<<endl;
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun42
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
-// **** ModifSel ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner Nom Modifier; + Nom Selection optionnel\n"
- <<"Selection pour Mettre une Selection, sinon Annule"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_GeneralModifier,modif,WS->NamedItem(arg1));
- if (modif.IsNull())
- { sout<<"Pas un nom de Modifier : "<<arg1<<endl; return IFSelect_RetError; }
- Handle(IFSelect_Selection) sel;
- if (arg2[0] != '\0') {
- sel = GetCasted(IFSelect_Selection,WS->NamedItem(arg2));
- if (sel.IsNull())
- { sout<<"Pas un nom de Selection : "<<arg2<<endl; return IFSelect_RetError; }
- }
- if (!WS->SetItemSelection(modif,sel)) return IFSelect_RetFail;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun43
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
-// **** SetAppliedModifier ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner Nom Modifier; + Nom Dispatch ou Transformer optionnel :\n"
- <<" - rien : tous Dispatches\n - Dispatch : ce Dispatch seul\n"
- <<" - Transformer : pas un Dispatch mais un Transformer"<<endl;
- return IFSelect_RetError; }
- DeclareAndCast(IFSelect_GeneralModifier,modif,WS->NamedItem(arg1));
- if (modif.IsNull())
- { sout<<"Pas un nom de Modifier : "<<arg1<<endl; return IFSelect_RetError; }
- Handle(Standard_Transient) item;
- if (arg2[0] != '\0') {
- item = WS->NamedItem(arg2);
- if (item.IsNull())
- { sout<<"Pas un nom connu : "<<arg2<<endl; return IFSelect_RetError; }
- }
- else item = WS->ShareOut();
- if (!WS->SetAppliedModifier(modif,item)) return IFSelect_RetFail;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun44
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** ResetApplied (modifier) ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Designer un modifier"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_GeneralModifier,modif,WS->NamedItem(arg1));
- if (modif.IsNull())
- { sout<<"Pas un nom de Modifier : "<<arg1<<endl; return IFSelect_RetError; }
- if (!WS->ResetAppliedModifier(modif)) return IFSelect_RetFail;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun45
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
- const Standard_CString arg3 = pilot->Arg(3);
-// **** ModifMove ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 4) { sout<<"modifmove MF rang1 rang2, M pour Model F pour File"<<endl; return IFSelect_RetError; }
- Standard_Boolean formodel;
- if (arg1[0] == 'm' || arg1[0] == 'M') formodel = Standard_True;
- else if (arg1[0] == 'f' || arg1[0] == 'F') formodel = Standard_False;
- else { sout<<"preciser M pour Model, F pour File"<<endl; return IFSelect_RetError; }
- Standard_Integer before = atoi(arg2);
- Standard_Integer after = atoi(arg3);
- if (before == 0 || after == 0) { sout<<"Donner 2 Entiers Positifs"<<endl; return IFSelect_RetError; }
- if (!WS->ChangeModifierRank(formodel,before,after)) return IFSelect_RetFail;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun51
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
-// **** DispSel ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"Donner Noms Dispatch et Selection Finale"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(arg1));
- if (disp.IsNull())
- { sout<<"Pas un nom de Dispatch : "<<arg1<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg2));
- if (sel.IsNull())
- { sout<<"Pas un nom de Selection : "<<arg2<<endl; return IFSelect_RetError; }
- if (!WS->SetItemSelection(disp,sel)) return IFSelect_RetFail;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun_dispone
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** DispOne ****
- Handle(IFSelect_DispPerOne) disp = new IFSelect_DispPerOne;
- return pilot->RecordItem(disp);
-}
-
-static IFSelect_ReturnStatus fun_dispglob
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** DispGlob ****
- Handle(IFSelect_DispGlobal) disp = new IFSelect_DispGlobal;
- return pilot->RecordItem(disp);
-}
-
-static IFSelect_ReturnStatus fun_dispcount
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** DispCount ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner Nom IntParam pour Count"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_IntParam,par,WS->NamedItem(arg1));
- if (par.IsNull())
- { sout<<"Pas un nom de IntParam : "<<arg1<<endl; return IFSelect_RetError; }
- Handle(IFSelect_DispPerCount) disp = new IFSelect_DispPerCount;
- disp->SetCount (par);
- return pilot->RecordItem(disp);
-}
-
-static IFSelect_ReturnStatus fun_dispfiles
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** DispFiles ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner Nom IntParam pour NbFiles"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_IntParam,par,WS->NamedItem(arg1));
- if (par.IsNull())
- { sout<<"Pas un nom de IntParam : "<<arg1<<endl; return IFSelect_RetError; }
- Handle(IFSelect_DispPerFiles) disp = new IFSelect_DispPerFiles;
- disp->SetCount (par);
- return pilot->RecordItem(disp);
-}
-
-
-static IFSelect_ReturnStatus fun_dispsign
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** DispFiles ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner Nom Signature"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_Signature,sig,WS->NamedItem(arg1));
- if (sig.IsNull())
- { sout<<"Pas un nom de Signature : "<<arg1<<endl; return IFSelect_RetError; }
- Handle(IFSelect_DispPerSignature) disp = new IFSelect_DispPerSignature;
- disp->SetSignCounter (new IFSelect_SignCounter(sig));
- return pilot->RecordItem(disp);
-}
-
-
-static IFSelect_ReturnStatus fun56
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Dispatch ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner Nom du Dispatch"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(arg1));
- if (disp.IsNull()) { sout<<"Pas un dispatch : "<<arg1<<endl; return IFSelect_RetError; }
- Standard_Integer num = WS->DispatchRank(disp);
- sout<<"Dispatch de Nom : "<<arg1<<" , en ShareOut, Numero "<<num<<" : ";
- Handle(IFSelect_Selection) sel = WS->ItemSelection(disp);
- Handle(TCollection_HAsciiString) selname = WS->Name(sel);
- if (sel.IsNull()) sout<<"Pas de Selection Finale"<<endl;
- else if (selname.IsNull()) sout<<"Selection Finale : #"<<WS->ItemIdent(sel)<<endl;
- else sout<<"Selection Finale : "<<selname->ToCString()<<endl;
- if (disp->HasRootName()) sout<<"-- Racine nom de fichier : "
- <<disp->RootName()->ToCString()<<endl;
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun57
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Remove ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give Name to Remove !"<<endl; return IFSelect_RetError; }
- if (!WS->RemoveNamedItem(arg1)) return IFSelect_RetFail;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun58
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** EvalDisp ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"evaldisp mode disp [disp ...] : Mode + Name(s) of Dispatch(es). Mode:\n"
- <<" 0 brief 1 +forgotten ents 2 +duplicata 3 1+2"<<endl
- <<"See also : evaladisp writedisp xsplit"<<endl;
- return IFSelect_RetVoid; }
- Standard_Boolean OK = Standard_True;
- Standard_Integer i , mode = atoi(arg1); sout<<" Mode "<<mode<<"\n";
- for (i = 2; i < argc; i ++) {
- DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(pilot->Arg(i)));
- if (disp.IsNull())
- { sout<<"Not a dispatch:"<<pilot->Arg(i)<<endl; OK = Standard_False; }
- }
- if (!OK) {
- sout<<"Some of the parameters are not correct"<<endl;
- return IFSelect_RetError;
- }
-
- WS->ClearShareOut(Standard_True);
- for (i = 2; i < argc; i ++) {
- DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(pilot->Arg(i)));
- WS->SetActive(disp,Standard_True);
- }
-// WS->EvaluateDispatch(disp,mode);
- WS->EvaluateComplete(mode);
- return IFSelect_RetVoid;
-}
-
-
-static IFSelect_ReturnStatus fun_evaladisp
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** EvalADisp [GiveList] ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"evaladisp mode(=0-1-2-3) disp [givelist] : Mode + Dispatch [+ GiveList]\n If GiveList not given, computed from Selection of the Dispatch. Mode:\n"
- <<" 0 brief 1 +forgotten ents 2 +duplicata 3 1+2"<<endl
- <<"See also : writedisp"<<endl;
- return IFSelect_RetVoid; }
- if (arg1[1] != '\0') { sout<<"first parameter : mode, must be a number between 0 and 3"<<endl; return IFSelect_RetError; }
- Standard_Integer mode = atoi(arg1); sout<<" Mode "<<mode<<"\n";
-// DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(pilot->Arg(2)));
- Handle(IFSelect_Dispatch) disp = IFSelect_Functions::GiveDispatch (WS,pilot->Arg(2),Standard_True);
- if (disp.IsNull())
- { sout<<"Not a dispatch:"<<pilot->Arg(2)<<endl; return IFSelect_RetError; }
- Handle(IFSelect_Selection) selsav = disp->FinalSelection();
- Handle(IFSelect_Selection) sel;
- if (argc > 3) {
- Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
- Handle(TColStd_HSequenceOfTransient) list = IFSelect_Functions::GiveList
- (pilot->Session(),pilot->CommandPart(3));
- Standard_Integer nb = (list.IsNull() ? 0 : list->Length());
- if (nb > 0) { sp->AddList (list); sel = sp; }
- }
-
- if (sel.IsNull() && selsav.IsNull())
- { sout<<"No Selection nor GiveList defined"<<endl; return IFSelect_RetError; }
- if (sel.IsNull() && !selsav.IsNull()) {
- if (argc > 3) sout<<"GiveList is empty, hence computed from the Selection of the Dispatch"<<endl;
- sel = selsav;
- }
- disp->SetFinalSelection(sel);
-// WS->ClearShareOut(Standard_True);
-// WS->SetActive(disp,Standard_True);
- WS->EvaluateDispatch(disp,mode);
- disp->SetFinalSelection(selsav);
-
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun_writedisp
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** EvalADisp [GiveList] ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"writedisp filename disp [givelist] : FileName + Dispatch [+ GiveList]\n If GiveList not given, computed from Selection of the Dispatch.\n"
- <<"FileName : rootname.ext will gives rootname_1.ext etc...\n"
- <<" path/rootname.ext gives path/rootname_1.ext etc...\n"
- <<"See also : evaladisp"<<endl;
- return IFSelect_RetVoid; }
- TCollection_AsciiString prefix,rootname,suffix;
- SplitFileName (arg1,prefix,rootname,suffix);
- if (rootname.Length() == 0 || suffix.Length() == 0) {
- sout<<"Empty Root Name or Extension"<<endl;
- return IFSelect_RetError;
- }
-
-// DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(pilot->Arg(2)));
- Handle(IFSelect_Dispatch) disp = IFSelect_Functions::GiveDispatch (WS,pilot->Arg(2),Standard_True);
- if (disp.IsNull())
- { sout<<"Not a dispatch:"<<pilot->Arg(2)<<endl; return IFSelect_RetError; }
- Handle(IFSelect_Selection) selsav = disp->FinalSelection();
- Handle(IFSelect_Selection) sel;
- if (argc > 3) {
- Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
- Handle(TColStd_HSequenceOfTransient) list = IFSelect_Functions::GiveList
- (pilot->Session(),pilot->CommandPart(3));
- Standard_Integer nb = (list.IsNull() ? 0 : list->Length());
- if (nb > 0) { sp->AddList (list); sel = sp; }
- }
-
- if (sel.IsNull() && selsav.IsNull())
- { sout<<"No Selection nor GiveList defined"<<endl; return IFSelect_RetError; }
- if (sel.IsNull() && !selsav.IsNull()) {
- if (argc > 3) sout<<"GiveList is empty, hence computed from the Selection of the Dispatch"<<endl;
- sel = selsav;
- }
-
- WS->ClearShareOut(Standard_True);
- disp->SetFinalSelection(sel);
- WS->SetActive(disp,Standard_True);
- WS->BeginSentFiles(Standard_True);
-
- WS->SetFilePrefix (prefix.ToCString());
- WS->SetFileExtension (suffix.ToCString());
- WS->SetFileRoot(disp,rootname.ToCString());
-
- Standard_Boolean OK = WS->SendSplit();
- disp->SetFinalSelection(selsav);
- return (OK ? IFSelect_RetDone : IFSelect_RetFail);
-}
-
-
-static IFSelect_ReturnStatus fun59
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** EvalComplete ****
- Standard_Integer mode = 0;
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) sout << " -- mode par defaut 0\n";
- else { mode = atoi(arg1); sout << " -- mode : " << mode << endl; }
- WS->EvaluateComplete(mode); return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun60
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** LastRunCheckList ****
- Interface_CheckIterator chlist = WS->LastRunCheckList();
- Handle(IFSelect_CheckCounter) counter = new IFSelect_CheckCounter(0);
- counter->Analyse(chlist,WS->Model(),Standard_False);
- counter->PrintCount (Message::DefaultMessenger());
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun61
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** RunTransformer ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner Nom de Transformer"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_Transformer,tsf,WS->NamedItem(arg1));
- Standard_Integer effect = WS->RunTransformer(tsf);
- switch (effect) {
- case -4 : sout<<"Edition sur place, nouveau Protocole, erreur recalcul graphe"<<endl; break;
- case -3 : sout<<"Erreur, Transformation ignoree"<<endl; break;
- case -2 : sout<<"Erreur sur edition sur place, risque de corruption (verifier)"<<endl; break;
- case -1 : sout<<"Erreur sur edition locale, risque de corruption (verifier)"<<endl; break;
- case 0 :
- if (tsf.IsNull()) sout<<"Erreur, pas un Transformer: "<<arg1<<endl;
- else sout<<"Execution non faite"<<endl;
- break;
- case 1 : sout<<"Transformation locale (graphe non touche)"<<endl; break;
- case 2 : sout<<"Edition sur place (graphe recalcule)"<<endl; break;
- case 3 : sout<<"Modele reconstruit"<<endl; break;
- case 4 : sout<<"Edition sur place, nouveau Protocole"<<endl; break;
- case 5 : sout<<"Nouveau Modele avec nouveau Protocole"<<endl; break;
- default : break;
- }
- return ((effect > 0) ? IFSelect_RetDone : IFSelect_RetFail);
-}
-
-static IFSelect_ReturnStatus fun62
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** TransformStandard Copy ****
- return pilot->RecordItem(WS->NewTransformStandard(Standard_True));
-}
-
-static IFSelect_ReturnStatus fun63
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** TransformStandard OntheSpot ****
- return pilot->RecordItem(WS->NewTransformStandard(Standard_False));
-}
-
-static IFSelect_ReturnStatus fun6465
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** Run Modifier avec Standard Copy ****
-// **** Run Modifier avec OnTheSpot ****
- Standard_Boolean runcopy = (pilot->Arg(0)[3] == 'c');
-// soit c est un nom, sinon c est une commande
- Handle(IFSelect_Modifier) modif;
- if (WS->NameIdent(arg1) > 0)
- modif = GetCasted(IFSelect_Modifier,WS->NamedItem(arg1));
- else {
- pilot->RemoveWord(0); // c etait la commande run
- pilot->Perform();
- modif = GetCasted(IFSelect_Modifier,pilot->RecordedItem());
- }
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (modif.IsNull())
- { sout<<"Pas un nom de Modifier : "<<arg1<<endl; return IFSelect_RetError; }
-
- Handle(TColStd_HSequenceOfTransient) list;
- Handle(IFSelect_SelectPointed) sp;
- if (argc > 2) {
- list = IFSelect_Functions::GiveList (WS,pilot->CommandPart(2));
- sp = new IFSelect_SelectPointed;
- sp->SetList (list);
- }
-
- Standard_Integer effect = 0;
- effect = WS->RunModifierSelected (modif,sp,runcopy);
-// sout<<"Modifier applique sur TransformStandard #"<<WS->ItemIdent(tsf)<<endl;
- switch (effect) {
- case -4 : sout<<"Edition sur place, nouveau Protocole, erreur recalcul graphe"<<endl; break;
- case -3 : sout<<"Erreur, Transformation ignoree"<<endl; break;
- case -2 : sout<<"Erreur sur edition sur place, risque de corruption (verifier)"<<endl; break;
- case -1 : sout<<"Erreur sur edition locale, risque de corruption (verifier)"<<endl; break;
- case 0 :
- if (modif.IsNull()) sout<<"Erreur, pas un Modifier: "<<arg1<<endl;
- else sout<<"Execution non faite"<<endl;
- break;
- case 1 : sout<<"Transformation locale (graphe non touche)"<<endl; break;
- case 2 : sout<<"Edition sur place (graphe recalcule)"<<endl; break;
- case 3 : sout<<"Modele reconstruit"<<endl; break;
- case 4 : sout<<"Edition sur place, nouveau Protocole"<<endl; break;
- case 5 : sout<<"Nouveau Modele avec nouveau Protocole"<<endl; break;
- default : break;
- }
- return ((effect > 0) ? IFSelect_RetDone : IFSelect_RetFail);
-}
-
-static IFSelect_ReturnStatus fun66
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
-// **** (xset) ModifReorder ****
- char opt = ' ';
- Standard_Integer argc = pilot->NbWords();
- if (argc >= 2) opt = pilot->Word(1).Value(1);
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (opt != 'f' && opt != 'l')
- { sout<<"Donner option : f -> root-first l -> root-last"<<endl; return IFSelect_RetError; }
- return pilot->RecordItem(new IFSelect_ModifReorder(opt == 'l'));
-}
-
-static IFSelect_ReturnStatus fun70
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** SelToggle ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner Nom de Selection"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1));
- if (!WS->ToggleSelectExtract(sel))
- { sout<<"Pas une SelectExtract : "<<arg1<<endl; return IFSelect_RetFail; }
- if (WS->IsReversedSelectExtract(sel)) sout<<arg1<<" a present Reversed"<<endl;
- else sout<<arg1<<" a present Directe"<<endl;
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun71
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
-// **** SelInput ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"Donner Noms Selections cible et input"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1));
- DeclareAndCast(IFSelect_Selection,sou,WS->NamedItem(arg2));
- if (sel.IsNull() || sou.IsNull())
- { sout<<"Incorrect : "<<arg1<<","<<arg2<<endl; return IFSelect_RetError; }
- if (!WS->SetInputSelection(sel,sou)) {
- sout<<"Nom incorrect ou Selection "<<arg1<<" ni Extract ni Deduct"<<endl;
- return IFSelect_RetFail;
- }
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun72
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** SelModelRoots ****
- return pilot->RecordItem (new IFSelect_SelectModelRoots);
-}
-
-static IFSelect_ReturnStatus fun73
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
-// **** SelRange ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc >= 2 && arg1[0] == '?') argc = 1;
- if (argc < 2) {
- sout<<"Donner la description du SelectRange"
- <<" Formes admises :\n <n1> <n2> : Range de <n1> a <n2>\n"
- <<" <n1> tout seul : Range n0 <n1>\n from <n1> : Range From <n1>\n"
- <<" until <n2> : Range Until <n2>"<<endl;
- return IFSelect_RetVoid;
- }
-
- Handle(IFSelect_IntParam) low,up;
- Handle(IFSelect_SelectRange) sel;
-// Range From
- if (pilot->Word(1).IsEqual("from")) {
- if (argc < 3) { sout<<"Forme admise : from <i>"<<endl; return IFSelect_RetError; }
- low = GetCasted(IFSelect_IntParam,WS->NamedItem(arg2));
- sel = new IFSelect_SelectRange;
- sel->SetFrom (low);
-// Range Until
- } else if (pilot->Word(1).IsEqual("until")) {
- if (argc < 3) { sout<<"Forme admise : until <i>"<<endl; return IFSelect_RetError; }
- up = GetCasted(IFSelect_IntParam,WS->NamedItem(arg2));
- sel = new IFSelect_SelectRange;
- sel->SetUntil (up);
-// Range One (n-th)
- } else if (argc < 3) {
- low = GetCasted(IFSelect_IntParam,WS->NamedItem(arg1));
- sel = new IFSelect_SelectRange;
- sel->SetOne (low);
-// Range (from-to)
- } else {
- low = GetCasted(IFSelect_IntParam,WS->NamedItem(arg1));
- up = GetCasted(IFSelect_IntParam,WS->NamedItem(arg2));
- sel = new IFSelect_SelectRange;
- sel->SetRange (low,up);
- }
- return pilot->RecordItem (sel);
-}
-
-static IFSelect_ReturnStatus fun74
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** SelRoots ****
- return pilot->RecordItem (new IFSelect_SelectRoots);
-}
-
-static IFSelect_ReturnStatus fun75
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** SelShared ****
- return pilot->RecordItem (new IFSelect_SelectShared);
-}
-
-static IFSelect_ReturnStatus fun76
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
-// **** SelDiff ****
- Handle(IFSelect_Selection) sel = new IFSelect_SelectDiff;
- if (sel.IsNull()) return IFSelect_RetFail;
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) sout<<"Diff sans input : ne pas oublier de les definir (ctlmain, ctlsec)!"<<endl;
- DeclareAndCast(IFSelect_Selection,selmain,WS->NamedItem(arg1));
- DeclareAndCast(IFSelect_Selection,selsec ,WS->NamedItem(arg2));
- if (argc >= 2)
- if (!WS->SetControl(sel,selmain,Standard_True))
- sout<<"Echec ControlMain:"<<arg1<<" , a refaire (ctlmain)"<<endl;
- if (argc >= 3)
- if (!WS->SetControl(sel,selsec,Standard_False))
- sout<<"Echec ControlSecond:"<<arg2<<" , a refaire (ctlsec)"<<endl;
- return pilot->RecordItem (sel);
-}
-
-static IFSelect_ReturnStatus fun77
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
-// **** SelControlMain ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"Donner Noms de Control et MainInput"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1));
- DeclareAndCast(IFSelect_Selection,selmain,WS->NamedItem(arg2));
- if (WS->SetControl(sel,selmain,Standard_True)) return IFSelect_RetDone;
- sout<<"Nom incorrect ou Selection "<<arg1<<" pas de type Control"<<endl;
- return IFSelect_RetFail;
-}
-
-static IFSelect_ReturnStatus fun78
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
-// **** SelControlSecond ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"Donner Noms de Control et SecondInput"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1));
- DeclareAndCast(IFSelect_Selection,seldif,WS->NamedItem(arg2));
- if (WS->SetControl(sel,seldif,Standard_False)) return IFSelect_RetDone;
- sout<<"Nom incorrect ou Selection "<<arg1<<" pas de type Control"<<endl;
- return IFSelect_RetFail;
-}
-
-static IFSelect_ReturnStatus fun79
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** SelModelAll ****
- return pilot->RecordItem (new IFSelect_SelectModelEntities);
-}
-
-static IFSelect_ReturnStatus fun80
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
-// **** SelCombAdd ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"Donner n0 Combine et une Input"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1));
- DeclareAndCast(IFSelect_Selection,seladd,WS->NamedItem(arg2));
- if (WS->CombineAdd(sel,seladd)) return IFSelect_RetDone;
- sout<<"Nom incorrect ou Selection "<<arg1<<" pas Combine"<<endl;
- return IFSelect_RetFail;
-}
-
-static IFSelect_ReturnStatus fun81
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
-// **** SelCombRem ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"Donner n0 Combine et RANG a supprimer"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1));
- DeclareAndCast(IFSelect_Selection,inp,WS->NamedItem(arg2));
- if (WS->CombineRemove(sel,inp)) return IFSelect_RetDone;
- sout<<"Nom incorrect ou Selection "<<arg1<<" ni Union ni Intersection"<<endl;
- return IFSelect_RetFail;
-}
-
-static IFSelect_ReturnStatus fun82
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** SelEntNumber ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner Nom IntParam pour n0 Entite"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_IntParam,par,WS->NamedItem(arg1));
- Handle(IFSelect_SelectEntityNumber) sel = new IFSelect_SelectEntityNumber;
- sel->SetNumber(par);
- return pilot->RecordItem (sel);
-}
-
-static IFSelect_ReturnStatus fun83
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** SelUnion ****
- return pilot->RecordItem (new IFSelect_SelectUnion);
-}
-
-static IFSelect_ReturnStatus fun84
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** SelIntersection ****
- return pilot->RecordItem (new IFSelect_SelectIntersection);
-}
-
-static IFSelect_ReturnStatus fun85
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** SelTextType Exact ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner le TYPE a selectionner"<<endl; return IFSelect_RetError; }
- return pilot->RecordItem (new IFSelect_SelectSignature
- (new IFSelect_SignType,arg1,Standard_True));
-}
-
-static IFSelect_ReturnStatus fun86
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
-// **** SelErrorEntities ****
- return pilot->RecordItem (new IFSelect_SelectErrorEntities);
-}
-
-static IFSelect_ReturnStatus fun87
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
-// **** SelUnknownEntities **
- return pilot->RecordItem (new IFSelect_SelectUnknownEntities);
-}
-
-static IFSelect_ReturnStatus fun88
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
-// **** SelSharing ****
- return pilot->RecordItem (new IFSelect_SelectSharing);
-}
-
-static IFSelect_ReturnStatus fun89
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** SelTextType Contain **
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner le TYPE a selectionner"<<endl; return IFSelect_RetError; }
- return pilot->RecordItem (new IFSelect_SelectSignature
- (new IFSelect_SignType,arg1,Standard_False));
-}
-
-static IFSelect_ReturnStatus fun90
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
-// **** SelPointed ****
- Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
- if (pilot->NbWords() > 1) {
- Handle(TColStd_HSequenceOfTransient) list = IFSelect_Functions::GiveList
- (pilot->Session(),pilot->CommandPart(1));
- if (list.IsNull()) return IFSelect_RetFail;
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- sout<<"SelectPointed : "<<list->Length()<<" entities"<<endl;
- sp->AddList (list);
- }
- return pilot->RecordItem (sp);
-}
-
-static IFSelect_ReturnStatus fun91
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** SetPointed (edit) / SetList (edit) ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) {
- sout<<"Donner NOM SelectPointed + Option(s) :\n"
- <<" aucune : liste des entites pointees\n"
- <<" 0: Clear +nn ajout entite nn -nn enleve nn /nn toggle nn"<<endl;
- return IFSelect_RetError;
- }
- DeclareAndCast(IFSelect_SelectPointed,sp,WS->NamedItem(arg1));
- if (sp.IsNull()) { sout<<"Pas une SelectPointed:"<<arg1<<endl; return IFSelect_RetError; }
- const Handle(Interface_InterfaceModel) &model = WS->Model(); // pour Print
- if (argc == 2) { // listage simple
- Standard_Integer nb = sp->NbItems();
- sout<<" SelectPointed : "<<arg1<<" : "<<nb<<" Items :"<<endl;
- for (Standard_Integer i = 1; i <= nb; i ++) {
- Handle(Standard_Transient) pointed = sp->Item(i);
- Standard_Integer id = WS->StartingNumber(pointed);
- if (id == 0) sout <<" (inconnu)";
- else { sout<<" "; model->Print(pointed,sout); }
- }
- if (nb > 0) sout<<endl;
- return IFSelect_RetDone;
- }
-
- for (Standard_Integer ia = 2; ia < argc ; ia ++) {
- const TCollection_AsciiString argi = pilot->Word(ia);
- Standard_Integer id = pilot->Number(&(argi.ToCString())[1]);
- if (id == 0) {
- if (!argi.IsEqual("0")) sout<<"Incorrect,ignore:"<<argi<<endl;
- else { sout<<"Clear SelectPointed"<<endl; sp->Clear(); }
- } else if (argi.Value(1) == '-') {
- Handle(Standard_Transient) item = WS->StartingEntity(id);
- if (sp->Remove(item)) sout<<"Removed:no."<<id;
- else sout<<" Echec Remove "<<id;
- sout<<": "; model->Print(item,sout); sout<<endl;
- } else if (argi.Value(1) == '/') {
- Handle(Standard_Transient) item = WS->StartingEntity(id);
- if (sp->Remove(item)) sout<<"Toggled:n0."<<id;
- else sout<<" Echec Toggle "<<id;
- sout<<": "; model->Print(item,sout); sout<<endl;
- } else if (argi.Value(1) == '+') {
- Handle(Standard_Transient) item = WS->StartingEntity(id);
- if (sp->Add(item)) sout<<"Added:no."<<id;
- else sout<<" Echec Add "<<id;
- sout<<": "; model->Print(item,sout); sout<<endl;
- } else {
- sout<<"Ignore:"<<argi<<" , donner n0 PRECEDE de + ou - ou /"<<endl;
- }
- }
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun92
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** SelIncorrectEntities ****
- WS->ComputeCheck();
- return pilot->RecordItem (new IFSelect_SelectIncorrectEntities);
-}
-
-static IFSelect_ReturnStatus fun93
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** SelSignature ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"Give name of Signature or Counter, text + option exact(D) else contains"<<endl; return IFSelect_RetError; }
- Standard_Boolean exact = Standard_True;
- if (argc > 3) { if (pilot->Arg(3)[0] == 'c') exact = Standard_False; }
-
- DeclareAndCast(IFSelect_Signature,sign,WS->NamedItem(arg1));
- DeclareAndCast(IFSelect_SignCounter,cnt,WS->NamedItem(arg1));
- Handle(IFSelect_SelectSignature) sel;
-
- if (!sign.IsNull()) sel = new IFSelect_SelectSignature (sign,arg2,exact);
- else if (!cnt.IsNull()) sel = new IFSelect_SelectSignature (cnt,arg2,exact);
- else { sout<<arg1<<":neither Signature nor Counter"<<endl; return IFSelect_RetError; }
-
- return pilot->RecordItem(sel);
-}
-
-static IFSelect_ReturnStatus fun94
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** SignCounter ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner nom signature"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_Signature,sign,WS->NamedItem(arg1));
- if (sign.IsNull()) { sout<<arg1<<":pas une signature"<<endl; return IFSelect_RetError; }
- Handle(IFSelect_SignCounter) cnt = new IFSelect_SignCounter (sign,Standard_True,Standard_True);
- return pilot->RecordItem(cnt);
-}
-
-static IFSelect_ReturnStatus funbselected
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-// **** NbSelected = GraphCounter ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Donner nom selection (deduction) a appliquer"<<endl; return IFSelect_RetError; }
- DeclareAndCast(IFSelect_SelectDeduct,applied,WS->GiveSelection(arg1));
- if (applied.IsNull()) { sout<<arg1<<":pas une SelectDeduct"<<endl; return IFSelect_RetError; }
- Handle(IFSelect_GraphCounter) cnt = new IFSelect_GraphCounter (Standard_True,Standard_True);
- cnt->SetApplied (applied);
- return pilot->RecordItem(cnt);
-}
-
-// #########################################
-// #### EDITOR - EDITFORM ####
-// #########################################
-
-static IFSelect_ReturnStatus fun_editlist
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give the name of an EditForm or an Editor"<<endl;
- return IFSelect_RetError; }
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-
-// EditForm
-
- DeclareAndCast(IFSelect_EditForm,edf,WS->NamedItem(arg1));
- Handle(IFSelect_Editor) edt;
- if (!edf.IsNull()) {
- sout<<"Print EditForm "<<arg1<<endl;
- edt = edf->Editor();
- if (argc < 3) {
-
-// DEFINITIONS : Editor (direct ou via EditForm)
-
- if (edt.IsNull()) edt = GetCasted(IFSelect_Editor,WS->NamedItem(arg1));
- if (edt.IsNull()) return IFSelect_RetVoid;
-
- sout<<"Editor, Label : "<<edt->Label()<<endl;
- sout<<endl<<" -- Names (short - complete) + Labels of Values"<<endl;
- edt->PrintNames(sout);
- sout<<endl<<" -- Definitions --"<<endl;
- edt->PrintDefs (sout);
- if (!edf.IsNull()) {
- edf->PrintDefs(sout);
- sout<<endl<<"To display values, add an option : o original f final m modified"<<endl;
- }
-
- return IFSelect_RetVoid;
-
- } else {
- char opt = arg2[0];
- Standard_Integer what = 0;
- if (opt == 'o') what = -1;
- else if (opt == 'f') what = 1;
-
- edf->PrintValues (sout,what,Standard_False);
- }
- }
-
- return IFSelect_RetVoid;
-}
-
-static IFSelect_ReturnStatus fun_editvalue
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 3) { sout<<"Give the name of an EditForm + name of Value [+ newvalue or . to nullify]"<<endl;
- return IFSelect_RetError; }
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- DeclareAndCast(IFSelect_EditForm,edf,WS->NamedItem(arg1));
- if (edf.IsNull())
- { sout<<"Not an EditForm : "<<arg1<<endl; return IFSelect_RetError; }
- Standard_Integer num = edf->NameNumber (arg2);
- if (num == 0) sout<<"Unknown Value Name : "<<arg2<<endl;
- if (num < 0) sout<<"Not Extracted Value Name : "<<arg2<<endl;
- if (num <= 0) return IFSelect_RetError;
-
- Standard_Boolean islist = edf->Editor()->IsList(num);
- Standard_CString name = edf->Editor()->Name(num,Standard_True); // vrai nom
- Handle(TColStd_HSequenceOfHAsciiString) listr;
- Handle(TCollection_HAsciiString) str;
- sout<<"Value Name : "<<name<<(edf->IsModified(num) ? "(already edited) : " : " : ");
-
- if (islist) {
- listr = edf->EditedList(num);
- if (listr.IsNull()) sout<<"(NULL LIST)"<<endl;
- else {
- Standard_Integer ilist,nblist = listr->Length();
- sout<<"(List : "<<nblist<<" Items)"<<endl;
- for (ilist = 1; ilist <= nblist; ilist ++) {
- str = listr->Value(ilist);
- sout<<" ["<<ilist<<"] "<< (str.IsNull() ? "(NULL)" : str->ToCString())<<endl;
- }
- }
- if (argc < 4) sout<<"To Edit, options by editval edit-form value-name ?"<<endl;
- } else {
- str = edf->EditedValue (num);
- sout<<(str.IsNull() ? "(NULL)" : str->ToCString())<<endl;
- }
- if (argc < 4) return IFSelect_RetVoid;
-
-// Valeur simple ou liste ?
- Standard_Integer numarg = 3;
- str.Nullify();
-
- const Standard_CString argval = pilot->Arg(numarg);
- if (islist) {
- if (argval[0] == '?') {
- sout<<"To Edit, options"<<endl<<" + val : add value at end (blanks allowed)"
- <<endl<<" +nn text : insert val before item nn"<<endl
- <<" nn text : replace item nn with a new value"<<endl
- <<" -nn : remove item nn"<<endl<<" . : clear the list"<<endl;
- return IFSelect_RetVoid;
- }
- Standard_Boolean stated = Standard_False;
- Handle(IFSelect_ListEditor) listed = edf->ListEditor (num);
- if (listed.IsNull()) return IFSelect_RetError;
- if (argval[0] == '.') { listr.Nullify(); stated = listed->LoadEdited(listr); }
- else if (argval[0] == '+') {
- Standard_Integer numadd = 0;
- if (argval[1] != '\0') numadd = atoi(argval);
- stated = listed->AddValue (new TCollection_HAsciiString(pilot->CommandPart(numarg+1)),numadd);
- }
- else if (argval[0] == '-') {
- Standard_Integer numrem = atoi(argval);
- stated = listed->Remove(numrem);
- }
- else {
- Standard_Integer numset = atoi(argval);
- if (numset > 0) stated = listed->AddValue
- (new TCollection_HAsciiString(pilot->CommandPart(numarg+1)),numset);
- }
- if (stated) stated = edf->ModifyList (num,listed,Standard_True);
- if (stated) sout<<"List Edition done"<<endl;
- else sout<<"List Edition not done, option"<<argval<<endl;
- } else {
- if (argval[0] == '.' && argval[1] == '\0') str.Nullify();
- else str = new TCollection_HAsciiString (pilot->CommandPart(numarg));
- if (edf->Modify (num,str,Standard_True)) {
- sout<<"Now set to "<<(str.IsNull() ? "(NULL)" : str->ToCString())<<endl;
- } else {
- sout<<"Modify not done"<<endl; return IFSelect_RetFail;
- }
- }
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun_editclear
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give the name of an EditForm [+ name of Value else all]"<<endl;
- return IFSelect_RetError; }
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- DeclareAndCast(IFSelect_EditForm,edf,WS->NamedItem(arg1));
- if (edf.IsNull())
- { sout<<"Not an EditForm : "<<arg1<<endl; return IFSelect_RetError; }
- if (argc < 3) { edf->ClearEdit(); sout<<"All Modifications Cleared"<<endl; }
- else {
- Standard_Integer num = edf->NameNumber (arg2);
- if (num == 0) sout<<"Unknown Value Name : "<<arg2<<endl;
- if (num < 0) sout<<"Not Extracted Value Name : "<<arg2<<endl;
- if (num <= 0) return IFSelect_RetError;
- if (!edf->IsModified(num))
- { sout<<"Value "<<arg2<<" was not modified"<<endl; return IFSelect_RetVoid; }
- edf->ClearEdit (num);
- sout<<"Modification on Value "<<arg2<<" Cleared"<<endl;
- }
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun_editapply
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give the name of an EditForm [+ option keep to re-apply edited values]"<<endl;
- return IFSelect_RetError; }
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- DeclareAndCast(IFSelect_EditForm,edf,WS->NamedItem(arg1));
- if (edf.IsNull())
- { sout<<"Not an EditForm : "<<arg1<<endl; return IFSelect_RetError; }
-
- Handle(Standard_Transient) ent = edf->Entity();
- Handle(Interface_InterfaceModel) model = edf->Model();
- if (!model.IsNull()) {
- if (ent.IsNull()) sout<<"Applying modifications on loaded model"<<endl;
- else {
- sout<<"Applying modifications on loaded entity : ";
- model->PrintLabel (ent,sout);
- }
- }
- else sout<<"Applying modifications"<<endl;
-
- if (!edf->ApplyData (edf->Entity(),edf->Model())) {
- sout<<"Modifications could not be applied"<<endl;
- return IFSelect_RetFail;
- }
- sout<<"Modifications have been applied"<<endl;
-
- Standard_Boolean stat = Standard_True;
- if (argc > 2 && arg2[0] == 'k') stat = Standard_False;
- if (stat) {
- edf->ClearEdit();
- sout<<"Edited values are cleared"<<endl;
- }
- else sout<<"Edited values are kept for another loading/applying"<<endl;
-
- return IFSelect_RetDone;
-}
-
-static IFSelect_ReturnStatus fun_editload
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give the name of an EditForm [+ Entity-Ident]"<<endl;
- return IFSelect_RetError; }
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- DeclareAndCast(IFSelect_EditForm,edf,WS->NamedItem(arg1));
- if (edf.IsNull())
- { sout<<"Not an EditForm : "<<arg1<<endl; return IFSelect_RetError; }
-
- Standard_Integer num = (argc < 3 ? 0 : pilot->Number (arg2));
- Standard_Boolean stat = Standard_False;
- if (argc < 3) {
- sout<<"EditForm "<<arg1<<" : Loading Model"<<endl;
- stat = edf->LoadModel(WS->Model());
- } else if (num <= 0) {
- sout<<"Not an entity ident : "<<arg2<<endl;
- return IFSelect_RetError;
- } else {
- sout<<"EditForm "<<arg1<<" : Loading Entity "<<arg2<<endl;
- stat = edf->LoadData (WS->StartingEntity(num),WS->Model());
- }
-
- if (!stat) {
- sout<<"Loading not done"<<endl;
- return IFSelect_RetFail;
- }
- sout<<"Loading done"<<endl;
- return IFSelect_RetDone;
-}
-
-// #########################################
-// #### FONCTIONS COMPLEMENTAIRES ####
-// #########################################
-
- Handle(Standard_Transient) IFSelect_Functions::GiveEntity
- (const Handle(IFSelect_WorkSession)& WS,
- const Standard_CString name)
-{
- Handle(Standard_Transient) ent; // demarre a Null
- Standard_Integer num = GiveEntityNumber(WS,name);
- if (num > 0) ent = WS->StartingEntity(num);
- return ent;
-}
-
- Standard_Integer IFSelect_Functions::GiveEntityNumber
- (const Handle(IFSelect_WorkSession)& WS,
- const Standard_CString name)
-{
- Standard_Integer num = 0;
- if (!name || name[0] == '\0') {
- char ligne[80]; ligne[0] = '\0';
- cin >> ligne;
-// cin.clear(); cin.getline (ligne,79);
- if (ligne[0] == '\0') return 0;
- num = WS->NumberFromLabel (ligne);
- }
- else num = WS->NumberFromLabel (name);
- return num;
-}
-
- Handle(TColStd_HSequenceOfTransient) IFSelect_Functions::GiveList
- (const Handle(IFSelect_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
-
-Handle(IFSelect_Dispatch) IFSelect_Functions::GiveDispatch
- (const Handle(IFSelect_WorkSession)& WS,
- const Standard_CString name, const Standard_Boolean mode)
-{
- DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(name));
- if (!disp.IsNull()) return disp; // OK as it is given
-
-// Else, let s try special cases
- TCollection_AsciiString nam(name);
- Standard_Integer paro = nam.Location(1,'(',1,nam.Length());
- Standard_Integer parf = nam.Location(1,')',1,nam.Length());
- nam.SetValue(paro,'\0'); nam.SetValue(parf,'\0');
- if (paro <= 0 &&parf <= 0) return disp;
- disp = GetCasted(IFSelect_Dispatch,WS->NamedItem(nam.ToCString()));
- if (disp.IsNull()) return disp; // KO anyway
-
-// According to the type of dispatch :
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- DeclareAndCast(IFSelect_DispPerCount,dc,disp);
- if (!dc.IsNull()) {
- Standard_Integer nb = atoi( &(nam.ToCString())[paro]);
- if (nb <= 0) {
- sout<<" DispPerCount, count is not positive"<<endl;
- disp.Nullify();
- return disp;
- }
- if (mode) {
- Handle(IFSelect_IntParam) val = new IFSelect_IntParam;
- val->SetValue(nb);
- dc->SetCount (val);
- }
- return dc;
- }
- DeclareAndCast(IFSelect_DispPerFiles,dp,disp);
- if (!dp.IsNull()) {
- Standard_Integer nb = atoi( &(nam.ToCString())[paro]);
- if (nb <= 0) {
- sout<<" DispPerFiles, count is not positive"<<endl;
- disp.Nullify();
- return disp;
- }
- if (mode) {
- Handle(IFSelect_IntParam) val = new IFSelect_IntParam;
- val->SetValue(nb);
- dp->SetCount (val);
- }
- return dp;
- }
- DeclareAndCast(IFSelect_DispPerSignature,ds,disp);
- if (!ds.IsNull()) {
- DeclareAndCast(IFSelect_Signature,sg,WS->NamedItem( &(nam.ToCString())[paro]));
- if (sg.IsNull()) {
- sout<<"DispPerSignature "<<nam<<" , Signature not valid : "<<&(nam.ToCString())[paro]<<endl;
- disp.Nullify();
- return disp;
- }
- if (mode) ds->SetSignCounter (new IFSelect_SignCounter(sg));
- return ds;
- }
- sout<<"Dispatch : "<<name<<" , Parameter : "<<&(nam.ToCString())[paro]<<endl;
- return disp;
-}
-
-
-// #########################################
-// #### INITIALISATIONS ####
-// #########################################
-
-static int initactor = 0;
-
-
- void IFSelect_Functions::Init ()
-{
- if (initactor) return; initactor = 1;
- IFSelect_Act::SetGroup("DE: General");
- IFSelect_Act::AddFunc("xstatus","Lists XSTEP Status : Version, System Name ...",funstatus);
- IFSelect_Act::AddFunc("handler","Toggle status catch Handler Error of the session",fun1);
- IFSelect_Act::AddFunc("xload","file:string : Read File -> Load Model",fun3);
- IFSelect_Act::AddFunc("xread","file:string : Read File -> Load Model",fun3);
- IFSelect_Act::AddFunc("writeall","file:string : Write all model (no split)",fun4);
- IFSelect_Act::AddFunc("writesel","file:string sel:Selection : Write Selected (no split)",fun5);
- IFSelect_Act::AddFunc("writeent","file:string n1ent n2ent...:integer : Write Entite(s) (no split)",fun6);
- IFSelect_Act::AddFunc("writent", "file:string n1ent n2ent...:integer : Write Entite(s) (no split)",fun6);
- IFSelect_Act::AddFunc("elabel","nument:integer : Displays Label Model of an entity",fun7);
- IFSelect_Act::AddFunc("enum","label:string : Displays entities n0.s of which Label Model ends by..",fun8);
-
- IFSelect_Act::AddFunc("listtypes","List nb entities per type. Optional selection name else all model",fun9);
- IFSelect_Act::AddFunc("count","Count : counter [selection]",funcount);
- IFSelect_Act::AddFunc("listcount","List Counted : counter [selection [nument]]",funcount);
- IFSelect_Act::AddFunc("sumcount","Summary Counted : counter [selection [nument]]",funcount);
- IFSelect_Act::AddFunc("signtype","Sign Type [newone]",funsigntype);
- IFSelect_Act::AddFunc("signcase","signature : displays possible cases",funsigncase);
-
- IFSelect_Act::AddFunc("estatus","ent/nument : displays status of an entity",fun10);
- IFSelect_Act::AddFunc("data","Data (DumpModel); whole help : data tout court",fun11);
- IFSelect_Act::AddFunc("entity","give n0 ou id of entity [+ level]",fundumpent);
- IFSelect_Act::AddFunc("signature","signature name + n0/ident entity",funsign);
- IFSelect_Act::AddFunc("queryparent"," give 2 n0s/labels of entities : dad son",funqp);
-
- IFSelect_Act::AddFunc("dumpshare","Dump Share (dispatches, IntParams)",fun12);
- IFSelect_Act::AddFunc("listitems","List Items [label else all] ->Type,Label[,Name]",fun13);
- IFSelect_Act::AddFSet("integer","value:integer : cree un IntParam",fun14);
- IFSelect_Act::AddFunc("setint","name:IntParam newValue:integer : Change valeur IntParam",fun15);
- IFSelect_Act::AddFSet("text","value:string : cree un TextParam",fun16);
- IFSelect_Act::AddFunc("settext","Name:TextParam newValue:string : Change valeur TextParam",fun17);
- IFSelect_Act::AddFunc("dumpsel","Dump Selection suivi du Nom de la Selection a dumper",fun19);
- IFSelect_Act::AddFunc("evalsel","name:Selection [num/sel] : Evalue une Selection",fun20);
- IFSelect_Act::AddFunc("givelist","num/sel [num/sel ...] : Evaluates GiveList",fun20);
- IFSelect_Act::AddFunc("giveshort","num/sel [num/sel ...] : GiveList in short form",fun20);
- IFSelect_Act::AddFunc("givepointed","num/sel [num/sel ...] : GiveList to fill a SelectPointed",fun20);
- IFSelect_Act::AddFunc("makelist","listname [givelist] : Makes a List(SelectPointed) from GiveList",fun20);
- IFSelect_Act::AddFunc("givecount","num/sel [num/sel ...] : Counts GiveList",fun20c);
- IFSelect_Act::AddFSet("selsuite","sel sel ... : Creates a SelectSuite",funselsuite);
- IFSelect_Act::AddFunc("clearitems","Clears all items (selections, dispatches, etc)",fun21);
- IFSelect_Act::AddFunc("cleardata","mode:a-g-c-p : Clears all or some data (model, check...)",fun22);
-
- IFSelect_Act::AddFunc("itemlabel","xxx xxx : liste items having this label",fun24);
- IFSelect_Act::AddFunc("xsave","filename:string : sauve items-session",fun25);
- IFSelect_Act::AddFunc("xrestore","filename:string : restaure items-session",fun26);
- IFSelect_Act::AddFunc("param","nompar:string : displays parameter value; + nompar val : changes it",fun27);
- IFSelect_Act::AddFunc("defparam","nompar:string : display def. param; also : nompar edit, nompar init",fun28);
-
- IFSelect_Act::AddFunc("sentfiles","Lists files sent from last Load",fun29);
- IFSelect_Act::AddFunc("fileprefix","prefix:string : definit File Prefix",fun30);
- IFSelect_Act::AddFunc("fileext","extent:string : definit File Extension",fun31);
- IFSelect_Act::AddFunc("fileroot","disp:Dispatch root:string : definit File Root sur un Dispatch",fun32);
- IFSelect_Act::AddFunc("filedef","defroot:string : definit File DefaultRoot",fun33);
- IFSelect_Act::AddFunc("evalfile","Evaluation du FileNaming et memorisation",fun34);
- IFSelect_Act::AddFunc("clearfile","Efface la liste d'EvalFile",fun35);
- IFSelect_Act::AddFunc("xsplit","[disp:Dispatch sinon tout] : Split, la grande affaire !",fun36);
- IFSelect_Act::AddFunc("remaining","options... : Remaining Entities, help complet par remaining ?",fun37);
- IFSelect_Act::AddFunc("setcontent","sel:Selection mode:k ou r : Restreint contenu du modele",fun38);
-
- IFSelect_Act::AddFunc("listmodif","List Final Modifiers",fun40);
- IFSelect_Act::AddFunc("dumpmodif","modif:Modifier : Affiche le Statut d'un Modifier",fun41);
- IFSelect_Act::AddFunc("modifsel","modif:Modifier [sel:Selection] : Change/Annule Selection de Modifier",fun42);
- IFSelect_Act::AddFunc("setapplied","modif:Modifier [name:un item sinon sortie fichier] : Applique un Modifier",fun43);
- IFSelect_Act::AddFunc("resetapplied","modif:Modifier : Enleve un Modifier de la sortie fichier",fun44);
- IFSelect_Act::AddFunc("modifmove","modif:Modifier M(model)/F(file) avant,apres:integer : Deplace un Modifier (sortie fichier)",fun45);
-
- IFSelect_Act::AddFunc("dispsel","disp:Dispatch sel:Selection -> Selection Finale de Dispatch",fun51);
- IFSelect_Act::AddFSet("dispone","cree DispPerOne",fun_dispone);
- IFSelect_Act::AddFSet("dispglob","cree DispGlobal",fun_dispglob);
- IFSelect_Act::AddFSet("dispcount","count:IntParam : cree DispPerCount",fun_dispcount);
- IFSelect_Act::AddFSet("dispfile","files:IntParam : cree DispPerFiles",fun_dispfiles);
- IFSelect_Act::AddFSet("dispsign","sign:Signature : cree DispPerSignature",fun_dispsign);
- IFSelect_Act::AddFunc("dumpdisp","disp:Dispatch : Affiche le Statut d'un Dispatch",fun56);
-
- IFSelect_Act::AddFunc("xremove","nom : Remove a Control Item de la Session",fun57);
- IFSelect_Act::AddFunc("evaldisp","mode=[0-3] disp:Dispatch : Evaluates one or more Dispatch(es)",fun58);
- IFSelect_Act::AddFunc("evaladisp","mode=[0-3] disp:Dispatch [givelist] : Evaluates a Dispatch (on a GiveList)",fun_evaladisp);
- IFSelect_Act::AddFunc("writedisp","filepattern disp:Dispatch [givelist] : Writes Entities by Splitting by a Dispatch",fun_writedisp);
- IFSelect_Act::AddFunc("evalcomplete","Evaluation Complete de la Repartition",fun59);
-
- IFSelect_Act::AddFunc("runcheck","affiche LastRunCheckList (write,modif)",fun60);
- IFSelect_Act::AddFunc("runtranformer","transf:Transformer : Applique un Transformer",fun61);
- IFSelect_Act::AddFSet("copy","cree TransformStandard, option Copy, vide",fun62);
- IFSelect_Act::AddFSet("onthespot","cree TransformStandard, option OntheSpot, vide",fun63);
- IFSelect_Act::AddFunc("runcopy","modif:ModelModifier [givelist] : Run <modif> via TransformStandard option Copy",fun6465);
- IFSelect_Act::AddFunc("runonthespot","modif:ModelModifier [givelist] : Run <modif> via TransformStandard option OnTheSpot",fun6465);
- IFSelect_Act::AddFSet("reorder","[f ou t] reordonne le modele",fun66);
-
- IFSelect_Act::AddFunc("toggle","sel:Selection genre Extract : Toggle Direct/Reverse",fun70);
- IFSelect_Act::AddFunc("input","sel:Selection genre Deduct ou Extract input:Selection : Set Input",fun71);
- IFSelect_Act::AddFSet("modelroots","cree SelectModelRoots",fun72);
- IFSelect_Act::AddFSet("range","options... : cree SelectRange ...; tout court pour help",fun73);
- IFSelect_Act::AddFSet("roots","cree SelectRoots (local roots)",fun74);
- IFSelect_Act::AddFSet("shared","cree SelectShared",fun75);
- IFSelect_Act::AddFSet("diff","[main:Selection diff:Selection] : cree SelectDiff",fun76);
- IFSelect_Act::AddFunc("selmain","sel:Selection genre Control main:Selection : Set Main Input",fun77);
- IFSelect_Act::AddFunc("selsecond","sel:Selection genre Control sec:Selection : Set Second Input",fun78);
- IFSelect_Act::AddFSet("modelall","cree SelectModelAll",fun79);
- IFSelect_Act::AddFunc("seladd","sel:Selection genre Combine input:Selection : Add Selection",fun80);
- IFSelect_Act::AddFunc("selrem","sel:Selection genre Combine input:Selection : Remove Selection",fun81);
- IFSelect_Act::AddFSet("number","num:IntParam : Cree SelectEntityNumber",fun82);
-
- IFSelect_Act::AddFSet("union","cree SelectUnion (vide), cf aussi combadd, combrem",fun83);
- IFSelect_Act::AddFSet("intersect","cree SelectIntersection (vide), cf aussi combadd, combrem",fun84);
- IFSelect_Act::AddFSet("typexact","type:string : cree SelectTextType Exact",fun85);
- IFSelect_Act::AddFSet("errors","cree SelectErrorEntities (from file)",fun86);
- IFSelect_Act::AddFSet("unknown","cree SelectUnknownEntities",fun87);
- IFSelect_Act::AddFSet("sharing","cree SelectSharing",fun88);
- IFSelect_Act::AddFSet("typecontain","type:string : cree SelectTextType Contains",fun89);
- IFSelect_Act::AddFSet("pointed","cree SelectPointed [num/sel num/sel]",fun90);
- IFSelect_Act::AddFunc("setpointed","sel:SelectPointed : edition SelectPointed. tout court pour help",fun91);
- IFSelect_Act::AddFunc("setlist","sel:SelectPointed : edition SelectPointed. tout court pour help",fun91);
- IFSelect_Act::AddFSet("incorrect","cree SelectIncorrectEntities (computed)",fun92);
-
- IFSelect_Act::AddFSet("signsel","sign:Signature|cnt:Counter text:string [e(D)|c] : cree SelectSignature",fun93);
- IFSelect_Act::AddFSet("signcounter","sign:Signature : cree SignCounter",fun94);
- IFSelect_Act::AddFSet("nbselected","applied:Selection : cree GraphCounter(=NbSelected)",funbselected);
-
- IFSelect_Act::AddFunc("editlist","editor or editform : lists defs + values",fun_editlist);
- IFSelect_Act::AddFunc("editvalue","editform paramname [newval or .] : lists-changes a value",fun_editvalue);
- IFSelect_Act::AddFunc("editclear","editform [paramname] : clears edition on all or one param",fun_editclear);
- IFSelect_Act::AddFunc("editload","editform [entity-id] : loads from model or an entity",fun_editload);
- IFSelect_Act::AddFunc("editapply","editform [keep] : applies on loaded data",fun_editapply);
-}
+++ /dev/null
-// Created on: 1993-07-28
-// 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_Functions_HeaderFile
-#define _IFSelect_Functions_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Standard_CString.hxx>
-#include <Standard_Integer.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <Standard_Boolean.hxx>
-class Standard_Transient;
-class IFSelect_WorkSession;
-class IFSelect_Dispatch;
-
-
-//! Functions gives access to all the actions which can be
-//! commanded with the resources provided by IFSelect : especially
-//! WorkSession and various types of Selections and Dispatches
-//!
-//! It works by adding functions by method Init
-class IFSelect_Functions
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- //! Takes the name of an entity, either as argument, or (if <name>
- //! is empty) on keybord, and returns the entity
- //! name can be a label or a number (in alphanumeric), it is
- //! searched by NumberFromLabel from WorkSession.
- //! If <name> doesn't match en entity, a Null Handle is returned
- Standard_EXPORT static Handle(Standard_Transient) GiveEntity (const Handle(IFSelect_WorkSession)& WS, const Standard_CString name = "");
-
- //! Same as GetEntity, but returns the number in the model of the
- //! entity. Returns 0 for null handle
- Standard_EXPORT static Standard_Integer GiveEntityNumber (const Handle(IFSelect_WorkSession)& WS, const Standard_CString name = "");
-
- //! Computes a List of entities from a WorkSession and two idents,
- //! first and second, as follows :
- //! if <first> is a Number or Label of an entity : this entity
- //! if <first> is the name of a Selection in <WS>, and <second>
- //! not defined, the standard result of this Selection
- //! if <first> is for a Selection and <second> is defined, the
- //! standard result of this selection from the list computed
- //! with <second> (an entity or a selection)
- //! If <second> is erroneous, it is ignored
- Standard_EXPORT static Handle(TColStd_HSequenceOfTransient) GiveList (const Handle(IFSelect_WorkSession)& WS, const Standard_CString first = "", const Standard_CString second = "");
-
- //! Evaluates and returns a Dispatch, from data of a WorkSession
- //! if <mode> is False, searches for exact name of Dispatch in WS
- //! Else (D), allows a parameter between brackets :
- //! ex.: dispatch_name(parameter)
- //! The parameter can be: an integer for DispPerCount or DispPerFiles
- //! or the name of a Signature for DispPerSignature
- //! Returns Null Handle if not found not well evaluated
- Standard_EXPORT static Handle(IFSelect_Dispatch) GiveDispatch (const Handle(IFSelect_WorkSession)& WS, const Standard_CString name, const Standard_Boolean mode = Standard_True);
-
- //! Defines and loads all basic functions (as ActFunc)
- Standard_EXPORT static void Init();
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IFSelect_Functions_HeaderFile
//! package IFAdapt, EntityModifier and EntityCopier
class IFSelect_GeneralModifier : public MMgt_TShared
{
+ public:
-public:
-
-
//! Returns True if this modifier may change the graph of
//! dependences (aknowledged at creation time)
Standard_EXPORT Standard_Boolean MayChangeGraph() const;
//! Returns a short text which defines the operation performed
Standard_EXPORT virtual TCollection_AsciiString Label() const = 0;
-
-
-
DEFINE_STANDARD_RTTIEXT(IFSelect_GeneralModifier,MMgt_TShared)
-protected:
+ protected:
-
//! Sets the Modifier criteria to default Values
//! (i.e. "always applies")
//! <maychangegraph> must be provided at creation time, to :
//! dependencies when this modifier is applied
Standard_EXPORT IFSelect_GeneralModifier(const Standard_Boolean maychangegraph);
-
-
-private:
-
+ private:
Handle(IFSelect_Selection) thesel;
Handle(IFSelect_Dispatch) thedisp;
Standard_Boolean thechgr;
-
-
};
-
-
-
-
-
-
#endif // _IFSelect_GeneralModifier_HeaderFile
// commercial license or contractual agreement.
-#include <IFGraph_Cumulate.hxx>
#include <IFSelect_SelectCombine.hxx>
#include <IFSelect_Selection.hxx>
#include <IFSelect_SelectionIterator.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(); }
#include <IFSelect_Selection.hxx>
#include <IFSelect_SessionPilot.hxx>
#include <IFSelect_SignCounter.hxx>
-#include <IFSelect_WorkLibrary.hxx>
#include <IFSelect_WorkSession.hxx>
#include <Interface_EntityIterator.hxx>
#include <Interface_InterfaceModel.hxx>
}
- Handle(IFSelect_WorkSession) IFSelect_SessionPilot::Session () const
- { return thesession; }
-
- Handle(IFSelect_WorkLibrary) IFSelect_SessionPilot::Library () const
- { return thesession->WorkLibrary(); }
-
- Standard_Boolean IFSelect_SessionPilot::RecordMode () const
- { return therecord; }
-
- void IFSelect_SessionPilot::SetSession
- (const Handle(IFSelect_WorkSession)& WS)
- { thesession = WS; }
-
- void IFSelect_SessionPilot::SetLibrary
- (const Handle(IFSelect_WorkLibrary)& WL)
- { if (!thesession.IsNull()) thesession->SetLibrary(WL); }
-
- void IFSelect_SessionPilot::SetRecordMode (const Standard_Boolean mode)
- { therecord = mode; }
-
-
void IFSelect_SessionPilot::SetCommandLine
(const TCollection_AsciiString& command)
{
#endif
thenbwords ++;
}
-/*
- aligner sur MAXWORDS
- char l0[80],l1[80],l2[80],l3[80],l4[80],l5[80],l6[80],l7[80],l8[80],l9[80];
- char m0[80],m1[80],m2[80],m3[80],m4[80],m5[80],m6[80],m7[80],m8[80],m9[80];
- thenbwords = sscanf
- (thecommand.ToCString(),"%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
- l0,l1,l2,l3,l4,l5,l6,l7,l8,l9,m0,m1,m2,m3,m4,m5,m6,m7,m8,m9);
- if (thenbwords < 0) thenbwords = 0;
- if (thenbwords > MAXWORDS) thenbwords = MAXWORDS;
- Standard_Integer nb = thewords.Upper();
- for (i = 0; i <= nb; i ++) thewords(i).Clear();
- switch (thenbwords) {
- case 20 : thewords(19).AssignCat(m9);
- case 19 : thewords(18).AssignCat(m8);
- case 18 : thewords(17).AssignCat(m7);
- case 17 : thewords(16).AssignCat(m6);
- case 16 : thewords(15).AssignCat(m5);
- case 15 : thewords(14).AssignCat(m4);
- case 14 : thewords(13).AssignCat(m3);
- case 13 : thewords(12).AssignCat(m2);
- case 12 : thewords(11).AssignCat(m1);
- case 11 : thewords(10).AssignCat(m0);
- case 10 : thewords(9).AssignCat(l9);
- case 9 : thewords(8).AssignCat(l8);
- case 8 : thewords(7).AssignCat(l7);
- case 7 : thewords(6).AssignCat(l6);
- case 6 : thewords(5).AssignCat(l5);
- case 5 : thewords(4).AssignCat(l4);
- case 4 : thewords(3).AssignCat(l3);
- case 3 : thewords(2).AssignCat(l2);
- case 2 : thewords(1).AssignCat(l1);
- case 1 : thewords(0).AssignCat(l0);
- default : break;
- }
-*/
thenumrec = 0;
theobjrec.Nullify();
}
- const TCollection_AsciiString& IFSelect_SessionPilot::CommandLine () const
- { return thecommand; }
-
Standard_CString IFSelect_SessionPilot::CommandPart
(const Standard_Integer numarg) const
{
return &(thecommand.ToCString())[thewordeb(numarg)-1];
}
- Standard_Integer IFSelect_SessionPilot::NbWords () const
- { return thenbwords; }
-
const TCollection_AsciiString& IFSelect_SessionPilot::Word
(const Standard_Integer num) const
{ if (num < thenbwords) return thewords(num); return nulword; }
return Standard_True;
}
- Standard_Integer IFSelect_SessionPilot::NbCommands () const
- { return thecomlist.Length(); }
-
- const TCollection_AsciiString& IFSelect_SessionPilot::Command
- (const Standard_Integer num) const
- { return thecomlist(num); }
-
-
IFSelect_ReturnStatus IFSelect_SessionPilot::RecordItem
(const Handle(Standard_Transient)& item)
{
return (item.IsNull() ? IFSelect_RetFail : IFSelect_RetDone);
}
- Handle(Standard_Transient) IFSelect_SessionPilot::RecordedItem () const
- { return theobjrec; }
-
- void IFSelect_SessionPilot::Clear ()
- { thecomlist.Clear(); }
-
-
// #######################################################################
// ######## CONTROLE D EXECUTION
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
-#include <Standard_Integer.hxx>
#include <TColStd_Array1OfAsciiString.hxx>
#include <TColStd_Array1OfInteger.hxx>
-#include <Standard_Boolean.hxx>
#include <TColStd_SequenceOfAsciiString.hxx>
#include <IFSelect_Activator.hxx>
-#include <Standard_CString.hxx>
#include <IFSelect_ReturnStatus.hxx>
#include <IFSelect_PrintCount.hxx>
class IFSelect_WorkSession;
-class Standard_Transient;
-class IFSelect_WorkLibrary;
-class TCollection_AsciiString;
class IFSelect_SignCounter;
//! are skipped (comment lines are display if read from file)
class IFSelect_SessionPilot : public IFSelect_Activator
{
-
-public:
-
+ public:
//! Creates an empty SessionPilot, with a prompt which will be
//! displayed on querying commands. If not precised (""), this
Standard_EXPORT IFSelect_SessionPilot(const Standard_CString prompt = "");
//! Returns the WorkSession which is worked on
- Standard_EXPORT Handle(IFSelect_WorkSession) Session() const;
-
- //! Returns the WorKlibrary (Null if not set). WorkLibrary is used
- //! to Read and Write Files, according to the Norm
- Standard_EXPORT Handle(IFSelect_WorkLibrary) Library() const;
+ const Handle(IFSelect_WorkSession) & Session() const { return thesession; }
//! Returns the Record Mode for Commands. Default is False.
- Standard_EXPORT Standard_Boolean RecordMode() const;
+ Standard_Boolean RecordMode() const { return therecord; }
//! Sets a WorkSession to be worked on
- Standard_EXPORT void SetSession (const Handle(IFSelect_WorkSession)& WS);
-
- //! Sets a WorkLibrary
- Standard_EXPORT void SetLibrary (const Handle(IFSelect_WorkLibrary)& WL);
+ void SetSession (const Handle(IFSelect_WorkSession)& WS) { thesession = WS; }
//! Changes the RecordMode.
- Standard_EXPORT void SetRecordMode (const Standard_Boolean mode);
+ void SetRecordMode (const Standard_Boolean mode) { therecord = mode; }
//! Sets the value of the Command Line to be interpreted
//! Also prepares the interpretation (splitting by blanks)
Standard_EXPORT void SetCommandLine (const TCollection_AsciiString& command);
//! Returns the Command Line to be interpreted
- Standard_EXPORT const TCollection_AsciiString& CommandLine() const;
+ const TCollection_AsciiString& CommandLine() const { return thecommand; }
//! Returns the part of the command line which begins at argument
//! <numarg> between 0 and NbWords-1 (by default, all the line)
//! blanks : 0 if empty, one if a command without args, else it
//! gives the count of args minus one.
//! Warning : limited to 10 (command title + 9 args)
- Standard_EXPORT Standard_Integer NbWords() const;
+ Standard_Integer NbWords() const { return thenbwords; }
//! Returns a word given its rank in the Command Line. Begins at 0
//! which is the Command Title, 1 is the 1st arg., etc...
Standard_EXPORT Standard_Boolean RemoveWord (const Standard_Integer num);
//! Returns the count of recorded Commands
- Standard_EXPORT Standard_Integer NbCommands() const;
-
+ Standard_Integer NbCommands() const { return thecomlist.Length(); }
+
//! Returns a recorded Command, given its rank (from 1)
- Standard_EXPORT const TCollection_AsciiString& Command (const Standard_Integer num) const;
+ const TCollection_AsciiString& Command (const Standard_Integer num) const { return thecomlist(num); }
//! Allows to associate a Transient Value with the last execution
//! as a partial result
//! Returns the Transient Object which was recorded with the
//! current Line Command. If none was, returns a Null Handle
- Standard_EXPORT Handle(Standard_Transient) RecordedItem() const;
-
+ const Handle(Standard_Transient) & RecordedItem() const { return theobjrec; }
+
//! Clears the recorded informations (commands, objects)
- Standard_EXPORT void Clear();
+ void Clear() { thecomlist.Clear(); }
//! Reads commands from a Script File, named <file>. By default
//! (file = ""), reads from standard input with a prompt
Standard_Integer thenumrec;
Handle(Standard_Transient) theobjrec;
TColStd_SequenceOfAsciiString thecomlist;
-
-
};
-
-
-
-
-
-
#endif // _IFSelect_SessionPilot_HeaderFile
Interface_EntityIterator IFSelect_ShareOutResult::PacketContent ()
{
-// IFGraph_Cumulate G(thegraph);
Interface_EntityIterator iter = thedispres.Entities();
Interface_Graph G(thegraph);
// G.GetFromIter(thedispres.Entities(),0);
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,
//! kind of informations relevant for the norm,
class IFSelect_WorkLibrary : public Standard_Transient
{
-
-public:
-
+ 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
//! 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:
-
+ protected:
//! Required to initialise fields
- Standard_EXPORT IFSelect_WorkLibrary();
-
-
-
-private:
+ IFSelect_WorkLibrary() : thelevdef(0) {}
+ private:
Standard_Integer thelevdef;
Handle(Interface_HArray1OfHAsciiString) thelevhlp;
-
-
};
-
-
-
-
-
-
#endif // _IFSelect_WorkLibrary_HeaderFile
#include <IFGraph_SubPartsIterator.hxx>
#include <IFSelect_CheckCounter.hxx>
#include <IFSelect_Dispatch.hxx>
-#include <IFSelect_DispGlobal.hxx>
-#include <IFSelect_DispPerCount.hxx>
-#include <IFSelect_DispPerOne.hxx>
#include <IFSelect_EditForm.hxx>
#include <IFSelect_Editor.hxx>
#include <IFSelect_GeneralModifier.hxx>
}
-//=======================================================================
-//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 :
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();
}
-//=======================================================================
-//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 ....
//! 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 informations are lost)
Standard_EXPORT void ClearFile();
//! 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
IGESControl_AlgoContainer.hxx
IGESControl_Controller.cxx
IGESControl_Controller.hxx
+IGESControl_FloatFormat.cxx
+IGESControl_FloatFormat.hxx
IGESControl_IGESBoundary.cxx
IGESControl_IGESBoundary.hxx
IGESControl_Reader.cxx
IGESControl_Reader.lxx
IGESControl_ToolContainer.cxx
IGESControl_ToolContainer.hxx
+IGESControl_WorkLibrary.cxx
+IGESControl_WorkLibrary.hxx
IGESControl_Writer.cxx
IGESControl_Writer.hxx
#include <Transfer_Binder.hxx>
#include <Transfer_Finder.hxx>
#include <Transfer_FinderProcess.hxx>
-//szv_c1:#include <Transfer_TransientMapper.hxx>
+#include <Transfer_SimpleBinderOfTransient.hxx>
#include <TransferBRep_ShapeMapper.hxx>
#include <XSAlgo.hxx>
#include <XSAlgo_AlgoContainer.hxx>
{
DeclareAndCast(TransferBRep_ShapeMapper,shmap,start);
if (!shmap.IsNull()) return Standard_True;
- /*szv_c1:DeclareAndCast(Transfer_TransientMapper,gemap,start);
- if (!gemap.IsNull()) {
- Handle(Standard_Transient) geom = gemap->Value();
- DeclareAndCast(Geom_Curve,Curve,geom);
- DeclareAndCast(Geom_Surface,Surf,geom);*/
- DeclareAndCast(Geom_Curve,Curve,start);
- DeclareAndCast(Geom_Surface,Surf,start);
- if (!Curve.IsNull() || !Surf.IsNull()) return Standard_True;
- //szv_c1:}
+ DeclareAndCast(Geom_Curve,Curve,start);
+ DeclareAndCast(Geom_Surface,Surf,start);
+ if (!Curve.IsNull() || !Surf.IsNull()) return Standard_True;
return Standard_False;
}
-Handle(Transfer_Binder) IGESControl_ActorWrite::Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_ProcessForFinder)& TP)
+Handle(Transfer_Binder) IGESControl_ActorWrite::Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_Process)& TP)
{
XSAlgo::AlgoContainer()->PrepareForTransfer();
XSAlgo::AlgoContainer()->MergeTransferInfo(FP, info);
if (!ent.IsNull()) return new Transfer_SimpleBinderOfTransient(ent);
}
- /*szv_c1:DeclareAndCast(Transfer_TransientMapper,gemap,start);
- if (!gemap.IsNull()) {
- Handle(Standard_Transient) geom = gemap->Value();
- DeclareAndCast(Geom_Curve,Curve,geom);
- DeclareAndCast(Geom_Surface,Surf,geom);*/
- DeclareAndCast(Geom_Curve,Curve,start);
- DeclareAndCast(Geom_Surface,Surf,start);
+
+ DeclareAndCast(Geom_Curve,Curve,start);
+ DeclareAndCast(Geom_Surface,Surf,start);
// On reconnait : Curve et Surface de Geom
// quid de Point; Geom2d ?
- GeomToIGES_GeomCurve GC; GC.SetModel(modl);
- GeomToIGES_GeomSurface GS; GS.SetModel(modl);
- if (!Curve.IsNull())
- ent = GC.TransferCurve(Curve,Curve->FirstParameter(),Curve->LastParameter());
- else if (!Surf.IsNull()) {
- Standard_Real U1,U2,V1,V2;
- Surf->Bounds(U1,U2,V1,V2);
- ent = GS.TransferSurface(Surf,U1,U2,V1,V2);
- }
- if (!ent.IsNull()) return new Transfer_SimpleBinderOfTransient(ent);
- //szv_c1:}
+ GeomToIGES_GeomCurve GC; GC.SetModel(modl);
+ GeomToIGES_GeomSurface GS; GS.SetModel(modl);
+ if (!Curve.IsNull())
+ ent = GC.TransferCurve(Curve,Curve->FirstParameter(),Curve->LastParameter());
+ else if (!Surf.IsNull()) {
+ Standard_Real U1,U2,V1,V2;
+ Surf->Bounds(U1,U2,V1,V2);
+ ent = GS.TransferSurface(Surf,U1,U2,V1,V2);
+ }
+ if (!ent.IsNull()) return new Transfer_SimpleBinderOfTransient(ent);
return NULL;
}
IGESControl_ActorWrite() {}
//! Recognizes a ShapeMapper
- Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Standard_Transient)& start) Standard_OVERRIDE;
+ Standard_EXPORT Standard_Boolean Recognize (const Handle(Standard_Transient)& start) Standard_OVERRIDE;
//! Transfers Shape to IGES Entities
//!
//! ModeTrans may be : 0 -> groups of Faces
//! or 1 -> BRep
- Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_ProcessForFinder)& FP) Standard_OVERRIDE;
+ Standard_EXPORT Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_Process)& FP) Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(IGESControl_ActorWrite,Transfer_ActorOfFinderProcess)
};
//#58 rln 28.12.98 changing default values for Global Section
//sln 14.01.2002 OCC51 : verifying whether entry model of method ActorRead is IGESDatat_IGESModel
-#include <IFSelect_EditForm.hxx>
-#include <IFSelect_SelectModelEntities.hxx>
-#include <IFSelect_SelectModelRoots.hxx>
-#include <IFSelect_SelectType.hxx>
-#include <IFSelect_SignCounter.hxx>
-#include <IFSelect_SignMultiple.hxx>
-#include <IFSelect_SignType.hxx>
-#include <IGESAppli.hxx>
-#include <IGESBasic_SubfigureDef.hxx>
-#include <IGESControl_ActorWrite.hxx>
#include <IGESControl_AlgoContainer.hxx>
#include <IGESControl_Controller.hxx>
+#include <IGESData.hxx>
#include <IGESData_IGESModel.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>
-#include <IGESSelect_IGESName.hxx>
-#include <IGESSelect_IGESTypeForm.hxx>
-#include <IGESSelect_RemoveCurves.hxx>
-#include <IGESSelect_SelectBasicGeom.hxx>
-#include <IGESSelect_SelectBypassGroup.hxx>
-#include <IGESSelect_SelectBypassSubfigure.hxx>
-#include <IGESSelect_SelectFaces.hxx>
-#include <IGESSelect_SelectPCurves.hxx>
-#include <IGESSelect_SelectSubordinate.hxx>
-#include <IGESSelect_SelectVisibleStatus.hxx>
-#include <IGESSelect_SetGlobalParameter.hxx>
-#include <IGESSelect_SetLabel.hxx>
-#include <IGESSelect_SignColor.hxx>
-#include <IGESSelect_SignLevelNumber.hxx>
-#include <IGESSelect_SignStatus.hxx>
-#include <IGESSelect_UpdateFileName.hxx>
-#include <IGESSelect_WorkLibrary.hxx>
+#include <IGESData_FileProtocol.hxx>
+#include <IGESControl_WorkLibrary.hxx>
+#include <IGESAppli.hxx>
+#include <IGESAppli_Protocol.hxx>
#include <IGESSolid.hxx>
+#include <IGESSolid_Protocol.hxx>
#include <IGESToBRep.hxx>
#include <IGESToBRep_Actor.hxx>
-#include <Interface_InterfaceModel.hxx>
+#include <IGESControl_ActorWrite.hxx>
#include <Interface_Macros.hxx>
#include <Interface_Static.hxx>
-#include <Standard_Type.hxx>
#include <TCollection_HAsciiString.hxx>
#include <TopoDS_Shape.hxx>
-#include <Transfer_ActorOfTransientProcess.hxx>
-#include <Transfer_FinderProcess.hxx>
#include <XSAlgo.hxx>
-#include <XSControl_SelectForTransfer.hxx>
#include <XSControl_WorkSession.hxx>
IMPLEMENT_STANDARD_RTTIEXT(IGESControl_Controller,XSControl_Controller)
{
static Standard_Boolean init = Standard_False;
if (!init) {
+ init = Standard_True;
IGESSolid::Init();
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 ("write.iges.unit",6);
TraceStatic ("write.iges.brep.mode",6);
- myAdaptorLibrary = new IGESSelect_WorkLibrary(themode);
- myAdaptorProtocol = IGESSelect_WorkLibrary::DefineProtocol();
+ myAdaptorLibrary = new IGESControl_WorkLibrary(themode);
+ myAdaptorProtocol = DefineProtocol();
Handle(IGESToBRep_Actor) anactiges = new IGESToBRep_Actor;
anactiges->SetContinuity(0);
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
Handle(Interface_InterfaceModel) IGESControl_Controller::NewModel () const
{
// On prend un modele qu on prepare avec les statiques enregistres
- DeclareAndCast(IGESData_IGESModel,igm,Interface_InterfaceModel::Template("iges"));
+ Handle(IGESData_IGESModel) igm = IGESData::NewModel();
IGESData_GlobalSection GS = igm->GlobalSection();
GS.SetReceiveName (Interface_Static::Static("write.iges.header.receiver")->HStringValue());
//purpose :
//=======================================================================
-Standard_Boolean IGESControl_Controller::Init ()
+void IGESControl_Controller::Init ()
{
static Standard_Boolean inic = Standard_False;
if (!inic) {
+ inic = Standard_True;
Handle(IGESControl_Controller) ADIGES = new IGESControl_Controller(Standard_False);
ADIGES->AutoRecord();
XSAlgo::Init();
IGESToBRep::Init();
IGESToBRep::SetAlgoContainer (new IGESControl_AlgoContainer());
- inic = Standard_True;
}
- return Standard_True;
+}
+
+//=======================================================================
+//function : Init
+//purpose :
+//=======================================================================
+
+const Handle(IGESData_Protocol) & IGESControl_Controller::DefineProtocol ()
+{
+ static Handle(IGESData_FileProtocol) gIGESProto;
+ if (gIGESProto.IsNull()) {
+ Handle(IGESData_Protocol) aIGESProto1 = IGESSolid::Protocol();
+ Handle(IGESData_Protocol) aIGESProto2 = IGESAppli::Protocol();
+ gIGESProto = new IGESData_FileProtocol;
+ gIGESProto->Add(aIGESProto1);
+ gIGESProto->Add(aIGESProto2);
+ }
+ return gIGESProto;
}
class TopoDS_Shape;
class Transfer_FinderProcess;
class XSControl_WorkSession;
+class IGESData_Protocol;
class IGESControl_Controller;
{
public:
- //! Initializes the use of IGES Norm (the first time) and returns
- //! a Controller for IGES-5.1
- //! If <modefnes> is True, sets it to internal FNES format
- Standard_EXPORT IGESControl_Controller(const Standard_Boolean modefnes = Standard_False);
-
//! Creates a new empty Model ready to receive data of the Norm.
//! It is taken from IGES Template Model
Standard_EXPORT Handle(Interface_InterfaceModel) NewModel() const Standard_OVERRIDE;
//! records it to various names, available to select it later
//! 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 static void Init();
- Standard_EXPORT virtual void Customise (Handle(XSControl_WorkSession)& WS) Standard_OVERRIDE;
+ //! Defines a protocol to be adequate for IGES
+ //! (encompasses ALL the IGES norm including IGESSolid, IGESAppli)
+ Standard_EXPORT static const Handle(IGESData_Protocol) & DefineProtocol();
DEFINE_STANDARD_RTTIEXT(IGESControl_Controller,XSControl_Controller)
- private:
+ protected:
+
+ //! Initializes the use of IGES Norm (the first time) and returns
+ //! a Controller for IGES-5.1
+ //! If <modefnes> is True, sets it to internal FNES format
+ Standard_EXPORT IGESControl_Controller(const Standard_Boolean modefnes = Standard_False);
Standard_Boolean themode;
};
--- /dev/null
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#include <IGESControl_FloatFormat.hxx>
+#include <IGESData_IGESWriter.hxx>
+#include <Interface_FloatWriter.hxx>
+
+#include <stdio.h>
+IMPLEMENT_STANDARD_RTTIEXT(IGESControl_FloatFormat,IFSelect_GeneralModifier)
+
+IGESControl_FloatFormat::IGESControl_FloatFormat ()
+: IFSelect_GeneralModifier (Standard_False),
+ thezerosup (Standard_True) , themainform ("%E") ,
+ theformrange ("%f") , therangemin (0.1) , therangemax (1000.)
+{}
+
+void IGESControl_FloatFormat::SetDefault (const Standard_Integer digits)
+{
+ themainform.Clear();
+ theformrange.Clear();
+ if (digits <= 0) {
+ themainform.AssignCat ("%E");
+ theformrange.AssignCat ("%f");
+ } else {
+ char format[20];
+ char pourcent = '%'; char point = '.';
+ Sprintf(format, "%c%d%c%dE",pourcent,digits+2,point,digits);
+ themainform.AssignCat (format);
+ Sprintf(format, "%c%d%c%df",pourcent,digits+2,point,digits);
+ theformrange.AssignCat (format);
+ }
+ therangemin = 0.1; therangemax = 1000.;
+ thezerosup = Standard_True;
+}
+
+void IGESControl_FloatFormat::SetFormat (const Standard_CString format)
+{ themainform.Clear(); themainform.AssignCat(format); }
+
+void IGESControl_FloatFormat::SetFormatForRange
+ (const Standard_CString form, const Standard_Real R1, const Standard_Real R2)
+{
+ theformrange.Clear(); theformrange.AssignCat(form);
+ therangemin = R1; therangemax = R2;
+}
+
+void IGESControl_FloatFormat::Format
+ (Standard_Boolean& zerosup, TCollection_AsciiString& mainform,
+ Standard_Boolean& hasrange, TCollection_AsciiString& formrange,
+ Standard_Real& rangemin, Standard_Real& rangemax) const
+{
+ zerosup = thezerosup;
+ mainform = themainform;
+ hasrange = (theformrange.Length() > 0);
+ formrange = theformrange;
+ rangemin = therangemin;
+ rangemax = therangemax;
+}
+
+void IGESControl_FloatFormat::Perform (IGESData_IGESWriter& writer) const
+{
+ writer.FloatWriter().SetFormat (themainform.ToCString());
+ writer.FloatWriter().SetZeroSuppress (thezerosup);
+ if (theformrange.Length() > 0) writer.FloatWriter().SetFormatForRange
+ (theformrange.ToCString(), therangemin, therangemax);
+}
+
+TCollection_AsciiString IGESControl_FloatFormat::Label () const
+{
+ TCollection_AsciiString lab("Float Format ");
+ if (thezerosup) lab.AssignCat(" ZeroSup ");
+ lab.AssignCat (themainform);
+ if (theformrange.Length() > 0) {
+ char mess[30];
+// Sprintf(mess,", in range %f %f %s",
+// therangemin,therangemax,theformrange.ToCString());
+// lab.AssignCat(mess);
+// ... FloatFormat a droit aussi a un beau format pour son propre compte ...
+ lab.AssignCat (", in range ");
+ Standard_Integer convlen = Interface_FloatWriter::Convert
+ (therangemin,mess,Standard_True,therangemin/2.,therangemax*2.,"%f","%f");
+ mess[convlen] = ' '; mess[convlen+1] = '\0';
+ lab.AssignCat(mess);
+ convlen = Interface_FloatWriter::Convert
+ (therangemax,mess,Standard_True,therangemin/2.,therangemax*2.,"%f","%f");
+ mess[convlen] = ':'; mess[convlen+1] = '\0';
+ lab.AssignCat(mess);
+ lab.AssignCat(theformrange.ToCString());
+ }
+ return lab;
+}
--- /dev/null
+// Created on: 1994-06-01
+// Created by: Christian CAILLET
+// Copyright (c) 1994-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _IGESControl_FloatFormat_HeaderFile
+#define _IGESControl_FloatFormat_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <TCollection_AsciiString.hxx>
+#include <IFSelect_GeneralModifier.hxx>
+class IGESData_IGESWriter;
+
+class IGESControl_FloatFormat;
+DEFINE_STANDARD_HANDLE(IGESControl_FloatFormat, IFSelect_GeneralModifier)
+
+//! This class gives control out format for floatting values :
+//! ZeroSuppress or no, Main Format, Format in Range (for values
+//! around 1.), as IGESWriter allows to manage it.
+//! Formats are given under C-printf form
+class IGESControl_FloatFormat : public IFSelect_GeneralModifier
+{
+ public:
+
+ //! Creates a new FloatFormat, with standard options :
+ //! ZeroSuppress, Main Format = %E,
+ //! Format between 0.001 and 1000. = %f
+ Standard_EXPORT IGESControl_FloatFormat();
+
+ //! Sets FloatFormat to default value (see Create) but if <digits>
+ //! is given positive, it commands Formats (main and range) to
+ //! ensure <digits> significant digits to be displayed
+ Standard_EXPORT void SetDefault (const Standard_Integer digits = 0);
+
+ //! Sets ZeroSuppress mode to a new value
+ void SetZeroSuppress (const Standard_Boolean mode) { thezerosup = mode; }
+
+ //! Sets Main Format to a new value
+ //! Remark : SetFormat, SetZeroSuppress and SetFormatForRange are
+ //! independant
+ Standard_EXPORT void SetFormat (const Standard_CString format = "%E");
+
+ //! Sets Format for Range to a new value with its range of
+ //! application.
+ //! To cancel it, give format as "" (empty string)
+ //! Remark that if the condition (0. < Rmin < Rmax) is not
+ //! verified, this secondary format will be ignored.
+ //! Moreover, this secondary format is intended to be used in a
+ //! range around 1.
+ Standard_EXPORT void SetFormatForRange (const Standard_CString format = "%f", const Standard_Real Rmin = 0.1, const Standard_Real Rmax = 1000.0);
+
+ //! Returns all recorded parameters :
+ //! zerosup : ZeroSuppress status
+ //! mainform : Main Format (which applies out of the range, or
+ //! for every real if no range is set)
+ //! hasrange : True if a FormatInRange is set, False else
+ //! (following parameters do not apply if it is False)
+ //! forminrange : Secondary Format (it applies inside the range)
+ //! rangemin, rangemax : the range in which the secondary format
+ //! applies
+ Standard_EXPORT void Format (Standard_Boolean& zerosup, TCollection_AsciiString& mainform, Standard_Boolean& hasrange, TCollection_AsciiString& forminrange, Standard_Real& rangemin, Standard_Real& rangemax) const;
+
+ //! Sets the Floatting Formats of IGESWriter to the recorded
+ //! parameters
+ Standard_EXPORT void Perform (IGESData_IGESWriter& writer) const;
+
+ //! Returns specific Label : for instance,
+ //! "Float Format [ZeroSuppress] %E [, in range R1-R2 %f]"
+ Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT(IGESControl_FloatFormat,IFSelect_GeneralModifier)
+
+ private:
+
+ Standard_Boolean thezerosup;
+ TCollection_AsciiString themainform;
+ TCollection_AsciiString theformrange;
+ Standard_Real therangemin;
+ Standard_Real therangemax;
+};
+
+#endif // _IGESControl_FloatFormat_HeaderFile
#include <Dico_IteratorOfDictionaryOfInteger.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <IFSelect_CheckCounter.hxx>
-#include <IFSelect_Functions.hxx>
#include <IGESControl_Controller.hxx>
#include <IGESControl_Reader.hxx>
#include <IGESData_FileProtocol.hxx>
#include <TopoDS_Shape.hxx>
#include <Transfer_ActorOfTransientProcess.hxx>
#include <Transfer_Binder.hxx>
-#include <Transfer_IteratorOfProcessForTransient.hxx>
#include <Transfer_TransientProcess.hxx>
#include <TransferBRep.hxx>
#include <XSControl_Controller.hxx>
//function : IGESControl_Reader
//purpose :
//=======================================================================
+
IGESControl_Reader::IGESControl_Reader ()
{
IGESControl_Controller::Init();
if (! model.IsNull()) {
nbEntities = model->NbEntities();
nbRoots = TP->NbRoots();
- Transfer_IteratorOfProcessForTransient iterTrans = TP->RootResult(Standard_True);
+ Transfer_TransientProcess::Iterator iterTrans = TP->RootResult(Standard_True);
Handle(Dico_DictionaryOfInteger) dicoCountResult = new Dico_DictionaryOfInteger;
Handle(Dico_DictionaryOfInteger) dicoCountMapping = new Dico_DictionaryOfInteger;
for (iterTrans.Start(); iterTrans.More() ; iterTrans.Next() ) {
--- /dev/null
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#include <IFSelect_ContextWrite.hxx>
+#include <IFSelect_GeneralModifier.hxx>
+#include <IGESAppli.hxx>
+#include <IGESData_IGESDumper.hxx>
+#include <IGESData_IGESEntity.hxx>
+#include <IGESData_IGESModel.hxx>
+#include <IGESData_IGESWriter.hxx>
+#include <IGESData_Protocol.hxx>
+#include <IGESDefs.hxx>
+#include <IGESFile_Read.hxx>
+#include <IGESControl_FloatFormat.hxx>
+#include <IGESControl_WorkLibrary.hxx>
+#include <IGESSolid.hxx>
+#include <Interface_Check.hxx>
+#include <Interface_InterfaceModel.hxx>
+#include <Interface_Macros.hxx>
+#include <Interface_ReportEntity.hxx>
+#include <Message.hxx>
+#include <Message_Messenger.hxx>
+#include <OSD_OpenFile.hxx>
+#include <Standard_ErrorHandler.hxx>
+#include <Standard_Stream.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+
+#include <errno.h>
+IMPLEMENT_STANDARD_RTTIEXT(IGESControl_WorkLibrary,IFSelect_WorkLibrary)
+
+IGESControl_WorkLibrary::IGESControl_WorkLibrary (const Standard_Boolean modefnes)
+: themodefnes (modefnes)
+{
+ IGESSolid::Init();
+ IGESAppli::Init();
+ IGESDefs::Init();
+
+ SetDumpLevels (4,6);
+ SetDumpHelp (0,"Only DNum");
+ SetDumpHelp (1,"DNum, IGES Type & Form");
+ SetDumpHelp (2,"Main Directory Informations");
+ SetDumpHelp (3,"Complete Directory Part");
+ SetDumpHelp (4,"Directory + Fields (except list contents)");
+ SetDumpHelp (5,"Complete (with list contents)");
+ SetDumpHelp (6,"Complete + Transformed data");
+}
+
+Standard_Integer IGESControl_WorkLibrary::ReadFile
+ (const Standard_CString name,
+ Handle(Interface_InterfaceModel)& model,
+ const Handle(Interface_Protocol)& protocol) const
+{
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ Handle(IGESData_IGESModel) igesmod = new IGESData_IGESModel;
+ DeclareAndCast(IGESData_Protocol,prot,protocol);
+
+ char* pname=(char*) name;
+ Standard_Integer status = IGESFile_Read (pname,igesmod,prot);
+
+ if (status < 0) sout<<"File not found : "<<name<<endl;
+ if (status > 0) sout<<"Error when reading file : "<<name<<endl;
+ if (status == 0) model = igesmod;
+ else model.Nullify();
+ return status;
+}
+
+Standard_Boolean IGESControl_WorkLibrary::WriteFile
+ (IFSelect_ContextWrite& ctx) const
+{
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+// Preparation
+ DeclareAndCast(IGESData_IGESModel,igesmod,ctx.Model());
+ DeclareAndCast(IGESData_Protocol,prot,ctx.Protocol());
+
+ if (igesmod.IsNull() || prot.IsNull()) return Standard_False;
+ ofstream fout;
+ OSD_OpenStream(fout,ctx.FileName(),ios::out );
+ if (!fout) {
+ ctx.CCheck(0)->AddFail("IGES File could not be created");
+ sout<<" - IGES File could not be created : " << ctx.FileName() << endl; return 0;
+ }
+ sout<<" IGES File Name : "<<ctx.FileName();
+ IGESData_IGESWriter VW(igesmod);
+ sout<<"("<<igesmod->NbEntities()<<" ents) ";
+
+// File Modifiers
+ Standard_Integer nbmod = ctx.NbModifiers();
+ for (Standard_Integer numod = 1; numod <= nbmod; numod ++) {
+ ctx.SetModifier (numod);
+ DeclareAndCast(IGESControl_FloatFormat,filemod,ctx.FileModifier());
+ if (!filemod.IsNull()) filemod->Perform(VW);
+// (impressions de mise au point)
+ sout << " .. FileMod." << numod <<" "<< filemod->Label();
+ if (ctx.IsForAll()) sout << " (all model)";
+ else sout << " (" << ctx.NbEntities() << " entities)";
+ }
+
+// Envoi
+ VW.SendModel(prot);
+ sout<<" Write ";
+ if (themodefnes) VW.WriteMode() = 10;
+ Standard_Boolean status = VW.Print(fout); sout<<" Done"<<endl;
+
+ errno = 0;
+ fout.close();
+ status = fout.good() && status && !errno;
+ if(errno)
+ sout << strerror(errno) << endl;
+
+ return status;
+}
+
+void IGESControl_WorkLibrary::DumpEntity
+ (const Handle(Interface_InterfaceModel)& model,
+ const Handle(Interface_Protocol)& protocol,
+ const Handle(Standard_Transient)& entity,
+ const Handle(Message_Messenger)& S, const Standard_Integer level) const
+{
+ DeclareAndCast(IGESData_IGESModel,igesmod,model);
+ DeclareAndCast(IGESData_Protocol,igespro,protocol);
+ DeclareAndCast(IGESData_IGESEntity,igesent,entity);
+ if (igesmod.IsNull() || igespro.IsNull() || igesent.IsNull()) return;
+ Standard_Integer num = igesmod->Number(igesent);
+ if (num == 0) return;
+
+ S<<" --- Entity "<<num;
+ Standard_Boolean iserr = model->IsRedefinedContent(num);
+ Handle(Standard_Transient) con;
+ if (iserr) con = model->ReportEntity(num)->Content();
+ if (entity.IsNull()) { S<<" Null"<<endl; return ; }
+
+// On attaque le dump : d abord cas de l Erreur
+ if (iserr) {
+ S << " ERRONEOUS, Content, Type cdl : ";
+ if (!con.IsNull()) S << con->DynamicType()->Name();
+ else S << "(undefined)" << endl;
+ igesent = GetCasted(IGESData_IGESEntity,con);
+ con.Nullify();
+ Handle(Interface_Check) check = model->ReportEntity(num)->Check();
+ Interface_CheckIterator chlist;
+ chlist.Add (check,num);
+ chlist.Print (S,igesmod,Standard_False);
+ if (igesent.IsNull()) return;
+ }
+ else S << " Type cdl : " << igesent->DynamicType()->Name();
+
+ IGESData_IGESDumper dump(igesmod,igespro);
+ try {
+ OCC_CATCH_SIGNALS
+ dump.Dump(igesent,S,level,(level-1)/3);
+ }
+ catch (Standard_Failure) {
+ S << " ** Dump Interrupt **" << endl;
+ }
+}
--- /dev/null
+// Created on: 1994-06-03
+// Created by: Christian CAILLET
+// Copyright (c) 1994-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _IGESControl_WorkLibrary_HeaderFile
+#define _IGESControl_WorkLibrary_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <IFSelect_WorkLibrary.hxx>
+class Interface_InterfaceModel;
+class Interface_Protocol;
+class IFSelect_ContextWrite;
+class Message_Messenger;
+
+
+class IGESControl_WorkLibrary;
+DEFINE_STANDARD_HANDLE(IGESControl_WorkLibrary, IFSelect_WorkLibrary)
+
+//! Performs Read and Write an IGES File with an IGES Model
+class IGESControl_WorkLibrary : public IFSelect_WorkLibrary
+{
+ public:
+
+ //! Creates a IGES WorkLibrary
+ //! If <modefnes> is given as True, it will work for FNES
+ Standard_EXPORT IGESControl_WorkLibrary(const Standard_Boolean modefnes = Standard_False);
+
+ //! Reads a IGES File and returns a IGES Model (into <mod>),
+ //! or lets <mod> "Null" in case of Error
+ //! Returns 0 if OK, 1 if Read Error, -1 if File not opened
+ Standard_EXPORT Standard_Integer ReadFile (const Standard_CString name, Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol) const Standard_OVERRIDE;
+
+ //! Writes a File from a IGES Model (brought by <ctx>)
+ //! Returns False (and writes no file) if <ctx> is not for IGES
+ Standard_EXPORT Standard_Boolean WriteFile (IFSelect_ContextWrite& ctx) const Standard_OVERRIDE;
+
+ //! Dumps an IGES Entity with an IGES Dumper. <level> is the one
+ //! used by IGESDumper.
+ Standard_EXPORT void DumpEntity (const Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol, const Handle(Standard_Transient)& entity, const Handle(Message_Messenger)& S, const Standard_Integer level) const Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT(IGESControl_WorkLibrary,IFSelect_WorkLibrary)
+
+ private:
+
+ Standard_Boolean themodefnes;
+};
+
+#endif // _IGESControl_WorkLibrary_HeaderFile
#include <IGESData_IGESModel.hxx>
#include <IGESData_IGESWriter.hxx>
#include <IGESData_Protocol.hxx>
-#include <IGESSelect_WorkLibrary.hxx>
#include <Interface_Macros.hxx>
#include <Interface_Static.hxx>
#include <Message_ProgressIndicator.hxx>
#include <OSD_OpenFile.hxx>
#include <ShapeAnalysis_ShapeTolerance.hxx>
#include <Standard_Stream.hxx>
-#include <Standard_Transient.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Shape.hxx>
#include <Transfer_FinderProcess.hxx>
{
// faudrait aussi (?) prendre les parametres par defaut ... ?
IGESControl_Controller::Init();
- myEditor.Init(IGESSelect_WorkLibrary::DefineProtocol());
+ myEditor.Init(IGESControl_Controller::DefineProtocol());
myEditor.SetUnitName(Interface_Static::CVal ("write.iges.unit"));
myEditor.ApplyUnit();
myWriteMode = Interface_Static::IVal ("write.iges.brep.mode");
{
// faudrait aussi (?) prendre les parametres par defaut ... ?
IGESControl_Controller::Init();
- myEditor.Init(IGESSelect_WorkLibrary::DefineProtocol());
+ myEditor.Init(IGESControl_Controller::DefineProtocol());
myEditor.SetUnitName(unit);
myEditor.ApplyUnit();
myModel = myEditor.Model();
(const Handle(IGESData_IGESModel)& model, const Standard_Integer modecr)
: myTP (new Transfer_FinderProcess(10000)) ,
myModel (model) ,
- myEditor (model,IGESSelect_WorkLibrary::DefineProtocol()) ,
+ myEditor (model,IGESControl_Controller::DefineProtocol()) ,
myWriteMode (modecr) , myIsComputed (Standard_False) { }
Standard_Boolean IGESControl_Writer::AddShape (const TopoDS_Shape& theShape)
Standard_Boolean IGESControl_Writer::AddEntity (const Handle(IGESData_IGESEntity)& ent)
{
if (ent.IsNull()) return Standard_False;
- myModel->AddWithRefs(ent,IGESSelect_WorkLibrary::DefineProtocol());
+ myModel->AddWithRefs(ent,IGESControl_Controller::DefineProtocol());
myIsComputed = Standard_False;
return Standard_True;
}
return Standard_False;
IGESData_IGESWriter IW (myModel);
// ne pas oublier le mode fnes ... a transmettre a IW
- IW.SendModel (IGESSelect_WorkLibrary::DefineProtocol());
+ IW.SendModel (IGESControl_Controller::DefineProtocol());
#ifdef OCCT_DEBUG
cout<<" ... ecriture ..."<<flush;
#endif
#include <TCollection_HAsciiString.hxx>
#include <stdio.h>
-static Handle(IGESData_Protocol) proto;
+
+static Handle(IGESData_Protocol) gIGESProto;
+static Handle(IGESData_IGESModel) gIGESModel;
static Handle(IGESData_DefaultGeneral) stmod;
static Handle(IGESData_DefaultSpecific) speci;
-
- void IGESData::Init ()
+void IGESData::Init ()
{
- if (proto.IsNull()) proto = new IGESData_Protocol;
+ if (gIGESProto.IsNull()) gIGESProto = new IGESData_Protocol;
if (stmod.IsNull()) stmod = new IGESData_DefaultGeneral;
if (speci.IsNull()) speci = new IGESData_DefaultSpecific;
-// et modele template "iges"
- if (Interface_InterfaceModel::HasTemplate("iges")) return;
+
+ // et modele template "iges"
+ if (!gIGESModel.IsNull()) return;
OSD_Process process;
//----------------------------
IGESData_GlobalSection GS;
+
//#58 rln 28.12.98 changing default values for Global Section
char procver[80];
sprintf (procver, XSTEP_PROCESSOR_VERSION, "IGES");
Handle(TCollection_HAsciiString) gsys = new TCollection_HAsciiString (procver);
Interface_Static::Init ("XSTEP","write.iges.header.product" ,'t',procver);
-/* Handle(TCollection_HAsciiString) gsys = new TCollection_HAsciiString
- (XSTEP_VERSION);
- gsys->AssignCat(" on ");
- gsys->AssignCat
-#ifdef HPUX
- ("HP-UX");
- cout<<"-- OSD_Path::SystemVersion, does not work well on HP-UX"<<endl;
-#endif
-#ifndef HPUX
- (host.SystemVersion().ToCString());
-#endif
-
-// SendName : nom significatif de la piece transmise par exemple
-// SystemId : c est MDTV etc
-// InterfaceVersion : la version en cours de XSTEP; incluant la plateforme
-
- char nomsys[100]; int istat; long lstat;
- struct utsname infosy;
- istat = uname (&infosy);
- lstat = sysinfo (SI_HW_PROVIDER,nomsys,99);
- Handle(TCollection_HAsciiString) gsys = new TCollection_HAsciiString(nomsys);
- gsys->AssignCat(" ");
- lstat = sysinfo (SI_ARCHITECTURE,nomsys,99);
- gsys->AssignCat(nomsys);
- gsys->AssignCat("/");
- gsys->AssignCat(infosy.sysname);
- gsys->AssignCat(" ");
- gsys->AssignCat(infosy.release);
-*/
- Standard_Integer year; //gka 19.01.99
OSD_Process system;
Quantity_Date ladate = system.SystemDate();
- year = ladate.Year();
- Handle(TCollection_HAsciiString) datestr;
- if( year < 2000 )
- //#65 rln 12.02.99 S4151 (explicitly force YYMMDD.HHMMSS before Y2000)
- datestr = GS.NewDateString(0,0,0,0,0,0,0);
- else
- //#65 rln 12.02.99 S4151 (explicitly force YYYYMMDD.HHMMSS after Y2000)
- datestr = GS.NewDateString(0,0,0,0,0,0,-1);
+ const Standard_Integer year = ladate.Year();
+ Handle(TCollection_HAsciiString) datestr = GS.NewDateString(0,0,0,0,0,0,( year < 2000 ? 0 : -1 )); //#65 rln 12.02.99 S4151 (explicitly force YYYYMMDD.HHMMSS after Y2000)
GS.SetSeparator (',');
GS.SetEndMark (';');
GS.SetSendName (new TCollection_HAsciiString(Interface_Static::CVal("write.iges.header.product")));
GS.SetMaxPower10Double ( RealLast10Exp() );
GS.SetMaxDigitsDouble ( RealDigits() );
GS.SetReceiveName (Interface_Static::Static("write.iges.header.receiver")->HStringValue());
-// new TCollection_HAsciiString("Unknown");
GS.SetScale (1.0);
GS.SetUnitFlag (Interface_Static::IVal("write.iges.unit"));
GS.SetUnitName (new TCollection_HAsciiString(Interface_Static::CVal("write.iges.unit")));
GS.SetResolution (0.0001);
GS.SetMaxCoord (0.0 /*1000.0*/);//22.10.98 rln BUC60081
GS.SetAuthorName (Interface_Static::Static("write.iges.header.author")->HStringValue());
-// new TCollection_HAsciiString (process.UserName());
GS.SetCompanyName (Interface_Static::Static("write.iges.header.company")->HStringValue());
-// new TCollection_HAsciiString("Matra Datavision");
GS.SetIGESVersion (11); // pour IGES-5.3 //gka 19.01.99
GS.SetDraftingStandard (0);
GS.SetLastChangeDate (datestr);
GS.SetApplicationProtocol(new TCollection_HAsciiString("")); //gka 19.01.99
-// Interface_Check check;
-// GS.Init(params, check);
-
// Creating the Model
//-------------------
- Handle(IGESData_IGESModel) model = new IGESData_IGESModel;
- model->SetGlobalSection(GS);
- Interface_InterfaceModel::SetTemplate ("iges", model);
+ gIGESModel = new IGESData_IGESModel;
+ gIGESModel->SetGlobalSection(GS);
+}
+
+const Handle(IGESData_Protocol) & IGESData::Protocol ()
+{
+ return gIGESProto;
}
- Handle(IGESData_Protocol) IGESData::Protocol ()
+Handle(IGESData_IGESModel) IGESData::NewModel ()
{
- return proto;
+ if (gIGESModel.IsNull()) return NULL;
+ Handle(Interface_InterfaceModel) newmod = gIGESModel->NewEmptyModel();
+ newmod->GetFromAnother (gIGESModel);
+ return Handle(IGESData_IGESModel)::DownCast(newmod);
}
#define _IGESData_HeaderFile
#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
-
-class IGESData_Protocol;
class IGESData_Protocol;
class IGESData_IGESModel;
-class IGESData_IGESEntity;
-class IGESData_LineFontEntity;
-class IGESData_LevelListEntity;
-class IGESData_TransfEntity;
-class IGESData_ViewKindEntity;
-class IGESData_LabelDisplayEntity;
-class IGESData_ColorEntity;
-class IGESData_NameEntity;
-class IGESData_SingleParentEntity;
-class IGESData_UndefinedEntity;
-class IGESData_FreeFormatEntity;
-class IGESData_GlobalSection;
-class IGESData_DefSwitch;
-class IGESData_DirChecker;
-class IGESData_IGESReaderData;
-class IGESData_IGESReaderTool;
-class IGESData_ParamReader;
-class IGESData_ParamCursor;
-class IGESData_DirPart;
-class IGESData_IGESType;
-class IGESData_FileRecognizer;
-class IGESData_IGESWriter;
-class IGESData_IGESDumper;
-class IGESData_BasicEditor;
-class IGESData_ToolLocation;
-class IGESData_GeneralModule;
-class IGESData_DefaultGeneral;
-class IGESData_ReadWriteModule;
-class IGESData_SpecificModule;
-class IGESData_DefaultSpecific;
-class IGESData_FileProtocol;
-class IGESData_WriterLib;
-class IGESData_SpecificLib;
-class IGESData_GlobalNodeOfWriterLib;
-class IGESData_NodeOfWriterLib;
-class IGESData_GlobalNodeOfSpecificLib;
-class IGESData_NodeOfSpecificLib;
-
//! basic description of an IGES Interface
class IGESData
{
-public:
-
- DEFINE_STANDARD_ALLOC
+ public:
-
//! Prepares General dynamic data used for IGESData specifically :
//! Protocol and Modules, which treat UndefinedEntity
Standard_EXPORT static void Init();
//! Returns a Protocol from IGESData (avoids to create it)
- Standard_EXPORT static Handle(IGESData_Protocol) Protocol();
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-friend class IGESData_Protocol;
-friend class IGESData_IGESModel;
-friend class IGESData_IGESEntity;
-friend class IGESData_LineFontEntity;
-friend class IGESData_LevelListEntity;
-friend class IGESData_TransfEntity;
-friend class IGESData_ViewKindEntity;
-friend class IGESData_LabelDisplayEntity;
-friend class IGESData_ColorEntity;
-friend class IGESData_NameEntity;
-friend class IGESData_SingleParentEntity;
-friend class IGESData_UndefinedEntity;
-friend class IGESData_FreeFormatEntity;
-friend class IGESData_GlobalSection;
-friend class IGESData_DefSwitch;
-friend class IGESData_DirChecker;
-friend class IGESData_IGESReaderData;
-friend class IGESData_IGESReaderTool;
-friend class IGESData_ParamReader;
-friend class IGESData_ParamCursor;
-friend class IGESData_DirPart;
-friend class IGESData_IGESType;
-friend class IGESData_FileRecognizer;
-friend class IGESData_IGESWriter;
-friend class IGESData_IGESDumper;
-friend class IGESData_BasicEditor;
-friend class IGESData_ToolLocation;
-friend class IGESData_GeneralModule;
-friend class IGESData_DefaultGeneral;
-friend class IGESData_ReadWriteModule;
-friend class IGESData_SpecificModule;
-friend class IGESData_DefaultSpecific;
-friend class IGESData_FileProtocol;
-friend class IGESData_WriterLib;
-friend class IGESData_SpecificLib;
-friend class IGESData_GlobalNodeOfWriterLib;
-friend class IGESData_NodeOfWriterLib;
-friend class IGESData_GlobalNodeOfSpecificLib;
-friend class IGESData_NodeOfSpecificLib;
-
+ Standard_EXPORT static const Handle(IGESData_Protocol) & Protocol();
+
+ //! Returns a Protocol from IGESData (avoids to create it)
+ Standard_EXPORT static Handle(IGESData_IGESModel) NewModel ();
};
-
-
-
-
-
-
#endif // _IGESData_HeaderFile
//#73 rln 10.03.99 S4135: "read.scale.unit" does not affect GlobalSection
+#include <IGESData.hxx>
#include <IGESData_BasicEditor.hxx>
#include <IGESData_ColorEntity.hxx>
#include <IGESData_DirChecker.hxx>
{
theunit = Standard_False;
theproto = protocol;
- themodel = GetCasted(IGESData_IGESModel,Interface_InterfaceModel::Template("iges"));
+ themodel = IGESData::NewModel();
theglib = Interface_GeneralLib (protocol);
theslib = protocol;
}
Standard_Integer nb = themodel->NbEntities();
if (nb == 0) return;
TColStd_Array1OfInteger subs (0,nb); subs.Init(0); // gere Subordinate Status
- Interface_Graph G (themodel,theglib); // gere & memorise UseFlag
+ Interface_Graph G (themodel); // gere & memorise UseFlag
G.ResetStatus();
// 2 phases : d abord on fait un calcul d ensemble. Ensuite on applique
-IGESSelect.cxx
-IGESSelect.hxx
-IGESSelect_Activator.cxx
-IGESSelect_Activator.hxx
-IGESSelect_AddFileComment.cxx
-IGESSelect_AddFileComment.hxx
IGESSelect_AddGroup.cxx
IGESSelect_AddGroup.hxx
IGESSelect_AutoCorrect.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_UpdateLastChange.hxx
IGESSelect_ViewSorter.cxx
IGESSelect_ViewSorter.hxx
-IGESSelect_WorkLibrary.cxx
-IGESSelect_WorkLibrary.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_Functions.hxx>
-#include <IFSelect_SessionPilot.hxx>
-#include <IFSelect_ShareOut.hxx>
-#include <IFSelect_WorkSession.hxx>
-#include <IGESData_IGESEntity.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESSelect.hxx>
-#include <IGESSelect_Activator.hxx>
-#include <IGESSelect_WorkLibrary.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_Macros.hxx>
-
-void IGESSelect::Run ()
-{
-// Handle(IFSelect_BasicActivator) Activator = new IFSelect_BasicActivator;
- IFSelect_Functions::Init();
- Handle(IFSelect_SessionPilot) pilot = new IFSelect_SessionPilot("XSTEP-IGES>");
- Handle(IGESSelect_Activator) igesact = new IGESSelect_Activator;
- pilot->SetSession (new IFSelect_WorkSession ( ));
- pilot->SetLibrary (new IGESSelect_WorkLibrary);
-
- pilot->ReadScript();
-}
-
-
-Standard_Integer IGESSelect::WhatIges
- (const Handle(IGESData_IGESEntity)& ent, const Interface_Graph& G,
- Handle(IGESData_IGESEntity)& /* sup */, Standard_Integer& /* index */)
-{
- Handle(IGESData_IGESEntity) igesent = ent;
- if (igesent.IsNull()) return Standard_False;
-// Standard_Integer igt = igesent->TypeNumber();
- DeclareAndCast(IGESData_IGESModel,model,G.Model());
- if (igesent.IsNull() || model.IsNull()) return 0;
-
-// Plane : de View ? de SingleParent ? sinon cf TrimmedSurface & cie
-
-
-
- return 0;
-}
+++ /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_HeaderFile
-#define _IGESSelect_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Standard_Integer.hxx>
-class IGESData_IGESEntity;
-class Interface_Graph;
-class IGESSelect_EditHeader;
-class IGESSelect_EditDirPart;
-class IGESSelect_IGESTypeForm;
-class IGESSelect_IGESName;
-class IGESSelect_SignStatus;
-class IGESSelect_SignLevelNumber;
-class IGESSelect_SignColor;
-class IGESSelect_CounterOfLevelNumber;
-class IGESSelect_ViewSorter;
-class IGESSelect_DispPerSingleView;
-class IGESSelect_DispPerDrawing;
-class IGESSelect_SelectVisibleStatus;
-class IGESSelect_SelectSubordinate;
-class IGESSelect_SelectLevelNumber;
-class IGESSelect_SelectName;
-class IGESSelect_SelectFromSingleView;
-class IGESSelect_SelectFromDrawing;
-class IGESSelect_SelectSingleViewFrom;
-class IGESSelect_SelectDrawingFrom;
-class IGESSelect_SelectBypassGroup;
-class IGESSelect_SelectBypassSubfigure;
-class IGESSelect_SelectBasicGeom;
-class IGESSelect_SelectFaces;
-class IGESSelect_SelectPCurves;
-class IGESSelect_ModelModifier;
-class IGESSelect_FileModifier;
-class IGESSelect_FloatFormat;
-class IGESSelect_AddFileComment;
-class IGESSelect_UpdateFileName;
-class IGESSelect_UpdateCreationDate;
-class IGESSelect_UpdateLastChange;
-class IGESSelect_SetVersion5;
-class IGESSelect_SetGlobalParameter;
-class IGESSelect_AutoCorrect;
-class IGESSelect_ComputeStatus;
-class IGESSelect_RebuildDrawings;
-class IGESSelect_RebuildGroups;
-class IGESSelect_AddGroup;
-class IGESSelect_ChangeLevelNumber;
-class IGESSelect_ChangeLevelList;
-class IGESSelect_SplineToBSpline;
-class IGESSelect_RemoveCurves;
-class IGESSelect_SetLabel;
-class IGESSelect_WorkLibrary;
-class IGESSelect_Activator;
-class IGESSelect_Dumper;
-
-
-//! This package defines the library of the most used tools for
-//! IGES Files : Selections & Modifiers specific to the IGES norm,
-//! and the most needed converters
-class IGESSelect
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- //! Simply gives a prompt for a conversational action on standard
- //! input/output. Returns the status of a
- Standard_EXPORT static void Run();
-
- //! Gives a quick analysis of an IGES Entity in the context of a
- //! model (i.e. a File) described by a Graph.
- //! Returned values are :
- //! <sup> : the most meaningfull super entity, if any (else Null)
- //! <index> : meaningfull index relating to super entity, if any
- //! <returned> : a status which helps exploitation of <sup>, by
- //! giving a case
- //! (normally, types of <ent> and <sup> should suffice to
- //! known the case)
- Standard_EXPORT static Standard_Integer WhatIges (const Handle(IGESData_IGESEntity)& ent, const Interface_Graph& G, Handle(IGESData_IGESEntity)& sup, Standard_Integer& index);
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-friend class IGESSelect_EditHeader;
-friend class IGESSelect_EditDirPart;
-friend class IGESSelect_IGESTypeForm;
-friend class IGESSelect_IGESName;
-friend class IGESSelect_SignStatus;
-friend class IGESSelect_SignLevelNumber;
-friend class IGESSelect_SignColor;
-friend class IGESSelect_CounterOfLevelNumber;
-friend class IGESSelect_ViewSorter;
-friend class IGESSelect_DispPerSingleView;
-friend class IGESSelect_DispPerDrawing;
-friend class IGESSelect_SelectVisibleStatus;
-friend class IGESSelect_SelectSubordinate;
-friend class IGESSelect_SelectLevelNumber;
-friend class IGESSelect_SelectName;
-friend class IGESSelect_SelectFromSingleView;
-friend class IGESSelect_SelectFromDrawing;
-friend class IGESSelect_SelectSingleViewFrom;
-friend class IGESSelect_SelectDrawingFrom;
-friend class IGESSelect_SelectBypassGroup;
-friend class IGESSelect_SelectBypassSubfigure;
-friend class IGESSelect_SelectBasicGeom;
-friend class IGESSelect_SelectFaces;
-friend class IGESSelect_SelectPCurves;
-friend class IGESSelect_ModelModifier;
-friend class IGESSelect_FileModifier;
-friend class IGESSelect_FloatFormat;
-friend class IGESSelect_AddFileComment;
-friend class IGESSelect_UpdateFileName;
-friend class IGESSelect_UpdateCreationDate;
-friend class IGESSelect_UpdateLastChange;
-friend class IGESSelect_SetVersion5;
-friend class IGESSelect_SetGlobalParameter;
-friend class IGESSelect_AutoCorrect;
-friend class IGESSelect_ComputeStatus;
-friend class IGESSelect_RebuildDrawings;
-friend class IGESSelect_RebuildGroups;
-friend class IGESSelect_AddGroup;
-friend class IGESSelect_ChangeLevelNumber;
-friend class IGESSelect_ChangeLevelList;
-friend class IGESSelect_SplineToBSpline;
-friend class IGESSelect_RemoveCurves;
-friend class IGESSelect_SetLabel;
-friend class IGESSelect_WorkLibrary;
-friend class IGESSelect_Activator;
-friend class IGESSelect_Dumper;
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_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_PacketList.hxx>
-#include <IFSelect_SelectSignature.hxx>
-#include <IFSelect_SessionPilot.hxx>
-#include <IFSelect_WorkLibrary.hxx>
-#include <IFSelect_WorkSession.hxx>
-#include <IGESData_IGESEntity.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESData_Protocol.hxx>
-#include <IGESSelect_Activator.hxx>
-#include <IGESSelect_AddGroup.hxx>
-#include <IGESSelect_AutoCorrect.hxx>
-#include <IGESSelect_ComputeStatus.hxx>
-#include <IGESSelect_DispPerDrawing.hxx>
-#include <IGESSelect_DispPerSingleView.hxx>
-#include <IGESSelect_FloatFormat.hxx>
-#include <IGESSelect_IGESTypeForm.hxx>
-#include <IGESSelect_RebuildDrawings.hxx>
-#include <IGESSelect_RebuildGroups.hxx>
-#include <IGESSelect_SelectBypassGroup.hxx>
-#include <IGESSelect_SelectDrawingFrom.hxx>
-#include <IGESSelect_SelectFromDrawing.hxx>
-#include <IGESSelect_SelectFromSingleView.hxx>
-#include <IGESSelect_SelectLevelNumber.hxx>
-#include <IGESSelect_SelectName.hxx>
-#include <IGESSelect_SelectSingleViewFrom.hxx>
-#include <IGESSelect_SelectVisibleStatus.hxx>
-#include <IGESSelect_SetGlobalParameter.hxx>
-#include <IGESSelect_SetVersion5.hxx>
-#include <IGESSelect_SplineToBSpline.hxx>
-#include <IGESSelect_UpdateCreationDate.hxx>
-#include <IGESSelect_UpdateFileName.hxx>
-#include <IGESSelect_UpdateLastChange.hxx>
-#include <IGESSelect_ViewSorter.hxx>
-#include <IGESSelect_WorkLibrary.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_ErrorHandler.hxx>
-#include <Standard_Failure.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_HAsciiString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_Activator,IFSelect_Activator)
-
-static int initActivator = 0;
-
- IGESSelect_Activator::IGESSelect_Activator ()
-{
- if (initActivator) return; initActivator = 1;
-// Add ( 0,"load");
-// Add ( 0,"loadiges"); // homonyme
- SetForGroup ("XSTEP-IGES");
-
- Add ( 5,"listviews");
- Add ( 6,"listdrawings");
- Add ( 7,"listsviews");
-
- AddSet (10,"igestype");
- AddSet (11,"bypassgroup");
- AddSet (12,"igesname");
- AddSet (13,"igesvisible");
- AddSet (14,"igeslevel");
-
- AddSet (21,"igesfromdrawing");
- AddSet (22,"igesfromview");
- AddSet (23,"igesdrawingfrom");
- AddSet (24,"igesviewfrom");
-
- AddSet (31,"igesdispdrawing");
- AddSet (32,"igesdispview");
-
- AddSet (40,"floatformat");
- AddSet (41,"setglobalparam");
- AddSet (42,"setversion5");
- AddSet (43,"updatecreationdate");
- AddSet (44,"updatelastchange");
- AddSet (45,"updatefilename");
-
- AddSet (50,"autocorrect");
- AddSet (51,"computestatus");
- AddSet (52,"rebuildgroups");
- AddSet (53,"rebuilddrawings");
- AddSet (54,"addgroup");
-
- AddSet (60,"splinetobspline");
-
- Add (70,"setuseflag");
-}
-
-
- IFSelect_ReturnStatus IGESSelect_Activator::Do
- (const Standard_Integer number,
- const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Word(1).ToCString();
- const Standard_CString arg2 = pilot->Word(2).ToCString();
-// const Standard_CString arg3 = pilot->Word(3).ToCString();
- Handle(IFSelect_WorkSession) WS = pilot->Session();
-
- switch (number) {
-
- case 5 : // **** ListViews (sans tri complementaire)
- case 6 : // **** ListDrawings
- case 7 : { // **** ListS(ingle)Views
- Standard_Integer listmode = 0;
- if (argc == 2 && arg1[0] == '?') argc = -1;
- if (argc < 2) {
- cout<<"Ajouter un argument pour avoir :\n"<<
- " l : liste resumee"<<
- " c : liste complete par item (mais pas pour remaining)\n"<<
- " r : idem + liste complete remaining\n"<<
- " sur tout le modele. Ajouter nom selection pour lister sur une partie"<<endl;
- return (argc >= 0 ? IFSelect_RetError : IFSelect_RetVoid);
- }
- if (arg1[0] == 'l') {
- listmode = 0; cout<<"Liste resumee";
- }
- else if (arg1[0] == 'c') {
- listmode = 1; cout<<"Liste complete par item (pas pour Remaining)"<<endl;
- }
- else if (arg1[0] == 'r') {
- listmode = 2; cout<<"Liste complete par item et pour Remaining"<<endl;
- }
- else {
- cout<<"Parametre de listage non compris"<<endl; return IFSelect_RetError;
- }
-
- Handle(IGESSelect_ViewSorter) vs = new IGESSelect_ViewSorter;
- vs->SetModel(GetCasted(IGESData_IGESModel,WS->Model()));
- if (argc == 2) vs->AddModel(WS->Model());
- else {
-// on demande une selection
- DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg2));
- if (sel.IsNull()) {
- cout<<"Pas une selection : "<<arg2<<endl;
- return IFSelect_RetError;
- }
- vs->AddList (WS->SelectionResult(sel));
- }
- Standard_Boolean listdr = (number > 5);
- if (number == 6) vs->SortDrawings(WS->Graph());
- if (number == 7) vs->SortSingleViews(Standard_True);
- Handle(IFSelect_PacketList) sets = vs->Sets(listdr);
- Standard_Integer nb = vs->NbSets(listdr);
- cout<<" -- ViewSorter for";
- if (number == 5) cout<<" Views & Drawings";
- if (number == 6) cout<<" Drawings only (complete)";
- if (number == 7) cout<<" Single Views & Drawing Frames";
- cout<<", on "<<vs->NbEntities()<<" ent.s, give "<<nb<<" Sets"<<endl;
-
- Interface_EntityIterator iter;
- for (Standard_Integer i = 1; i <= nb; i ++) {
- cout<<" -- Set n0 "<<i<<" Item=entity n0: "<<
- WS->Model()->Number(vs->SetItem(i,listdr))<<" List:";
- cout<<sets->NbEntities(i)<<" ent.s:"<<endl;
- if (listmode == 0) continue;
- iter = sets->Entities(i);
- WS->ListEntities (iter,0);
- }
-
- cout <<" -- Remaining Entities (not yet sorted) :"
- <<sets->NbDuplicated(0,Standard_False)<<endl;
- if (listmode < 2) return IFSelect_RetVoid;
- iter = sets->Duplicated(0,Standard_False);
- WS->ListEntities(iter,0);
- return IFSelect_RetVoid;
- }
-
- case 10 : { // **** IGESType (form Type/Form)
- if (argc < 2) {
- cout<<"Donner le n0 de type desire, + en option la forme\n"
- <<" Si pas de forme, prend toutes les formes du type demande"<<endl;
- return IFSelect_RetError;
- }
- char signature[20];
- if (argc == 2) sprintf(signature,"%s",arg1);
- else sprintf(signature,"%s %s",arg1,arg2);
- Handle(IFSelect_SelectSignature) sel = new IFSelect_SelectSignature
- (new IGESSelect_IGESTypeForm, signature,(argc > 2));
- return pilot->RecordItem (sel);
- }
-
- case 11 : { // **** IGES BypassGroup
- return pilot->RecordItem (new IGESSelect_SelectBypassGroup);
- }
-
- case 12 : { // **** IGES Name
- if (argc < 2) {
- cout<<"Donner un Nom de TextParam pour IGESName"<<endl;
- return IFSelect_RetError;
- }
- Handle(IGESSelect_SelectName) sel = new IGESSelect_SelectName;
- sel->SetName
- (GetCasted(TCollection_HAsciiString,WS->NamedItem(arg1)) );
- return pilot->RecordItem (sel);
- }
-
- case 13 : { // **** IGES VisibleStatus
- return pilot->RecordItem (new IGESSelect_SelectVisibleStatus);
- }
-
- case 14 : { // **** IGES LevelNumber
- if (argc < 2) {
- cout<<"Donner nom IntParam pour Level"<<endl;
- return IFSelect_RetError;
- }
- DeclareAndCast(IFSelect_IntParam,lev,WS->NamedItem(arg1));
- if (lev.IsNull()) {
- cout<<arg1<<" : pas un IntParam (pour Level)"<<endl;
- return IFSelect_RetError;
- }
- Handle(IGESSelect_SelectLevelNumber) sel = new IGESSelect_SelectLevelNumber;
- sel->SetLevelNumber(lev);
- return pilot->RecordItem (sel);
- }
-
- case 21 : { // **** IGES FromDrawing
- return pilot->RecordItem (new IGESSelect_SelectFromDrawing);
- }
- case 22 : { // **** IGES FromSingleView
- return pilot->RecordItem (new IGESSelect_SelectFromSingleView);
- }
- case 23 : { // **** IGES FromDrawing
- return pilot->RecordItem (new IGESSelect_SelectDrawingFrom);
- }
- case 24 : { // **** IGES FromDrawing
- return pilot->RecordItem (new IGESSelect_SelectSingleViewFrom);
- }
-
- case 31 : { // **** IGES DispatchPerDrawing
- return pilot->RecordItem (new IGESSelect_DispPerDrawing);
- }
- case 32 : { // **** IGES DispatchPerSingleView
- return pilot->RecordItem (new IGESSelect_DispPerSingleView);
- }
-
- case 40 : { // **** FloatFormat
- char prem = ' ';
- if (argc < 2) prem = '?';
- else if (argc == 5) {
- cout<<"floatformat tout court donne les formes admises"<<endl;
- return IFSelect_RetError;
- }
- else prem = arg1[0];
- Standard_Boolean zerosup=Standard_False;
- Standard_Integer digits = 0;
- if (prem == 'N' || prem == 'n') zerosup = Standard_False;
- else if (prem == 'Z' || prem == 'z') zerosup = Standard_True;
- else if (prem >= 48 && prem <= 57) digits = atoi(arg1);
- else {
- cout<<"floatformat digits, digits=nb de chiffres signifiants, ou\n"
- << "floatformat NZ %mainformat [%rangeformat [Rmin Rmax]]\n"
- <<" NZ : N ou n pour Non-zero-suppress, Z ou z pour zero-suppress\n"
- <<" %mainformat : format principal type printf, ex,: %E\n"
- <<" + optionnel : format secondaire (flottants autour de 1.) :\n"
- <<" %rangeformat Rmin Rmax : format type printf entre Rmin et Rmax\n"
- <<" %rangeformat tout seul : format type printf entre 0.1 et 1000.\n"
- <<flush;
- return (prem == '?' ? IFSelect_RetVoid : IFSelect_RetError);
- }
- Standard_Real Rmin=0., Rmax=0.;
- if (argc > 4) {
- Rmin = Atof(pilot->Word(4).ToCString());
- Rmax = Atof(pilot->Word(5).ToCString());
- if (Rmin <= 0 || Rmax <= 0) { cout<<"intervalle : donner reels > 0"<<endl; return IFSelect_RetError; }
- }
- Handle(IGESSelect_FloatFormat) fm = new IGESSelect_FloatFormat;
- if (argc == 2) fm->SetDefault(digits);
- else {
- fm->SetZeroSuppress(zerosup);
- fm->SetFormat (arg2);
- if (argc == 4) fm->SetFormatForRange(pilot->Word(3).ToCString());
- else if (argc >= 6) fm->SetFormatForRange(pilot->Word(3).ToCString(),Rmin,Rmax);
- else fm->SetFormatForRange("");
- }
- return pilot->RecordItem(fm);
- }
-
- case 41 : { // **** SetGlobalParameter
- if (argc < 3) {
- cout<<"Donner entier=n0 param a changer + nom TextParam pour la valeur"<<endl;
- return IFSelect_RetError;
- }
- Standard_Integer numpar = atoi(arg1);
- if (numpar <= 0) {
- cout<<"Pas un n0 de param global correct:"<<arg1<<endl;
- return IFSelect_RetError;
- }
- DeclareAndCast(TCollection_HAsciiString,val,WS->NamedItem(arg2));
- if (val.IsNull()) {
- cout<<"Pas un nom de TextParam:"<<arg2<<endl;
- return IFSelect_RetError;
- }
- Handle(IGESSelect_SetGlobalParameter) mod =
- new IGESSelect_SetGlobalParameter(numpar);
- mod->SetValue(val);
- return pilot->RecordItem (mod);
- }
-
- case 42 : { // **** Set IGES Version 5.1
- return pilot->RecordItem (new IGESSelect_SetVersion5);
- }
- case 43 : { // **** Update Creation Date
- return pilot->RecordItem (new IGESSelect_UpdateCreationDate);
- }
- case 44 : { // **** Update Last Change Date
- return pilot->RecordItem (new IGESSelect_UpdateLastChange);
- }
- case 45 : { // **** Update File Name
- return pilot->RecordItem (new IGESSelect_UpdateFileName);
- }
-
- case 50 : { // **** AutoCorrect
- return pilot->RecordItem (new IGESSelect_AutoCorrect);
- }
- case 51 : { // **** Compute Status
- return pilot->RecordItem (new IGESSelect_ComputeStatus);
- }
- case 52 : { // **** Rebuild Groups
- return pilot->RecordItem (new IGESSelect_RebuildGroups);
- }
- case 53 : { // **** Rebuild Drawings
- return pilot->RecordItem (new IGESSelect_RebuildDrawings);
- }
- case 54 : { // **** Add Group
- return pilot->RecordItem (new IGESSelect_AddGroup);
- }
-
- case 60 : { // **** Spline To BSpline
- if (argc < 2) {
- cout<<"Pour SplineToBSpline, donner mode :\n"<<
- " n pour normal, t pour tryC2"<<endl;
- return IFSelect_RetError;
- }
- Standard_Boolean tryC2;
- if (arg1[0] == 'n' || arg1[0] == 'N')
- tryC2 = Standard_False;
- else if (arg1[0] == 't' || arg1[0] == 'T')
- tryC2 = Standard_True;
- else {
- cout<<" Mode incorrect : "<<arg1<<endl;
- return IFSelect_RetError;
- }
- Handle(IGESSelect_SplineToBSpline) conv =
- new IGESSelect_SplineToBSpline (tryC2);
- return pilot->RecordItem(conv);
- }
-
- case 70 : { // **** SetUseFlag
- Standard_Integer usefl = atoi (arg1);
- if (argc > 2) {
- Handle(TColStd_HSequenceOfTransient) list = WS->GiveList(pilot->CommandPart(2));
- Standard_Integer i, nb = list->Length();
- for (i = 1; i <= nb; i ++) {
- DeclareAndCast(IGESData_IGESEntity,ent,list->Value(i));
- if (!ent.IsNull()) ent->InitStatus
- (ent->BlankStatus(),ent->SubordinateStatus(),usefl,ent->HierarchyStatus());
- }
- }
- else {
- Standard_Integer i, nb = WS->NbStartingEntities();
- for (i = 1; i <= nb; i ++) {
- DeclareAndCast(IGESData_IGESEntity,ent,WS->StartingEntity(i));
- if (!ent.IsNull()) ent->InitStatus
- (ent->BlankStatus(),ent->SubordinateStatus(),usefl,ent->HierarchyStatus());
- }
- }
- return IFSelect_RetDone;
- }
-
- default : break;
- }
- return IFSelect_RetVoid;
-
-}
-
-Standard_CString IGESSelect_Activator::Help
- (const Standard_Integer number) const
-{
- switch (number) {
- case 5 : return "Liste Vues (tous types). Nom selection sinon tout modele";
- case 6 : return "Liste Drawings. Nom selection sinon tout modele";
- case 7 : return "Liste Vues SIMPLES. Nom selection sinon tout modele";
-
- case 10 : return "type:integer [form:integer] : cree Select IGESType";
- case 11 : return "cree Select Bypass Group";
- case 12 : return "name:TextParam : cree Select Name (Name/Label)";
- case 13 : return "cree Select Visible Status (Blank Status = 0 sinon 1)";
- case 14 : return "level:IntParam : cree Select LevelNumber";
-
- case 21 : return "cree Select From Drawing";
- case 22 : return "cree Select From Single View";
- case 23 : return "cree Select Drawing From, drawing(s) pour une liste d entites";
- case 24 : return "cree Select View From, views pour une liste d entites";
-
- case 31 : return "cree Dispatch Per Drawing";
- case 32 : return "cree Dispatch Per SingleView";
-
- case 40 : return "options... : cree FloatFormat ... floatformat tout court->help";
- case 41 : return "numpar:integer value:TextParam : cree Set Global Param";
- case 42 : return "cree Set Version -> 5.1";
- case 43 : return "cree Update Creation Date";
- case 44 : return "cree Update Last Change Date";
- case 45 : return "cree Update File Name (dynamic)";
-
- case 50 : return "cree AutoCorrect";
- case 51 : return "cree Compute Status (in D.E.)";
- case 52 : return "cree Rebuild Groups";
- case 53 : return "cree Rebuild Drawings";
- case 54 : return "cree AddGroup";
-
- case 60 : return "cree SplineToBSpline Conversion";
-
- case 70 : return "useflag givelist : Set Use Flag to value";
-
- default : break;
- }
- return "??";
-}
+++ /dev/null
-// Created on: 1994-06-03
-// Created by: Christian CAILLET
-// Copyright (c) 1994-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _IGESSelect_Activator_HeaderFile
-#define _IGESSelect_Activator_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Activator.hxx>
-#include <IFSelect_ReturnStatus.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_CString.hxx>
-class IFSelect_SessionPilot;
-
-
-class IGESSelect_Activator;
-DEFINE_STANDARD_HANDLE(IGESSelect_Activator, IFSelect_Activator)
-
-//! Performs Actions specific to IGESSelect, i.e. creation of
-//! IGES Selections and Dispatches, plus dumping specific to IGES
-class IGESSelect_Activator : public IFSelect_Activator
-{
-
-public:
-
-
- Standard_EXPORT IGESSelect_Activator();
-
- //! Executes a Command Line for IGESSelect
- Standard_EXPORT IFSelect_ReturnStatus Do (const Standard_Integer number, const Handle(IFSelect_SessionPilot)& pilot) Standard_OVERRIDE;
-
- //! Sends a short help message for IGESSelect commands
- Standard_EXPORT Standard_CString Help (const Standard_Integer number) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_Activator,IFSelect_Activator)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_Activator_HeaderFile
+++ /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_CString.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 emoty 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
#include <IGESSelect_DispPerDrawing.hxx>
#include <IGESSelect_DispPerSingleView.hxx>
#include <IGESSelect_Dumper.hxx>
-#include <IGESSelect_FloatFormat.hxx>
+#include <IGESControl_FloatFormat.hxx>
#include <IGESSelect_RebuildDrawings.hxx>
#include <IGESSelect_RebuildGroups.hxx>
#include <IGESSelect_SelectBypassGroup.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 (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);
+ if (type == STANDARD_TYPE(IGESControl_FloatFormat)) {
+ DeclareAndCast(IGESControl_FloatFormat,ff,item);
Standard_Boolean zerosup, hasrange;
Standard_Real rangemin, rangemax;
TCollection_AsciiString mainform,forminrange;
if (type.IsEqual("IGESSelect_SelectBypassGroup"))
{ item = new IGESSelect_SelectBypassGroup; return Standard_True; }
- if (type.IsEqual("IGESSelect_FloatFormat")) {
+ if (type.IsEqual("IGESControl_FloatFormat")) {
if (file.NbParams() < 2) return Standard_False;
- Handle(IGESSelect_FloatFormat) ff = new IGESSelect_FloatFormat;
+ Handle(IGESControl_FloatFormat) ff = new IGESControl_FloatFormat;
Standard_Boolean zerosup;
const TCollection_AsciiString zsup = file.ParamValue(1);
if (zsup.Length() < 1) return Standard_False;
#include <Standard_Type.hxx>
#include <IFSelect_SessionDumper.hxx>
-#include <Standard_Boolean.hxx>
class IFSelect_SessionFile;
-class Standard_Transient;
class TCollection_AsciiString;
-
class IGESSelect_Dumper;
DEFINE_STANDARD_HANDLE(IGESSelect_Dumper, IFSelect_SessionDumper)
//! Dispatches, Modifiers
class IGESSelect_Dumper : public IFSelect_SessionDumper
{
+ public:
-public:
-
-
//! Creates a Dumper and puts it into the Library of Dumper
- Standard_EXPORT IGESSelect_Dumper();
-
+ IGESSelect_Dumper() {}
+
//! Write the Own Parameters of Types defined in package IGESSelect
//! Returns True if <item> has been processed, False else
Standard_EXPORT Standard_Boolean WriteOwn (IFSelect_SessionFile& file, const Handle(Standard_Transient)& item) const Standard_OVERRIDE;
//! 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
-// 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 <Standard_Boolean.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <Standard_Real.hxx>
-#include <IGESSelect_FileModifier.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_CString.hxx>
-class TCollection_AsciiString;
-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
- //! independant
- Standard_EXPORT void SetFormat (const Standard_CString format = "%E");
-
- //! Sets Format for Range to a new value with its range of
- //! application.
- //! To cancel it, give format as "" (empty string)
- //! Remark that if the condition (0. < Rmin < Rmax) is not
- //! verified, this secondary format will be ignored.
- //! Moreover, this secondary format is intended to be used in a
- //! range around 1.
- Standard_EXPORT void SetFormatForRange (const Standard_CString format = "%f", const Standard_Real Rmin = 0.1, const Standard_Real Rmax = 1000.0);
-
- //! Returns all recorded parameters :
- //! zerosup : ZeroSuppress status
- //! mainform : Main Format (which applies out of the range, or
- //! for every real if no range is set)
- //! hasrange : True if a FormatInRange is set, False else
- //! (following parameters do not apply if it is False)
- //! forminrange : Secondary Format (it applies inside the range)
- //! rangemin, rangemax : the range in which the secondary format
- //! applies
- Standard_EXPORT void Format (Standard_Boolean& zerosup, TCollection_AsciiString& mainform, Standard_Boolean& hasrange, TCollection_AsciiString& forminrange, Standard_Real& rangemin, Standard_Real& rangemax) const;
-
- //! Sets the Floatting Formats of IGESWriter to the recorded
- //! parameters
- Standard_EXPORT void Perform (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 <IFSelect_ContextWrite.hxx>
-#include <IFSelect_GeneralModifier.hxx>
-#include <IGESAppli.hxx>
-#include <IGESAppli_Protocol.hxx>
-#include <IGESData_FileProtocol.hxx>
-#include <IGESData_IGESDumper.hxx>
-#include <IGESData_IGESEntity.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESData_IGESWriter.hxx>
-#include <IGESData_Protocol.hxx>
-#include <IGESDefs.hxx>
-#include <IGESFile_Read.hxx>
-#include <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_OpenFile.hxx>
-#include <Standard_ErrorHandler.hxx>
-#include <Standard_Stream.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TColStd_HSequenceOfInteger.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 Informations");
- SetDumpHelp (3,"Complete Directory Part");
- SetDumpHelp (4,"Directory + Fields (except list contents)");
- SetDumpHelp (5,"Complete (with list contents)");
- SetDumpHelp (6,"Complete + Transformed data");
-}
-
- Standard_Integer IGESSelect_WorkLibrary::ReadFile
- (const Standard_CString name,
- Handle(Interface_InterfaceModel)& model,
- const Handle(Interface_Protocol)& protocol) const
-{
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- Handle(IGESData_IGESModel) igesmod = new IGESData_IGESModel;
- DeclareAndCast(IGESData_Protocol,prot,protocol);
-
- char* pname=(char*) name;
- Standard_Integer status = IGESFile_Read (pname,igesmod,prot);
-
- if (status < 0) sout<<"File not found : "<<name<<endl;
- if (status > 0) sout<<"Error when reading file : "<<name<<endl;
- if (status == 0) model = igesmod;
- else model.Nullify();
- return status;
-}
-
-
- Standard_Boolean IGESSelect_WorkLibrary::WriteFile
- (IFSelect_ContextWrite& ctx) const
-{
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
-// Preparation
- DeclareAndCast(IGESData_IGESModel,igesmod,ctx.Model());
- DeclareAndCast(IGESData_Protocol,prot,ctx.Protocol());
-
- if (igesmod.IsNull() || prot.IsNull()) return Standard_False;
- ofstream fout;
- OSD_OpenStream(fout,ctx.FileName(),ios::out );
- if (!fout) {
- ctx.CCheck(0)->AddFail("IGES File could not be created");
- sout<<" - IGES File could not be created : " << ctx.FileName() << endl; return 0;
- }
- sout<<" IGES File Name : "<<ctx.FileName();
- IGESData_IGESWriter VW(igesmod);
- sout<<"("<<igesmod->NbEntities()<<" ents) ";
-
-// File Modifiers
- Standard_Integer nbmod = ctx.NbModifiers();
- for (Standard_Integer numod = 1; numod <= nbmod; numod ++) {
- ctx.SetModifier (numod);
- DeclareAndCast(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 << flush;
- }
-
-// Envoi
- VW.SendModel(prot);
- sout<<" Write ";
- if (themodefnes) VW.WriteMode() = 10;
- Standard_Boolean status = VW.Print(fout); sout<<" Done"<<endl;
-
- errno = 0;
- fout.close();
- status = fout.good() && status && !errno;
- if(errno)
- sout << strerror(errno) << endl;
-
- return status;
-}
-
- 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,
- const Handle(Message_Messenger)& S, const Standard_Integer level) const
-{
- DeclareAndCast(IGESData_IGESModel,igesmod,model);
- DeclareAndCast(IGESData_Protocol,igespro,protocol);
- DeclareAndCast(IGESData_IGESEntity,igesent,entity);
- if (igesmod.IsNull() || igespro.IsNull() || igesent.IsNull()) return;
- Standard_Integer num = igesmod->Number(igesent);
- if (num == 0) return;
-
- S<<" --- Entity "<<num;
- Standard_Boolean iserr = model->IsRedefinedContent(num);
- Handle(Standard_Transient) con;
- if (iserr) con = model->ReportEntity(num)->Content();
- if (entity.IsNull()) { S<<" Null"<<endl; return ; }
-
-// On attaque le dump : d abord cas de l Erreur
- if (iserr) {
- S << " ERRONEOUS, Content, Type cdl : ";
- if (!con.IsNull()) S << con->DynamicType()->Name();
- else S << "(undefined)" << endl;
- igesent = GetCasted(IGESData_IGESEntity,con);
- con.Nullify();
- Handle(Interface_Check) check = model->ReportEntity(num)->Check();
- Interface_CheckIterator chlist;
- chlist.Add (check,num);
- chlist.Print (S,igesmod,Standard_False);
- if (igesent.IsNull()) return;
- }
- else S << " Type cdl : " << igesent->DynamicType()->Name();
-
- IGESData_IGESDumper dump(igesmod,igespro);
- try {
- OCC_CATCH_SIGNALS
- dump.Dump(igesent,S,level,(level-1)/3);
- }
- catch (Standard_Failure) {
- S << " ** Dump Interrupt **" << endl;
- }
-}
+++ /dev/null
-// Created on: 1994-06-03
-// Created by: Christian CAILLET
-// Copyright (c) 1994-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _IGESSelect_WorkLibrary_HeaderFile
-#define _IGESSelect_WorkLibrary_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Boolean.hxx>
-#include <IFSelect_WorkLibrary.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_CString.hxx>
-class Interface_InterfaceModel;
-class Interface_Protocol;
-class IFSelect_ContextWrite;
-class IGESData_Protocol;
-class Standard_Transient;
-class Message_Messenger;
-
-
-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 void DumpEntity (const Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol, const Handle(Standard_Transient)& entity, const Handle(Message_Messenger)& S, const Standard_Integer level) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(IGESSelect_WorkLibrary,IFSelect_WorkLibrary)
-
-protected:
-
-
-
-
-private:
-
-
- Standard_Boolean themodefnes;
-
-
-};
-
-
-
-
-
-
-
-#endif // _IGESSelect_WorkLibrary_HeaderFile
// (Modules are created and loaded in appropriate libraries, once by Init)
static Handle(IGESSolid_Protocol) protocol;
-
-
- void IGESSolid::Init ()
+void IGESSolid::Init ()
{
IGESGeom::Init();
if (protocol.IsNull()) {
}
}
- Handle(IGESSolid_Protocol) IGESSolid::Protocol ()
+const Handle(IGESSolid_Protocol) & IGESSolid::Protocol ()
{
return protocol;
}
#define _IGESSolid_HeaderFile
#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
-
-class IGESSolid_Protocol;
-class IGESSolid_Block;
-class IGESSolid_RightAngularWedge;
-class IGESSolid_Cylinder;
-class IGESSolid_ConeFrustum;
-class IGESSolid_Sphere;
-class IGESSolid_Torus;
-class IGESSolid_SolidOfRevolution;
-class IGESSolid_SolidOfLinearExtrusion;
-class IGESSolid_Ellipsoid;
-class IGESSolid_BooleanTree;
-class IGESSolid_SelectedComponent;
-class IGESSolid_SolidAssembly;
-class IGESSolid_ManifoldSolid;
-class IGESSolid_PlaneSurface;
-class IGESSolid_CylindricalSurface;
-class IGESSolid_ConicalSurface;
-class IGESSolid_SphericalSurface;
-class IGESSolid_ToroidalSurface;
-class IGESSolid_SolidInstance;
-class IGESSolid_VertexList;
-class IGESSolid_EdgeList;
-class IGESSolid_Loop;
-class IGESSolid_Face;
-class IGESSolid_Shell;
-class IGESSolid_ToolBlock;
-class IGESSolid_ToolRightAngularWedge;
-class IGESSolid_ToolCylinder;
-class IGESSolid_ToolConeFrustum;
-class IGESSolid_ToolSphere;
-class IGESSolid_ToolTorus;
-class IGESSolid_ToolSolidOfRevolution;
-class IGESSolid_ToolSolidOfLinearExtrusion;
-class IGESSolid_ToolEllipsoid;
-class IGESSolid_ToolBooleanTree;
-class IGESSolid_ToolSelectedComponent;
-class IGESSolid_ToolSolidAssembly;
-class IGESSolid_ToolManifoldSolid;
-class IGESSolid_ToolPlaneSurface;
-class IGESSolid_ToolCylindricalSurface;
-class IGESSolid_ToolConicalSurface;
-class IGESSolid_ToolSphericalSurface;
-class IGESSolid_ToolToroidalSurface;
-class IGESSolid_ToolSolidInstance;
-class IGESSolid_ToolVertexList;
-class IGESSolid_ToolEdgeList;
-class IGESSolid_ToolLoop;
-class IGESSolid_ToolFace;
-class IGESSolid_ToolShell;
class IGESSolid_Protocol;
-class IGESSolid_ReadWriteModule;
-class IGESSolid_GeneralModule;
-class IGESSolid_SpecificModule;
-class IGESSolid_TopoBuilder;
//! This package consists of B-Rep and CSG Solid entities
class IGESSolid
{
-public:
-
- DEFINE_STANDARD_ALLOC
+ public:
-
//! Prepares dynamic data (Protocol, Modules) for this package
Standard_EXPORT static void Init();
//! Returns the Protocol for this Package
- Standard_EXPORT static Handle(IGESSolid_Protocol) Protocol();
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-friend class IGESSolid_Block;
-friend class IGESSolid_RightAngularWedge;
-friend class IGESSolid_Cylinder;
-friend class IGESSolid_ConeFrustum;
-friend class IGESSolid_Sphere;
-friend class IGESSolid_Torus;
-friend class IGESSolid_SolidOfRevolution;
-friend class IGESSolid_SolidOfLinearExtrusion;
-friend class IGESSolid_Ellipsoid;
-friend class IGESSolid_BooleanTree;
-friend class IGESSolid_SelectedComponent;
-friend class IGESSolid_SolidAssembly;
-friend class IGESSolid_ManifoldSolid;
-friend class IGESSolid_PlaneSurface;
-friend class IGESSolid_CylindricalSurface;
-friend class IGESSolid_ConicalSurface;
-friend class IGESSolid_SphericalSurface;
-friend class IGESSolid_ToroidalSurface;
-friend class IGESSolid_SolidInstance;
-friend class IGESSolid_VertexList;
-friend class IGESSolid_EdgeList;
-friend class IGESSolid_Loop;
-friend class IGESSolid_Face;
-friend class IGESSolid_Shell;
-friend class IGESSolid_ToolBlock;
-friend class IGESSolid_ToolRightAngularWedge;
-friend class IGESSolid_ToolCylinder;
-friend class IGESSolid_ToolConeFrustum;
-friend class IGESSolid_ToolSphere;
-friend class IGESSolid_ToolTorus;
-friend class IGESSolid_ToolSolidOfRevolution;
-friend class IGESSolid_ToolSolidOfLinearExtrusion;
-friend class IGESSolid_ToolEllipsoid;
-friend class IGESSolid_ToolBooleanTree;
-friend class IGESSolid_ToolSelectedComponent;
-friend class IGESSolid_ToolSolidAssembly;
-friend class IGESSolid_ToolManifoldSolid;
-friend class IGESSolid_ToolPlaneSurface;
-friend class IGESSolid_ToolCylindricalSurface;
-friend class IGESSolid_ToolConicalSurface;
-friend class IGESSolid_ToolSphericalSurface;
-friend class IGESSolid_ToolToroidalSurface;
-friend class IGESSolid_ToolSolidInstance;
-friend class IGESSolid_ToolVertexList;
-friend class IGESSolid_ToolEdgeList;
-friend class IGESSolid_ToolLoop;
-friend class IGESSolid_ToolFace;
-friend class IGESSolid_ToolShell;
-friend class IGESSolid_Protocol;
-friend class IGESSolid_ReadWriteModule;
-friend class IGESSolid_GeneralModule;
-friend class IGESSolid_SpecificModule;
-friend class IGESSolid_TopoBuilder;
-
+ Standard_EXPORT static const Handle(IGESSolid_Protocol) & Protocol();
};
-
-
-
-
-
-
#endif // _IGESSolid_HeaderFile
IGESToBRep_BRepEntity.hxx
IGESToBRep_CurveAndSurface.cxx
IGESToBRep_CurveAndSurface.hxx
-IGESToBRep_CurveAndSurface.lxx
IGESToBRep_IGESBoundary.cxx
IGESToBRep_IGESBoundary.hxx
IGESToBRep_IGESBoundary.lxx
//purpose :
//=======================================================================
-Handle(Transfer_Binder) IGESToBRep_Actor::Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_ProcessForTransient)& PT)
+Handle(Transfer_Binder) IGESToBRep_Actor::Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_Process)& PT)
{
DeclareAndCast(IGESData_IGESModel,mymodel,themodel);
DeclareAndCast(IGESData_IGESEntity,ent,start);
Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Standard_Transient)& start) Standard_OVERRIDE;
- Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_ProcessForTransient)& TP) Standard_OVERRIDE;
+ Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_Process)& TP) Standard_OVERRIDE;
Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& model);
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
-#include <Standard_Real.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
+#include <Transfer_TransientProcess.hxx>
class Geom_Surface;
class IGESData_IGESModel;
-class Transfer_TransientProcess;
class TopoDS_Shape;
class IGESData_IGESEntity;
class Message_Msg;
//! Provides methods to transfer CurveAndSurface from IGES to CASCADE.
class IGESToBRep_CurveAndSurface
{
-public:
+ public:
DEFINE_STANDARD_ALLOC
-
//! Creates a tool CurveAndSurface ready to run, with
//! epsilons set to 1.E-04, myModeTopo to True, the
//! optimization of the continuity to False.
Standard_EXPORT void Init();
//! Changes the value of "myEps"
- void SetEpsilon (const Standard_Real eps);
+ void SetEpsilon (const Standard_Real eps) { myEps = eps; }
//! Returns the value of "myEps"
- Standard_Real GetEpsilon() const;
+ Standard_Real GetEpsilon() const { return myEps; }
//! Changes the value of "myEpsCoeff"
- void SetEpsCoeff (const Standard_Real eps);
+ void SetEpsCoeff (const Standard_Real eps) { myEpsCoeff = eps; }
//! Returns the value of "myEpsCoeff"
- Standard_Real GetEpsCoeff() const;
+ Standard_Real GetEpsCoeff() const { return myEpsCoeff; }
//! Changes the value of "myEpsGeom"
Standard_EXPORT void SetEpsGeom (const Standard_Real eps);
//! Returns the value of "myEpsGeom"
- Standard_Real GetEpsGeom() const;
+ Standard_Real GetEpsGeom() const { return myEpsGeom; }
//! Changes the value of "myMinTol"
- void SetMinTol (const Standard_Real mintol);
+ void SetMinTol (const Standard_Real mintol) { myMinTol = mintol; }
//! Changes the value of "myMaxTol"
- void SetMaxTol (const Standard_Real maxtol);
+ void SetMaxTol (const Standard_Real maxtol) { myMaxTol = maxtol; }
//! Sets values of "myMinTol" and "myMaxTol" as follows
//! myMaxTol = Max ("read.maxprecision.val", myEpsGeom * myUnitFactor)
Standard_EXPORT void UpdateMinMaxTol();
//! Returns the value of "myMinTol"
- Standard_Real GetMinTol() const;
+ Standard_Real GetMinTol() const { return myMinTol; }
//! Returns the value of "myMaxTol"
- Standard_Real GetMaxTol() const;
+ Standard_Real GetMaxTol() const { return myMaxTol; }
//! Changes the value of "myModeApprox"
- void SetModeApprox (const Standard_Boolean mode);
+ void SetModeApprox (const Standard_Boolean mode) { myModeApprox = mode; }
//! Returns the value of "myModeApprox"
- Standard_Boolean GetModeApprox() const;
+ Standard_Boolean GetModeApprox() const { return myModeApprox; }
//! Changes the value of "myModeIsTopo"
- void SetModeTransfer (const Standard_Boolean mode);
+ void SetModeTransfer (const Standard_Boolean mode) { myModeIsTopo = mode; }
//! Returns the value of "myModeIsTopo"
- Standard_Boolean GetModeTransfer() const;
+ Standard_Boolean GetModeTransfer() const { return myModeIsTopo; }
//! Changes the value of "myContIsOpti"
- void SetOptimized (const Standard_Boolean optimized);
+ void SetOptimized (const Standard_Boolean optimized) { myContIsOpti = optimized; }
//! Returns the value of "myContIsOpti"
- Standard_Boolean GetOptimized() const;
+ Standard_Boolean GetOptimized() const { return myContIsOpti; }
//! Returns the value of " myUnitFactor"
- Standard_Real GetUnitFactor() const;
+ Standard_Real GetUnitFactor() const { return myUnitFactor; }
//! Changes the value of "mySurfaceCurve"
- void SetSurfaceCurve (const Standard_Integer ival);
+ void SetSurfaceCurve (const Standard_Integer ival) { mySurfaceCurve = ival; }
//! Returns the value of " mySurfaceCurve" 0 = value in
//! file , 2 = kepp 2d and compute 3d 3 = keep 3d and
//! compute 2d
- Standard_Integer GetSurfaceCurve() const;
+ Standard_Integer GetSurfaceCurve() const { return mySurfaceCurve; }
//! Set the value of "myModel"
Standard_EXPORT void SetModel (const Handle(IGESData_IGESModel)& model);
//! Returns the value of "myModel"
- Handle(IGESData_IGESModel) GetModel() const;
+ const Handle(IGESData_IGESModel) & GetModel() const { return myModel; }
//! Changes the value of "myContinuity"
//! if continuity = 0 do nothing else
//! if continuity = 1 try C1
//! if continuity = 2 try C2
- void SetContinuity (const Standard_Integer continuity);
+ void SetContinuity (const Standard_Integer continuity) { myContinuity = continuity; }
//! Returns the value of "myContinuity"
- Standard_Integer GetContinuity() const;
+ Standard_Integer GetContinuity() const { return myContinuity; }
//! Set the value of "myMsgReg"
- void SetTransferProcess (const Handle(Transfer_TransientProcess)& TP);
+ void SetTransferProcess (const Handle(Transfer_TransientProcess)& TP) { myTP = TP; }
//! Returns the value of "myMsgReg"
- Handle(Transfer_TransientProcess) GetTransferProcess() const;
+ const Handle(Transfer_TransientProcess) & GetTransferProcess() const { return myTP; }
//! Returns the result of the transfert of any IGES Curve
//! or Surface Entity. If the transfer has failed, this
Standard_EXPORT TopoDS_Shape TransferGeometry (const Handle(IGESData_IGESEntity)& start);
//! Records a new Fail message
- void SendFail (const Handle(IGESData_IGESEntity)& start, const Message_Msg& amsg);
+ void SendFail (const Handle(IGESData_IGESEntity)& start, const Message_Msg& amsg)
+ { myTP->SendFail(start,amsg); }
//! Records a new Warning message
- void SendWarning (const Handle(IGESData_IGESEntity)& start, const Message_Msg& amsg);
-
- //! Records a new Information message from the definition
- //! of a Msg (Original+Value)
- void SendMsg (const Handle(IGESData_IGESEntity)& start, const Message_Msg& amsg);
-
+ void SendWarning (const Handle(IGESData_IGESEntity)& start, const Message_Msg& amsg)
+ { myTP->SendWarning(start,amsg); }
+
//! Returns True if start was already treated and has a result in "myMap"
//! else returns False.
Standard_EXPORT Standard_Boolean HasShapeResult (const Handle(IGESData_IGESEntity)& start) const;
Standard_EXPORT Standard_Real GetUVResolution();
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
+ private:
Standard_Real myEps;
Standard_Real myEpsCoeff;
Standard_Boolean myIsResolCom;
Handle(IGESData_IGESModel) myModel;
Handle(Transfer_TransientProcess) myTP;
-
-
};
-
-#include <IGESToBRep_CurveAndSurface.lxx>
-
-
-
-
-
#endif // _IGESToBRep_CurveAndSurface_HeaderFile
+++ /dev/null
-// Created on: 2000-01-31
-// Created by: data exchange team
-// Copyright (c) 2000-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <Transfer_TransientProcess.hxx>
-#include <IGESData_IGESEntity.hxx>
-
-//=======================================================================
-//function : SetEpsilon
-//purpose :
-//=======================================================================
-
-inline void IGESToBRep_CurveAndSurface::SetEpsilon(const Standard_Real eps)
-{
- myEps = eps;
-}
-
-
-//=======================================================================
-//function : GetEpsilon
-//purpose :
-//=======================================================================
-
-inline Standard_Real IGESToBRep_CurveAndSurface::GetEpsilon() const
-{
- return myEps;
-}
-
-
-//=======================================================================
-//function : SetEpsCoeff
-//purpose :
-//=======================================================================
-
-inline void IGESToBRep_CurveAndSurface::SetEpsCoeff(const Standard_Real eps)
-{
- myEpsCoeff = eps;
-}
-
-
-//=======================================================================
-//function : GetEpsCoeff
-//purpose :
-//=======================================================================
-
-inline Standard_Real IGESToBRep_CurveAndSurface::GetEpsCoeff() const
-{
- return myEpsCoeff;
-}
-
-
-//=======================================================================
-//function : GetEpsGeom
-//purpose :
-//=======================================================================
-
-inline Standard_Real IGESToBRep_CurveAndSurface::GetEpsGeom() const
-{
- return myEpsGeom;
-}
-
-
-//=======================================================================
-//function : SetMinTol
-//purpose :
-//=======================================================================
-
-inline void IGESToBRep_CurveAndSurface::SetMinTol(const Standard_Real mintol)
-{
- myMinTol = mintol;
-}
-
-
-//=======================================================================
-//function : SetMaxTol
-//purpose :
-//=======================================================================
-
-inline void IGESToBRep_CurveAndSurface::SetMaxTol(const Standard_Real maxtol)
-{
- myMaxTol = maxtol;
-}
-
-
-//=======================================================================
-//function : GetMinTol
-//purpose :
-//=======================================================================
-
-inline Standard_Real IGESToBRep_CurveAndSurface::GetMinTol() const
-{
- return myMinTol;
-}
-
-
-//=======================================================================
-//function : GetMaxTol
-//purpose :
-//=======================================================================
-
-inline Standard_Real IGESToBRep_CurveAndSurface::GetMaxTol() const
-{
- return myMaxTol;
-}
-
-
-//=======================================================================
-//function : SetModeApprox
-//purpose :
-//=======================================================================
-
-inline void IGESToBRep_CurveAndSurface::SetModeApprox(const Standard_Boolean mode)
-{
- myModeApprox = mode;
-}
-
-
-//=======================================================================
-//function : GetModeApprox
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean IGESToBRep_CurveAndSurface::GetModeApprox() const
-{
- return myModeApprox;
-}
-
-
-//=======================================================================
-//function : SetModeTransfer
-//purpose :
-//=======================================================================
-
-inline void IGESToBRep_CurveAndSurface::SetModeTransfer(const Standard_Boolean mode)
-{
- myModeIsTopo = mode;
-}
-
-
-//=======================================================================
-//function : GetModeTransfer
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean IGESToBRep_CurveAndSurface::GetModeTransfer() const
-{
- return myModeIsTopo;
-}
-
-
-//=======================================================================
-//function : SetOptimized
-//purpose :
-//=======================================================================
-
-inline void IGESToBRep_CurveAndSurface::SetOptimized(const Standard_Boolean optimized)
-{
- myContIsOpti = optimized;
-}
-
-
-//=======================================================================
-//function : GetOptimized
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean IGESToBRep_CurveAndSurface::GetOptimized() const
-{
- return myContIsOpti;
-}
-
-
-//=======================================================================
-//function : GetUnitFactor
-//purpose :
-//=======================================================================
-
-inline Standard_Real IGESToBRep_CurveAndSurface::GetUnitFactor() const
-{
- return myUnitFactor;
-}
-
-
-//=======================================================================
-//function : SetSurfaceCurve
-//purpose :
-//=======================================================================
-
-inline void IGESToBRep_CurveAndSurface::SetSurfaceCurve(const Standard_Integer ival)
-{
- mySurfaceCurve = ival;
-}
-
-
-//=======================================================================
-//function : GetSurfaceCurve
-//purpose :
-//=======================================================================
-
-inline Standard_Integer IGESToBRep_CurveAndSurface::GetSurfaceCurve() const
-{
- return mySurfaceCurve;
-}
-
-
-//=======================================================================
-//function : GetModel
-//purpose :
-//=======================================================================
-
-inline Handle(IGESData_IGESModel) IGESToBRep_CurveAndSurface::GetModel() const
-{
- return myModel;
-}
-
-
-//=======================================================================
-//function : SetContinuity
-//purpose :
-//=======================================================================
-
-inline void IGESToBRep_CurveAndSurface::SetContinuity(const Standard_Integer continuity)
-{
- myContinuity = continuity;
-}
-
-
-//=======================================================================
-//function : GetContinuity
-//purpose :
-//=======================================================================
-
-inline Standard_Integer IGESToBRep_CurveAndSurface::GetContinuity() const
-{
- return myContinuity;
-}
-
-
-//=======================================================================
-//function : SetTransferProcess
-//purpose :
-//=======================================================================
-
-inline void IGESToBRep_CurveAndSurface::SetTransferProcess(const Handle(Transfer_TransientProcess)& TP)
-{
- myTP = TP;
-}
-
-
-//=======================================================================
-//function : GetTransferProcess
-//purpose :
-//=======================================================================
-
-inline Handle(Transfer_TransientProcess) IGESToBRep_CurveAndSurface::GetTransferProcess() const
-{
- return myTP;
-}
-
-
-//=======================================================================
-//function : SendFail
-//purpose :
-//=======================================================================
-
-inline void IGESToBRep_CurveAndSurface::SendFail (const Handle(IGESData_IGESEntity)& start,
- const Message_Msg& amsg)
-{
- GetTransferProcess()->SendFail(start,amsg);
-}
-
-
-//=======================================================================
-//function : SendWarning
-//purpose :
-//=======================================================================
-
-inline void IGESToBRep_CurveAndSurface::SendWarning (const Handle(IGESData_IGESEntity)& start,
- const Message_Msg& amsg)
-{
- GetTransferProcess()->SendWarning(start,amsg);
-}
-
-
-//=======================================================================
-//function : SendMsg
-//purpose :
-//=======================================================================
-
-inline void IGESToBRep_CurveAndSurface::SendMsg (const Handle(IGESData_IGESEntity)& start,
- const Message_Msg& amsg)
-{
- GetTransferProcess()->SendMsg(start,amsg);
-}
-
-
#include <TopAbs.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Shape.hxx>
-#include <Transfer_IteratorOfProcessForTransient.hxx>
#include <Transfer_TransientProcess.hxx>
#include <TransferBRep.hxx>
#include <TransferBRep_ShapeBinder.hxx>
#include <XSAlgo_AlgoContainer.hxx>
#include <stdio.h>
-//#include <ShapeCustom.hxx>
#ifdef _MSC_VER
#include <stdlib.h>
#else
//function : IGESToBRep_Reader
//purpose :
//=======================================================================
- IGESToBRep_Reader::IGESToBRep_Reader ()
+
+IGESToBRep_Reader::IGESToBRep_Reader ()
{
theDone = Standard_False;
if (protocol.IsNull()) {
theProc = new Transfer_TransientProcess;
}
-
//=======================================================================
//function : LoadFile
//purpose : loads a Model from a file
{
if ( theProc.IsNull() )
theProc = new Transfer_TransientProcess;
- Handle(Message_Messenger) TF = theProc->Messenger();
+
+ const Handle(Message_Messenger) &TF = theProc->Messenger();
// Message for Diagnostic file.
Message_Msg msg2000("IGES_2000");
msg2000.Arg(filename);
TF->Send (msg2000, Message_Info);
- //Message_Msg msg2001("IGES_2001"); // Date
Message_Msg msg2005("IGES_2005");
msg2005.Arg(theProc->TraceLevel());
TF->Send (msg2005, Message_Info);
// Sending of message : IGES file opening error
Message_Msg Msg2("XSTEP_2");
TF->Send (Msg2, Message_Info);
- //Message_Msg Msg3("XSTEP_3");
- //Message_Msg Msg4("XSTEP_4");
- //Message_Msg Msg5("XSTEP_5");
- //Message_Msg Msg6("XSTEP_6");
- //Message_Msg Msg7("XSTEP_7");
// Reasons of the file opening error
switch(errno)
{
nbWarn += ach->NbWarnings();
nbFail += ach->NbFails();
}
-// Messages nbWarn and nbFail;
Msg25.Arg(nbFail);
Msg26.Arg(nbWarn);
TF->Send (Msg25, Message_Info);
return StatusFile;
}
-
//=======================================================================
//function : SetModel
//purpose : Specifies a Model to work on
//=======================================================================
- void IGESToBRep_Reader::SetModel (const Handle(IGESData_IGESModel)& model)
+
+void IGESToBRep_Reader::SetModel (const Handle(IGESData_IGESModel)& model)
{
theModel = model;
theDone = Standard_False;
theProc->Clear();
}
-
-//=======================================================================
-//function : Model
-//purpose : returns the Model to be worked on
-//=======================================================================
- Handle(IGESData_IGESModel) IGESToBRep_Reader::Model () const
- { return theModel; }
-
-
-//=======================================================================
-//function : SetTransientProcess
-//purpose : Specifies a TransferProcess
-//=======================================================================
- void IGESToBRep_Reader::SetTransientProcess
- (const Handle(Transfer_TransientProcess)& TP)
- { theProc = TP; }
-
-//=======================================================================
-//function : TransientProcess
-//purpose : Returns the TransferProcess
-//=======================================================================
- Handle(Transfer_TransientProcess) IGESToBRep_Reader::TransientProcess () const
- { return theProc; }
-
-//=======================================================================
-//function : Actor
-//purpose : returns theActor
-//=======================================================================
- Handle(IGESToBRep_Actor) IGESToBRep_Reader::Actor () const
- { return theActor; }
-
-
-//=======================================================================
-//function : Clear
-//purpose : Clears the result and Done status
-//=======================================================================
- void IGESToBRep_Reader::Clear ()
-{
- theDone = Standard_False;
- theShapes.Clear();
-}
-
-
//=======================================================================
//function : Check
//purpose : Checks the Model
//=======================================================================
- Standard_Boolean IGESToBRep_Reader::Check
- (const Standard_Boolean withprint) const
+
+Standard_Boolean IGESToBRep_Reader::Check (const Standard_Boolean withprint) const
{
Interface_CheckTool cht (theModel,protocol);
Interface_CheckIterator chl = cht.CompleteCheckList();
if (withprint && !theProc.IsNull())
- cht.Print(chl, theProc->Messenger());
+ chl.Print(theProc->Messenger(),theModel,Standard_False);
return chl.IsEmpty(Standard_True);
}
-
-//=======================================================================
-//function : IsDone
-//purpose : returns True if the last transfert was a success
-//=======================================================================
- Standard_Boolean IGESToBRep_Reader::IsDone () const
- { return theDone; }
-
-
//=======================================================================
//function : EncodeRegul
//purpose : INTERNAL to encode regularity on edges
return Standard_True;
}
-//=======================================================================
-//function : UpdateMap
-//purpose : Updates the correspondence map (Transfer_TransientProcess),
-// setting as translation results, the shapes received after
-// modification by modifier (BRepTools_Modifier)
-//warning : BRepTools_Modifier raises exception when it cannot find input
-// shape in its internal list
-//=======================================================================
-
-// coment as unused PTV 18.09.2000
-// static void UpdateMap (const Handle(Transfer_TransientProcess)& map,
-// const BRepTools_Modifier& modifier)
-// {
-// Transfer_IteratorOfProcessForTransient iterator = map->CompleteResult(Standard_True);
-// for (iterator.Start(); iterator.More(); iterator.Next()) {
-// const Handle(Transfer_Binder) binder = iterator.Value();
-// try { //to avoid exception in BRepTools_Modifier
-// OCC_CATCH_SIGNALS
-// if (binder->IsKind (STANDARD_TYPE (TransferBRep_ShapeBinder))) {
-// DeclareAndCast(TransferBRep_ShapeBinder, shapebinder, binder);
-// if (shapebinder->HasResult()) {
-// TopoDS_Shape result = shapebinder->Result();
-// TopoDS_Shape modified = modifier.ModifiedShape (result);
-// if (shapebinder->Status() != Transfer_StatusUsed) //to avoid exception
-// shapebinder->SetResult (modified);
-// }
-// }
-// else if (binder->IsKind (STANDARD_TYPE (TransferBRep_ShapeListBinder))) {
-// DeclareAndCast(TransferBRep_ShapeListBinder, shapelistbinder, binder);
-// for (Standard_Integer i = 1; i <= shapelistbinder->NbShapes(); i++) {
-// TopoDS_Shape result = shapelistbinder->Shape (i);
-// TopoDS_Shape modified = modifier.ModifiedShape (result);
-// shapelistbinder->SetResult (i, modified);
-// }
-// }
-// }
-// catch(Standard_Failure) {
-// continue;
-// }
-// }
-// }
-
//=======================================================================
//function : TrimTolerances
//purpose : Trims tolerances of the shape according to static parameters
//
//=======================================================================
-static void TrimTolerances (const TopoDS_Shape& shape,
- const Standard_Real tol)
+static void TrimTolerances (const TopoDS_Shape& shape, const Standard_Real tol)
{
if( Interface_Static::IVal("read.maxprecision.mode")==1) {
ShapeFix_ShapeTolerance SFST;
//function : TransferRoots
//purpose : Transfers all Roots Entities
//=======================================================================
+
void IGESToBRep_Reader::TransferRoots (const Standard_Boolean onlyvisible)
{
if (theModel.IsNull() || theProc.IsNull()) return;
TF->Send (msg2065, Message_Info);
}
-
//=======================================================================
//function : Transfer
//purpose : Transfers an Entity given
//=======================================================================
+
Standard_Boolean IGESToBRep_Reader::Transfer(const Standard_Integer num)
{
Handle(Message_Messenger) TF = theProc->Messenger();
return Standard_True;
}
-
//=======================================================================
//function : UsedTolerance
//purpose : Returns the used tolerance (input)
//=======================================================================
- Standard_Real IGESToBRep_Reader::UsedTolerance () const
- { return theActor->UsedTolerance(); }
-
-//=======================================================================
-//function : NbShapes
-//purpose : Returns the count of produced Shapes
-//=======================================================================
- Standard_Integer IGESToBRep_Reader::NbShapes () const
- { return theShapes.Length(); }
+Standard_Real IGESToBRep_Reader::UsedTolerance () const
+{ return theActor->UsedTolerance(); }
//=======================================================================
//function : Shape
//purpose : Returns a Shape given its rank
//=======================================================================
- TopoDS_Shape IGESToBRep_Reader::Shape (const Standard_Integer num) const
+
+TopoDS_Shape IGESToBRep_Reader::Shape (const Standard_Integer num) const
{
TopoDS_Shape res;
if (num > 0 && num <= theShapes.Length()) res = theShapes.Value(num);
return res;
}
-
//=======================================================================
//function : OneShape
//purpose : Returns a unique Shape
//=======================================================================
- TopoDS_Shape IGESToBRep_Reader::OneShape () const
+
+TopoDS_Shape IGESToBRep_Reader::OneShape () const
{
TopoDS_Shape res;
Standard_Integer nb = theShapes.Length();
Standard_EXPORT void SetModel (const Handle(IGESData_IGESModel)& model);
//! Returns the Model to be worked on.
- Standard_EXPORT Handle(IGESData_IGESModel) Model() const;
+ const Handle(IGESData_IGESModel) & Model() const { return theModel; }
//! Allows to set an already defined TransientProcess
//! (to be called after LoadFile or SetModel)
- Standard_EXPORT void SetTransientProcess (const Handle(Transfer_TransientProcess)& TP);
+ void SetTransientProcess (const Handle(Transfer_TransientProcess)& TP) { theProc = TP; }
//! Returns the TransientProcess
- Standard_EXPORT Handle(Transfer_TransientProcess) TransientProcess() const;
-
+ const Handle(Transfer_TransientProcess) & TransientProcess() const { return theProc; }
+
//! Returns "theActor"
- Standard_EXPORT Handle(IGESToBRep_Actor) Actor() const;
+ const Handle(IGESToBRep_Actor) & Actor() const { return theActor; }
//! Clears the results between two translation operations.
- Standard_EXPORT void Clear();
-
+ void Clear() { theDone = Standard_False; theShapes.Clear(); }
+
//! Checks the IGES file that was
//! loaded into memory. Displays error messages in the default
//! message file if withprint is true. Returns True if no fail
Standard_EXPORT Standard_Boolean Transfer (const Standard_Integer num);
//! Returns True if the LAST Transfer/TransferRoots was a success
- Standard_EXPORT Standard_Boolean IsDone() const;
-
+ Standard_Boolean IsDone() const { return theDone; }
+
//! Returns the Tolerance which has been actually used, converted
//! in millimeters
//! (either that from File or that from Session, according the mode)
Standard_EXPORT Standard_Real UsedTolerance() const;
//! Returns the number of shapes produced by the translation.
- Standard_EXPORT Standard_Integer NbShapes() const;
+ Standard_Integer NbShapes() const { return theShapes.Length(); }
//! Returns the num the resulting shape in a translation operation.
Standard_EXPORT TopoDS_Shape Shape (const Standard_Integer num = 1) const;
//! - a compound containing the resulting shapes if there are several.
Standard_EXPORT TopoDS_Shape OneShape() const;
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
+ private:
Handle(IGESData_IGESModel) theModel;
Standard_Boolean theDone;
TopTools_SequenceOfShape theShapes;
Handle(IGESToBRep_Actor) theActor;
Handle(Transfer_TransientProcess) theProc;
-
-
};
-
-
-
-
-
-
#endif // _IGESToBRep_Reader_HeaderFile
Interface_STAT.hxx
Interface_Static.cxx
Interface_Static.hxx
-Interface_Statics.hxx
Interface_StaticStandards.cxx
Interface_Translates.hxx
Interface_TypedValue.cxx
Interface_CheckTool::Interface_CheckTool(const Handle(Interface_InterfaceModel)& model,
const Handle(Interface_Protocol)& protocol)
- : thegtool ( new Interface_GTool(protocol,model->NbEntities()) ) ,
- theshare (model,protocol)
-{
- thestat = 0;
-}
-
-
-//=======================================================================
-//function : Interface_CheckTool
-//purpose :
-//=======================================================================
-
-Interface_CheckTool::Interface_CheckTool(const Handle(Interface_InterfaceModel)& model)
- : thegtool(model->GTool()) , theshare (model,model->GTool())
-{
- thestat = 0;
- thegtool->Reservate(model->NbEntities());
-}
-
+: Interface_ShareTool (model),
+ thegtool (new Interface_GTool(protocol,model->NbEntities())),
+ thestat (0)
+{}
//=======================================================================
//function : Interface_CheckTool
//=======================================================================
Interface_CheckTool::Interface_CheckTool(const Interface_Graph& graph)
- : thegtool(graph.Model()->GTool()) , theshare (graph)
-{
-}
-
+: Interface_ShareTool (graph),
+ thegtool (graph.Model()->GTool()),
+ thestat (0)
+{}
//=======================================================================
//function : Interface_CheckTool
//=======================================================================
Interface_CheckTool::Interface_CheckTool(const Handle(Interface_HGraph)& hgraph)
- : thegtool(hgraph->Graph().Model()->GTool()) , theshare (hgraph)
-{
-}
-
-
-//=======================================================================
-//function : FillCheck
-//purpose :
-//=======================================================================
-
-void Interface_CheckTool::FillCheck(const Handle(Standard_Transient)& ent,
- const Interface_ShareTool& sh,
- Handle(Interface_Check)& ach)
-{
- Handle(Interface_GeneralModule) module;
- Standard_Integer CN;
- if (thegtool->Select(ent,module,CN)) {
-// Sans try/catch (fait par l appelant, evite try/catch en boucle)
- if (!errh) {
- module->CheckCase(CN,ent,sh,ach);
- return;
- }
-// Avec try/catch
- try {
- OCC_CATCH_SIGNALS
- module->CheckCase(CN,ent,sh,ach);
- }
- catch (Standard_Failure) {
- raisecheck(ach);
- }
- }
- else {
- DeclareAndCast(Interface_ReportEntity,rep,ent);
- if (rep.IsNull()) return;
- ach = rep->Check();
- }
- if (theshare.Graph().HasShareErrors(ent))
- ach->AddFail("** Shared Items unknown from the containing Model");
-}
-
-
-//=======================================================================
-//function : Print
-//purpose :
-//=======================================================================
-
-void Interface_CheckTool::Print(const Handle(Interface_Check)& ach,
- const Handle(Message_Messenger)& S) const
-{
- Standard_Integer i, nb;
- nb = ach->NbFails();
- if (nb > 0) S << " Fail Messages : " << nb << " :\n";
- for (i = 1; i <= nb; i ++) {
- S << ach->Fail(i) << "\n";
- }
- nb = ach->NbWarnings();
- if (nb > 0) S << " Warning Messages : " << nb << " :\n";
- for (i = 1; i <= nb; i ++) {
- S << ach->Warning(i) << "\n";
- }
-}
-
-
-//=======================================================================
-//function : Print
-//purpose :
-//=======================================================================
-
-void Interface_CheckTool::Print(const Interface_CheckIterator& list,
- const Handle(Message_Messenger)& S) const
-{
- Handle(Interface_InterfaceModel) model = theshare.Model();
- list.Print(S,model,Standard_False);
-}
+: Interface_ShareTool (hgraph),
+ thegtool (hgraph->Graph().Model()->GTool()),
+ thestat (0)
+{}
// .... Check General sur un Modele ....
-
-// Check : Une Entite d un Modele, designee par son rang
-
-
-//=======================================================================
-//function : Check
-//purpose :
-//=======================================================================
-
-Handle(Interface_Check) Interface_CheckTool::Check(const Standard_Integer num)
-{
- Handle(Interface_InterfaceModel) model = theshare.Model();
- Handle(Standard_Transient) ent = model->Value(num);
- Handle(Interface_Check) ach = new Interface_Check(ent); // non filtre par "Warning" : tel quel
- errh = 1;
- FillCheck(ent,theshare,ach);
- return ach;
-}
-
-
-// CheckSuccess : test passe-passe pas, sur CheckList(Fail) des Entites
-
-
-//=======================================================================
-//function : CheckSuccess
-//purpose :
-//=======================================================================
-
-void Interface_CheckTool::CheckSuccess (const Standard_Boolean reset)
-{
- if (reset) thestat = 0;
- if (thestat > 3) Interface_CheckFailure::Raise // deja teste avec erreur
- ("Interface Model : Global Check");
- Handle(Interface_InterfaceModel) model = theshare.Model();
- if (model->GlobalCheck()->NbFails() > 0) Interface_CheckFailure::Raise
- ("Interface Model : Global Check");
- Handle(Interface_Check) modchk = new Interface_Check;
- model->VerifyCheck(modchk);
- if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (theshare.Graph(),modchk);
- if (modchk->HasFailed()) Interface_CheckFailure::Raise
- ("Interface Model : Verify Check");
- if (thestat == 3) return; // tout teste et ca passe
-
- errh = 0; // Pas de try/catch, car justement on raise
- Standard_Integer nb = model->NbEntities();
- for (Standard_Integer i = 1; i <= nb; i ++) {
- if (model->IsErrorEntity(i)) Interface_CheckFailure::Raise
- ("Interface Model : an Entity is recorded as Erroneous");
- Handle(Standard_Transient) ent = model->Value(i);
- if (thestat & 1) {
- if (!model->IsErrorEntity(i)) continue; // deja verify, reste analyse
- }
- if (thestat & 2) {
- if ( model->IsErrorEntity(i)) continue; // deja analyse, reste verify
- }
-
- Handle(Interface_Check) ach = new Interface_Check(ent);
- FillCheck(ent,theshare,ach);
- if (ach->HasFailed()) Interface_CheckFailure::Raise
- ("Interface Model : Check on an Entity has Failed");
- }
-}
-
-
// CompleteCheckList : Tous Tests : GlobalCheck, Analyse-Verify en Fail ou en
// Warning; plus les Unknown Entities (par Check vide)
-
//=======================================================================
//function : CompleteCheckList
//purpose :
Interface_CheckIterator Interface_CheckTool::CompleteCheckList ()
{
thestat = 3;
- Handle(Interface_InterfaceModel) model = theshare.Model();
+ const Handle(Interface_InterfaceModel) &model = Graph().Model();
Interface_CheckIterator res;
res.SetModel(model);
Handle(Interface_Check) globch = model->GlobalCheck(); // GlobalCheck Statique
- if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (theshare.Graph(),globch);
+ if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (Graph(),globch);
model->VerifyCheck(globch); // GlobalCheck Dynamique
if (globch->HasFailed() || globch->HasWarnings()) res.Add(globch,0);
if (globch->HasFailed()) thestat |= 12;
if (ach->HasFailed()) // FAIL : pas de Check semantique
{ res.Add(ach,i); ach = new Interface_Check; thestat |= 12; continue; }
}
- if (!model->HasSemanticChecks()) FillCheck(ent,theshare,ach);
+ if (!model->HasSemanticChecks()) FillCheck(ent,ach);
else ach->GetMessages (model->Check (i,Standard_False));
if (ach->HasFailed() || ach->HasWarnings())
{ res.Add(ach,i); ach = new Interface_Check; if (ach->HasFailed()) thestat |= 12; }
// CheckList : Check Fail sur Entites, en Analyse (Read time) ou Verify
-
//=======================================================================
//function : CheckList
//purpose :
Interface_CheckIterator Interface_CheckTool::CheckList ()
{
thestat = 3;
- Handle(Interface_InterfaceModel) model = theshare.Model();
+ const Handle(Interface_InterfaceModel) &model = Graph().Model();
Interface_CheckIterator res;
res.SetModel(model);
Standard_Integer i=0, n0 = 1, nb = model->NbEntities();
Handle(Interface_Check) globch = model->GlobalCheck();
- if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (theshare.Graph(),globch);
+ if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (Graph(),globch);
model->VerifyCheck(globch);
if (globch->HasFailed()) { thestat |= 12; res.Add(globch,0); }
ent = model->Value(i);
ach->Clear();
ach->SetEntity(ent);
- if (!model->HasSemanticChecks()) FillCheck(ent,theshare,ach);
+ if (!model->HasSemanticChecks()) FillCheck(ent,ach);
else ach = model->Check (i,Standard_False);
if (ach->HasFailed()) { thestat |= 12; res.Add(ach,i); }
}
Interface_CheckIterator Interface_CheckTool::AnalyseCheckList ()
{
thestat = 2;
- Handle(Interface_InterfaceModel) model = theshare.Model();
+ const Handle(Interface_InterfaceModel) &model = Graph().Model();
Interface_CheckIterator res;
res.SetModel(model);
Standard_Integer i=0, n0 = 1, nb = model->NbEntities();
try {
OCC_CATCH_SIGNALS
for (i = n0; i <= nb; i ++) {
- if (!model->IsReportEntity(i)) continue;
- Handle(Interface_ReportEntity) rep = model->ReportEntity(i);
- ach = rep->Check();
- if (ach->HasFailed() || ach->HasWarnings())
- { thestat |= 8; res.Add(ach,i); }
+ if (!model->IsReportEntity(i)) continue;
+ ach = model->ReportEntity(i)->Check();
+ if (ach->HasFailed() || ach->HasWarnings())
+ { thestat |= 8; res.Add(ach,i); }
}
n0 = nb+1;
}
Interface_CheckIterator Interface_CheckTool::VerifyCheckList ()
{
thestat = 1;
- Handle(Interface_InterfaceModel) model = theshare.Model();
+ const Handle(Interface_InterfaceModel) &model = Graph().Model();
Interface_CheckIterator res;
res.SetModel(model);
Standard_Integer i=0, n0 = 1, nb = model->NbEntities();
try {
OCC_CATCH_SIGNALS
for (i = n0; i <= nb; i ++) {
- if (model->IsErrorEntity(i)) continue;
- ent = model->Value(i);
- ach->Clear();
- ach->SetEntity(ent);
- if (!model->HasSemanticChecks()) FillCheck(ent,theshare,ach);
- else ach = model->Check (i,Standard_False);
- if (ach->HasFailed() || ach->HasWarnings())
- { thestat |= 4; res.Add(ach,i); }
+ if (model->IsErrorEntity(i)) continue;
+ ent = model->Value(i);
+ ach->Clear();
+ ach->SetEntity(ent);
+ if (!model->HasSemanticChecks()) FillCheck(ent,ach);
+ else ach = model->Check (i,Standard_False);
+ if (ach->HasFailed() || ach->HasWarnings())
+ { thestat |= 4; res.Add(ach,i); }
}
n0 = nb+1;
}
return res;
}
-
-// Warnings sur Entites (Read time ou apres)
-
-
//=======================================================================
-//function : WarningCheckList
+//function : FillCheck
//purpose :
//=======================================================================
-Interface_CheckIterator Interface_CheckTool::WarningCheckList ()
+void Interface_CheckTool::FillCheck(const Handle(Standard_Transient)& ent,
+ Handle(Interface_Check)& ach)
{
- thestat = 3;
- Handle(Interface_InterfaceModel) model = theshare.Model();
- Interface_CheckIterator res;
- res.SetModel(model);
- Standard_Integer i=0, n0 = 1, nb = model->NbEntities();
-
- errh = 0;
- while (n0 <= nb) {
- Handle(Interface_Check) ach = new Interface_Check;
- Handle(Standard_Transient) ent;
+ Handle(Interface_GeneralModule) module;
+ Standard_Integer CN;
+ if (thegtool->Select(ent,module,CN)) {
+// Sans try/catch (fait par l appelant, evite try/catch en boucle)
+ if (!errh) {
+ module->CheckCase(CN,ent,*this,ach);
+ return;
+ }
+// Avec try/catch
try {
OCC_CATCH_SIGNALS
- for (i = n0; i <= nb; i ++) {
- ach->Clear();
- ach->SetEntity (ent);
- if (model->IsReportEntity(i)) {
- Handle(Interface_ReportEntity) rep = model->ReportEntity(i);
- if (rep->IsError()) { thestat |= 12; continue; }
- ach = rep->Check();
- }
- ent = model->Value(i);
- if (!model->HasSemanticChecks()) FillCheck(ent,theshare,ach);
- else ach = model->Check (i,Standard_False);
- if (ach->HasFailed()) thestat |= 12;
- else if (ach->HasWarnings()) res.Add(ach,i);
- }
- n0 = nb+1;
+ module->CheckCase(CN,ent,*this,ach);
}
- catch(Standard_Failure) {
- n0 = i+1;
+ catch (Standard_Failure) {
raisecheck(ach);
- res.Add(ach,i); thestat |= 12;
}
}
-
- return res;
-}
-
-
-//=======================================================================
-//function : UnknownEntities
-//purpose :
-//=======================================================================
-
-Interface_EntityIterator Interface_CheckTool::UnknownEntities ()
-{
- Handle(Interface_InterfaceModel) model = theshare.Model();
- Interface_EntityIterator res;
- Standard_Integer nb = model->NbEntities();
- for (Standard_Integer i = 1; i <= nb; i ++) {
- if (model->IsUnknownEntity(i)) res.GetOneItem(model->Value(i));
+ else {
+ DeclareAndCast(Interface_ReportEntity,rep,ent);
+ if (rep.IsNull()) return;
+ ach = rep->Check();
}
- return res;
+ if (Graph().HasShareErrors(ent))
+ ach->AddFail("** Shared Items unknown from the containing Model");
}
#include <Standard_Handle.hxx>
#include <Interface_ShareTool.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Boolean.hxx>
class Interface_GTool;
-class Interface_CheckFailure;
class Interface_InterfaceModel;
class Interface_Protocol;
class Interface_Graph;
class Interface_HGraph;
-class Standard_Transient;
-class Interface_ShareTool;
class Interface_Check;
class Message_Messenger;
class Interface_CheckIterator;
-class Interface_EntityIterator;
//! Performs Checks on Entities, using General Service Library and
//! Modules to work. Works on one Entity or on a complete Model
-class Interface_CheckTool
+class Interface_CheckTool : public Interface_ShareTool
{
-public:
+ public:
DEFINE_STANDARD_ALLOC
-
//! Creates a CheckTool, by calling the General Service Library
//! and Modules, selected through a Protocol, to work on a Model
//! Moreover, Protocol recognizes Unknown Entities
Standard_EXPORT Interface_CheckTool(const Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol);
- //! Creates a CheckTool, by calling the General Service Library
- //! and Modules, selected through a Protocol, to work on a Model
- //! Protocol and so on are taken from the Model (its GTool)
- Standard_EXPORT Interface_CheckTool(const Handle(Interface_InterfaceModel)& model);
-
//! Creates a CheckTool from a Graph. The Graph contains a Model
//! which designates a Protocol: they are used to create ShareTool
Standard_EXPORT Interface_CheckTool(const Interface_Graph& graph);
Standard_EXPORT Interface_CheckTool(const Handle(Interface_HGraph)& hgraph);
- //! Fills as required a Check with the Error and Warning messages
- //! produced by Checking a given Entity.
- //! For an Erroneous or Corrected Entity : Check build at Analyse
- //! time; else, Check computed for Entity (Verify integrity), can
- //! use a Graph as required to control context
- Standard_EXPORT void FillCheck (const Handle(Standard_Transient)& ent, const Interface_ShareTool& sh, Handle(Interface_Check)& ach);
-
- //! Utility method which Prints the content of a Check
- Standard_EXPORT void Print (const Handle(Interface_Check)& ach, const Handle(Message_Messenger)& S) const;
-
- //! Simply Lists all the Checks and the Content (messages) and the
- //! Entity, if there is, of each Check
- //! (if all Checks are OK, nothing is Printed)
- Standard_EXPORT void Print (const Interface_CheckIterator& list, const Handle(Message_Messenger)& S) const;
-
- //! Returns the Check associated to an Entity identified by
- //! its Number in a Model.
- Standard_EXPORT Handle(Interface_Check) Check (const Standard_Integer num);
-
- //! Checks if any Error has been detected (CheckList not empty)
- //! Returns normally if none, raises exception if some exists.
- //! It reuses the last computations from other checking methods,
- //! unless the argument <resest> is given True
- Standard_EXPORT void CheckSuccess (const Standard_Boolean reset = Standard_False);
-
//! Returns list of all "remarkable" informations, which include :
//! - GlobalCheck, if not empty
//! - Error Checks, for all Errors (Verify + Analyse)
//! Returns list of integrity constraints errors (semantic)
//! (note that GlobalCheck is not in this list)
Standard_EXPORT Interface_CheckIterator VerifyCheckList();
-
- //! Returns list of Corrections (includes GlobalCheck if corrected)
- Standard_EXPORT Interface_CheckIterator WarningCheckList();
-
- //! Returns list of Unknown Entities
- //! Note that Error and Erroneous Entities are not considered
- //! as Unknown
- Standard_EXPORT Interface_EntityIterator UnknownEntities();
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
+ private:
+
+ //! Fills as required a Check with the Error and Warning messages
+ //! produced by Checking a given Entity.
+ //! For an Erroneous or Corrected Entity : Check build at Analyse
+ //! time; else, Check computed for Entity (Verify integrity), can
+ //! use a Graph as required to control context
+ Standard_EXPORT void FillCheck (const Handle(Standard_Transient)& ent, Handle(Interface_Check)& ach);
Handle(Interface_GTool) thegtool;
- Interface_ShareTool theshare;
Standard_Integer thestat;
-
-
};
-
-
-
-
-
-
#endif // _Interface_CheckTool_HeaderFile
#include <Interface_EntityIterator.hxx>
-#include <Interface_IntVal.hxx>
#include <Standard_NoMoreObject.hxx>
#include <Standard_NoSuchObject.hxx>
-#include <Standard_Transient.hxx>
-// Iterateur pour ecriture for, ou while avec Next en fin :
-// for (creer iterateur; iter.More(); iter.Next()) { val = iter.Value(); ... }
-// .... Definitions initiales : en particulier celles requises pour
-// les outils de graphe (construction avec le graphe, avec un vertex)
-Interface_EntityIterator::Interface_EntityIterator ()
+Interface_EntityIterator::Interface_EntityIterator (const Handle(TColStd_HSequenceOfTransient)& list)
{
-// thecurr = new Interface_IntVal;
-// thecurr->CValue() = 0;
-// thelist = new TColStd_HSequenceOfTransient(); // constructeur vide
-// thelist sera construit au premier Add (quelquefois, il nyena pas)
-}
-
- Interface_EntityIterator::Interface_EntityIterator
- (const Handle(TColStd_HSequenceOfTransient)& list)
-{
- thecurr = new Interface_IntVal;
- thecurr->CValue() = 0;
+ thecurr = 0;
thelist = list;
}
- void Interface_EntityIterator::AddList
- (const Handle(TColStd_HSequenceOfTransient)& list)
+void Interface_EntityIterator::AddList (const Handle(TColStd_HSequenceOfTransient)& list)
{
if (thelist.IsNull()) thelist = new TColStd_HSequenceOfTransient();
- if (thecurr.IsNull()) thecurr = new Interface_IntVal;
- thecurr->CValue() = 0;
+ thecurr = 0;
thelist->Append(list);
}
- void Interface_EntityIterator::AddItem
- (const Handle(Standard_Transient)& anentity)
+void Interface_EntityIterator::AddItem (const Handle(Standard_Transient)& anentity)
{
if (anentity.IsNull()) return;
- if (thecurr.IsNull()) thecurr = new Interface_IntVal;
if (thelist.IsNull()) thelist = new TColStd_HSequenceOfTransient();
- thecurr->CValue() = 0;
+ thecurr = 0;
thelist->Append(anentity);
}
- void Interface_EntityIterator::GetOneItem
- (const Handle(Standard_Transient)& anentity)
- { AddItem(anentity); }
-
- void Interface_EntityIterator::Reset ()
+void Interface_EntityIterator::Reset ()
{
- if (thecurr.IsNull()) thecurr = new Interface_IntVal;
- thecurr->CValue() = 0;
+ thecurr = 0;
thelist = new TColStd_HSequenceOfTransient();
}
-
// .... Fonctionnalites de tri prealable a l'iteration ....
// Facon "bete" : supprimer les termes qui ne conviennent pas : lent !
// Mieux vaut refaire une autre sequence a cote
- void Interface_EntityIterator::SelectType
- (const Handle(Standard_Type)& atype, const Standard_Boolean keep)
+void Interface_EntityIterator::SelectType (const Handle(Standard_Type)& atype, const Standard_Boolean keep)
{
if (thelist.IsNull()) return;
Standard_Integer i, n = thelist->Length();
// .... Iteration proprement dite ....
- Standard_Integer Interface_EntityIterator::NbEntities () const
+Standard_Integer Interface_EntityIterator::NbEntities () const
{
- if (thelist.IsNull()) return 0;
- if (!thecurr.IsNull() && thecurr->Value() == 0) Start();
- return thelist->Length();
+ return thelist.IsNull()? 0 : thelist->Length();
}
- Standard_Integer Interface_EntityIterator::NbTyped
- (const Handle(Standard_Type)& atype) const
+Standard_Integer Interface_EntityIterator::NbTyped (const Handle(Standard_Type)& atype) const
{
Standard_Integer res = 0;
if (thelist.IsNull()) return res;
return res;
}
- Interface_EntityIterator Interface_EntityIterator::Typed
- (const Handle(Standard_Type)& atype) const
+Interface_EntityIterator Interface_EntityIterator::Typed (const Handle(Standard_Type)& atype) const
{
Interface_EntityIterator res;
if (thelist.IsNull()) return res;
return res;
}
-
- void Interface_EntityIterator::Start () const
- { if (!thecurr.IsNull()) thecurr->CValue() = 1 ; } // peut etre redefini ...
-
- Standard_Boolean Interface_EntityIterator::More () const
+void Interface_EntityIterator::Start () const
{
- if (thecurr.IsNull()) return Standard_False;
- if (thecurr->Value() == 0) Start(); // preparation de l iteration
- if (thelist.IsNull()) return Standard_False;
- return (thecurr->Value() <= thelist->Length());
+ thecurr = 1;
}
- void Interface_EntityIterator::Next () const
- { thecurr->CValue() ++; } // Next ne verifie rien : soin laisse a Value
-
- const Handle(Standard_Transient)& Interface_EntityIterator::Value () const
+Standard_Boolean Interface_EntityIterator::More () const
{
-// NbEntity pas const (on ne sait pas comment il est implemente apres tout)
- if (thelist.IsNull()) Standard_NoSuchObject::Raise("Interface_EntityIterator");
- if (thecurr->Value() < 1 || thecurr->Value() > thelist->Length())
- Standard_NoSuchObject::Raise("Interface_EntityIterator");
- return thelist->Value(thecurr->Value());
+ if (thecurr == 0) Start(); // preparation de l iteration
+ return thelist.IsNull()? Standard_False : (thecurr <= thelist->Length());
}
- Handle(TColStd_HSequenceOfTransient) Interface_EntityIterator::Content () const
+const Handle(Standard_Transient)& Interface_EntityIterator::Value () const
{
- if (!thecurr.IsNull() && thecurr->Value() == 0) Start();
- if (thelist.IsNull()) return new TColStd_HSequenceOfTransient(); // vide
- return thelist;
+ // NbEntity pas const (on ne sait pas comment il est implemente apres tout)
+ if (thelist.IsNull())
+ Standard_NoSuchObject::Raise("Interface_EntityIterator");
+ if (thecurr < 1 || thecurr > thelist->Length())
+ Standard_NoSuchObject::Raise("Interface_EntityIterator");
+ return thelist->Value(thecurr);
}
-void Interface_EntityIterator::Destroy ()
- { thecurr.Nullify(); } // redevient vide !
-
-Interface_EntityIterator::~Interface_EntityIterator()
+Handle(TColStd_HSequenceOfTransient) Interface_EntityIterator::Content () const
{
- Destroy();
+ return (thelist.IsNull()? new TColStd_HSequenceOfTransient() : thelist);
}
-
#include <TColStd_HSequenceOfTransient.hxx>
#include <Standard_Type.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-class Interface_IntVal;
-class Standard_NoMoreObject;
-class Standard_NoSuchObject;
-class Standard_Transient;
//! Defines an Iterator on Entities.
//! Allows considering of various criteria
class Interface_EntityIterator
{
-public:
+ public:
DEFINE_STANDARD_ALLOC
-
//! Defines an empty iterator (see AddList & AddItem)
- Standard_EXPORT Interface_EntityIterator();
+ Interface_EntityIterator() {}
//! Defines an iterator on a list, directly i.e. without copying it
Standard_EXPORT Interface_EntityIterator(const Handle(TColStd_HSequenceOfTransient)& list);
Standard_EXPORT void AddItem (const Handle(Standard_Transient)& anentity);
//! same as AddItem (kept for compatibility)
- Standard_EXPORT void GetOneItem (const Handle(Standard_Transient)& anentity);
+ void GetOneItem (const Handle(Standard_Transient)& anentity) { AddItem(anentity); }
//! Selects entities with are Kind of a given type, keep only
//! them (is keep is True) or reject only them (if keep is False)
Standard_EXPORT Standard_Boolean More() const;
//! Sets iteration to the next entity (vertex) to give
- Standard_EXPORT void Next() const;
+ void Next() const { thecurr++; } // Next ne verifie rien : soin laisse a Value
//! Returns the current Entity iterated, to be used by Interface
//! tools
//! Returns an empty Sequence if the Iterator is empty
//! Calls Start if not yet done
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Content() const;
-
- //! Clears data of iteration
- Standard_EXPORT void Destroy();
//! Destructor
- Standard_EXPORT virtual ~Interface_EntityIterator();
-
-protected:
+ Standard_EXPORT virtual ~Interface_EntityIterator() {}
+ protected:
//! Allows subclasses of EntityIterator to reevaluate an iteration
Standard_EXPORT void Reset();
+ private:
-
-
-private:
-
-
-
- Handle(Interface_IntVal) thecurr;
+ mutable Standard_Integer thecurr;
Handle(TColStd_HSequenceOfTransient) thelist;
-
-
};
-
-
-
-
-
-
#endif // _Interface_EntityIterator_HeaderFile
// dce 21/01/99 S3767 : Suppression of general messages
#include <Interface_Check.hxx>
-#include <Interface_CheckFailure.hxx>
#include <Interface_FileReaderData.hxx>
#include <Interface_FileReaderTool.hxx>
#include <Interface_GeneralLib.hxx>
// .... CONSTRUCTEURS ....
-// .... Construction a partir de la connaissance des Entites ....
-
-
-Interface_Graph::Interface_Graph
-(const Handle(Interface_InterfaceModel)& amodel,
- const Interface_GeneralLib& /*lib*/,
- Standard_Boolean theModeStat)
- : themodel (amodel), thepresents ("")
-{
- if(theModeStat)
- InitStats();
- Evaluate();
-}
-
-Interface_Graph::Interface_Graph
-(const Handle(Interface_InterfaceModel)& amodel,
- const Handle(Interface_Protocol)& /*protocol*/,
- Standard_Boolean theModeStat)
- : themodel (amodel) , thepresents ("")
-
-{
- if(theModeStat)
- InitStats();
- Evaluate();
-}
-
-Interface_Graph::Interface_Graph
-(const Handle(Interface_InterfaceModel)& amodel,
- const Handle(Interface_GTool)& /*gtool*/,
- Standard_Boolean theModeStat)
- : themodel (amodel) , thepresents ("")
-{
- if(theModeStat)
- InitStats();
- Evaluate();
-}
-
-Interface_Graph::Interface_Graph
-(const Handle(Interface_InterfaceModel)& amodel,
- Standard_Boolean theModeStat)
-: themodel (amodel) , thepresents ("")
-{
- if(theModeStat)
- InitStats();
- Evaluate ();
-}
-
// .... Construction depuis un autre Graph ....
Interface_Graph::Interface_Graph
}
}
-const Interface_BitMap& Interface_Graph::BitMap () const
-{ return theflags; }
-
-Interface_BitMap& Interface_Graph::CBitMap ()
-{ return theflags; }
-
// ###########################################################################
// .... Chargements Elementaires avec Propagation de "Share" .... //
-const Handle(Interface_InterfaceModel)& Interface_Graph::Model() const
-{ return themodel; }
-
void Interface_Graph::GetFromModel ()
{
if (themodel.IsNull() || thestats.IsNull())
#include <TColStd_HArray1OfListOfInteger.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
-class Interface_InterfaceModel;
-class Standard_DomainError;
class Interface_GeneralLib;
class Interface_Protocol;
class Interface_GTool;
//! Creates an empty graph, ready to receive Entities from amodel
//! Note that this way of Creation allows <me> to verify that
//! Entities to work with are contained in <amodel>
- //! Basic Shared and Sharing lists are obtained from a General
- //! Services Library, given directly as an argument
- Standard_EXPORT Interface_Graph(const Handle(Interface_InterfaceModel)& amodel, const Interface_GeneralLib& lib, const Standard_Boolean theModeStats = Standard_True);
-
- //! Same as above, but the Library is defined through a Protocol
- Standard_EXPORT Interface_Graph(const Handle(Interface_InterfaceModel)& amodel, const Handle(Interface_Protocol)& protocol, const Standard_Boolean theModeStats = Standard_True);
-
- //! Same as above, but the Library is defined through a Protocol
- Standard_EXPORT Interface_Graph(const Handle(Interface_InterfaceModel)& amodel, const Handle(Interface_GTool)& gtool, const Standard_Boolean theModeStats = Standard_True);
-
- //! Same a above but works with the Protocol recorded in the Model
- Standard_EXPORT Interface_Graph(const Handle(Interface_InterfaceModel)& amodel, const Standard_Boolean theModeStats = Standard_True);
+ Interface_Graph(const Handle(Interface_InterfaceModel)& amodel, const Standard_Boolean theModeStats = Standard_True)
+ : themodel (amodel), thepresents ("")
+ {
+ if(theModeStats)
+ InitStats();
+ Evaluate();
+ }
//! Creates a Graph from another one, getting all its data
//! Remark that status are copied from <agraph>, but the other
Standard_EXPORT void RemoveStatus (const Standard_Integer stat);
//! Returns the Bit Map in order to read or edit flag values
- Standard_EXPORT const Interface_BitMap& BitMap() const;
-
+ const Interface_BitMap& BitMap() const { return theflags; }
+
//! Returns the Bit Map in order to edit it (add new flags)
- Standard_EXPORT Interface_BitMap& CBitMap();
-
+ Interface_BitMap& CBitMap() { return theflags; }
+
//! Returns the Model with which this Graph was created
- Standard_EXPORT const Handle(Interface_InterfaceModel)& Model() const;
-
+ const Handle(Interface_InterfaceModel)& Model() const { return themodel; }
+
//! Loads Graph with all Entities contained in the Model
Standard_EXPORT void GetFromModel();
//! Returns mode resposible for computation of statuses;
Standard_EXPORT Standard_Boolean ModeStat() const;
-
-
-
-protected:
-
+ protected:
//! Initialize statuses and flags
Standard_EXPORT void InitStats();
-
Handle(Interface_InterfaceModel) themodel;
TCollection_AsciiString thepresents;
Handle(TColStd_HArray1OfInteger) thestats;
Handle(TColStd_HArray1OfListOfInteger) thesharings;
-
-private:
-
+ private:
//! Performs the Evaluation of the Graph, from an initial Library,
//! either defined through a Protocol, or given dierctly
//! If <gtool> is defined, it has priority
Standard_EXPORT void Evaluate();
-
Interface_BitMap theflags;
-
-
};
-
-
-
-
-
-
#endif // _Interface_Graph_HeaderFile
#include <Interface_IntList.hxx>
#include <Standard_Transient.hxx>
-Interface_GraphContent::Interface_GraphContent () { }
-
- Interface_GraphContent::Interface_GraphContent
- (const Interface_Graph& agraph)
- { GetFromGraph(agraph); }
-
- Interface_GraphContent::Interface_GraphContent
- (const Interface_Graph& agraph, const Standard_Integer stat)
- { GetFromGraph(agraph,stat); }
-
- Interface_GraphContent::Interface_GraphContent
- (const Interface_Graph& agraph, const Handle(Standard_Transient)& ent)
+Interface_GraphContent::Interface_GraphContent (const Interface_Graph& agraph, const Handle(Standard_Transient)& ent)
{
Interface_EntityIterator list = agraph.Shareds(ent);
Standard_Integer nb = list.NbEntities();
}
}
-
- void Interface_GraphContent::GetFromGraph (const Interface_Graph& agraph)
+void Interface_GraphContent::GetFromGraph (const Interface_Graph& agraph)
{
Standard_Integer nb = agraph.Size();
for (Standard_Integer i = 1; i <= nb; i ++) {
}
}
- void Interface_GraphContent::GetFromGraph
- (const Interface_Graph& agraph, const Standard_Integer stat)
+void Interface_GraphContent::GetFromGraph (const Interface_Graph& agraph, const Standard_Integer stat)
{
Standard_Integer nb = agraph.Size();
for (Standard_Integer i = 1; i <= nb; i ++) {
}
}
- Interface_EntityIterator Interface_GraphContent::Result ()
+Interface_EntityIterator Interface_GraphContent::Result ()
{
Interface_EntityIterator iter; // On transvase ...
for (Begin(); More(); Next()) iter.GetOneItem(Value());
return iter;
}
-
- void Interface_GraphContent::Begin ()
+void Interface_GraphContent::Begin ()
{
Evaluate();
Interface_EntityIterator::Start();
}
- void Interface_GraphContent::Evaluate ()
-{ } // par defaut, Evaluate ne fait rien
+void Interface_GraphContent::Evaluate ()
+{}
//! all being given under one unique form
class Interface_GraphContent : public Interface_EntityIterator
{
-public:
+ public:
DEFINE_STANDARD_ALLOC
-
//! Creates an empty GraphContent, ready to be filled
- Standard_EXPORT Interface_GraphContent();
+ Interface_GraphContent() {}
//! Creates with all entities designated by a Graph
- Standard_EXPORT Interface_GraphContent(const Interface_Graph& agraph);
+ Interface_GraphContent(const Interface_Graph& agraph)
+ { GetFromGraph(agraph); }
//! Creates with entities having specific Status value in a Graph
- Standard_EXPORT Interface_GraphContent(const Interface_Graph& agraph, const Standard_Integer stat);
+ Interface_GraphContent(const Interface_Graph& agraph, const Standard_Integer stat)
+ { GetFromGraph(agraph,stat); }
//! Creates an Iterator with Shared entities of an entity
//! (equivalente to EntityIterator but with a Graph)
//! Default is set to doing nothing : intended to be redefined
//! by each sub-class
Standard_EXPORT virtual void Evaluate();
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-
};
-
-
-
-
-
-
#endif // _Interface_GraphContent_HeaderFile
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-
-#include <Interface_GeneralLib.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_GTool.hxx>
#include <Interface_HGraph.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Protocol.hxx>
-#include <Standard_DomainError.hxx>
-#include <Standard_Type.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Interface_HGraph,MMgt_TShared)
-
-Interface_HGraph::Interface_HGraph (const Interface_Graph& agraph)
- : thegraph(agraph) { }
-
-
- Interface_HGraph::Interface_HGraph
- (const Handle(Interface_InterfaceModel)& amodel,
- const Interface_GeneralLib& lib,
- const Standard_Boolean theModeStat)
- : thegraph (amodel,lib,theModeStat) { }
-
-
- Interface_HGraph::Interface_HGraph
- (const Handle(Interface_InterfaceModel)& amodel,
- const Handle(Interface_Protocol)& protocol,
- const Standard_Boolean theModeStat)
- : thegraph (amodel,protocol,theModeStat) { }
-
-
- Interface_HGraph::Interface_HGraph
- (const Handle(Interface_InterfaceModel)& amodel,
- const Handle(Interface_GTool)& gtool,
- const Standard_Boolean theModeStat)
- : thegraph (amodel,gtool,theModeStat) { }
-
-
- Interface_HGraph::Interface_HGraph
- (const Handle(Interface_InterfaceModel)& amodel,
- const Standard_Boolean theModeStat)
- : thegraph (amodel,theModeStat) { }
-
-
- const Interface_Graph& Interface_HGraph::Graph () const
- { return thegraph; }
-
-
- Interface_Graph& Interface_HGraph::CGraph ()
- { return thegraph; }
#include <Standard.hxx>
#include <Standard_Type.hxx>
+#include <MMgt_TShared.hxx>
#include <Interface_Graph.hxx>
-#include <MMgt_TShared.hxx>
-#include <Standard_Boolean.hxx>
-class Standard_DomainError;
-class Interface_Graph;
class Interface_InterfaceModel;
-class Interface_GeneralLib;
-class Interface_Protocol;
-class Interface_GTool;
-
class Interface_HGraph;
DEFINE_STANDARD_HANDLE(Interface_HGraph, MMgt_TShared)
//! Models, with the same general conditions)
class Interface_HGraph : public MMgt_TShared
{
-
-public:
-
+ public:
//! Creates an HGraph directly from a Graph.
//! Remark that the starting Graph is duplicated
- Standard_EXPORT Interface_HGraph(const Interface_Graph& agraph);
-
- //! Creates an HGraph with a Graph created from <amodel> and <lib>
- Standard_EXPORT Interface_HGraph(const Handle(Interface_InterfaceModel)& amodel, const Interface_GeneralLib& lib, const Standard_Boolean theModeStats = Standard_True);
+ Interface_HGraph(const Interface_Graph& agraph)
+ : thegraph (agraph)
+ {}
- //! Creates an HGraph with a graph itself created from <amodel>
- //! and <protocol>
- Standard_EXPORT Interface_HGraph(const Handle(Interface_InterfaceModel)& amodel, const Handle(Interface_Protocol)& protocol, const Standard_Boolean theModeStats = Standard_True);
-
- //! Creates an HGraph with a graph itself created from <amodel>
- //! and <protocol>
- Standard_EXPORT Interface_HGraph(const Handle(Interface_InterfaceModel)& amodel, const Handle(Interface_GTool)& gtool, const Standard_Boolean theModeStats = Standard_True);
-
- //! Same a above, but works with the GTool in the model
- Standard_EXPORT Interface_HGraph(const Handle(Interface_InterfaceModel)& amodel, const Standard_Boolean theModeStats = Standard_True);
+ //! Creates an HGraph with a Graph created from <amodel>, works with the GTool in the model
+ Interface_HGraph(const Handle(Interface_InterfaceModel)& amodel, const Standard_Boolean theModeStats = Standard_True)
+ : thegraph (amodel,theModeStats)
+ {}
//! Returns the Graph contained in <me>, for Read Only Operations
//! Remark that it is returns as "const &"
//! Getting it in a new variable instead of a reference would be
//! a pitty, because all the graph's content would be duplicated
- Standard_EXPORT const Interface_Graph& Graph() const;
+ const Interface_Graph& Graph() const { return thegraph; }
//! Same as above, but for Read-Write Operations
//! Then, The Graph will be modified in the HGraph itself
- Standard_EXPORT Interface_Graph& CGraph();
-
-
-
+ Interface_Graph& CGraph() { return thegraph; }
DEFINE_STANDARD_RTTIEXT(Interface_HGraph,MMgt_TShared)
-protected:
-
-
-
-
-private:
-
+ private:
Interface_Graph thegraph;
-
-
};
-
-
-
-
-
-
#endif // _Interface_HGraph_HeaderFile
IMPLEMENT_STANDARD_RTTIEXT(Interface_InterfaceModel,MMgt_TShared)
-// 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 const Handle(Dico_DictionaryOfTransient)& templates()
-{
- static Handle(Dico_DictionaryOfTransient) atemp;
- if (atemp.IsNull()) atemp = new Dico_DictionaryOfTransient;
- return 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;
//purpose :
//=======================================================================
-void Interface_InterfaceModel::Destroy () // on fait un mimumum
+Interface_InterfaceModel::~Interface_InterfaceModel () // on fait un mimumum
{
// Moins que Clear que, lui, est adapte a chaque norme
ClearEntities();
}
-//=======================================================================
-//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 :
}
-//=======================================================================
-//function : DispatchStatus
-//purpose :
-//=======================================================================
-
-Standard_Boolean& Interface_InterfaceModel::DispatchStatus ()
-{
- return isdispatch;
-}
-
-
//=======================================================================
//function : ClearEntities
//purpose :
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;
// .... 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
+Standard_Boolean Interface_InterfaceModel::Contains (const Handle(Standard_Transient)& anentity) const
{
if (theentities.Contains(anentity)) return Standard_True;
Handle(Interface_ReportEntity) rep =
//purpose :
//=======================================================================
-Standard_Integer Interface_InterfaceModel::Number
- (const Handle(Standard_Transient)& anentity) const
+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())) {
+ if (anentity->IsKind(STANDARD_TYPE(Interface_ReportEntity))) {
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
+Standard_Integer Interface_InterfaceModel::NbTypes (const Handle(Standard_Transient)& ent) const
{
if (Protocol().IsNull()) return 1;
return Protocol()->NbTypes(ent);
//purpose :
//=======================================================================
-Interface_DataState Interface_InterfaceModel::EntityState
- (const Standard_Integer num) const
+Interface_DataState Interface_InterfaceModel::EntityState (const Standard_Integer num) const
{
Handle(Interface_ReportEntity) rep;
if (!thereports.IsBound(num)) {
}
-//=======================================================================
-//function : HasSemanticChecks
-//purpose :
-//=======================================================================
-
-Standard_Boolean Interface_InterfaceModel::HasSemanticChecks () const
-{
- return haschecksem;
-}
-
-
//=======================================================================
//function : Check
//purpose :
void Interface_InterfaceModel::AddEntity(const Handle(Standard_Transient)& anentity)
{
- //Standard_Integer newnum; svv #2
- if (!anentity->IsKind(typerep())) theentities.Add(anentity);
+ if (!anentity->IsKind(STANDARD_TYPE(Interface_ReportEntity))) theentities.Add(anentity);
// Report : Ajouter Concerned, mais noter presence Report et sa valeur
else {
Handle(Interface_ReportEntity) rep =
}
-//=======================================================================
-//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.
//purpose :
//=======================================================================
-void Interface_InterfaceModel::GetFromTransfer
- (const Interface_EntityIterator& aniter)
+void Interface_InterfaceModel::GetFromTransfer (const Interface_EntityIterator& aniter)
{
theentities.Clear(); theentities.ReSize (aniter.NbEntities());
for (aniter.Start(); aniter.More(); aniter.Next()) {
//purpose :
//=======================================================================
-Standard_Boolean Interface_InterfaceModel::SetCategoryNumber
- (const Standard_Integer num, const Standard_Integer val)
+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;
//purpose :
//=======================================================================
-Standard_Integer Interface_InterfaceModel::CategoryNumber
- (const Standard_Integer num) const
+Standard_Integer Interface_InterfaceModel::CategoryNumber (const Standard_Integer num) const
{
if (thecategory.IsNull()) return 0;
if (num < 1 || num > thecategory->Length()) return 0;
//purpose :
//=======================================================================
-void Interface_InterfaceModel::FillIterator(Interface_EntityIterator& iter) const
+void Interface_InterfaceModel::FillIterator (Interface_EntityIterator& iter) const
{
Standard_Integer nb = NbEntities();
for (Standard_Integer i = 1; i <= nb; i ++)
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 :
if (i <= 0 || i > n) i = 0;
return i;
}
-
-
-//=======================================================================
-//function : HasTemplate
-//purpose :
-//=======================================================================
-
-Standard_Boolean Interface_InterfaceModel::HasTemplate
- (const Standard_CString name)
-{
- return templates()->HasItem(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(templates()->Item(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)
-{
- Standard_Boolean deja;
- Handle(Standard_Transient)& newmod = templates()->NewItem(name,deja);
- newmod = model;
- return deja;
-}
-
-
-//=======================================================================
-//function : ListTemplates
-//purpose :
-//=======================================================================
-
-Handle(TColStd_HSequenceOfHAsciiString) Interface_InterfaceModel::ListTemplates ()
-{
- Handle(TColStd_HSequenceOfHAsciiString) list = new
- TColStd_HSequenceOfHAsciiString();
- if (templates().IsNull()) return list;
- for (Dico_IteratorOfDictionaryOfTransient iter(templates());
- iter.More(); iter.Next()) {
- list->Append (new TCollection_HAsciiString (iter.Name()) );
- }
- return list;
-}
#include <Standard.hxx>
#include <Standard_Type.hxx>
+#include <MMgt_TShared.hxx>
#include <TColStd_IndexedMapOfTransient.hxx>
#include <TColStd_DataMapOfIntegerTransient.hxx>
-#include <Standard_Boolean.hxx>
-#include <MMgt_TShared.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Type.hxx>
-#include <Standard_CString.hxx>
#include <Interface_DataState.hxx>
#include <TColStd_HSequenceOfHAsciiString.hxx>
class Interface_Check;
class TCollection_HAsciiString;
class Interface_GTool;
-class Standard_OutOfRange;
-class Standard_NoSuchObject;
-class Interface_InterfaceMismatch;
class Interface_Protocol;
-class Standard_Transient;
class Interface_ReportEntity;
class Interface_CheckIterator;
class Interface_GeneralLib;
//! See also Graph, ShareTool, CheckTool for more
class Interface_InterfaceModel : public MMgt_TShared
{
-
-public:
-
+ public:
//! Clears the list of entities (service WhenDelete)
- Standard_EXPORT void Destroy();
-~Interface_InterfaceModel()
-{
- Destroy();
-}
+ Standard_EXPORT ~Interface_InterfaceModel();
//! Sets a Protocol for this Model
//! It is also set by a call to 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);
+ void SetGTool (const Handle(Interface_GTool)& gtool) { thegtool = gtool; }
//! Returns the GTool, set by SetProtocol or by SetGTool
- Standard_EXPORT Handle(Interface_GTool) GTool() const;
+ const Handle(Interface_GTool) & GTool() const { return thegtool; }
//! 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();
+ Standard_Boolean& DispatchStatus() { return isdispatch; }
//! Erases contained data; used when a Model is copied to others :
//! the new copied ones begin from clear
Standard_EXPORT virtual void ClearHeader() = 0;
//! Returns count of contained Entities
- Standard_EXPORT Standard_Integer NbEntities() const;
+ Standard_Integer NbEntities() const { return theentities.Extent(); }
//! Returns True if a Model contains an Entity (for a ReportEntity,
//! looks for the ReportEntity itself AND its Concerned Entity)
//! 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;
+ const Handle(Standard_Transient)& Value (const Standard_Integer num) const { return theentities.FindKey(num); }
//! Returns the count of DISTINCT types under which an entity may
//! be processed. Defined by the Protocol, which gives default as
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;
+ Standard_Boolean HasSemanticChecks() const { return haschecksem; }
//! Returns the check attached to an entity, designated by its
//! Number. 0 for global check
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);
+ void ReplaceEntity (const Standard_Integer nument, const Handle(Standard_Transient)& anent) { theentities.Substitute(nument,anent); }
//! Reverses the Numbers of the Entities, between <after> and the
//! total count of Entities. Thus, the entities :
//! 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;
+ const Handle(Interface_Check)& GlobalCheck (const Standard_Boolean syntactic = Standard_True) const { return (syntactic? thecheckstx : thechecksem); }
//! 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);
+ void SetGlobalCheck (const Handle(Interface_Check)& ach) { thecheckstx = 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;
+ Standard_EXPORT virtual void VerifyCheck (Handle(Interface_Check)&) const {}
//! Dumps Header in a short, easy to read, form, onto a Stream
//! <level> allows to print more or less parts of the header,
//! 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,MMgt_TShared)
-protected:
-
+ protected:
//! Defines empty InterfaceModel, ready to be filled
Standard_EXPORT Interface_InterfaceModel();
-
-
-private:
-
+ private:
TColStd_IndexedMapOfTransient theentities;
TColStd_DataMapOfIntegerTransient thereports;
Standard_Boolean isdispatch;
Handle(TCollection_HAsciiString) thecategory;
Handle(Interface_GTool) thegtool;
-
-
};
-
-
-
-
-
-
#endif // _Interface_InterfaceModel_HeaderFile
#include <Interface_ShareTool.hxx>
#include <Message_Messenger.hxx>
#include <Standard_DomainError.hxx>
-#include <Standard_Transient.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
-Interface_ShareTool::Interface_ShareTool (const Handle(Interface_InterfaceModel)& amodel,
- const Interface_GeneralLib& lib)
+Standard_Boolean Interface_ShareTool::IsShared (const Handle(Standard_Transient)& ent) const
{
- theHGraph = new Interface_HGraph(amodel,lib);
-}
-
-Interface_ShareTool::Interface_ShareTool (const Handle(Interface_InterfaceModel)& amodel,
- const Handle(Interface_GTool)& gtool)
-{
- theHGraph = new Interface_HGraph(amodel,gtool);
-}
-
-Interface_ShareTool::Interface_ShareTool (const Handle(Interface_InterfaceModel)& amodel,
- const Handle(Interface_Protocol)& protocol)
-{
- theHGraph = new Interface_HGraph(amodel,protocol);
-}
-
-Interface_ShareTool::Interface_ShareTool (const Handle(Interface_InterfaceModel)& amodel)
-{
- theHGraph = new Interface_HGraph(amodel);
-}
-
-Interface_ShareTool::Interface_ShareTool (const Interface_Graph& agraph)
-{
- theHGraph = new Interface_HGraph(agraph.Model());
-}
-
-Interface_ShareTool::Interface_ShareTool (const Handle(Interface_HGraph)& ahgraph)
-{
- theHGraph = ahgraph;
-}
-
-// Ajout des "Implied" sur toutes les Entites du Graphe
-/*void Interface_ShareTool::AddImplied (const Handle(Interface_GTool)& gtool)
-{
- Interface_Graph& thegraph = theHGraph->CGraph();
- Standard_Integer nb = thegraph.Size();
- Standard_Boolean yena = Standard_False;
- for (Standard_Integer i = 1; i <= nb; i ++) {
- Handle(Standard_Transient) ent = thegraph.Entity(i);
- if (ent.IsNull()) continue;
- Handle(Interface_GeneralModule) module; Standard_Integer CN;
- if (gtool->Select(ent,module,CN)) {
- Interface_EntityIterator iter;
- module->ListImpliedCase(CN,ent,iter);
- if (iter.NbEntities() == 0) continue;
- yena = Standard_True;
- thegraph.SetShare(ent);
- for (iter.Start(); iter.More(); iter.Next())
- thegraph.AddShared(ent,iter.Value());
- }
- }
- if (yena) thegraph.EvalSharings();
-}*/
-
-
- Handle(Interface_InterfaceModel) Interface_ShareTool::Model () const
- { return theHGraph->Graph().Model(); }
-
- const Interface_Graph& Interface_ShareTool::Graph () const
- { return theHGraph->Graph(); }
-
- Interface_EntityIterator Interface_ShareTool::RootEntities () const
- { return theHGraph->Graph().RootEntities(); }
-
- Standard_Boolean Interface_ShareTool::IsShared
- (const Handle(Standard_Transient)& ent) const
-{
- const Interface_Graph& thegraph = theHGraph->Graph();
- Handle(TColStd_HSequenceOfTransient) list =
- thegraph.GetShareds (ent);
+ Handle(TColStd_HSequenceOfTransient) list = Graph().GetShareds (ent);
return (!list.IsNull() && list->Length() > 0);
}
- Interface_EntityIterator Interface_ShareTool::Shareds
- (const Handle(Standard_Transient)& ent) const
- { return theHGraph->Graph().Shareds(ent); }
-
- Interface_EntityIterator Interface_ShareTool::Sharings
- (const Handle(Standard_Transient)& ent) const
- { return theHGraph->Graph().Sharings(ent); }
-
-
- Standard_Integer Interface_ShareTool::NbTypedSharings
- (const Handle(Standard_Transient)& ent,
- const Handle(Standard_Type)& atype) const
+/*szv_c1:Standard_Integer Interface_ShareTool::NbTypedSharings (const Handle(Standard_Transient)& ent, const Handle(Standard_Type)& atype) const
{
- Interface_Graph& thegraph = theHGraph->CGraph();
- Handle(TColStd_HSequenceOfTransient) list = thegraph.GetSharings (ent);
+ Handle(TColStd_HSequenceOfTransient) list = Graph().GetSharings (ent);
if(list.IsNull())
return 0;
Standard_Integer result = 0;
- Standard_Integer n = list->Length();
+ const Standard_Integer n = list->Length();
for (Standard_Integer i = 1; i <= n; i ++) {
- Handle(Standard_Transient) entsh = list->Value(i);
+ const Handle(Standard_Transient) &entsh = list->Value(i);
if (entsh.IsNull()) continue;
- if (entsh->IsKind(atype)) result ++;
+ if (entsh->IsKind(atype)) result++;
}
return result;
-}
-
- Handle(Standard_Transient) Interface_ShareTool::TypedSharing
- (const Handle(Standard_Transient)& ent,
- const Handle(Standard_Type)& atype) const
-{
- Interface_Graph& thegraph = theHGraph->CGraph();
- Handle(TColStd_HSequenceOfTransient) list = thegraph.GetSharings(ent);
- if(list.IsNull())
- return 0;
- Handle(Standard_Transient) entresult;
- Standard_Integer result = 0;
- Standard_Integer n = list->Length();
- for (Standard_Integer i = 1; i <= n; i ++) {
- Handle(Standard_Transient) entsh = list->Value(i);
- if (entsh.IsNull()) continue;
- if (entsh->IsKind(atype)) {
- entresult = entsh;
- result ++;
- if (result > 1) Interface_InterfaceError::Raise
- ("Interface ShareTool : TypedSharing, more than one found");
- }
- }
- if (result == 0) Interface_InterfaceError::Raise
- ("Interface ShareTool : TypedSharing, not found");
- return entresult;
-}
+}*/
- Interface_EntityIterator Interface_ShareTool::All
-(const Handle(Standard_Transient)& ent, const Standard_Boolean rootlast) const
+Interface_EntityIterator Interface_ShareTool::All (const Handle(Standard_Transient)& ent, const Standard_Boolean rootlast) const
{
- Handle(Interface_InterfaceModel) model = Model();
+ const Handle(Interface_InterfaceModel) &model = Graph().Model();
Interface_EntityIterator list;
Standard_Integer i, n0 = 0, nb = model->NbEntities();
Handle(TColStd_HArray1OfInteger) fl = new TColStd_HArray1OfInteger (0,nb);
fl->Init(0);
if (ent == model) {
// On passe les racines en revue (l ordre de base est conserve)
- Interface_EntityIterator roots = RootEntities();
+ Interface_EntityIterator roots = Graph().RootEntities();
for (roots.Start(); roots.More(); roots.Next()) {
Interface_EntityIterator subl = All(roots.Value(),rootlast);
for (subl.Start(); subl.More(); subl.Next()) {
Standard_Integer num = model->Number(en);
if (fl->Value(num) != 0) continue; // deja vu
n0 ++; fl->SetValue (num,n0);
- Interface_EntityIterator sh = Shareds(en);
+ Interface_EntityIterator sh = Graph().Shareds(en);
sq->Append (sh.Content());
}
}
return list;
}
-
- void Interface_ShareTool::Print
- (const Interface_EntityIterator& iter, const Handle(Message_Messenger)& S) const
-{
- S << " Nb.Entities : " << iter.NbEntities() << " : ";
- for (iter.Start(); iter.More(); iter.Next()) {
- Handle(Standard_Transient) ent = iter.Value();
- S << " n0/id:"; Model()->Print(ent,S);
- }
- S<<endl;
-}
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Type.hxx>
-class Interface_HGraph;
-class Standard_DomainError;
-class Interface_InterfaceError;
+#include <Interface_HGraph.hxx>
class Interface_InterfaceModel;
-class Interface_GeneralLib;
-class Interface_GTool;
-class Interface_Protocol;
-class Interface_Graph;
class Interface_EntityIterator;
-class Standard_Transient;
class Message_Messenger;
//! this can be usefull for Reference Checking
class Interface_ShareTool
{
-public:
+ public:
DEFINE_STANDARD_ALLOC
-
//! Creates a ShareTool from a Model and builds all required data,
- //! by calling the General Service Library and Modules
- //! (GeneralLib given as an argument)
- Standard_EXPORT Interface_ShareTool(const Handle(Interface_InterfaceModel)& amodel, const Interface_GeneralLib& lib);
-
- //! Same a above, but GeneralLib is detained by a GTool
- Standard_EXPORT Interface_ShareTool(const Handle(Interface_InterfaceModel)& amodel, const Handle(Interface_GTool)& gtool);
-
- //! Same a above, but GeneralLib is defined through a Protocol
- //! Protocol is used to build the working library
- Standard_EXPORT Interface_ShareTool(const Handle(Interface_InterfaceModel)& amodel, const Handle(Interface_Protocol)& protocol);
-
- //! Same as above, but works with the GTool of the Model
- Standard_EXPORT Interface_ShareTool(const Handle(Interface_InterfaceModel)& amodel);
-
+ //! works with the GTool of the Model
+ Interface_ShareTool(const Handle(Interface_InterfaceModel)& amodel)
+ : theHGraph(new Interface_HGraph(amodel))
+ {}
+
//! Creates a ShareTool from an already defined Graph
//! Remark that the data of the Graph are copied
- Standard_EXPORT Interface_ShareTool(const Interface_Graph& agraph);
-
+ Interface_ShareTool(const Interface_Graph& agraph)
+ : theHGraph(new Interface_HGraph(agraph.Model()))
+ {}
+
//! Completes the Graph by Adding Implied References. Hence, they
//! are considered as Sharing References in all the other queries
- Standard_EXPORT Interface_ShareTool(const Handle(Interface_HGraph)& ahgraph);
-
- //! Returns the Model used for Creation (directly or for Graph)
- Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
-
+ Interface_ShareTool(const Handle(Interface_HGraph)& ahgraph)
+ : theHGraph(ahgraph)
+ {}
+
//! Returns the data used by the ShareTool to work
//! Can then be used directly (read only)
- Standard_EXPORT const Interface_Graph& Graph() const;
-
- //! Returns the Entities which are not Shared (their Sharing List
- //! is empty) in the Model
- Standard_EXPORT Interface_EntityIterator RootEntities() const;
-
+ const Interface_Graph& Graph() const { return theHGraph->Graph(); }
+
//! Returns True if <ent> is Shared by other Entities in the Model
Standard_EXPORT Standard_Boolean IsShared (const Handle(Standard_Transient)& ent) const;
- //! Returns the List of Entities Shared by a given Entity <ent>
- Standard_EXPORT Interface_EntityIterator Shareds (const Handle(Standard_Transient)& ent) const;
-
- //! Returns the List of Entities Sharing a given Entity <ent>
- Standard_EXPORT Interface_EntityIterator Sharings (const Handle(Standard_Transient)& ent) const;
-
//! Returns the count of Sharing Entities of an Entity, which
//! are Kind of a given Type
- Standard_EXPORT Standard_Integer NbTypedSharings (const Handle(Standard_Transient)& ent, const Handle(Standard_Type)& atype) const;
-
- //! Returns the Sharing Entity of an Entity, which is Kind of a
- //! given Type. Allows to access a Sharing Entity of a given type
- //! when there is one and only one (current case)
- Standard_EXPORT Handle(Standard_Transient) TypedSharing (const Handle(Standard_Transient)& ent, const Handle(Standard_Type)& atype) const;
+ //szv_c1:Standard_EXPORT Standard_Integer NbTypedSharings (const Handle(Standard_Transient)& ent, const Handle(Standard_Type)& atype) const;
//! Returns the complete list of entities shared by <ent> at any
//! level, including <ent> itself
//! entities and ends by the root. Else, the root is first and
//! the lower level entities are at end
Standard_EXPORT Interface_EntityIterator All (const Handle(Standard_Transient)& ent, const Standard_Boolean rootlast = Standard_True) const;
-
- //! Utility method which Prints the content of an iterator
- //! (by their Numbers)
- Standard_EXPORT void Print (const Interface_EntityIterator& iter, const Handle(Message_Messenger)& S) const;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
+ private:
Handle(Interface_HGraph) theHGraph;
-
-
};
-
-
-
-
-
-
#endif // _Interface_ShareTool_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.
-
-// Macros to help static Handles not to be "constructed" before main run
-// In order to avoid it, the Handle to be statically reserved is encapsulated
-// in a structure itself designated through a Null Pointer :
-// Only the pointer is declared static, and initialized to NULL : then,
-// there is no routine to call for static construction
-
-// Remember that the objet designated by a static Handle should not be created
-// in the static declaration, but must anyway be created, during main run,
-// once before its first use : this is the initialization step.
-
-
-// This set of macros allows user to simply declare and use "static" Handles.
-// It is available once having included this file :
-// ***************************************************
-// #include <Interface_Statics.hxx>
-
-// Static construction is replaced by using the macro StaticHandle :
-// ***************************************************
-// Old statement : static Handle(pk_class) object;
-// Is replaced by : StaticHandle(pk_class,object);
-// which creates a null pointer called 'object_s' and typed 'pk_class_struc'
-
-// For first initialisation and use, several ways are available, all of them
-// give an access to the Handle through a reference.
-// It is required to initialize the static structure once, the macros Init*
-// assume that it is created once and only once, even if they are called
-// more than once.
-// It is possible : to create the object at initialization time by a macro,
-// or to create it after the macro call through its reference :
-
-// ***************************************************
-// Old statement (in a routine, not static) :
-// if (object.IsNull()) object = new pk_class (..args if any..);
-// can be maintained, but preceeded by an initialization :
-// InitHandle(pk_class,object); // -> Null Handle
-
-// ***************************************************
-// or it can be replaced by a direct formula (creation called only once) :
-// InitHandleVoid(pk_class,object); // for a void constructor
-// or InitHandleArgs(pk_class,object,(..args..));
-// (the arglist between embedded parentheses)
-// or InitHandleVal(pk_class,object,val); // i.e. object = val;
-
-// To simply use this pseudo-static object, consider
-// either the static variable object_s->H
-// ***************************************************
-// or take it by the macro (which does not initialize it)
-// UseHandle(pk_class,object);
-
-
-// Declaration of a static Handle : first use for a given type
-#define StaticHandle(type,var) static struct type##_struc { Handle(type) H; } *var##_s = NULL
-
-// Another declaration for an already declared type (with StaticHandle)
-#define StaticHandleA(type,var) static struct type##_struc *var##_s = NULL
-
-// Using it (IT MUST HAVE BEEN FORMERLY INITIALIZED)
-#define UseHandle(type,var) Handle(type)& var = var##_s->H
-
-// Initializing it (as Null Handle)
-#define InitHandle(type,var) \
-if(!var##_s) { var##_s=new type##_struc; }\
-Handle(type)& var = var##_s->H;
-
-// Initializing it and Creating it by a Void Constructor
-#define InitHandleVoid(type,var) \
-if(!var##_s) { var##_s=new type##_struc; var##_s->H=new type; }\
-Handle(type)& var = var##_s->H;
-
-// Initializing it and Creating it by a Constructor with Arguments
-// (give them grouped in their parentheses)
-#define InitHandleArgs(type,var,args) \
-if(!var##_s) { var##_s=new type##_struc; var##_s->H=new type args; }\
-Handle(type)& var = var##_s->H;
-
-// Initializing it from an already determined Value
-#define InitHandleVal(type,var,value) \
-if(!var##_s) { var##_s=new type##_struc; var##_s->H=value; }\
-Handle(type)& var = var##_s->H;
di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)\n";
di<<" To modify : command param read.iges.bspline.continuity\n";
Handle(XSControl_WorkSession) thesession = Reader.WS();
- thesession->ClearContext();
+ thesession->TransferReader()->Context().Nullify();
XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
progress->NewScope ( 80, "Translation" );
progress->Show();
di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)\n";
di<<" To modify : command param read.iges.bspline.continuity\n";
Handle(XSControl_WorkSession) thesession = Reader.WS();
- thesession->ClearContext();
+ thesession->TransferReader()->Context().Nullify();
XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
progress->NewScope ( 80, "Translation" );
progress->Show();
di << "Usage : " << argv[0] << " edge_result edge1 edge2\n";
return 1;
}
- //TCollection_AsciiString fnom(a[1]);
- //Standard_Boolean modfic = XSDRAW::FileAndVar(a[1],a[2],a[3],"IGES",fnom,rnom,resnom);
TopoDS_Shape Sh1 = DBRep::Get(argv[2]);
TopoDS_Shape Sh2 = DBRep::Get(argv[3]);
if(Sh1.IsNull() || Sh2.IsNull()) return 1;
Handle(Geom_Curve) ac1 = BRep_Tool::Curve(e1,f1,l1);
Handle(Geom_Curve) ac2 = BRep_Tool::Curve(e2,f2,l2);
if(e1.Orientation() == TopAbs_REVERSED) {
- //Standard_Real cf = cf1;
- //cf1 = ac1->ReversedParameter ( cl1 );
- //cl1 = ac1->ReversedParameter ( cf );
ac1 = ac1->Reversed();
}
if(e2.Orientation() == TopAbs_REVERSED) {
- //Standard_Real cf = cf2;
- //ac2 = ac2->ReversedParameter ( cl2 );
- //ac2 = ac2->ReversedParameter ( cf );
ac2 = ac2->Reversed();
}
Handle(Geom_BSplineCurve) bsplc1 = Handle(Geom_BSplineCurve)::DownCast(ac1);
// commercial license or contractual agreement.
-#include <HeaderSection.hxx>
-#include <HeaderSection_Protocol.hxx>
#include <RWHeaderSection.hxx>
#include <RWHeaderSection_GeneralModule.hxx>
#include <RWHeaderSection_ReadWriteModule.hxx>
#include <StepData.hxx>
-/// #include <EuclidStandard.hxx>
static Handle(RWHeaderSection_ReadWriteModule) rwm;
static Handle(RWHeaderSection_GeneralModule) rwg;
-
void RWHeaderSection::Init()
{
-/// EuclidStandard::Init();
- Handle(HeaderSection_Protocol) proto = HeaderSection::Protocol();
- StepData::AddHeaderProtocol(proto);
+ const Handle(StepData_Protocol) &hp = StepData::HeaderProtocol();
if (rwm.IsNull()) rwm = new RWHeaderSection_ReadWriteModule;
if (rwg.IsNull()) rwg = new RWHeaderSection_GeneralModule;
}
-
-
#define _RWHeaderSection_HeaderFile
#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-class RWHeaderSection_ReadWriteModule;
-class RWHeaderSection_GeneralModule;
-class RWHeaderSection_RWFileName;
-class RWHeaderSection_RWFileDescription;
-class RWHeaderSection_RWFileSchema;
-
-
-
-class RWHeaderSection
+class RWHeaderSection
{
-public:
+ public:
- DEFINE_STANDARD_ALLOC
-
-
//! enforced the initialisation of the libraries
Standard_EXPORT static void Init();
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-friend class RWHeaderSection_ReadWriteModule;
-friend class RWHeaderSection_GeneralModule;
-friend class RWHeaderSection_RWFileName;
-friend class RWHeaderSection_RWFileDescription;
-friend class RWHeaderSection_RWFileSchema;
-
};
-
-
-
-
-
-
#endif // _RWHeaderSection_HeaderFile
#include <StepAP214_Protocol.hxx>
#include <StepData_WriterLib.hxx>
-static int init = 0;
-
void RWStepAP214::Init()
- {
- if (init) return; init = 1;
- RWHeaderSection::Init();
- Handle(StepAP214_Protocol) proto = StepAP214::Protocol();
- Interface_GeneralLib::SetGlobal (new RWStepAP214_GeneralModule,proto);
- Interface_ReaderLib::SetGlobal (new RWStepAP214_ReadWriteModule,proto);
- StepData_WriterLib::SetGlobal (new RWStepAP214_ReadWriteModule,proto);
- }
+{
+ static int init = 0;
+ if (init) return; init = 1;
+
+ RWHeaderSection::Init();
+ const Handle(StepAP214_Protocol) &proto = StepAP214::Protocol();
+ Interface_GeneralLib::SetGlobal (new RWStepAP214_GeneralModule,proto);
+ Interface_ReaderLib::SetGlobal (new RWStepAP214_ReadWriteModule,proto);
+ StepData_WriterLib::SetGlobal (new RWStepAP214_ReadWriteModule,proto);
+}
#define _RWStepAP214_HeaderFile
#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-class RWStepAP214_ReadWriteModule;
-class RWStepAP214_GeneralModule;
-class RWStepAP214_RWAutoDesignActualDateAndTimeAssignment;
-class RWStepAP214_RWAutoDesignActualDateAssignment;
-class RWStepAP214_RWAutoDesignApprovalAssignment;
-class RWStepAP214_RWAutoDesignDateAndPersonAssignment;
-class RWStepAP214_RWAutoDesignGroupAssignment;
-class RWStepAP214_RWAutoDesignNominalDateAndTimeAssignment;
-class RWStepAP214_RWAutoDesignNominalDateAssignment;
-class RWStepAP214_RWAutoDesignOrganizationAssignment;
-class RWStepAP214_RWAutoDesignPersonAndOrganizationAssignment;
-class RWStepAP214_RWAutoDesignPresentedItem;
-class RWStepAP214_RWAutoDesignSecurityClassificationAssignment;
-class RWStepAP214_RWAutoDesignDocumentReference;
-class RWStepAP214_RWAppliedDateAndTimeAssignment;
-class RWStepAP214_RWAppliedDateAssignment;
-class RWStepAP214_RWAppliedApprovalAssignment;
-class RWStepAP214_RWAppliedGroupAssignment;
-class RWStepAP214_RWAppliedOrganizationAssignment;
-class RWStepAP214_RWAppliedPersonAndOrganizationAssignment;
-class RWStepAP214_RWAppliedPresentedItem;
-class RWStepAP214_RWAppliedSecurityClassificationAssignment;
-class RWStepAP214_RWAppliedDocumentReference;
-class RWStepAP214_RWAppliedExternalIdentificationAssignment;
-class RWStepAP214_RWClass;
-class RWStepAP214_RWExternallyDefinedClass;
-class RWStepAP214_RWExternallyDefinedGeneralProperty;
-class RWStepAP214_RWRepItemGroup;
-
-
class RWStepAP214
{
-public:
+ public:
- DEFINE_STANDARD_ALLOC
-
-
//! enforced the initialisation of the libraries
Standard_EXPORT static void Init();
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-friend class RWStepAP214_ReadWriteModule;
-friend class RWStepAP214_GeneralModule;
-friend class RWStepAP214_RWAutoDesignActualDateAndTimeAssignment;
-friend class RWStepAP214_RWAutoDesignActualDateAssignment;
-friend class RWStepAP214_RWAutoDesignApprovalAssignment;
-friend class RWStepAP214_RWAutoDesignDateAndPersonAssignment;
-friend class RWStepAP214_RWAutoDesignGroupAssignment;
-friend class RWStepAP214_RWAutoDesignNominalDateAndTimeAssignment;
-friend class RWStepAP214_RWAutoDesignNominalDateAssignment;
-friend class RWStepAP214_RWAutoDesignOrganizationAssignment;
-friend class RWStepAP214_RWAutoDesignPersonAndOrganizationAssignment;
-friend class RWStepAP214_RWAutoDesignPresentedItem;
-friend class RWStepAP214_RWAutoDesignSecurityClassificationAssignment;
-friend class RWStepAP214_RWAutoDesignDocumentReference;
-friend class RWStepAP214_RWAppliedDateAndTimeAssignment;
-friend class RWStepAP214_RWAppliedDateAssignment;
-friend class RWStepAP214_RWAppliedApprovalAssignment;
-friend class RWStepAP214_RWAppliedGroupAssignment;
-friend class RWStepAP214_RWAppliedOrganizationAssignment;
-friend class RWStepAP214_RWAppliedPersonAndOrganizationAssignment;
-friend class RWStepAP214_RWAppliedPresentedItem;
-friend class RWStepAP214_RWAppliedSecurityClassificationAssignment;
-friend class RWStepAP214_RWAppliedDocumentReference;
-friend class RWStepAP214_RWAppliedExternalIdentificationAssignment;
-friend class RWStepAP214_RWClass;
-friend class RWStepAP214_RWExternallyDefinedClass;
-friend class RWStepAP214_RWExternallyDefinedGeneralProperty;
-friend class RWStepAP214_RWRepItemGroup;
-
};
-
-
-
-
-
-
#endif // _RWStepAP214_HeaderFile
Handle(Interface_Check)& ach,
const Handle(StepShape_EdgeCurve)& ent) const
{
-
-
// --- Number of Parameter Control ---
if (!data->CheckNbParams(num,5,ach,"edge_curve")) return;
const Interface_ShareTool& aShto,
Handle(Interface_Check)& ach) const
{
-// cout << "------ calling CheckEdgeCurve ------" << endl;
-
Handle(StepShape_OrientedEdge) theOE1, theOE2;
Handle(StepShape_FaceBound) theFOB1, theFOB2;
- //Handle(StepShape_FaceSurface) theFS1, theFS2;
Standard_Boolean theOEOri1 = Standard_True;
Standard_Boolean theOEOri2 = Standard_True;
Standard_Boolean theFBOri1 = Standard_True;
Standard_Boolean theFBOri2 = Standard_True;
- //Standard_Boolean theFSOri1 = Standard_True;
- //Standard_Boolean theFSOri2 = Standard_True;
Standard_Boolean Cumulated1, Cumulated2;
// 1- First Vertex != LastVertex but First VertexPoint == Last VertexPoint
if (!StartPoint.IsNull() && !EndPoint.IsNull()) {
Standard_Real Dist = Sqrt
- ((StartPoint->CoordinatesValue(1) - EndPoint->CoordinatesValue(1)) *
- (StartPoint->CoordinatesValue(1) - EndPoint->CoordinatesValue(1)) +
- (StartPoint->CoordinatesValue(2) - EndPoint->CoordinatesValue(2)) *
- (StartPoint->CoordinatesValue(2) - EndPoint->CoordinatesValue(2)) +
- (StartPoint->CoordinatesValue(3) - EndPoint->CoordinatesValue(3)) *
- (StartPoint->CoordinatesValue(3) - EndPoint->CoordinatesValue(3)));
- if (Dist < Precision::Confusion() ) {
- ach->AddWarning("Two instances of Vertex have equal (within uncertainty) coordinates");
- }
+ ((StartPoint->CoordinatesValue(1) - EndPoint->CoordinatesValue(1)) *
+ (StartPoint->CoordinatesValue(1) - EndPoint->CoordinatesValue(1)) +
+ (StartPoint->CoordinatesValue(2) - EndPoint->CoordinatesValue(2)) *
+ (StartPoint->CoordinatesValue(2) - EndPoint->CoordinatesValue(2)) +
+ (StartPoint->CoordinatesValue(3) - EndPoint->CoordinatesValue(3)) *
+ (StartPoint->CoordinatesValue(3) - EndPoint->CoordinatesValue(3)));
+ if (Dist < Precision::Confusion() )
+ ach->AddWarning("Two instances of Vertex have equal (within uncertainty) coordinates");
}
}
ach->AddFail("ERROR: EdgeCurve not referenced");
}
else {
- Interface_EntityIterator myShRef = aShto.Sharings(ent);
+ Interface_EntityIterator myShRef = aShto.Graph().Sharings(ent);
myShRef.SelectType (STANDARD_TYPE(StepShape_OrientedEdge),Standard_True);
nbRef = myShRef.NbEntities();
- if (nbRef ==2) {
+ if (nbRef == 2) {
theOE1 = Handle(StepShape_OrientedEdge)::DownCast(myShRef.Value());
theOEOri1 = theOE1->Orientation();
myShRef.Next();
// get the FaceBound orientation for theOE1
Standard_Boolean sharOE1 = aShto.IsShared(theOE1);
- if(!sharOE1){
-#ifdef OCCT_DEBUG
- cout << "OrientedEdge1 not shared" <<endl;
-#endif
- }
- else {
- myShRef = aShto.Sharings(theOE1);
- myShRef.SelectType (STANDARD_TYPE(StepShape_EdgeLoop),Standard_True);
- nbRef = myShRef.NbEntities();
- if (nbRef == 1) {
- myShRef.Start();
- Handle(StepShape_EdgeLoop) theEL1 =
- Handle(StepShape_EdgeLoop)::DownCast(myShRef.Value());
- Standard_Boolean sharEL1 = aShto.IsShared(theEL1);
- if(!sharEL1) {
+ if(sharOE1) {
+ myShRef = aShto.Graph().Sharings(theOE1);
+ myShRef.SelectType (STANDARD_TYPE(StepShape_EdgeLoop),Standard_True);
+ nbRef = myShRef.NbEntities();
+ if (nbRef == 1) {
+ myShRef.Start();
+ Handle(StepShape_EdgeLoop) theEL1 = Handle(StepShape_EdgeLoop)::DownCast(myShRef.Value());
+
+ Standard_Boolean sharEL1 = aShto.IsShared(theEL1);
+ if(sharEL1) {
+ myShRef = aShto.Graph().Sharings(theEL1);
+ myShRef.SelectType (STANDARD_TYPE(StepShape_FaceBound),Standard_True);
#ifdef OCCT_DEBUG
- cout << "EdgeLoop1 not shared" <<endl;
+ nbRef =
#endif
- }
- else {
- myShRef = aShto.Sharings(theEL1);
- myShRef.SelectType (STANDARD_TYPE(StepShape_FaceBound),Standard_True);
+ myShRef.NbEntities();
+ myShRef.Start();
+ theFOB1 = Handle(StepShape_FaceBound)::DownCast(myShRef.Value());
+ if (!theFOB1.IsNull()) {
+ theFBOri1 = theFOB1->Orientation();
+ }
#ifdef OCCT_DEBUG
- nbRef =
+ else cout << "EdgeLoop not referenced by FaceBound" << endl;
#endif
- myShRef.NbEntities();
- myShRef.Start();
- theFOB1 = Handle(StepShape_FaceBound)::DownCast(myShRef.Value());
- if (!theFOB1.IsNull()) {
- theFBOri1 = theFOB1->Orientation();
- }
- else {
+ }
#ifdef OCCT_DEBUG
- cout << "EdgeLoop not referenced by FaceBound" << endl;
+ else cout << "EdgeLoop1 not shared" <<endl;
#endif
- }
- }
- }
- else {
- if (nbRef == 0) {
+ }
#ifdef OCCT_DEBUG
- cout << "OrientedEdge not referenced" << endl;
+ else {
+ if (nbRef == 0)
+ cout << "OrientedEdge not referenced" << endl;
+ /*szv_c1:else if (aShto.NbTypedSharings(theOE1,STANDARD_TYPE(StepShape_EdgeLoop)) > 1)
+ cout << "OrientedEdge referenced more than once" << endl;*/
+ }
#endif
- }
- else {
- if (aShto.NbTypedSharings(theOE1,
- STANDARD_TYPE(StepShape_EdgeLoop)) > 1) {
+ }
#ifdef OCCT_DEBUG
- cout << "OrientedEdge referenced more than once" << endl;
+ else cout << "OrientedEdge1 not shared" <<endl;
#endif
- }
- }
- }
- }
// get the FaceBound orientation for theOE2
Standard_Boolean sharOE2 = aShto.IsShared(theOE2);
- if(!sharOE2){
-#ifdef OCCT_DEBUG
- cout << "OrientedEdge2 not shared" <<endl;
-#endif
- }
- else {
- myShRef = aShto.Sharings(theOE2);
+ if (sharOE2) {
+ myShRef = aShto.Graph().Sharings(theOE2);
+ myShRef.Start();
+ Handle(StepShape_EdgeLoop) theEL2 =
+ Handle(StepShape_EdgeLoop)::DownCast(myShRef.Value());
+ Standard_Boolean sharEL2 = aShto.IsShared(theEL2);
+ if (sharEL2) {
+ myShRef = aShto.Graph().Sharings(theEL2);
+ myShRef.Start();
+ theFOB2 = Handle(StepShape_FaceBound)::DownCast(myShRef.Value());
+ if (!theFOB2.IsNull())
+ theFBOri2 = theFOB2->Orientation();
#ifdef OCCT_DEBUG
-// Standard_Integer nbRef =
+ else cout << "EdgeLoop not referenced by FaceBound" << endl;
#endif
-// unused myShRef.NbEntities();
- myShRef.Start();
- Handle(StepShape_EdgeLoop) theEL2 =
- Handle(StepShape_EdgeLoop)::DownCast(myShRef.Value());
- Standard_Boolean sharEL2 = aShto.IsShared(theEL2);
- if(!sharEL2){
+ }
#ifdef OCCT_DEBUG
- cout << "EdgeLoop2 not shared" <<endl;
+ else cout << "EdgeLoop2 not shared" <<endl;
#endif
- }
- else {
- myShRef = aShto.Sharings(theEL2);
- // unused Standard_Integer nbRef = myShRef.NbEntities();
- myShRef.Start();
- theFOB2 = Handle(StepShape_FaceBound)::DownCast(myShRef.Value());
- if (!theFOB2.IsNull()) {
- theFBOri2 = theFOB2->Orientation();
- }
- else {
+ }
#ifdef OCCT_DEBUG
- cout << "EdgeLoop not referenced by FaceBound" << endl;
+ else cout << "OrientedEdge2 not shared" <<endl;
#endif
- }
- }
- }
- // "cumulate" the FaceBound and the OrientedEdge orientation
+ // "cumulate" the FaceBound and the OrientedEdge orientation
- Cumulated1 = theFBOri1 ^ theOEOri1;
+ Cumulated1 = theFBOri1 ^ theOEOri1;
Cumulated2 = theFBOri2 ^ theOEOri2;
// the orientation of the OrientedEdges must be opposite
- if (Cumulated1 == Cumulated2) {
- ach->AddFail("ERROR: non 2-manifold topology");
- }
+ if (Cumulated1 == Cumulated2)
+ ach->AddFail("ERROR: non 2-manifold topology");
}
}
}
for(Standard_Integer i=1; i<=nbEdg; i++) {
Handle(StepShape_OrientedEdge) theOE1 = theEL1->EdgeListValue(i);
Handle(StepShape_Edge) theEdg1 = theOE1->EdgeElement();
- Interface_EntityIterator myShRef = aShto.Sharings(theEdg1);
+ Interface_EntityIterator myShRef = aShto.Graph().Sharings(theEdg1);
myShRef.SelectType (STANDARD_TYPE(StepShape_OrientedEdge),Standard_True);
Standard_Integer nbRef = myShRef.NbEntities();
if(nbRef == 1) {
#endif
}
else {
- myShRef = aShto.Sharings(theOE2);
+ myShRef = aShto.Graph().Sharings(theOE2);
myShRef.SelectType (STANDARD_TYPE(StepShape_EdgeLoop),Standard_True);
myShRef.Start();
Handle(StepShape_EdgeLoop) theEL2 =
#endif
}
else {
- myShRef = aShto.Sharings(theEL2);
+ myShRef = aShto.Graph().Sharings(theEL2);
myShRef.SelectType (STANDARD_TYPE(StepShape_FaceBound),Standard_True);
myShRef.Start();
Handle(StepShape_FaceBound) theFB2 =
#include <Interface_Static.hxx>
-#include <Standard_Type.hxx>
#include <STEPCAFControl_ActorWrite.hxx>
#include <STEPCAFControl_Controller.hxx>
#include <XSAlgo.hxx>
//function : STEPCAFControl_Controller
//purpose :
//=======================================================================
+
STEPCAFControl_Controller::STEPCAFControl_Controller ()
{
- Handle(STEPCAFControl_ActorWrite) ActWrite = new STEPCAFControl_ActorWrite;
- myAdaptorWrite = ActWrite;
+ myAdaptorWrite = new STEPCAFControl_ActorWrite;
}
//=======================================================================
//purpose :
//=======================================================================
-Standard_Boolean STEPCAFControl_Controller::Init ()
+void STEPCAFControl_Controller::Init ()
{
static Standard_Boolean inic = Standard_False;
- if (inic) return Standard_True;
+ if (inic) return;
inic = Standard_True;
// self-registering
Handle(STEPCAFControl_Controller) STEPCTL = new STEPCAFControl_Controller;
Interface_Static::Init ("stepcaf", "read.stepcaf.subshapes.name", '&', "eval Off"); // 0
Interface_Static::Init ("stepcaf", "read.stepcaf.subshapes.name", '&', "eval On"); // 1
Interface_Static::SetIVal("read.stepcaf.subshapes.name", 0); // Disabled by default
-
- return Standard_True;
}
#include <Standard_Type.hxx>
#include <STEPControl_Controller.hxx>
-#include <Standard_Boolean.hxx>
class STEPCAFControl_Controller;
//! (inherited automatically)
class STEPCAFControl_Controller : public STEPControl_Controller
{
+ public:
-public:
-
-
- //! Initializes the use of STEP Norm (the first time)
- Standard_EXPORT STEPCAFControl_Controller();
-
//! Standard Initialisation. It creates a Controller for STEP-XCAF
//! and records it to various names, available to select it later
//! Returns True when done, False if could not be done
- Standard_EXPORT static Standard_Boolean Init();
-
-
-
+ Standard_EXPORT static void Init();
DEFINE_STANDARD_RTTIEXT(STEPCAFControl_Controller,STEPControl_Controller)
-protected:
-
-
-
-
-private:
-
-
-
+ protected:
+ //! Initializes the use of STEP Norm (the first time)
+ Standard_EXPORT STEPCAFControl_Controller();
};
-
-
-
-
-
-
#endif // _STEPCAFControl_Controller_HeaderFile
STEPControl_ActorWrite.hxx
STEPControl_Controller.cxx
STEPControl_Controller.hxx
+STEPControl_FloatFormat.cxx
+STEPControl_FloatFormat.hxx
STEPControl_Reader.cxx
STEPControl_Reader.hxx
STEPControl_StepModelType.hxx
+STEPControl_WorkLibrary.cxx
+STEPControl_WorkLibrary.hxx
STEPControl_Writer.cxx
STEPControl_Writer.hxx
// mapping
// ============================================================================
-Handle(Transfer_Binder) STEPControl_ActorRead::Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_ProcessForTransient)& TP)
+Handle(Transfer_Binder) STEPControl_ActorRead::Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_Process)& TP)
{
// [BEGIN] Get version of preprocessor (to detect I-Deas case) (ssv; 23.11.2010)
Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast ( TP->Model() );
Handle(Message_Messenger) sout = TP->Messenger();
#ifdef TRANSLOG
// POUR MISE AU POINT, a supprimer ensuite
-// sout<<"STEP->Shape, ent n0 "<<TP->Model()->Number(start)<<" Level="<<TP->NestingLevel()<<endl;
if (TP->TraceLevel() > 1)
sout<<" -- Actor : Transfer Ent.n0 "<<TP->Model()->Number(start)<<" Type "<<start->DynamicType()->Name()<<endl;
#endif
Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Standard_Transient)& start) Standard_OVERRIDE;
- Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_ProcessForTransient)& TP) Standard_OVERRIDE;
+ Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_Process)& TP) Standard_OVERRIDE;
Standard_EXPORT Handle(Transfer_Binder) TransferShape (const Handle(Standard_Transient)& start, const Handle(Transfer_TransientProcess)& TP, const Standard_Boolean isManifold = Standard_True);
//purpose :
//=======================================================================
-Handle(Transfer_Binder) STEPControl_ActorWrite::Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_ProcessForFinder)& FP)
+Handle(Transfer_Binder) STEPControl_ActorWrite::Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_Process)& FP)
{
XSAlgo::AlgoContainer()->PrepareForTransfer();
#include <TopTools_HSequenceOfShape.hxx>
#include <STEPControl_StepModelType.hxx>
#include <STEPConstruct_ContextTool.hxx>
+class Transfer_Finder;
class Transfer_FinderProcess;
class StepShape_ShapeDefinitionRepresentation;
class StepGeom_Axis2Placement3d;
SetMode(STEPControl_ShellBasedSurfaceModel);
}
- Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Standard_Transient)& start) Standard_OVERRIDE;
+ Standard_EXPORT Standard_Boolean Recognize (const Handle(Standard_Transient)& start) Standard_OVERRIDE;
- Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_ProcessForFinder)& FP) Standard_OVERRIDE;
+ Standard_EXPORT Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_Process)& FP) Standard_OVERRIDE;
Standard_EXPORT Handle(Transfer_Binder) TransferSubShape (const Handle(Transfer_Finder)& start, const Handle(StepShape_ShapeDefinitionRepresentation)& SDR, Handle(StepGeom_Axis2Placement3d)& AX1, const Handle(Transfer_FinderProcess)& FP, const Handle(TopTools_HSequenceOfShape)& shapeGroup = NULL, const Standard_Boolean isManifold = Standard_True);
//:j4 gka 16.03.99 S4134
// gka 05.04.99 S4136: parameters definitions changed
-#include <APIHeaderSection_EditHeader.hxx>
-#include <APIHeaderSection_MakeHeader.hxx>
-#include <HeaderSection.hxx>
-#include <IFSelect_EditForm.hxx>
-#include <IFSelect_SelectModelRoots.hxx>
-#include <IFSelect_SelectSignature.hxx>
-#include <IFSelect_SignAncestor.hxx>
-#include <IFSelect_SignCounter.hxx>
-#include <Interface_InterfaceModel.hxx>
#include <Interface_Macros.hxx>
#include <Interface_Static.hxx>
-#include <RWHeaderSection.hxx>
+#include <StepAP214.hxx>
+#include <StepAP214_Protocol.hxx>
#include <RWStepAP214.hxx>
-#include <Standard_Type.hxx>
#include <Standard_Version.hxx>
#include <STEPControl_ActorRead.hxx>
#include <STEPControl_ActorWrite.hxx>
#include <STEPControl_Controller.hxx>
-#include <StepData_FileProtocol.hxx>
#include <StepData_StepModel.hxx>
-#include <STEPEdit.hxx>
-#include <STEPEdit_EditContext.hxx>
-#include <STEPEdit_EditSDR.hxx>
-#include <StepSelect_StepType.hxx>
-#include <StepSelect_WorkLibrary.hxx>
-#include <STEPSelections_SelectAssembly.hxx>
-#include <STEPSelections_SelectDerived.hxx>
-#include <STEPSelections_SelectFaces.hxx>
-#include <STEPSelections_SelectForTransfer.hxx>
-#include <STEPSelections_SelectGSCurves.hxx>
-#include <STEPSelections_SelectInstances.hxx>
-#include <TCollection_HAsciiString.hxx>
+#include <STEPControl_WorkLibrary.hxx>
#include <TopoDS_Shape.hxx>
-#include <Transfer_ActorOfTransientProcess.hxx>
-#include <Transfer_FinderProcess.hxx>
#include <XSAlgo.hxx>
#include <XSControl_WorkSession.hxx>
+#include <APIHeaderSection_MakeHeader.hxx>
IMPLEMENT_STANDARD_RTTIEXT(STEPControl_Controller,XSControl_Controller)
{
static Standard_Boolean init = Standard_False;
if (!init) {
- RWHeaderSection::Init(); RWStepAP214::Init();
+ RWStepAP214::Init();
Interface_Static::Init ("step","write.step.product.name",'t',"Open CASCADE STEP translator " OCC_VERSION_STRING);
Interface_Static::Init ("step","write.step.assembly",'e',"");
ActWrite->SetGroupMode (Interface_Static::IVal("write.step.assembly"));
myAdaptorWrite = ActWrite;
- Handle(StepSelect_WorkLibrary) swl = new StepSelect_WorkLibrary;
+ Handle(STEPControl_WorkLibrary) swl = new STEPControl_WorkLibrary;
swl->SetDumpLabel(1);
myAdaptorLibrary = swl;
- myAdaptorProtocol = STEPEdit::Protocol();
+ myAdaptorProtocol = StepAP214::Protocol();
myAdaptorRead = new STEPControl_ActorRead; // par ex pour Recognize
SetModeWrite (0,4);
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
{
- return STEPEdit::NewModel();
+ APIHeaderSection_MakeHeader head;
+ return head.NewModel(StepAP214::Protocol());
}
// #### PROVISOIRE ??? ####
return XSControl_Controller::TransferWriteShape (shape,FP,model,modeshape);
}
-Standard_Boolean STEPControl_Controller::Init ()
+//=======================================================================
+//function : Init
+//purpose :
+//=======================================================================
+
+void STEPControl_Controller::Init ()
{
static Standard_Boolean inic = Standard_False;
if (!inic) {
+ inic = Standard_True;
Handle(STEPControl_Controller) STEPCTL = new STEPControl_Controller;
STEPCTL->AutoRecord(); // avec les noms donnes a la construction
XSAlgo::Init();
- inic = Standard_True;
}
- 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);
-
-
-
}
//! defines basic controller for STEP processor
class STEPControl_Controller : public XSControl_Controller
{
-
-public:
-
-
- //! Initializes the use of STEP Norm (the first time) and
- //! returns a Controller
- Standard_EXPORT STEPControl_Controller();
+ public:
//! Creates a new empty Model ready to receive data of the Norm.
//! 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;
+ Standard_EXPORT virtual Handle(Interface_InterfaceModel) NewModel() const Standard_OVERRIDE;
//! Takes one Shape and transfers it to the InterfaceModel
//! (already created by NewModel for instance)
//! Standard Initialisation. It creates a Controller for STEP
//! and records it to various names, available to select it later
//! Returns True when done, False if could not be done
- Standard_EXPORT static Standard_Boolean Init();
-
-
-
+ Standard_EXPORT static void Init();
DEFINE_STANDARD_RTTIEXT(STEPControl_Controller,XSControl_Controller)
-protected:
-
-
-
-
-private:
-
-
-
+ protected:
+ //! Initializes the use of STEP Norm (the first time) and
+ //! returns a Controller
+ Standard_EXPORT STEPControl_Controller();
};
-
-
-
-
-
-
#endif // _STEPControl_Controller_HeaderFile
--- /dev/null
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <STEPControl_FloatFormat.hxx>
+#include <StepData_StepWriter.hxx>
+
+#include <stdio.h>
+IMPLEMENT_STANDARD_RTTIEXT(STEPControl_FloatFormat,IFSelect_GeneralModifier)
+
+STEPControl_FloatFormat::STEPControl_FloatFormat ()
+: IFSelect_GeneralModifier (Standard_False),
+ thezerosup (Standard_True) , themainform ("%E") ,
+ theformrange ("%f") , therangemin (0.1) , therangemax (1000.)
+{}
+
+
+void STEPControl_FloatFormat::SetDefault (const Standard_Integer digits)
+{
+ themainform.Clear();
+ theformrange.Clear();
+ if (digits <= 0) {
+ themainform.AssignCat ("%E");
+ theformrange.AssignCat ("%f");
+ } else {
+ char format[20];
+ char pourcent = '%'; char point = '.';
+ Sprintf(format, "%c%d%c%dE",pourcent,digits+2,point,digits);
+ themainform.AssignCat (format);
+ Sprintf(format, "%c%d%c%df",pourcent,digits+2,point,digits);
+ theformrange.AssignCat (format);
+ }
+ therangemin = 0.1; therangemax = 1000.;
+ thezerosup = Standard_True;
+}
+
+
+void STEPControl_FloatFormat::SetFormat (const Standard_CString format)
+{ themainform.Clear(); themainform.AssignCat(format); }
+
+
+void STEPControl_FloatFormat::SetFormatForRange
+ (const Standard_CString form, const Standard_Real R1, const Standard_Real R2)
+{
+ theformrange.Clear(); theformrange.AssignCat(form);
+ therangemin = R1; therangemax = R2;
+}
+
+
+void STEPControl_FloatFormat::Format
+ (Standard_Boolean& zerosup, TCollection_AsciiString& mainform,
+ Standard_Boolean& hasrange, TCollection_AsciiString& formrange,
+ Standard_Real& rangemin, Standard_Real& rangemax) const
+{
+ zerosup = thezerosup;
+ mainform = themainform;
+ hasrange = (theformrange.Length() > 0);
+ formrange = theformrange;
+ rangemin = therangemin;
+ rangemax = therangemax;
+}
+
+
+void STEPControl_FloatFormat::Perform (StepData_StepWriter& writer) const
+{
+ writer.FloatWriter().SetFormat (themainform.ToCString());
+ writer.FloatWriter().SetZeroSuppress (thezerosup);
+ if (theformrange.Length() > 0) writer.FloatWriter().SetFormatForRange
+ (theformrange.ToCString(), therangemin, therangemax);
+}
+
+
+TCollection_AsciiString STEPControl_FloatFormat::Label () const
+{
+ TCollection_AsciiString lab("Float Format ");
+ if (thezerosup) lab.AssignCat(" ZeroSuppress");
+ lab.AssignCat (themainform);
+ if (theformrange.Length() > 0) {
+ char mess[30];
+ Sprintf(mess,", in range %f %f %s",
+ therangemin,therangemax,theformrange.ToCString());
+ lab.AssignCat(mess);
+ }
+ return lab;
+}
--- /dev/null
+// Created on: 1994-06-01
+// Created by: Christian CAILLET
+// Copyright (c) 1994-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _STEPControl_FloatFormat_HeaderFile
+#define _STEPControl_FloatFormat_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <TCollection_AsciiString.hxx>
+#include <IFSelect_GeneralModifier.hxx>
+class StepData_StepWriter;
+
+class STEPControl_FloatFormat;
+DEFINE_STANDARD_HANDLE(STEPControl_FloatFormat, IFSelect_GeneralModifier)
+
+//! This class gives control out format for floatting values :
+//! ZeroSuppress or no, Main Format, Format in Range (for values
+//! around 1.), as StepWriter allows to manage it.
+//! Formats are given under C-printf form
+class STEPControl_FloatFormat : public IFSelect_GeneralModifier
+{
+ public:
+
+ //! Creates a new FloatFormat, with standard options :
+ //! ZeroSuppress, Main Format = %E,
+ //! Format between 0.001 and 1000. = %f
+ Standard_EXPORT STEPControl_FloatFormat();
+
+ //! Sets FloatFormat to default value (see Create) but if <digits>
+ //! is given positive, it commands Formats (main and range) to
+ //! ensure <digits> significant digits to be displayed
+ Standard_EXPORT void SetDefault (const Standard_Integer digits = 0);
+
+ //! Sets ZeroSuppress mode to a new value
+ void SetZeroSuppress (const Standard_Boolean mode) { thezerosup = mode; }
+
+ //! Sets Main Format to a new value
+ //! Remark : SetFormat, SetZeroSuppress and SetFormatForRange are
+ //! independant
+ Standard_EXPORT void SetFormat (const Standard_CString format = "%E");
+
+ //! Sets Format for Range to a new value with its range of
+ //! application.
+ //! To cancel it, give format as "" (empty string)
+ //! Remark that if the condition (0. < Rmin < Rmax) is not
+ //! verified, this secondary format will be ignored.
+ //! Moreover, this secondary format is intended to be used in a
+ //! range around 1.
+ Standard_EXPORT void SetFormatForRange (const Standard_CString format = "%f", const Standard_Real Rmin = 0.1, const Standard_Real Rmax = 1000.0);
+
+ //! Returns all recorded parameters :
+ //! zerosup : ZeroSuppress status
+ //! mainform : Main Format (which applies out of the range, or
+ //! for every real if no range is set)
+ //! hasrange : True if a FormatInRange is set, False else
+ //! (following parameters do not apply if it is False)
+ //! forminrange : Secondary Format (it applies inside the range)
+ //! rangemin, rangemax : the range in which the secondary format
+ //! applies
+ Standard_EXPORT void Format (Standard_Boolean& zerosup, TCollection_AsciiString& mainform, Standard_Boolean& hasrange, TCollection_AsciiString& forminrange, Standard_Real& rangemin, Standard_Real& rangemax) const;
+
+ //! Sets the Floatting Formats of StepWriter to the recorded
+ //! parameters
+ Standard_EXPORT void Perform (StepData_StepWriter& writer) const;
+
+ //! Returns specific Label : for instance,
+ //! "Float Format [ZeroSuppress] %E [, in range R1-R2 %f]"
+ Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT(STEPControl_FloatFormat,IFSelect_GeneralModifier)
+
+ private:
+
+ Standard_Boolean thezerosup;
+ TCollection_AsciiString themainform;
+ TCollection_AsciiString theformrange;
+ Standard_Real therangemin;
+ Standard_Real therangemax;
+};
+
+#endif // _STEPControl_FloatFormat_HeaderFile
--- /dev/null
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#include <IFSelect_ContextWrite.hxx>
+#include <IFSelect_GeneralModifier.hxx>
+#include <Interface_Check.hxx>
+#include <Interface_CheckIterator.hxx>
+#include <Interface_CopyTool.hxx>
+#include <Interface_EntityIterator.hxx>
+#include <Interface_InterfaceModel.hxx>
+#include <Interface_Macros.hxx>
+#include <Interface_ParamType.hxx>
+#include <Interface_Protocol.hxx>
+#include <Interface_ReportEntity.hxx>
+#include <Interface_UndefinedContent.hxx>
+#include <Message.hxx>
+#include <Message_Messenger.hxx>
+#include <OSD_OpenFile.hxx>
+#include <Standard_Transient.hxx>
+#include <Standard_Type.hxx>
+#include <StepData_Protocol.hxx>
+#include <StepData_StepDumper.hxx>
+#include <StepData_StepModel.hxx>
+#include <StepData_StepWriter.hxx>
+#include <StepData_UndefinedEntity.hxx>
+#include <StepFile_Read.hxx>
+#include <STEPControl_FloatFormat.hxx>
+#include <STEPControl_WorkLibrary.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+
+#include <errno.h>
+#include <sys/stat.h>
+IMPLEMENT_STANDARD_RTTIEXT(STEPControl_WorkLibrary,IFSelect_WorkLibrary)
+
+STEPControl_WorkLibrary::STEPControl_WorkLibrary
+ (const Standard_Boolean copymode)
+ : thecopymode (copymode) , thelabmode (0)
+{
+ SetDumpLevels (1,2);
+ SetDumpHelp (0,"#id + Step Type");
+ SetDumpHelp (1,"Entity as in file");
+ SetDumpHelp (2,"Entity + shareds (level 1) as in file");
+}
+// rq : les init sont faits par ailleurs, pas de souci a se faire
+
+
+Standard_Integer STEPControl_WorkLibrary::ReadFile
+ (const Standard_CString name,
+ Handle(Interface_InterfaceModel)& model,
+ const Handle(Interface_Protocol)& protocol) const
+{
+ long status = 1;
+ DeclareAndCast(StepData_Protocol,stepro,protocol);
+ if (stepro.IsNull()) return 1;
+ Handle(StepData_StepModel) stepmodel = new StepData_StepModel;
+ model = stepmodel;
+ StepFile_ReadTrace (0);
+ char *pName=(char *)name;
+ status = StepFile_Read (pName,stepmodel,stepro);
+ return status;
+}
+
+
+Standard_Boolean STEPControl_WorkLibrary::WriteFile
+ (IFSelect_ContextWrite& ctx) const
+{
+// Preparation
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ DeclareAndCast(StepData_StepModel,stepmodel,ctx.Model());
+ DeclareAndCast(StepData_Protocol,stepro,ctx.Protocol());
+ if (stepmodel.IsNull() || stepro.IsNull()) return Standard_False;
+
+ ofstream fout;
+ OSD_OpenStream(fout,ctx.FileName(),ios::out|ios::trunc);
+
+ if (!fout || !fout.rdbuf()->is_open()) {
+ ctx.CCheck(0)->AddFail("Step File could not be created");
+ sout<<" Step File could not be created : " << ctx.FileName() << endl; return 0;
+ }
+ sout << " Step File Name : "<<ctx.FileName();
+ StepData_StepWriter SW(stepmodel);
+ sout<<"("<<stepmodel->NbEntities()<<" ents) ";
+
+// File Modifiers
+ Standard_Integer nbmod = ctx.NbModifiers();
+ for (Standard_Integer numod = 1; numod <= nbmod; numod ++) {
+ ctx.SetModifier (numod);
+ DeclareAndCast(STEPControl_FloatFormat,filemod,ctx.FileModifier());
+ if (!filemod.IsNull()) filemod->Perform(SW);
+// (impressions de mise au point)
+ sout << " .. FileMod." << numod << filemod->Label();
+ if (ctx.IsForAll()) sout << " (all model)";
+ else sout << " (" << ctx.NbEntities() << " entities)";
+ }
+
+// Envoi
+ SW.SendModel(stepro);
+ Interface_CheckIterator chl = SW.CheckList();
+ for (chl.Start(); chl.More(); chl.Next())
+ ctx.CCheck(chl.Number())->GetMessages(chl.Value());
+ sout<<" Write ";
+ Standard_Boolean isGood = SW.Print(fout);
+ sout<<" Done"<<endl;
+
+ errno = 0;
+ fout.close();
+ isGood = fout.good() && isGood && !errno;
+ if(errno)
+ sout << strerror(errno) << endl;
+ return isGood;
+}
+
+
+Standard_Boolean STEPControl_WorkLibrary::CopyModel
+ (const Handle(Interface_InterfaceModel)& original,
+ const Handle(Interface_InterfaceModel)& newmodel,
+ const Interface_EntityIterator& list,
+ Interface_CopyTool& TC) const
+{
+ if (thecopymode) return
+ IFSelect_WorkLibrary::CopyModel (original,newmodel,list,TC);
+ return thecopymode;
+}
+
+
+void STEPControl_WorkLibrary::DumpEntity
+ (const Handle(Interface_InterfaceModel)& model,
+ const Handle(Interface_Protocol)& protocol,
+ const Handle(Standard_Transient)& entity,
+ const Handle(Message_Messenger)& S, const Standard_Integer level) const
+{
+ Standard_Integer nument = model->Number(entity);
+ if (nument <= 0 || nument > model->NbEntities()) return;
+ Standard_Boolean iserr = model->IsRedefinedContent(nument);
+ Handle(Standard_Transient) ent, con; ent = entity;
+ S<<" --- (STEP) Entity "; model->Print(entity,S);
+ if (iserr) con = model->ReportEntity(nument)->Content();
+ if (entity.IsNull()) { S<<" Null"<<endl; return; }
+
+// On attaque le dump : d abord cas de l Erreur
+ S << " Type cdl : " << entity->DynamicType()->Name() << endl;
+ if (iserr)
+ S<<" *** NOT WELL LOADED : CONTENT FROM FILE ***"<<endl;
+ else if (model->IsUnknownEntity(nument))
+ S<<" *** UNKNOWN TYPE ***"<<endl;
+
+ StepData_StepDumper dump(GetCasted(StepData_StepModel,model),
+ GetCasted(StepData_Protocol,protocol),thelabmode);
+ dump.Dump(S,ent,level);
+}
--- /dev/null
+// Created on: 1994-09-14
+// Created by: Christian CAILLET
+// Copyright (c) 1994-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _STEPControl_WorkLibrary_HeaderFile
+#define _STEPControl_WorkLibrary_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <Standard_Boolean.hxx>
+#include <Standard_Integer.hxx>
+#include <IFSelect_WorkLibrary.hxx>
+#include <Standard_CString.hxx>
+class Interface_InterfaceModel;
+class Interface_Protocol;
+class IFSelect_ContextWrite;
+class Interface_EntityIterator;
+class Interface_CopyTool;
+class Standard_Transient;
+class Message_Messenger;
+
+
+class STEPControl_WorkLibrary;
+DEFINE_STANDARD_HANDLE(STEPControl_WorkLibrary, IFSelect_WorkLibrary)
+
+//! Performs Read and Write a STEP File with a STEP Model
+//! Following the protocols, Copy may be implemented or not
+class STEPControl_WorkLibrary : public IFSelect_WorkLibrary
+{
+ public:
+
+ //! Creates a STEP WorkLibrary
+ //! <copymode> precises whether Copy is implemented or not
+ Standard_EXPORT STEPControl_WorkLibrary(const Standard_Boolean copymode = Standard_True);
+
+ //! Selects a mode to dump entities
+ //! 0 (D) : prints numbers, then displays table number/label
+ //! 1 : prints labels, then displays table label/number
+ //! 2 : prints labels onky
+ void SetDumpLabel (const Standard_Integer mode) { thelabmode = mode; }
+
+ //! Reads a STEP File and returns a STEP Model (into <mod>),
+ //! or lets <mod> "Null" in case of Error
+ //! Returns 0 if OK, 1 if Read Error, -1 if File not opened
+ Standard_EXPORT Standard_Integer ReadFile (const Standard_CString name, Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol) const Standard_OVERRIDE;
+
+ //! Writes a File from a STEP Model
+ //! Returns False (and writes no file) if <ctx> does not bring a
+ //! STEP Model
+ Standard_EXPORT Standard_Boolean WriteFile (IFSelect_ContextWrite& ctx) const Standard_OVERRIDE;
+
+ //! Performs the copy of entities from an original model to a new
+ //! one. Works according <copymode> :
+ //! if True, standard copy is run
+ //! else nothing is done and returned value is False
+ Standard_EXPORT virtual Standard_Boolean CopyModel (const Handle(Interface_InterfaceModel)& original, const Handle(Interface_InterfaceModel)& newmodel, const Interface_EntityIterator& list, Interface_CopyTool& TC) const Standard_OVERRIDE;
+
+ //! Dumps an entity under STEP form, i.e. as a part of a Step file
+ //! Works with a StepDumper.
+ //! Level 0 just displays type; level 1 displays the entity itself
+ //! and level 2 displays the entity plus its shared ones (one
+ //! sub-level : immediately shared entities)
+ Standard_EXPORT void DumpEntity (const Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol, const Handle(Standard_Transient)& entity, const Handle(Message_Messenger)& S, const Standard_Integer level) const Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT(STEPControl_WorkLibrary,IFSelect_WorkLibrary)
+
+ private:
+
+ Standard_Boolean thecopymode;
+ Standard_Integer thelabmode;
+};
+
+#endif // _STEPControl_WorkLibrary_HeaderFile
-STEPEdit.cxx
-STEPEdit.hxx
STEPEdit_EditContext.cxx
STEPEdit_EditContext.hxx
STEPEdit_EditSDR.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 <APIHeaderSection_MakeHeader.hxx>
-#include <IFSelect_SelectModelEntities.hxx>
-#include <IFSelect_SelectModelRoots.hxx>
-#include <IFSelect_SelectSignature.hxx>
-#include <IFSelect_Signature.hxx>
-#include <Interface_Protocol.hxx>
-#include <StepAP214.hxx>
-#include <StepAP214_Protocol.hxx>
-#include <StepData_StepModel.hxx>
-#include <STEPEdit.hxx>
-#include <StepSelect_StepType.hxx>
-
-Handle(Interface_Protocol) STEPEdit::Protocol ()
-{
-/*
- static Handle(StepData_FileProtocol) proto;
- if (!proto.IsNull()) return proto;
- proto = new StepData_FileProtocol;
- proto->Add (StepAP214::Protocol());
- proto->Add (HeaderSection::Protocol());
- return proto;
-*/
- return StepAP214::Protocol();
-}
-
-Handle(StepData_StepModel) STEPEdit::NewModel ()
-{
- APIHeaderSection_MakeHeader head;
- return head.NewModel(STEPEdit::Protocol());
-}
-
-Handle(IFSelect_Signature) STEPEdit::SignType ()
-{
- static Handle(StepSelect_StepType) sty;
- if (!sty.IsNull()) return sty;
- sty = new StepSelect_StepType;
- sty->SetProtocol (STEPEdit::Protocol());
- return sty;
-}
-
-Handle(IFSelect_SelectSignature) STEPEdit::NewSelectSDR ()
-{
- Handle(IFSelect_SelectSignature) sel = new IFSelect_SelectSignature
- (STEPEdit::SignType(),"SHAPE_DEFINITION_REPRESENTATION");
- sel->SetInput (new IFSelect_SelectModelRoots);
- return sel;
-}
-
-Handle(IFSelect_SelectSignature) STEPEdit::NewSelectPlacedItem ()
-{
- Handle(IFSelect_SelectSignature) sel = new IFSelect_SelectSignature
- (STEPEdit::SignType(),"MAPPED_ITEM|CONTEXT_DEPENDENT_SHAPE_REPRESENTATION",Standard_False);
- sel->SetInput (new IFSelect_SelectModelEntities);
- return sel;
-}
-
-Handle(IFSelect_SelectSignature) STEPEdit::NewSelectShapeRepr ()
-{
- Handle(IFSelect_SelectSignature) sel = new IFSelect_SelectSignature
- (STEPEdit::SignType(),"SHAPE_REPRESENTATION",Standard_False);
-// REPRESENTATION_RELATIONSHIP passe par CONTEXT_DEPENDENT_SHAPE_REPRESENTATION
- sel->SetInput (new IFSelect_SelectModelEntities);
- return sel;
-}
+++ /dev/null
-// Created on: 1998-07-29
-// Created by: Christian CAILLET
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _STEPEdit_HeaderFile
-#define _STEPEdit_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-class Interface_Protocol;
-class StepData_StepModel;
-class IFSelect_Signature;
-class IFSelect_SelectSignature;
-class STEPEdit_EditContext;
-class STEPEdit_EditSDR;
-
-
-//! Provides tools to exploit and edit a set of STEP data :
-//! editors, selections ..
-class STEPEdit
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- //! Returns a Protocol fit for STEP (creates the first time)
- Standard_EXPORT static Handle(Interface_Protocol) Protocol();
-
- //! Returns a new empty StepModel fit for STEP
- //! i.e. with its header determined from Protocol
- Standard_EXPORT static Handle(StepData_StepModel) NewModel();
-
- //! Returns a SignType fit for STEP (creates the first time)
- Standard_EXPORT static Handle(IFSelect_Signature) SignType();
-
- //! Creates a Selection for ShapeDefinitionRepresentation
- //! By default searches among root entities
- Standard_EXPORT static Handle(IFSelect_SelectSignature) NewSelectSDR();
-
- //! Creates a Selection for Placed Items, i.e. MappedItem or
- //! ContextDependentShapeRepresentation, which itself refers to a
- //! RepresentationRelationship with possible subtypes (Shape...
- //! and/or ...WithTransformation)
- //! By default in the whole StepModel
- Standard_EXPORT static Handle(IFSelect_SelectSignature) NewSelectPlacedItem();
-
- //! Creates a Selection for ShapeRepresentation and its sub-types,
- //! plus ContextDependentShapeRepresentation (which is not a
- //! sub-type of ShapeRepresentation)
- //! By default in the whole StepModel
- Standard_EXPORT static Handle(IFSelect_SelectSignature) NewSelectShapeRepr();
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-friend class STEPEdit_EditContext;
-friend class STEPEdit_EditSDR;
-
-};
-
-
-
-
-
-
-
-#endif // _STEPEdit_HeaderFile
Interface_EntityIterator roots = G.RootEntities();
myGraph = new Interface_HGraph(G);
- myEntities.Destroy();
+ myEntities.Start();
for (roots.Start(); roots.More(); roots.Next())
AddInstances(roots.Value(), G, myEntities);
}
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-
-#include <Interface_Statics.hxx>
#include <StepAP214.hxx>
#include <StepAP214_Protocol.hxx>
-StaticHandle(StepAP214_Protocol, proto);
-
-Handle(StepAP214_Protocol) StepAP214::Protocol()
-
- {
- InitHandleVoid(StepAP214_Protocol, proto);
- return proto;
- }
+//szv_c1:StaticHandle(StepAP214_Protocol, proto);
+static Handle(StepAP214_Protocol) proto;
+const Handle(StepAP214_Protocol) & StepAP214::Protocol()
+{
+ //szv_c1:InitHandleVoid(StepAP214_Protocol, proto);
+ if (proto.IsNull()) proto = new StepAP214_Protocol;
+ return proto;
+}
#define _StepAP214_HeaderFile
#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
-
-class StepAP214_Protocol;
-class StepAP214_AutoDesignDateAndPersonItem;
-class StepAP214_AutoDesignDateAndTimeItem;
-class StepAP214_AutoDesignDatedItem;
-class StepAP214_AutoDesignGeneralOrgItem;
-class StepAP214_AutoDesignOrganizationItem;
-class StepAP214_AutoDesignGroupedItem;
-class StepAP214_AutoDesignPresentedItemSelect;
-class StepAP214_AutoDesignReferencingItem;
-class StepAP214_DateAndTimeItem;
-class StepAP214_DateItem;
-class StepAP214_ApprovalItem;
-class StepAP214_OrganizationItem;
-class StepAP214_DocumentReferenceItem;
-class StepAP214_GroupItem;
-class StepAP214_PersonAndOrganizationItem;
-class StepAP214_PresentedItemSelect;
-class StepAP214_SecurityClassificationItem;
class StepAP214_Protocol;
-class StepAP214_AutoDesignApprovalAssignment;
-class StepAP214_AutoDesignActualDateAndTimeAssignment;
-class StepAP214_AutoDesignNominalDateAndTimeAssignment;
-class StepAP214_AutoDesignActualDateAssignment;
-class StepAP214_AutoDesignNominalDateAssignment;
-class StepAP214_AutoDesignGroupAssignment;
-class StepAP214_AutoDesignOrganizationAssignment;
-class StepAP214_AutoDesignDateAndPersonAssignment;
-class StepAP214_AutoDesignPersonAndOrganizationAssignment;
-class StepAP214_AutoDesignPresentedItem;
-class StepAP214_AutoDesignSecurityClassificationAssignment;
-class StepAP214_AutoDesignDocumentReference;
-class StepAP214_AppliedApprovalAssignment;
-class StepAP214_AppliedDateAndTimeAssignment;
-class StepAP214_AppliedDateAssignment;
-class StepAP214_AppliedGroupAssignment;
-class StepAP214_AppliedOrganizationAssignment;
-class StepAP214_AppliedPersonAndOrganizationAssignment;
-class StepAP214_AppliedPresentedItem;
-class StepAP214_AppliedSecurityClassificationAssignment;
-class StepAP214_AppliedDocumentReference;
-class StepAP214_AppliedExternalIdentificationAssignment;
-class StepAP214_Class;
-class StepAP214_ExternalIdentificationItem;
-class StepAP214_ExternallyDefinedClass;
-class StepAP214_ExternallyDefinedGeneralProperty;
-class StepAP214_RepItemGroup;
-
//! Complete AP214 CC1 , Revision 4
//! Upgrading from Revision 2 to Revision 4 : 26 Mar 1997
//! Splitting in sub-schemas : 5 Nov 1997
class StepAP214
{
-public:
+ public:
- DEFINE_STANDARD_ALLOC
-
-
//! creates a Protocol
- Standard_EXPORT static Handle(StepAP214_Protocol) Protocol();
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-friend class StepAP214_AutoDesignDateAndPersonItem;
-friend class StepAP214_AutoDesignDateAndTimeItem;
-friend class StepAP214_AutoDesignDatedItem;
-friend class StepAP214_AutoDesignGeneralOrgItem;
-friend class StepAP214_AutoDesignOrganizationItem;
-friend class StepAP214_AutoDesignGroupedItem;
-friend class StepAP214_AutoDesignPresentedItemSelect;
-friend class StepAP214_AutoDesignReferencingItem;
-friend class StepAP214_DateAndTimeItem;
-friend class StepAP214_DateItem;
-friend class StepAP214_ApprovalItem;
-friend class StepAP214_OrganizationItem;
-friend class StepAP214_DocumentReferenceItem;
-friend class StepAP214_GroupItem;
-friend class StepAP214_PersonAndOrganizationItem;
-friend class StepAP214_PresentedItemSelect;
-friend class StepAP214_SecurityClassificationItem;
-friend class StepAP214_Protocol;
-friend class StepAP214_AutoDesignApprovalAssignment;
-friend class StepAP214_AutoDesignActualDateAndTimeAssignment;
-friend class StepAP214_AutoDesignNominalDateAndTimeAssignment;
-friend class StepAP214_AutoDesignActualDateAssignment;
-friend class StepAP214_AutoDesignNominalDateAssignment;
-friend class StepAP214_AutoDesignGroupAssignment;
-friend class StepAP214_AutoDesignOrganizationAssignment;
-friend class StepAP214_AutoDesignDateAndPersonAssignment;
-friend class StepAP214_AutoDesignPersonAndOrganizationAssignment;
-friend class StepAP214_AutoDesignPresentedItem;
-friend class StepAP214_AutoDesignSecurityClassificationAssignment;
-friend class StepAP214_AutoDesignDocumentReference;
-friend class StepAP214_AppliedApprovalAssignment;
-friend class StepAP214_AppliedDateAndTimeAssignment;
-friend class StepAP214_AppliedDateAssignment;
-friend class StepAP214_AppliedGroupAssignment;
-friend class StepAP214_AppliedOrganizationAssignment;
-friend class StepAP214_AppliedPersonAndOrganizationAssignment;
-friend class StepAP214_AppliedPresentedItem;
-friend class StepAP214_AppliedSecurityClassificationAssignment;
-friend class StepAP214_AppliedDocumentReference;
-friend class StepAP214_AppliedExternalIdentificationAssignment;
-friend class StepAP214_Class;
-friend class StepAP214_ExternalIdentificationItem;
-friend class StepAP214_ExternallyDefinedClass;
-friend class StepAP214_ExternallyDefinedGeneralProperty;
-friend class StepAP214_RepItemGroup;
-
+ Standard_EXPORT static const Handle(StepAP214_Protocol) & Protocol();
};
-
-
-
-
-
-
#endif // _StepAP214_HeaderFile
#include <StepRepr_ConstructiveGeometryRepresentationRelationship.hxx>
#include <StepVisual_CharacterizedObjectAndCharacterizedRepresentationAndDraughtingModelAndRepresentation.hxx>
-static int init = 0;
static Interface_DataMapOfTransientInteger types(800);
StepAP214_Protocol::StepAP214_Protocol ()
{
+ static int init = 0;
if (init) return; init = 1;
types.Bind (STANDARD_TYPE(StepBasic_Address), 1);
//purpose :
//=======================================================================
-Standard_Integer StepAP214_Protocol::TypeNumber(const
-Handle(Standard_Type)& atype) const
+Standard_Integer StepAP214_Protocol::TypeNumber(const Handle(Standard_Type)& atype) const
{
- if (types.IsBound (atype)) return types.Find(atype);
- else return 0;
+ const Standard_Integer *num = types.Seek(atype);
+ return (num? *num : 0);
}
//purpose :
//=======================================================================
-Handle(Interface_Protocol) StepAP214_Protocol::Resource
- (const Standard_Integer /*num*/) const
+Handle(Interface_Protocol) StepAP214_Protocol::Resource (const Standard_Integer /*num*/) const
{
return HeaderSection::Protocol();
}
-
//! It requires StepAP214 as a Resource
class StepAP214_Protocol : public StepData_Protocol
{
-
-public:
-
+ public:
Standard_EXPORT StepAP214_Protocol();
//! Returns a Resource, given its rank (between 1 and NbResources)
Standard_EXPORT virtual Handle(Interface_Protocol) Resource (const Standard_Integer num) const Standard_OVERRIDE;
-
-
-
DEFINE_STANDARD_RTTIEXT(StepAP214_Protocol,StepData_Protocol)
-
-protected:
-
-
-
-
-private:
-
-
-
-
};
-
-
-
-
-
-
#endif // _StepAP214_Protocol_HeaderFile
StepData_DescrGeneral.hxx
StepData_Described.cxx
StepData_Described.hxx
-StepData_DescrProtocol.cxx
-StepData_DescrProtocol.hxx
StepData_DescrReadWrite.cxx
StepData_DescrReadWrite.hxx
StepData_ECDescr.cxx
StepData_FieldListD.hxx
StepData_FieldListN.cxx
StepData_FieldListN.hxx
-StepData_FileProtocol.cxx
-StepData_FileProtocol.hxx
StepData_FileRecognizer.hxx
StepData_FileRecognizer_0.cxx
StepData_FreeFormEntity.cxx
StepData_GlobalNodeOfWriterLib.hxx
StepData_GlobalNodeOfWriterLib_0.cxx
StepData_HArray1OfField.hxx
-StepData_HeaderTool.cxx
-StepData_HeaderTool.hxx
StepData_Logical.hxx
StepData_NodeOfWriterLib.hxx
StepData_NodeOfWriterLib_0.cxx
// abv 09.04.99 S4136: eliminate parameter step.readaccept.void
// svv #2 23.02.00: porting on SIL
-#include <Interface_Macros.hxx>
-#include <Interface_Static.hxx>
-#include <Interface_Statics.hxx>
#include <StepData.hxx>
-#include <StepData_DefaultGeneral.hxx>
-#include <StepData_FileProtocol.hxx>
+#include <Interface_Macros.hxx>
+#include <HeaderSection.hxx>
+#include <HeaderSection_Protocol.hxx>
#include <StepData_Protocol.hxx>
-StaticHandle(StepData_Protocol,proto);
-//svv #2: StaticHandle(StepData_DefaultGeneral,stmod);
-
-StaticHandleA(StepData_Protocol,theheader);
+//szv_c1:StaticHandle(StepData_Protocol,proto);
+static Handle(StepData_Protocol) proto;
+//szv_c1:StaticHandleA(StepData_Protocol,theheader);
+static Handle(StepData_Protocol) theheader;
- void StepData::Init ()
-{
-// InitHandleVoid(StepData_Protocol,proto);
-// InitHandleVoid(StepData_DefaultGeneral,stmod);
-//:S4136 Interface_Static::Init("step","step.readaccept.void",'i',"1");
-// if (proto.IsNull()) proto = new StepData_Protocol;
-// if (stmod.IsNull()) stmod = new StepData_DefaultGeneral;
-}
-
- Handle(StepData_Protocol) StepData::Protocol ()
+const Handle(StepData_Protocol) & StepData::Protocol ()
{
- InitHandleVoid(StepData_Protocol,proto);// svv #2
-// UseHandle(StepData_Protocol,proto);
+ //szv_c1:InitHandleVoid(StepData_Protocol,proto);// svv #2
+ if (proto.IsNull()) proto = new StepData_Protocol;
return proto;
}
-
- void StepData::AddHeaderProtocol (const Handle(StepData_Protocol)& header)
-{
- InitHandle(StepData_Protocol,theheader);
- if (theheader.IsNull()) theheader = header;
- else {
- DeclareAndCast(StepData_FileProtocol,headmult,theheader);
- if (headmult.IsNull()) {
- headmult = new StepData_FileProtocol;
- headmult->Add(theheader);
- }
- headmult->Add(header);
- theheader = headmult;
- }
-}
-
- Handle(StepData_Protocol) StepData::HeaderProtocol ()
+const Handle(StepData_Protocol) & StepData::HeaderProtocol ()
{
- UseHandle(StepData_Protocol,theheader);
- return theheader;
+ /*szv_c1:UseHandle(StepData_Protocol,theheader);
+ return theheader;*/
+ return HeaderSection::Protocol();
}
#define _StepData_HeaderFile
#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
-
-class StepData_Protocol;
-class StepData_StepModel;
-class StepData_UndefinedEntity;
-class StepData_SelectType;
-class StepData_Field;
-class StepData_SelectMember;
-class StepData_SelectInt;
-class StepData_SelectReal;
-class StepData_SelectNamed;
-class StepData_SelectArrReal;
-class StepData_PDescr;
-class StepData_FieldList;
-class StepData_FieldList1;
-class StepData_FieldListN;
-class StepData_FieldListD;
-class StepData_EDescr;
-class StepData_ESDescr;
-class StepData_ECDescr;
-class StepData_Described;
-class StepData_Simple;
-class StepData_Plex;
-class StepData_FreeFormEntity;
class StepData_Protocol;
-class StepData_GeneralModule;
-class StepData_FileRecognizer;
-class StepData_FileProtocol;
-class StepData_HeaderTool;
-class StepData_EnumTool;
-class StepData_DescrProtocol;
-class StepData_DescrGeneral;
-class StepData_DescrReadWrite;
-class StepData_StepReaderData;
-class StepData_StepReaderTool;
-class StepData_ReadWriteModule;
-class StepData_StepWriter;
-class StepData_StepDumper;
-class StepData_WriterLib;
-class StepData_DefaultGeneral;
-class StepData_GlobalNodeOfWriterLib;
-class StepData_NodeOfWriterLib;
-
//! Gives basic data definition for Step Interface.
//! Any class of a data model described in EXPRESS Language
//! is candidate to be managed by a Step Interface
class StepData
{
-public:
-
- DEFINE_STANDARD_ALLOC
-
+ public:
+ //! Returns a Protocol from StepData
+ Standard_EXPORT static const Handle(StepData_Protocol) & Protocol();
+
//! Returns the recorded HeaderProtocol, which can be :
//! - a Null Handle if no Header Protocol was yet defined
//! - a simple Protocol if only one was defined
//! - a FileProtocol if more than one Protocol was yet defined
- Standard_EXPORT static Handle(StepData_Protocol) HeaderProtocol();
-
- //! Adds a new Header Protocol to the Header Definition
- Standard_EXPORT static void AddHeaderProtocol (const Handle(StepData_Protocol)& headerproto);
-
- //! Prepares General Data required to work with this package,
- //! which are the Protocol and Modules to be loaded into Libraries
- Standard_EXPORT static void Init();
-
- //! Returns a Protocol from StepData (avoids to create it)
- Standard_EXPORT static Handle(StepData_Protocol) Protocol();
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-friend class StepData_StepModel;
-friend class StepData_UndefinedEntity;
-friend class StepData_SelectType;
-friend class StepData_Field;
-friend class StepData_SelectMember;
-friend class StepData_SelectInt;
-friend class StepData_SelectReal;
-friend class StepData_SelectNamed;
-friend class StepData_SelectArrReal;
-friend class StepData_PDescr;
-friend class StepData_FieldList;
-friend class StepData_FieldList1;
-friend class StepData_FieldListN;
-friend class StepData_FieldListD;
-friend class StepData_EDescr;
-friend class StepData_ESDescr;
-friend class StepData_ECDescr;
-friend class StepData_Described;
-friend class StepData_Simple;
-friend class StepData_Plex;
-friend class StepData_FreeFormEntity;
-friend class StepData_Protocol;
-friend class StepData_GeneralModule;
-friend class StepData_FileRecognizer;
-friend class StepData_FileProtocol;
-friend class StepData_HeaderTool;
-friend class StepData_EnumTool;
-friend class StepData_DescrProtocol;
-friend class StepData_DescrGeneral;
-friend class StepData_DescrReadWrite;
-friend class StepData_StepReaderData;
-friend class StepData_StepReaderTool;
-friend class StepData_ReadWriteModule;
-friend class StepData_StepWriter;
-friend class StepData_StepDumper;
-friend class StepData_WriterLib;
-friend class StepData_DefaultGeneral;
-friend class StepData_GlobalNodeOfWriterLib;
-friend class StepData_NodeOfWriterLib;
-
+ Standard_EXPORT static const Handle(StepData_Protocol) & HeaderProtocol();
};
-
-
-
-
-
-
#endif // _StepData_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_GeneralLib.hxx>
-#include <Interface_ReaderLib.hxx>
-#include <Standard_Type.hxx>
-#include <StepData_DescrGeneral.hxx>
-#include <StepData_DescrProtocol.hxx>
-#include <StepData_DescrReadWrite.hxx>
-#include <StepData_WriterLib.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(StepData_DescrProtocol,StepData_FileProtocol)
-
-StepData_DescrProtocol::StepData_DescrProtocol () { }
-
- void StepData_DescrProtocol::SetSchemaName (const Standard_CString name)
- { thename.Clear(); thename.AssignCat (name); }
-
- void StepData_DescrProtocol::LibRecord () const
-{
- if (!HasDescr()) return; // rien a recorder dans la lib ?
- Handle(StepData_DescrGeneral) gen = new StepData_DescrGeneral (this);
- Handle(StepData_DescrReadWrite) rwm = new StepData_DescrReadWrite (this);
- Interface_GeneralLib::SetGlobal (gen,this);
- Interface_ReaderLib::SetGlobal (rwm,this);
- StepData_WriterLib::SetGlobal (rwm,this);
-}
-
- Standard_CString StepData_DescrProtocol::SchemaName () const
- { return thename.ToCString(); }
+++ /dev/null
-// Created on: 1997-05-21
-// 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 _StepData_DescrProtocol_HeaderFile
-#define _StepData_DescrProtocol_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <StepData_FileProtocol.hxx>
-#include <Standard_CString.hxx>
-
-
-class StepData_DescrProtocol;
-DEFINE_STANDARD_HANDLE(StepData_DescrProtocol, StepData_FileProtocol)
-
-//! A DescrProtocol is a protocol dynamically (at execution time)
-//! defined with :
-//! - a list of resources (inherits FileProtocol)
-//! - a list of entity descriptions
-//! i.e. it can be defined with only C++ writing to initialize it
-//! Its initialization must :
-//! - set its schema name
-//! - define its resources (which can also be other DescrProtocol)
-//! - define its entity descriptions
-//! - record it in the system by calling RecordLib
-class StepData_DescrProtocol : public StepData_FileProtocol
-{
-
-public:
-
-
- Standard_EXPORT StepData_DescrProtocol();
-
- //! Defines a specific Schema Name for this Protocol
- Standard_EXPORT void SetSchemaName (const Standard_CString name);
-
- //! Records this Protocol in the service libraries, with a
- //! DescrGeneral and a DescrReadWrite
- //! Does nothing if the Protocol brings no proper description
- Standard_EXPORT void LibRecord() const;
-
- //! Returns the Schema Name attached to each class of Protocol
- //! here, returns the SchemaName set by SetSchemaName
- //! was C++ : return const
- Standard_EXPORT virtual Standard_CString SchemaName() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(StepData_DescrProtocol,StepData_FileProtocol)
-
-protected:
-
-
-
-
-private:
-
-
- TCollection_AsciiString thename;
-
-
-};
-
-
-
-
-
-
-
-#endif // _StepData_DescrProtocol_HeaderFile
+++ /dev/null
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-
-#include <Interface_Check.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_Protocol.hxx>
-#include <Standard_Type.hxx>
-#include <StepData_FileProtocol.hxx>
-#include <StepData_Protocol.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(StepData_FileProtocol,StepData_Protocol)
-
-//static TCollection_AsciiString thename("");
-static Standard_CString thename = "";
-
-// Protocol fabrique a la demande avec d autres Protocoles
-
-
- StepData_FileProtocol::StepData_FileProtocol () { }
-
- void StepData_FileProtocol::Add (const Handle(StepData_Protocol)& protocol)
-{
- if (protocol.IsNull()) return;
- Handle(Standard_Type) ptype = protocol->DynamicType();
- Standard_Integer nb = thecomps.Length();
- for (Standard_Integer i = 1; i <= nb; i ++) {
- if (thecomps.Value(i)->IsInstance(ptype)) return;
- }
- thecomps.Append(protocol);
-}
-
-
- Standard_Integer StepData_FileProtocol::NbResources () const
- { return thecomps.Length(); }
-
- Handle(Interface_Protocol) StepData_FileProtocol::Resource
- (const Standard_Integer num) const
- { return Handle(Interface_Protocol)::DownCast(thecomps.Value(num)); }
-
-
- Standard_Integer StepData_FileProtocol::TypeNumber
- (const Handle(Standard_Type)& /*atype*/) const
- { return 0; }
-
-
-Standard_Boolean StepData_FileProtocol::GlobalCheck(const Interface_Graph& G,
- Handle(Interface_Check)& ach) const
-{
- Standard_Boolean res = Standard_False;
- Standard_Integer i,nb = NbResources();
- for (i = 1; i <= nb; i ++) res |= Resource(i)->GlobalCheck (G,ach);
- return res;
-}
-
-
- Standard_CString StepData_FileProtocol::SchemaName () const
- { return thename; }
+++ /dev/null
-// Created on: 1993-07-23
-// 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 _StepData_FileProtocol_HeaderFile
-#define _StepData_FileProtocol_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TColStd_SequenceOfTransient.hxx>
-#include <StepData_Protocol.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Type.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_CString.hxx>
-class StepData_Protocol;
-class Interface_Protocol;
-class Interface_Graph;
-class Interface_Check;
-
-
-class StepData_FileProtocol;
-DEFINE_STANDARD_HANDLE(StepData_FileProtocol, StepData_Protocol)
-
-//! A FileProtocol is defined as the addition of several already
-//! existing Protocols. It corresponds to the definition of a
-//! SchemaName with several Names, each one being attached to a
-//! specific Protocol. Thus, a File defined with a compound Schema
-//! is processed as any other one, once built the equivalent
-//! compound Protocol, a FileProtocol
-class StepData_FileProtocol : public StepData_Protocol
-{
-
-public:
-
-
- //! Creates an empty FileProtocol
- Standard_EXPORT StepData_FileProtocol();
-
- //! Adds a Protocol to the definition list of the FileProtocol
- //! But ensures that each class of Protocol is present only once
- //! in this list
- Standard_EXPORT void Add (const Handle(StepData_Protocol)& protocol);
-
- //! Gives the count of Protocols used as Resource (can be zero)
- //! i.e. the count of Protocol recorded by calling the method Add
- Standard_EXPORT virtual Standard_Integer NbResources() const Standard_OVERRIDE;
-
- //! Returns a Resource, given a rank. Here, rank of calling Add
- Standard_EXPORT virtual Handle(Interface_Protocol) Resource (const Standard_Integer num) const Standard_OVERRIDE;
-
- //! Returns a Case Number, specific of each recognized Type
- //! Here, NO Type at all is recognized properly : all Types are
- //! recognized by the resources
- Standard_EXPORT virtual Standard_Integer TypeNumber (const Handle(Standard_Type)& atype) const Standard_OVERRIDE;
-
- //! Calls GlobalCheck for each of its recorded ressources
- Standard_EXPORT virtual Standard_Boolean GlobalCheck (const Interface_Graph& G, Handle(Interface_Check)& ach) const Standard_OVERRIDE;
-
- //! Returns the Schema Name attached to each class of Protocol
- //! To be redefined by each sub-class
- //! Here, SchemaName returns "" (empty String)
- //! was C++ : return const
- Standard_EXPORT virtual Standard_CString SchemaName() const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(StepData_FileProtocol,StepData_Protocol)
-
-protected:
-
-
-
-
-private:
-
-
- TColStd_SequenceOfTransient thecomps;
-
-
-};
-
-
-
-
-
-
-
-#endif // _StepData_FileProtocol_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_Protocol.hxx>
-#include <Interface_ReaderLib.hxx>
-#include <StepData_FileProtocol.hxx>
-#include <StepData_HeaderTool.hxx>
-#include <StepData_Protocol.hxx>
-#include <StepData_StepReaderData.hxx>
-#include <TCollection_AsciiString.hxx>
-
-// HeaderTool prend en charge le Schema de Donnees utilise pour un Fichier
-// Ce Schema peut etre compose de un ou plusieurs Protocoles, chacun etant
-// designe par une String. Les Strings correspondent au type "SCHEMA_NAME"
-// (typedef) et le Schema est une entite de Header de type "FILE_SCHEMA",
-// il a cette forme dans le fichier :
-static Interface_ReaderLib lib;
-
-
- StepData_HeaderTool::StepData_HeaderTool
- (const Handle(StepData_StepReaderData)& data)
-{
- lib.SetComplete();
- thedone = Standard_False;
- Standard_Integer num = 0;
- while ( (num = data->FindNextRecord(num)) != 0) {
- const TCollection_AsciiString& headertype = data->RecordType(num);
- if (headertype == "FILE_SCHEMA") {
- Standard_Integer numsub = data->SubListNumber(num,1,Standard_True);
- Standard_Integer nb = data->NbParams(numsub);
- for (Standard_Integer i = 1; i <= nb; i ++) {
- TCollection_AsciiString unom = data->ParamCValue(numsub,i);
- unom.Remove(unom.Length());
- unom.Remove(1); // quotes debut et fin
- thenames.Append(unom);
- }
- }
- }
-}
-
-
- StepData_HeaderTool::StepData_HeaderTool
- (const TColStd_SequenceOfAsciiString& names)
-{
- lib.SetComplete();
- thedone = Standard_False;
- Standard_Integer nb = names.Length();
- for (Standard_Integer i = 1; i <= nb; i ++) thenames.Append(names.Value(i));
-}
-
- Standard_Integer StepData_HeaderTool::NbSchemaNames () const
- { return thenames.Length(); }
-
- const TCollection_AsciiString& StepData_HeaderTool::SchemaName
- (const Standard_Integer num) const
- { return thenames.Value(num); }
-
- Handle(StepData_Protocol) StepData_HeaderTool::NamedProtocol
- (const TCollection_AsciiString& name) const
-{
- Handle(StepData_Protocol) proto;
- for (lib.Start(); lib.More(); lib.Next()) {
- proto = Handle(StepData_Protocol)::DownCast(lib.Protocol());
- if ( name.IsEqual(proto->SchemaName()) ) return proto;
- }
- return proto;
-}
-
-
- void StepData_HeaderTool::Build
- (const Handle(StepData_FileProtocol)& proto)
-{
- thedone = Standard_True;
- theignored.Clear();
- Standard_Integer nb = thenames.Length();
- for (Standard_Integer i = 1; i <= nb; i ++) {
- Handle(StepData_Protocol) unproto = NamedProtocol(thenames.Value(i));
- if (unproto.IsNull()) theignored.Append(thenames.Value(i));
- else proto->Add(unproto);
- }
-}
-
- Handle(StepData_Protocol) StepData_HeaderTool::Protocol ()
-{
- thedone = Standard_True;
- theignored.Clear();
- Handle(StepData_Protocol) unproto;
- if (thenames.IsEmpty()) return unproto;
- if (thenames.Length() == 1) {
- unproto = NamedProtocol (thenames.Value(1));
- if (unproto.IsNull()) theignored.Append (thenames.Value(1));
- return unproto;
- }
- Handle(StepData_FileProtocol) proto = new StepData_FileProtocol;
- Build(proto);
- return proto;
-}
-
-
- Standard_Boolean StepData_HeaderTool::IsDone () const
- { return thedone; }
-
-
- Standard_Integer StepData_HeaderTool::NbIgnoreds () const
- { return theignored.Length(); }
-
- const TCollection_AsciiString& StepData_HeaderTool::Ignored
- (const Standard_Integer num) const
- { return theignored.Value(num); }
-
-
- void StepData_HeaderTool::Print (Standard_OStream& S) const
-{
- Standard_Integer nb = thenames.Length();
- Standard_Integer lng = 0; Standard_Integer ln1;
- S << " --- StepData_HeaderTool : List of Protocol Names --- Count : "
- << nb << endl;
- Standard_Integer i; // svv Jan11 2000 : porting on DEC
- for (i = 1; i <= nb; i ++) {
- ln1 = thenames.Value(i).Length() + 8; lng += ln1;
- if (lng > 80) { S << endl; lng = ln1; }
- S << " " << i << " : " << thenames.Value(i);
- }
- if (lng == 0) S << endl;
-
- nb = theignored.Length();
- if (!thedone) {
- S << " --- Evaluation of Protocol not Done ---" << endl;
- } else if (nb == 0) {
- S << " --- All Names correspond to a known Protocol ---" << endl;
- } else {
- lng = ln1 = 0;
- S << " --- Among them, " << nb << " remain unrecognized ---" << endl;
- for (i = 1; i <= nb; i ++) {
- ln1 = theignored.Value(i).Length() + 3; lng += ln1;
- if (lng > 80) { S << endl; lng = ln1; }
- S << " : " << theignored.Value(i);
- }
- if (lng == 0) S << endl;
- }
-}
+++ /dev/null
-// Created on: 1993-07-23
-// 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 _StepData_HeaderTool_HeaderFile
-#define _StepData_HeaderTool_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <TColStd_SequenceOfAsciiString.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_OStream.hxx>
-class StepData_StepReaderData;
-class TCollection_AsciiString;
-class StepData_Protocol;
-class StepData_FileProtocol;
-
-
-//! HeaderTool exploits data from Header to build a Protocol :
-//! it uses the Header Entity FileSchema to do this.
-//! It builds a Protocol from the Global List of Protocols
-//! stored in the Library ReaderLib
-class StepData_HeaderTool
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- //! Creates a HeaderTool from data read from a File. Computes the
- //! list of Schema Names. The Protocol will be computed later
- //! (because there are several options)
- Standard_EXPORT StepData_HeaderTool(const Handle(StepData_StepReaderData)& data);
-
- //! Creates a HeaderTool directly from a list of Schema Names
- Standard_EXPORT StepData_HeaderTool(const TColStd_SequenceOfAsciiString& names);
-
- //! Returns the count of SchemaNames
- Standard_EXPORT Standard_Integer NbSchemaNames() const;
-
- //! Returns a SchemaName, given its rank
- Standard_EXPORT const TCollection_AsciiString& SchemaName (const Standard_Integer num) const;
-
- //! Returns the Protocol which corresponds to a Schema Name
- //! Returns a Null Handle if this Schema Name is attached to no
- //! Protocol recorded in the Global List of ReaderLib
- Standard_EXPORT Handle(StepData_Protocol) NamedProtocol (const TCollection_AsciiString& name) const;
-
- //! Fills a FileProtocol with the list of Protocols attached to
- //! the list of Schema Names. It can remain empty ...
- Standard_EXPORT void Build (const Handle(StepData_FileProtocol)& protocol);
-
- //! Returns a Protocol computed from the list of Schema Names :
- //! - a Null Handle if no SchemaName has been recognized (or list
- //! empty)
- //! - a single Protocol if only one SchemaName has been recognized
- //! - a FileProtocol with its componants if several SchemaNames
- //! have been recognized
- Standard_EXPORT Handle(StepData_Protocol) Protocol();
-
- //! Returns True if either Build or Protocol has been called
- //! If it is False, Ignored and NbIgnored should not be called
- Standard_EXPORT Standard_Boolean IsDone() const;
-
- //! Returns the count of ignored SchemaNames (0 if all were OK)
- Standard_EXPORT Standard_Integer NbIgnoreds() const;
-
- //! Returns an ignored SchemaName, given its rank in the list of
- //! Ignored SchemaNames (not in the total list)
- Standard_EXPORT const TCollection_AsciiString& Ignored (const Standard_Integer num) const;
-
- //! Sends the state of the HeaderTool in a comprehensive way,
- //! to an output stream
- Standard_EXPORT void Print (Standard_OStream& S) const;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
- TColStd_SequenceOfAsciiString thenames;
- Standard_Boolean thedone;
- TColStd_SequenceOfAsciiString theignored;
-
-
-};
-
-
-
-
-
-
-
-#endif // _StepData_HeaderTool_HeaderFile
void StepData_StepModel::VerifyCheck(Handle(Interface_Check)& ach) const
{
Interface_GeneralLib lib(StepData::HeaderProtocol());
- Handle(StepData_StepModel) me (this);
- Handle(Interface_Protocol) aHP = StepData::HeaderProtocol();
- Interface_ShareTool sh(me,aHP);
+ Handle(Interface_InterfaceModel) me (this);
+ Interface_ShareTool sh(me);
Handle(Interface_GeneralModule) module; Standard_Integer CN;
for (Interface_EntityIterator iter = Header(); iter.More(); iter.Next()) {
Handle(Standard_Transient) head = iter.Value();
{
// NB : level n est pas utilise
- Handle(StepData_Protocol) stepro = StepData::HeaderProtocol();
+ const Handle(StepData_Protocol) &stepro = StepData::HeaderProtocol();
Standard_Boolean iapro = !stepro.IsNull();
if (!iapro) S<<" -- WARNING : StepModel DumpHeader, Protocol not defined\n";
-StepSelect_Activator.cxx
-StepSelect_Activator.hxx
-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
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of 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_SessionPilot.hxx>
-#include <IFSelect_WorkSession.hxx>
-#include <Interface_Macros.hxx>
-#include <Standard_ErrorHandler.hxx>
-#include <Standard_Failure.hxx>
-#include <Standard_Type.hxx>
-#include <StepData_Plex.hxx>
-#include <StepData_Simple.hxx>
-#include <StepData_UndefinedEntity.hxx>
-#include <StepSelect_Activator.hxx>
-#include <StepSelect_FloatFormat.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(StepSelect_Activator,IFSelect_Activator)
-
-static int initActivator = 0;
-
-
-StepSelect_Activator::StepSelect_Activator ()
-{
- if (initActivator) return; initActivator = 1;
-// Add ( 0,"load");
-// Add ( 0,"loadstep"); // homonyme
-// Add ( 1,"entity");
-// Add ( 2,"liststep");
-
-// AddSet (10,"steptype");
-
- Add ( 1,"stepschema");
- AddSet (40,"floatformat");
-}
-
-
-IFSelect_ReturnStatus StepSelect_Activator::Do
- (const Standard_Integer number,
- const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Word(1).ToCString();
- const Standard_CString arg2 = pilot->Word(2).ToCString();
-// const Standard_CString arg3 = pilot->Word(3).ToCString();
-
- switch (number) {
-
- case 1 : { // **** StepSchema
- if (argc < 2) {
- cout<<"Identify an entity"<<endl;
- return IFSelect_RetError;
- }
- Standard_Integer num = pilot->Number(arg1);
- if (num <= 0) {
- cout<<"Not an entity : "<<arg2<<endl;
- return IFSelect_RetError;
- }
- Handle(Standard_Transient) ent = pilot->Session()->StartingEntity(num);
- DeclareAndCast(StepData_UndefinedEntity,und,ent);
- if (!und.IsNull()) {
- cout<<"Entity "<<arg2<<" : No Binding known"<<endl;
- return IFSelect_RetVoid;
- }
- DeclareAndCast(StepData_Simple,sim,ent);
- if (!sim.IsNull()) {
- cout<<"Entity "<<arg2<<" : Late Binding"<<endl;
- cout<<"Simple Type : "<<sim->StepType()<<endl;
- return IFSelect_RetVoid;
- }
- DeclareAndCast(StepData_Plex,plx,ent);
- if (!plx.IsNull()) {
- cout<<"Entity "<<arg2<<" : Late Binding"<<endl;
- cout<<"Complex Type"<<endl;
- }
-// reste Early Binding
- cout<<"Entity "<<arg2<<" : Early Binding"<<endl;
- cout<<"CDL Type : "<<ent->DynamicType()->Name()<<endl;
- return IFSelect_RetVoid;
- }
-
- case 40 : { // **** FloatFormat
- char prem = ' ';
- if (argc < 2) prem = '?';
- else if (argc == 5) { cout<<"floatformat tout court donne les formes admises"<<endl; return IFSelect_RetError; }
- else prem = arg1[0];
- Standard_Boolean zerosup=Standard_False;
- Standard_Integer digits = 0;
- if (prem == 'N' || prem == 'n') zerosup = Standard_False;
- else if (prem == 'Z' || prem == 'z') zerosup = Standard_True;
- else if (prem >= 48 && prem <= 57) digits = atoi(arg1);
- else {
- cout<<"floatformat digits, digits=nb de chiffres signifiants, ou\n"
- << "floatformat NZ %mainformat [%rangeformat [Rmin Rmax]]\n"
- <<" NZ : N ou n pour Non-zero-suppress, Z ou z pour zero-suppress\n"
- <<" %mainformat : format principal type printf, ex,: %E\n"
- <<" + optionnel : format secondaire (flottants autour de 1.) :\n"
- <<" %rangeformat Rmin Rmax : format type printf entre Rmin et Rmax\n"
- <<" %rangeformat tout seul : format type printf entre 0.1 et 1000.\n"
- <<flush;
- return (prem == '?' ? IFSelect_RetVoid : IFSelect_RetError);
- }
- Standard_Real Rmin=0., Rmax=0.;
- if (argc > 4) {
- Rmin = Atof(pilot->Word(4).ToCString());
- Rmax = Atof(pilot->Word(5).ToCString());
- if (Rmin <= 0 || Rmax <= 0) { cout<<"intervalle : donner reels > 0"<<endl; return IFSelect_RetError; }
- }
- Handle(StepSelect_FloatFormat) fm = new StepSelect_FloatFormat;
- if (argc == 2) fm->SetDefault(digits);
- else {
- fm->SetZeroSuppress(zerosup);
- fm->SetFormat (arg2);
- if (argc == 4) fm->SetFormatForRange(pilot->Word(3).ToCString());
- else if (argc >= 6) fm->SetFormatForRange(pilot->Word(3).ToCString(),Rmin,Rmax);
- else fm->SetFormatForRange("");
- }
- return pilot->RecordItem(fm);
- }
-
- default : break;
- }
- return IFSelect_RetVoid;
-
-}
-
-
-Standard_CString StepSelect_Activator::Help
- (const Standard_Integer number) const
-{
- switch (number) {
-
- case 40 : return "options... : cree FloatFormat ... floatformat tout court->help";
- default : break;
- }
- return "";
-}
+++ /dev/null
-// Created on: 1995-04-20
-// 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 _StepSelect_Activator_HeaderFile
-#define _StepSelect_Activator_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <IFSelect_Activator.hxx>
-#include <IFSelect_ReturnStatus.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_CString.hxx>
-class IFSelect_SessionPilot;
-
-
-class StepSelect_Activator;
-DEFINE_STANDARD_HANDLE(StepSelect_Activator, IFSelect_Activator)
-
-//! Performs Actions specific to StepSelect, i.e. creation of
-//! Step Selections and Counters, plus dumping specific to Step
-class StepSelect_Activator : public IFSelect_Activator
-{
-
-public:
-
-
- Standard_EXPORT StepSelect_Activator();
-
- //! Executes a Command Line for StepSelect
- Standard_EXPORT IFSelect_ReturnStatus Do (const Standard_Integer number, const Handle(IFSelect_SessionPilot)& pilot) Standard_OVERRIDE;
-
- //! Sends a short help message for StepSelect commands
- Standard_EXPORT Standard_CString Help (const Standard_Integer number) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(StepSelect_Activator,IFSelect_Activator)
-
-protected:
-
-
-
-
-private:
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _StepSelect_Activator_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_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 <Interface_FloatWriter.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 <Standard_Boolean.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <Standard_Real.hxx>
-#include <StepSelect_FileModifier.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_CString.hxx>
-class TCollection_AsciiString;
-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
- //! independant
- Standard_EXPORT void SetFormat (const Standard_CString format = "%E");
-
- //! Sets Format for Range to a new value with its range of
- //! application.
- //! To cancel it, give format as "" (empty string)
- //! Remark that if the condition (0. < Rmin < Rmax) is not
- //! verified, this secondary format will be ignored.
- //! Moreover, this secondary format is intended to be used in a
- //! range around 1.
- Standard_EXPORT void SetFormatForRange (const Standard_CString format = "%f", const Standard_Real Rmin = 0.1, const Standard_Real Rmax = 1000.0);
-
- //! Returns all recorded parameters :
- //! zerosup : ZeroSuppress status
- //! mainform : Main Format (which applies out of the range, or
- //! for every real if no range is set)
- //! hasrange : True if a FormatInRange is set, False else
- //! (following parameters do not apply if it is False)
- //! forminrange : Secondary Format (it applies inside the range)
- //! rangemin, rangemax : the range in which the secondary format
- //! applies
- Standard_EXPORT void Format (Standard_Boolean& zerosup, TCollection_AsciiString& mainform, Standard_Boolean& hasrange, TCollection_AsciiString& forminrange, Standard_Real& rangemin, Standard_Real& rangemax) const;
-
- //! Sets the Floatting Formats of StepWriter to the recorded
- //! parameters
- Standard_EXPORT void Perform (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 <IFSelect_ContextWrite.hxx>
-#include <IFSelect_GeneralModifier.hxx>
-#include <Interface_Check.hxx>
-#include <Interface_CheckIterator.hxx>
-#include <Interface_CopyTool.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Interface_ParamType.hxx>
-#include <Interface_Protocol.hxx>
-#include <Interface_ReportEntity.hxx>
-#include <Interface_UndefinedContent.hxx>
-#include <Message.hxx>
-#include <Message_Messenger.hxx>
-#include <OSD_OpenFile.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <StepData_Protocol.hxx>
-#include <StepData_StepDumper.hxx>
-#include <StepData_StepModel.hxx>
-#include <StepData_StepWriter.hxx>
-#include <StepData_UndefinedEntity.hxx>
-#include <StepFile_Read.hxx>
-#include <StepSelect_FileModifier.hxx>
-#include <StepSelect_WorkLibrary.hxx>
-#include <TCollection_HAsciiString.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-
-#include <errno.h>
-#include <sys/stat.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
-{
- long status = 1;
- DeclareAndCast(StepData_Protocol,stepro,protocol);
- if (stepro.IsNull()) return 1;
- Handle(StepData_StepModel) stepmodel = new StepData_StepModel;
- model = stepmodel;
- StepFile_ReadTrace (0);
- char *pName=(char *)name;
- status = StepFile_Read (pName,stepmodel,stepro);
- return status;
-}
-
-
-Standard_Boolean StepSelect_WorkLibrary::WriteFile
- (IFSelect_ContextWrite& ctx) const
-{
-// Preparation
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- DeclareAndCast(StepData_StepModel,stepmodel,ctx.Model());
- DeclareAndCast(StepData_Protocol,stepro,ctx.Protocol());
- if (stepmodel.IsNull() || stepro.IsNull()) return Standard_False;
-
- ofstream fout;
- OSD_OpenStream(fout,ctx.FileName(),ios::out|ios::trunc);
-
- if (!fout || !fout.rdbuf()->is_open()) {
- ctx.CCheck(0)->AddFail("Step File could not be created");
- sout<<" Step File could not be created : " << ctx.FileName() << endl; return 0;
- }
- sout << " Step File Name : "<<ctx.FileName();
- StepData_StepWriter SW(stepmodel);
- sout<<"("<<stepmodel->NbEntities()<<" ents) ";
-
-// File Modifiers
- Standard_Integer nbmod = ctx.NbModifiers();
- for (Standard_Integer numod = 1; numod <= nbmod; numod ++) {
- ctx.SetModifier (numod);
- DeclareAndCast(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 << 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(fout);
- sout<<" Done"<<endl;
-
- errno = 0;
- fout.close();
- isGood = fout.good() && isGood && !errno;
- if(errno)
- sout << strerror(errno) << 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,
- const Handle(Message_Messenger)& S, const Standard_Integer level) const
-{
- Standard_Integer nument = model->Number(entity);
- if (nument <= 0 || nument > model->NbEntities()) return;
- Standard_Boolean iserr = model->IsRedefinedContent(nument);
- Handle(Standard_Transient) ent, con; ent = entity;
- S<<" --- (STEP) Entity "; model->Print(entity,S);
- if (iserr) con = model->ReportEntity(nument)->Content();
- if (entity.IsNull()) { S<<" Null"<<endl; return; }
-
-// On attaque le dump : d abord cas de l Erreur
- S << " Type cdl : " << entity->DynamicType()->Name() << endl;
- if (iserr)
- S<<" *** NOT WELL LOADED : CONTENT FROM FILE ***"<<endl;
- else if (model->IsUnknownEntity(nument))
- S<<" *** UNKNOWN TYPE ***"<<endl;
-
- StepData_StepDumper dump(GetCasted(StepData_StepModel,model),
- GetCasted(StepData_Protocol,protocol),thelabmode);
- dump.Dump(S,ent,level);
-}
+++ /dev/null
-// Created on: 1994-09-14
-// Created by: Christian CAILLET
-// Copyright (c) 1994-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _StepSelect_WorkLibrary_HeaderFile
-#define _StepSelect_WorkLibrary_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-#include <IFSelect_WorkLibrary.hxx>
-#include <Standard_CString.hxx>
-class Interface_InterfaceModel;
-class Interface_Protocol;
-class IFSelect_ContextWrite;
-class Interface_EntityIterator;
-class Interface_CopyTool;
-class Standard_Transient;
-class Message_Messenger;
-
-
-class 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;
-
- //! Writes a File from a STEP Model
- //! Returns False (and writes no file) if <ctx> does not bring a
- //! STEP Model
- Standard_EXPORT Standard_Boolean WriteFile (IFSelect_ContextWrite& ctx) const Standard_OVERRIDE;
-
- //! Performs the copy of entities from an original model to a new
- //! one. Works according <copymode> :
- //! if True, standard copy is run
- //! else nothing is done and returned value is False
- Standard_EXPORT virtual Standard_Boolean CopyModel (const Handle(Interface_InterfaceModel)& original, const Handle(Interface_InterfaceModel)& newmodel, const Interface_EntityIterator& list, Interface_CopyTool& TC) const Standard_OVERRIDE;
-
- //! Dumps an entity under STEP form, i.e. as a part of a Step file
- //! Works with a StepDumper.
- //! Level 0 just displays type; level 1 displays the entity itself
- //! and level 2 displays the entity plus its shared ones (one
- //! sub-level : immediately shared entities)
- Standard_EXPORT void DumpEntity (const Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol, const Handle(Standard_Transient)& entity, const Handle(Message_Messenger)& S, const Standard_Integer level) const Standard_OVERRIDE;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(StepSelect_WorkLibrary,IFSelect_WorkLibrary)
-
-protected:
-
-
-
-
-private:
-
-
- Standard_Boolean thecopymode;
- Standard_Integer thelabmode;
-
-
-};
-
-
-
-
-
-
-
-#endif // _StepSelect_WorkLibrary_HeaderFile
IGESDefs
IGESAppli
IGESConvGeom
-IGESSelect
IGESToBRep
GeomToIGES
Geom2dToIGES
StepAP203
RWStepAP203
STEPConstruct
-STEPEdit
GeomToStep
StepToGeom
StepToTopoDS
TopoDSToStep
STEPControl
-STEPSelections
StepAP209
RWStepAP242
StepAP242
HeaderSection
RWHeaderSection
APIHeaderSection
-StepSelect
UnitsMethods
XSAlgo
LibCtl
+IGESSelect
+StepSelect
+STEPEdit
+STEPSelections
XSDRAW
XSDRAWIGES
XSDRAWSTEP
-Transfer_Actor.hxx
Transfer_ActorOfFinderProcess.hxx
Transfer_ActorOfTransientProcess.hxx
Transfer_Binder.cxx
Transfer_Binder.hxx
-Transfer_DataInfo.hxx
Transfer_Finder.cxx
Transfer_Finder.hxx
Transfer_FinderProcess.cxx
Transfer_Hasher.cxx
Transfer_Hasher.hxx
Transfer_HSequenceOfBinder.hxx
-Transfer_HSequenceOfFinder.hxx
-Transfer_IteratorOfProcessForFinder.hxx
-Transfer_IteratorOfProcessForTransient.hxx
Transfer_MapContainer.cxx
Transfer_MapContainer.hxx
-Transfer_ProcessForFinder.hxx
-Transfer_ProcessForTransient.hxx
+Transfer_Process.cxx
+Transfer_Process.hxx
Transfer_ResultFromModel.cxx
Transfer_ResultFromModel.hxx
Transfer_ResultFromTransient.cxx
Transfer_StatusResult.hxx
Transfer_TransferDeadLoop.hxx
Transfer_TransferFailure.hxx
-Transfer_Iterator.cxx
-Transfer_Iterator.hxx
-Transfer_TransferMapOfProcessForFinder.hxx
-Transfer_TransferMapOfProcessForTransient.hxx
-Transfer_ProcessGen.hxx
Transfer_TransientListBinder.cxx
Transfer_TransientListBinder.hxx
Transfer_TransientProcess.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.
-
-#ifndef _Transfer_Actor_HeaderFile
-#define _Transfer_Actor_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-#include <MMgt_TShared.hxx>
-
-class Transfer_Actor : public MMgt_TShared
-{
- public:
-
- Transfer_Actor() : themodetrans(0) {}
-
- //! Set a specific transfer mode
- void SetTransferMode (const Standard_Integer theMode) { themodetrans = theMode; }
-
- DEFINE_STANDARD_RTTI_INLINE(Transfer_Actor,MMgt_TShared)
-
- protected:
-
- Standard_Integer themodetrans;
-};
-
-#endif // _Transfer_Actor_HeaderFile
#ifndef _Transfer_ActorOfFinderProcess_HeaderFile
#define _Transfer_ActorOfFinderProcess_HeaderFile
-#include <Transfer_ProcessForFinder.hxx>
+#include <Transfer_Process.hxx>
-#define Transfer_ActorOfFinderProcess Transfer_ProcessForFinder::Actor
+#define Transfer_ActorOfFinderProcess Transfer_Process::Actor
#endif // _Transfer_ActorOfFinderProcess_HeaderFile
#ifndef _Transfer_ActorOfTransientProcess_HeaderFile
#define _Transfer_ActorOfTransientProcess_HeaderFile
-#include <Transfer_ProcessForTransient.hxx>
+#include <Transfer_Process.hxx>
-#define Transfer_ActorOfTransientProcess Transfer_ProcessForTransient::Actor
+#define Transfer_ActorOfTransientProcess Transfer_Process::Actor
#endif // _Transfer_ActorOfTransientProcess_HeaderFile
+++ /dev/null
-// Created on: 1996-09-04
-// 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 _Transfer_DataInfo_HeaderFile
-#define _Transfer_DataInfo_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Handle.hxx>
-#include <Standard_Type.hxx>
-
-//! Gives informations on an object
-//! Used as template to instantiate Mapper and SimpleBinder
-//! This class is for Transient
-class Transfer_DataInfo
-{
- public:
-
- //! Returns Type Name (string)
- //! Allows to name type of non-handled objects
- static Standard_CString TypeName (const Handle(Standard_Transient)& ent) { return ent->DynamicType()->Name(); }
-};
-
-#endif // _Transfer_DataInfo_HeaderFile
#include <Transfer_FinderProcess.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(Transfer_FinderProcess,Transfer_ProcessForFinder)
+IMPLEMENT_STANDARD_RTTIEXT(Transfer_FinderProcess,Transfer_Process)
#ifndef _Transfer_FinderProcess_HeaderFile
#define _Transfer_FinderProcess_HeaderFile
-#include <Transfer_ProcessForFinder.hxx>
+#include <Transfer_Process.hxx>
-class Transfer_FinderProcess : public Transfer_ProcessForFinder
+class Transfer_FinderProcess : public Transfer_Process
{
public:
//! Sets FinderProcess at initial state, with an initial size
Transfer_FinderProcess(const Standard_Integer nb = 10000)
- : Transfer_ProcessForFinder (nb)
+ : Transfer_Process (nb)
{}
- DEFINE_STANDARD_RTTIEXT(Transfer_FinderProcess,Transfer_ProcessForFinder)
+ DEFINE_STANDARD_RTTIEXT(Transfer_FinderProcess,Transfer_Process)
};
#endif // _Transfer_FinderProcess_HeaderFile
+++ /dev/null
-// Created on: 1992-02-03
-// 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 Transfer_HSequenceOfFinder_HeaderFile
-#define Transfer_HSequenceOfFinder_HeaderFile
-
-#include <Transfer_Finder.hxx>
-#include <Transfer_SequenceOfFinder.hxx>
-#include <NCollection_DefineHSequence.hxx>
-
-DEFINE_HSEQUENCE(Transfer_HSequenceOfFinder, Transfer_SequenceOfFinder)
-
-
-#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 <Standard_NoSuchObject.hxx>
-#include <Transfer_Binder.hxx>
-#include <Transfer_Iterator.hxx>
-#include <Transfer_HSequenceOfBinder.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-
-Transfer_Iterator::Transfer_Iterator ()
-{
- theitems = new Transfer_HSequenceOfBinder;
- theselect = new TColStd_HSequenceOfInteger;
- thecurr = 1;
-}
-
-void Transfer_Iterator::AddItem (const Handle(Transfer_Binder)& atr)
-{
- theitems->Append(atr);
- theselect->Append(1);
-}
-
-void Transfer_Iterator::SelectItem (const Standard_Integer num, const Standard_Boolean keep)
-{
- if (num < 1 || num > theselect->Length()) return;
- theselect->SetValue (num,(keep? 1 : 0));
-}
-
-// .... Iteration-Interrogations ....
-
-Standard_Integer Transfer_Iterator::Number () const
-{
- Standard_Integer i, n = theselect->Length(), numb = 0;
- for (i = 1; i <= n; i ++) {
- if (theselect->Value(i) != 0) numb++;
- }
- return numb;
-}
-
-Standard_Boolean Transfer_Iterator::More ()
-{
- if (thecurr > theselect->Length()) return Standard_False;
- if (theselect->Value(thecurr) == 0) Next();
- if (thecurr > theselect->Length()) return Standard_False;
- return (theselect->Value(thecurr) > 0);
-}
-
-void Transfer_Iterator::Next ()
-{
- thecurr++;
- if (thecurr > theselect->Length()) return;
- if (theselect->Value(thecurr) == 0) Next();
-}
-
-const Handle(Transfer_Binder)& Transfer_Iterator::Value () const
-{
- if (thecurr == 0 || thecurr > theselect->Length())
- Standard_NoSuchObject::Raise ("Transfer_Iterator::Value");
- if (theselect->Value(thecurr) == 0)
- Standard_NoSuchObject::Raise ("Transfer_Iterator::Value");
- return theitems->Value(thecurr);
-}
+++ /dev/null
-// Created on: 1992-10-28
-// 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 _Transfer_Iterator_HeaderFile
-#define _Transfer_Iterator_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-class Transfer_HSequenceOfBinder;
-class TColStd_HSequenceOfInteger;
-
-//! Defines an Iterator on the result of a Transfer
-//! Available for Normal Results or not (Erroneous Transfer)
-//! It gives several kinds of Informations, and allows to consider
-//! various criteria (criteria are cumulative)
-class Transfer_Iterator
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
- //! Creates an empty Iterator
- Standard_EXPORT Transfer_Iterator();
-
- //! Returns count of Binders to be iterated
- Standard_EXPORT Standard_Integer Number() const;
-
- //! Clears Iteration in progress, to allow it to be restarted
- void Start() { thecurr = 0; Next(); }
-
- //! Returns True if there are other Items to iterate
- Standard_EXPORT Standard_Boolean More();
-
- //! Sets Iteration to the next Item
- Standard_EXPORT void Next();
-
- //! Returns the current Binder
- Standard_EXPORT const Handle(Transfer_Binder)& Value() const;
-
- protected:
-
- //! Adds a Binder to the iteration list (construction)
- Standard_EXPORT void AddItem (const Handle(Transfer_Binder)& atr);
-
- //! Selects/Unselect (according to <keep> an item designated by
- //! its rank <num> in the list
- //! Used by sub-classes which have specific criteria
- Standard_EXPORT void SelectItem (const Standard_Integer num, const Standard_Boolean keep);
-
- Standard_Integer thecurr;
-
- private:
-
- Handle(Transfer_HSequenceOfBinder) theitems;
- Handle(TColStd_HSequenceOfInteger) theselect;
-};
-
-#endif // _Transfer_Iterator_HeaderFile
+++ /dev/null
-// Created on: 1992-02-03
-// 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 _Transfer_IteratorOfProcessForFinder_HeaderFile
-#define _Transfer_IteratorOfProcessForFinder_HeaderFile
-
-#include <Transfer_ProcessForFinder.hxx>
-
-typedef Transfer_ProcessForFinder::Iterator Transfer_IteratorOfProcessForFinder;
-
-#endif // _Transfer_IteratorOfProcessForFinder_HeaderFile
+++ /dev/null
-// Created on: 1992-02-03
-// 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 _Transfer_IteratorOfProcessForTransient_HeaderFile
-#define _Transfer_IteratorOfProcessForTransient_HeaderFile
-
-#include <Transfer_ProcessForTransient.hxx>
-
-typedef Transfer_ProcessForTransient::Iterator Transfer_IteratorOfProcessForTransient;
-
-#endif // _Transfer_IteratorOfProcessForTransient_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 <Transfer_Process.hxx>
+
+#include <Standard_ErrorHandler.hxx>
+#include <Standard_Failure.hxx>
+#include <TColStd_Array1OfInteger.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <Message_Msg.hxx>
+#include <Message_Messenger.hxx>
+#include <Interface_Check.hxx>
+#include <Interface_CheckIterator.hxx>
+#include <Interface_InterfaceModel.hxx>
+#include <Interface_MSG.hxx>
+#include <Transfer_Finder.hxx>
+#include <Transfer_VoidBinder.hxx>
+#include <Transfer_SimpleBinderOfTransient.hxx>
+#include <Transfer_HSequenceOfBinder.hxx>
+#include <Transfer_TransferDeadLoop.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Transfer_Process,MMgt_TShared)
+
+//=======================================================================
+// Methods of Transfer_Process::Iterator
+//=======================================================================
+
+Transfer_Process::Iterator::Iterator (const Standard_Boolean WithSource)
+: myCurrent(1),
+ myBinders(new Transfer_HSequenceOfBinder),
+ mySelected(new TColStd_HSequenceOfInteger)
+{
+ if (WithSource)
+ mySourceObjects = new TColStd_HSequenceOfTransient();
+}
+
+void Transfer_Process::Iterator::Add (const Handle(Transfer_Binder)& theBinder)
+{
+ if (!mySourceObjects.IsNull())
+ Standard_NoSuchObject::Raise("Transfer_Process::Iterator::Add, Source Object required but not provided");
+ AddItem(theBinder);
+}
+
+void Transfer_Process::Iterator::Add (const Handle(Transfer_Binder)& theBinder, const Handle(Standard_Transient)& theSource)
+{
+ AddItem(theBinder);
+ if (!mySourceObjects.IsNull()) mySourceObjects->Append(theSource);
+}
+
+void Transfer_Process::Iterator::Filter (const Handle(TColStd_HSequenceOfTransient)& theList)
+{
+ if (theList.IsNull() || mySourceObjects.IsNull()) return;
+ Standard_Integer i, j, nb = mySourceObjects->Length();
+ if (nb == 0) return;
+ Handle(Transfer_Binder) factice;
+ Transfer_MapOfProcess amap (nb);
+ for (i = 1; i <= nb; i ++) {
+ j = amap.Add (mySourceObjects->Value(i),factice);
+ mySelected->SetValue (j,0);
+ }
+
+ // Comparaison
+ nb = theList->Length();
+ for (i = 1; i <= nb; i ++) {
+ j = amap.FindIndex (theList->Value(i));
+ if (j > 0) mySelected->SetValue (j,1);
+ }
+}
+
+Standard_Integer Transfer_Process::Iterator::Number () const
+{
+ Standard_Integer i, n = mySelected->Length(), numb = 0;
+ for (i = 1; i <= n; i ++) {
+ if (mySelected->Value(i) != 0) numb++;
+ }
+ return numb;
+}
+
+Standard_Boolean Transfer_Process::Iterator::More ()
+{
+ if (myCurrent > mySelected->Length()) return Standard_False;
+ if (mySelected->Value(myCurrent) == 0) Next();
+ if (myCurrent > mySelected->Length()) return Standard_False;
+ return (mySelected->Value(myCurrent) > 0);
+}
+
+void Transfer_Process::Iterator::Next ()
+{
+ myCurrent++;
+ if (myCurrent > mySelected->Length()) return;
+ if (mySelected->Value(myCurrent) == 0) Next();
+}
+
+const Handle(Transfer_Binder)& Transfer_Process::Iterator::Value () const
+{
+ if (myCurrent == 0 || myCurrent > mySelected->Length())
+ Standard_NoSuchObject::Raise ("Transfer_Process::Iterator::Value");
+ if (mySelected->Value(myCurrent) == 0)
+ Standard_NoSuchObject::Raise ("Transfer_Process::Iterator::Value");
+ return myBinders->Value(myCurrent);
+}
+
+const Handle(Standard_Transient) & Transfer_Process::Iterator::SourceObject() const
+{
+ if (mySourceObjects.IsNull())
+ Standard_NoSuchObject::Raise("Transfer_Process::Iterator : No Source Objects defined at all");
+ return mySourceObjects->Value(myCurrent);
+}
+
+void Transfer_Process::Iterator::AddItem (const Handle(Transfer_Binder)& atr)
+{
+ myBinders->Append(atr);
+ mySelected->Append(1);
+}
+
+//=======================================================================
+// Methods of Transfer_Process
+//=======================================================================
+
+void Transfer_Process::Clean ()
+{
+ Standard_Integer i, nb = NbMapped();
+ Standard_Integer j,unb = 0;
+ for (i = 1; i <= nb; i ++) {
+ if (themap(i).IsNull()) unb ++;
+ }
+ if (unb == 0) return;
+
+ // Refaire la map -> decalages
+ TColStd_Array1OfInteger unbs (1,nb); unbs.Init(0);
+ Transfer_MapOfProcess newmap (nb*2);
+ for (i = 1; i <= nb; i ++) {
+ Handle(Standard_Transient) ent = Mapped(i);
+ Handle(Transfer_Binder) bnd = MapItem(i);
+ if (bnd.IsNull()) continue;
+ j = newmap.Add (ent,bnd);
+ unbs.SetValue (i,j);
+ }
+ themap.Assign (newmap);
+
+ // Update the map of roots
+ TColStd_IndexedMapOfInteger aNewRoots;
+ for( i=1; i<= theroots.Extent(); i++ ) {
+ j = theroots.FindKey(i);
+ Standard_Integer k = unbs.Value(j);
+ if ( k ) aNewRoots.Add ( k );
+ }
+ theroots.Clear();
+ theroots = aNewRoots;
+
+ // Le reste : nettoyage
+ thelastobj.Nullify();
+ thelastbnd.Nullify();
+ theindex = 0;
+}
+
+Handle(Transfer_Binder) Transfer_Process::Find (const Handle(Standard_Transient) &start) const
+{
+ if (thelastobj == start && theindex > 0) return thelastbnd;
+ const Standard_Integer index = themap.FindIndex (start);
+ return (index > 0)? themap.FindFromIndex(index) : NULL;
+}
+
+Standard_Boolean Transfer_Process::IsBound (const Handle(Standard_Transient) &start) const
+{
+ Handle(Transfer_Binder) binder = Find(start);
+ return (binder.IsNull()? Standard_False : binder->HasResult());
+}
+
+void Transfer_Process::Bind (const Handle(Standard_Transient) &start, const Handle(Transfer_Binder)& binder)
+{
+ if (binder.IsNull()) return;
+ Handle(Transfer_Binder) former = FindAndMask(start);
+ if (!former.IsNull()) {
+ // On admet VoidBinder : alors on reprend son Check
+ if (former->DynamicType() == STANDARD_TYPE(Transfer_VoidBinder)) {
+ binder->Merge(former);
+ themap(theindex) = binder; // Substitution
+ }
+ else if (former->Status() == Transfer_StatusUsed) {
+ StartTrace (former,start,thelevel,4);
+ Transfer_TransferFailure::Raise ("TransferProcess : Bind, already Bound");
+ }
+ else {
+ if (thetrace > 2) StartTrace (former,start,thelevel,5);
+ binder->CCheck()->GetMessages (former->Check());
+ }
+ }
+ if (theindex == 0 || thelastbnd.IsNull()) {
+ if (theindex == 0) theindex = themap.Add(start,binder); // Nouveau
+ else themap(theindex) = binder; // idem en fait
+ thelastbnd = binder;
+ }
+ else {
+ thelastbnd = binder;
+ themap(theindex) = binder;
+ }
+}
+
+Standard_Boolean Transfer_Process::Unbind (const Handle(Standard_Transient) &start)
+{
+ Handle(Transfer_Binder) former = FindAndMask(start);
+ if (theindex == 0) return Standard_False;
+ if (former.IsNull()) return Standard_False;
+ if (former->DynamicType() == STANDARD_TYPE(Transfer_VoidBinder)) return Standard_True;
+ themap(theindex) = thelastbnd;
+ if(theroots.Contains(theindex)) {
+ TColStd_IndexedMapOfInteger aNewRoots;
+ for(Standard_Integer i = 1; i <= theroots.Extent(); i++)
+ if(theindex!= theroots.FindKey(i))
+ aNewRoots.Add(theroots.FindKey(i));
+
+ theroots.Clear();
+ theroots = aNewRoots;
+ }
+
+ thelastobj.Nullify();
+ thelastbnd.Nullify();
+ theindex = 0;
+ return Standard_True;
+}
+
+void Transfer_Process::SendMsg (const Handle(Standard_Transient) &start, const Message_Msg& amsg)
+{
+ Handle(Transfer_Binder) binder = FindAndMask(start);
+ if (binder.IsNull()) {
+ binder = new Transfer_VoidBinder;
+ Bind (start,binder);
+ }
+ // Alimente la trace : Regle causant (user messages)
+ if (thetrace > 0) {
+ StartTrace (binder,start,thelevel,6);
+ themessenger << amsg.Value();
+ if (amsg.IsEdited()&&thetrace>2)
+ themessenger << " [from: " << amsg.Original() << "]";
+ themessenger << endl;
+ }
+}
+
+void Transfer_Process::AddFail (const Handle(Standard_Transient) &start, const Standard_CString mess, const Standard_CString orig)
+{
+ Handle(Transfer_Binder) binder = FindAndMask(start);
+ if (binder.IsNull()) {
+ binder = new Transfer_VoidBinder;
+ Bind (start,binder);
+ }
+ binder->AddFail (mess,orig);
+ if (thetrace > 0) {
+ StartTrace (binder,start,thelevel,1);
+ themessenger << " --> Fail : " << mess;
+ if (orig[0] != '\0'&&thetrace>2) themessenger << " [from: " << orig << "]";
+ themessenger << endl;
+ }
+}
+
+void Transfer_Process::AddFail (const Handle(Standard_Transient) &start, const Message_Msg& amsg)
+{
+ if (amsg.IsEdited()) AddFail (start,TCollection_AsciiString(amsg.Value()).ToCString(), TCollection_AsciiString(amsg.Original()).ToCString());
+ else AddFail (start,TCollection_AsciiString(amsg.Value()).ToCString());
+}
+
+void Transfer_Process::AddWarning (const Handle(Standard_Transient) &start, const Standard_CString mess, const Standard_CString orig)
+{
+ Handle(Transfer_Binder) binder = FindAndMask(start);
+ if (binder.IsNull()) {
+ binder = new Transfer_VoidBinder;
+ Bind (start,binder);
+ }
+ binder->AddWarning(mess,orig);
+ if (thetrace > 1) {
+ StartTrace (binder,start,thelevel,2);
+ themessenger << " --> Warning : " << mess;
+ if (orig[0] != '\0'&&thetrace>2) themessenger << " [from: " << orig << "]";
+ themessenger << endl;
+ }
+}
+
+void Transfer_Process::AddWarning (const Handle(Standard_Transient) &start, const Message_Msg& amsg)
+{
+ if (amsg.IsEdited()) AddWarning (start,TCollection_AsciiString(amsg.Value()).ToCString(), TCollection_AsciiString(amsg.Original()).ToCString());
+ else AddWarning (start,TCollection_AsciiString(amsg.Value()).ToCString());
+}
+
+Handle(Interface_Check) Transfer_Process::Check (const Handle(Standard_Transient) &start) const
+{
+ const Handle(Transfer_Binder)& binder = Find(start);
+ return (binder.IsNull()? NULL : binder->Check());
+}
+
+void Transfer_Process::BindTransient (const Handle(Standard_Transient) &start, const Handle(Standard_Transient)& res)
+{
+ if (res.IsNull()) return;
+ Handle(Transfer_SimpleBinderOfTransient) binder = Handle(Transfer_SimpleBinderOfTransient)::DownCast(Find(start));
+ // Binding sur place ?
+ if (!binder.IsNull() && binder->Status() == Transfer_StatusVoid) {
+ binder->SetResult(res); return;
+ }
+ // Sinon, refaire
+ binder = new Transfer_SimpleBinderOfTransient(res);
+ Bind(start,binder);
+}
+
+Handle(Standard_Transient) Transfer_Process::FindTransient (const Handle(Standard_Transient) &start) const
+{
+ Handle(Transfer_SimpleBinderOfTransient) binder = Handle(Transfer_SimpleBinderOfTransient)::DownCast(Find(start));
+ if (binder.IsNull()) return NULL;
+ if (!binder->HasResult()) return NULL;
+ return binder->Result();
+}
+
+Standard_Boolean Transfer_Process::GetTypedTransient (const Handle(Transfer_Binder)& binder, const Handle(Standard_Type)& atype, Handle(Standard_Transient)& val) const
+{
+ return Transfer_SimpleBinderOfTransient::GetTypedResult(binder,atype,val);
+}
+
+Handle(Transfer_Binder) Transfer_Process::Transferring (const Handle(Standard_Transient) &theSource)
+{
+ // Map deja alimentee ?
+ Handle(Transfer_Binder) former = FindAndMask(theSource);
+
+ // .... Transfert deja effectue avec Resultat ? ....
+
+ // On considere que cette nouvelle demande de Transfert correspond donc a une
+ // utilisation en plus : noter "AlreadyUsed", donc resultat non modifiable
+ if (!former.IsNull()) {
+ if (former->HasResult()) {
+ former->SetAlreadyUsed();
+ return former;
+ }
+
+ // .... Etat Initial : peut-etre deja fait ... ou infaisable !
+ Transfer_StatusExec statex = former->StatusExec();
+ switch (statex) {
+ case Transfer_StatusInitial : // Transfert prepare a faire
+ break;
+ case Transfer_StatusDone : // Transfert deja fait
+ themessenger << " .. and Transfer done" << endl;
+ return former;
+ case Transfer_StatusRun : // ca y est, on boucle
+ former->SetStatusExec(Transfer_StatusLoop);
+ return former;
+ case Transfer_StatusError : // pas propre, ca ...
+ if (thetrace) {
+ themessenger << " *** Transfer in Error Status :" << endl;
+ StartTrace (former, theSource, thelevel,0);
+ }
+ else StartTrace (former,theSource,thelevel,4);
+ Transfer_TransferFailure::Raise("TransferProcess : Transfer in Error Status");
+ case Transfer_StatusLoop : // la boucle est bouclee ...
+ if (thetrace) {
+ themessenger << " *** Transfer Head of Dead Loop :" << endl;
+ StartTrace (former,theSource,thelevel,0);
+ }
+ else StartTrace (former,theSource,thelevel,4);
+ Transfer_TransferDeadLoop::Raise("TransferProcess : Transfer at Head of a Dead Loop");
+ }
+
+ // .... OK, on peut lancer l Execution
+ former->SetStatusExec(Transfer_StatusRun);
+ }
+
+ Handle(Transfer_Binder) binder;
+ Standard_Boolean newbind = Standard_False;
+
+ // Transfert sous protection pour les exceptions (pour notification en fait)
+ const Standard_Integer oldlev = thelevel;
+ try {
+ OCC_CATCH_SIGNALS
+ //! Invokes the Actor to work (set by SetActor), and tries its Nexts if no result is produced,
+ //! until a Non Null Binder is produced.
+ //! But keep in mind that a Null Binder can allways be returned
+ //! if a Starting Entity has not been recognized at all.
+ thelevel++; // si decremente et == 0, transfert racine
+
+ Handle(Actor) actor = theactor;
+ // On balaie les Next jusqu a avoir un Resultat
+ while (!actor.IsNull()) {
+ if (actor->Recognize (theSource)) binder = actor->Transferring(theSource,this);
+ else binder.Nullify();
+ if (!binder.IsNull()) break;
+ actor = actor->Next();
+ }
+
+ if (!binder.IsNull()) {
+ // Gestion du niveau racine (.. a regarder de pres ..)
+ if (therootl == 0 && binder->StatusExec() == Transfer_StatusDone)
+ therootl = thelevel - 1;
+ }
+
+ if (thelevel > 0) thelevel--;
+ }
+
+ // ... Exceptions a Rattraper : elles ne se ressemblent pas toutes ... !
+ catch (Transfer_TransferDeadLoop) {
+ if (binder.IsNull()) {
+ themessenger << " *** Dead Loop with no Result" << endl;
+ if (thetrace) StartTrace (binder,theSource,thelevel-1,0);
+ binder = new Transfer_VoidBinder;
+ Bind (theSource,binder); newbind = Standard_True;
+ } else if (binder->StatusExec() == Transfer_StatusLoop) {
+ if (thetrace) {
+ themessenger << " *** Dead Loop : Finding head of Loop :" << endl;
+ StartTrace (binder,theSource,thelevel-1,0);
+ }
+ else StartTrace (binder,theSource,thelevel-1,4);
+ Transfer_TransferFailure::Raise("TransferProcess : Head of Dead Loop");
+ // Autrement dit, on change d exception (on est sorti de la boucle)
+ } else {
+ if (thetrace) {
+ themessenger << " *** Dead Loop : Actor in Loop :" << endl;
+ StartTrace (binder,theSource,thelevel-1,0);
+ }
+ }
+ binder->AddFail("Transfer in dead Loop");
+ thelevel = oldlev;
+ }
+ catch (Standard_Failure) {
+ if (binder.IsNull()) {
+ themessenger << " *** Exception Raised with no Result" << endl;
+ binder = new Transfer_VoidBinder;
+ Bind (theSource,binder); newbind = Standard_True;
+ }
+ binder->AddFail("Transfer stopped by exception raising");
+ if (thetrace) {
+ themessenger << " *** Raised : " << Standard_Failure::Caught()->GetMessageString() << endl;
+ StartTrace (binder,theSource,thelevel-1,4);
+ }
+ thelevel = oldlev;
+ }
+
+ // .... Conclusion : Noter dans la Map ....
+ if (!newbind && !binder.IsNull()) {
+ Bind(theSource,binder);
+ }
+ else {
+ //= by ABV: 5 Oct 97: nothing generated, but former can be in run state - drop it
+ //= ASK: may be set it to StatusInitial ?
+ if ( !former.IsNull() ) former->SetStatusExec ( Transfer_StatusDone ); //+
+ return NULL; // Binder Null ... que faire d autre ?
+ }
+
+ // .... Gerer les Racines (si prevu) ....
+ if (therootl >= thelevel) {
+ therootl = 0;
+ if (therootm && binder->Status() != Transfer_StatusVoid) {
+ SetRoot (theSource);
+ }
+ }
+ return thelastbnd;
+}
+
+void Transfer_Process::StartTrace (const Handle(Transfer_Binder)& binder, const Handle(Standard_Transient) &start, const Standard_Integer level, const Standard_Integer mode) const
+{
+ // ### Fail (Roots:50) -- Start start->DynamicType()
+ // ### Fail (Roots:50) -- Start id:#label.. Type:start->DynamicType()
+ if (thetrace > 3) { // Internal to be switch when searching bug (trace >= 4)
+ if (mode == 1) themessenger << " ### Fail";
+ if (mode == 2) themessenger << " ### Warning";
+ if (mode == 3) themessenger << " ### New Root n0 " << theroots.Extent();
+ if (mode == 4) themessenger << " ### Exception";
+ if (mode == 5) themessenger << " ### Substitution";
+ if (mode == 6) themessenger << " ### Information";
+ if (level > 1)
+ themessenger << " (nested)"; // " at nesting Level:"<<level;
+ if (mode >= 0 && mode != 3)
+ themessenger << " at " << theroots.Extent() << " Roots";
+ }
+ if (!start.IsNull()) PrintTrace (start,themessenger);
+
+ if (!binder.IsNull()) {
+ Handle(Transfer_Binder) bnd = binder;
+ Standard_Boolean hasres = Standard_False;
+ while (!bnd.IsNull()) {
+ if (bnd->Status() != Transfer_StatusVoid) {
+ // --- Result Type: binder->ResultType() --- Binder : binder->DynamicType();
+ if (!hasres)
+ themessenger << "\n --- Result Type : ";
+ else
+ themessenger << " , ";
+ themessenger << bnd->ResultTypeName();
+ hasres = Standard_True;
+ }
+ bnd = bnd->NextResult();
+ }
+ if (!hasres && mode > 2) {
+ themessenger << "\n --- No Result recorded";
+ }
+ }
+ themessenger << endl;
+}
+
+void Transfer_Process::PrintTrace (const Handle(Standard_Transient) &theSource, const Handle(Message_Messenger)& S) const
+{
+ if (!theSource.IsNull()) {
+ Handle(Transfer_Finder) aFinder = Handle(Transfer_Finder)::DownCast(theSource);
+ S << " Type:" << (aFinder.IsNull()? theSource->DynamicType()->Name() : aFinder->ValueTypeName());
+ }
+}
+
+void Transfer_Process::PrintStats(const Handle(Message_Messenger)& S) const
+{
+ S<<"\n*******************************************************************\n";
+ S << "******** Basic Statistics ********"<<endl;
+
+ if (themodel.IsNull())
+ S<<"**** Model unknown"<<endl;
+ else
+ S<<"**** Nb Entities : "<<themodel->NbEntities()<<endl;
+
+ Standard_Integer nbr = 0, nbe = 0, nbw = 0;
+ Standard_Integer i, max = NbMapped(), nbroots = NbRoots();
+ S << "**** Nb Final Results : "<<nbroots<<endl;
+
+ for (i = 1; i <= max; i ++) {
+ const Handle(Transfer_Binder)& binder = MapItem(i);
+ if (binder.IsNull()) continue;
+ const Handle(Interface_Check) ach = binder->Check();
+ Transfer_StatusExec stat = binder->StatusExec();
+ if (stat != Transfer_StatusInitial && stat != Transfer_StatusDone)
+ nbe ++;
+ else {
+ if (ach->NbWarnings() > 0) nbw++;
+ if (binder->HasResult()) nbr++;
+ }
+ }
+ if (nbr > nbroots)
+ S<<"**** ( Itermediate Results : "<<nbr-nbroots<<" )\n";
+ if (nbe > 0)
+ S<<"**** Errors on : "<<Interface_MSG::Blanks(nbe,4)<<nbe<<" Entities\n";
+ if (nbw > 0)
+ S<<"**** Warnings on : "<<Interface_MSG::Blanks(nbw,4)<<nbw<<" Entities\n";
+ S<<"*******************************************************************\n";
+}
+
+Transfer_Process::Iterator Transfer_Process::RootResult (const Standard_Boolean withstart) const
+{
+ Iterator iter(withstart);
+ const Standard_Integer max = theroots.Extent();
+ for (Standard_Integer j = 1; j <= max; j ++) {
+ const Standard_Integer i = theroots.FindKey(j);
+ Handle(Transfer_Binder) binder = MapItem(i);
+ if (binder.IsNull()) continue;
+ if (withstart) iter.Add (binder,Mapped(i));
+ else iter.Add (binder);
+ }
+ return iter;
+}
+
+Transfer_Process::Iterator Transfer_Process::CompleteResult (const Standard_Boolean withstart) const
+{
+ Iterator iter(withstart);
+ const Standard_Integer max = NbMapped();
+ for (Standard_Integer i = 1; i <= max; i ++) {
+ Handle(Transfer_Binder) binder = MapItem(i);
+ if (binder.IsNull()) continue;
+ if (withstart) iter.Add (binder,Mapped(i));
+ else iter.Add (binder);
+ }
+ return iter;
+}
+
+Transfer_Process::Iterator Transfer_Process::AbnormalResult() const
+{
+ Iterator iter(Standard_True);
+ const Standard_Integer max = NbMapped();
+ for (Standard_Integer i = 1; i <= max; i ++) {
+ Handle(Transfer_Binder) binder = MapItem(i);
+ if (binder.IsNull()) continue;
+ Transfer_StatusExec statex = binder->StatusExec();
+ if (statex != Transfer_StatusInitial && statex != Transfer_StatusDone)
+ iter.Add (binder,Mapped(i)); // on note les cas "pas normaux"
+ }
+ return iter;
+}
+
+Interface_CheckIterator Transfer_Process::CheckList (const Standard_Boolean erronly) const
+{
+ Interface_CheckIterator list;
+ Standard_Integer num, max = NbMapped();
+ for (Standard_Integer i = 1; i <= max; i ++) {
+ Handle(Transfer_Binder) binder = MapItem(i);
+ if (binder.IsNull()) continue;
+ Transfer_StatusExec statex = binder->StatusExec();
+ Handle(Interface_Check) check = binder->Check();
+ if (statex != Transfer_StatusInitial && statex != Transfer_StatusDone && !check->HasFailed())
+ check->AddFail("Transfer in Abnormal Status (!= Initial or Done)");
+ if (!check->HasFailed() && (erronly || check->NbWarnings() == 0)) continue;
+ const Handle(Standard_Transient) &ent = Mapped(i);
+ num = CheckNum(ent);
+ if (num == 0) num = i;
+ check->SetEntity(ent);
+ list.Add(check,num);
+ }
+ return list;
+}
--- /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.
+
+// TheSourceType is assumed Handle(Standard_Transient) or Handle(Transfer_Finder)
+// It should provide : "==" , .IsNull() , ->DynamicType()
+
+#ifndef _Transfer_Process_HeaderFile
+#define _Transfer_Process_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+#include <Standard_Type.hxx>
+#include <MMgt_TShared.hxx>
+
+#include <NCollection_IndexedDataMap.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <Message.hxx>
+#include <Transfer_Binder.hxx>
+#include <Transfer_Hasher.hxx>
+
+class TColStd_HSequenceOfInteger;
+class TColStd_HSequenceOfTransient;
+class Message_Msg;
+class Message_Messenger;
+class Interface_Check;
+class Interface_CheckIterator;
+class Interface_InterfaceModel;
+class Transfer_HSequenceOfBinder;
+class Transfer_Binder;
+
+
+class Transfer_Process : public MMgt_TShared
+{
+ public:
+
+ typedef NCollection_IndexedDataMap<Handle(Standard_Transient),Handle(Transfer_Binder),Transfer_Hasher> Transfer_MapOfProcess;
+
+ class Actor : public MMgt_TShared
+ {
+ public:
+
+ Actor() : themodetrans(0) {}
+
+ //! Prerequesite for Transfer : the method Transfer is called on a starting object only if Recognize has returned True on it.
+ //! This allows to define a list of Actors, each one processing a definite kind of data
+ //! Transfer_Process calls Recognize on each one before calling Transfer.
+ //! But even if Recognize has returned True, Transfer can reject by returning a Null Binder (afterwards rejection),
+ //! the next actor is then invoked
+ //!
+ //! The provided default returns True, can be redefined
+ Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Standard_Transient)& /*start*/) { return Standard_True; }
+
+ //! Specific action of Transfer. The Result is stored in
+ //! the returned Binder, or a Null Handle for "No result"
+ //! (Default defined as doing nothing; should be deffered)
+ //! "mutable" allows the Actor to record intermediate
+ //! information, in addition to those of TransferProcess
+ Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& /*start*/, const Handle(Transfer_Process)& /*TP*/) { return NULL; }
+
+ //! Defines a Next Actor : it can then be asked to work if
+ //! <me> produces no result for a given type of Object.
+ //! If Next is already set and is not "Last", calls
+ //! SetNext on it. If Next defined and "Last", the new
+ //! actor is added before it in the list
+ Standard_EXPORT void SetNext (const Handle(Actor)& next)
+ {
+ if (thenext == next) return;
+ if (thenext.IsNull()) thenext = next;
+ else thenext->SetNext(next);
+ }
+
+ //! Returns the Actor defined as Next, or a Null Handle
+ const Handle(Actor) & Next() const { return thenext; }
+
+ //! Set a specific transfer mode
+ void SetTransferMode (const Standard_Integer theMode) { themodetrans = theMode; }
+
+ DEFINE_STANDARD_RTTI_INLINE(Actor,MMgt_TShared)
+
+ protected:
+
+ Handle(Actor) thenext;
+ Standard_Integer themodetrans;
+ };
+
+ class Iterator
+ {
+ public:
+
+ DEFINE_STANDARD_ALLOC
+
+ //! Creates an empty Iterator
+ //! If WithSource is True, each Binder to be iterated will
+ //! be associated to its corresponding Source Object
+ Standard_EXPORT Iterator(const Standard_Boolean WithSource);
+
+ //! Adds a Binder to the iteration list (construction)
+ //! with no corresponding Starting Object
+ //! (note that Result is brought by Binder)
+ Standard_EXPORT void Add (const Handle(Transfer_Binder)& theBinder);
+
+ //! Adds a Binder to the iteration list, associated with
+ //! its corresponding Starting Object "start"
+ //! Starting Object is ignored if not required at
+ //! Creation time
+ Standard_EXPORT void Add (const Handle(Transfer_Binder)& theBinder, const Handle(Standard_Transient)& theSource);
+
+ //! After having added all items, keeps or rejects items
+ //! which are attached to starting data given by <list>
+ //! <keep> = True (D) : keeps. <keep> = False : rejects
+ //! Does nothing if <withstarts> was False
+ Standard_EXPORT void Filter (const Handle(TColStd_HSequenceOfTransient)& theList);
+
+ //! Returns count of Binders to be iterated
+ Standard_EXPORT Standard_Integer Number() const;
+
+ //! Clears Iteration in progress, to allow it to be restarted
+ void Start() { myCurrent = 0; Next(); }
+
+ //! Returns True if there are other Items to iterate
+ Standard_EXPORT Standard_Boolean More();
+
+ //! Sets Iteration to the next Item
+ Standard_EXPORT void Next();
+
+ //! Returns the current Binder
+ Standard_EXPORT const Handle(Transfer_Binder)& Value() const;
+
+ //! Returns corresponding Source Object
+ Standard_EXPORT const Handle(Standard_Transient) & SourceObject() const;
+
+ private:
+
+ //! Adds a Binder to the iteration list (construction)
+ Standard_EXPORT void AddItem (const Handle(Transfer_Binder)& atr);
+
+ Standard_Integer myCurrent;
+ Handle(Transfer_HSequenceOfBinder) myBinders;
+ Handle(TColStd_HSequenceOfInteger) mySelected;
+ Handle(TColStd_HSequenceOfTransient) mySourceObjects;
+ };
+
+ public:
+
+ //! Sets TransferProcess at initial state. Gives an Initial size
+ //! (indicative) for the Map when known (default is 10000).
+ //! Sets default trace file as a printer and default trace level
+ //! (see Message_TraceFile).
+ Transfer_Process(const Standard_Integer nb = 10000)
+ : themessenger(Message::DefaultMessenger()),
+ thetrace(0),
+ thelevel(0), therootl(0),
+ therootm(Standard_False),
+ theindex(0),
+ themap(nb)
+ {}
+
+ //! Sets TransferProcess at initial state. Gives an Initial size
+ //! (indicative) for the Map when known (default is 10000).
+ //! Sets a specified printer.
+ Transfer_Process(const Handle(Message_Messenger)& messenger, const Standard_Integer nb = 10000)
+ : themessenger(messenger.IsNull()? Message::DefaultMessenger() : messenger),
+ thetrace(1),
+ thelevel(0), therootl(0),
+ therootm(Standard_False),
+ theindex(0),
+ themap(nb)
+ {}
+
+ //! Sets an InterfaceModel, which can be used during transfer
+ //! for instance if a context must be managed, it is in the Model
+ void SetModel (const Handle(Interface_InterfaceModel)& model) { themodel = model; }
+
+ //! Returns the Model which can be used for context
+ const Handle(Interface_InterfaceModel)& Model() const { return themodel; }
+
+ //! Resets a TransferProcess as ready for a completely new work.
+ //! Clears general data (roots) and the Map
+ void Clear()
+ {
+ thelevel = 0; therootl = 0;
+ theroots.Clear();
+ themap.Clear();
+ theindex = 0; thelastobj.Nullify(); thelastbnd.Nullify();
+ }
+
+ //! Rebuilds the Map and the roots to really remove Unbound items
+ //! Because Unbind keeps the entity in place, even if not bound
+ //! Hence, working by checking new items is meaningless if a
+ //! formerly unbound item is rebound
+ Standard_EXPORT void Clean();
+
+ //! Resizes the Map as required (if a new reliable value has been
+ //! determined). Acts only if <nb> is greater than actual NbMapped
+ void Resize (const Standard_Integer nb) { if (nb > themap.NbBuckets()) themap.ReSize(nb); }
+
+ //! Defines an Actor, which is used for automatic Transfer
+ //! If already defined, the new Actor is cumulated
+ //! (see SetNext from Actor)
+ void SetActor (const Handle(Actor)& actor)
+ {
+ if (theactor == actor) return;
+ if (theactor.IsNull()) theactor = actor;
+ else if (actor.IsNull()) theactor = actor;
+ else theactor->SetNext(actor);
+ }
+
+ //! Returns the Binder which is linked with a starting Object
+ //! It can either bring a Result (Transfer done) or none (for a
+ //! pre-binding).
+ //! If no Binder is linked with <start>, returns a Null Handle
+ //! Considers a category number, by default 0
+ Standard_EXPORT Handle(Transfer_Binder) Find (const Handle(Standard_Transient) &start) const;
+
+ //! Returns True if a Result (whatever its form) is Bound with a starting Object.
+ //! I.e., if a Binder with a Result set, is linked with it
+ Standard_EXPORT Standard_Boolean IsBound (const Handle(Standard_Transient) &start) const;
+
+ //! Creates a Link a starting Object with a Binder. This Binder
+ //! can either bring a Result (effective Binding) or none (it can
+ //! be set later : pre-binding).
+ //! Considers a category number, by default 0
+ Standard_EXPORT void Bind (const Handle(Standard_Transient) &start, const Handle(Transfer_Binder)& binder);
+
+ //! Removes the Binder linked with a starting object
+ //! If this Binder brings a non-empty Check, it is replaced by
+ //! a VoidBinder. Also removes from the list of Roots as required.
+ //! Returns True if done, False if <start> was not bound
+ //! Considers a category number, by default 0
+ Standard_EXPORT Standard_Boolean Unbind (const Handle(Standard_Transient) &start);
+
+ //! Sets Messenger used for outputting messages.
+ void SetMessenger (const Handle(Message_Messenger)& messenger)
+ { themessenger = messenger.IsNull()? Message::DefaultMessenger() : messenger; }
+
+ //! Returns Messenger used for outputting messages.
+ //! The returned object is guaranteed to be non-null;
+ //! default is Message::Messenger().
+ const Handle(Message_Messenger) & Messenger() const { return themessenger; }
+
+ //! Sets trace level used for outputting messages:
+ //! <trace> = 0 : no trace at all
+ //! <trace> = 1 : handled exceptions and calls to AddError
+ //! <trace> = 2 : also calls to AddWarning
+ //! <trace> = 3 : also traces new Roots
+ //! (uses method ErrorTrace).
+ //! Default is 1 : Errors traced
+ void SetTraceLevel (const Standard_Integer tracelev) { thetrace = tracelev; }
+
+ //! Returns trace level used for outputting messages.
+ Standard_Integer TraceLevel() const { return thetrace; }
+
+ //! New name for AddFail (Msg)
+ void SendFail (const Handle(Standard_Transient) &start, const Message_Msg& amsg) { AddFail(start,amsg); }
+
+ //! New name for AddWarning (Msg)
+ void SendWarning (const Handle(Standard_Transient) &start, const Message_Msg& amsg) { AddWarning(start,amsg); }
+
+ //! Adds an Error message to a starting entity (to the check of
+ //! its Binder of category 0, as a Fail)
+ Standard_EXPORT void AddFail (const Handle(Standard_Transient) &start, const Standard_CString mess, const Standard_CString orig = "");
+
+ //! (other name of AddFail, maintained for compatibility)
+ void AddError (const Handle(Standard_Transient) &start, const Standard_CString mess, const Standard_CString orig = "")
+ { AddFail (start,mess,orig); }
+
+ //! Adds an Error Message to a starting entity from the definition
+ //! of a Msg (Original+Value)
+ Standard_EXPORT void AddFail (const Handle(Standard_Transient) &start, const Message_Msg& amsg);
+
+ //! Adds a Warning message to a starting entity (to the check of
+ //! its Binder of category 0)
+ Standard_EXPORT void AddWarning (const Handle(Standard_Transient) &start, const Standard_CString mess, const Standard_CString orig = "");
+
+ //! Adds a Warning Message to a starting entity from the definition
+ //! of a Msg (Original+Value)
+ Standard_EXPORT void AddWarning (const Handle(Standard_Transient) &start, const Message_Msg& amsg);
+
+ //! Returns the Check attached to a starting entity. If <start>
+ //! is unknown, returns an empty Check
+ //! Adds a case name to a starting entity
+ //! Adds a case value to a starting entity
+ //! Returns the complete case list for an entity. Null Handle if empty
+ //! In the list of mapped items (between 1 and NbMapped),
+ //! searches for the first item which follows <num0>(not included)
+ //! and which has an attribute named <name>
+ //! Attributes are brought by Binders
+ //! Hence, allows such an iteration
+ //!
+ //! for (num = TP->NextItemWithAttribute(name,0);
+ //! num > 0;
+ //! num = TP->NextItemWithAttribute(name,num) {
+ //! .. process mapped item <num>
+ //! }
+ //! Returns the type of an Attribute attached to binders
+ //! If this name gives no Attribute, returns ParamVoid
+ //! If this name gives several different types, returns ParamMisc
+ //! Else, returns the effective type (ParamInteger, ParamReal,
+ //! ParamIdent, or ParamText)
+ //! Returns the list of recorded Attribute Names, as a Dictionary
+ //! of Integer : each value gives the count of items which bring
+ //! this attribute name
+ //! By default, considers all the attribute names
+ //! If <rootname> is given, considers only the attribute names
+ //! which begin by <rootname>
+ Standard_EXPORT Handle(Interface_Check) Check (const Handle(Standard_Transient) &start) const;
+
+ //! Binds a starting object with a Transient Result.
+ //! Uses a SimpleBinderOfTransient to work. If there is already
+ //! one but with no Result set, sets its Result.
+ //! Considers a category number, by default 0
+ Standard_EXPORT void BindTransient (const Handle(Standard_Transient) &start, const Handle(Standard_Transient)& res);
+
+ //! Returns the Result of the Transfer of an object <start> as a
+ //! Transient Result.
+ //! Returns a Null Handle if there is no Transient Result
+ //! Considers a category number, by default 0
+ //! Warning : Supposes that Binding is done with a SimpleBinderOfTransient
+ Standard_EXPORT Handle(Standard_Transient) FindTransient (const Handle(Standard_Transient) &start) const;
+
+ //! Searches for a transient result attached to a starting object,
+ //! according to its type, by criterium IsKind(atype)
+ //!
+ //! In case of multiple result, explores the list and gives in
+ //! <val> the first transient result IsKind(atype)
+ //! Returns True and fills <val> if found
+ //! Else, returns False (<val> is not touched, not even nullified)
+ //!
+ //! This syntactic form avoids to do DownCast : if a result is
+ //! found with the good type, it is loaded in <val> and can be
+ //! immediately used, well initialised
+ Standard_Boolean FindTypedTransient (const Handle(Standard_Transient) &start, const Handle(Standard_Type)& atype, Handle(Standard_Transient)& val) const
+ { return GetTypedTransient (Find(start),atype,val); }
+
+ //! Safe variant for arbitrary type of argument
+ template <class T>
+ Standard_Boolean FindTypedTransient (const Handle(Standard_Transient) &start, const Handle(Standard_Type)& atype, Handle(T)& val) const
+ {
+ Handle(Standard_Transient) aVal = val;
+ return FindTypedTransient (start, atype, aVal) && ! (val = Handle(T)::DownCast(aVal)).IsNull();
+ }
+
+ //! Searches for a transient result recorded in a Binder, whatever
+ //! this Binder is recorded or not in <me>
+ //!
+ //! This is strictly equivalent to the class method GetTypedResult
+ //! from class SimpleBinderOfTransient, but is just lighter to call
+ //!
+ //! Apart from this, works as FindTypedTransient
+ Standard_EXPORT Standard_Boolean GetTypedTransient (const Handle(Transfer_Binder)& binder, const Handle(Standard_Type)& atype, Handle(Standard_Transient)& val) const;
+
+ //! Safe variant for arbitrary type of argument
+ template <class T>
+ Standard_Boolean GetTypedTransient (const Handle(Transfer_Binder)& start, const Handle(Standard_Type)& atype, Handle(T)& val) const
+ {
+ Handle(Standard_Transient) aVal = val;
+ return GetTypedTransient (start, atype, aVal) && ! (val = Handle(T)::DownCast(aVal)).IsNull();
+ }
+
+ //! Returns the maximum possible value for Map Index
+ //! (no result can be bound with a value greater than it)
+ Standard_Integer NbMapped() const { return themap.Extent(); }
+
+ //! Returns the Starting Object bound to an Index,
+ const Handle(Standard_Transient) & Mapped (const Standard_Integer num) const { return themap.FindKey(num); }
+
+ //! Returns the Index value bound to a Starting Object, 0 if none
+ Standard_Integer MapIndex (const Handle(Standard_Transient) &start) const { return themap.FindIndex(start); }
+
+ //! Returns the Binder bound to an Index
+ //! Considers a category number, by default 0
+ Handle(Transfer_Binder) MapItem (const Standard_Integer num) const { return themap.FindFromIndex(num); }
+
+ //! Declares <obj> (and its Result) as Root. This status will be
+ //! later exploited by RootResult, see below (Result can be
+ //! produced at any time)
+ void SetRoot (const Handle(Standard_Transient) &start)
+ {
+ Standard_Integer index = MapIndex(start);
+ if (index == 0)
+ return;
+ theroots.Add(index);
+ if (thetrace > 2) StartTrace (MapItem(index),start,thelevel,3);
+ }
+
+ //! Enable (if <stat> True) or Disables (if <stat> False) Root
+ //! Management. If it is set, Transfers are considered as stacked
+ //! (a first Transfer commands other Transfers, and so on) and
+ //! the Transfers commanded by an external caller are "Root".
+ //! Remark : SetRoot can be called whatever this status, on every
+ //! object.
+ //! Default is set to True.
+ void SetRootManagement (const Standard_Boolean stat) { therootm = stat; }
+
+ //! Returns the count of recorded Roots
+ Standard_Integer NbRoots() const { return theroots.Extent(); }
+
+ //! Returns a Root Entity given its number in the list (1-NbRoots)
+ Standard_EXPORT const Handle(Standard_Transient) & Root (const Standard_Integer num) const
+ {
+ Standard_Integer ind = 0;
+ if (num > 0 && num <= theroots.Extent()) ind = theroots.FindKey(num);
+ return themap.FindKey (ind);
+ }
+
+ //! Returns the index in the list of roots for a starting item,
+ //! or 0 if it is not recorded as a root
+ Standard_EXPORT Standard_Integer RootIndex (const Handle(Standard_Transient) &start) const
+ {
+ Standard_Integer index = MapIndex(start);
+ if (index == 0) return 0;
+ return theroots.FindIndex(index);
+ }
+
+ //! Performs the Transfer of a Source Object.
+ //! Mapping and Roots are managed : nothing is done if a Result is
+ //! already Bound, an exception is raised in case of error.
+ Standard_EXPORT Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient) &theSource);
+
+ //! Same as Transferring but does not return the Binder.
+ //! Simply returns True in case of success (for user call)
+ Standard_Boolean Transfer (const Handle(Standard_Transient) &theSource)
+ {
+ Handle(Transfer_Binder) binder = Transferring(theSource);
+ return (!binder.IsNull());
+ }
+
+ //! Method called when trace is asked
+ //! Calls PrintTrace to display information relevant for starting
+ //! objects (which can be redefined)
+ //! <level> is Nesting Level of Transfer (0 = root)
+ //! <mode> controls the way the trace is done :
+ //! 0 neutral, 1 for Error, 2 for Warning message, 3 for new Root
+ Standard_EXPORT void StartTrace (const Handle(Transfer_Binder)& binder, const Handle(Standard_Transient) &start, const Standard_Integer level, const Standard_Integer mode) const;
+
+ //! Prints statistics on transfer
+ Standard_EXPORT void PrintStats(const Handle(Message_Messenger)& S) const;
+
+ //! Returns, as an iterator, the log of root transfer, i.e. the
+ //! created objects and Binders bound to starting roots
+ //! If withstart is given True, Starting Objets are also returned
+ Standard_EXPORT Iterator RootResult (const Standard_Boolean withstart = Standard_False) const;
+
+ //! Returns, as an Iterator, the entire log of transfer (list of
+ //! created objects and Binders which can bring errors)
+ //! If withstart is given True, Starting Objets are also returned
+ Standard_EXPORT Iterator CompleteResult (const Standard_Boolean withstart = Standard_False) const;
+
+ //! Returns Binders which are neither "Done" nor "Initial",
+ //! that is Error,Loop or Run (abnormal states at end of Transfer)
+ //! Starting Objects are given in correspondance in the iterator
+ Standard_EXPORT Iterator AbnormalResult() const;
+
+ //! Returns a CheckList as a list of Check : each one is for a
+ //! starting entity which have either check (warning or fail)
+ //! messages are attached, or are in abnormal state : that case
+ //! gives a specific message
+ //! If <erronly> is True, checks with Warnings only are ignored
+ Standard_EXPORT Interface_CheckIterator CheckList (const Standard_Boolean erronly) const;
+
+ //! Sets Progress indicator
+ void SetProgress (const Handle(Message_ProgressIndicator)& theProgress) { myProgress = theProgress; }
+
+ //! Gets Progress indicator
+ const Handle(Message_ProgressIndicator) & GetProgress() const { return myProgress; }
+
+ DEFINE_STANDARD_RTTIEXT(Transfer_Process,MMgt_TShared)
+
+ protected:
+
+ //! Adds an information message
+ //! Trace is filled if trace level is at least 3
+ Standard_EXPORT void SendMsg (const Handle(Standard_Transient) &start, const Message_Msg& amsg);
+
+ //! Computes a number to be associated to a starting object in
+ //! a check or a check-list
+ //! By default, returns 0; can be redefined
+ Standard_EXPORT virtual Standard_Integer CheckNum (const Handle(Standard_Transient) &) const { return 0; }
+
+ //! Prints a short information on a source object.
+ Standard_EXPORT virtual void PrintTrace (const Handle(Standard_Transient) &theSource, const Handle(Message_Messenger)& S) const;
+
+ Handle(Interface_InterfaceModel) themodel;
+
+ private:
+
+ //! Same as Find but stores the last access to the map, for a
+ //! faster access on next calls (as Bind does too)
+ const Handle(Transfer_Binder) & FindAndMask (const Handle(Standard_Transient) &start)
+ {
+ if (thelastobj == start) {
+ if (theindex > 0) return thelastbnd;
+ }
+ thelastobj = start;
+ theindex = themap.FindIndex (start);
+ if (theindex > 0) thelastbnd = themap.FindFromIndex(theindex);
+ else thelastbnd.Nullify();
+ return thelastbnd;
+ }
+
+ Handle(Message_Messenger) themessenger;
+ Standard_Integer thetrace;
+ Standard_Integer thelevel;
+ Standard_Integer therootl;
+ Standard_Boolean therootm;
+ TColStd_IndexedMapOfInteger theroots;
+ Handle(Standard_Transient) thelastobj;
+ Handle(Transfer_Binder) thelastbnd;
+ Standard_Integer theindex;
+ Handle(Actor) theactor;
+ Transfer_MapOfProcess themap;
+ Handle(Message_ProgressIndicator) myProgress;
+};
+
+#endif // _Transfer_Process_HeaderFile
+++ /dev/null
-// Created on: 1992-02-03
-// 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 _Transfer_ProcessForFinder_HeaderFile
-#define _Transfer_ProcessForFinder_HeaderFile
-
-#include <Transfer_ProcessGen.hxx>
-
-#include <TColStd_HSequenceOfTransient.hxx>
-
-typedef Transfer_ProcessGen<Handle(Standard_Transient),TColStd_HSequenceOfTransient> Transfer_ProcessForFinder;
-
-#endif // _Transfer_ProcessForFinder_HeaderFile
+++ /dev/null
-// Created on: 1992-02-03
-// 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 _Transfer_ProcessForTransient_HeaderFile
-#define _Transfer_ProcessForTransient_HeaderFile
-
-#include <Transfer_ProcessGen.hxx>
-
-#include <TColStd_HSequenceOfTransient.hxx>
-
-typedef Transfer_ProcessGen<Handle(Standard_Transient),TColStd_HSequenceOfTransient> Transfer_ProcessForTransient;
-
-#endif // _Transfer_ProcessForTransient_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.
-
-// TheSourceType is assumed Handle(Standard_Transient) or Handle(Transfer_Finder)
-// It should provide : "==" , .IsNull() , ->DynamicType()
-
-#ifndef _Transfer_ProcessGen_HeaderFile
-#define _Transfer_ProcessGen_HeaderFile
-
-#include <MMgt_TShared.hxx>
-
-#include <Standard_ErrorHandler.hxx>
-#include <Standard_Failure.hxx>
-
-#include <Message_Messenger.hxx>
-#include <Message_Msg.hxx>
-#include <Message.hxx>
-
-class Interface_InterfaceModel;
-#include <Interface_MSG.hxx>
-#include <Interface_CheckIterator.hxx>
-
-class Transfer_Binder;
-#include <Transfer_Actor.hxx>
-#include <Transfer_Iterator.hxx>
-#include <Transfer_Finder.hxx>
-#include <Transfer_Hasher.hxx>
-
-#include <Transfer_VoidBinder.hxx>
-#include <Transfer_SimpleBinderOfTransient.hxx>
-#include <Transfer_StatusResult.hxx>
-#include <Transfer_TransferFailure.hxx>
-#include <Transfer_TransferDeadLoop.hxx>
-
-#include <TColStd_IndexedMapOfInteger.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-
-#include <NCollection_IndexedDataMap.hxx>
-
-
-template < class TheKeyType,
- class TheListType >
-class Transfer_ProcessGen : public MMgt_TShared
-{
- public:
-
- typedef NCollection_IndexedDataMap<TheKeyType,Handle(Transfer_Binder),Transfer_Hasher> Transfer_MapOfProcess;
-
- class Actor : public Transfer_Actor
- {
- public:
-
- Standard_EXPORT Actor() {}
-
- //! Prerequesite for Transfer : the method Transfer is
- //! called on a starting object only if Recognize has
- //! returned True on it
- //! This allows to define a list of Actors, each one
- //! processing a definite kind of data
- //! TransferProcess calls Recognize on each one before
- //! calling Transfer. But even if Recognize has returned
- //! True, Transfer can reject by returning a Null Binder
- //! (afterwards rejection), the next actor is then invoked
- //!
- //! The provided default returns True, can be redefined
- Standard_EXPORT virtual Standard_Boolean Recognize (const TheKeyType& /*start*/) { return Standard_True; }
-
- //! Specific action of Transfer. The Result is stored in
- //! the returned Binder, or a Null Handle for "No result"
- //! (Default defined as doing nothing; should be deffered)
- //! "mutable" allows the Actor to record intermediate
- //! information, in addition to those of TransferProcess
- Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const TheKeyType& /*start*/, const Handle(Transfer_ProcessGen)& /*TP*/) { return NULL; }
-
- //! Defines a Next Actor : it can then be asked to work if
- //! <me> produces no result for a given type of Object.
- //! If Next is already set and is not "Last", calls
- //! SetNext on it. If Next defined and "Last", the new
- //! actor is added before it in the list
- Standard_EXPORT void SetNext (const Handle(Actor)& next)
- {
- if (thenext == next) return;
- if (thenext.IsNull()) thenext = next;
- else thenext->SetNext(next);
- }
-
- //! Returns the Actor defined as Next, or a Null Handle
- const Handle(Actor) & Next() const { return thenext; }
-
- DEFINE_STANDARD_RTTI_INLINE(Actor,Transfer_Actor)
-
- protected:
-
- Handle(Actor) thenext;
- };
-
- class Iterator : public Transfer_Iterator
- {
- public:
-
- DEFINE_STANDARD_ALLOC
-
- //! Creates an empty Iterator
- //! If WithSource is True, each Binder to be iterated will
- //! be associated to its corresponding Source Object
- Standard_EXPORT Iterator(const Standard_Boolean WithSource)
- { if (WithSource) mySourceObjects = new TheListType(); }
-
- //! Adds a Binder to the iteration list (construction)
- //! with no corresponding Starting Object
- //! (note that Result is brought by Binder)
- Standard_EXPORT void Add (const Handle(Transfer_Binder)& theBinder)
- {
- if (!mySourceObjects.IsNull())
- Standard_NoSuchObject::Raise("Transfer_ProcessGen::Iterator::Add, Source Object required but not provided");
- AddItem(theBinder);
- }
-
- //! Adds a Binder to the iteration list, associated with
- //! its corresponding Starting Object "start"
- //! Starting Object is ignored if not required at
- //! Creation time
- Standard_EXPORT void Add (const Handle(Transfer_Binder)& theBinder, const TheKeyType& theSource)
- {
- AddItem(theBinder);
- if (!mySourceObjects.IsNull()) mySourceObjects->Append(theSource);
- }
-
- //! After having added all items, keeps or rejects items
- //! which are attached to starting data given by <list>
- //! <keep> = True (D) : keeps. <keep> = False : rejects
- //! Does nothing if <withstarts> was False
- Standard_EXPORT void Filter (const Handle(TheListType)& theList)
- {
- if (theList.IsNull() || mySourceObjects.IsNull()) return;
- Standard_Integer i, j, nb = mySourceObjects->Length();
- if (nb == 0) return;
- Handle(Transfer_Binder) factice;
- Transfer_MapOfProcess amap (nb);
- for (i = 1; i <= nb; i ++) {
- j = amap.Add (mySourceObjects->Value(i),factice);
- SelectItem (j,Standard_False);
- }
-
- // Comparaison
- nb = theList->Length();
- for (i = 1; i <= nb; i ++) {
- j = amap.FindIndex (theList->Value(i));
- if (j > 0) SelectItem (j,Standard_True);
- }
- }
-
- //! Returns corresponding Source Object
- Standard_EXPORT const TheKeyType& SourceObject() const
- {
- if (mySourceObjects.IsNull())
- Standard_NoSuchObject::Raise("Transfer_ProcessGen::Iterator : No Source Objects defined at all");
- return mySourceObjects->Value(thecurr);
- }
-
- private:
-
- Handle(TheListType) mySourceObjects;
- };
-
- public:
-
- //! Sets TransferProcess at initial state. Gives an Initial size
- //! (indicative) for the Map when known (default is 10000).
- //! Sets default trace file as a printer and default trace level
- //! (see Message_TraceFile).
- Standard_EXPORT Transfer_ProcessGen(const Standard_Integer nb = 10000)
- : themap (nb)
- {
- therootm = Standard_False;
- thelevel = 0; therootl = 0;
- themessenger = Message::DefaultMessenger();
- thetrace = 0;
- theindex = 0;
- }
-
- //! Sets TransferProcess at initial state. Gives an Initial size
- //! (indicative) for the Map when known (default is 10000).
- //! Sets a specified printer.
- Standard_EXPORT Transfer_ProcessGen(const Handle(Message_Messenger)& messenger, const Standard_Integer nb = 10000)
- : themap (nb)
- {
- therootm = Standard_False;
- thelevel = 0; therootl = 0;
- SetMessenger (messenger);
- thetrace = 1;
- theindex = 0;
- }
-
- //! Sets an InterfaceModel, which can be used during transfer
- //! for instance if a context must be managed, it is in the Model
- void SetModel (const Handle(Interface_InterfaceModel)& model) { themodel = model; }
-
- //! Returns the Model which can be used for context
- const Handle(Interface_InterfaceModel)& Model() const { return themodel; }
-
- //! Resets a TransferProcess as ready for a completely new work.
- //! Clears general data (roots) and the Map
- Standard_EXPORT void Clear()
- {
- thelevel = 0; therootl = 0;
- theroots.Clear();
- themap.Clear();
- theindex = 0; thelastobj.Nullify(); thelastbnd.Nullify();
- }
-
- //! Rebuilds the Map and the roots to really remove Unbound items
- //! Because Unbind keeps the entity in place, even if not bound
- //! Hence, working by checking new items is meaningless if a
- //! formerly unbound item is rebound
- Standard_EXPORT void Clean()
- {
- Standard_Integer i, nb = NbMapped();
- Standard_Integer j,unb = 0;
- for (i = 1; i <= nb; i ++) {
- if (themap(i).IsNull()) unb ++;
- }
- if (unb == 0) return;
-
- // Refaire la map -> decalages
- TColStd_Array1OfInteger unbs (1,nb); unbs.Init(0);
- Transfer_TransferMap newmap (nb*2);
- for (i = 1; i <= nb; i ++) {
- TheKeyType ent = Mapped(i);
- Handle(Transfer_Binder) bnd = MapItem(i);
- if (bnd.IsNull()) continue;
- j = newmap.Add (ent,bnd);
- unbs.SetValue (i,j);
- }
- themap.Assign (newmap);
-
- // Update the map of roots
- TColStd_IndexedMapOfInteger aNewRoots;
- for( i=1; i<= theroots.Extent(); i++ ) {
- j = theroots.FindKey(i);
- Standard_Integer k = unbs.Value(j);
- if ( k ) aNewRoots.Add ( k );
- }
- theroots.Clear();
- theroots = aNewRoots;
-
- // Le reste : nettoyage
- thelastobj.Nullify();
- thelastbnd.Nullify();
- theindex = 0;
- }
-
- //! Resizes the Map as required (if a new reliable value has been
- //! determined). Acts only if <nb> is greater than actual NbMapped
- Standard_EXPORT void Resize (const Standard_Integer nb) { if (nb > themap.NbBuckets()) themap.ReSize(nb); }
-
- //! Defines an Actor, which is used for automatic Transfer
- //! If already defined, the new Actor is cumulated
- //! (see SetNext from Actor)
- Standard_EXPORT void SetActor (const Handle(Actor)& actor)
- {
- if (theactor == actor) return;
- if (theactor.IsNull()) theactor = actor;
- else if (actor.IsNull()) theactor = actor; // declenche RAZ
- else theactor->SetNext(actor);
- }
-
- //! Returns the Binder which is linked with a starting Object
- //! It can either bring a Result (Transfer done) or none (for a
- //! pre-binding).
- //! If no Binder is linked with <start>, returns a Null Handle
- //! Considers a category number, by default 0
- Standard_EXPORT Handle(Transfer_Binder) Find (const TheKeyType& start) const
- {
- if (thelastobj == start) {
- if (theindex > 0) return thelastbnd;
- }
- const Standard_Integer index = themap.FindIndex (start);
- if (index > 0) {
- return themap.FindFromIndex(index);
- }
- return NULL;
- }
-
- //! Returns True if a Result (whatever its form) is Bound with a starting Object.
- //! I.e., if a Binder with a Result set, is linked with it
- Standard_EXPORT Standard_Boolean IsBound (const TheKeyType& start) const
- {
- Handle(Transfer_Binder) binder = Find(start);
- return (binder.IsNull()? Standard_False : binder->HasResult());
- }
-
- //! Creates a Link a starting Object with a Binder. This Binder
- //! can either bring a Result (effective Binding) or none (it can
- //! be set later : pre-binding).
- //! Considers a category number, by default 0
- Standard_EXPORT void Bind (const TheKeyType& start, const Handle(Transfer_Binder)& binder)
- {
- if (binder.IsNull()) return;
- Handle(Transfer_Binder) former = FindAndMask(start);
- if (!former.IsNull()) {
- // On admet VoidBinder : alors on reprend son Check
- if (former->DynamicType() == STANDARD_TYPE(Transfer_VoidBinder)) {
- binder->Merge(former);
- themap(theindex) = binder; // Substitution
- }
- else if (former->Status() == Transfer_StatusUsed) {
- StartTrace (former,start,thelevel,4);
- Transfer_TransferFailure::Raise ("TransferProcess : Bind, already Bound");
- }
- else {
- if (thetrace > 2) StartTrace (former,start,thelevel,5);
- binder->CCheck()->GetMessages (former->Check());
- }
- }
- if (theindex == 0 || thelastbnd.IsNull()) {
- if (theindex == 0) theindex = themap.Add(start,binder); // Nouveau
- else themap(theindex) = binder; // idem en fait
- thelastbnd = binder;
- }
- else {
- thelastbnd = binder;
- themap(theindex) = binder;
- }
- }
-
- //! Removes the Binder linked with a starting object
- //! If this Binder brings a non-empty Check, it is replaced by
- //! a VoidBinder. Also removes from the list of Roots as required.
- //! Returns True if done, False if <start> was not bound
- //! Considers a category number, by default 0
- Standard_EXPORT Standard_Boolean Unbind (const TheKeyType& start)
- {
- Handle(Transfer_Binder) former = FindAndMask(start);
- if (theindex == 0) return Standard_False;
- if (former.IsNull()) return Standard_False;
- if (former->DynamicType() == STANDARD_TYPE(Transfer_VoidBinder)) return Standard_True;
- themap(theindex) = thelastbnd;
- if(theroots.Contains(theindex)) {
- TColStd_IndexedMapOfInteger aNewRoots;
- for(Standard_Integer i = 1; i <= theroots.Extent(); i++)
- if(theindex!= theroots.FindKey(i))
- aNewRoots.Add(theroots.FindKey(i));
-
- theroots.Clear();
- theroots = aNewRoots;
- }
-
- thelastobj.Nullify();
- thelastbnd.Nullify();
- theindex = 0;
- return Standard_True;
- }
-
- //! Sets Messenger used for outputting messages.
- Standard_EXPORT void SetMessenger (const Handle(Message_Messenger)& messenger)
- { themessenger = messenger.IsNull()? Message::DefaultMessenger() : messenger; }
-
- //! Returns Messenger used for outputting messages.
- //! The returned object is guaranteed to be non-null;
- //! default is Message::Messenger().
- Standard_EXPORT const Handle(Message_Messenger) & Messenger() const { return themessenger; }
-
- //! Sets trace level used for outputting messages:
- //! <trace> = 0 : no trace at all
- //! <trace> = 1 : handled exceptions and calls to AddError
- //! <trace> = 2 : also calls to AddWarning
- //! <trace> = 3 : also traces new Roots
- //! (uses method ErrorTrace).
- //! Default is 1 : Errors traced
- Standard_EXPORT void SetTraceLevel (const Standard_Integer tracelev) { thetrace = tracelev; }
-
- //! Returns trace level used for outputting messages.
- Standard_EXPORT Standard_Integer TraceLevel() const { return thetrace; }
-
- //! New name for AddFail (Msg)
- Standard_EXPORT void SendFail (const TheKeyType& start, const Message_Msg& amsg) { AddFail(start,amsg); }
-
- //! New name for AddWarning (Msg)
- Standard_EXPORT void SendWarning (const TheKeyType& start, const Message_Msg& amsg) { AddWarning(start,amsg); }
-
- //! Adds an information message
- //! Trace is filled if trace level is at least 3
- Standard_EXPORT void SendMsg (const TheKeyType& start, const Message_Msg& amsg)
- {
- Handle(Transfer_Binder) binder = FindAndMask(start);
- if (binder.IsNull()) {
- binder = new Transfer_VoidBinder;
- Bind (start,binder);
- }
- // Alimente la trace : Regle causant (user messages)
- if (thetrace > 0) {
- StartTrace (binder,start,thelevel,6);
- themessenger << amsg.Value();
- if (amsg.IsEdited()&&thetrace>2)
- themessenger << " [from: " << amsg.Original() << "]";
- themessenger << endl;
- }
- }
-
- //! Adds an Error message to a starting entity (to the check of
- //! its Binder of category 0, as a Fail)
- Standard_EXPORT void AddFail (const TheKeyType& start, const Standard_CString mess, const Standard_CString orig = "")
- {
- Handle(Transfer_Binder) binder = FindAndMask(start);
- if (binder.IsNull()) {
- binder = new Transfer_VoidBinder;
- Bind (start,binder);
- }
- binder->AddFail (mess,orig);
- if (thetrace > 0) {
- StartTrace (binder,start,thelevel,1);
- themessenger << " --> Fail : " << mess;
- if (orig[0] != '\0'&&thetrace>2) themessenger << " [from: " << orig << "]";
- themessenger << endl;
- }
- }
-
- //! (other name of AddFail, maintained for compatibility)
- Standard_EXPORT void AddError (const TheKeyType& start, const Standard_CString mess, const Standard_CString orig = "")
- { AddFail (start,mess,orig); }
-
- //! Adds an Error Message to a starting entity from the definition
- //! of a Msg (Original+Value)
- Standard_EXPORT void AddFail (const TheKeyType& start, const Message_Msg& amsg)
- {
- if (amsg.IsEdited()) AddFail (start,TCollection_AsciiString(amsg.Value()).ToCString(), TCollection_AsciiString(amsg.Original()).ToCString());
- else AddFail (start,TCollection_AsciiString(amsg.Value()).ToCString());
- }
-
- //! Adds a Warning message to a starting entity (to the check of
- //! its Binder of category 0)
- Standard_EXPORT void AddWarning (const TheKeyType& start, const Standard_CString mess, const Standard_CString orig = "")
- {
- Handle(Transfer_Binder) binder = FindAndMask(start);
- if (binder.IsNull()) {
- binder = new Transfer_VoidBinder;
- Bind (start,binder);
- }
- binder->AddWarning(mess,orig);
- if (thetrace > 1) {
- StartTrace (binder,start,thelevel,2);
- themessenger << " --> Warning : " << mess;
- if (orig[0] != '\0'&&thetrace>2) themessenger << " [from: " << orig << "]";
- themessenger << endl;
- }
- }
-
- //! Adds a Warning Message to a starting entity from the definition
- //! of a Msg (Original+Value)
- Standard_EXPORT void AddWarning (const TheKeyType& start, const Message_Msg& amsg)
- {
- if (amsg.IsEdited()) AddWarning (start,TCollection_AsciiString(amsg.Value()).ToCString(), TCollection_AsciiString(amsg.Original()).ToCString());
- else AddWarning (start,TCollection_AsciiString(amsg.Value()).ToCString());
- }
-
- //! Returns the Check attached to a starting entity. If <start>
- //! is unknown, returns an empty Check
- //! Adds a case name to a starting entity
- //! Adds a case value to a starting entity
- //! Returns the complete case list for an entity. Null Handle if empty
- //! In the list of mapped items (between 1 and NbMapped),
- //! searches for the first item which follows <num0>(not included)
- //! and which has an attribute named <name>
- //! Attributes are brought by Binders
- //! Hence, allows such an iteration
- //!
- //! for (num = TP->NextItemWithAttribute(name,0);
- //! num > 0;
- //! num = TP->NextItemWithAttribute(name,num) {
- //! .. process mapped item <num>
- //! }
- //! Returns the type of an Attribute attached to binders
- //! If this name gives no Attribute, returns ParamVoid
- //! If this name gives several different types, returns ParamMisc
- //! Else, returns the effective type (ParamInteger, ParamReal,
- //! ParamIdent, or ParamText)
- //! Returns the list of recorded Attribute Names, as a Dictionary
- //! of Integer : each value gives the count of items which bring
- //! this attribute name
- //! By default, considers all the attribute names
- //! If <rootname> is given, considers only the attribute names
- //! which begin by <rootname>
- Standard_EXPORT Handle(Interface_Check) Check (const TheKeyType& start) const
- {
- const Handle(Transfer_Binder)& binder = Find(start);
- return (binder.IsNull()? NULL : binder->Check());
- }
-
- //! Binds a starting object with a Transient Result.
- //! Uses a SimpleBinderOfTransient to work. If there is already
- //! one but with no Result set, sets its Result.
- //! Considers a category number, by default 0
- Standard_EXPORT void BindTransient (const TheKeyType& start, const Handle(Standard_Transient)& res)
- {
- if (res.IsNull()) return;
- Handle(Transfer_SimpleBinderOfTransient) binder = Handle(Transfer_SimpleBinderOfTransient)::DownCast(Find(start));
- // Binding sur place ?
- if (!binder.IsNull() && binder->Status() == Transfer_StatusVoid) {
- binder->SetResult(res); return;
- }
- // Sinon, refaire
- binder = new Transfer_SimpleBinderOfTransient(res);
- Bind(start,binder);
- }
-
- //! Returns the Result of the Transfer of an object <start> as a
- //! Transient Result.
- //! Returns a Null Handle if there is no Transient Result
- //! Considers a category number, by default 0
- //! Warning : Supposes that Binding is done with a SimpleBinderOfTransient
- Standard_EXPORT Handle(Standard_Transient) FindTransient (const TheKeyType& start) const
- {
- Handle(Transfer_SimpleBinderOfTransient) binder = Handle(Transfer_SimpleBinderOfTransient)::DownCast(Find(start));
- if (binder.IsNull()) return NULL;
- if (!binder->HasResult()) return NULL;
- return binder->Result();
- }
-
- //! Searches for a transient result attached to a starting object,
- //! according to its type, by criterium IsKind(atype)
- //!
- //! In case of multiple result, explores the list and gives in
- //! <val> the first transient result IsKind(atype)
- //! Returns True and fills <val> if found
- //! Else, returns False (<val> is not touched, not even nullified)
- //!
- //! This syntactic form avoids to do DownCast : if a result is
- //! found with the good type, it is loaded in <val> and can be
- //! immediately used, well initialised
- Standard_EXPORT Standard_Boolean FindTypedTransient (const TheKeyType& start, const Handle(Standard_Type)& atype, Handle(Standard_Transient)& val) const
- { return GetTypedTransient (Find(start),atype,val); }
-
- //! Safe variant for arbitrary type of argument
- template <class T>
- Standard_Boolean FindTypedTransient (const TheKeyType& start, const Handle(Standard_Type)& atype, Handle(T)& val) const
- {
- Handle(Standard_Transient) aVal = val;
- return FindTypedTransient (start, atype, aVal) && ! (val = Handle(T)::DownCast(aVal)).IsNull();
- }
-
- //! Searches for a transient result recorded in a Binder, whatever
- //! this Binder is recorded or not in <me>
- //!
- //! This is strictly equivalent to the class method GetTypedResult
- //! from class SimpleBinderOfTransient, but is just lighter to call
- //!
- //! Apart from this, works as FindTypedTransient
- Standard_EXPORT Standard_Boolean GetTypedTransient (const Handle(Transfer_Binder)& binder, const Handle(Standard_Type)& atype, Handle(Standard_Transient)& val) const
- { return Transfer_SimpleBinderOfTransient::GetTypedResult(binder,atype,val); }
-
- //! Safe variant for arbitrary type of argument
- template <class T>
- Standard_Boolean GetTypedTransient (const Handle(Transfer_Binder)& start, const Handle(Standard_Type)& atype, Handle(T)& val) const
- {
- Handle(Standard_Transient) aVal = val;
- return GetTypedTransient (start, atype, aVal) && ! (val = Handle(T)::DownCast(aVal)).IsNull();
- }
-
- //! Returns the maximum possible value for Map Index
- //! (no result can be bound with a value greater than it)
- Standard_EXPORT Standard_Integer NbMapped() const { return themap.Extent(); }
-
- //! Returns the Starting Object bound to an Index,
- Standard_EXPORT const TheKeyType& Mapped (const Standard_Integer num) const { return themap.FindKey(num); }
-
- //! Returns the Index value bound to a Starting Object, 0 if none
- Standard_EXPORT Standard_Integer MapIndex (const TheKeyType& start) const { return themap.FindIndex(start); }
-
- //! Returns the Binder bound to an Index
- //! Considers a category number, by default 0
- Standard_EXPORT Handle(Transfer_Binder) MapItem (const Standard_Integer num) const { return themap.FindFromIndex(num); }
-
- //! Declares <obj> (and its Result) as Root. This status will be
- //! later exploited by RootResult, see below (Result can be
- //! produced at any time)
- Standard_EXPORT void SetRoot (const TheKeyType& start)
- {
- Standard_Integer index = MapIndex(start);
- if (index == 0)
- return;
- theroots.Add(index);
- if (thetrace > 2) StartTrace (MapItem(index),start,thelevel,3);
- }
-
- //! Enable (if <stat> True) or Disables (if <stat> False) Root
- //! Management. If it is set, Transfers are considered as stacked
- //! (a first Transfer commands other Transfers, and so on) and
- //! the Transfers commanded by an external caller are "Root".
- //! Remark : SetRoot can be called whatever this status, on every
- //! object.
- //! Default is set to True.
- Standard_EXPORT void SetRootManagement (const Standard_Boolean stat) { therootm = stat; }
-
- //! Returns the count of recorded Roots
- Standard_EXPORT Standard_Integer NbRoots() const { return theroots.Extent(); }
-
- //! Returns a Root Entity given its number in the list (1-NbRoots)
- Standard_EXPORT const TheKeyType& Root (const Standard_Integer num) const
- {
- Standard_Integer ind = 0;
- if (num > 0 && num <= theroots.Extent()) ind = theroots.FindKey(num);
- return themap.FindKey (ind);
- }
-
- //! Returns the Binder bound with a Root Entity given its number
- //! Considers a category number, by default 0
- Standard_EXPORT Handle(Transfer_Binder) RootItem (const Standard_Integer num) const
- {
- Standard_Integer ind = 0;
- if (num > 0 && num <= theroots.Extent()) ind = theroots.FindKey(num);
- return themap.FindFromIndex(ind);
- }
-
- //! Returns the index in the list of roots for a starting item,
- //! or 0 if it is not recorded as a root
- Standard_EXPORT Standard_Integer RootIndex (const TheKeyType& start) const
- {
- Standard_Integer index = MapIndex(start);
- if (index == 0) return 0;
- return theroots.FindIndex(index);
- }
-
- //! Returns Nesting Level of Transfers (managed by methods
- //! TranscriptWith & Co). Starts to zero. If no automatic Transfer
- //! is used, it remains to zero. Zero means Root Level.
- Standard_EXPORT Standard_Integer NestingLevel() const { return thelevel; }
-
- //! Resets Nesting Level of Transfers to Zero (Root Level),
- //! whatever its current value.
- Standard_EXPORT void ResetNestingLevel() { thelevel = 0; }
-
- //! Tells if <start> has been recognized as good candidate for
- //! Transfer. i.e. queries the Actor and its Nexts
- Standard_EXPORT Standard_Boolean Recognize (const TheKeyType& start) const
- {
- Handle(Actor) actor = theactor;
- // On balaie les Next jusqu a avoir un Resultat
- while (!actor.IsNull()) {
- if (actor->Recognize (start)) return Standard_True;
- actor = actor->Next();
- }
- return Standard_False;
- }
-
- //! Performs the Transfer of a Source Object.
- //! Mapping and Roots are managed : nothing is done if a Result is
- //! already Bound, an exception is raised in case of error.
- Standard_EXPORT Handle(Transfer_Binder) Transferring (const TheKeyType& theSource)
- {
- // Map deja alimentee ?
- Handle(Transfer_Binder) former = FindAndMask(theSource);
-
- // .... Transfert deja effectue avec Resultat ? ....
-
- // On considere que cette nouvelle demande de Transfert correspond donc a une
- // utilisation en plus : noter "AlreadyUsed", donc resultat non modifiable
- if (!former.IsNull()) {
- if (former->HasResult()) {
- former->SetAlreadyUsed();
- return former;
- }
-
- // .... Etat Initial : peut-etre deja fait ... ou infaisable !
- Transfer_StatusExec statex = former->StatusExec();
- switch (statex) {
- case Transfer_StatusInitial : // Transfert prepare a faire
- break;
- case Transfer_StatusDone : // Transfert deja fait
- themessenger << " .. and Transfer done" << endl;
- return former;
- case Transfer_StatusRun : // ca y est, on boucle
- former->SetStatusExec(Transfer_StatusLoop);
- return former;
- case Transfer_StatusError : // pas propre, ca ...
- if (thetrace) {
- themessenger << " *** Transfer in Error Status :" << endl;
- StartTrace (former, theSource, thelevel,0);
- }
- else StartTrace (former,theSource,thelevel,4);
- Transfer_TransferFailure::Raise("TransferProcess : Transfer in Error Status");
- case Transfer_StatusLoop : // la boucle est bouclee ...
- if (thetrace) {
- themessenger << " *** Transfer Head of Dead Loop :" << endl;
- StartTrace (former,theSource,thelevel,0);
- }
- else StartTrace (former,theSource,thelevel,4);
- Transfer_TransferDeadLoop::Raise("TransferProcess : Transfer at Head of a Dead Loop");
- }
-
- // .... OK, on peut lancer l Execution
- former->SetStatusExec(Transfer_StatusRun);
- }
-
- Handle(Transfer_Binder) binder;
- Standard_Boolean newbind = Standard_False;
-
- // Transfert sous protection pour les exceptions (pour notification en fait)
- const Standard_Integer oldlev = thelevel;
- try {
- OCC_CATCH_SIGNALS
- //! Invokes the Actor to work (set by SetActor), and tries its Nexts if no result is produced,
- //! until a Non Null Binder is produced.
- //! But keep in mind that a Null Binder can allways be returned
- //! if a Starting Entity has not been recognized at all.
- thelevel ++; // si decremente et == 0, transfert racine
-
- Handle(Actor) actor = theactor;
- // On balaie les Next jusqu a avoir un Resultat
- while (!actor.IsNull()) {
- if (actor->Recognize (theSource)) binder = actor->Transferring(theSource,this);
- else binder.Nullify();
- if (!binder.IsNull()) break;
- actor = actor->Next();
- }
-
- if (!binder.IsNull()) {
- // Gestion du niveau racine (.. a regarder de pres ..)
- if (therootl == 0 && binder->StatusExec() == Transfer_StatusDone)
- therootl = thelevel - 1;
- }
-
- if (thelevel > 0) thelevel --;
- }
-
- // ... Exceptions a Rattraper : elles ne se ressemblent pas toutes ... !
- catch (Transfer_TransferDeadLoop) {
- if (binder.IsNull()) {
- themessenger << " *** Dead Loop with no Result" << endl;
- if (thetrace) StartTrace (binder,theSource,thelevel-1,0);
- binder = new Transfer_VoidBinder;
- Bind (theSource,binder); newbind = Standard_True;
- } else if (binder->StatusExec() == Transfer_StatusLoop) {
- if (thetrace) {
- themessenger << " *** Dead Loop : Finding head of Loop :" << endl;
- StartTrace (binder,theSource,thelevel-1,0);
- }
- else StartTrace (binder,theSource,thelevel-1,4);
- Transfer_TransferFailure::Raise("TransferProcess : Head of Dead Loop");
- // Autrement dit, on change d exception (on est sorti de la boucle)
- } else {
- if (thetrace) {
- themessenger << " *** Dead Loop : Actor in Loop :" << endl;
- StartTrace (binder,theSource,thelevel-1,0);
- }
- }
- binder->AddFail("Transfer in dead Loop");
- thelevel = oldlev;
- }
- catch (Standard_Failure) {
- if (binder.IsNull()) {
- themessenger << " *** Exception Raised with no Result" << endl;
- binder = new Transfer_VoidBinder;
- Bind (theSource,binder); newbind = Standard_True;
- }
- binder->AddFail("Transfer stopped by exception raising");
- if (thetrace) {
- themessenger << " *** Raised : " << Standard_Failure::Caught()->GetMessageString() << endl;
- StartTrace (binder,theSource,thelevel-1,4);
- }
- thelevel = oldlev;
- }
-
- // .... Conclusion : Noter dans la Map ....
- if (!newbind && !binder.IsNull()) {
- Bind(theSource,binder);
- }
- else {
- //= by ABV: 5 Oct 97: nothing generated, but former can be in run state - drop it
- //= ASK: may be set it to StatusInitial ?
- if ( !former.IsNull() ) former->SetStatusExec ( Transfer_StatusDone ); //+
- return NULL; // Binder Null ... que faire d autre ?
- }
-
- // .... Gerer les Racines (si prevu) ....
- if (therootl >= thelevel) {
- therootl = 0;
- if (therootm && binder->Status() != Transfer_StatusVoid) {
- SetRoot (theSource);
- }
- }
- return thelastbnd;
- }
-
- //! Same as Transferring but does not return the Binder.
- //! Simply returns True in case of success (for user call)
- Standard_EXPORT Standard_Boolean Transfer (const TheKeyType& theSource)
- {
- Handle(Transfer_Binder) binder = Transferring(theSource);
- return (!binder.IsNull());
- }
-
- //! Method called when trace is asked
- //! Calls PrintTrace to display information relevant for starting
- //! objects (which can be redefined)
- //! <level> is Nesting Level of Transfer (0 = root)
- //! <mode> controls the way the trace is done :
- //! 0 neutral, 1 for Error, 2 for Warning message, 3 for new Root
- Standard_EXPORT void StartTrace (const Handle(Transfer_Binder)& binder, const TheKeyType& start, const Standard_Integer level, const Standard_Integer mode) const
- {
- // ### Fail (Roots:50) -- Start start->DynamicType()
- // ### Fail (Roots:50) -- Start id:#label.. Type:start->DynamicType()
- if (thetrace > 3) { // Internal to be switch when searching bug (trace >= 4)
- if (mode == 1) themessenger << " ### Fail";
- if (mode == 2) themessenger << " ### Warning";
- if (mode == 3) themessenger << " ### New Root n0 " << theroots.Extent();
- if (mode == 4) themessenger << " ### Exception";
- if (mode == 5) themessenger << " ### Substitution";
- if (mode == 6) themessenger << " ### Information";
- if (level > 1)
- themessenger << " (nested)"; // " at nesting Level:"<<level;
- if (mode >= 0 && mode != 3)
- themessenger << " at " << theroots.Extent() << " Roots";
- }
- if (!start.IsNull()) PrintTrace (start,themessenger);
-
- if (!binder.IsNull()) {
- Handle(Transfer_Binder) bnd = binder;
- Standard_Boolean hasres = Standard_False;
- while (!bnd.IsNull()) {
- if (bnd->Status() != Transfer_StatusVoid) {
- // --- Result Type: binder->ResultType() --- Binder : binder->DynamicType();
- if (!hasres)
- themessenger << "\n --- Result Type : ";
- else
- themessenger << " , ";
- themessenger << bnd->ResultTypeName();
- hasres = Standard_True;
- }
- bnd = bnd->NextResult();
- }
- if (!hasres && mode > 2) {
- themessenger << "\n --- No Result recorded";
- }
- }
- themessenger << endl;
- }
-
- //! Prints a short information on a source object.
- Standard_EXPORT virtual void PrintTrace (const TheKeyType& theSource, const Handle(Message_Messenger)& S) const
- {
- if (!theSource.IsNull()) {
- Handle(Transfer_Finder) aFinder = Handle(Transfer_Finder)::DownCast(theSource);
- S << " Type:" << (aFinder.IsNull()? theSource->DynamicType()->Name() : aFinder->ValueTypeName());
- }
- }
-
- //! Prints statistics on transfer
- void PrintStats(const Handle(Message_Messenger)& S) const
- {
- S<<"\n*******************************************************************\n";
- S << "******** Basic Statistics ********"<<endl;
-
- if (themodel.IsNull())
- S<<"**** Model unknown"<<endl;
- else
- S<<"**** Nb Entities : "<<themodel->NbEntities()<<endl;
-
- Standard_Integer nbr = 0, nbe = 0, nbw = 0;
- Standard_Integer i, max = NbMapped(), nbroots = NbRoots();
- S << "**** Nb Final Results : "<<nbroots<<endl;
-
- for (i = 1; i <= max; i ++) {
- const Handle(Transfer_Binder)& binder = MapItem(i);
- if (binder.IsNull()) continue;
- const Handle(Interface_Check) ach = binder->Check();
- Transfer_StatusExec stat = binder->StatusExec();
- if (stat != Transfer_StatusInitial && stat != Transfer_StatusDone)
- nbe ++;
- else {
- if (ach->NbWarnings() > 0) nbw++;
- if (binder->HasResult()) nbr++;
- }
- }
- if (nbr > nbroots)
- S<<"**** ( Itermediate Results : "<<nbr-nbroots<<" )\n";
- if (nbe > 0)
- S<<"**** Errors on : "<<Interface_MSG::Blanks(nbe,4)<<nbe<<" Entities\n";
- if (nbw > 0)
- S<<"**** Warnings on : "<<Interface_MSG::Blanks(nbw,4)<<nbw<<" Entities\n";
- S<<"*******************************************************************\n";
- }
-
- //! Returns, as an iterator, the log of root transfer, i.e. the
- //! created objects and Binders bound to starting roots
- //! If withstart is given True, Starting Objets are also returned
- Standard_EXPORT Iterator RootResult (const Standard_Boolean withstart = Standard_False) const
- {
- Iterator iter(withstart);
- const Standard_Integer max = theroots.Extent();
- for (Standard_Integer j = 1; j <= max; j ++) {
- const Standard_Integer i = theroots.FindKey(j);
- Handle(Transfer_Binder) binder = MapItem(i);
- if (binder.IsNull()) continue;
- if (withstart) iter.Add (binder,Mapped(i));
- else iter.Add (binder);
- }
- return iter;
- }
-
- //! Returns, as an Iterator, the entire log of transfer (list of
- //! created objects and Binders which can bring errors)
- //! If withstart is given True, Starting Objets are also returned
- Standard_EXPORT Iterator CompleteResult (const Standard_Boolean withstart = Standard_False) const
- {
- Iterator iter(withstart);
- const Standard_Integer max = NbMapped();
- for (Standard_Integer i = 1; i <= max; i ++) {
- Handle(Transfer_Binder) binder = MapItem(i);
- if (binder.IsNull()) continue;
- if (withstart) iter.Add (binder,Mapped(i));
- else iter.Add (binder);
- }
- return iter;
- }
-
- //! Returns Binders which are neither "Done" nor "Initial",
- //! that is Error,Loop or Run (abnormal states at end of Transfer)
- //! Starting Objects are given in correspondance in the iterator
- Standard_EXPORT Iterator AbnormalResult() const
- {
- Iterator iter(Standard_True);
- const Standard_Integer max = NbMapped();
- for (Standard_Integer i = 1; i <= max; i ++) {
- Handle(Transfer_Binder) binder = MapItem(i);
- if (binder.IsNull()) continue;
- Transfer_StatusExec statex = binder->StatusExec();
- if (statex != Transfer_StatusInitial && statex != Transfer_StatusDone)
- iter.Add (binder,Mapped(i)); // on note les cas "pas normaux"
- }
- return iter;
- }
-
- //! Returns a CheckList as a list of Check : each one is for a
- //! starting entity which have either check (warning or fail)
- //! messages are attached, or are in abnormal state : that case
- //! gives a specific message
- //! If <erronly> is True, checks with Warnings only are ignored
- Standard_EXPORT Interface_CheckIterator CheckList (const Standard_Boolean erronly) const
- {
- Interface_CheckIterator list;
- Standard_Integer num, max = NbMapped();
- for (Standard_Integer i = 1; i <= max; i ++) {
- Handle(Transfer_Binder) binder = MapItem(i);
- if (binder.IsNull()) continue;
- Transfer_StatusExec statex = binder->StatusExec();
- Handle(Interface_Check) check = binder->Check();
- if (statex != Transfer_StatusInitial && statex != Transfer_StatusDone && !check->HasFailed())
- check->AddFail("Transfer in Abnormal Status (!= Initial or Done)");
- if (!check->HasFailed() && (erronly || check->NbWarnings() == 0)) continue;
- const TheKeyType& ent = Mapped(i);
- num = CheckNum(ent);
- if (num == 0) num = i;
- check->SetEntity(ent);
- list.Add(check,num);
- }
- return list;
- }
-
- //! Sets Progress indicator
- void SetProgress (const Handle(Message_ProgressIndicator)& theProgress) { myProgress = theProgress; }
-
- //! Gets Progress indicator
- const Handle(Message_ProgressIndicator) & GetProgress() const { return myProgress; }
-
- DEFINE_STANDARD_RTTI_INLINE(Transfer_ProcessGen,MMgt_TShared)
-
- protected:
-
- //! Computes a number to be associated to a starting object in
- //! a check or a check-list
- //! By default, returns 0; can be redefined
- Standard_EXPORT virtual Standard_Integer CheckNum (const TheKeyType&) const { return 0; }
-
- Handle(Interface_InterfaceModel) themodel;
-
- private:
-
- //! Same as Find but stores the last access to the map, for a
- //! faster access on next calls (as Bind does too)
- Standard_EXPORT const Handle(Transfer_Binder) & FindAndMask (const TheKeyType& start)
- {
- if (thelastobj == start) {
- if (theindex > 0) return thelastbnd;
- }
- thelastobj = start;
- theindex = themap.FindIndex (start);
- if (theindex > 0) thelastbnd = themap.FindFromIndex(theindex);
- else thelastbnd.Nullify();
- return thelastbnd;
- }
-
- Standard_Integer thetrace;
- Handle(Message_Messenger) themessenger;
- Standard_Integer thelevel;
- Standard_Integer therootl;
- Standard_Boolean therootm;
- TColStd_IndexedMapOfInteger theroots;
- TheKeyType thelastobj;
- Handle(Transfer_Binder) thelastbnd;
- Standard_Integer theindex;
- Handle(Actor) theactor;
- Transfer_MapOfProcess themap;
- Handle(Message_ProgressIndicator) myProgress;
-};
-
-#endif // _Transfer_ProcessGen_HeaderFile
+++ /dev/null
-// Created on: 1992-02-03
-// 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 _Transfer_TransferMapOfProcessForFinder_HeaderFile
-#define _Transfer_TransferMapOfProcessForFinder_HeaderFile
-
-#include <NCollection_IndexedDataMap.hxx>
-#include <Transfer_Binder.hxx>
-#include <Transfer_Finder.hxx>
-#include <Transfer_Hasher.hxx>
-
-typedef NCollection_IndexedDataMap<Handle(Transfer_Finder),Handle(Transfer_Binder),Transfer_Hasher> Transfer_TransferMapOfProcessForFinder;
-
-#endif // _Transfer_TransferMapOfProcessForFinder_HeaderFile
+++ /dev/null
-// Created on: 1992-02-03
-// 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 _Transfer_TransferMapOfProcessForTransient_HeaderFile
-#define _Transfer_TransferMapOfProcessForTransient_HeaderFile
-
-#include <NCollection_IndexedDataMap.hxx>
-#include <TColStd_MapTransientHasher.hxx>
-#include <Transfer_Binder.hxx>
-
-typedef NCollection_IndexedDataMap<Handle(Standard_Transient),Handle(Transfer_Binder),TColStd_MapTransientHasher> Transfer_TransferMapOfProcessForTransient;
-
-#endif // _Transfer_TransferMapOfProcessForTransient_HeaderFile
#include <Transfer_Binder.hxx>
#include <Transfer_TransientProcess.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(Transfer_TransientProcess,Transfer_ProcessForTransient)
+IMPLEMENT_STANDARD_RTTIEXT(Transfer_TransientProcess,Transfer_Process)
//=======================================================================
//function : SetGraph
#include <Standard_Type.hxx>
#include <TColStd_SequenceOfTransient.hxx>
-#include <Transfer_ProcessForTransient.hxx>
+#include <Transfer_Process.hxx>
class Dico_DictionaryOfTransient;
class Message_Messenger;
class Interface_HGraph;
class Interface_EntityIterator;
class Transfer_TransientProcess;
-DEFINE_STANDARD_HANDLE(Transfer_TransientProcess, Transfer_ProcessForTransient)
+DEFINE_STANDARD_HANDLE(Transfer_TransientProcess, Transfer_Process)
//! Adds specific features to the generic definition :
//! TransientProcess is intended to work from an InterfaceModel
//!
//! Hence, some informations about starting entities can be gotten
//! from the model : for Trace, CheckList, Integrity Status
-class Transfer_TransientProcess : public Transfer_ProcessForTransient
+class Transfer_TransientProcess : public Transfer_Process
{
public:
//! Sets TransientProcess at initial state, with an initial size
Transfer_TransientProcess(const Standard_Integer nb = 10000)
- : Transfer_ProcessForTransient (nb)
+ : Transfer_Process (nb)
{}
//! Sets a Graph : superseedes SetModel if already done
//! Rather for internal use (ex.: preparing and setting in once)
Handle(Dico_DictionaryOfTransient)& Context() { return thectx; }
- //! Specific printing to trace an entity : prints label and type
- //! (if model is set)
- Standard_EXPORT virtual void PrintTrace (const Handle(Standard_Transient)& start, const Handle(Message_Messenger)& S) const Standard_OVERRIDE;
-
TColStd_SequenceOfTransient & RootsForTransfer() { return thetrroots; }
- DEFINE_STANDARD_RTTIEXT(Transfer_TransientProcess,Transfer_ProcessForTransient)
+ DEFINE_STANDARD_RTTIEXT(Transfer_TransientProcess,Transfer_Process)
protected:
//! Specific number of a source object for check-list : Number in model
- Standard_EXPORT virtual Standard_Integer CheckNum (const Handle(Standard_Transient)& ent) const Standard_OVERRIDE;
+ Standard_EXPORT Standard_Integer CheckNum (const Handle(Standard_Transient)& ent) const Standard_OVERRIDE;
+
+ //! Specific printing to trace an entity : prints label and type
+ //! (if model is set)
+ Standard_EXPORT void PrintTrace (const Handle(Standard_Transient)& start, const Handle(Message_Messenger)& S) const Standard_OVERRIDE;
private:
#include <Interface_Macros.hxx>
#include <TopoDS_HShape.hxx>
#include <TopoDS_Shape.hxx>
-#include <Transfer_ProcessForFinder.hxx>
-#include <Transfer_IteratorOfProcessForTransient.hxx>
+#include <Transfer_Process.hxx>
#include <Transfer_SimpleBinderOfTransient.hxx>
#include <Transfer_TransientProcess.hxx>
if (TP.IsNull()) return shapes;
shapes = new TopTools_HSequenceOfShape();
- Transfer_IteratorOfProcessForTransient list = (roots ? TP->RootResult() : TP->CompleteResult());
+ Transfer_TransientProcess::Iterator list = (roots ? TP->RootResult() : TP->CompleteResult());
for (list.Start(); list.More(); list.Next()) {
const Handle(Transfer_Binder) &binder = list.Value();
ShapeAppend (binder,shapes);
return shapes;
}
-Handle(TransferBRep_ShapeMapper) TransferBRep::ShapeMapper (const Handle(Transfer_ProcessForFinder)& FP, const TopoDS_Shape& theShape)
+Handle(TransferBRep_ShapeMapper) TransferBRep::ShapeMapper (const Handle(Transfer_Process)& FP, const TopoDS_Shape& theShape)
{
Handle(TransferBRep_ShapeMapper) mapper = new TransferBRep_ShapeMapper(theShape);
const Standard_Integer index = FP->MapIndex (mapper);
#include <TColStd_HSequenceOfTransient.hxx>
#include <TopAbs_Orientation.hxx>
#include <TopTools_HSequenceOfShape.hxx>
-#include <Transfer_ProcessForFinder.hxx>
class TopoDS_Shape;
class Transfer_Binder;
+class Transfer_Process;
class Transfer_TransientProcess;
class TransferBRep_ShapeMapper;
//! Either <shape> is already mapped, then its Mapper is returned
//! Or it is not, then a new one is created then returned, BUT
//! it is not mapped here (use Bind to do this)
- Standard_EXPORT static Handle(TransferBRep_ShapeMapper) ShapeMapper (const Handle(Transfer_ProcessForFinder)& FP, const TopoDS_Shape& theShape);
+ Standard_EXPORT static Handle(TransferBRep_ShapeMapper) ShapeMapper (const Handle(Transfer_Process)& FP, const TopoDS_Shape& theShape);
//! Returns Type Name (string)
//! Here, the true name of the Type of a Shape
#include <TopoDS_Shape.hxx>
#include <stdio.h>
+
//============================================================
// Support for several models in DRAW
//============================================================
static Handle(Dico_DictionaryOfTransient) thedictws = new Dico_DictionaryOfTransient;
-static Standard_Boolean ClearDicWS()
-{
- thedictws->Clear();
- return Standard_True;
-}
-
static void AddWS(TCollection_AsciiString filename,
const Handle(XSControl_WorkSession)& WS)
{
static Standard_Boolean FillDicWS(Handle(STEPCAFControl_DictionaryOfExternFile)& dicFile)
{
- ClearDicWS();
+ thedictws->Clear();
if ( dicFile->IsEmpty() ) {
return Standard_False;
}
return Standard_True;
}
-static Standard_Boolean SetCurrentWS (TCollection_AsciiString filename)
-{
- if ( !thedictws->HasItem(filename) ) return Standard_False;
- Handle(XSControl_WorkSession) CurrentWS =
- Handle(XSControl_WorkSession)::DownCast( thedictws->Item(filename) );
- XSDRAW::Pilot()->SetSession( CurrentWS );
-
- return Standard_True;
-}
-
//=======================================================================
//function : SetCurWS
return 1;
}
TCollection_AsciiString filename (argv[1]);
- SetCurrentWS( filename );
+ if ( thedictws->HasItem(filename) ) {
+ Handle(XSControl_WorkSession) CurrentWS =
+ Handle(XSControl_WorkSession)::DownCast( thedictws->Item(filename) );
+ XSDRAW::Pilot()->SetSession( CurrentWS );
+ }
return 0;
}
//purpose :
//=======================================================================
- void XSAlgo::SetAlgoContainer(const Handle(XSAlgo_AlgoContainer)& aContainer)
+void XSAlgo::SetAlgoContainer(const Handle(XSAlgo_AlgoContainer)& aContainer)
{
theContainer = aContainer;
}
//purpose :
//=======================================================================
- Handle(XSAlgo_AlgoContainer) XSAlgo::AlgoContainer()
+const Handle(XSAlgo_AlgoContainer) & XSAlgo::AlgoContainer()
{
return theContainer;
}
#define _XSAlgo_HeaderFile
#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
class XSAlgo_AlgoContainer;
-class XSAlgo_ToolContainer;
-class XSAlgo_AlgoContainer;
-
-
class XSAlgo
{
-public:
-
- DEFINE_STANDARD_ALLOC
+ public:
-
//! Provides initerface to the algorithms from Shape Healing
//! and others for XSTEP processors.
//! Creates and initializes default AlgoContainer.
Standard_EXPORT static void SetAlgoContainer (const Handle(XSAlgo_AlgoContainer)& aContainer);
//! Returns default AlgoContainer
- Standard_EXPORT static Handle(XSAlgo_AlgoContainer) AlgoContainer();
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-friend class XSAlgo_ToolContainer;
-friend class XSAlgo_AlgoContainer;
-
+ Standard_EXPORT static const Handle(XSAlgo_AlgoContainer) & AlgoContainer();
};
-
-
-
-
-
-
#endif // _XSAlgo_HeaderFile
-XSControl.cxx
-XSControl.hxx
XSControl_ConnectedShapes.cxx
XSControl_ConnectedShapes.hxx
XSControl_Controller.cxx
XSControl_Controller.hxx
-XSControl_FuncShape.cxx
-XSControl_FuncShape.hxx
-XSControl_Functions.cxx
-XSControl_Functions.hxx
XSControl_Reader.cxx
XSControl_Reader.hxx
XSControl_SelectForTransfer.cxx
XSControl_TransferReader.hxx
XSControl_TransferWriter.cxx
XSControl_TransferWriter.hxx
-XSControl_Utils.cxx
-XSControl_Utils.hxx
XSControl_Vars.cxx
XSControl_Vars.hxx
XSControl_WorkSession.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 <XSControl.hxx>
-#include <IFSelect_SessionPilot.hxx>
-#include <XSControl_WorkSession.hxx>
-
-Handle(XSControl_WorkSession) XSControl::Session (const Handle(IFSelect_SessionPilot)& pilot)
-{ return Handle(XSControl_WorkSession)::DownCast(pilot->Session()); }
+++ /dev/null
-// Created on: 1995-03-13
-// 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_HeaderFile
-#define _XSControl_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Handle.hxx>
-
-class XSControl_WorkSession;
-class IFSelect_SessionPilot;
-
-//! This package provides complements to IFSelect & Co for
-//! control of a session
-class XSControl
-{
- public:
-
- //! Returns the WorkSession of a SessionPilot, but casts it as
- //! from XSControl : it then gives access to Control & Transfers
- Standard_EXPORT static Handle(XSControl_WorkSession) Session (const Handle(IFSelect_SessionPilot)& pilot);
-};
-
-#endif // _XSControl_HeaderFile
IFSelect_ReturnStatus stat = IFSelect_RetFail;
Handle(Transfer_Binder) binder = FP->Find (aMapper);
- Handle(Transfer_SimpleBinderOfTransient) bindtr;
while (!binder.IsNull()) {
- bindtr = Handle(Transfer_SimpleBinderOfTransient)::DownCast (binder);
+ Handle(Transfer_SimpleBinderOfTransient) bindtr = Handle(Transfer_SimpleBinderOfTransient)::DownCast (binder);
if (!bindtr.IsNull()) {
Handle(Standard_Transient) ent = bindtr->Result();
if (!ent.IsNull()) {
WS->AddNamedItem ("xst-shared",new IFSelect_SelectShared);
WS->AddNamedItem ("xst-nb-selected",new IFSelect_GraphCounter);
- //szv:mySignType = stp;
WS->SetSignType( stp );
}
//! Names (see method Name)
void AutoRecord() const
{
- Record (Name(Standard_True));
- Record (Name(Standard_False));
+ Record (myShortName.ToCString());
+ Record (myLongName.ToCString());
}
- //! Records <me> in a general dictionary under a name
- //! Error if <name> already used for another one
- Standard_EXPORT void Record (const Standard_CString name) const;
-
//! Returns the Controller attached to a given name
//! Returns a Null Handle if <name> is unknown
Standard_EXPORT static Handle(XSControl_Controller) Recorded (const Standard_CString name);
{ return (rsc ? myShortName.ToCString() : myLongName.ToCString()); }
//! Returns the Protocol attached to the Norm (from field)
- const Handle(Interface_Protocol) & Protocol () const
- { return myAdaptorProtocol; }
-
- //! Returns the SignType attached to the norm (from field)
- //szv:const Handle(IFSelect_Signature) & SignType1() const
- //szv:{ return mySignType; }
+ const Handle(Interface_Protocol) & Protocol () const { return myAdaptorProtocol; }
//! Returns the WorkLibrary attached to the Norm. Remark that it
//! has to be in phase with the Protocol (read from field)
//! Customises a WorkSession, by adding to it the recorded items (by AddSessionItem)
Standard_EXPORT virtual void Customise (Handle(XSControl_WorkSession)& WS);
- const Handle(Dico_DictionaryOfTransient) & AdaptorSession() const
- { return myAdaptorSession; }
+ const Handle(Dico_DictionaryOfTransient) & AdaptorSession() const { return myAdaptorSession; }
DEFINE_STANDARD_RTTIEXT(XSControl_Controller,MMgt_TShared)
//! <theLongName> is for the complete, official, long name
//! <theShortName> is for the short name used for resources
Standard_EXPORT XSControl_Controller(const Standard_CString theLongName, const Standard_CString theShortName);
+
+ //! Records <me> in a general dictionary under a name
+ //! Error if <name> already used for another one
+ Standard_EXPORT void Record (const Standard_CString name) const;
//! Records the name of a Static to be traced for a given use
Standard_EXPORT void TraceStatic (const Standard_CString theName, const Standard_Integer theUse);
+++ /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 <BRep_Builder.hxx>
-#include <BRepTools.hxx>
-#include <Geom2d_Curve.hxx>
-#include <Geom_Geometry.hxx>
-#include <IFSelect_Act.hxx>
-#include <IFSelect_CheckCounter.hxx>
-#include <IFSelect_Functions.hxx>
-#include <IFSelect_SessionPilot.hxx>
-#include <Interface_CheckIterator.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Message.hxx>
-#include <Message_Messenger.hxx>
-#include <ShapeExtend_Explorer.hxx>
-#include <Standard_ErrorHandler.hxx>
-#include <Standard_Failure.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <TColStd_SequenceOfInteger.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Compound.hxx>
-#include <TopoDS_Iterator.hxx>
-#include <TopTools_HSequenceOfShape.hxx>
-#include <Transfer_Binder.hxx>
-#include <Transfer_Finder.hxx>
-#include <Transfer_FinderProcess.hxx>
-#include <Transfer_SimpleBinderOfTransient.hxx>
-#include <Transfer_TransientListBinder.hxx>
-#include <Transfer_TransientProcess.hxx>
-#include <TransferBRep.hxx>
-#include <TransferBRep_ShapeBinder.hxx>
-#include <TransferBRep_ShapeListBinder.hxx>
-#include <TransferBRep_ShapeMapper.hxx>
-#include <XSControl.hxx>
-#include <XSControl_ConnectedShapes.hxx>
-#include <XSControl_Controller.hxx>
-#include <XSControl_FuncShape.hxx>
-#include <XSControl_TransferReader.hxx>
-#include <XSControl_TransferWriter.hxx>
-#include <XSControl_Vars.hxx>
-#include <XSControl_WorkSession.hxx>
-
-#include <stdio.h>
-
-//=======================================================================
-//function : XSControl_tpdraw
-//purpose :
-//=======================================================================
-static Handle(XSControl_Vars) GetXSControlVars (const Handle(IFSelect_SessionPilot)& pilot)
-{
- static const Handle(XSControl_Vars) avars;
- Handle(XSControl_WorkSession) WS = XSControl::Session(pilot);
- return (WS.IsNull()? avars : WS->Vars());
-}
-
-// ######################################################################
-// #### ####
-// #### COMMANDS ####
-// #### ####
-// ######################################################################
-
-//=======================================================================
-//function : XSControl_tpdraw
-//purpose :
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_tpdraw
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
- const Standard_CString arg3 = pilot->Arg(3);
- const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (TP.IsNull()) { sout<<"No Transfer Read"<<endl; return IFSelect_RetError;}
- // **** tpdraw ****
- if (argc < 2) {
- sout<<"Donner [mode facultatif : item ou root] , NUMERO , nom DRAW facultatif"<<endl;
- sout<<" mode si present : item ou root, sinon n0 d entite modele"<<endl;
- sout<<" NUMERO entier : d entite, d item transfert ou de root transfert\n"
- << " ou * pour dire tous"<<endl;
- return IFSelect_RetError;
- }
- Standard_Integer mode = 0, num=0;
- if (arg1[0] == 'i') mode = 1;
- else if (arg1[0] == 'r') mode = 2;
- Standard_Boolean tout = Standard_False;
- if (mode == 0) {
- if (argc < 2) { sout<<"Donner au moins un NUMERO ou *"<<endl; return IFSelect_RetError; }
- if (arg1[0] == '*') tout = Standard_True;
- else num = IFSelect_Functions::GiveEntityNumber(XSControl::Session(pilot),arg1);
- } else {
- if (arg2[0] == '*') tout = Standard_True;
- else num = IFSelect_Functions::GiveEntityNumber(XSControl::Session(pilot),arg2);
- }
-
- Standard_Integer nbvar = 0;
- Handle(Transfer_Binder) binder;
- Handle(Standard_Transient) ent;
- TopoDS_Shape sh; char nomvar[40];
- // Standard_Boolean moderoot = (pilot->Word(0).Value(3) == 'r');
-
- Standard_Integer n1, n2, i, max=0, index=0;
- Handle(Interface_InterfaceModel) model = TP->Model();
- if (model.IsNull()) {
- if (mode == 0) {
- sout<<"Pas de modele, preciser n0 d item de transfert"<<endl;
- return IFSelect_RetError;
- }
- }
- if (mode == 0) { sout<<"Entite de modele"; max = model->NbEntities(); }
- if (mode == 1) { sout<<"Item de transfert"; max = TP->NbMapped(); }
- if (mode == 2) { sout<<"Racine de transfert"; max = TP->NbRoots(); }
- if (tout) {
- n1 = 1; n2 = max;
- sout<<", listage de 1 a "<<max<<endl;
- }
- else if (num <= 0 || num > max) {
- sout<<" - Num="<<num<<" hors limite (de 1 a "<<max<<")"<<endl;
- return IFSelect_RetError;
- } else {
- n1 = n2 = num; nbvar = -1; // nbvar : 1ere shape simple = pas de n0
- sout<<", n0 "<<num<<endl;
- }
-
- for (i = n1; i <= n2; i ++) {
- if (mode == 0) {
- ent = model->Value(i);
- num = i;
- index = TP->MapIndex(ent);
- } else if (mode == 1) {
- ent = TP->Mapped(i);
- if (model.IsNull()) num = 0;
- else num = model->Number(ent);
- index = i;
- } else if (mode == 2) {
- ent = TP->Root(i);
- if (model.IsNull()) num = 0;
- else num = model->Number(ent);
- index = TP->MapIndex(ent);
- }
-
- if (index > 0) binder = TP->MapItem (index);
- if (binder.IsNull()) index = 0;
- if (index == 0) {
- if (!tout) sout<<"Entite n0 "<<num<<" : non repertoriee"<<endl;
- continue;
- }
- if (!binder->HasResult()) {
- if (!tout) sout<<"Entite n0 "<<num<<" : pas de resultat"<<endl;
- continue;
- }
- sh = TransferBRep::ShapeResult (binder);
- //DeclareAndCast(TransferBRep_ShapeBinder,shb,binder);
- if (!sh.IsNull()) {
- //sh = shb->Result();
- nbvar ++;
- if (sh.IsNull()) { sout<<" (no Shape recorded)"<<endl; continue; }
- if (tout) sout<<"[ "<<i<<" ]:";
- if (num == 0) sout<<" pas dans le modele";
- else sout<<" ent.n0 "<<num;
- sout<<", item transfert n0 "<<index;
- if (nbvar == 0) {
- if (argc > 3 && mode > 0) sprintf (nomvar,"%s",arg3);
- else if (argc > 2 && mode == 0) sprintf (nomvar,"%s",arg2);
- else sprintf (nomvar,"tp_%d",i);
- } else {
- if (argc > 3 && mode > 0) sprintf (nomvar,"%s_%d",arg3,nbvar);
- else if (argc > 2 && mode == 0) sprintf (nomvar,"%s_%d",arg2,nbvar);
- else sprintf (nomvar,"tp_%d",i);
- }
- sout<<" -> 1 DRAW Shape: "<<nomvar<<endl;
- GetXSControlVars(pilot)->SetShape(nomvar,sh);
- continue;
- }
- DeclareAndCast(TransferBRep_ShapeListBinder,slb,binder);
- if (!slb.IsNull()) {
- const Standard_Integer nbs = slb->Result().Length();
- if (tout) sout<<"[ "<<i<<" ]:";
- if (num == 0) sout<<" pas dans le modele";
- else sout<<" ent.n0 "<<num;
- sout<<", item transfert n0 "<<index;
- sout<<" -> "<<nbs<<" DRAW Shapes :";
- for (Standard_Integer j = 1; j <= nbs; j ++) {
- sh = slb->Result().Value(j); if (nbvar < 0) nbvar = 0; nbvar ++;
- if (sh.IsNull()) { sout<<" (no Shape recorded)"<<endl; continue; }
- if (argc > 3 && mode > 0) sprintf (nomvar,"%s_%d",arg3,nbvar);
- else if (argc > 2 && mode == 0) sprintf (nomvar,"%s_%d",arg2,nbvar);
- else sprintf (nomvar,"tp_%d_%d",i,nbvar);
- sout<<" "<<nomvar;
- GetXSControlVars(pilot)->SetShape(nomvar,sh);
- }
- sout<<endl;
- continue;
- }
- DeclareAndCast(Transfer_SimpleBinderOfTransient,trb,binder);
- if (!trb.IsNull()) {
- Handle(Standard_Transient) resu = trb->Result();
- if (resu.IsNull()) {
- sout<<"Entite n0 "<<num<<" : pas de resultat"<<endl;
- continue;
- }
- DeclareAndCast(Geom_Geometry,geom,resu);
- sout<<"Entite n0 "<<num<<" : resultat "<<resu->DynamicType()->Name();
- if (geom.IsNull()) { sout<<endl; continue; }
- nbvar ++;
- if (nbvar == 0) {
- if (argc > 3 && mode > 0) sprintf (nomvar,"%s",arg3);
- else if (argc > 2 && mode == 0) sprintf (nomvar,"%s",arg2);
- else sprintf (nomvar,"tp_%d",i);
- } else {
- if (argc > 3 && mode > 0) sprintf (nomvar,"%s_%d",arg3,nbvar);
- else if (argc > 2 && mode == 0) sprintf (nomvar,"%s_%d",arg2,nbvar);
- else sprintf (nomvar,"tp_%d",i);
- }
- char* nomv = nomvar;
- GetXSControlVars(pilot)->Set (nomv,geom);
- sout<<" -> DRAW Geom : "<<nomvar<<endl;
- continue;
- }
-
- if (sh.IsNull() && trb.IsNull())
- if (!tout) sout<<"Entite n0 "<<num<<" : resultat pas une Shape mais "<<binder->ResultTypeName()<<endl;
- }
-
- if (sh.IsNull()) sout<<" (No Shape)"<<endl;
- return IFSelect_RetDone;
-}
-
-//=======================================================================
-//function : XSControl_tpcompound
-//purpose :
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_tpcompound
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (TP.IsNull()) { sout<<"No Transfer Read"<<endl; return IFSelect_RetError;}
- // **** tpcompound ****
- if (argc < 2) { sout<<"Give a NAME for the Compound + optional givelist, else roots are taken"<<endl; return IFSelect_RetError; }
- Handle(TopTools_HSequenceOfShape) list;
- if (argc == 2) list = TransferBRep::Shapes(TP);
- else {
- Handle(TColStd_HSequenceOfTransient) lise = IFSelect_Functions::GiveList(pilot->Session(),pilot->CommandPart(2));
- if (lise.IsNull()) { sout<<"Not a valid entity list : "<<pilot->CommandPart(2)<<endl; return IFSelect_RetError; }
- list = TransferBRep::Shapes (TP,lise);
- sout<<lise->Length()<<" Entities, ";
- }
- if (list.IsNull()) { sout<<"No Shape listed"<<endl; return IFSelect_RetError; }
- Standard_Integer nb = list->Length();
- sout<<nb<<" Shape(s) listed"<<endl;
- TopoDS_Compound C;
- BRep_Builder B;
- B.MakeCompound(C);
- for (Standard_Integer i = 1; i <= nb; i ++) B.Add (C,list->Value(i));
- GetXSControlVars(pilot)->SetShape (arg1,C);
- return IFSelect_RetDone;
-}
-
-
-
-//=======================================================================
-//function : XSControl_traccess
-//purpose :
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_traccess
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
- // **** trdraw : TransferReader **** 26
- // **** trsave : TransferReader **** 27
- // **** trcomp (comp -> DRAW) **** 28
- // **** trscomp (comp -> save) **** 29
- Standard_Boolean cascomp = (pilot->Word(0).Location(1,'o',1,5) > 0);
- Standard_Boolean cassave = (pilot->Word(0).Location(1,'s',1,5) > 0);
- char nomsh[100], noms[100];
- const Handle(XSControl_TransferReader) &TR = XSControl::Session(pilot)->TransferReader();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (TR.IsNull()) { sout<<" manque init"<<endl; return IFSelect_RetError; }
- const Handle(Interface_InterfaceModel) &mdl = TR->Model();
- if (mdl.IsNull()) { sout<<" modele absent"<<endl; return IFSelect_RetError; }
- Standard_Integer num = (argc > 1 ? IFSelect_Functions::GiveEntityNumber(XSControl::Session(pilot),arg1) : 0);
-
- if (argc > 1) strcpy (nomsh,arg1);
- else strcpy (nomsh,(cascomp ? "TREAD_COMP" : "TREAD_LIST"));
- if (cassave) sout<<" save shapes -> current directory"<<endl;
-
- if (num == 0 || cascomp) {
- TopoDS_Compound C; // pour cas compound
- BRep_Builder B;
- B.MakeCompound(C);
-
- const Handle(TopTools_HSequenceOfShape) &list = TR->ShapeResultList(Standard_True);
- Standard_Integer i, nb = list->Length();
- sout<<" TOUS RESULTATS par ShapeResultList, soit "<<nb<<endl;
- for (i = 1; i <= nb; i ++) {
- sprintf (noms,"%s_%d",nomsh,i);
- if ( (i%1000) == 0) sout<<"("<<i<<")"<<endl;
- else if ( (i%100) == 0) sout<<"*";
- else if ( (i%10) == 0) sout<<"0";
- else sout<<".";
- if (list->Value(i).IsNull()) continue;
- if (!cascomp && !cassave) GetXSControlVars(pilot)->SetShape(noms,list->Value(i));
- else if (!cascomp && cassave) BRepTools::Write (list->Value(i),noms);
- else if (cascomp) B.Add (C,list->Value(i));
- }
- sout<<endl;
- if (cascomp && !cassave) GetXSControlVars(pilot)->SetShape(nomsh,C);
- else if (cascomp && cassave) BRepTools::Write (C,nomsh);
- } else {
- if (num < 1 || num > mdl->NbEntities()) { sout<<" incorrect:"<<arg1<<endl; return IFSelect_RetError; }
- TopoDS_Shape sh = TR->ShapeResult(mdl->Value(num));
- if (sh.IsNull()) { sout<<" Pas de resultat pour "<<arg1<<endl; return IFSelect_RetError; }
- if (argc > 2) sprintf (nomsh,"%s",arg2);
- else sprintf (nomsh,"TREAD_%d",num);
- if (!cascomp && !cassave) GetXSControlVars(pilot)->SetShape(nomsh,sh);
- else if (!cascomp && cassave) BRepTools::Write (sh,nomsh);
- else sout<<"Option non comprise"<<endl;
- }
- return IFSelect_RetDone;
-}
-
-//=======================================================================
-//function : XSControl_IsEqualSubShape
-//purpose :
-//=======================================================================
-// PTV 23.08.2000 Added for checking where are an entity from.
-static Standard_Boolean XSControl_IsEqualSubShape (const TopoDS_Shape& Shape,
- TopoDS_Shape& sh, Standard_Integer aLevel)
-{
- if ( sh.IsSame(Shape) ) return Standard_True;
- if (aLevel > 0) {
- TopoDS_Shape varShape;
- aLevel--;
- TopoDS_Iterator it(sh);
- for (; it.More(); it.Next() ) {
- varShape = it.Value();
- if ( XSControl_IsEqualSubShape(Shape, varShape, aLevel) ) return Standard_True;
- }
- }
- return Standard_False;
-}
-
-//=======================================================================
-//function : XSControl_fromshape
-//purpose :
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_fromshape
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- // **** fromshape (tread) ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) {
- sout<<"Give name of a DRAW Shape"<<endl;
- return IFSelect_RetError;
- }
- const char* a1 = (char *)arg1;
- TopoDS_Shape Shape = GetXSControlVars(pilot)->GetShape(a1);
- if (Shape.IsNull()) {
- sout<<"Not a DRAW Shape:"<<arg1<<endl;
- return IFSelect_RetError;
- }
- Standard_Boolean yena = Standard_False;
- Standard_Integer aLevel = 1;
- if (argc >=3 )
- aLevel = atoi(pilot->Arg(2));
- Standard_Boolean silent = Standard_False;
- if (aLevel <0 ) {
- silent = Standard_True;
- aLevel = -aLevel;
- }
-
- // IMPORT
- const Handle(XSControl_TransferReader) &TR = XSControl::Session(pilot)->TransferReader();
- if (TR.IsNull()) { } // sout<<"No read transfer (import) recorded"<<endl;
- else {
- yena = Standard_True;
- if ( ! silent ) sout<<"Shape "<<arg1<<" : ";
- Standard_Integer modrec = 1;
- Handle(Standard_Transient) ent = TR->EntityFromShapeResult (Shape,modrec);
- if (ent.IsNull()) {
- modrec = -1;
- ent = TR->EntityFromShapeResult (Shape,modrec);
- }
- if (ent.IsNull()) {
- modrec = 2;
- Handle(Transfer_TransientProcess) TP = TR->TransientProcess();
- if (TP.IsNull()) {
- if ( silent )
- sout << "Shape "<<arg1<<" : ";
- sout<<"no map"<<endl;
- }
- else {
- TopoDS_Shape S0 = Shape;
- TopLoc_Location L;
- S0.Location ( L );
- Standard_Integer i, nb = TP->NbMapped();
- if ( ! silent ) sout<<"searching in map among "<<nb<<" ...";
- for (i = 1; i <= nb; i ++) {
- ent = TP->Mapped(i);
- TopoDS_Shape sh = TransferBRep::ShapeResult(TP,ent);
- if (sh.IsNull()) {
- ent.Nullify();
- continue;
- }
- if (XSControl_IsEqualSubShape(Shape, sh, aLevel)) break;
- modrec = -2;
- sh.Location ( L );
- if (XSControl_IsEqualSubShape(S0, sh, aLevel)) break;
- ent.Nullify();
- modrec = 2;
- }
- }
- }
- if ( ! ent.IsNull() ) {
- if ( silent ) sout << "Shape " << arg1 << ": ";
- if (modrec <0) sout<<"(moved from origin) ";
- //else sout<<"(origin) ";
- }
- // on affiche
- if (ent.IsNull()) {
- if ( ! silent ) sout<<" unknown as imported";
- // skl 11.05.2004
- // if Shape is a compound try to make "fromshape" for its subshapes
- if(Shape.ShapeType()==TopAbs_COMPOUND) {
- sout<<endl<<"Subshapes imported from entities:";
- TopoDS_Iterator Iter(Shape);
- for (; Iter.More(); Iter.Next()) {
- TopoDS_Shape subsh = Iter.Value();
- Standard_Integer submodrec = 1;
- Handle(Standard_Transient) subent = TR->EntityFromShapeResult(subsh,submodrec);
- if (subent.IsNull()) {
- submodrec = -1;
- subent = TR->EntityFromShapeResult(subsh,submodrec);
- }
- if (!subent.IsNull()) {
- sout<<" "<<XSControl::Session(pilot)->Model()->Number(subent);
- }
- }
- }
- }
- else {
- sout<<"imported from entity ";
- XSControl::Session(pilot)->Model()->Print(ent,sout);
- if ( silent ) sout << " in file " << XSControl::Session(pilot)->LoadedFile() << endl;
- }
- if ( ! silent ) sout<<endl;
- }
-
- // ET EN EXPORT ?
- const Handle(Transfer_FinderProcess) &FP = XSControl::Session(pilot)->TransferWriter()->FinderProcess();
- if (FP.IsNull()) { }
- else {
- yena = Standard_True;
- Handle(Transfer_Finder) fnd = TransferBRep::ShapeMapper (FP,Shape);
- Handle(Standard_Transient) ent;
- if (!fnd.IsNull()) ent = FP->FindTransient (fnd);
- if (!ent.IsNull()) {
- sout<<"Shape "<<arg1<<": exported to entity ";
- XSControl::Session(pilot)->Model()->Print(ent,sout);
- if ( silent ) sout << " in file " << XSControl::Session(pilot)->LoadedFile();
- sout<<endl;
- }
- // abv 31.08.00: treat case of splitted shape (several results)
- // it is supposed that results are of the same type and lie in one-level comp
- else {
- Handle(Transfer_Binder) bnd = FP->Find ( fnd );
- if ( ! bnd.IsNull() ) {
- Handle(Transfer_TransientListBinder) TransientListBinder =
- Handle(Transfer_TransientListBinder)::DownCast( bnd ); //skl
- if (! TransientListBinder.IsNull() ) {
- Standard_Integer i = 1, nb = TransientListBinder->Result().Length();
- if (nb > 0) sout<<"Shape "<<arg1<<": exported to entities ";
- for (; i<=nb; i++) {
- XSControl::Session(pilot)->Model()->Print( TransientListBinder->Result().Value(i), sout );
- if (i < nb) sout<<", ";
- }
- if (nb > 0) {
- if ( silent ) sout << " in file " << XSControl::Session(pilot)->LoadedFile();
- sout<<endl;
- }
- }
- }
- }
- }
- if (!yena) sout<<"No transfer (either import or export) recorded"<<endl;
-
- return IFSelect_RetVoid;
-}
-
-//=======================================================================
-//function : XSControl_trconnexentities
-//purpose :
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_trconnexentities
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- // **** connected entities (last transfer) ****
- const Handle(XSControl_TransferReader) &TR = XSControl::Session(pilot)->TransferReader();
- Handle(Transfer_TransientProcess) TP;
- if (!TR.IsNull()) TP = TR->TransientProcess();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (TP.IsNull()) { sout<<"no transfer map"<<endl; return IFSelect_RetVoid; }
- if (argc < 2) {
- sout<<"Give name of a DRAW Shape + optional shape type v-e-w-f(D)-s"<<endl;
- return IFSelect_RetError;
- }
- const char* a1 = (const char *)arg1;
- TopoDS_Shape Shape = GetXSControlVars(pilot)->GetShape(a1);
- if (Shape.IsNull()) { sout<<"Not a DRAW Shape:"<<arg1<<endl; return IFSelect_RetError; }
- sout<<"Shape "<<arg1<<" : ";
-
- Handle(TColStd_HSequenceOfTransient) list =
- XSControl_ConnectedShapes::AdjacentEntities (Shape,TP,TopAbs_FACE);
- Standard_Integer i, nb = list->Length();
- sout<<nb<<" Entities produced Connected Shapes :"<<endl;
- const Handle(Interface_InterfaceModel) &model = XSControl::Session(pilot)->Model();
- sout<<"(";
- for (i = 1; i <= nb; i ++) {
- if (i > 1) sout<<",";
- sout<<model->Number(list->Value(i));
- }
- sout<<")"<<endl;
- return IFSelect_RetDone;
-}
-
-//=======================================================================
-//function : XSControl_trimport
-//purpose :
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_trimport
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- // FileName ou . (pour courant) VarName GiveList (obligatoire)
- // GiveList : * pour xst-transferrable-roots
- Handle(XSControl_WorkSession) WS = XSControl::Session(pilot);
-
- Standard_Integer argc = pilot->NbWords();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 4) {
- sout<<"Give : filename or . for current model; varname or . to take fileroot\n GiveList, * for all transferrable roots"<<endl;
- return IFSelect_RetError;
- }
- const Standard_CString arg1 = pilot->Arg(1);
- const Standard_CString arg2 = pilot->Arg(2);
- const Standard_CString arg3 = pilot->Arg(3);
-
- // File Name and Variable (root) Name
-
- TCollection_AsciiString fnom,rnom;
- Standard_Boolean modfic = XSControl_FuncShape::FileAndVar
- (WS,arg1,arg2,"IMPORT",fnom,rnom);
- if (modfic) sout<<" File to read : "<<fnom<<endl;
- else sout<<" Model taken from the session : "<<fnom<<endl;
- sout<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom<<endl;
-
- // keep the current command, because sub-commands will be called
- TCollection_AsciiString compart = pilot->CommandPart (3);
-
- // Reading file if required
-
- if (modfic) {
- TCollection_AsciiString comload ("xload ");
- comload.AssignCat(arg1);
- IFSelect_ReturnStatus status = pilot->Execute(comload);
- if (status != IFSelect_RetDone)
- { sout<<"Abandon import"<<endl; return status; }
- } else {
- sout<<"Currently Loaded Model"<<endl;
- }
-
- // Selecting Entities
-
- Handle(TColStd_HSequenceOfTransient) list;
- if (arg3[0] == '*' && arg3[1] == '\0') {
- list = WS->GiveList ("xst-transferrable-roots");
- sout<<"All Transferrable Roots : ";
- } else {
- sout<<"List given by "<<compart.ToCString()<<" : ";
- list = WS->GiveList (compart.ToCString());
- }
- if (list.IsNull()) { sout<<"No list defined. Abandon"<<endl; return IFSelect_RetError; }
- Standard_Integer nbl = list->Length();
- sout<<"Nb entities selected : "<<nbl<<endl;
-
- // Starting Transfer
-
- WS->InitTransferReader (0);
- const Handle(XSControl_TransferReader) &TR = WS->TransferReader();
- if (TR.IsNull()) { sout<<" init not done or failed"<<endl; return IFSelect_RetError; }
-
- TR->BeginTransfer();
-
- // Transferring
- Standard_Integer nbt = TR->TransferList(list);
- sout<<"Nb Entities Selected : "<<nbl<<" have given "<<nbt<<" results"<<endl;
-
- // Filling VARS. one compound (trimpcomp) or one shape per ent (trimport)
- Standard_Boolean iscomp = (pilot->Arg(0)[5] == 'c');
- Standard_Integer nbs = 0;
- TopoDS_Shape sh;
- TopoDS_Compound C;
- BRep_Builder B;
- B.MakeCompound (C);
- Handle(Interface_InterfaceModel) mdl = TR->Model();
- if (mdl.IsNull()) { sout<<" modele absent"<<endl; return IFSelect_RetError; }
- for (Standard_Integer il= 1; il <= nbl; il ++) {
- Handle(Standard_Transient) ent = list->Value(il);
- sh = TR->ShapeResult(ent);
- if (sh.IsNull()) continue;
- nbs ++;
- if (iscomp) B.Add (C,sh);
- else {
- char nomsh[50];
- sprintf (nomsh,"%s_%d",rnom.ToCString(),nbs);
- GetXSControlVars(pilot)->SetShape(nomsh,sh);
- }
- }
- if (nbs == 0) sout<<"No Shape produced"<<endl;
- else if (nbs == 1) {
- sout<<"One Shape produced, named "<<rnom.ToCString()<<endl;
- GetXSControlVars(pilot)->SetShape(rnom.ToCString(),sh);
- } else if (iscomp) {
- sout<<"One compound made of "<<nbs<<" Shapes, named "<<rnom.ToCString()<<endl;
- GetXSControlVars(pilot)->SetShape(rnom.ToCString(),C);
- } else { // several individual shapes
- sout<<nbs<<" Shapes, named "<<rnom.ToCString()<<"_1 to "<<rnom.ToCString()<<"_"<<nbs<<endl;
- }
-
- return IFSelect_RetDone;
-}
-
-//=======================================================================
-//function : XSControl_twrite
-//purpose :
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_twrite
- (const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- // **** twrite ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- Handle(XSControl_TransferWriter) TW = XSControl::Session(pilot)->TransferWriter();
- if (argc < 2) { sout<<" donner nom de shape draw"<<endl; return IFSelect_RetError; }
- sout<<"Attention, on alimente le modele courant ..."<<endl;
-
- // Shape
- for (Standard_Integer i = 1; i < argc; i ++) {
- const char* ai = (const char *)pilot->Arg(i);
- TopoDS_Shape Shape = GetXSControlVars(pilot)->GetShape(ai);
- if (Shape.IsNull()) { sout<<"pas un nom de shape draw:"<<arg1<<endl; continue; }
- sout<<"Pour Shape : "<<ai;
- Standard_Integer stat = TW->TransferWriteShape (XSControl::Session(pilot)->Model(),Shape);
- sout<<" Transfer Write Status = "<<stat<<endl;
- }
- pilot->Session()->ComputeGraph();
- // Transient ? (Geom) : ignore
- return IFSelect_RetDone;
-}
-
-// ######################################################################
-// #### TIMERS ####
-// ######################################################################
-
-
-// ######################################################################
-// #### ####
-// #### Initialising Commands ####
-// #### ####
-// ######################################################################
-
-static int initactor = 0;
-
-
-//=======================================================================
-//function : Init
-//purpose :
-//=======================================================================
-
-void XSControl_FuncShape::Init ()
-{
- if (initactor) return; initactor = 1;
-
- IFSelect_Act::SetGroup("DE: General");
-
- IFSelect_Act::AddFunc ("tpdraw","[mode:item or root] num|* [nomvar] Passes an ITEM to Shape Draw (Start or Result)",XSControl_tpdraw);
-
- IFSelect_Act::AddFunc ("tpcompound","name:cstring [givelist] : -> compound with Shapes Root or from givelist",XSControl_tpcompound);
-
- IFSelect_Act::AddFunc ("trdraw","results ->DRAW : all; or num [name] : from ent.num -> DRAW [name/tread_num]",XSControl_traccess);
- IFSelect_Act::AddFunc ("trsave","results ->files : all; or num [name] : from ent.num -> DRAW [name/tread_num]",XSControl_traccess);
- IFSelect_Act::AddFunc ("trcomp","results -> 1 compound -> DRAW + name optional",XSControl_traccess);
- IFSelect_Act::AddFunc ("trscomp","results -> 1 compound -> file + name optional",XSControl_traccess);
-
- IFSelect_Act::AddFunc ("fromshape","shape [level=1]: imported/exported entity (when known)",XSControl_fromshape);
- IFSelect_Act::AddFunc ("trconnexent","name of draw shape : entities -> connected shapes (when known)",XSControl_trconnexentities);
-
- IFSelect_Act::AddFunc ("trimport","filename or . varname givelist -> 1 shape per entity",XSControl_trimport);
- IFSelect_Act::AddFunc ("trimpcomp","filename or . varname givelist -> one xcompound",XSControl_trimport);
-
- IFSelect_Act::AddFunc ("twrite","shape : transfer write for this shape, AFTER newmodel !",XSControl_twrite);
-
- //skl IFSelect_Act::AddFunc ("checkbrep","shapename or * [+ rootname for expurged and faulties [+ mode f-s]]",XSHAPE_checkbrep);
- //skl IFSelect_Act::AddFunc ("dblist","option : clear nb index set n1 data n1 n2",XSHAPE_dblist);
-}
-
-// ######################################################################
-// #### ####
-// #### Additional Methods ####
-// #### ####
-// ######################################################################
-
-
-//=======================================================================
-//function : MoreShapes
-//purpose :
-//=======================================================================
-
-Standard_Integer XSControl_FuncShape::MoreShapes
- (const Handle(XSControl_WorkSession)& session,
- Handle(TopTools_HSequenceOfShape)& list, const Standard_CString name)
-{
- // name = un nom -> Draw
- // name = "*" -> tous les transferts RACINES du TP
- // name = "**" -> tous les transferts du TP : VRAIMENT TOUS
- // name = "." -> reperage graphique (not yet impl)
- // name = nom(n1-n2) avec n1,n2 entiers : les variables de nom nomn1 a nomn2
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (list.IsNull()) list = new TopTools_HSequenceOfShape();
- if (name[0] == '*' && (name[1] == '\0' || (name[1] == '*' && name[2] == '\0'))) {
- const Handle(Transfer_TransientProcess) &TP = session->TransferReader()->TransientProcess();
- if (TP.IsNull()) { sout<<"last transfer : unknown"<<endl;return 0; }
- Handle(TopTools_HSequenceOfShape) li = TransferBRep::Shapes(TP,(name[1] == '\0'));
- if (li.IsNull()) return 0;
- list->Append (li);
- return li->Length();
- }
- Standard_Integer i, paro = 0, parf = 0, moins = 0, n1 = 0, n2 = 0;
- for (i = 0; name[i] != '\0'; i ++) {
- if (name[i] == '(') paro = i;
- if (name[i] == '-') moins = i;
- if (name[i] == ')') parf = i;
- }
- if (paro && moins && parf) {
- n2 = atoi (&name[moins+1]);
- n1 = atoi (&name[paro +1]); if (n1 < 0) n1 += n2; // sinon on a n1-n2
- }
- // liste
- if (n1 <= n2 && n1 > 0) {
- char nom[50], nomsh[60]; Standard_Integer nbsh = 0;
- for (i = 0; i < paro; i ++) nom[i]=name[i]; nom[paro] = '\0';
- sout<<"Shapes DRAW named : "<<nom<<n1<<" to "<<nom<<n2;
- for (i = n1; i <= n2 ; i ++) {
- const char* nomshh = &nomsh[0];
- sprintf (nomsh,"%s%d",nom,i);
- TopoDS_Shape Shape = session->Vars()->GetShape(nomshh);
- if (Shape.IsNull()) continue;
- list->Append(Shape);
- nbsh ++;
- }
- sout<<" -> taken "<<nbsh<<" Shapes"<<endl;
- return nbsh;
- }
- const char* a1 = (const char *)name;
- TopoDS_Shape Shape = session->Vars()->GetShape(a1);
- if (Shape.IsNull()) { sout<<"not a shape draw:"<<a1<<endl; return 0; }
- list->Append(Shape);
- return 1;
-}
-
-
-//=======================================================================
-//function : FileAndVar
-//purpose :
-//=======================================================================
-
-Standard_Boolean XSControl_FuncShape::FileAndVar
- (const Handle(XSControl_WorkSession)& session,
- const Standard_CString file, const Standard_CString var,
- const Standard_CString def,
- TCollection_AsciiString& resfile, TCollection_AsciiString& resvar)
-{
- Standard_Boolean iafic = Standard_True;
- resfile.Clear(); resvar.Clear();
- if (file)
- if ( file[0] == '\0' ||
- (file[0] == '.' && file[1] == '\0')) iafic = Standard_False;
- if (!iafic) resfile.AssignCat (session->LoadedFile());
- else resfile.AssignCat (file);
-
- if (var && var[0] != '\0' && (var[0] != '.' || var[1] != '\0') )
- resvar.AssignCat (var);
- else if (resfile.Length() == 0) resvar.AssignCat (def);
- else {
- Standard_Integer nomdeb, nomfin;
- nomdeb = resfile.SearchFromEnd ("/");
- if (nomdeb <= 0) nomdeb = resfile.SearchFromEnd("\\"); // pour NT
- if (nomdeb < 0) nomdeb = 0;
- nomfin = resfile.SearchFromEnd (".");
- if (nomfin < nomdeb) nomfin = resfile.Length() + 1;
- resvar = resfile.SubString(nomdeb+1,nomfin-1);
- }
- return iafic;
-}
+++ /dev/null
-// Created on: 1995-03-16
-// 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_FuncShape_HeaderFile
-#define _XSControl_FuncShape_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Standard_Integer.hxx>
-#include <TopTools_HSequenceOfShape.hxx>
-#include <Standard_CString.hxx>
-#include <Standard_Boolean.hxx>
-class XSControl_WorkSession;
-class TCollection_AsciiString;
-
-
-//! Defines additionnal commands for XSControl to :
-//! - control of initialisation (xinit, xnorm, newmodel)
-//! - analyse of the result of a transfer (recorded in a
-//! TransientProcess for Read, FinderProcess for Write) :
-//! statistics, various lists (roots,complete,abnormal), what
-//! about one specific entity, producing a model with the
-//! abnormal result
-//!
-//! This appendix of XSControl is compiled separately to distinguish
-//! basic features from user callable forms
-class XSControl_FuncShape
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- //! Defines and loads all functions which work on shapes for XSControl (as ActFunc)
- Standard_EXPORT static void Init();
-
- //! Analyses a name as designating Shapes from a Vars or from
- //! XSTEP transfer (last Transfer on Reading). <name> can be :
- //! "*" : all the root shapes produced by last Transfer (Read)
- //! i.e. considers roots of the TransientProcess
- //! a name : a name of a variable DRAW
- //!
- //! Returns the count of designated Shapes. Their list is put in
- //! <list>. If <list> is null, it is firstly created. Then it is
- //! completed (Append without Clear) by the Shapes found
- //! Returns 0 if no Shape could be found
- Standard_EXPORT static Standard_Integer MoreShapes (const Handle(XSControl_WorkSession)& session, Handle(TopTools_HSequenceOfShape)& list, const Standard_CString name);
-
- //! Analyses given file name and variable name, with a default
- //! name for variables. Returns resulting file name and variable
- //! name plus status "file to read"(True) or "already read"(False)
- //! In the latter case, empty resfile means no file available
- //!
- //! If <file> is null or empty or equates ".", considers Session
- //! and returned status is False
- //! Else, returns resfile = file and status is True
- //! If <var> is neither null nor empty, resvar = var
- //! Else, the root part of <resfile> is considered, if defined
- //! Else, <def> is taken
- Standard_EXPORT static Standard_Boolean FileAndVar (const Handle(XSControl_WorkSession)& session, const Standard_CString file, const Standard_CString var, const Standard_CString def, TCollection_AsciiString& resfile, TCollection_AsciiString& resvar);
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _XSControl_FuncShape_HeaderFile
+++ /dev/null
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-
-#include <Dico_IteratorOfDictionaryOfInteger.hxx>
-#include <IFSelect_Act.hxx>
-#include <IFSelect_CheckCounter.hxx>
-#include <IFSelect_Functions.hxx>
-#include <IFSelect_SessionPilot.hxx>
-#include <Interface_CheckIterator.hxx>
-#include <Interface_InterfaceModel.hxx>
-#include <Interface_Macros.hxx>
-#include <Interface_Static.hxx>
-#include <Message.hxx>
-#include <Message_Messenger.hxx>
-#include <TColStd_HSequenceOfHAsciiString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <Transfer_Binder.hxx>
-#include <Transfer_FinderProcess.hxx>
-#include <Transfer_IteratorOfProcessForTransient.hxx>
-#include <Transfer_ResultFromModel.hxx>
-#include <Transfer_TransientProcess.hxx>
-#include <XSControl.hxx>
-#include <XSControl_Controller.hxx>
-#include <XSControl_Functions.hxx>
-#include <XSControl_SelectForTransfer.hxx>
-#include <XSControl_TransferReader.hxx>
-#include <XSControl_TransferWriter.hxx>
-#include <XSControl_WorkSession.hxx>
-
-// #######################################################################
-// ## ##
-// ## ##
-// ## FUNCTIONS ##
-// ## ##
-// ## ##
-// #######################################################################
-//=======================================================================
-//function : xinit
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_xinit(const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- // **** xinit ****
- if (argc > 1) return (XSControl::Session(pilot)->SelectNorm(arg1) ?
- IFSelect_RetDone : IFSelect_RetFail);
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- sout<<"Selected Norm:"<<XSControl::Session(pilot)->SelectedNorm()<<endl;
- return IFSelect_RetVoid;
-}
-
-
-//=======================================================================
-//function : xnorm
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_xnorm(const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- // **** xnorm ****
- Handle(XSControl_WorkSession) WS = XSControl::Session(pilot);
- Handle(XSControl_Controller) control = WS->NormAdaptor();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc == 1)
- sout<<"Current Norm. xnorm newnorm to change"<<endl;
- else sout<<"Current Norm :"<<endl;
- if (control.IsNull()) sout<<"no norm currently defined"<<endl;
- else
- sout<<" Long Name (complete) : "<<control->Name(Standard_False)<<endl
- << " Short name (resource) : "<<control->Name(Standard_True)<<endl;
- if (argc == 1) return IFSelect_RetVoid;
-
- control = XSControl_Controller::Recorded(arg1);
- if (control.IsNull()) {
- sout<<" No norm named : "<<arg1<<endl;
- return IFSelect_RetError;
- }
-
- WS->SetController(control);
- sout<<"new norm : "<<control->Name()<<endl;
- return IFSelect_RetDone;
-}
-
-
-//=======================================================================
-//function : newmodel
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_newmodel(const Handle(IFSelect_SessionPilot)& pilot)
-{
- // **** newmodel ****
- if (!XSControl::Session(pilot)->NewModel().IsNull()) return IFSelect_RetDone;
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- sout<<"No new Model produced"<<endl;
- return IFSelect_RetFail;
-}
-
-
-//=======================================================================
-//function : tpclear
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_tpclear(const Handle(IFSelect_SessionPilot)& pilot)
-{
- // **** tpclear/twclear ****
- const Standard_Boolean modew = (pilot->Word(0).Value(2) == 'w');
- const Handle(Transfer_FinderProcess) &FP = XSControl::Session(pilot)->TransferWriter()->FinderProcess();
- const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (modew) { if(!FP.IsNull()) FP->Clear(); else sout<<"No Transfer Write"<<endl; }
- else { if(!TP.IsNull()) TP->Clear(); else sout<<"No Transfer Read"<<endl; }
- return IFSelect_RetDone;
-}
-
-
-//=======================================================================
-//function : tpstat
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_tpstat(const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- //const Standard_CString arg2 = pilot->Arg(2);
- const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (TP.IsNull()) { sout<<"No Transfer Read"<<endl; return IFSelect_RetError;}
- // **** tpstat ****
-
- Standard_Integer mod1 = -1;
- Standard_Integer mod2 = 0;
- // g : general c : check (compte) C (liste) f : fails(compte) F (liste)
- // resultats racines : n : n0s entites s : status b : binders
- // t : compte par type r : compte par resultat l : liste(type-resultat)
- // *n *s *b *t *r *l : idem sur tout
- // ?n etc.. : idem sur resultats anormaux
- // ? tout court pour help
-
- if (argc > 1) {
- char a2 = arg1[1]; if (a2 == '\0') a2 = '!';
- switch (arg1[0]) {
- case 'g' : mod1 = 0; break;
- case 'c' : mod1 = 4; mod2 = 4; break;
- case 'C' : mod1 = 4; mod2 = 2; break;
- case 'f' : mod1 = 5; mod2 = 4; break;
- case 'F' : mod1 = 5; mod2 = 2; break;
- case '*' : mod1 = 2; break;
- case '?' : mod1 = 3; break;
- default : mod1 = 1; if (argc > 2) mod1 = 2; a2 = arg1[0]; break;
- }
- if (mod1 < 1 || mod1 > 3) a2 = '!';
- switch (a2) {
- case 'n' : mod2 = 0; break;
- case 's' : mod2 = 1; break;
- case 'b' : mod2 = 2; break;
- case 't' : mod2 = 3; break;
- case 'r' : mod2 = 4; break;
- case 'l' : mod2 = 5; break;
- case 'L' : mod2 = 6; break;
- case '!' : break;
- case '?' : mod1 = -1; break;
- default : mod1 = -2; break;
- }
- }
- // A present help eventuel
- if (mod1 < -1) sout<<"Unknown Mode"<<endl;
- if (mod1 < 0) {
- sout<<"Modes available :\n"
- <<"g : general c : checks (count) C (list)\n"
- <<" f : fails (count) F (list)\n"
- <<" n : numbers of transferred entities (on TRANSFER ROOTS)\n"
- <<" s : their status (type entity-result , presence checks)\n"
- <<" b : detail of binders\n"
- <<" t : count per entity type r : per type/status result\n"
- <<" l : count per couple type entity/result\n"
- <<" L : list per couple type entity/result\n"
- <<" *n *s *b *t *r *l *L : idem on ALL recorded items\n"
- <<" ?n ?s ?b ?t ... : idem on abnormal items\n"
- <<" n select : n applied on a selection idem for s b t r l"<<endl;
- if (mod1 < -1) return IFSelect_RetError;
- return IFSelect_RetVoid;
- }
-
- if (!TP.IsNull()) {
- sout<<"TransferRead :";
- if (TP->Model() != pilot->Session()->Model()) sout<<"Model differs from the session";
- Handle(TColStd_HSequenceOfTransient) list =
- IFSelect_Functions::GiveList(pilot->Session(),pilot->CommandPart(2));
- XSControl_TransferReader::PrintStatsOnList (TP,list,mod1,mod2);
- }
- else sout<<"TransferRead : not defined"<<endl;
- return IFSelect_RetVoid;
-}
-
-
-//=======================================================================
-//function : tpent
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_tpent(const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
- // **** tpent ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (TP.IsNull()) { sout<<"No Transfer Read"<<endl; return IFSelect_RetError;}
- Handle(Interface_InterfaceModel) model = TP->Model();
- if (model.IsNull()) return IFSelect_RetFail;
-
- if (argc < 2) { sout<<"Give ENTITY NUMBER (IN MODEL TransferProcess)"<<endl; return IFSelect_RetError; }
- Standard_Integer num = atoi(arg1);
- if (num <= 0 || num > model->NbEntities()) { sout<<"Number not in [1 - "<<model->NbEntities()<<"]"<<endl; return IFSelect_RetError; }
- Handle(Standard_Transient) ent = model->Value(num);
- Standard_Integer index = TP->MapIndex (ent);
- if (index == 0) sout<<"Entity "<<num<<" not recorded in transfer"<<endl;
- else XSControl::Session(pilot)->PrintTransferStatus (index,Standard_False,sout);
- return IFSelect_RetVoid;
-}
-
-
-//=======================================================================
-//function : tpitem
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_tpitem(const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
-// **** tpitem/tproot/twitem/twroot ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (argc < 2) { sout<<"Give ITEM NUMBER (in TransferProcess)"<<endl; return IFSelect_RetError; }
- Standard_Integer num = atoi(arg1);
- if (pilot->Word(0).Value(3) == 'r') num = -num;
- Standard_Boolean modew = Standard_False;
- if (pilot->Word(0).Value(2) == 'w') modew = Standard_True;
- Handle(Transfer_Binder) binder;
- Handle(Transfer_Finder) finder;
- Handle(Standard_Transient) ent;
- if (!XSControl::Session(pilot)->PrintTransferStatus(num,modew,sout))
- sout<<" - Num="<<num<<" incorrect"<<endl;
- return IFSelect_RetVoid;
-}
-
-
-//=======================================================================
-//function : trecord
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_trecord(const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
-// **** trecord : TransferReader ****
- Standard_Boolean tous = (argc == 1);
- Standard_Integer num = -1;
- const Handle(Interface_InterfaceModel) &mdl = XSControl::Session(pilot)->Model();
- const Handle(XSControl_TransferReader) &TR = XSControl::Session(pilot)->TransferReader();
- Handle(Standard_Transient) ent;
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (mdl.IsNull() || TR.IsNull() || TP.IsNull())
- { sout<<" init not done"<<endl; return IFSelect_RetError; }
- if (!tous) num = atoi(arg1);
- // Enregistrer les racines
- if (tous) {
- Standard_Integer nb = TP->NbRoots();
- sout<<" Recording "<<nb<<" Roots"<<endl;
- for (Standard_Integer i = 1; i <= nb; i ++) {
- ent = TP->Root(i);
- if (TR->RecordResult (ent)) sout<<" Root n0."<<i<<endl;
- else sout<<" Root n0."<<i<<" not recorded"<<endl;
- }
- } else {
- if (num < 1 || num > mdl->NbEntities()) sout<<"incorrect number:"<<num<<endl;
- else if (TR->RecordResult(mdl->Value(num))) sout<<" Entity n0."<<num<<endl;
- else sout<<" Entity n0."<<num<<" not recorded"<<endl;
- }
- return IFSelect_RetDone;
-}
-
-
-//=======================================================================
-//function : trstat
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_trstat(const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
-// **** trstat : TransferReader ****
- const Handle(XSControl_TransferReader) &TR = XSControl::Session(pilot)->TransferReader();
- if (TR.IsNull()) { sout<<" init not done"<<endl; return IFSelect_RetError; }
- Handle(Interface_InterfaceModel) mdl = TR->Model();
- if (mdl.IsNull()) { sout<<" No model"<<endl; return IFSelect_RetError; }
- sout<<" Statistics : FileName : "<<TR->FileName()<<endl;
- if (argc == 1) {
- // stats generales
- TR->PrintStats(10,0);
- } else {
- // stats unitaires
- Standard_Integer num = atoi(arg1);
- if (num < 1 || num > mdl->NbEntities()) { sout<<" incorrect number:"<<arg1<<endl; return IFSelect_RetError; }
- Handle(Standard_Transient) ent = mdl->Value(num);
- if (!TR->IsRecorded(ent)) { sout<<" Entity "<<num<<" not recorded"<<endl; return IFSelect_RetError; }
- Handle(Transfer_ResultFromModel) RM = TR->FinalResult(ent);
- Handle(TColStd_HSequenceOfTransient) list = TR->CheckedList(ent);
- Standard_Integer i, nb = list->Length();
- if (nb > 0) sout<<" Entities implied by Check/Result :"<<nb<<" i.e.:";
- for (i = 1; i <= nb; i ++) { sout<<" "; mdl->Print(list->Value(i),sout); }
- sout<<endl;
- if (RM.IsNull()) { sout<<" no other info"<<endl; return IFSelect_RetVoid; }
- Interface_CheckIterator chl = RM->CheckList(Standard_False);
- pilot->Session()->PrintCheckList(chl,Standard_False,IFSelect_EntitiesByItem);
- }
- return IFSelect_RetVoid;
-}
-
-
-//=======================================================================
-//function : trbegin
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_trbegin(const Handle(IFSelect_SessionPilot)& pilot)
-{
- // **** trbegin : TransferReader ****
- Handle(XSControl_TransferReader) TR = XSControl::Session(pilot)->TransferReader();
- Standard_Boolean init = TR.IsNull();
- if (pilot->NbWords() > 1) { if (pilot->Arg(1)[0] == 'i') init = Standard_True; }
- if (init) {
- XSControl::Session(pilot)->InitTransferReader (0);
- TR = XSControl::Session(pilot)->TransferReader();
- if (TR.IsNull()) {
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- sout<<" init not done or failed"<<endl;
- return IFSelect_RetError;
- }
- }
- TR->BeginTransfer();
- return IFSelect_RetDone;
-}
-
-
-//=======================================================================
-//function : tread
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_tread(const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- //const Standard_CString arg1 = pilot->Arg(1);
- // **** tread : TransferReader ****
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- const Handle(XSControl_TransferReader) &TR = XSControl::Session(pilot)->TransferReader();
- if (TR.IsNull()) { sout<<" init not done"<<endl; return IFSelect_RetError; }
- const Handle(Interface_InterfaceModel) &mdl = TR->Model();
- if (mdl.IsNull()) { sout<<" No model"<<endl; return IFSelect_RetError; }
- if (argc < 2) {
-// DeclareAndCast(IFSelect_Selection,sel,pilot->Session()->NamedItem("xst-model-roots"));
- Handle(Standard_Transient) sel = pilot->Session()->NamedItem("xst-model-roots");
- if (sel.IsNull()) { sout<<"Select Roots absent"<<endl; return IFSelect_RetError; }
- Handle(TColStd_HSequenceOfTransient) list = pilot->Session()->GiveList(sel);
- sout<<" Transferring all roots i.e. : "<<TR->TransferList(list)<<endl;
- } else {
- Handle(TColStd_HSequenceOfTransient) list =
- IFSelect_Functions::GiveList(pilot->Session(),pilot->CommandPart(1));
- sout<<" Transfer of "<<list->Length()<<" entities"<<endl;
- Standard_Integer nb = TR->TransferList(list);
- sout<<" Gives "<<nb<<" results"<<endl;
- }
- return IFSelect_RetDone;
-}
-
-
-//=======================================================================
-//function : trtp
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_trtp(const Handle(IFSelect_SessionPilot)& pilot)
-{
- // **** TReader -> TProcess ****
- const Handle(XSControl_TransferReader) &TR = XSControl::Session(pilot)->TransferReader();
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (TR.IsNull()) sout<<" No TransferReader"<<endl;
- else if (TR->TransientProcess().IsNull()) sout<<" Transfer Reader without Process"<<endl;
- return IFSelect_RetVoid;
-}
-
-
-//=======================================================================
-//function : tptr
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_tptr(const Handle(IFSelect_SessionPilot)& pilot)
-{
- // **** TProcess -> TReader ****
- XSControl::Session(pilot)->InitTransferReader (3);
- return IFSelect_RetDone;
-}
-
-
-//=======================================================================
-//function : twmode
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_twmode(const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->NbWords();
- const Standard_CString arg1 = pilot->Arg(1);
- // **** twmode ****
- Handle(XSControl_TransferWriter) TW = XSControl::Session(pilot)->TransferWriter();
- Handle(XSControl_Controller) control = XSControl::Session(pilot)->NormAdaptor();
- Standard_Integer modemin,modemax;
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (control->ModeWriteBounds (modemin,modemax)) {
- sout<<"Write Mode : allowed values "<<modemin<<" to "<<modemax<<endl;
- for (Standard_Integer modd = modemin; modd <= modemax; modd ++) {
- sout<<modd<<" : "<<control->ModeWriteHelp (modd)<<endl;;
- }
- }
- sout<<"Write Mode : actual = "<<TW->TransferMode()<<endl;
- if (argc <= 1) return IFSelect_RetVoid;
- Standard_Integer mod = atoi(arg1);
- sout<<"New value -> "<<arg1<<endl;
- TW->SetTransferMode(mod);
- if (!control->IsModeWrite (mod)) sout<<"Warning : this new value is not supported"<<endl;
- return IFSelect_RetDone;
-}
-
-
-//=======================================================================
-//function : twstat
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_twstat(const Handle(IFSelect_SessionPilot)& pilot)
-{
- const Handle(Transfer_FinderProcess) &FP = XSControl::Session(pilot)->TransferWriter()->FinderProcess();
- // **** twstat ****
- // Pour Write
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (!FP.IsNull()) {
- sout<<"TransferWrite:";
- FP->PrintStats (sout);
- }
- else sout<<"TransferWrite: not defined"<<endl;
- return IFSelect_RetVoid;
-}
-
-
-//=======================================================================
-//function : settransfert
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_settransfert(const Handle(IFSelect_SessionPilot)& pilot)
-{
- // **** SelectForTransfer ****
- return pilot->RecordItem(new XSControl_SelectForTransfer(XSControl::Session(pilot)->TransferReader()));
-}
-
-
-
-static int initactor = 0;
-
-//=======================================================================
-//function : Init
-//purpose :
-//=======================================================================
-
-void XSControl_Functions::Init ()
-{
- if (initactor) return; initactor = 1;
- IFSelect_Act::SetGroup("DE: General");
-
- IFSelect_Act::AddFunc ("xinit","[norm:string to change norme] reinitialises according to the norm",XSControl_xinit);
- IFSelect_Act::AddFunc ("xnorm","displays current norm +norm : changes it",XSControl_xnorm);
-
- IFSelect_Act::AddFunc ("newmodel","produces a new empty model, for the session",XSControl_newmodel);
-
- IFSelect_Act::AddFunc ("tpclear","Clears TransferProcess (READ)",XSControl_tpclear);
- IFSelect_Act::AddFunc ("twclear","Clears TransferProcess (WRITE)",XSControl_tpclear);
-
- IFSelect_Act::AddFunc ("tpstat","Statistics on TransferProcess (READ)",XSControl_tpstat);
-
- IFSelect_Act::AddFunc ("tpent","[num:integer] Statistics on an entity of the model (READ)",XSControl_tpent);
-
- IFSelect_Act::AddFunc ("tpitem","[num:integer] Statistics on ITEM of transfer (READ)" ,XSControl_tpitem);
- IFSelect_Act::AddFunc ("tproot","[num:integer] Statistics on a ROOT of transfert (READ)" ,XSControl_tpitem);
- IFSelect_Act::AddFunc ("twitem","[num:integer] Statistics on an ITEM of transfer (WRITE)" ,XSControl_tpitem);
- IFSelect_Act::AddFunc ("twroot","[num:integer] Statistics on a ROOT of transfer (WRITE)",XSControl_tpitem);
-
- IFSelect_Act::AddFunc ("trecord","record : all root results; or num : for entity n0.num",XSControl_trecord);
- IFSelect_Act::AddFunc ("trstat","general statistics; or num : stats on entity n0 num",XSControl_trstat);
- IFSelect_Act::AddFunc ("trbegin","begin-transfer-reader [init]",XSControl_trbegin);
- IFSelect_Act::AddFunc ("tread","transfers all roots, or num|sel|sel num : entity list, by transfer-reader",XSControl_tread);
-
- IFSelect_Act::AddFunc ("trtp","feeds commands tp... with results from tr...",XSControl_trtp);
- IFSelect_Act::AddFunc ("tptr","feeds tr... from tp... (may be incomplete)",XSControl_tptr);
-
- IFSelect_Act::AddFunc ("twmode","displays mode transfer write, + num changes it",XSControl_twmode);
- IFSelect_Act::AddFunc ("twstat","Statistics on TransferProcess (WRITE)",XSControl_twstat);
-
- IFSelect_Act::AddFSet ("selecttransfer","selection (recognize from transfer actor)",XSControl_settransfert);
-}
+++ /dev/null
-// Created on: 1996-03-26
-// Created by: Christian CAILLET
-// Copyright (c) 1996-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _XSControl_Functions_HeaderFile
-#define _XSControl_Functions_HeaderFile
-
-#include <Standard.hxx>
-
-//! Functions from XSControl gives access to actions which can be
-//! commanded with the resources provided by XSControl: especially
-//! Controller and Transfer
-//!
-//! It works by adding functions by method Init
-class XSControl_Functions
-{
- public:
-
- //! Defines and loads all functions for XSControl (as ActFunc)
- Standard_EXPORT static void Init();
-};
-
-#endif // _XSControl_Functions_HeaderFile
//: gka 14.04.99: S4136: apply scaling
#include <BRep_Builder.hxx>
-#include <IFSelect_Functions.hxx>
#include <Interface_Check.hxx>
#include <Interface_InterfaceModel.hxx>
#include <Interface_ShareFlags.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Shape.hxx>
#include <Transfer_Binder.hxx>
-#include <Transfer_IteratorOfProcessForTransient.hxx>
#include <Transfer_TransientProcess.hxx>
#include <XSControl_Controller.hxx>
#include <XSControl_Reader.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <Transfer_ActorOfTransientProcess.hxx>
-#include <Transfer_IteratorOfProcessForTransient.hxx>
#include <Transfer_ResultFromModel.hxx>
#include <Transfer_ResultFromTransient.hxx>
#include <Transfer_SimpleBinderOfTransient.hxx>
#include <Transfer_TransientProcess.hxx>
#include <TransferBRep.hxx>
#include <TransferBRep_ShapeBinder.hxx>
+#include <TransferBRep_ShapeMapper.hxx>
#include <XSControl_Controller.hxx>
#include <XSControl_TransferReader.hxx>
-#include <XSControl_Utils.hxx>
#include <stdio.h>
+
IMPLEMENT_STANDARD_RTTIEXT(XSControl_TransferReader,MMgt_TShared)
+//=======================================================================
+//function : BinderShape
+//purpose :
+//=======================================================================
+
+static TopoDS_Shape BinderShape (const Handle(Standard_Transient)& tr)
+{
+ TopoDS_Shape sh;
+ DeclareAndCast(Transfer_Binder,sb,tr);
+ if (!sb.IsNull()) return TransferBRep::ShapeResult(sb);
+ DeclareAndCast(TransferBRep_ShapeMapper,sm,tr);
+ if (!sm.IsNull()) return sm->Shape();
+ DeclareAndCast(TopoDS_HShape,hs,tr);
+ if (!hs.IsNull()) return hs->Shape();
+ return sh;
+}
+
//=======================================================================
//function : SetController
//purpose :
if (res.IsNull()) return tres;
Handle(Transfer_ResultFromTransient) mres = res->MainResult();
if (mres.IsNull()) return tres;
- XSControl_Utils xu;
- TopoDS_Shape sh = xu.BinderShape (mres->Binder());
+ TopoDS_Shape sh = BinderShape (mres->Binder());
// Ouh la vilaine verrue
Standard_Real tolang = Interface_Static::RVal("read.encoderegularity.angle");
{
Handle(Standard_Transient) nulh;
// cas de la shape
- XSControl_Utils xu;
- TopoDS_Shape sh = xu.BinderShape (res);
+ TopoDS_Shape sh = BinderShape (res);
if (!sh.IsNull()) return EntityFromShapeResult (sh,mode);
Handle(Transfer_Binder) abinder;
if (res.IsNull()) return nulh;
Standard_Integer i,j,nb;
- XSControl_Utils xu;
if (mode == 0 || mode == 1 || mode == -1) {
// on regarde dans le TransientProcess
if (!myTP.IsNull()) {
for (ir = 1; ir <= nr; ir ++) {
DeclareAndCast(Transfer_ResultFromTransient,rft,list->Value(ir));
if (rft.IsNull()) continue;
- TopoDS_Shape sh = xu.BinderShape (rft->Binder());
+ TopoDS_Shape sh = BinderShape (rft->Binder());
if (!sh.IsNull() && sh == res) return rft->Start();
}
// A present, recherche et enregistrement
- XSControl_Utils xu;
if (mode == 0 || mode == 1) {
// on regarde dans le TransientProcess
if (!myTP.IsNull()) {
for (j = 1; j <= nb; j ++) {
i = (mode == 0 ? myModel->Number (myTP->Root(j)) : j);
if (i == 0) continue;
- TopoDS_Shape sh = xu.BinderShape (myTP->MapItem(i));
+ TopoDS_Shape sh = BinderShape (myTP->MapItem(i));
if (!sh.IsNull() && shapes.Contains(sh)) {
lt->Append (myTP->Mapped(i));
j=nb; //skl (for looking for entities in checkbrep)
for (ir = 1; ir <= nr; ir ++) {
DeclareAndCast(Transfer_ResultFromTransient,rft,list->Value(i));
if (rft.IsNull()) continue;
- TopoDS_Shape sh = xu.BinderShape (rft->Binder());
+ TopoDS_Shape sh = BinderShape (rft->Binder());
if (!sh.IsNull() && shapes.Contains(sh)) lt->Append (rft->Start());
}
Standard_Integer stat;
Standard_Integer nbv = 0, nbw = 0, nbf = 0, nbr = 0, nbrw = 0, nbrf = 0, nbnr = 0, nbi = 0;
- Transfer_IteratorOfProcessForTransient itrp(Standard_True);
+ Transfer_TransientProcess::Iterator itrp(Standard_True);
if (what == 1) itrp = TP->RootResult(Standard_True);
if (what == 2) itrp = TP->CompleteResult(Standard_True);
if (what == 3) itrp = TP->AbnormalResult();
#include <Transfer_SimpleBinderOfTransient.hxx>
#include <XSControl_Controller.hxx>
#include <XSControl_TransferWriter.hxx>
-#include <XSControl_Utils.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XSControl_TransferWriter,MMgt_TShared)
+++ /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 <BRep_Builder.hxx>
-#include <BRepTools.hxx>
-#include <Interface_HArray1OfHAsciiString.hxx>
-#include <Interface_Macros.hxx>
-#include <Interface_MSG.hxx>
-#include <Message.hxx>
-#include <Message_Messenger.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_TypeMismatch.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TCollection_HAsciiString.hxx>
-#include <TCollection_HExtendedString.hxx>
-#include <TColStd_HArray1OfTransient.hxx>
-#include <TColStd_HSequenceOfAsciiString.hxx>
-#include <TColStd_HSequenceOfExtendedString.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Compound.hxx>
-#include <TopoDS_HShape.hxx>
-#include <TopoDS_Iterator.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Shell.hxx>
-#include <TopoDS_Wire.hxx>
-#include <TransferBRep.hxx>
-#include <TransferBRep_ShapeBinder.hxx>
-#include <TransferBRep_ShapeMapper.hxx>
-#include <XSControl_Utils.hxx>
-
-static TCollection_AsciiString bufasc;
-static TCollection_ExtendedString bufext;
-static const Standard_ExtString voidext = { 0 };
-
-
- XSControl_Utils::XSControl_Utils () { }
-
-// #########################################################
-// ####### Fonctions de TRACE #######
-
- void XSControl_Utils::TraceLine (const Standard_CString line) const
-{
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- sout<<line<<endl;
-}
-
- void XSControl_Utils::TraceLines (const Handle(Standard_Transient)& lines) const
-{
- Handle(Message_Messenger) sout = Message::DefaultMessenger();
- Standard_Integer i,nb;
- DeclareAndCast(TColStd_HSequenceOfHAsciiString,linha,lines);
- if (!linha.IsNull()) {
- nb = linha->Length();
- for (i = 1; i <= nb; i ++)
- if (!linha->Value(i).IsNull()) sout<<linha->Value(i)->ToCString()<<endl;
- return;
- }
- DeclareAndCast(TColStd_HSequenceOfAsciiString,lina,lines);
- if (!lina.IsNull()) {
- nb = lina->Length();
- for (i = 1; i <= nb; i ++)
- sout<<lina->Value(i).ToCString()<<endl;
- return;
- }
- DeclareAndCast(TColStd_HSequenceOfHExtendedString,linhe,lines);
- if (!linhe.IsNull()) {
- nb = linhe->Length();
- for (i = 1; i <= nb; i ++)
- if (!linhe->Value(i).IsNull())
- sout << linhe->Value(i) << endl;
- return;
- }
- DeclareAndCast(TColStd_HSequenceOfExtendedString,linee,lines);
- if (!linee.IsNull()) {
- nb = linee->Length();
- for (i = 1; i <= nb; i ++)
- sout << linee->Value(i) << endl;
- return;
- }
- DeclareAndCast(TCollection_HAsciiString,lin1a,lines);
- if (!lin1a.IsNull()) sout<<lin1a;
- DeclareAndCast(TCollection_HExtendedString,lin1e,lines);
- if (!lin1e.IsNull()) sout<<lin1e;
-}
-
-
-// #########################################################
-// ####### TRANSIENT : Quelques acces de base #######
-
- Standard_Boolean XSControl_Utils::IsKind
- (const Handle(Standard_Transient)& item, const Handle(Standard_Type)& what) const
-{
- if (item.IsNull()) return Standard_False;
- if (what.IsNull()) return Standard_False;
- return item->IsKind(what);
-}
-
- Standard_CString XSControl_Utils::TypeName
- (const Handle(Standard_Transient)& item, const Standard_Boolean nopk) const
-{
- if (item.IsNull()) return "";
- DeclareAndCast(Standard_Type,atype,item);
- if (atype.IsNull()) atype = item->DynamicType();
- Standard_CString tn = atype->Name();
- if (!nopk) return tn;
- for (int i = 0; tn[i] != '\0'; i ++) {
- if (tn[i] == '_') return &tn[i+1];
- }
- return tn;
-}
-
-
-// ####### TRANSIENT : Fonctions de liste #######
-
- Handle(Standard_Transient) XSControl_Utils::TraValue
- (const Handle(Standard_Transient)& seqval, const Standard_Integer num) const
-{
- Handle(Standard_Transient) val;
- if (num < 1) return val;
- if (seqval.IsNull()) return val;
- DeclareAndCast(TColStd_HSequenceOfHAsciiString,seqs,seqval);
- if (!seqs.IsNull())
- { if (num <= seqs->Length()) val = seqs->Value(num); return val; }
- DeclareAndCast(TColStd_HSequenceOfTransient,seqt,seqval);
- if (!seqt.IsNull())
- { if (num <= seqt->Length()) val = seqt->Value(num); return val; }
-// Standard_TypeMismatch::Raise("XSControl_Utils::SeqTraValue");
- return val;
-}
-
- Handle(TColStd_HSequenceOfTransient) XSControl_Utils::NewSeqTra () const
- { return new TColStd_HSequenceOfTransient(); }
-
- void XSControl_Utils::AppendTra
- (const Handle(TColStd_HSequenceOfTransient)& seqval,
- const Handle(Standard_Transient)& traval) const
- { seqval->Append (traval); }
-
-
-// ####### DATES #######
-
- Standard_CString XSControl_Utils::DateString
- (const Standard_Integer yy, const Standard_Integer mm,
- const Standard_Integer dd, const Standard_Integer hh,
- const Standard_Integer mn, const Standard_Integer ss) const
-{
- char ladate[50];
- Interface_MSG::TDate (ladate, yy,mm,dd,hh,mn,ss);
- bufasc.Clear(); bufasc.AssignCat(ladate);
- return bufasc.ToCString();
-}
-
- void XSControl_Utils::DateValues
- (const Standard_CString text,
- Standard_Integer& yy, Standard_Integer& mm, Standard_Integer& dd,
- Standard_Integer& hh, Standard_Integer& mn, Standard_Integer& ss) const
- { Interface_MSG::NDate (text, yy,mm,dd,hh,mn,ss); }
-
-
-// ##########################################################
-// ####### STRING : Ascii de base #######
-
- Standard_CString XSControl_Utils::ToCString
- (const Handle(TCollection_HAsciiString)& strval) const
- {
-//JR/Hp
- Standard_CString astr = (Standard_CString ) (strval.IsNull() ? "" : strval->ToCString());
- return astr ;
-// return (strval.IsNull() ? "" : strval->ToCString());
- }
-
- Standard_CString XSControl_Utils::ToCString
- (const TCollection_AsciiString& strval) const
- { return strval.ToCString(); }
-
- Handle(TCollection_HAsciiString) XSControl_Utils::ToHString
- (const Standard_CString strcon) const
- { return new TCollection_HAsciiString(strcon); }
-
- TCollection_AsciiString XSControl_Utils::ToAString
- (const Standard_CString strcon) const
- { return TCollection_AsciiString(strcon); }
-
-// ####### STRING : Extended de base #######
-
- Standard_ExtString XSControl_Utils::ToEString
- (const Handle(TCollection_HExtendedString)& strval) const
- { return (strval.IsNull() ? voidext : strval->ToExtString()); }
-
- Standard_ExtString XSControl_Utils::ToEString
- (const TCollection_ExtendedString& strval) const
- { return strval.ToExtString(); }
-
- Handle(TCollection_HExtendedString) XSControl_Utils::ToHString
- (const Standard_ExtString strcon) const
- { return new TCollection_HExtendedString(strcon); }
-
- TCollection_ExtendedString XSControl_Utils::ToXString
- (const Standard_ExtString strcon) const
- { return TCollection_ExtendedString(strcon); }
-
-// ####### STRING : Ascii <-> Extended #######
-
- Standard_ExtString XSControl_Utils::AsciiToExtended (const Standard_CString str) const
-{
- bufext.Clear(); bufext = TCollection_ExtendedString (str);
- return bufext.ToExtString();
-}
-
- Standard_Boolean XSControl_Utils::IsAscii (const Standard_ExtString str) const
-{
- bufext.Clear(); bufext.AssignCat (str);
- return bufext.IsAscii();
-}
-
- Standard_CString XSControl_Utils::ExtendedToAscii (const Standard_ExtString str) const
-{
- bufext.Clear(); bufext.AssignCat (str); bufasc.Clear();
- Standard_Integer i, nb = bufext.Length();
- for (i = 1; i <= nb; i ++) {
- int unext = bufext.Value(i);
- unext = unext & 127;
- char uncar = char(unext);
- bufasc.AssignCat (uncar);
- }
- return bufasc.ToCString();
-}
-
-// ####### STRING : LISTES #######
-
- Standard_CString XSControl_Utils::CStrValue
- (const Handle(Standard_Transient)& list, const Standard_Integer num) const
-{
- DeclareAndCast(TColStd_HSequenceOfHAsciiString,linha,list);
- if (!linha.IsNull()) {
-//JR/Hp
- Standard_CString astr = (Standard_CString )
- (num > linha->Length() ? "" : linha->Value(num)->ToCString());
- return astr ;
-// return (num > linha->Length() ? "" : linha->Value(num)->ToCString());
- }
-
- DeclareAndCast(TColStd_HSequenceOfAsciiString,lina,list);
- if (!lina.IsNull()) {
-//JR/Hp
- Standard_CString astr = (Standard_CString )
- (num > lina->Length() ? "" : lina->Value(num).ToCString());
- return astr ;
-// return (num > lina->Length() ? "" : lina->Value(num).ToCString());
- }
-
- DeclareAndCast(TColStd_HSequenceOfHExtendedString,linhe,list);
- if (!linhe.IsNull()) {
-//JR/Hp
- Standard_CString astr = (Standard_CString )
- (num > linhe->Length() ? "" : ExtendedToAscii(linhe->Value(num)->ToExtString()));
- return astr ;
-// return (num > linhe->Length() ? "" : ExtendedToAscii(linhe->Value(num)->ToExtString()));
- }
-
- DeclareAndCast(TColStd_HSequenceOfExtendedString,linee,list);
- if (!linee.IsNull()) {
-//JR/Hp
- Standard_CString astr = (Standard_CString )
- (num > linee->Length() ? "" : ExtendedToAscii(linee->Value(num).ToExtString()));
- return astr ;
-// return (num > linee->Length() ? "" : ExtendedToAscii(linee->Value(num).T
- }
-
- DeclareAndCast(TCollection_HAsciiString,lin1a,list);
- if (!lin1a.IsNull()) return lin1a->ToCString();
- DeclareAndCast(TCollection_HExtendedString,lin1e,list);
- if (!lin1e.IsNull()) return ExtendedToAscii(lin1e->ToExtString());
- return "";
-}
-
-
- Standard_ExtString XSControl_Utils::EStrValue
- (const Handle(Standard_Transient)& list, const Standard_Integer num) const
-{
- DeclareAndCast(TColStd_HSequenceOfHAsciiString,linha,list);
- if (!linha.IsNull()) return
- (num > linha->Length() ? voidext : AsciiToExtended(linha->Value(num)->ToCString()));
-
- DeclareAndCast(TColStd_HSequenceOfAsciiString,lina,list);
- if (!lina.IsNull())
- (num > lina->Length() ? voidext : AsciiToExtended(lina->Value(num).ToCString()));
-
- DeclareAndCast(TColStd_HSequenceOfHExtendedString,linhe,list);
- if (!linhe.IsNull()) return
- (num > linhe->Length() ? voidext : linhe->Value(num)->ToExtString());
-
- DeclareAndCast(TColStd_HSequenceOfExtendedString,linee,list);
- if (!linee.IsNull()) return
- (num > linee->Length() ? voidext : linee->Value(num).ToExtString());
-
- DeclareAndCast(TCollection_HAsciiString,lin1a,list);
- if (!lin1a.IsNull()) return AsciiToExtended(lin1a->ToCString());
- DeclareAndCast(TCollection_HExtendedString,lin1e,list);
- if (!lin1e.IsNull()) return lin1e->ToExtString();
- return voidext;
-}
-
- Handle(TColStd_HSequenceOfHAsciiString) XSControl_Utils::NewSeqCStr () const
- { return new TColStd_HSequenceOfHAsciiString(); }
-
- void XSControl_Utils::AppendCStr
- (const Handle(TColStd_HSequenceOfHAsciiString)& seqval,
- const Standard_CString strval) const
- { seqval->Append (new TCollection_HAsciiString(strval)); }
-
- Handle(TColStd_HSequenceOfHExtendedString) XSControl_Utils::NewSeqEStr () const
- { return new TColStd_HSequenceOfHExtendedString(); }
-
- void XSControl_Utils::AppendEStr
- (const Handle(TColStd_HSequenceOfHExtendedString)& seqval,
- const Standard_ExtString strval) const
- { seqval->Append (new TCollection_HExtendedString(strval)); }
-
-
-// ##########################################################
-// ####### SHAPES : Acces de base #######
-
- Standard_Boolean XSControl_Utils::WriteShape
- (const TopoDS_Shape& shape,
- const Standard_CString filename) const
- { return BRepTools::Write (shape,filename); }
-
- TopoDS_Shape XSControl_Utils::NewShape () const
- { TopoDS_Shape shape; return shape; }
-
- Standard_Boolean XSControl_Utils::ReadShape
- (TopoDS_Shape& shape,
- const Standard_CString filename) const
-{
- BRep_Builder B;
- return BRepTools::Read (shape,filename,B);
-}
-
- Standard_Boolean XSControl_Utils::IsNullShape (const TopoDS_Shape& shape) const
- { return shape.IsNull(); }
-
-
- TopoDS_Shape XSControl_Utils::CompoundFromSeq
- (const Handle(TopTools_HSequenceOfShape)& seqval) const
-{
- BRep_Builder B;
- TopoDS_Compound C;
- B.MakeCompound(C);
- Standard_Integer i,n = seqval->Length();
- for (i = 1; i <= n ; i ++) B.Add(C,seqval->Value(i));
- return C;
-}
-
- TopAbs_ShapeEnum XSControl_Utils::ShapeType
- (const TopoDS_Shape& shape, const Standard_Boolean compound) const
-{
- if (shape.IsNull()) return TopAbs_SHAPE;
- TopAbs_ShapeEnum res = shape.ShapeType();
- if (!compound || res != TopAbs_COMPOUND) return res;
- res = TopAbs_SHAPE;
- for (TopoDS_Iterator iter(shape); iter.More(); iter.Next()) {
- TopoDS_Shape sh = iter.Value();
- if (sh.IsNull()) continue;
- TopAbs_ShapeEnum typ = sh.ShapeType();
- if (typ == TopAbs_COMPOUND) typ = ShapeType (sh,compound);
- if (res == TopAbs_SHAPE) res = typ;
-// Egalite : OK; Pseudo-Egalite : EDGE/WIRE ou FACE/SHELL
- else if (res == TopAbs_EDGE && typ == TopAbs_WIRE) res = typ;
- else if (res == TopAbs_WIRE && typ == TopAbs_EDGE) continue;
- else if (res == TopAbs_FACE && typ == TopAbs_SHELL) res = typ;
- else if (res == TopAbs_SHELL && typ == TopAbs_FACE) continue;
- else if (res != typ) return TopAbs_COMPOUND;
- }
- return res;
-}
-
- TopoDS_Shape XSControl_Utils::SortedCompound
- (const TopoDS_Shape& shape, const TopAbs_ShapeEnum type,
- const Standard_Boolean explore, const Standard_Boolean compound) const
-{
- if (shape.IsNull()) return shape;
- TopAbs_ShapeEnum typ = shape.ShapeType();
- TopoDS_Shape sh, sh0;
- Standard_Integer nb = 0;
-
-// Compound : on le prend, soit tel quel, soit son contenu
- if (typ == TopAbs_COMPOUND || typ == TopAbs_COMPSOLID) {
- TopoDS_Compound C;
- BRep_Builder B;
- B.MakeCompound (C);
- for (TopoDS_Iterator it(shape); it.More(); it.Next()) {
- sh0 = SortedCompound (it.Value(),type,explore,compound);
- if (sh0.IsNull()) continue;
- sh = sh0;
- typ = sh.ShapeType();
- if (typ == TopAbs_COMPOUND && !compound) {
- for (TopoDS_Iterator it2 (sh); it2.More(); it2.Next())
- { nb ++; sh = it2.Value(); B.Add (C, sh); }
- }
- else { nb ++; B.Add (C,sh); }
- }
- if (nb == 0) C.Nullify();
- else if (nb == 1) return sh;
- return C;
- }
-
-// Egalite : OK; Pseudo-Egalite : EDGE/WIRE ou FACE/SHELL
- if (typ == type) return shape;
- if (typ == TopAbs_EDGE && type == TopAbs_WIRE) {
- BRep_Builder B;
- TopoDS_Wire W;
- B.MakeWire (W);
- B.Add (W,shape); // ne passe pas ! : TopoDS::Edge(shape)
- return W;
- }
- if (typ == TopAbs_FACE && type == TopAbs_SHELL) {
- BRep_Builder B;
- TopoDS_Shell S;
- B.MakeShell (S);
- B.Add (S,shape); // ne passe pas ! : TopoDS::Face(shape));
- S.Closed (BRep_Tool::IsClosed (S));
- return S;
- }
-
-// Le reste : selon exploration
- if (!explore) {
- TopoDS_Shape nulsh;
- return nulsh;
- }
-
-// Ici, on doit explorer
-// SOLID + mode COMPOUND : reconduire les SHELLs
- if (typ == TopAbs_SOLID && compound) {
- TopoDS_Compound C;
- BRep_Builder B;
- B.MakeCompound (C);
- for (TopoDS_Iterator it(shape); it.More(); it.Next()) {
- sh0 = SortedCompound (it.Value(),type,explore,compound);
- if (sh0.IsNull()) continue;
- sh = sh0;
- nb ++; B.Add (C,sh);
- }
- if (nb == 0) C.Nullify();
- else if (nb == 1) return sh;
- return C;
- }
-
-// Exploration classique
- TopoDS_Compound CC;
- BRep_Builder BB;
- BB.MakeCompound(CC);
- for (TopExp_Explorer expl (shape,type); expl.More(); expl.Next()) {
- nb ++; sh = expl.Current();
- BB.Add (CC,sh);
- }
- if (nb == 0) CC.Nullify();
- else if (nb == 1) return sh;
- return CC;
-}
-
-
-// ####### SHAPES : Liste #######
-
- TopoDS_Shape XSControl_Utils::ShapeValue
- (const Handle(TopTools_HSequenceOfShape)& seqval, const Standard_Integer num) const
-{
- TopoDS_Shape shape;
- if (seqval.IsNull()) return shape;
- if (num > 0 && num <= seqval->Length()) shape = seqval->Value(num);
- return shape;
-}
-
- Handle(TopTools_HSequenceOfShape) XSControl_Utils::NewSeqShape () const
- { return new TopTools_HSequenceOfShape(); }
-
- void XSControl_Utils::AppendShape
- (const Handle(TopTools_HSequenceOfShape)& seqval, const TopoDS_Shape& shape) const
- { seqval->Append (shape); }
-
-// ####### SHAPES <-> Transient #######
-
- Handle(Standard_Transient) XSControl_Utils::ShapeBinder
- (const TopoDS_Shape& shape, const Standard_Boolean hs) const
- { if (hs) return new TopoDS_HShape (shape);
- else return new TransferBRep_ShapeBinder (shape); }
-
- TopoDS_Shape XSControl_Utils::BinderShape
- (const Handle(Standard_Transient)& tr) const
-{
- TopoDS_Shape sh;
- DeclareAndCast(Transfer_Binder,sb,tr);
- if (!sb.IsNull()) return TransferBRep::ShapeResult(sb);
- DeclareAndCast(TransferBRep_ShapeMapper,sm,tr);
- if (!sm.IsNull()) return sm->Shape();
- DeclareAndCast(TopoDS_HShape,hs,tr);
- if (!hs.IsNull()) return hs->Shape();
- return sh;
-}
-
-
-// ##########################################################
-// ####### LISTES : Fonctions Generales #######
-
- Standard_Integer XSControl_Utils::SeqLength
- (const Handle(Standard_Transient)& seqval) const
-{
- if (seqval.IsNull()) return 0;
- DeclareAndCast(TColStd_HSequenceOfHAsciiString,seqs,seqval);
- if (!seqs.IsNull()) return seqs->Length();
- DeclareAndCast(TColStd_HSequenceOfAsciiString,seqa,seqval);
- if (!seqa.IsNull()) return seqa->Length();
- DeclareAndCast(TColStd_HSequenceOfHExtendedString,seqe,seqval);
- if (!seqe.IsNull()) return seqe->Length();
- DeclareAndCast(TColStd_HSequenceOfHExtendedString,seqx,seqval);
- if (!seqx.IsNull()) return seqx->Length();
-
- DeclareAndCast(TColStd_HSequenceOfTransient,seqt,seqval);
- if (!seqt.IsNull()) return seqt->Length();
- DeclareAndCast(TopTools_HSequenceOfShape,seqh,seqval);
- if (!seqh.IsNull()) return seqh->Length();
- DeclareAndCast(TColStd_HSequenceOfInteger,seqi,seqval);
- if (!seqi.IsNull()) return seqi->Length();
-// Standard_TypeMismatch::Raise("XSControl_Utils::SeqLength");
- return 0;
-}
-
- Handle(Standard_Transient) XSControl_Utils::SeqToArr
- (const Handle(Standard_Transient)& seqval, const Standard_Integer first) const
-{
- Standard_Integer i,lng;
- Handle(Standard_Transient) val;
- if (seqval.IsNull()) return val;
- DeclareAndCast(TColStd_HSequenceOfHAsciiString,seqs,seqval);
- if (!seqs.IsNull()) {
- lng = seqs->Length();
- Handle(Interface_HArray1OfHAsciiString) arrs =
- new Interface_HArray1OfHAsciiString(first,lng-first+1);
- for (i = 1; i <= lng; i ++) arrs->SetValue (i-first+1,seqs->Value(i));
- return arrs;
- }
- DeclareAndCast(TColStd_HSequenceOfTransient,seqt,seqval);
- if (!seqt.IsNull()) {
- lng = seqt->Length();
- Handle(TColStd_HArray1OfTransient) arrt =
- new TColStd_HArray1OfTransient(first,lng-first+1);
- for (i = 1; i <= lng; i ++) arrt->SetValue (i-first+1,seqt->Value(i));
- return arrt;
- }
- Standard_TypeMismatch::Raise("XSControl_Utils::SeqToArr");
- return val;
-}
-
-
- Handle(Standard_Transient) XSControl_Utils::ArrToSeq
- (const Handle(Standard_Transient)& arrval) const
-{
- Standard_Integer i,first,last;
- Handle(Standard_Transient) val;
- if (arrval.IsNull()) return val;
- DeclareAndCast(Interface_HArray1OfHAsciiString,arrs,arrval);
- if (!arrs.IsNull()) {
- first = arrs->Lower();
- last = arrs->Upper();
- Handle(TColStd_HSequenceOfHAsciiString) seqs =
- new TColStd_HSequenceOfHAsciiString();
- for (i = first; i <= last; i ++) seqs->Append (arrs->Value(i));
- return seqs;
- }
- DeclareAndCast(TColStd_HArray1OfTransient,arrt,arrval);
- if (!arrt.IsNull()) {
- first = arrt->Lower();
- last = arrt->Upper();
- Handle(TColStd_HSequenceOfTransient) seqt =
- new TColStd_HSequenceOfTransient();
- for (i = first; i <= last; i ++) seqt->Append (arrt->Value(i));
- return seqt;
- }
- Standard_TypeMismatch::Raise("XSControl_Utils::ArrToSeq");
- return val;
-}
-
-
- Standard_Integer XSControl_Utils::SeqIntValue
- (const Handle(TColStd_HSequenceOfInteger)& seqval,
- const Standard_Integer num) const
-{
- if (seqval.IsNull()) return 0;
- return seqval->Value(num);
-}
+++ /dev/null
-// Created on: 1995-12-04
-// 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_Utils_HeaderFile
-#define _XSControl_Utils_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Standard_CString.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Type.hxx>
-#include <Standard_Integer.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <Standard_ExtString.hxx>
-#include <TColStd_HSequenceOfHAsciiString.hxx>
-#include <TColStd_HSequenceOfHExtendedString.hxx>
-#include <TopTools_HSequenceOfShape.hxx>
-#include <TopAbs_ShapeEnum.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-class Standard_TypeMismatch;
-class Standard_Transient;
-class TCollection_HAsciiString;
-class TCollection_AsciiString;
-class TCollection_HExtendedString;
-class TCollection_ExtendedString;
-class TopoDS_Shape;
-
-
-//! This class provides various useful utility routines, to
-//! facilitate handling of most common data structures :
-//! transients (type, type name ...),
-//! strings (ascii or extended, pointed or handled or ...),
-//! shapes (reading, writing, testing ...),
-//! sequences & arrays (of strings, of transients, of shapes ...),
-//! ...
-//!
-//! Also it gives some helps on some data structures from XSTEP,
-//! such as printing on standard trace file, recignizing most
-//! currently used auxiliary types (Binder,Mapper ...)
-class XSControl_Utils
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- //! the only use of this, is to allow a frontal to get one
- //! distinct "Utils" set per separate engine
- Standard_EXPORT XSControl_Utils();
-
- //! Just prints a line into the current Trace File. This allows to
- //! better characterise the various trace outputs, as desired.
- Standard_EXPORT void TraceLine (const Standard_CString line) const;
-
- //! Just prints a line or a set of lines into the current Trace
- //! File. <lines> can be a HAscii/ExtendedString (produces a print
- //! without ending line) or a HSequence or HArray1 Of ..
- //! (one new line per item)
- Standard_EXPORT void TraceLines (const Handle(Standard_Transient)& lines) const;
-
- Standard_EXPORT Standard_Boolean IsKind (const Handle(Standard_Transient)& item, const Handle(Standard_Type)& what) const;
-
- //! Returns the name of the dynamic type of an object, i.e. :
- //! If it is a Type, its Name
- //! If it is a object not a type, the Name of its DynamicType
- //! If it is Null, an empty string
- //! If <nopk> is False (D), gives complete name
- //! If <nopk> is True, returns class name without package
- Standard_EXPORT Standard_CString TypeName (const Handle(Standard_Transient)& item, const Standard_Boolean nopk = Standard_False) const;
-
- Standard_EXPORT Handle(Standard_Transient) TraValue (const Handle(Standard_Transient)& list, const Standard_Integer num) const;
-
- Standard_EXPORT Handle(TColStd_HSequenceOfTransient) NewSeqTra() const;
-
- Standard_EXPORT void AppendTra (const Handle(TColStd_HSequenceOfTransient)& seqval, const Handle(Standard_Transient)& traval) const;
-
- Standard_EXPORT Standard_CString DateString (const Standard_Integer yy, const Standard_Integer mm, const Standard_Integer dd, const Standard_Integer hh, const Standard_Integer mn, const Standard_Integer ss) const;
-
- Standard_EXPORT void DateValues (const Standard_CString text, Standard_Integer& yy, Standard_Integer& mm, Standard_Integer& dd, Standard_Integer& hh, Standard_Integer& mn, Standard_Integer& ss) const;
-
- Standard_EXPORT Standard_CString ToCString (const Handle(TCollection_HAsciiString)& strval) const;
-
- Standard_EXPORT Standard_CString ToCString (const TCollection_AsciiString& strval) const;
-
- Standard_EXPORT Handle(TCollection_HAsciiString) ToHString (const Standard_CString strcon) const;
-
- Standard_EXPORT TCollection_AsciiString ToAString (const Standard_CString strcon) const;
-
- Standard_EXPORT Standard_ExtString ToEString (const Handle(TCollection_HExtendedString)& strval) const;
-
- Standard_EXPORT Standard_ExtString ToEString (const TCollection_ExtendedString& strval) const;
-
- Standard_EXPORT Handle(TCollection_HExtendedString) ToHString (const Standard_ExtString strcon) const;
-
- Standard_EXPORT TCollection_ExtendedString ToXString (const Standard_ExtString strcon) const;
-
- Standard_EXPORT Standard_ExtString AsciiToExtended (const Standard_CString str) const;
-
- Standard_EXPORT Standard_Boolean IsAscii (const Standard_ExtString str) const;
-
- Standard_EXPORT Standard_CString ExtendedToAscii (const Standard_ExtString str) const;
-
- Standard_EXPORT Standard_CString CStrValue (const Handle(Standard_Transient)& list, const Standard_Integer num) const;
-
- Standard_EXPORT Standard_ExtString EStrValue (const Handle(Standard_Transient)& list, const Standard_Integer num) const;
-
- Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) NewSeqCStr() const;
-
- Standard_EXPORT void AppendCStr (const Handle(TColStd_HSequenceOfHAsciiString)& seqval, const Standard_CString strval) const;
-
- Standard_EXPORT Handle(TColStd_HSequenceOfHExtendedString) NewSeqEStr() const;
-
- Standard_EXPORT void AppendEStr (const Handle(TColStd_HSequenceOfHExtendedString)& seqval, const Standard_ExtString strval) const;
-
- //! Writes a Shape under the internal BRepTools form
- //! (an internal help utility)
- //! Returns True if writing has succeeded, False else
- Standard_EXPORT Standard_Boolean WriteShape (const TopoDS_Shape& shape, const Standard_CString filename) const;
-
- //! Returns a new empty, undefined Shape, which can then be filled
- //! by ReadShape
- Standard_EXPORT TopoDS_Shape NewShape() const;
-
- //! Reads a Shape from the internal BRepTools form and returns it
- //! (an internal help utility)
- //! Returns True if reading has succeeded, False else
- Standard_EXPORT Standard_Boolean ReadShape (TopoDS_Shape& shape, const Standard_CString filename) const;
-
- //! Returns True if a Shape is Null
- Standard_EXPORT Standard_Boolean IsNullShape (const TopoDS_Shape& shape) const;
-
- //! Converts a list of Shapes to a Compound (a kind of Shape)
- Standard_EXPORT TopoDS_Shape CompoundFromSeq (const Handle(TopTools_HSequenceOfShape)& seqval) const;
-
- //! Returns the type of a Shape : true type if <compound> is False
- //! If <compound> is True and <shape> is a Compound, iterates on
- //! its items. If all are of the same type, returns this type.
- //! Else, returns COMPOUND. If it is empty, returns SHAPE
- //! For a Null Shape, returns SHAPE
- Standard_EXPORT TopAbs_ShapeEnum ShapeType (const TopoDS_Shape& shape, const Standard_Boolean compound) const;
-
- //! From a Shape, builds a Compound as follows :
- //! explores it level by level
- //! If <explore> is False, only COMPOUND items. Else, all items
- //! Adds to the result, shapes which comply to <type>
- //! + if <type> is WIRE, considers free edges (and makes wires)
- //! + if <type> is SHELL, considers free faces (and makes shells)
- //! If <compound> is True, gathers items in compounds which
- //! correspond to starting COMPOUND,SOLID or SHELL containers, or
- //! items directly contained in a Compound
- Standard_EXPORT TopoDS_Shape SortedCompound (const TopoDS_Shape& shape, const TopAbs_ShapeEnum type, const Standard_Boolean explore, const Standard_Boolean compound) const;
-
- Standard_EXPORT TopoDS_Shape ShapeValue (const Handle(TopTools_HSequenceOfShape)& seqv, const Standard_Integer num) const;
-
- Standard_EXPORT Handle(TopTools_HSequenceOfShape) NewSeqShape() const;
-
- Standard_EXPORT void AppendShape (const Handle(TopTools_HSequenceOfShape)& seqv, const TopoDS_Shape& shape) const;
-
- //! Creates a Transient Object from a Shape : it is either a Binder
- //! (used by functions which require a Transient but can process
- //! a Shape, such as viewing functions) or a HShape (according to hs)
- //! Default is a HShape
- Standard_EXPORT Handle(Standard_Transient) ShapeBinder (const TopoDS_Shape& shape, const Standard_Boolean hs = Standard_True) const;
-
- //! From a Transient, returns a Shape.
- //! In fact, recognizes ShapeBinder ShapeMapper and HShape
- Standard_EXPORT TopoDS_Shape BinderShape (const Handle(Standard_Transient)& tr) const;
-
- Standard_EXPORT Standard_Integer SeqLength (const Handle(Standard_Transient)& list) const;
-
- Standard_EXPORT Handle(Standard_Transient) SeqToArr (const Handle(Standard_Transient)& seq, const Standard_Integer first = 1) const;
-
- Standard_EXPORT Handle(Standard_Transient) ArrToSeq (const Handle(Standard_Transient)& arr) const;
-
- Standard_EXPORT Standard_Integer SeqIntValue (const Handle(TColStd_HSequenceOfInteger)& list, const Standard_Integer num) const;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-
-};
-
-
-
-
-
-
-
-#endif // _XSControl_Utils_HeaderFile
//! dictionary), but which is aimed to be redefined
class XSControl_Vars : public MMgt_TShared
{
-
-public:
-
+ public:
Standard_EXPORT XSControl_Vars();
Standard_EXPORT virtual void Set (const Standard_CString name, const Handle(Standard_Transient)& val);
- Standard_EXPORT virtual Handle(Standard_Transient) Get (Standard_CString& name) const;
-
Standard_EXPORT virtual Handle(Geom_Geometry) GetGeom (Standard_CString& name) const;
Standard_EXPORT virtual Handle(Geom2d_Curve) GetCurve2d (Standard_CString& name) const;
Standard_EXPORT virtual TopoDS_Shape GetShape (Standard_CString& name) const;
-
-
-
DEFINE_STANDARD_RTTIEXT(XSControl_Vars,MMgt_TShared)
-protected:
-
-
-
-
-private:
-
+ protected:
+
+ Standard_EXPORT virtual Handle(Standard_Transient) Get (Standard_CString& name) const;
Handle(Dico_DictionaryOfTransient) thevars;
-
-
};
-
-
-
-
-
-
#endif // _XSControl_Vars_HeaderFile
//:i1 pdn 03.04.99 BUC60301
-#include <Dico_DictionaryOfTransient.hxx>
-#include <Dico_IteratorOfDictionaryOfTransient.hxx>
-#include <Geom2d_Point.hxx>
#include <Interface_Check.hxx>
#include <Interface_CheckIterator.hxx>
#include <Interface_Graph.hxx>
}
-// ##########################################
-// ############ Contexte de Transfert ######
-// ##########################################
-
-
-//=======================================================================
-//function : SetAllContext
-//purpose :
-//=======================================================================
-
-void XSControl_WorkSession::SetAllContext(const Handle(Dico_DictionaryOfTransient)& context)
-{
- myContext = context;
- myTransferReader->Context() = context;
-}
-
-
-//=======================================================================
-//function : ClearContext
-//purpose :
-//=======================================================================
-
-void XSControl_WorkSession::ClearContext ()
-{
- myContext.Nullify();
- myTransferReader->Context().Nullify();
-}
-
-
// ##########################################
// ############ RESULTATS FORCES ######
// ##########################################
TR->SetTransientProcess(TP);
}
-//=======================================================================
-//function : MapReader
-//purpose :
-//=======================================================================
-
-Handle(Transfer_TransientProcess) XSControl_WorkSession::MapReader() const
-{
- return myTransferReader->TransientProcess();
-}
-
//=======================================================================
//function : SetMapReader
//purpose :
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;
#include <XSControl_TransferWriter.hxx>
class XSControl_Controller;
class XSControl_TransferReader;
-class Dico_DictionaryOfTransient;
class XSControl_Vars;
class Message_Messenger;
class Transfer_TransientProcess;
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 Context List, Null if not defined
- //! The Context is given to the TransientProcess for TransferRead
- const Handle(Dico_DictionaryOfTransient) & Context() const
- { return myContext; }
-
- //! Sets the current Context List, as a whole
- //! Sets it to the TransferReader
- Standard_EXPORT void SetAllContext (const Handle(Dico_DictionaryOfTransient)& theContext);
-
- //! Clears the whole current Context (nullifies it)
- Standard_EXPORT void ClearContext();
+ const Handle(XSControl_Controller) & NormAdaptor() const { return myController; }
//! Prints the transfer status of a transferred item, as beeing
//! the Mapped n0 <num>, from MapWriter if <wri> is True, or
//! 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;
+ const Handle(XSControl_TransferReader) & TransferReader () const { return myTransferReader; }
//! Changes the Map Reader, i.e. considers that the new one
//! defines the relevant read results (forgets the former ones)
Standard_EXPORT Handle(Interface_InterfaceModel) NewModel();
//! Returns the Transfer Reader, Null if not set
- const Handle(XSControl_TransferWriter) & TransferWriter() const
- { return myTransferWriter; }
+ const Handle(XSControl_TransferWriter) & TransferWriter() const { return myTransferWriter; }
//! Changes the Map Reader, i.e. considers that the new one
//! defines the relevant read results (forgets the former ones)
//! Error if transfer badly initialised
Standard_EXPORT IFSelect_ReturnStatus TransferWriteShape (const TopoDS_Shape& theShape, const Standard_Boolean theCompGraph = Standard_True);
- const Handle(XSControl_Vars) & Vars() const
- { return myVars; }
+ const Handle(XSControl_Vars) & Vars() const { return myVars; }
- void SetVars (const Handle(XSControl_Vars)& theVars)
- { myVars = theVars; }
+ void SetVars (const Handle(XSControl_Vars)& theVars) { myVars = theVars; }
DEFINE_STANDARD_RTTIEXT(XSControl_WorkSession,IFSelect_WorkSession)
private:
+ //! Sets a Transfer Reader, which manages transfers on reading
+ Standard_EXPORT void SetTransferReader (const Handle(XSControl_TransferReader)& theTR);
+
//! Clears binders
Standard_EXPORT void ClearBinders();
Handle(XSControl_Controller) myController;
Handle(XSControl_TransferReader) myTransferReader;
Handle(XSControl_TransferWriter) myTransferWriter;
- Handle(Dico_DictionaryOfTransient) myContext;
Handle(XSControl_Vars) myVars;
};
XSDRAW.cxx
XSDRAW.hxx
+XSDRAW_Activator.cxx
+XSDRAW_Activator.hxx
XSDRAW_Commands.hxx
+XSDRAW_ControlFunctions.cxx
+XSDRAW_ControlFunctions.hxx
XSDRAW_Functions.cxx
XSDRAW_Functions.hxx
+XSDRAW_SelectFunctions.cxx
+XSDRAW_SelectFunctions.hxx
+XSDRAW_ShapeFunctions.cxx
+XSDRAW_ShapeFunctions.hxx
XSDRAW_Vars.cxx
XSDRAW_Vars.hxx
#include <DBRep.hxx>
#include <Dico_DictionaryOfInteger.hxx>
#include <Draw_Appli.hxx>
-#include <IFSelect_Functions.hxx>
#include <IFSelect_SessionPilot.hxx>
#include <Interface_InterfaceModel.hxx>
#include <Interface_Macros.hxx>
#include <Interface_Protocol.hxx>
#include <Message.hxx>
+#include <Message_Messenger.hxx>
#include <Standard_Transient.hxx>
#include <TCollection_AsciiString.hxx>
#include <TColStd_HSequenceOfAsciiString.hxx>
#include <Transfer_FinderProcess.hxx>
#include <Transfer_TransientProcess.hxx>
#include <TransferBRep.hxx>
-#include <XSControl.hxx>
#include <XSControl_Controller.hxx>
-#include <XSControl_FuncShape.hxx>
-#include <XSControl_Functions.hxx>
#include <XSControl_TransferReader.hxx>
#include <XSControl_WorkSession.hxx>
#include <XSDRAW.hxx>
#include <XSDRAW_Vars.hxx>
+#include <XSDRAW_Functions.hxx>
+#include <XSDRAW_SelectFunctions.hxx>
+#include <XSDRAW_ShapeFunctions.hxx>
#include <stdio.h>
-//#include <XSDRAW_Shape.hxx>
static int deja = 0, dejald = 0;
-//unused variable
-//static int okxset = 0;
static Handle(Dico_DictionaryOfInteger) theolds;
static Handle(TColStd_HSequenceOfAsciiString) thenews;
theolds->SetItem (oldname,num);
}
- void XSDRAW::RemoveCommand
- (const Standard_CString oldname)
+void XSDRAW::RemoveCommand (const Standard_CString oldname)
{
ChangeCommand (oldname,"");
}
- Standard_Boolean XSDRAW::LoadSession ()
+Standard_Boolean XSDRAW::LoadSession ()
{
if (deja) return Standard_False;
deja = 1;
WS->SetVars (new XSDRAW_Vars);
thepilot->SetSession (WS);
- IFSelect_Functions::Init();
- XSControl_Functions::Init();
- XSControl_FuncShape::Init();
-// XSDRAW_Shape::Init(); passe a present par theCommands
+ XSDRAW_Functions::Init();
return Standard_True;
}
// Pour tout faire d un coup : BRepTest & cie:
LoadSession();
- //skl: we make remove commands "x" and "exit" in order to this commands are
+ //skl: we remove commands "x" and "exit" in order to this commands are
// performed not in IFSelect_SessionPilot but in standard Tcl interpretor
XSDRAW::RemoveCommand("x");
XSDRAW::RemoveCommand("exit");
-// if (!getenv("WBHOSTTOP")) XSDRAW::RemoveCommand("xsnew");
- Handle(TColStd_HSequenceOfAsciiString) list =
- IFSelect_Activator::Commands(0);
+ Handle(TColStd_HSequenceOfAsciiString) list = IFSelect_Activator::Commands(0);
TCollection_AsciiString com;
Standard_Integer i, nb = list->Length();
for (i = 1; i <= nb; i ++) {
}
}
- Standard_Integer XSDRAW::Execute
- (const Standard_CString command, const Standard_CString varname)
+Standard_Integer XSDRAW::Execute (const Standard_CString command, const Standard_CString varname)
{
char mess[100];
Sprintf (mess,command,varname);
return 1; // stat ?
}
- Handle(IFSelect_SessionPilot) XSDRAW::Pilot ()
- { return thepilot; }
+const Handle(IFSelect_SessionPilot) & XSDRAW::Pilot ()
+{ return thepilot; }
- Handle(XSControl_WorkSession) XSDRAW::Session ()
- { return XSControl::Session(thepilot); }
+Handle(XSControl_WorkSession) XSDRAW::Session (const Handle(IFSelect_SessionPilot) &thePilot)
+{ return Handle(XSControl_WorkSession)::DownCast((thePilot.IsNull()? thepilot : thePilot)->Session()); }
- void XSDRAW::SetController (const Handle(XSControl_Controller)& control)
+void XSDRAW::SetController (const Handle(XSControl_Controller)& control)
{
if (thepilot.IsNull()) XSDRAW::LoadSession();
if (control.IsNull()) cout<<"XSTEP Controller not defined"<<endl;
// ############ AUXILIAIRES #############
Handle(Standard_Transient) XSDRAW::GetEntity (const Standard_CString name)
- { return IFSelect_Functions::GiveEntity (Session(),name); }
+ { return XSDRAW_SelectFunctions::GiveEntity (Session(),name); }
Standard_Integer XSDRAW::GetEntityNumber (const Standard_CString name)
- { return IFSelect_Functions::GiveEntityNumber (Session(),name); }
+ { return XSDRAW_SelectFunctions::GiveEntityNumber (Session(),name); }
Handle(TColStd_HSequenceOfTransient) XSDRAW::GetList
Handle(TColStd_HSequenceOfTransient) list;
if (!first || first[0] == '\0') {
char ligne[80]; ligne[0] = '\0'; char truc;
-// cin.clear(); cin.get (ligne,79,'\n');
cin >> ligne; Standard_Size ln = strlen(ligne);
char *ff = &ligne[0], *ss = NULL;
cin.get(truc); if (truc != '\n') { cin>>&ligne[ln+1]; ss = &ligne[ln+1]; }
return XSDRAW::GetList (ff,ss);
}
-// return IFSelect_Functions::GiveList (Session(),first,second);
- return IFSelect_Functions::GiveList (Session(),first,second);
+ return XSDRAW_SelectFunctions::GiveList (Session(),first,second);
}
- Standard_Boolean XSDRAW::FileAndVar
+Standard_Boolean XSDRAW::FileAndVar
(const Standard_CString file, const Standard_CString var,
const Standard_CString def,
TCollection_AsciiString& resfile, TCollection_AsciiString& resvar)
-{ return XSControl_FuncShape::FileAndVar
- (XSDRAW::Session(),file,var,def,resfile,resvar); }
-
- Standard_Integer XSDRAW::MoreShapes
- (Handle(TopTools_HSequenceOfShape)& list, const Standard_CString name)
-{ return XSControl_FuncShape::MoreShapes (XSDRAW::Session(),list,name); }
+{
+ return XSDRAW_ShapeFunctions::FileAndVar(Session(),file,var,def,resfile,resvar);
+}
+Standard_Integer XSDRAW::MoreShapes (Handle(TopTools_HSequenceOfShape)& list, const Standard_CString name)
+{
+ return XSDRAW_ShapeFunctions::MoreShapes(Session(),list,name);
+}
// FONCTION POUR LE DEBUG
#include <Draw_Interpretor.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <TopTools_HSequenceOfShape.hxx>
-class IFSelect_SessionPilot;
+#include <IFSelect_SessionPilot.hxx>
class XSControl_WorkSession;
class XSControl_Controller;
class Interface_Protocol;
Standard_EXPORT static Standard_Integer Execute (const Standard_CString command, const Standard_CString var = "");
//! Returns the SessionPilot (can be used for direct call)
- Standard_EXPORT static Handle(IFSelect_SessionPilot) Pilot();
+ Standard_EXPORT static const Handle(IFSelect_SessionPilot) & Pilot();
//! Returns the WorkSession defined in AddDraw (through Pilot)
//! It is from XSControl, it brings functionnalities for Transfers
- Standard_EXPORT static Handle(XSControl_WorkSession) Session();
+ Standard_EXPORT static Handle(XSControl_WorkSession) Session(const Handle(IFSelect_SessionPilot) &thePilot = NULL);
//! Defines a Controller for the command "xinit" and applies it
//! (i.e. calls its method Customise)
--- /dev/null
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <XSDRAW_Activator.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(XSDRAW_Activator,IFSelect_Activator)
+
+static TCollection_AsciiString thedefgr, thedefil;
+
+void XSDRAW_Activator::SetGroup (const Standard_CString group, const Standard_CString file)
+{
+ thedefgr.Clear(); if (group[0] != '\0') thedefgr.AssignCat(group);
+ thedefil.Clear(); if (file [0] != '\0') thedefil.AssignCat(file);
+}
+
+void XSDRAW_Activator::AddFunc (const Standard_CString name, const Standard_CString help, const XSDRAW_ActFunc func)
+{
+ Handle(XSDRAW_Activator) act = new XSDRAW_Activator (name,help,func);
+ if (thedefgr.Length() > 0) act->SetForGroup (thedefgr.ToCString());
+ act->Add (1,name);
+}
+
+void XSDRAW_Activator::AddFSet (const Standard_CString name, const Standard_CString help, const XSDRAW_ActFunc func)
+{
+ Handle(XSDRAW_Activator) act = new XSDRAW_Activator (name,help,func);
+ if (thedefgr.Length() > 0)
+ act->SetForGroup (thedefgr.ToCString(),thedefil.ToCString());
+ act->AddSet (1,name);
+}
--- /dev/null
+// Created on: 1996-03-05
+// 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 _XSDRAW_Activator_HeaderFile
+#define _XSDRAW_Activator_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <TCollection_AsciiString.hxx>
+#include <IFSelect_Activator.hxx>
+#include <IFSelect_ReturnStatus.hxx>
+class IFSelect_SessionPilot;
+
+typedef IFSelect_ReturnStatus (*XSDRAW_ActFunc) (const Handle(IFSelect_SessionPilot)&);
+
+//! Act gives a simple way to define and add functions to be ran
+//! from a SessionPilot, as follows :
+//!
+//! Define a function as
+//! static IFSelect_RetStatus myfunc
+//! (const Standard_CString name,
+//! const Handle(IFSelect_SessionPilot)& pilot)
+//! { ... }
+//! When ran, it receives the exact name (string) of the called
+//! function, and the SessionPilot which brings other infos
+//!
+//! Add it by
+//! XSDRAW_Activator::AddFunc (name,help,myfunc);
+//! for a normal function, or
+//! XSDRAW_Activator::AddFSet (name,help,myfunc);
+//! for a function which is intended to create a control item
+//! name and help are given as CString
+//!
+//! Then, it is available for run
+class XSDRAW_Activator : public IFSelect_Activator
+{
+ public:
+
+ //! Creates an Act with a name, help and a function
+ //! mode (Add or AddSet) is given when recording
+ XSDRAW_Activator(const Standard_CString name, const Standard_CString help, const XSDRAW_ActFunc func)
+ : thename (name) , thehelp (help) , thefunc (func)
+ {}
+
+ //! Execution of Command Line. remark that <number> is senseless
+ //! because each Act brings one and only one function
+ IFSelect_ReturnStatus Do (const Standard_Integer, const Handle(IFSelect_SessionPilot)& pilot) Standard_OVERRIDE
+ { return (thefunc? thefunc(pilot) : IFSelect_RetVoid); }
+
+ //! Short Help for commands : returns the help given to create
+ Standard_CString Help (const Standard_Integer) const Standard_OVERRIDE
+ { return thehelp.ToCString(); }
+
+ //! Changes the default group name for the following Acts
+ //! group empty means to come back to default from Activator
+ //! Also a file name can be precised (to query by getsource)
+ Standard_EXPORT static void SetGroup (const Standard_CString group, const Standard_CString file = "");
+
+ //! Adds a function with its name and help : creates an Act then
+ //! records it as normal function
+ Standard_EXPORT static void AddFunc (const Standard_CString name, const Standard_CString help, const XSDRAW_ActFunc func);
+
+ //! Adds a function with its name and help : creates an Act then
+ //! records it as function for XSET (i.e. to create control item)
+ Standard_EXPORT static void AddFSet (const Standard_CString name, const Standard_CString help, const XSDRAW_ActFunc func);
+
+ DEFINE_STANDARD_RTTIEXT(XSDRAW_Activator,IFSelect_Activator)
+
+ private:
+
+ TCollection_AsciiString thename;
+ TCollection_AsciiString thehelp;
+ XSDRAW_ActFunc thefunc;
+};
+
+#endif // _XSDRAW_Activator_HeaderFile
--- /dev/null
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#include <IFSelect_CheckCounter.hxx>
+#include <IFSelect_SessionPilot.hxx>
+#include <Interface_CheckIterator.hxx>
+#include <Interface_InterfaceModel.hxx>
+#include <Interface_Macros.hxx>
+#include <Interface_Static.hxx>
+#include <Message.hxx>
+#include <Message_Messenger.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+#include <Transfer_Binder.hxx>
+#include <Transfer_FinderProcess.hxx>
+#include <Transfer_ResultFromModel.hxx>
+#include <Transfer_TransientProcess.hxx>
+#include <XSControl_Controller.hxx>
+#include <XSControl_SelectForTransfer.hxx>
+#include <XSControl_TransferReader.hxx>
+#include <XSControl_TransferWriter.hxx>
+#include <XSControl_WorkSession.hxx>
+#include <XSDRAW.hxx>
+#include <XSDRAW_Activator.hxx>
+#include <XSDRAW_ControlFunctions.hxx>
+#include <XSDRAW_SelectFunctions.hxx>
+
+// #######################################################################
+// ## ##
+// ## ##
+// ## FUNCTIONS ##
+// ## ##
+// ## ##
+// #######################################################################
+//=======================================================================
+//function : xinit
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_xinit(const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ // **** xinit ****
+ if (argc > 1) return (XSDRAW::Session(pilot)->SelectNorm(arg1) ?
+ IFSelect_RetDone : IFSelect_RetFail);
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ sout<<"Selected Norm:"<<XSDRAW::Session(pilot)->SelectedNorm()<<endl;
+ return IFSelect_RetVoid;
+}
+
+
+//=======================================================================
+//function : xnorm
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_xnorm(const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ // **** xnorm ****
+ Handle(XSControl_WorkSession) WS = XSDRAW::Session(pilot);
+ Handle(XSControl_Controller) control = WS->NormAdaptor();
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc == 1)
+ sout<<"Current Norm. xnorm newnorm to change"<<endl;
+ else sout<<"Current Norm :"<<endl;
+ if (control.IsNull()) sout<<"no norm currently defined"<<endl;
+ else
+ sout<<" Long Name (complete) : "<<control->Name(Standard_False)<<endl
+ << " Short name (resource) : "<<control->Name(Standard_True)<<endl;
+ if (argc == 1) return IFSelect_RetVoid;
+
+ control = XSControl_Controller::Recorded(arg1);
+ if (control.IsNull()) {
+ sout<<" No norm named : "<<arg1<<endl;
+ return IFSelect_RetError;
+ }
+
+ WS->SetController(control);
+ sout<<"new norm : "<<control->Name()<<endl;
+ return IFSelect_RetDone;
+}
+
+
+//=======================================================================
+//function : newmodel
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_newmodel(const Handle(IFSelect_SessionPilot)& pilot)
+{
+ // **** newmodel ****
+ if (!XSDRAW::Session(pilot)->NewModel().IsNull()) return IFSelect_RetDone;
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ sout<<"No new Model produced"<<endl;
+ return IFSelect_RetFail;
+}
+
+
+//=======================================================================
+//function : tpclear
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_tpclear(const Handle(IFSelect_SessionPilot)& pilot)
+{
+ // **** tpclear/twclear ****
+ const Standard_Boolean modew = (pilot->Word(0).Value(2) == 'w');
+ const Handle(Transfer_FinderProcess) &FP = XSDRAW::Session(pilot)->TransferWriter()->FinderProcess();
+ const Handle(Transfer_TransientProcess) &TP = XSDRAW::Session(pilot)->TransferReader()->TransientProcess();
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (modew) { if(!FP.IsNull()) FP->Clear(); else sout<<"No Transfer Write"<<endl; }
+ else { if(!TP.IsNull()) TP->Clear(); else sout<<"No Transfer Read"<<endl; }
+ return IFSelect_RetDone;
+}
+
+
+//=======================================================================
+//function : tpstat
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_tpstat(const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ //const Standard_CString arg2 = pilot->Arg(2);
+ const Handle(Transfer_TransientProcess) &TP = XSDRAW::Session(pilot)->TransferReader()->TransientProcess();
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (TP.IsNull()) { sout<<"No Transfer Read"<<endl; return IFSelect_RetError;}
+ // **** tpstat ****
+
+ Standard_Integer mod1 = -1;
+ Standard_Integer mod2 = 0;
+ // g : general c : check (compte) C (liste) f : fails(compte) F (liste)
+ // resultats racines : n : n0s entites s : status b : binders
+ // t : compte par type r : compte par resultat l : liste(type-resultat)
+ // *n *s *b *t *r *l : idem sur tout
+ // ?n etc.. : idem sur resultats anormaux
+ // ? tout court pour help
+
+ if (argc > 1) {
+ char a2 = arg1[1]; if (a2 == '\0') a2 = '!';
+ switch (arg1[0]) {
+ case 'g' : mod1 = 0; break;
+ case 'c' : mod1 = 4; mod2 = 4; break;
+ case 'C' : mod1 = 4; mod2 = 2; break;
+ case 'f' : mod1 = 5; mod2 = 4; break;
+ case 'F' : mod1 = 5; mod2 = 2; break;
+ case '*' : mod1 = 2; break;
+ case '?' : mod1 = 3; break;
+ default : mod1 = 1; if (argc > 2) mod1 = 2; a2 = arg1[0]; break;
+ }
+ if (mod1 < 1 || mod1 > 3) a2 = '!';
+ switch (a2) {
+ case 'n' : mod2 = 0; break;
+ case 's' : mod2 = 1; break;
+ case 'b' : mod2 = 2; break;
+ case 't' : mod2 = 3; break;
+ case 'r' : mod2 = 4; break;
+ case 'l' : mod2 = 5; break;
+ case 'L' : mod2 = 6; break;
+ case '!' : break;
+ case '?' : mod1 = -1; break;
+ default : mod1 = -2; break;
+ }
+ }
+ // A present help eventuel
+ if (mod1 < -1) sout<<"Unknown Mode"<<endl;
+ if (mod1 < 0) {
+ sout<<"Modes available :\n"
+ <<"g : general c : checks (count) C (list)\n"
+ <<" f : fails (count) F (list)\n"
+ <<" n : numbers of transferred entities (on TRANSFER ROOTS)\n"
+ <<" s : their status (type entity-result , presence checks)\n"
+ <<" b : detail of binders\n"
+ <<" t : count per entity type r : per type/status result\n"
+ <<" l : count per couple type entity/result\n"
+ <<" L : list per couple type entity/result\n"
+ <<" *n *s *b *t *r *l *L : idem on ALL recorded items\n"
+ <<" ?n ?s ?b ?t ... : idem on abnormal items\n"
+ <<" n select : n applied on a selection idem for s b t r l"<<endl;
+ if (mod1 < -1) return IFSelect_RetError;
+ return IFSelect_RetVoid;
+ }
+
+ if (!TP.IsNull()) {
+ sout<<"TransferRead :";
+ if (TP->Model() != pilot->Session()->Model()) sout<<"Model differs from the session";
+ Handle(TColStd_HSequenceOfTransient) list =
+ XSDRAW_SelectFunctions::GiveList(pilot->Session(),pilot->CommandPart(2));
+ XSControl_TransferReader::PrintStatsOnList (TP,list,mod1,mod2);
+ }
+ else sout<<"TransferRead : not defined"<<endl;
+ return IFSelect_RetVoid;
+}
+
+
+//=======================================================================
+//function : tpent
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_tpent(const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Handle(Transfer_TransientProcess) &TP = XSDRAW::Session(pilot)->TransferReader()->TransientProcess();
+ // **** tpent ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (TP.IsNull()) { sout<<"No Transfer Read"<<endl; return IFSelect_RetError;}
+ Handle(Interface_InterfaceModel) model = TP->Model();
+ if (model.IsNull()) return IFSelect_RetFail;
+
+ if (argc < 2) { sout<<"Give ENTITY NUMBER (IN MODEL TransferProcess)"<<endl; return IFSelect_RetError; }
+ Standard_Integer num = atoi(arg1);
+ if (num <= 0 || num > model->NbEntities()) { sout<<"Number not in [1 - "<<model->NbEntities()<<"]"<<endl; return IFSelect_RetError; }
+ Handle(Standard_Transient) ent = model->Value(num);
+ Standard_Integer index = TP->MapIndex (ent);
+ if (index == 0) sout<<"Entity "<<num<<" not recorded in transfer"<<endl;
+ else XSDRAW::Session(pilot)->PrintTransferStatus (index,Standard_False,sout);
+ return IFSelect_RetVoid;
+}
+
+
+//=======================================================================
+//function : tpitem
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_tpitem(const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** tpitem/tproot/twitem/twroot ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Give ITEM NUMBER (in TransferProcess)"<<endl; return IFSelect_RetError; }
+ Standard_Integer num = atoi(arg1);
+ if (pilot->Word(0).Value(3) == 'r') num = -num;
+ Standard_Boolean modew = Standard_False;
+ if (pilot->Word(0).Value(2) == 'w') modew = Standard_True;
+ Handle(Transfer_Binder) binder;
+ Handle(Standard_Transient) ent;
+ if (!XSDRAW::Session(pilot)->PrintTransferStatus(num,modew,sout))
+ sout<<" - Num="<<num<<" incorrect"<<endl;
+ return IFSelect_RetVoid;
+}
+
+
+//=======================================================================
+//function : trecord
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_trecord(const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Handle(Transfer_TransientProcess) &TP = XSDRAW::Session(pilot)->TransferReader()->TransientProcess();
+// **** trecord : TransferReader ****
+ Standard_Boolean tous = (argc == 1);
+ Standard_Integer num = -1;
+ const Handle(Interface_InterfaceModel) &mdl = XSDRAW::Session(pilot)->Model();
+ const Handle(XSControl_TransferReader) &TR = XSDRAW::Session(pilot)->TransferReader();
+ Handle(Standard_Transient) ent;
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (mdl.IsNull() || TR.IsNull() || TP.IsNull())
+ { sout<<" init not done"<<endl; return IFSelect_RetError; }
+ if (!tous) num = atoi(arg1);
+ // Enregistrer les racines
+ if (tous) {
+ Standard_Integer nb = TP->NbRoots();
+ sout<<" Recording "<<nb<<" Roots"<<endl;
+ for (Standard_Integer i = 1; i <= nb; i ++) {
+ ent = TP->Root(i);
+ if (TR->RecordResult (ent)) sout<<" Root n0."<<i<<endl;
+ else sout<<" Root n0."<<i<<" not recorded"<<endl;
+ }
+ } else {
+ if (num < 1 || num > mdl->NbEntities()) sout<<"incorrect number:"<<num<<endl;
+ else if (TR->RecordResult(mdl->Value(num))) sout<<" Entity n0."<<num<<endl;
+ else sout<<" Entity n0."<<num<<" not recorded"<<endl;
+ }
+ return IFSelect_RetDone;
+}
+
+
+//=======================================================================
+//function : trstat
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_trstat(const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+// **** trstat : TransferReader ****
+ const Handle(XSControl_TransferReader) &TR = XSDRAW::Session(pilot)->TransferReader();
+ if (TR.IsNull()) { sout<<" init not done"<<endl; return IFSelect_RetError; }
+ Handle(Interface_InterfaceModel) mdl = TR->Model();
+ if (mdl.IsNull()) { sout<<" No model"<<endl; return IFSelect_RetError; }
+ sout<<" Statistics : FileName : "<<TR->FileName()<<endl;
+ if (argc == 1) {
+ // stats generales
+ TR->PrintStats(10,0);
+ } else {
+ // stats unitaires
+ Standard_Integer num = atoi(arg1);
+ if (num < 1 || num > mdl->NbEntities()) { sout<<" incorrect number:"<<arg1<<endl; return IFSelect_RetError; }
+ Handle(Standard_Transient) ent = mdl->Value(num);
+ if (!TR->IsRecorded(ent)) { sout<<" Entity "<<num<<" not recorded"<<endl; return IFSelect_RetError; }
+ Handle(Transfer_ResultFromModel) RM = TR->FinalResult(ent);
+ Handle(TColStd_HSequenceOfTransient) list = TR->CheckedList(ent);
+ Standard_Integer i, nb = list->Length();
+ if (nb > 0) sout<<" Entities implied by Check/Result :"<<nb<<" i.e.:";
+ for (i = 1; i <= nb; i ++) { sout<<" "; mdl->Print(list->Value(i),sout); }
+ sout<<endl;
+ if (RM.IsNull()) { sout<<" no other info"<<endl; return IFSelect_RetVoid; }
+ Interface_CheckIterator chl = RM->CheckList(Standard_False);
+ pilot->Session()->PrintCheckList(chl,Standard_False,IFSelect_EntitiesByItem);
+ }
+ return IFSelect_RetVoid;
+}
+
+
+//=======================================================================
+//function : trbegin
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_trbegin(const Handle(IFSelect_SessionPilot)& pilot)
+{
+ // **** trbegin : TransferReader ****
+ Handle(XSControl_TransferReader) TR = XSDRAW::Session(pilot)->TransferReader();
+ Standard_Boolean init = TR.IsNull();
+ if (pilot->NbWords() > 1) { if (pilot->Arg(1)[0] == 'i') init = Standard_True; }
+ if (init) {
+ XSDRAW::Session(pilot)->InitTransferReader (0);
+ TR = XSDRAW::Session(pilot)->TransferReader();
+ if (TR.IsNull()) {
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ sout<<" init not done or failed"<<endl;
+ return IFSelect_RetError;
+ }
+ }
+ TR->BeginTransfer();
+ return IFSelect_RetDone;
+}
+
+
+//=======================================================================
+//function : tread
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_tread(const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ //const Standard_CString arg1 = pilot->Arg(1);
+ // **** tread : TransferReader ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ const Handle(XSControl_TransferReader) &TR = XSDRAW::Session(pilot)->TransferReader();
+ if (TR.IsNull()) { sout<<" init not done"<<endl; return IFSelect_RetError; }
+ const Handle(Interface_InterfaceModel) &mdl = TR->Model();
+ if (mdl.IsNull()) { sout<<" No model"<<endl; return IFSelect_RetError; }
+ if (argc < 2) {
+// DeclareAndCast(IFSelect_Selection,sel,pilot->Session()->NamedItem("xst-model-roots"));
+ Handle(Standard_Transient) sel = pilot->Session()->NamedItem("xst-model-roots");
+ if (sel.IsNull()) { sout<<"Select Roots absent"<<endl; return IFSelect_RetError; }
+ Handle(TColStd_HSequenceOfTransient) list = pilot->Session()->GiveList(sel);
+ sout<<" Transferring all roots i.e. : "<<TR->TransferList(list)<<endl;
+ } else {
+ Handle(TColStd_HSequenceOfTransient) list =
+ XSDRAW_SelectFunctions::GiveList(pilot->Session(),pilot->CommandPart(1));
+ sout<<" Transfer of "<<list->Length()<<" entities"<<endl;
+ Standard_Integer nb = TR->TransferList(list);
+ sout<<" Gives "<<nb<<" results"<<endl;
+ }
+ return IFSelect_RetDone;
+}
+
+
+//=======================================================================
+//function : trtp
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_trtp(const Handle(IFSelect_SessionPilot)& pilot)
+{
+ // **** TReader -> TProcess ****
+ const Handle(XSControl_TransferReader) &TR = XSDRAW::Session(pilot)->TransferReader();
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (TR.IsNull()) sout<<" No TransferReader"<<endl;
+ else if (TR->TransientProcess().IsNull()) sout<<" Transfer Reader without Process"<<endl;
+ return IFSelect_RetVoid;
+}
+
+
+//=======================================================================
+//function : tptr
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_tptr(const Handle(IFSelect_SessionPilot)& pilot)
+{
+ // **** TProcess -> TReader ****
+ XSDRAW::Session(pilot)->InitTransferReader (3);
+ return IFSelect_RetDone;
+}
+
+
+//=======================================================================
+//function : twmode
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_twmode(const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ // **** twmode ****
+ Handle(XSControl_TransferWriter) TW = XSDRAW::Session(pilot)->TransferWriter();
+ Handle(XSControl_Controller) control = XSDRAW::Session(pilot)->NormAdaptor();
+ Standard_Integer modemin,modemax;
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (control->ModeWriteBounds (modemin,modemax)) {
+ sout<<"Write Mode : allowed values "<<modemin<<" to "<<modemax<<endl;
+ for (Standard_Integer modd = modemin; modd <= modemax; modd ++) {
+ sout<<modd<<" : "<<control->ModeWriteHelp (modd)<<endl;;
+ }
+ }
+ sout<<"Write Mode : actual = "<<TW->TransferMode()<<endl;
+ if (argc <= 1) return IFSelect_RetVoid;
+ Standard_Integer mod = atoi(arg1);
+ sout<<"New value -> "<<arg1<<endl;
+ TW->SetTransferMode(mod);
+ if (!control->IsModeWrite (mod)) sout<<"Warning : this new value is not supported"<<endl;
+ return IFSelect_RetDone;
+}
+
+
+//=======================================================================
+//function : twstat
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_twstat(const Handle(IFSelect_SessionPilot)& pilot)
+{
+ const Handle(Transfer_FinderProcess) &FP = XSDRAW::Session(pilot)->TransferWriter()->FinderProcess();
+ // **** twstat ****
+ // Pour Write
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (!FP.IsNull()) {
+ sout<<"TransferWrite:";
+ FP->PrintStats (sout);
+ }
+ else sout<<"TransferWrite: not defined"<<endl;
+ return IFSelect_RetVoid;
+}
+
+
+//=======================================================================
+//function : settransfert
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_settransfert(const Handle(IFSelect_SessionPilot)& pilot)
+{
+ // **** SelectForTransfer ****
+ return pilot->RecordItem(new XSControl_SelectForTransfer(XSDRAW::Session(pilot)->TransferReader()));
+}
+
+
+//=======================================================================
+//function : Init
+//purpose :
+//=======================================================================
+
+void XSDRAW_ControlFunctions::Init ()
+{
+ static int initactor = 0;
+ if (initactor) return; initactor = 1;
+
+ XSDRAW_Activator::SetGroup("DE: General");
+
+ XSDRAW_Activator::AddFunc ("xinit","[norm:string to change norme] reinitialises according to the norm",XSControl_xinit);
+ XSDRAW_Activator::AddFunc ("xnorm","displays current norm +norm : changes it",XSControl_xnorm);
+
+ XSDRAW_Activator::AddFunc ("newmodel","produces a new empty model, for the session",XSControl_newmodel);
+
+ XSDRAW_Activator::AddFunc ("tpclear","Clears TransferProcess (READ)",XSControl_tpclear);
+ XSDRAW_Activator::AddFunc ("twclear","Clears TransferProcess (WRITE)",XSControl_tpclear);
+
+ XSDRAW_Activator::AddFunc ("tpstat","Statistics on TransferProcess (READ)",XSControl_tpstat);
+
+ XSDRAW_Activator::AddFunc ("tpent","[num:integer] Statistics on an entity of the model (READ)",XSControl_tpent);
+
+ XSDRAW_Activator::AddFunc ("tpitem","[num:integer] Statistics on ITEM of transfer (READ)" ,XSControl_tpitem);
+ XSDRAW_Activator::AddFunc ("tproot","[num:integer] Statistics on a ROOT of transfert (READ)" ,XSControl_tpitem);
+ XSDRAW_Activator::AddFunc ("twitem","[num:integer] Statistics on an ITEM of transfer (WRITE)" ,XSControl_tpitem);
+ XSDRAW_Activator::AddFunc ("twroot","[num:integer] Statistics on a ROOT of transfer (WRITE)",XSControl_tpitem);
+
+ XSDRAW_Activator::AddFunc ("trecord","record : all root results; or num : for entity n0.num",XSControl_trecord);
+ XSDRAW_Activator::AddFunc ("trstat","general statistics; or num : stats on entity n0 num",XSControl_trstat);
+ XSDRAW_Activator::AddFunc ("trbegin","begin-transfer-reader [init]",XSControl_trbegin);
+ XSDRAW_Activator::AddFunc ("tread","transfers all roots, or num|sel|sel num : entity list, by transfer-reader",XSControl_tread);
+
+ XSDRAW_Activator::AddFunc ("trtp","feeds commands tp... with results from tr...",XSControl_trtp);
+ XSDRAW_Activator::AddFunc ("tptr","feeds tr... from tp... (may be incomplete)",XSControl_tptr);
+
+ XSDRAW_Activator::AddFunc ("twmode","displays mode transfer write, + num changes it",XSControl_twmode);
+ XSDRAW_Activator::AddFunc ("twstat","Statistics on TransferProcess (WRITE)",XSControl_twstat);
+
+ XSDRAW_Activator::AddFSet ("selecttransfer","selection (recognize from transfer actor)",XSControl_settransfert);
+}
--- /dev/null
+// Created on: 1996-03-26
+// Created by: Christian CAILLET
+// Copyright (c) 1996-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _XSDRAW_ControlFunctions_HeaderFile
+#define _XSDRAW_ControlFunctions_HeaderFile
+
+#include <Standard.hxx>
+
+//! Functions from XSDRAW give access to actions which can be
+//! commanded with the resources provided by XSControl:
+//! especially Controller and Transfer
+//!
+//! It works by adding functions by method Init
+class XSDRAW_ControlFunctions
+{
+ public:
+
+ //! Defines and loads all functions for XSControl (as ActFunc)
+ Standard_EXPORT static void Init();
+};
+
+#endif // _XSDRAW_ControlFunctions_HeaderFile
// commercial license or contractual agreement.
-#include <XSControl_FuncShape.hxx>
#include <XSDRAW_Functions.hxx>
+#include <XSDRAW_ShapeFunctions.hxx>
+#include <XSDRAW_ControlFunctions.hxx>
+#include <XSDRAW_SelectFunctions.hxx>
void XSDRAW_Functions::Init ()
{
- XSControl_FuncShape::Init ();
+ XSDRAW_SelectFunctions::Init();
+ XSDRAW_ControlFunctions::Init();
+ XSDRAW_ShapeFunctions::Init ();
}
--- /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.
+
+//#58 rln 28.12.98 Versioning
+
+#include <IFSelect_CheckCounter.hxx>
+#include <IFSelect_Dispatch.hxx>
+#include <IFSelect_DispGlobal.hxx>
+#include <IFSelect_DispPerCount.hxx>
+#include <IFSelect_DispPerFiles.hxx>
+#include <IFSelect_DispPerOne.hxx>
+#include <IFSelect_DispPerSignature.hxx>
+#include <IFSelect_EditForm.hxx>
+#include <IFSelect_Editor.hxx>
+#include <IFSelect_GeneralModifier.hxx>
+#include <IFSelect_GraphCounter.hxx>
+#include <IFSelect_IntParam.hxx>
+#include <IFSelect_ListEditor.hxx>
+#include <IFSelect_Modifier.hxx>
+#include <IFSelect_ModifReorder.hxx>
+#include <IFSelect_SelectDeduct.hxx>
+#include <IFSelect_SelectDiff.hxx>
+#include <IFSelect_SelectEntityNumber.hxx>
+#include <IFSelect_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_SessionPilot.hxx>
+#include <IFSelect_ShareOut.hxx>
+#include <IFSelect_Signature.hxx>
+#include <IFSelect_SignatureList.hxx>
+#include <IFSelect_SignCounter.hxx>
+#include <IFSelect_SignType.hxx>
+#include <IFSelect_Transformer.hxx>
+#include <IFSelect_WorkLibrary.hxx>
+#include <IFSelect_WorkSession.hxx>
+#include <Interface_Category.hxx>
+#include <Interface_CheckIterator.hxx>
+#include <Interface_EntityIterator.hxx>
+#include <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 <TColStd_MapOfInteger.hxx>
+#include <XSDRAW_Activator.hxx>
+#include <XSDRAW_SelectFunctions.hxx>
+
+
+#include <stdio.h>
+// Decomposition of a file name in its parts : prefix, root, suffix
+static void SplitFileName
+ (const Standard_CString filename,
+ TCollection_AsciiString& prefix,
+ TCollection_AsciiString& fileroot,
+ TCollection_AsciiString& suffix)
+{
+ Standard_Integer nomdeb, nomfin, nomlon;
+ TCollection_AsciiString resfile (filename);
+ nomlon = resfile.Length();
+ nomdeb = resfile.SearchFromEnd ("/");
+ if (nomdeb <= 0) nomdeb = resfile.SearchFromEnd("\\"); // pour NT
+ if (nomdeb < 0) nomdeb = 0;
+ nomfin = resfile.SearchFromEnd (".");
+ if (nomfin < nomdeb) nomfin = nomlon + 1;
+
+ if (nomdeb > 0) prefix = resfile.SubString (1,nomdeb);
+ fileroot = resfile.SubString(nomdeb+1,nomfin-1);
+ if (nomfin <= nomlon) suffix = resfile.SubString (nomfin,nomlon);
+}
+
+
+
+// Functions definit un certain nombre de commandes
+// enregistrees dans le Dictionnaire de Activator (par des Act unitaires)
+// Les actions elles-memes sont regroupees en fin de fichier
+
+// Les definitions
+
+static IFSelect_ReturnStatus funstatus
+ (const Handle(IFSelect_SessionPilot)& )
+{
+// **** Version & cie ****
+ //#58 rln
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ sout<<"Processor Version : "<<XSTEP_PROCESSOR_VERSION<<endl;
+ sout<<"OL Version : "<<XSTEP_SYSTEM_VERSION<<endl;
+ sout<<"Configuration : "<<XSTEP_Config<<endl;
+ sout<<"UL Names : "<<XSTEP_ULNames<<endl;
+ return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus fun1
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** ToggleHandler ****
+ Standard_Boolean hand = !WS->ErrorHandle();
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (hand) sout << " -- Mode Catch Error now Active" <<endl;
+ else sout << " -- Mode Catch Error now Inactive" <<endl;
+ WS->SetErrorHandle(hand);
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun3
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** XRead / Load ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Read/Load : give file name !"<<endl; return IFSelect_RetError; }
+ if (WS->Protocol().IsNull()) { sout<<"Protocol not defined"<<endl; return IFSelect_RetError; }
+ if (WS->WorkLibrary().IsNull()) { sout<<"WorkLibrary not defined"<<endl; return IFSelect_RetError; }
+
+ 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 : sout<<"file:"<<arg1<<" gives empty result"<<endl; break;
+ case IFSelect_RetError : sout<<"file:"<<arg1<<" could not be opened"<<endl; break;
+ case IFSelect_RetDone : sout<<"file:"<<arg1<<" read"<<endl; break;
+ case IFSelect_RetFail : sout<<"file:"<<arg1<<" : error while reading"<<endl; break;
+ case IFSelect_RetStop : sout<<"file:"<<arg1<<" : EXCEPTION while reading"<<endl; break;
+ default : sout<<"file:"<<arg1<<" could not be read"<<endl; break;
+ }
+ if (status != IFSelect_RetDone) return status;
+// sout<<" - clearing list of already written files"<<endl;
+ WS->BeginSentFiles(Standard_True);
+ return status;
+}
+
+static IFSelect_ReturnStatus fun4
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** Write All ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Write All : give file name !"<<endl; return IFSelect_RetError; }
+ return WS->SendAll (arg1);
+}
+
+static IFSelect_ReturnStatus fun5
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// const Standard_CString arg2 = pilot->Arg(2);
+// **** Write Selected ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 3) { sout<<"Write Selected : give file name + givelist !"<<endl; return IFSelect_RetError; }
+ Handle(TColStd_HSequenceOfTransient) result =
+ XSDRAW_SelectFunctions::GiveList (WS,pilot->CommandPart( 2));
+ if (result.IsNull()) { sout<<"No entity selected"<<endl; return IFSelect_RetError; }
+ else sout<<"Nb Entities selected : "<<result->Length()<<endl;
+ Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
+ sp->SetList (result);
+ return WS->SendSelected (arg1,sp);
+}
+
+static IFSelect_ReturnStatus fun6
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** Write Entite(s) ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 3) { sout<<"Write Entitie(s) : give file name + n0s entitie(s)!"<<endl; return IFSelect_RetError; }
+ int ko = 0;
+ Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
+ for (Standard_Integer ia = 2; ia < argc ; ia ++) {
+ Standard_Integer id = pilot->Number(pilot->Arg(ia));
+ if (id > 0) {
+ Handle(Standard_Transient) item = WS->StartingEntity(id);
+ if (sp->Add(item)) sout<<"Added:no."<<id<<endl;
+ else { sout<<" Fail Add n0."<<id<<endl; ko ++; }
+ }
+ else { sout<<"Not an entity number:"<<pilot->Arg(ia)<<endl; ko ++; }
+ }
+ if (ko > 0) { sout<<ko<<" bad arguments, abandon"<<endl; return IFSelect_RetError; }
+ return WS->SendSelected (arg1,sp);
+}
+
+static IFSelect_ReturnStatus fun7
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** Entity Label ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Give entity number"<<endl; return IFSelect_RetError; }
+ if (!WS->HasModel()) { sout<<"No loaded model, abandon"<<endl; return IFSelect_RetError; }
+ Standard_Integer nument = WS->NumberFromLabel (arg1);
+ if (nument <= 0 || nument > WS->NbStartingEntities())
+ { sout<<"Not a suitable number: "<<arg1<<endl; return IFSelect_RetError; }
+ sout<<"N0."<<nument<<" ->Label in Model : ";
+ WS->Model()->PrintLabel(WS->StartingEntity(nument),sout);
+ sout<<endl;
+ return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus fun8
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** Entity Number ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Give label to search"<<endl; return IFSelect_RetError; }
+ if (!WS->HasModel()) { sout<<"No loaded model, abandon"<<endl; return IFSelect_RetError; }
+ const Handle(Interface_InterfaceModel) &model = WS->Model();
+ Standard_Integer i, cnt = 0;
+ Standard_Boolean exact = Standard_False;
+ sout<<" ** Search Entity Number for Label : "<<arg1<<endl;
+ for (i = model->NextNumberForLabel (arg1, 0, exact) ; i != 0;
+ i = model->NextNumberForLabel (arg1, i, exact)) {
+ cnt ++;
+ sout<<" ** Found n0/id:"; model->Print (model->Value(i),sout); sout<<endl;
+ }
+
+ if (cnt == 0) sout<<" ** No Match"<<endl;
+ else if (cnt == 1) sout<<" ** 1 Match"<<endl;
+ else sout<<cnt<<" Matches"<<endl;
+ return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus fun9
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+// **** List Types ****
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Handle(IFSelect_Signature) signtype = WS->SignType();
+ if (signtype.IsNull()) signtype = new IFSelect_SignType;
+ Handle(IFSelect_SignCounter) counter =
+ new IFSelect_SignCounter(signtype,Standard_False);
+ return pilot->ExecuteCounter (counter,1);
+}
+
+static IFSelect_ReturnStatus funcount
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg0 = pilot->Arg(0);
+ const Standard_CString arg1 = pilot->Arg(1);
+ Standard_Boolean listmode = (arg0[0] == 'l');
+// **** List Counter ****
+
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) {
+ sout<<"Designer signature ou compteur, + facultatif selection + facultatif entite"<<endl;
+ sout<<" signature/compteur seul -> tout le modele"<<endl
+ << " sign/compteur + selection -> cette selection, evaluation normale"<<endl
+ <<" sign/compteur + sel + num -> cette selection evaluee sur entite n0 num"<<endl;
+ return IFSelect_RetError;
+ }
+ DeclareAndCast(IFSelect_SignCounter,counter,WS->NamedItem(arg1));
+ if (counter.IsNull()) {
+ DeclareAndCast(IFSelect_Signature,signa,WS->NamedItem(arg1));
+ if (!signa.IsNull()) counter = new IFSelect_SignCounter(signa,Standard_False,listmode);
+ }
+// Handle(IFSelect_Selection) sel;
+// Standard_Integer n3 = 0; if (argc > 3) n3 = WS->NumberFromLabel(arg3);
+// if (argc > 2) sel = GetCasted(IFSelect_Selection,WS->NamedItem(arg2));
+// if (counter.IsNull() || (argc > 2 && n3 <= 0 && sel.IsNull()) ) {
+// sout<<"Nom:"<<arg1; if (argc > 2) sout<<" et/ou "<<arg2;
+// sout<<" incorrect (demande: compteur ou signature [selection])"<<endl;
+// return IFSelect_RetError;
+// }
+
+// Ajout : si Selection, on applique un GraphCounter
+// Et en ce cas, on peut en avoir plusieurs : la limite est le mot-cle "on"
+ Standard_Integer onflag = 0;
+ Standard_Integer i; // svv Jan11 2000 : porting on DEC
+ for (i = 2; i < argc; i ++) {
+ if (!strcmp (pilot->Arg(i),"on")) { onflag = i; break; }
+ }
+
+ Handle(IFSelect_Selection) sel = WS->GiveSelection(arg1);
+ DeclareAndCast(IFSelect_SelectDeduct,seld,sel);
+ if (!seld.IsNull()) {
+// Si onflag, faire une SelectSuite
+ if (onflag > 2) {
+ Handle(IFSelect_SelectSuite) suite = new IFSelect_SelectSuite;
+ for (i = 1; i < onflag; i ++) {
+ sel = WS->GiveSelection(pilot->Arg(i));
+ if (!suite->AddInput(sel)) {
+ sout<<"Incorrect definition for applied selection"<<endl;
+ return IFSelect_RetError;
+ }
+ }
+ seld = suite;
+ }
+
+ Handle(IFSelect_GraphCounter) gc = new IFSelect_GraphCounter(Standard_False,listmode);
+ gc->SetApplied (seld);
+ counter = gc;
+ }
+
+ if (counter.IsNull()) {
+ sout<<"Neither Counter nor Signature : "<<arg1<<endl;
+ return IFSelect_RetError;
+ }
+
+ if (onflag == 0) onflag = 1;
+ IFSelect_PrintCount pcm = IFSelect_ListByItem;
+ if (arg0[0] == 'c') pcm = IFSelect_CountByItem;
+ if (arg0[0] == 's') pcm = IFSelect_CountSummary;
+ return pilot->ExecuteCounter (counter,onflag+1, pcm);
+}
+
+static IFSelect_ReturnStatus funsigntype
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** Sign Type ****
+ Handle(IFSelect_Signature) signtype = WS->SignType();
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (signtype.IsNull()) sout<<"signtype actually undefined"<<endl;
+ else {
+ Handle(TCollection_HAsciiString) str = WS->Name (signtype);
+ Standard_Integer id = WS->ItemIdent (signtype);
+ sout<<signtype->Label()<<endl;
+ if (str.IsNull()) {
+ if (id > 0) sout<<"signtype : item n0 "<<id<<endl;
+ } else {
+ sout<<"signtype : also named as "<<str->ToCString()<<endl;
+ }
+ }
+ if (argc < 2) sout<<"signtype newitem to change, signtype . to clear"<<endl;
+ else {
+ if (arg1[0] == '.' && arg1[1] == '\0') {
+ signtype.Nullify();
+ sout<<"signtype now cleared"<<endl;
+ } else {
+ signtype = GetCasted(IFSelect_Signature,WS->NamedItem(arg1));
+ if (signtype.IsNull()) { sout<<"Not a Signature : "<<arg1<<endl; return IFSelect_RetError; }
+ else sout<<"signtype now set to "<<arg1<<endl;
+ }
+ WS->SetSignType(signtype);
+ return IFSelect_RetDone;
+ }
+ return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus funsigncase
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** Sign Case ****
+ Handle(IFSelect_Signature) signcase = GetCasted(IFSelect_Signature,WS->NamedItem(arg1));
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (signcase.IsNull()) sout<<"Not a Signature : "<<arg1<<endl;
+ else {
+ Standard_Boolean hasmin,hasmax; Standard_Integer valmin,valmax;
+ if (signcase->IsIntCase(hasmin,valmin,hasmax,valmax)) {
+ sout<<"Signature "<<arg1<<" : Integer Case";
+ if (hasmin) sout<<" - Mini:"<<valmin;
+ if (hasmax) sout<<" - Maxi:"<<valmax;
+ sout<<endl;
+ }
+ Handle(TColStd_HSequenceOfAsciiString) caselist = signcase->CaseList();
+ if (caselist.IsNull()) sout<<"Signature "<<arg1<<" : no predefined case, see command count "<<arg1<<endl;
+ else {
+ Standard_Integer i, nb = caselist->Length();
+ sout<<"Signature "<<arg1<<" : "<<nb<<" basic cases :"<<endl;
+ for (i = 1; i <= nb; i ++) sout<<" "<<caselist->Value(i);
+ sout<<endl;
+ }
+ }
+ return IFSelect_RetVoid;
+}
+
+
+static IFSelect_ReturnStatus fun10
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** Entity Status ****
+ Standard_Integer i,nb;
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) {
+ nb = Interface_Category::NbCategories();
+ sout<<" Categories defined :"<<nb<<" i.e. :\n";
+ for (i = 0; i <= nb; i ++)
+ sout<<"Cat."<<i<<" : "<<Interface_Category::Name(i)<<"\n";
+ sout<<" On a given entity : give its number"<<endl;
+ return IFSelect_RetVoid;
+ }
+ Standard_Integer num = pilot->Number(arg1);
+ if (num <= 0 || num > WS->NbStartingEntities())
+ { sout<<"Not a suitable entity number : "<<arg1<<endl; return IFSelect_RetError; }
+ Handle(Standard_Transient) ent = WS->StartingEntity(num);
+ WS->PrintEntityStatus(ent,sout);
+ return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus fun11
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** DumpModel (Data) ****
+ Standard_Integer niv = 0;
+// char arg10 = arg1[0];
+// if (argc < 2) arg10 = '?';
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ switch (arg1[0]) {
+ case '?' :
+ sout<<"? 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)"<<endl;
+ return IFSelect_RetVoid;
+ 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 : sout<<"Unknown Mode . data tout court pour help"<<endl; return IFSelect_RetError;
+ }
+ WS->TraceDumpModel(niv);
+ return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus fundumpent
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ Handle(IFSelect_WorkLibrary) WL = WS->WorkLibrary();
+ Standard_Integer levdef=0,levmax=10,level;
+ WL->DumpLevels (levdef,levmax);
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2 || (argc == 2 && levmax < 0)) {
+ sout<<"Give n0 or id of entity";
+ if (levmax < 0) sout<<" and dump level"<<endl;
+ else sout<<" + optinal, dump level in [0 - "<<levmax<<"] , default = "<<levdef<<endl;
+ for (level = 0; level <= levmax; level ++) {
+ Standard_CString help = WL->DumpHelp (level);
+ if (help[0] != '\0') sout<<level<<" : "<<help<<endl;
+ }
+ return IFSelect_RetError;
+ }
+
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+ Standard_Integer num = pilot->Number(arg1);
+ if (num == 0) return IFSelect_RetError;
+ level = levdef;
+ if (argc > 2) level = atoi(arg2);
+ Handle(Standard_Transient) ent = WS->StartingEntity(num);
+ if ( ent.IsNull() ) {
+ sout << "No entity with given id " << arg1 << " (" << num << ") is found in the current model" << endl;
+ }
+ else {
+ sout << " -- DUMP Entity n0 " << num << " level " << level << endl;
+ WL->DumpEntity (WS->Model(),WS->Protocol(),ent,sout,level);
+
+ Interface_CheckIterator chl = WS->CheckOne (ent);
+ if (!chl.IsEmpty(Standard_False)) chl.Print(sout,WS->Model(),Standard_False);
+ }
+// sout << flush;
+
+ return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus funsign
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 3) { sout<<" Give signature name + n0 or id of entity"<<endl; return IFSelect_RetError; }
+ DeclareAndCast(IFSelect_Signature,sign,WS->NamedItem(arg1));
+ if (sign.IsNull()) { sout<<"Not a signature : "<<arg1<<endl; return IFSelect_RetError; }
+ Standard_Integer num = pilot->Number(arg2);
+ Handle(Standard_Transient) ent = WS->StartingEntity (num);
+ if (num == 0) return IFSelect_RetError;
+ sout<<"Entity n0 "<<num<<" : "<<WS->SignValue(sign,ent)<<endl;
+ return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus funqp
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 3) { sout<<" Give 2 numeros or labels : dad son"<<endl; return IFSelect_RetError; }
+ Standard_Integer n1 = WS->NumberFromLabel(arg1);
+ Standard_Integer n2 = WS->NumberFromLabel(arg2);
+ sout<<"QueryParent for dad:"<<arg1<<":"<<n1<<" and son:"<<arg2<<":"<<n2<<endl;
+ Standard_Integer qp = WS->QueryParent(WS->StartingEntity(n1),WS->StartingEntity(n2));
+ if (qp < 0) sout<<arg1<<" is not super-entity of "<<arg2<<endl;
+ else if (qp == 0) sout<<arg1<<" is same as "<<arg2<<endl;
+ else sout<<arg1<<" is super-entity of "<<arg2<<" , max level found="<<qp<<endl;
+// sout<<" Trouve "<<qp<<endl;
+ return IFSelect_RetVoid;
+}
+
+
+static IFSelect_ReturnStatus fun12
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** DumpShare ****
+ WS->DumpShare(); return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus fun13
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** ListItems ****
+ WS->ListItems(pilot->Arg(1)); return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus fun14
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** NewInt ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 1) { sout<<"Donner la valeur entiere pour IntParam"<<endl; return IFSelect_RetError; }
+ Handle(IFSelect_IntParam) intpar = new IFSelect_IntParam;
+ if (argc >= 1) intpar->SetValue(atoi(arg1));
+ return pilot->RecordItem (intpar);
+}
+
+static IFSelect_ReturnStatus fun15
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+// **** SetInt ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 3)
+ { sout<<"Donner 2 arguments : nom Parametre et Valeur"<<endl; return IFSelect_RetError; }
+ Standard_Integer val = atoi(arg2);
+ DeclareAndCast(IFSelect_IntParam,par,WS->NamedItem(arg1));
+ if (!WS->SetIntValue(par,val)) return IFSelect_RetFail;
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun16
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** NewText ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 1) { sout<<"Donner la valeur texte pour TextParam"<<endl; return IFSelect_RetError; }
+ Handle(TCollection_HAsciiString) textpar = new TCollection_HAsciiString();
+ if (argc >= 1) textpar->AssignCat(arg1);
+ return pilot->RecordItem (textpar);
+}
+
+static IFSelect_ReturnStatus fun17
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+// **** SetText ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 3)
+ { sout<<"Donner 2 arguments : nom Parametre et Valeur"<<endl; return IFSelect_RetError; }
+ DeclareAndCast(TCollection_HAsciiString,par,WS->NamedItem(arg1));
+ if (!WS->SetTextValue(par,arg2)) return IFSelect_RetFail;
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun19
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** DumpSel ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Give 1 argument : Selection Name"<<endl; return IFSelect_RetError; }
+ WS->DumpSelection (GetCasted(IFSelect_Selection,WS->NamedItem(arg1)));
+ return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus fun20
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+// **** EvalSel ****
+// **** GiveList ****
+// **** GiveShort GivePointed ****
+// **** MakeList ****
+ char mode = pilot->Arg(0)[0]; // givelist/makelist
+ if (mode == 'g') mode = pilot->Arg(0)[4]; // l list s short p pointed
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Give Entity ID, or Selection Name [+ optional other selection or entity]"<<endl; return IFSelect_RetError; }
+
+// MakeList : sur Pointed existante ou a creer
+ Handle(IFSelect_SelectPointed) pnt;
+ if (mode == 'm') {
+ const Standard_CString arg1 = pilot->Arg(1);
+ Handle(Standard_Transient) item = WS->NamedItem (arg1);
+ pnt = GetCasted(IFSelect_SelectPointed,item);
+ if (!pnt.IsNull()) {
+ sout<<arg1<<":Already existing Selection for List, cleared then filled"<<endl;
+ pnt->Clear();
+ } else if (!item.IsNull()) {
+ sout<<arg1<<":Already existing Item not for a List, command ignored"<<endl;
+ return IFSelect_RetFail;
+ } else {
+ pnt = new IFSelect_SelectPointed;
+ WS->AddNamedItem (arg1,pnt);
+ }
+ }
+
+ Handle(TColStd_HSequenceOfTransient) result =
+ XSDRAW_SelectFunctions::GiveList (WS,pilot->CommandPart( (mode == 'm' ? 2 : 1) ));
+ if (result.IsNull()) return IFSelect_RetError;
+ Interface_EntityIterator iter (result);
+ sout<<pilot->CommandPart( (mode == 'm' ? 2 : 1) )<<" : ";
+ if (mode == 'l') WS->ListEntities (iter,0);
+ else if (mode == 's' || mode == 'm') WS->ListEntities (iter,2);
+ else if (mode == 'p') {
+ sout<<iter.NbEntities()<<" Entities : ";
+ for (iter.Start(); iter.More(); iter.Next())
+ sout<<" +"<<WS->StartingNumber (iter.Value());
+ sout<<endl;
+ }
+
+ if (!pnt.IsNull()) {
+ pnt->SetList (result);
+ sout<<"List set to a SelectPointed : "<<pilot->Arg(1)<<endl;
+ sout<<"Later editable by command setlist"<<endl;
+ }
+
+ return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus fun20c
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+// **** GiveCount ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Give Entity ID, or Selection Name [+ optional other selection or entity]"<<endl; return IFSelect_RetError; }
+// WS->EvaluateSelection(GetCasted(IFSelect_Selection,WS->NamedItem(arg1)));
+ Handle(TColStd_HSequenceOfTransient) result =
+ XSDRAW_SelectFunctions::GiveList (WS,pilot->CommandPart(1));
+ if (result.IsNull()) return IFSelect_RetError;
+ sout<<pilot->CommandPart(1)<<" : List of "<<result->Length()<<" Entities"<<endl;
+ return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus funselsuite
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+// **** SelSuite ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Give Entity ID, or Selection Name [+ optional other selection or entity]"<<endl; return IFSelect_RetError; }
+// WS->EvaluateSelection(GetCasted(IFSelect_Selection,WS->NamedItem(arg1)));
+ Handle(IFSelect_SelectSuite) selsuite = new IFSelect_SelectSuite;
+
+ for (Standard_Integer i = 1; i < argc; i ++) {
+ Handle(IFSelect_Selection) sel = WS->GiveSelection(pilot->Arg(i));
+ if (!selsuite->AddInput(sel)) {
+ sout<<pilot->Arg(i-1)<<" : not a SelectDeduct, no more can be added. Abandon"<<endl;
+ return IFSelect_RetError;
+ }
+ }
+ selsuite->SetLabel (pilot->CommandPart(1));
+ return pilot->RecordItem (selsuite);
+}
+
+
+static IFSelect_ReturnStatus fun21
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** ClearItems ****
+ WS->ClearItems(); WS->ClearFinalModifiers(); WS->ClearShareOut(Standard_False);
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun22
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** ClearData ****
+ Standard_Integer mode = -1;
+ if (argc >= 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;
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (mode <= 0) {
+ if (mode < 0) sout<<"Give a suitable mode";
+ sout<<" Available Modes :\n"
+ <<" a : all data g : graph+check c : check p : selectpointed"<<endl;
+ return (mode < 0 ? IFSelect_RetError : IFSelect_RetVoid);
+ }
+ WS->ClearData (mode);
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun24
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+// **** Item Label ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ TCollection_AsciiString label;
+ if (argc < 2) { sout<<" Give label to search"<<endl; return IFSelect_RetError; }
+ for (int i = 1; i < argc; i ++) {
+ label.AssignCat(pilot->Arg(i));
+ if (i < argc-1) label.AssignCat(" ");
+ }
+ for (int mode = 0; mode <= 2; mode ++) {
+ int nbitems = 0; int id;
+ sout<<"Searching label : "<<label<<". in mode ";
+ if (mode == 0) sout <<" exact" << endl;
+ if (mode == 1) sout <<" same head" << endl;
+ if (mode == 2) sout <<" search if present" << endl;
+ for (id = WS->NextIdentForLabel(label.ToCString(), 0,mode) ; id != 0;
+ id = WS->NextIdentForLabel(label.ToCString(),id,mode)) {
+ sout<<" "<<id; nbitems ++;
+ }
+ sout<<" -- giving " << nbitems << " found" << endl;
+ }
+ return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus fun25
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** Save (Dump) ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Donner nom du Fichier"<<endl; return IFSelect_RetError; }
+ IFSelect_SessionFile dumper(WS,arg1);
+ if (!dumper.IsDone()) return IFSelect_RetFail;
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun26
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** Restore (Dump) ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Donner nom du Fichier"<<endl; return IFSelect_RetError; }
+ IFSelect_SessionFile dumper(WS);
+ Standard_Integer readstat = dumper.Read(arg1);
+ if (readstat == 0) return IFSelect_RetDone;
+ else if (readstat > 0) sout << "-- Erreur Lecture Fichier "<<arg1<<endl;
+ else sout << "-- Pas pu ouvrir Fichier "<<arg1<<endl;
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun27
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+// **** Param(Value) ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) {
+ Handle(TColStd_HSequenceOfHAsciiString) li = Interface_Static::Items();
+ Standard_Integer i,nb = li->Length();
+ sout<<" List of parameters : "<<nb<<" items : "<<endl;
+ for (i = 1; i <= nb; i ++) {
+ sout<<li->Value(i);
+ sout<<" : "<<Interface_Static::CVal(li->Value(i)->ToCString())<<endl;
+ }
+ return IFSelect_RetVoid;
+ } else if (atoi(arg1) > 0) {
+ Standard_Integer use = atoi (arg1);
+ WS->TraceStatics (use);
+ } else {
+ if (argc > 2) sout<<" FORMER STATUS of Static Parameter "<<arg1<<endl;
+ else sout<<" ACTUAL STATUS of Static Parameter "<<arg1<<endl;
+ if (!Interface_Static::IsPresent(arg1)) { sout<<" Parameter "<<arg1<<" undefined"<<endl; return IFSelect_RetError; }
+ if (!Interface_Static::IsSet(arg1)) sout<<" Parameter "<<arg1<<" not valued"<<endl;
+ else if (argc == 2) Interface_Static::Static (arg1) -> Print(sout);
+ else sout<<" Value : "<<Interface_Static::CVal(arg1)<<endl;
+
+ if (argc == 2) sout<<"To modify, param name_param new_val"<<endl;
+ else {
+ sout<<" New demanded value : "<<arg2;
+ if (Interface_Static::SetCVal (arg1,arg2))
+ { sout<<" OK"<<endl; return IFSelect_RetDone; }
+ else { sout <<" , refused"<<endl; return IFSelect_RetError; }
+ }
+ }
+ return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus fun28
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+ const Standard_CString arg3 = pilot->Arg(3);
+// **** DefParam ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) {
+ Handle(TColStd_HSequenceOfHAsciiString) li = Interface_Static::Items();
+ Standard_Integer i,nb = li->Length();
+ sout<<" List of parameters : "<<nb<<" items :"<<endl;
+ for (i = 1; i <= nb; i ++) sout<<" "<<li->Value(i)->ToCString();
+ sout<<endl<<" defparam name_param to known more about one"<<endl;
+ sout<<" defparam nom_param e options to edit a definition"<<endl;
+
+ } else if (argc == 2) {
+ sout<<" Definition of Parameter : "<<arg1<<endl;
+ Handle(Interface_Static) unst = Interface_Static::Static (arg1);
+ if (unst.IsNull()) sout<<" undefined"<<endl;
+ else unst->Print(sout);
+ return IFSelect_RetVoid;
+
+ } else if (arg2[0] == 'i') {
+// initialisation : arg1=nompar a2='i' a3=family a4=type [a5=val]
+ if (argc < 5) { sout<<" name init family type [valinit]"<<endl; return IFSelect_RetVoid; }
+ char typ = (pilot->Arg(4))[0];
+ Standard_Boolean ok= (argc==5 ? Interface_Static::Init(arg3,arg1,typ) :
+ Interface_Static::Init(arg3,arg1,typ,pilot->Arg(5)));
+ return (ok ? IFSelect_RetDone : IFSelect_RetFail);
+
+ } else if (arg2[0] == 'e') {
+// edition : arg1=nompar arg2='e' arg3=option arg4...=parametres option
+ char comm[100];
+ if (argc < 4) {
+ sout<<" give name and options ! Options (according type), 1 a time\n"
+ <<" imin ival / imax ival / rmin rval / rmax rval /\n"
+ <<" enum stnum / enum stnum match / eval e1 e2 e3 ... (maxi 10)\n"
+ <<endl;
+ return IFSelect_RetVoid;
+ }
+ if (argc > 4) sout<<"Only the command and ONE more arg are considered"<<endl;
+ sprintf(comm,"%s %s",pilot->Arg(3),pilot->Arg(4));
+ sout<<"Editing parameter : "<<arg1<<" , by command : "<<comm<<endl;
+
+ Handle(Interface_Static) unst = Interface_Static::Static (arg1);
+ if (unst.IsNull()) { sout<<arg1<<" undefined"<<endl; return IFSelect_RetError; }
+ if (Interface_Static::Init(unst->Family(),arg1,'&',comm))
+ { sout<<"Editing done"<<endl; return IFSelect_RetDone; }
+ else { sout<<"Command not processed : "<<comm<<endl; return IFSelect_RetFail; }
+ }
+ sout<<"Unknown Option : "<<arg2<<endl;
+ return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus fun29
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** SentFiles ****
+ Handle(TColStd_HSequenceOfHAsciiString) list = WS->SentFiles();
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (list.IsNull())
+ { sout<<"List of Sent Files not enabled"<<endl; return IFSelect_RetVoid; }
+ Standard_Integer i, nb = list->Length();
+ sout<<" Sent Files : "<<nb<<" : "<<endl;
+ for (i = 1; i <= nb; i ++)
+ sout<<list->Value(i)->ToCString()<<endl;
+ return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus fun30
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** FilePrefix ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) {
+ if (WS->FilePrefix().IsNull()) sout<<"Pas de prefixe defini"<<endl;
+ else sout<<"Prefixe : "<<WS->FilePrefix()->ToCString()<<endl;
+ sout<<"Pour changer : filepref newprefix"<<endl;
+ return IFSelect_RetVoid;
+ }
+ WS->SetFilePrefix(arg1);
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun31
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** FileExtension ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) {
+ if (WS->FileExtension().IsNull()) sout<<"Pas d extension definie"<<endl;
+ else sout<<"Extension : "<<WS->FileExtension()->ToCString()<<endl;
+ sout<<"Pour changer : fileext newext"<<endl;
+ return IFSelect_RetVoid;
+ }
+ WS->SetFileExtension(arg1);
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun32
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+// **** FileRoot ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Donner Dispatch et nom de Root"<<endl; return IFSelect_RetError; }
+ DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(arg1));
+ if (argc < 3) {
+ if (WS->FileRoot(disp).IsNull()) sout<<"Pas de racine definie pour "<<arg1<<endl;
+ else sout<<"Racine pour "<<arg1<<" : "<<WS->FileRoot(disp)->ToCString()<<endl;
+ sout<<"Pour changer : fileroot nomdisp newroot"<<endl;
+ return IFSelect_RetVoid;
+ }
+ if (!WS->SetFileRoot(disp,arg2)) return IFSelect_RetFail;
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun33
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** Default File Root ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) {
+ if (WS->DefaultFileRoot().IsNull()) sout<<"Pas de racine par defaut definie"<<endl;
+ else sout<<"Racine par defaut : "<<WS->DefaultFileRoot()->ToCString()<<endl;
+ sout<<"Pour changer : filedef newdef"<<endl;
+ return IFSelect_RetVoid;
+ }
+ WS->SetDefaultFileRoot(arg1);
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun34
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** EvalFile ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (!WS->HasModel())
+ { sout<<"Pas de Modele charge, abandon"<<endl; return IFSelect_RetFail; }
+
+ sout<<"Evaluation avec Memorisation des resultats"<<endl;
+ WS->EvaluateFile();
+ Standard_Integer nbf = WS->NbFiles();
+ for (Standard_Integer i = 1; i <= nbf; i ++) {
+ Handle(Interface_InterfaceModel) mod = WS->FileModel(i);
+ if (mod.IsNull())
+ { sout<<"Modele "<<i<<" Model non genere ..."<<endl; continue; }
+ TCollection_AsciiString name = WS->FileName(i);
+ sout<<"Fichier n0 "<<i<<" Nb Entites : "<<mod->NbEntities()<<" Nom: ";
+ sout<<name<<endl;
+ }
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun35
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** ClearFile ****
+ WS->ClearFile(); return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun36
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+// **** Split ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ IFSelect_ReturnStatus stat = IFSelect_RetVoid;
+ if (argc < 2) sout<<"Split : derniere liste de dispatches definie"<<endl;
+ else {
+ WS->ClearShareOut(Standard_True);
+ for (Standard_Integer i = 1; i < argc; i ++) {
+ DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(pilot->Arg(i)));
+ if (disp.IsNull()) {
+ sout<<"Pas un dispatch:"<<pilot->Arg(i)<<", Splitt abandonne"<<endl;
+ stat = IFSelect_RetError;
+ }
+ else WS->SetActive(disp,Standard_True);
+ }
+ }
+ if (stat == IFSelect_RetError) return stat;
+ WS->BeginSentFiles(Standard_True);
+ if (!WS->SendSplit()) return IFSelect_RetFail;
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun37
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** Remaining Data ****
+ char mode = '?'; IFSelect_RemainMode numod = IFSelect_RemainDisplay;
+ if (argc >= 2) mode = arg1[0];
+ if (mode == 'u') numod = IFSelect_RemainUndo;
+ else if (mode == 'l') numod = IFSelect_RemainDisplay;
+ else if (mode == 'c') numod = IFSelect_RemainCompute;
+ else if (mode == 'f') numod = IFSelect_RemainForget;
+ else {
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc<2) sout<<"Donner un Mode - ";
+ sout<<"Modes possibles : l list, c compute, u undo, f forget"<<endl;
+ if (mode == '?') return IFSelect_RetDone; else return IFSelect_RetError;
+ }
+ if (!WS->SetRemaining(numod)) return IFSelect_RetVoid;
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun38
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+// **** SetModelContent ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 3) { sout<<"Donner nom selection et mode (k=keep,r=remove)"<<endl; return IFSelect_RetError; }
+ Standard_Boolean keepmode;
+ DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1));
+ if (sel.IsNull())
+ { sout<<"Pas de Selection de Nom : "<<arg1<<endl; return IFSelect_RetError; }
+ if (arg2[0] == 'k') { sout<<" -- SetContent keep ..."; keepmode = Standard_True; }
+ else if (arg2[0] == 'r') { sout<<" -- SetContent remove ..."; keepmode = Standard_False; }
+ else { sout<<"Donner nom selection et mode (k=keep,r=remove)"<<endl; return IFSelect_RetError; }
+
+ if (WS->SetModelContent(sel,keepmode)) sout<<" Done"<<endl;
+ else sout<<" Result empty, ignored"<<endl;
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun40
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** ListModif ****
+ WS->ListFinalModifiers(Standard_True);
+ WS->ListFinalModifiers(Standard_False); return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus fun41
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** Modifier ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Donner Nom du Modifier"<<endl; return IFSelect_RetError; }
+ DeclareAndCast(IFSelect_GeneralModifier,modif,WS->NamedItem(arg1));
+ if (modif.IsNull())
+ { sout<<"Pas de Modifier de Nom : "<<arg1<<endl; return IFSelect_RetVoid; }
+ Handle(IFSelect_IntParam) low,up;
+
+ Handle(IFSelect_Dispatch) disp = modif->Dispatch();
+ sout<<"Modifier : "<<arg1<<" Label : "<<modif->Label()<<endl;
+ Standard_Integer rank = WS->ModifierRank(modif);
+ if (modif->IsKind(STANDARD_TYPE(IFSelect_Modifier)))
+ sout<< "Model Modifier n0." << rank;
+ else sout<< "File Modifier n0." << rank;
+ if (disp.IsNull()) sout<<" Applique a tous les Dispatchs" << endl;
+ else {
+ sout << " Dispatch : "<<disp->Label();
+ if (WS->HasName(disp)) sout << " - Nom:"<<WS->Name(disp)->ToCString();
+ sout<<endl;
+ }
+
+ Handle(IFSelect_Selection) sel = modif->Selection();
+ if (!sel.IsNull()) sout<<" Selection : "<< sel->Label();
+ if (WS->HasName(sel)) sout<<" - Nom:"<< WS->Name(sel)->ToCString();
+ sout<<endl;
+ return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus fun42
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+// **** ModifSel ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Donner Nom Modifier; + Nom Selection optionnel\n"
+ <<"Selection pour Mettre une Selection, sinon Annule"<<endl; return IFSelect_RetError; }
+ DeclareAndCast(IFSelect_GeneralModifier,modif,WS->NamedItem(arg1));
+ if (modif.IsNull())
+ { sout<<"Pas un nom de Modifier : "<<arg1<<endl; return IFSelect_RetError; }
+ Handle(IFSelect_Selection) sel;
+ if (arg2[0] != '\0') {
+ sel = GetCasted(IFSelect_Selection,WS->NamedItem(arg2));
+ if (sel.IsNull())
+ { sout<<"Pas un nom de Selection : "<<arg2<<endl; return IFSelect_RetError; }
+ }
+ if (!WS->SetItemSelection(modif,sel)) return IFSelect_RetFail;
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun43
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+// **** SetAppliedModifier ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Donner Nom Modifier; + Nom Dispatch ou Transformer optionnel :\n"
+ <<" - rien : tous Dispatches\n - Dispatch : ce Dispatch seul\n"
+ <<" - Transformer : pas un Dispatch mais un Transformer"<<endl;
+ return IFSelect_RetError; }
+ DeclareAndCast(IFSelect_GeneralModifier,modif,WS->NamedItem(arg1));
+ if (modif.IsNull())
+ { sout<<"Pas un nom de Modifier : "<<arg1<<endl; return IFSelect_RetError; }
+ Handle(Standard_Transient) item;
+ if (arg2[0] != '\0') {
+ item = WS->NamedItem(arg2);
+ if (item.IsNull())
+ { sout<<"Pas un nom connu : "<<arg2<<endl; return IFSelect_RetError; }
+ }
+ else item = WS->ShareOut();
+ if (!WS->SetAppliedModifier(modif,item)) return IFSelect_RetFail;
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun44
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** ResetApplied (modifier) ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Designer un modifier"<<endl; return IFSelect_RetError; }
+ DeclareAndCast(IFSelect_GeneralModifier,modif,WS->NamedItem(arg1));
+ if (modif.IsNull())
+ { sout<<"Pas un nom de Modifier : "<<arg1<<endl; return IFSelect_RetError; }
+ if (!WS->ResetAppliedModifier(modif)) return IFSelect_RetFail;
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun45
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+ const Standard_CString arg3 = pilot->Arg(3);
+// **** ModifMove ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 4) { sout<<"modifmove MF rang1 rang2, M pour Model F pour File"<<endl; return IFSelect_RetError; }
+ Standard_Boolean formodel;
+ if (arg1[0] == 'm' || arg1[0] == 'M') formodel = Standard_True;
+ else if (arg1[0] == 'f' || arg1[0] == 'F') formodel = Standard_False;
+ else { sout<<"preciser M pour Model, F pour File"<<endl; return IFSelect_RetError; }
+ Standard_Integer before = atoi(arg2);
+ Standard_Integer after = atoi(arg3);
+ if (before == 0 || after == 0) { sout<<"Donner 2 Entiers Positifs"<<endl; return IFSelect_RetError; }
+ if (!WS->ChangeModifierRank(formodel,before,after)) return IFSelect_RetFail;
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun51
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+// **** DispSel ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 3) { sout<<"Donner Noms Dispatch et Selection Finale"<<endl; return IFSelect_RetError; }
+ DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(arg1));
+ if (disp.IsNull())
+ { sout<<"Pas un nom de Dispatch : "<<arg1<<endl; return IFSelect_RetError; }
+ DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg2));
+ if (sel.IsNull())
+ { sout<<"Pas un nom de Selection : "<<arg2<<endl; return IFSelect_RetError; }
+ if (!WS->SetItemSelection(disp,sel)) return IFSelect_RetFail;
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun_dispone
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** DispOne ****
+ Handle(IFSelect_DispPerOne) disp = new IFSelect_DispPerOne;
+ return pilot->RecordItem(disp);
+}
+
+static IFSelect_ReturnStatus fun_dispglob
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** DispGlob ****
+ Handle(IFSelect_DispGlobal) disp = new IFSelect_DispGlobal;
+ return pilot->RecordItem(disp);
+}
+
+static IFSelect_ReturnStatus fun_dispcount
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** DispCount ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Donner Nom IntParam pour Count"<<endl; return IFSelect_RetError; }
+ DeclareAndCast(IFSelect_IntParam,par,WS->NamedItem(arg1));
+ if (par.IsNull())
+ { sout<<"Pas un nom de IntParam : "<<arg1<<endl; return IFSelect_RetError; }
+ Handle(IFSelect_DispPerCount) disp = new IFSelect_DispPerCount;
+ disp->SetCount (par);
+ return pilot->RecordItem(disp);
+}
+
+static IFSelect_ReturnStatus fun_dispfiles
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** DispFiles ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Donner Nom IntParam pour NbFiles"<<endl; return IFSelect_RetError; }
+ DeclareAndCast(IFSelect_IntParam,par,WS->NamedItem(arg1));
+ if (par.IsNull())
+ { sout<<"Pas un nom de IntParam : "<<arg1<<endl; return IFSelect_RetError; }
+ Handle(IFSelect_DispPerFiles) disp = new IFSelect_DispPerFiles;
+ disp->SetCount (par);
+ return pilot->RecordItem(disp);
+}
+
+
+static IFSelect_ReturnStatus fun_dispsign
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** DispFiles ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Donner Nom Signature"<<endl; return IFSelect_RetError; }
+ DeclareAndCast(IFSelect_Signature,sig,WS->NamedItem(arg1));
+ if (sig.IsNull())
+ { sout<<"Pas un nom de Signature : "<<arg1<<endl; return IFSelect_RetError; }
+ Handle(IFSelect_DispPerSignature) disp = new IFSelect_DispPerSignature;
+ disp->SetSignCounter (new IFSelect_SignCounter(sig));
+ return pilot->RecordItem(disp);
+}
+
+
+static IFSelect_ReturnStatus fun56
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** Dispatch ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Donner Nom du Dispatch"<<endl; return IFSelect_RetError; }
+ DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(arg1));
+ if (disp.IsNull()) { sout<<"Pas un dispatch : "<<arg1<<endl; return IFSelect_RetError; }
+ Standard_Integer num = WS->DispatchRank(disp);
+ sout<<"Dispatch de Nom : "<<arg1<<" , en ShareOut, Numero "<<num<<" : ";
+ Handle(IFSelect_Selection) sel = WS->ItemSelection(disp);
+ Handle(TCollection_HAsciiString) selname = WS->Name(sel);
+ if (sel.IsNull()) sout<<"Pas de Selection Finale"<<endl;
+ else if (selname.IsNull()) sout<<"Selection Finale : #"<<WS->ItemIdent(sel)<<endl;
+ else sout<<"Selection Finale : "<<selname->ToCString()<<endl;
+ if (disp->HasRootName()) sout<<"-- Racine nom de fichier : "
+ <<disp->RootName()->ToCString()<<endl;
+ return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus fun57
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** Remove ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Give Name to Remove !"<<endl; return IFSelect_RetError; }
+ if (!WS->RemoveNamedItem(arg1)) return IFSelect_RetFail;
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun58
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** EvalDisp ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 3) { sout<<"evaldisp mode disp [disp ...] : Mode + Name(s) of Dispatch(es). Mode:\n"
+ <<" 0 brief 1 +forgotten ents 2 +duplicata 3 1+2"<<endl
+ <<"See also : evaladisp writedisp xsplit"<<endl;
+ return IFSelect_RetVoid; }
+ Standard_Boolean OK = Standard_True;
+ Standard_Integer i , mode = atoi(arg1); sout<<" Mode "<<mode<<"\n";
+ for (i = 2; i < argc; i ++) {
+ DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(pilot->Arg(i)));
+ if (disp.IsNull())
+ { sout<<"Not a dispatch:"<<pilot->Arg(i)<<endl; OK = Standard_False; }
+ }
+ if (!OK) {
+ sout<<"Some of the parameters are not correct"<<endl;
+ return IFSelect_RetError;
+ }
+
+ WS->ClearShareOut(Standard_True);
+ for (i = 2; i < argc; i ++) {
+ DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(pilot->Arg(i)));
+ WS->SetActive(disp,Standard_True);
+ }
+// WS->EvaluateDispatch(disp,mode);
+ WS->EvaluateComplete(mode);
+ return IFSelect_RetVoid;
+}
+
+
+static IFSelect_ReturnStatus fun_evaladisp
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** EvalADisp [GiveList] ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 3) { sout<<"evaladisp mode(=0-1-2-3) disp [givelist] : Mode + Dispatch [+ GiveList]\n If GiveList not given, computed from Selection of the Dispatch. Mode:\n"
+ <<" 0 brief 1 +forgotten ents 2 +duplicata 3 1+2"<<endl
+ <<"See also : writedisp"<<endl;
+ return IFSelect_RetVoid; }
+ if (arg1[1] != '\0') { sout<<"first parameter : mode, must be a number between 0 and 3"<<endl; return IFSelect_RetError; }
+ Standard_Integer mode = atoi(arg1); sout<<" Mode "<<mode<<"\n";
+// DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(pilot->Arg(2)));
+ Handle(IFSelect_Dispatch) disp = XSDRAW_SelectFunctions::GiveDispatch (WS,pilot->Arg(2),Standard_True);
+ if (disp.IsNull())
+ { sout<<"Not a dispatch:"<<pilot->Arg(2)<<endl; return IFSelect_RetError; }
+ Handle(IFSelect_Selection) selsav = disp->FinalSelection();
+ Handle(IFSelect_Selection) sel;
+ if (argc > 3) {
+ Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
+ Handle(TColStd_HSequenceOfTransient) list = XSDRAW_SelectFunctions::GiveList
+ (pilot->Session(),pilot->CommandPart(3));
+ Standard_Integer nb = (list.IsNull() ? 0 : list->Length());
+ if (nb > 0) { sp->AddList (list); sel = sp; }
+ }
+
+ if (sel.IsNull() && selsav.IsNull())
+ { sout<<"No Selection nor GiveList defined"<<endl; return IFSelect_RetError; }
+ if (sel.IsNull() && !selsav.IsNull()) {
+ if (argc > 3) sout<<"GiveList is empty, hence computed from the Selection of the Dispatch"<<endl;
+ sel = selsav;
+ }
+ disp->SetFinalSelection(sel);
+// WS->ClearShareOut(Standard_True);
+// WS->SetActive(disp,Standard_True);
+ WS->EvaluateDispatch(disp,mode);
+ disp->SetFinalSelection(selsav);
+
+ return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus fun_writedisp
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** EvalADisp [GiveList] ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 3) { sout<<"writedisp filename disp [givelist] : FileName + Dispatch [+ GiveList]\n If GiveList not given, computed from Selection of the Dispatch.\n"
+ <<"FileName : rootname.ext will gives rootname_1.ext etc...\n"
+ <<" path/rootname.ext gives path/rootname_1.ext etc...\n"
+ <<"See also : evaladisp"<<endl;
+ return IFSelect_RetVoid; }
+ TCollection_AsciiString prefix,rootname,suffix;
+ SplitFileName (arg1,prefix,rootname,suffix);
+ if (rootname.Length() == 0 || suffix.Length() == 0) {
+ sout<<"Empty Root Name or Extension"<<endl;
+ return IFSelect_RetError;
+ }
+
+// DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(pilot->Arg(2)));
+ Handle(IFSelect_Dispatch) disp = XSDRAW_SelectFunctions::GiveDispatch (WS,pilot->Arg(2),Standard_True);
+ if (disp.IsNull())
+ { sout<<"Not a dispatch:"<<pilot->Arg(2)<<endl; return IFSelect_RetError; }
+ Handle(IFSelect_Selection) selsav = disp->FinalSelection();
+ Handle(IFSelect_Selection) sel;
+ if (argc > 3) {
+ Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
+ Handle(TColStd_HSequenceOfTransient) list = XSDRAW_SelectFunctions::GiveList
+ (pilot->Session(),pilot->CommandPart(3));
+ Standard_Integer nb = (list.IsNull() ? 0 : list->Length());
+ if (nb > 0) { sp->AddList (list); sel = sp; }
+ }
+
+ if (sel.IsNull() && selsav.IsNull())
+ { sout<<"No Selection nor GiveList defined"<<endl; return IFSelect_RetError; }
+ if (sel.IsNull() && !selsav.IsNull()) {
+ if (argc > 3) sout<<"GiveList is empty, hence computed from the Selection of the Dispatch"<<endl;
+ sel = selsav;
+ }
+
+ WS->ClearShareOut(Standard_True);
+ disp->SetFinalSelection(sel);
+ WS->SetActive(disp,Standard_True);
+ WS->BeginSentFiles(Standard_True);
+
+ WS->SetFilePrefix (prefix.ToCString());
+ WS->SetFileExtension (suffix.ToCString());
+ WS->SetFileRoot(disp,rootname.ToCString());
+
+ Standard_Boolean OK = WS->SendSplit();
+ disp->SetFinalSelection(selsav);
+ return (OK ? IFSelect_RetDone : IFSelect_RetFail);
+}
+
+
+static IFSelect_ReturnStatus fun59
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** EvalComplete ****
+ Standard_Integer mode = 0;
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) sout << " -- mode par defaut 0\n";
+ else { mode = atoi(arg1); sout << " -- mode : " << mode << endl; }
+ WS->EvaluateComplete(mode); return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus fun60
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** LastRunCheckList ****
+ Interface_CheckIterator chlist = WS->LastRunCheckList();
+ Handle(IFSelect_CheckCounter) counter = new IFSelect_CheckCounter(0);
+ counter->Analyse(chlist,WS->Model(),Standard_False);
+ counter->PrintCount (Message::DefaultMessenger());
+ return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus fun61
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** RunTransformer ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Donner Nom de Transformer"<<endl; return IFSelect_RetError; }
+ DeclareAndCast(IFSelect_Transformer,tsf,WS->NamedItem(arg1));
+ Standard_Integer effect = WS->RunTransformer(tsf);
+ switch (effect) {
+ case -4 : sout<<"Edition sur place, nouveau Protocole, erreur recalcul graphe"<<endl; break;
+ case -3 : sout<<"Erreur, Transformation ignoree"<<endl; break;
+ case -2 : sout<<"Erreur sur edition sur place, risque de corruption (verifier)"<<endl; break;
+ case -1 : sout<<"Erreur sur edition locale, risque de corruption (verifier)"<<endl; break;
+ case 0 :
+ if (tsf.IsNull()) sout<<"Erreur, pas un Transformer: "<<arg1<<endl;
+ else sout<<"Execution non faite"<<endl;
+ break;
+ case 1 : sout<<"Transformation locale (graphe non touche)"<<endl; break;
+ case 2 : sout<<"Edition sur place (graphe recalcule)"<<endl; break;
+ case 3 : sout<<"Modele reconstruit"<<endl; break;
+ case 4 : sout<<"Edition sur place, nouveau Protocole"<<endl; break;
+ case 5 : sout<<"Nouveau Modele avec nouveau Protocole"<<endl; break;
+ default : break;
+ }
+ return ((effect > 0) ? IFSelect_RetDone : IFSelect_RetFail);
+}
+
+static IFSelect_ReturnStatus fun62
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** TransformStandard Copy ****
+ return pilot->RecordItem(WS->NewTransformStandard(Standard_True));
+}
+
+static IFSelect_ReturnStatus fun63
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** TransformStandard OntheSpot ****
+ return pilot->RecordItem(WS->NewTransformStandard(Standard_False));
+}
+
+static IFSelect_ReturnStatus fun6465
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** Run Modifier avec Standard Copy ****
+// **** Run Modifier avec OnTheSpot ****
+ Standard_Boolean runcopy = (pilot->Arg(0)[3] == 'c');
+// soit c est un nom, sinon c est une commande
+ Handle(IFSelect_Modifier) modif;
+ if (WS->NameIdent(arg1) > 0)
+ modif = GetCasted(IFSelect_Modifier,WS->NamedItem(arg1));
+ else {
+ pilot->RemoveWord(0); // c etait la commande run
+ pilot->Perform();
+ modif = GetCasted(IFSelect_Modifier,pilot->RecordedItem());
+ }
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (modif.IsNull())
+ { sout<<"Pas un nom de Modifier : "<<arg1<<endl; return IFSelect_RetError; }
+
+ Handle(TColStd_HSequenceOfTransient) list;
+ Handle(IFSelect_SelectPointed) sp;
+ if (argc > 2) {
+ list = XSDRAW_SelectFunctions::GiveList (WS,pilot->CommandPart(2));
+ sp = new IFSelect_SelectPointed;
+ sp->SetList (list);
+ }
+
+ Standard_Integer effect = 0;
+ effect = WS->RunModifierSelected (modif,sp,runcopy);
+// sout<<"Modifier applique sur TransformStandard #"<<WS->ItemIdent(tsf)<<endl;
+ switch (effect) {
+ case -4 : sout<<"Edition sur place, nouveau Protocole, erreur recalcul graphe"<<endl; break;
+ case -3 : sout<<"Erreur, Transformation ignoree"<<endl; break;
+ case -2 : sout<<"Erreur sur edition sur place, risque de corruption (verifier)"<<endl; break;
+ case -1 : sout<<"Erreur sur edition locale, risque de corruption (verifier)"<<endl; break;
+ case 0 :
+ if (modif.IsNull()) sout<<"Erreur, pas un Modifier: "<<arg1<<endl;
+ else sout<<"Execution non faite"<<endl;
+ break;
+ case 1 : sout<<"Transformation locale (graphe non touche)"<<endl; break;
+ case 2 : sout<<"Edition sur place (graphe recalcule)"<<endl; break;
+ case 3 : sout<<"Modele reconstruit"<<endl; break;
+ case 4 : sout<<"Edition sur place, nouveau Protocole"<<endl; break;
+ case 5 : sout<<"Nouveau Modele avec nouveau Protocole"<<endl; break;
+ default : break;
+ }
+ return ((effect > 0) ? IFSelect_RetDone : IFSelect_RetFail);
+}
+
+static IFSelect_ReturnStatus fun66
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+// **** (xset) ModifReorder ****
+ char opt = ' ';
+ Standard_Integer argc = pilot->NbWords();
+ if (argc >= 2) opt = pilot->Word(1).Value(1);
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (opt != 'f' && opt != 'l')
+ { sout<<"Donner option : f -> root-first l -> root-last"<<endl; return IFSelect_RetError; }
+ return pilot->RecordItem(new IFSelect_ModifReorder(opt == 'l'));
+}
+
+static IFSelect_ReturnStatus fun70
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** SelToggle ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Donner Nom de Selection"<<endl; return IFSelect_RetError; }
+ DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1));
+ if (!WS->ToggleSelectExtract(sel))
+ { sout<<"Pas une SelectExtract : "<<arg1<<endl; return IFSelect_RetFail; }
+ if (WS->IsReversedSelectExtract(sel)) sout<<arg1<<" a present Reversed"<<endl;
+ else sout<<arg1<<" a present Directe"<<endl;
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun71
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+// **** SelInput ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 3) { sout<<"Donner Noms Selections cible et input"<<endl; return IFSelect_RetError; }
+ DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1));
+ DeclareAndCast(IFSelect_Selection,sou,WS->NamedItem(arg2));
+ if (sel.IsNull() || sou.IsNull())
+ { sout<<"Incorrect : "<<arg1<<","<<arg2<<endl; return IFSelect_RetError; }
+ if (!WS->SetInputSelection(sel,sou)) {
+ sout<<"Nom incorrect ou Selection "<<arg1<<" ni Extract ni Deduct"<<endl;
+ return IFSelect_RetFail;
+ }
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun72
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** SelModelRoots ****
+ return pilot->RecordItem (new IFSelect_SelectModelRoots);
+}
+
+static IFSelect_ReturnStatus fun73
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+// **** SelRange ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc >= 2 && arg1[0] == '?') argc = 1;
+ if (argc < 2) {
+ sout<<"Donner la description du SelectRange"
+ <<" Formes admises :\n <n1> <n2> : Range de <n1> a <n2>\n"
+ <<" <n1> tout seul : Range n0 <n1>\n from <n1> : Range From <n1>\n"
+ <<" until <n2> : Range Until <n2>"<<endl;
+ return IFSelect_RetVoid;
+ }
+
+ Handle(IFSelect_IntParam) low,up;
+ Handle(IFSelect_SelectRange) sel;
+// Range From
+ if (pilot->Word(1).IsEqual("from")) {
+ if (argc < 3) { sout<<"Forme admise : from <i>"<<endl; return IFSelect_RetError; }
+ low = GetCasted(IFSelect_IntParam,WS->NamedItem(arg2));
+ sel = new IFSelect_SelectRange;
+ sel->SetFrom (low);
+// Range Until
+ } else if (pilot->Word(1).IsEqual("until")) {
+ if (argc < 3) { sout<<"Forme admise : until <i>"<<endl; return IFSelect_RetError; }
+ up = GetCasted(IFSelect_IntParam,WS->NamedItem(arg2));
+ sel = new IFSelect_SelectRange;
+ sel->SetUntil (up);
+// Range One (n-th)
+ } else if (argc < 3) {
+ low = GetCasted(IFSelect_IntParam,WS->NamedItem(arg1));
+ sel = new IFSelect_SelectRange;
+ sel->SetOne (low);
+// Range (from-to)
+ } else {
+ low = GetCasted(IFSelect_IntParam,WS->NamedItem(arg1));
+ up = GetCasted(IFSelect_IntParam,WS->NamedItem(arg2));
+ sel = new IFSelect_SelectRange;
+ sel->SetRange (low,up);
+ }
+ return pilot->RecordItem (sel);
+}
+
+static IFSelect_ReturnStatus fun74
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** SelRoots ****
+ return pilot->RecordItem (new IFSelect_SelectRoots);
+}
+
+static IFSelect_ReturnStatus fun75
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** SelShared ****
+ return pilot->RecordItem (new IFSelect_SelectShared);
+}
+
+static IFSelect_ReturnStatus fun76
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+// **** SelDiff ****
+ Handle(IFSelect_Selection) sel = new IFSelect_SelectDiff;
+ if (sel.IsNull()) return IFSelect_RetFail;
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 3) sout<<"Diff sans input : ne pas oublier de les definir (ctlmain, ctlsec)!"<<endl;
+ DeclareAndCast(IFSelect_Selection,selmain,WS->NamedItem(arg1));
+ DeclareAndCast(IFSelect_Selection,selsec ,WS->NamedItem(arg2));
+ if (argc >= 2)
+ if (!WS->SetControl(sel,selmain,Standard_True))
+ sout<<"Echec ControlMain:"<<arg1<<" , a refaire (ctlmain)"<<endl;
+ if (argc >= 3)
+ if (!WS->SetControl(sel,selsec,Standard_False))
+ sout<<"Echec ControlSecond:"<<arg2<<" , a refaire (ctlsec)"<<endl;
+ return pilot->RecordItem (sel);
+}
+
+static IFSelect_ReturnStatus fun77
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+// **** SelControlMain ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 3) { sout<<"Donner Noms de Control et MainInput"<<endl; return IFSelect_RetError; }
+ DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1));
+ DeclareAndCast(IFSelect_Selection,selmain,WS->NamedItem(arg2));
+ if (WS->SetControl(sel,selmain,Standard_True)) return IFSelect_RetDone;
+ sout<<"Nom incorrect ou Selection "<<arg1<<" pas de type Control"<<endl;
+ return IFSelect_RetFail;
+}
+
+static IFSelect_ReturnStatus fun78
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+// **** SelControlSecond ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 3) { sout<<"Donner Noms de Control et SecondInput"<<endl; return IFSelect_RetError; }
+ DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1));
+ DeclareAndCast(IFSelect_Selection,seldif,WS->NamedItem(arg2));
+ if (WS->SetControl(sel,seldif,Standard_False)) return IFSelect_RetDone;
+ sout<<"Nom incorrect ou Selection "<<arg1<<" pas de type Control"<<endl;
+ return IFSelect_RetFail;
+}
+
+static IFSelect_ReturnStatus fun79
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** SelModelAll ****
+ return pilot->RecordItem (new IFSelect_SelectModelEntities);
+}
+
+static IFSelect_ReturnStatus fun80
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+// **** SelCombAdd ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 3) { sout<<"Donner n0 Combine et une Input"<<endl; return IFSelect_RetError; }
+ DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1));
+ DeclareAndCast(IFSelect_Selection,seladd,WS->NamedItem(arg2));
+ if (WS->CombineAdd(sel,seladd)) return IFSelect_RetDone;
+ sout<<"Nom incorrect ou Selection "<<arg1<<" pas Combine"<<endl;
+ return IFSelect_RetFail;
+}
+
+static IFSelect_ReturnStatus fun81
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+// **** SelCombRem ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 3) { sout<<"Donner n0 Combine et RANG a supprimer"<<endl; return IFSelect_RetError; }
+ DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg1));
+ DeclareAndCast(IFSelect_Selection,inp,WS->NamedItem(arg2));
+ if (WS->CombineRemove(sel,inp)) return IFSelect_RetDone;
+ sout<<"Nom incorrect ou Selection "<<arg1<<" ni Union ni Intersection"<<endl;
+ return IFSelect_RetFail;
+}
+
+static IFSelect_ReturnStatus fun82
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** SelEntNumber ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Donner Nom IntParam pour n0 Entite"<<endl; return IFSelect_RetError; }
+ DeclareAndCast(IFSelect_IntParam,par,WS->NamedItem(arg1));
+ Handle(IFSelect_SelectEntityNumber) sel = new IFSelect_SelectEntityNumber;
+ sel->SetNumber(par);
+ return pilot->RecordItem (sel);
+}
+
+static IFSelect_ReturnStatus fun83
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** SelUnion ****
+ return pilot->RecordItem (new IFSelect_SelectUnion);
+}
+
+static IFSelect_ReturnStatus fun84
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** SelIntersection ****
+ return pilot->RecordItem (new IFSelect_SelectIntersection);
+}
+
+static IFSelect_ReturnStatus fun85
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** SelTextType Exact ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Donner le TYPE a selectionner"<<endl; return IFSelect_RetError; }
+ return pilot->RecordItem (new IFSelect_SelectSignature
+ (new IFSelect_SignType,arg1,Standard_True));
+}
+
+static IFSelect_ReturnStatus fun86
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+// **** SelErrorEntities ****
+ return pilot->RecordItem (new IFSelect_SelectErrorEntities);
+}
+
+static IFSelect_ReturnStatus fun87
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+// **** SelUnknownEntities **
+ return pilot->RecordItem (new IFSelect_SelectUnknownEntities);
+}
+
+static IFSelect_ReturnStatus fun88
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+// **** SelSharing ****
+ return pilot->RecordItem (new IFSelect_SelectSharing);
+}
+
+static IFSelect_ReturnStatus fun89
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** SelTextType Contain **
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Donner le TYPE a selectionner"<<endl; return IFSelect_RetError; }
+ return pilot->RecordItem (new IFSelect_SelectSignature
+ (new IFSelect_SignType,arg1,Standard_False));
+}
+
+static IFSelect_ReturnStatus fun90
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+// **** SelPointed ****
+ Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
+ if (pilot->NbWords() > 1) {
+ Handle(TColStd_HSequenceOfTransient) list = XSDRAW_SelectFunctions::GiveList
+ (pilot->Session(),pilot->CommandPart(1));
+ if (list.IsNull()) return IFSelect_RetFail;
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ sout<<"SelectPointed : "<<list->Length()<<" entities"<<endl;
+ sp->AddList (list);
+ }
+ return pilot->RecordItem (sp);
+}
+
+static IFSelect_ReturnStatus fun91
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+// **** SetPointed (edit) / SetList (edit) ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) {
+ sout<<"Donner NOM SelectPointed + Option(s) :\n"
+ <<" aucune : liste des entites pointees\n"
+ <<" 0: Clear +nn ajout entite nn -nn enleve nn /nn toggle nn"<<endl;
+ return IFSelect_RetError;
+ }
+ DeclareAndCast(IFSelect_SelectPointed,sp,WS->NamedItem(arg1));
+ if (sp.IsNull()) { sout<<"Pas une SelectPointed:"<<arg1<<endl; return IFSelect_RetError; }
+ const Handle(Interface_InterfaceModel) &model = WS->Model(); // pour Print
+ if (argc == 2) { // listage simple
+ Standard_Integer nb = sp->NbItems();
+ sout<<" SelectPointed : "<<arg1<<" : "<<nb<<" Items :"<<endl;
+ for (Standard_Integer i = 1; i <= nb; i ++) {
+ Handle(Standard_Transient) pointed = sp->Item(i);
+ Standard_Integer id = WS->StartingNumber(pointed);
+ if (id == 0) sout <<" (inconnu)";
+ else { sout<<" "; model->Print(pointed,sout); }
+ }
+ if (nb > 0) sout<<endl;
+ return IFSelect_RetDone;
+ }
+
+ for (Standard_Integer ia = 2; ia < argc ; ia ++) {
+ const TCollection_AsciiString argi = pilot->Word(ia);
+ Standard_Integer id = pilot->Number(&(argi.ToCString())[1]);
+ if (id == 0) {
+ if (!argi.IsEqual("0")) sout<<"Incorrect,ignore:"<<argi<<endl;
+ else { sout<<"Clear SelectPointed"<<endl; sp->Clear(); }
+ } else if (argi.Value(1) == '-') {
+ Handle(Standard_Transient) item = WS->StartingEntity(id);
+ if (sp->Remove(item)) sout<<"Removed:no."<<id;
+ else sout<<" Echec Remove "<<id;
+ sout<<": "; model->Print(item,sout); sout<<endl;
+ } else if (argi.Value(1) == '/') {
+ Handle(Standard_Transient) item = WS->StartingEntity(id);
+ if (sp->Remove(item)) sout<<"Toggled:n0."<<id;
+ else sout<<" Echec Toggle "<<id;
+ sout<<": "; model->Print(item,sout); sout<<endl;
+ } else if (argi.Value(1) == '+') {
+ Handle(Standard_Transient) item = WS->StartingEntity(id);
+ if (sp->Add(item)) sout<<"Added:no."<<id;
+ else sout<<" Echec Add "<<id;
+ sout<<": "; model->Print(item,sout); sout<<endl;
+ } else {
+ sout<<"Ignore:"<<argi<<" , donner n0 PRECEDE de + ou - ou /"<<endl;
+ }
+ }
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun92
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** SelIncorrectEntities ****
+ WS->ComputeCheck();
+ return pilot->RecordItem (new IFSelect_SelectIncorrectEntities);
+}
+
+static IFSelect_ReturnStatus fun93
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** SelSignature ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 3) { sout<<"Give name of Signature or Counter, text + option exact(D) else contains"<<endl; return IFSelect_RetError; }
+ Standard_Boolean exact = Standard_True;
+ if (argc > 3) { if (pilot->Arg(3)[0] == 'c') exact = Standard_False; }
+
+ DeclareAndCast(IFSelect_Signature,sign,WS->NamedItem(arg1));
+ DeclareAndCast(IFSelect_SignCounter,cnt,WS->NamedItem(arg1));
+ Handle(IFSelect_SelectSignature) sel;
+
+ if (!sign.IsNull()) sel = new IFSelect_SelectSignature (sign,arg2,exact);
+ else if (!cnt.IsNull()) sel = new IFSelect_SelectSignature (cnt,arg2,exact);
+ else { sout<<arg1<<":neither Signature nor Counter"<<endl; return IFSelect_RetError; }
+
+ return pilot->RecordItem(sel);
+}
+
+static IFSelect_ReturnStatus fun94
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** SignCounter ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Donner nom signature"<<endl; return IFSelect_RetError; }
+ DeclareAndCast(IFSelect_Signature,sign,WS->NamedItem(arg1));
+ if (sign.IsNull()) { sout<<arg1<<":pas une signature"<<endl; return IFSelect_RetError; }
+ Handle(IFSelect_SignCounter) cnt = new IFSelect_SignCounter (sign,Standard_True,Standard_True);
+ return pilot->RecordItem(cnt);
+}
+
+static IFSelect_ReturnStatus funbselected
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+// **** NbSelected = GraphCounter ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Donner nom selection (deduction) a appliquer"<<endl; return IFSelect_RetError; }
+ DeclareAndCast(IFSelect_SelectDeduct,applied,WS->GiveSelection(arg1));
+ if (applied.IsNull()) { sout<<arg1<<":pas une SelectDeduct"<<endl; return IFSelect_RetError; }
+ Handle(IFSelect_GraphCounter) cnt = new IFSelect_GraphCounter (Standard_True,Standard_True);
+ cnt->SetApplied (applied);
+ return pilot->RecordItem(cnt);
+}
+
+// #########################################
+// #### EDITOR - EDITFORM ####
+// #########################################
+
+static IFSelect_ReturnStatus fun_editlist
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Give the name of an EditForm or an Editor"<<endl;
+ return IFSelect_RetError; }
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+
+// EditForm
+
+ DeclareAndCast(IFSelect_EditForm,edf,WS->NamedItem(arg1));
+ Handle(IFSelect_Editor) edt;
+ if (!edf.IsNull()) {
+ sout<<"Print EditForm "<<arg1<<endl;
+ edt = edf->Editor();
+ if (argc < 3) {
+
+// DEFINITIONS : Editor (direct ou via EditForm)
+
+ if (edt.IsNull()) edt = GetCasted(IFSelect_Editor,WS->NamedItem(arg1));
+ if (edt.IsNull()) return IFSelect_RetVoid;
+
+ sout<<"Editor, Label : "<<edt->Label()<<endl;
+ sout<<endl<<" -- Names (short - complete) + Labels of Values"<<endl;
+ edt->PrintNames(sout);
+ sout<<endl<<" -- Definitions --"<<endl;
+ edt->PrintDefs (sout);
+ if (!edf.IsNull()) {
+ edf->PrintDefs(sout);
+ sout<<endl<<"To display values, add an option : o original f final m modified"<<endl;
+ }
+
+ return IFSelect_RetVoid;
+
+ } else {
+ char opt = arg2[0];
+ Standard_Integer what = 0;
+ if (opt == 'o') what = -1;
+ else if (opt == 'f') what = 1;
+
+ edf->PrintValues (sout,what,Standard_False);
+ }
+ }
+
+ return IFSelect_RetVoid;
+}
+
+static IFSelect_ReturnStatus fun_editvalue
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 3) { sout<<"Give the name of an EditForm + name of Value [+ newvalue or . to nullify]"<<endl;
+ return IFSelect_RetError; }
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ DeclareAndCast(IFSelect_EditForm,edf,WS->NamedItem(arg1));
+ if (edf.IsNull())
+ { sout<<"Not an EditForm : "<<arg1<<endl; return IFSelect_RetError; }
+ Standard_Integer num = edf->NameNumber (arg2);
+ if (num == 0) sout<<"Unknown Value Name : "<<arg2<<endl;
+ if (num < 0) sout<<"Not Extracted Value Name : "<<arg2<<endl;
+ if (num <= 0) return IFSelect_RetError;
+
+ Standard_Boolean islist = edf->Editor()->IsList(num);
+ Standard_CString name = edf->Editor()->Name(num,Standard_True); // vrai nom
+ Handle(TColStd_HSequenceOfHAsciiString) listr;
+ Handle(TCollection_HAsciiString) str;
+ sout<<"Value Name : "<<name<<(edf->IsModified(num) ? "(already edited) : " : " : ");
+
+ if (islist) {
+ listr = edf->EditedList(num);
+ if (listr.IsNull()) sout<<"(NULL LIST)"<<endl;
+ else {
+ Standard_Integer ilist,nblist = listr->Length();
+ sout<<"(List : "<<nblist<<" Items)"<<endl;
+ for (ilist = 1; ilist <= nblist; ilist ++) {
+ str = listr->Value(ilist);
+ sout<<" ["<<ilist<<"] "<< (str.IsNull() ? "(NULL)" : str->ToCString())<<endl;
+ }
+ }
+ if (argc < 4) sout<<"To Edit, options by editval edit-form value-name ?"<<endl;
+ } else {
+ str = edf->EditedValue (num);
+ sout<<(str.IsNull() ? "(NULL)" : str->ToCString())<<endl;
+ }
+ if (argc < 4) return IFSelect_RetVoid;
+
+// Valeur simple ou liste ?
+ Standard_Integer numarg = 3;
+ str.Nullify();
+
+ const Standard_CString argval = pilot->Arg(numarg);
+ if (islist) {
+ if (argval[0] == '?') {
+ sout<<"To Edit, options"<<endl<<" + val : add value at end (blanks allowed)"
+ <<endl<<" +nn text : insert val before item nn"<<endl
+ <<" nn text : replace item nn with a new value"<<endl
+ <<" -nn : remove item nn"<<endl<<" . : clear the list"<<endl;
+ return IFSelect_RetVoid;
+ }
+ Standard_Boolean stated = Standard_False;
+ Handle(IFSelect_ListEditor) listed = edf->ListEditor (num);
+ if (listed.IsNull()) return IFSelect_RetError;
+ if (argval[0] == '.') { listr.Nullify(); stated = listed->LoadEdited(listr); }
+ else if (argval[0] == '+') {
+ Standard_Integer numadd = 0;
+ if (argval[1] != '\0') numadd = atoi(argval);
+ stated = listed->AddValue (new TCollection_HAsciiString(pilot->CommandPart(numarg+1)),numadd);
+ }
+ else if (argval[0] == '-') {
+ Standard_Integer numrem = atoi(argval);
+ stated = listed->Remove(numrem);
+ }
+ else {
+ Standard_Integer numset = atoi(argval);
+ if (numset > 0) stated = listed->AddValue
+ (new TCollection_HAsciiString(pilot->CommandPart(numarg+1)),numset);
+ }
+ if (stated) stated = edf->ModifyList (num,listed,Standard_True);
+ if (stated) sout<<"List Edition done"<<endl;
+ else sout<<"List Edition not done, option"<<argval<<endl;
+ } else {
+ if (argval[0] == '.' && argval[1] == '\0') str.Nullify();
+ else str = new TCollection_HAsciiString (pilot->CommandPart(numarg));
+ if (edf->Modify (num,str,Standard_True)) {
+ sout<<"Now set to "<<(str.IsNull() ? "(NULL)" : str->ToCString())<<endl;
+ } else {
+ sout<<"Modify not done"<<endl; return IFSelect_RetFail;
+ }
+ }
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun_editclear
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Give the name of an EditForm [+ name of Value else all]"<<endl;
+ return IFSelect_RetError; }
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ DeclareAndCast(IFSelect_EditForm,edf,WS->NamedItem(arg1));
+ if (edf.IsNull())
+ { sout<<"Not an EditForm : "<<arg1<<endl; return IFSelect_RetError; }
+ if (argc < 3) { edf->ClearEdit(); sout<<"All Modifications Cleared"<<endl; }
+ else {
+ Standard_Integer num = edf->NameNumber (arg2);
+ if (num == 0) sout<<"Unknown Value Name : "<<arg2<<endl;
+ if (num < 0) sout<<"Not Extracted Value Name : "<<arg2<<endl;
+ if (num <= 0) return IFSelect_RetError;
+ if (!edf->IsModified(num))
+ { sout<<"Value "<<arg2<<" was not modified"<<endl; return IFSelect_RetVoid; }
+ edf->ClearEdit (num);
+ sout<<"Modification on Value "<<arg2<<" Cleared"<<endl;
+ }
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun_editapply
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Give the name of an EditForm [+ option keep to re-apply edited values]"<<endl;
+ return IFSelect_RetError; }
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ DeclareAndCast(IFSelect_EditForm,edf,WS->NamedItem(arg1));
+ if (edf.IsNull())
+ { sout<<"Not an EditForm : "<<arg1<<endl; return IFSelect_RetError; }
+
+ Handle(Standard_Transient) ent = edf->Entity();
+ Handle(Interface_InterfaceModel) model = edf->Model();
+ if (!model.IsNull()) {
+ if (ent.IsNull()) sout<<"Applying modifications on loaded model"<<endl;
+ else {
+ sout<<"Applying modifications on loaded entity : ";
+ model->PrintLabel (ent,sout);
+ }
+ }
+ else sout<<"Applying modifications"<<endl;
+
+ if (!edf->ApplyData (edf->Entity(),edf->Model())) {
+ sout<<"Modifications could not be applied"<<endl;
+ return IFSelect_RetFail;
+ }
+ sout<<"Modifications have been applied"<<endl;
+
+ Standard_Boolean stat = Standard_True;
+ if (argc > 2 && arg2[0] == 'k') stat = Standard_False;
+ if (stat) {
+ edf->ClearEdit();
+ sout<<"Edited values are cleared"<<endl;
+ }
+ else sout<<"Edited values are kept for another loading/applying"<<endl;
+
+ return IFSelect_RetDone;
+}
+
+static IFSelect_ReturnStatus fun_editload
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) { sout<<"Give the name of an EditForm [+ Entity-Ident]"<<endl;
+ return IFSelect_RetError; }
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+ Handle(IFSelect_WorkSession) WS = pilot->Session();
+ DeclareAndCast(IFSelect_EditForm,edf,WS->NamedItem(arg1));
+ if (edf.IsNull())
+ { sout<<"Not an EditForm : "<<arg1<<endl; return IFSelect_RetError; }
+
+ Standard_Integer num = (argc < 3 ? 0 : pilot->Number (arg2));
+ Standard_Boolean stat = Standard_False;
+ if (argc < 3) {
+ sout<<"EditForm "<<arg1<<" : Loading Model"<<endl;
+ stat = edf->LoadModel(WS->Model());
+ } else if (num <= 0) {
+ sout<<"Not an entity ident : "<<arg2<<endl;
+ return IFSelect_RetError;
+ } else {
+ sout<<"EditForm "<<arg1<<" : Loading Entity "<<arg2<<endl;
+ stat = edf->LoadData (WS->StartingEntity(num),WS->Model());
+ }
+
+ if (!stat) {
+ sout<<"Loading not done"<<endl;
+ return IFSelect_RetFail;
+ }
+ sout<<"Loading done"<<endl;
+ return IFSelect_RetDone;
+}
+
+// #########################################
+// #### FONCTIONS COMPLEMENTAIRES ####
+// #########################################
+
+ Handle(Standard_Transient) XSDRAW_SelectFunctions::GiveEntity
+ (const Handle(IFSelect_WorkSession)& WS,
+ const Standard_CString name)
+{
+ Handle(Standard_Transient) ent; // demarre a Null
+ Standard_Integer num = GiveEntityNumber(WS,name);
+ if (num > 0) ent = WS->StartingEntity(num);
+ return ent;
+}
+
+ Standard_Integer XSDRAW_SelectFunctions::GiveEntityNumber
+ (const Handle(IFSelect_WorkSession)& WS,
+ const Standard_CString name)
+{
+ Standard_Integer num = 0;
+ if (!name || name[0] == '\0') {
+ char ligne[80]; ligne[0] = '\0';
+ cin >> ligne;
+// cin.clear(); cin.getline (ligne,79);
+ if (ligne[0] == '\0') return 0;
+ num = WS->NumberFromLabel (ligne);
+ }
+ else num = WS->NumberFromLabel (name);
+ return num;
+}
+
+ Handle(TColStd_HSequenceOfTransient) XSDRAW_SelectFunctions::GiveList
+ (const Handle(IFSelect_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
+
+Handle(IFSelect_Dispatch) XSDRAW_SelectFunctions::GiveDispatch
+ (const Handle(IFSelect_WorkSession)& WS,
+ const Standard_CString name, const Standard_Boolean mode)
+{
+ DeclareAndCast(IFSelect_Dispatch,disp,WS->NamedItem(name));
+ if (!disp.IsNull()) return disp; // OK as it is given
+
+// Else, let s try special cases
+ TCollection_AsciiString nam(name);
+ Standard_Integer paro = nam.Location(1,'(',1,nam.Length());
+ Standard_Integer parf = nam.Location(1,')',1,nam.Length());
+ nam.SetValue(paro,'\0'); nam.SetValue(parf,'\0');
+ if (paro <= 0 &&parf <= 0) return disp;
+ disp = GetCasted(IFSelect_Dispatch,WS->NamedItem(nam.ToCString()));
+ if (disp.IsNull()) return disp; // KO anyway
+
+// According to the type of dispatch :
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ DeclareAndCast(IFSelect_DispPerCount,dc,disp);
+ if (!dc.IsNull()) {
+ Standard_Integer nb = atoi( &(nam.ToCString())[paro]);
+ if (nb <= 0) {
+ sout<<" DispPerCount, count is not positive"<<endl;
+ disp.Nullify();
+ return disp;
+ }
+ if (mode) {
+ Handle(IFSelect_IntParam) val = new IFSelect_IntParam;
+ val->SetValue(nb);
+ dc->SetCount (val);
+ }
+ return dc;
+ }
+ DeclareAndCast(IFSelect_DispPerFiles,dp,disp);
+ if (!dp.IsNull()) {
+ Standard_Integer nb = atoi( &(nam.ToCString())[paro]);
+ if (nb <= 0) {
+ sout<<" DispPerFiles, count is not positive"<<endl;
+ disp.Nullify();
+ return disp;
+ }
+ if (mode) {
+ Handle(IFSelect_IntParam) val = new IFSelect_IntParam;
+ val->SetValue(nb);
+ dp->SetCount (val);
+ }
+ return dp;
+ }
+ DeclareAndCast(IFSelect_DispPerSignature,ds,disp);
+ if (!ds.IsNull()) {
+ DeclareAndCast(IFSelect_Signature,sg,WS->NamedItem( &(nam.ToCString())[paro]));
+ if (sg.IsNull()) {
+ sout<<"DispPerSignature "<<nam<<" , Signature not valid : "<<&(nam.ToCString())[paro]<<endl;
+ disp.Nullify();
+ return disp;
+ }
+ if (mode) ds->SetSignCounter (new IFSelect_SignCounter(sg));
+ return ds;
+ }
+ sout<<"Dispatch : "<<name<<" , Parameter : "<<&(nam.ToCString())[paro]<<endl;
+ return disp;
+}
+
+
+// #########################################
+// #### INITIALISATIONS ####
+// #########################################
+
+void XSDRAW_SelectFunctions::Init ()
+{
+ static int initactor = 0;
+ if (initactor) return; initactor = 1;
+
+ XSDRAW_Activator::SetGroup("DE: General");
+ XSDRAW_Activator::AddFunc("xstatus","Lists XSTEP Status : Version, System Name ...",funstatus);
+ XSDRAW_Activator::AddFunc("handler","Toggle status catch Handler Error of the session",fun1);
+ XSDRAW_Activator::AddFunc("xload","file:string : Read File -> Load Model",fun3);
+ XSDRAW_Activator::AddFunc("xread","file:string : Read File -> Load Model",fun3);
+ XSDRAW_Activator::AddFunc("writeall","file:string : Write all model (no split)",fun4);
+ XSDRAW_Activator::AddFunc("writesel","file:string sel:Selection : Write Selected (no split)",fun5);
+ XSDRAW_Activator::AddFunc("writeent","file:string n1ent n2ent...:integer : Write Entite(s) (no split)",fun6);
+ XSDRAW_Activator::AddFunc("writent", "file:string n1ent n2ent...:integer : Write Entite(s) (no split)",fun6);
+ XSDRAW_Activator::AddFunc("elabel","nument:integer : Displays Label Model of an entity",fun7);
+ XSDRAW_Activator::AddFunc("enum","label:string : Displays entities n0.s of which Label Model ends by..",fun8);
+
+ XSDRAW_Activator::AddFunc("listtypes","List nb entities per type. Optional selection name else all model",fun9);
+ XSDRAW_Activator::AddFunc("count","Count : counter [selection]",funcount);
+ XSDRAW_Activator::AddFunc("listcount","List Counted : counter [selection [nument]]",funcount);
+ XSDRAW_Activator::AddFunc("sumcount","Summary Counted : counter [selection [nument]]",funcount);
+ XSDRAW_Activator::AddFunc("signtype","Sign Type [newone]",funsigntype);
+ XSDRAW_Activator::AddFunc("signcase","signature : displays possible cases",funsigncase);
+
+ XSDRAW_Activator::AddFunc("estatus","ent/nument : displays status of an entity",fun10);
+ XSDRAW_Activator::AddFunc("data","Data (DumpModel); whole help : data tout court",fun11);
+ XSDRAW_Activator::AddFunc("entity","give n0 ou id of entity [+ level]",fundumpent);
+ XSDRAW_Activator::AddFunc("signature","signature name + n0/ident entity",funsign);
+ XSDRAW_Activator::AddFunc("queryparent"," give 2 n0s/labels of entities : dad son",funqp);
+
+ XSDRAW_Activator::AddFunc("dumpshare","Dump Share (dispatches, IntParams)",fun12);
+ XSDRAW_Activator::AddFunc("listitems","List Items [label else all] ->Type,Label[,Name]",fun13);
+ XSDRAW_Activator::AddFSet("integer","value:integer : cree un IntParam",fun14);
+ XSDRAW_Activator::AddFunc("setint","name:IntParam newValue:integer : Change valeur IntParam",fun15);
+ XSDRAW_Activator::AddFSet("text","value:string : cree un TextParam",fun16);
+ XSDRAW_Activator::AddFunc("settext","Name:TextParam newValue:string : Change valeur TextParam",fun17);
+ XSDRAW_Activator::AddFunc("dumpsel","Dump Selection suivi du Nom de la Selection a dumper",fun19);
+ XSDRAW_Activator::AddFunc("evalsel","name:Selection [num/sel] : Evalue une Selection",fun20);
+ XSDRAW_Activator::AddFunc("givelist","num/sel [num/sel ...] : Evaluates GiveList",fun20);
+ XSDRAW_Activator::AddFunc("giveshort","num/sel [num/sel ...] : GiveList in short form",fun20);
+ XSDRAW_Activator::AddFunc("givepointed","num/sel [num/sel ...] : GiveList to fill a SelectPointed",fun20);
+ XSDRAW_Activator::AddFunc("makelist","listname [givelist] : Makes a List(SelectPointed) from GiveList",fun20);
+ XSDRAW_Activator::AddFunc("givecount","num/sel [num/sel ...] : Counts GiveList",fun20c);
+ XSDRAW_Activator::AddFSet("selsuite","sel sel ... : Creates a SelectSuite",funselsuite);
+ XSDRAW_Activator::AddFunc("clearitems","Clears all items (selections, dispatches, etc)",fun21);
+ XSDRAW_Activator::AddFunc("cleardata","mode:a-g-c-p : Clears all or some data (model, check...)",fun22);
+
+ XSDRAW_Activator::AddFunc("itemlabel","xxx xxx : liste items having this label",fun24);
+ XSDRAW_Activator::AddFunc("xsave","filename:string : sauve items-session",fun25);
+ XSDRAW_Activator::AddFunc("xrestore","filename:string : restaure items-session",fun26);
+ XSDRAW_Activator::AddFunc("param","nompar:string : displays parameter value; + nompar val : changes it",fun27);
+ XSDRAW_Activator::AddFunc("defparam","nompar:string : display def. param; also : nompar edit, nompar init",fun28);
+
+ XSDRAW_Activator::AddFunc("sentfiles","Lists files sent from last Load",fun29);
+ XSDRAW_Activator::AddFunc("fileprefix","prefix:string : definit File Prefix",fun30);
+ XSDRAW_Activator::AddFunc("fileext","extent:string : definit File Extension",fun31);
+ XSDRAW_Activator::AddFunc("fileroot","disp:Dispatch root:string : definit File Root sur un Dispatch",fun32);
+ XSDRAW_Activator::AddFunc("filedef","defroot:string : definit File DefaultRoot",fun33);
+ XSDRAW_Activator::AddFunc("evalfile","Evaluation du FileNaming et memorisation",fun34);
+ XSDRAW_Activator::AddFunc("clearfile","Efface la liste d'EvalFile",fun35);
+ XSDRAW_Activator::AddFunc("xsplit","[disp:Dispatch sinon tout] : Split, la grande affaire !",fun36);
+ XSDRAW_Activator::AddFunc("remaining","options... : Remaining Entities, help complet par remaining ?",fun37);
+ XSDRAW_Activator::AddFunc("setcontent","sel:Selection mode:k ou r : Restreint contenu du modele",fun38);
+
+ XSDRAW_Activator::AddFunc("listmodif","List Final Modifiers",fun40);
+ XSDRAW_Activator::AddFunc("dumpmodif","modif:Modifier : Affiche le Statut d'un Modifier",fun41);
+ XSDRAW_Activator::AddFunc("modifsel","modif:Modifier [sel:Selection] : Change/Annule Selection de Modifier",fun42);
+ XSDRAW_Activator::AddFunc("setapplied","modif:Modifier [name:un item sinon sortie fichier] : Applique un Modifier",fun43);
+ XSDRAW_Activator::AddFunc("resetapplied","modif:Modifier : Enleve un Modifier de la sortie fichier",fun44);
+ XSDRAW_Activator::AddFunc("modifmove","modif:Modifier M(model)/F(file) avant,apres:integer : Deplace un Modifier (sortie fichier)",fun45);
+
+ XSDRAW_Activator::AddFunc("dispsel","disp:Dispatch sel:Selection -> Selection Finale de Dispatch",fun51);
+ XSDRAW_Activator::AddFSet("dispone","cree DispPerOne",fun_dispone);
+ XSDRAW_Activator::AddFSet("dispglob","cree DispGlobal",fun_dispglob);
+ XSDRAW_Activator::AddFSet("dispcount","count:IntParam : cree DispPerCount",fun_dispcount);
+ XSDRAW_Activator::AddFSet("dispfile","files:IntParam : cree DispPerFiles",fun_dispfiles);
+ XSDRAW_Activator::AddFSet("dispsign","sign:Signature : cree DispPerSignature",fun_dispsign);
+ XSDRAW_Activator::AddFunc("dumpdisp","disp:Dispatch : Affiche le Statut d'un Dispatch",fun56);
+
+ XSDRAW_Activator::AddFunc("xremove","nom : Remove a Control Item de la Session",fun57);
+ XSDRAW_Activator::AddFunc("evaldisp","mode=[0-3] disp:Dispatch : Evaluates one or more Dispatch(es)",fun58);
+ XSDRAW_Activator::AddFunc("evaladisp","mode=[0-3] disp:Dispatch [givelist] : Evaluates a Dispatch (on a GiveList)",fun_evaladisp);
+ XSDRAW_Activator::AddFunc("writedisp","filepattern disp:Dispatch [givelist] : Writes Entities by Splitting by a Dispatch",fun_writedisp);
+ XSDRAW_Activator::AddFunc("evalcomplete","Evaluation Complete de la Repartition",fun59);
+
+ XSDRAW_Activator::AddFunc("runcheck","affiche LastRunCheckList (write,modif)",fun60);
+ XSDRAW_Activator::AddFunc("runtranformer","transf:Transformer : Applique un Transformer",fun61);
+ XSDRAW_Activator::AddFSet("copy","cree TransformStandard, option Copy, vide",fun62);
+ XSDRAW_Activator::AddFSet("onthespot","cree TransformStandard, option OntheSpot, vide",fun63);
+ XSDRAW_Activator::AddFunc("runcopy","modif:ModelModifier [givelist] : Run <modif> via TransformStandard option Copy",fun6465);
+ XSDRAW_Activator::AddFunc("runonthespot","modif:ModelModifier [givelist] : Run <modif> via TransformStandard option OnTheSpot",fun6465);
+ XSDRAW_Activator::AddFSet("reorder","[f ou t] reordonne le modele",fun66);
+
+ XSDRAW_Activator::AddFunc("toggle","sel:Selection genre Extract : Toggle Direct/Reverse",fun70);
+ XSDRAW_Activator::AddFunc("input","sel:Selection genre Deduct ou Extract input:Selection : Set Input",fun71);
+ XSDRAW_Activator::AddFSet("modelroots","cree SelectModelRoots",fun72);
+ XSDRAW_Activator::AddFSet("range","options... : cree SelectRange ...; tout court pour help",fun73);
+ XSDRAW_Activator::AddFSet("roots","cree SelectRoots (local roots)",fun74);
+ XSDRAW_Activator::AddFSet("shared","cree SelectShared",fun75);
+ XSDRAW_Activator::AddFSet("diff","[main:Selection diff:Selection] : cree SelectDiff",fun76);
+ XSDRAW_Activator::AddFunc("selmain","sel:Selection genre Control main:Selection : Set Main Input",fun77);
+ XSDRAW_Activator::AddFunc("selsecond","sel:Selection genre Control sec:Selection : Set Second Input",fun78);
+ XSDRAW_Activator::AddFSet("modelall","cree SelectModelAll",fun79);
+ XSDRAW_Activator::AddFunc("seladd","sel:Selection genre Combine input:Selection : Add Selection",fun80);
+ XSDRAW_Activator::AddFunc("selrem","sel:Selection genre Combine input:Selection : Remove Selection",fun81);
+ XSDRAW_Activator::AddFSet("number","num:IntParam : Cree SelectEntityNumber",fun82);
+
+ XSDRAW_Activator::AddFSet("union","cree SelectUnion (vide), cf aussi combadd, combrem",fun83);
+ XSDRAW_Activator::AddFSet("intersect","cree SelectIntersection (vide), cf aussi combadd, combrem",fun84);
+ XSDRAW_Activator::AddFSet("typexact","type:string : cree SelectTextType Exact",fun85);
+ XSDRAW_Activator::AddFSet("errors","cree SelectErrorEntities (from file)",fun86);
+ XSDRAW_Activator::AddFSet("unknown","cree SelectUnknownEntities",fun87);
+ XSDRAW_Activator::AddFSet("sharing","cree SelectSharing",fun88);
+ XSDRAW_Activator::AddFSet("typecontain","type:string : cree SelectTextType Contains",fun89);
+ XSDRAW_Activator::AddFSet("pointed","cree SelectPointed [num/sel num/sel]",fun90);
+ XSDRAW_Activator::AddFunc("setpointed","sel:SelectPointed : edition SelectPointed. tout court pour help",fun91);
+ XSDRAW_Activator::AddFunc("setlist","sel:SelectPointed : edition SelectPointed. tout court pour help",fun91);
+ XSDRAW_Activator::AddFSet("incorrect","cree SelectIncorrectEntities (computed)",fun92);
+
+ XSDRAW_Activator::AddFSet("signsel","sign:Signature|cnt:Counter text:string [e(D)|c] : cree SelectSignature",fun93);
+ XSDRAW_Activator::AddFSet("signcounter","sign:Signature : cree SignCounter",fun94);
+ XSDRAW_Activator::AddFSet("nbselected","applied:Selection : cree GraphCounter(=NbSelected)",funbselected);
+
+ XSDRAW_Activator::AddFunc("editlist","editor or editform : lists defs + values",fun_editlist);
+ XSDRAW_Activator::AddFunc("editvalue","editform paramname [newval or .] : lists-changes a value",fun_editvalue);
+ XSDRAW_Activator::AddFunc("editclear","editform [paramname] : clears edition on all or one param",fun_editclear);
+ XSDRAW_Activator::AddFunc("editload","editform [entity-id] : loads from model or an entity",fun_editload);
+ XSDRAW_Activator::AddFunc("editapply","editform [keep] : applies on loaded data",fun_editapply);
+}
--- /dev/null
+// Created on: 1993-07-28
+// Created by: Christian CAILLET
+// Copyright (c) 1993-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _XSDRAW_SelectFunctions_HeaderFile
+#define _XSDRAW_SelectFunctions_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+#include <Standard_Handle.hxx>
+
+#include <TColStd_HSequenceOfTransient.hxx>
+class IFSelect_WorkSession;
+class IFSelect_Dispatch;
+
+
+//! Functions gives access to all the actions which can be
+//! commanded with the resources provided by IFSelect : especially
+//! WorkSession and various types of Selections and Dispatches
+//!
+//! It works by adding functions by method Init
+class XSDRAW_SelectFunctions
+{
+ public:
+
+ //! Takes the name of an entity, either as argument, or (if <name>
+ //! is empty) on keybord, and returns the entity
+ //! name can be a label or a number (in alphanumeric), it is
+ //! searched by NumberFromLabel from WorkSession.
+ //! If <name> doesn't match en entity, a Null Handle is returned
+ Standard_EXPORT static Handle(Standard_Transient) GiveEntity (const Handle(IFSelect_WorkSession)& WS, const Standard_CString name = "");
+
+ //! Same as GetEntity, but returns the number in the model of the
+ //! entity. Returns 0 for null handle
+ Standard_EXPORT static Standard_Integer GiveEntityNumber (const Handle(IFSelect_WorkSession)& WS, const Standard_CString name = "");
+
+ //! Computes a List of entities from a WorkSession and two idents,
+ //! first and second, as follows :
+ //! if <first> is a Number or Label of an entity : this entity
+ //! if <first> is the name of a Selection in <WS>, and <second>
+ //! not defined, the standard result of this Selection
+ //! if <first> is for a Selection and <second> is defined, the
+ //! standard result of this selection from the list computed
+ //! with <second> (an entity or a selection)
+ //! If <second> is erroneous, it is ignored
+ Standard_EXPORT static Handle(TColStd_HSequenceOfTransient) GiveList (const Handle(IFSelect_WorkSession)& WS, const Standard_CString first = "", const Standard_CString second = "");
+
+ //! Evaluates and returns a Dispatch, from data of a WorkSession
+ //! if <mode> is False, searches for exact name of Dispatch in WS
+ //! Else (D), allows a parameter between brackets :
+ //! ex.: dispatch_name(parameter)
+ //! The parameter can be: an integer for DispPerCount or DispPerFiles
+ //! or the name of a Signature for DispPerSignature
+ //! Returns Null Handle if not found not well evaluated
+ Standard_EXPORT static Handle(IFSelect_Dispatch) GiveDispatch (const Handle(IFSelect_WorkSession)& WS, const Standard_CString name, const Standard_Boolean mode = Standard_True);
+
+ //! Defines and loads all basic functions (as ActFunc)
+ Standard_EXPORT static void Init();
+};
+
+#endif // _XSDRAW_SelectFunctions_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 <BRep_Builder.hxx>
+#include <BRepTools.hxx>
+#include <Geom_Geometry.hxx>
+#include <IFSelect_CheckCounter.hxx>
+#include <IFSelect_SessionPilot.hxx>
+#include <Interface_CheckIterator.hxx>
+#include <Interface_InterfaceModel.hxx>
+#include <Interface_Macros.hxx>
+#include <Message.hxx>
+#include <Message_Messenger.hxx>
+#include <ShapeExtend_Explorer.hxx>
+#include <Standard_ErrorHandler.hxx>
+#include <Standard_Failure.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+#include <TColStd_SequenceOfInteger.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopTools_HSequenceOfShape.hxx>
+#include <Transfer_Binder.hxx>
+#include <Transfer_Finder.hxx>
+#include <Transfer_FinderProcess.hxx>
+#include <Transfer_SimpleBinderOfTransient.hxx>
+#include <Transfer_TransientListBinder.hxx>
+#include <Transfer_TransientProcess.hxx>
+#include <TransferBRep.hxx>
+#include <TransferBRep_ShapeBinder.hxx>
+#include <TransferBRep_ShapeListBinder.hxx>
+#include <TransferBRep_ShapeMapper.hxx>
+#include <XSControl_ConnectedShapes.hxx>
+#include <XSControl_Controller.hxx>
+
+#include <XSControl_TransferReader.hxx>
+#include <XSControl_TransferWriter.hxx>
+#include <XSControl_Vars.hxx>
+#include <XSControl_WorkSession.hxx>
+#include <XSDRAW.hxx>
+#include <XSDRAW_Activator.hxx>
+#include <XSDRAW_SelectFunctions.hxx>
+#include <XSDRAW_ShapeFunctions.hxx>
+
+#include <stdio.h>
+
+//=======================================================================
+//function : XSControl_tpdraw
+//purpose :
+//=======================================================================
+static Handle(XSControl_Vars) GetXSControlVars (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ static const Handle(XSControl_Vars) avars;
+ Handle(XSControl_WorkSession) WS = XSDRAW::Session(pilot);
+ return (WS.IsNull()? avars : WS->Vars());
+}
+
+// ######################################################################
+// #### ####
+// #### COMMANDS ####
+// #### ####
+// ######################################################################
+
+//=======================================================================
+//function : XSControl_tpdraw
+//purpose :
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_tpdraw
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+ const Standard_CString arg3 = pilot->Arg(3);
+ const Handle(Transfer_TransientProcess) &TP = XSDRAW::Session(pilot)->TransferReader()->TransientProcess();
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (TP.IsNull()) { sout<<"No Transfer Read"<<endl; return IFSelect_RetError;}
+ // **** tpdraw ****
+ if (argc < 2) {
+ sout<<"Donner [mode facultatif : item ou root] , NUMERO , nom DRAW facultatif"<<endl;
+ sout<<" mode si present : item ou root, sinon n0 d entite modele"<<endl;
+ sout<<" NUMERO entier : d entite, d item transfert ou de root transfert\n"
+ << " ou * pour dire tous"<<endl;
+ return IFSelect_RetError;
+ }
+ Standard_Integer mode = 0, num=0;
+ if (arg1[0] == 'i') mode = 1;
+ else if (arg1[0] == 'r') mode = 2;
+ Standard_Boolean tout = Standard_False;
+ if (mode == 0) {
+ if (argc < 2) { sout<<"Donner au moins un NUMERO ou *"<<endl; return IFSelect_RetError; }
+ if (arg1[0] == '*') tout = Standard_True;
+ else num = XSDRAW_SelectFunctions::GiveEntityNumber(XSDRAW::Session(pilot),arg1);
+ } else {
+ if (arg2[0] == '*') tout = Standard_True;
+ else num = XSDRAW_SelectFunctions::GiveEntityNumber(XSDRAW::Session(pilot),arg2);
+ }
+
+ Standard_Integer nbvar = 0;
+ Handle(Transfer_Binder) binder;
+ Handle(Standard_Transient) ent;
+ TopoDS_Shape sh; char nomvar[40];
+ // Standard_Boolean moderoot = (pilot->Word(0).Value(3) == 'r');
+
+ Standard_Integer n1, n2, i, max=0, index=0;
+ Handle(Interface_InterfaceModel) model = TP->Model();
+ if (model.IsNull()) {
+ if (mode == 0) {
+ sout<<"Pas de modele, preciser n0 d item de transfert"<<endl;
+ return IFSelect_RetError;
+ }
+ }
+ if (mode == 0) { sout<<"Entite de modele"; max = model->NbEntities(); }
+ if (mode == 1) { sout<<"Item de transfert"; max = TP->NbMapped(); }
+ if (mode == 2) { sout<<"Racine de transfert"; max = TP->NbRoots(); }
+ if (tout) {
+ n1 = 1; n2 = max;
+ sout<<", listage de 1 a "<<max<<endl;
+ }
+ else if (num <= 0 || num > max) {
+ sout<<" - Num="<<num<<" hors limite (de 1 a "<<max<<")"<<endl;
+ return IFSelect_RetError;
+ } else {
+ n1 = n2 = num; nbvar = -1; // nbvar : 1ere shape simple = pas de n0
+ sout<<", n0 "<<num<<endl;
+ }
+
+ for (i = n1; i <= n2; i ++) {
+ if (mode == 0) {
+ ent = model->Value(i);
+ num = i;
+ index = TP->MapIndex(ent);
+ } else if (mode == 1) {
+ ent = TP->Mapped(i);
+ if (model.IsNull()) num = 0;
+ else num = model->Number(ent);
+ index = i;
+ } else if (mode == 2) {
+ ent = TP->Root(i);
+ if (model.IsNull()) num = 0;
+ else num = model->Number(ent);
+ index = TP->MapIndex(ent);
+ }
+
+ if (index > 0) binder = TP->MapItem (index);
+ if (binder.IsNull()) index = 0;
+ if (index == 0) {
+ if (!tout) sout<<"Entite n0 "<<num<<" : non repertoriee"<<endl;
+ continue;
+ }
+ if (!binder->HasResult()) {
+ if (!tout) sout<<"Entite n0 "<<num<<" : pas de resultat"<<endl;
+ continue;
+ }
+ sh = TransferBRep::ShapeResult (binder);
+ //DeclareAndCast(TransferBRep_ShapeBinder,shb,binder);
+ if (!sh.IsNull()) {
+ //sh = shb->Result();
+ nbvar ++;
+ if (sh.IsNull()) { sout<<" (no Shape recorded)"<<endl; continue; }
+ if (tout) sout<<"[ "<<i<<" ]:";
+ if (num == 0) sout<<" pas dans le modele";
+ else sout<<" ent.n0 "<<num;
+ sout<<", item transfert n0 "<<index;
+ if (nbvar == 0) {
+ if (argc > 3 && mode > 0) sprintf (nomvar,"%s",arg3);
+ else if (argc > 2 && mode == 0) sprintf (nomvar,"%s",arg2);
+ else sprintf (nomvar,"tp_%d",i);
+ } else {
+ if (argc > 3 && mode > 0) sprintf (nomvar,"%s_%d",arg3,nbvar);
+ else if (argc > 2 && mode == 0) sprintf (nomvar,"%s_%d",arg2,nbvar);
+ else sprintf (nomvar,"tp_%d",i);
+ }
+ sout<<" -> 1 DRAW Shape: "<<nomvar<<endl;
+ GetXSControlVars(pilot)->SetShape(nomvar,sh);
+ continue;
+ }
+ DeclareAndCast(TransferBRep_ShapeListBinder,slb,binder);
+ if (!slb.IsNull()) {
+ const Standard_Integer nbs = slb->Result().Length();
+ if (tout) sout<<"[ "<<i<<" ]:";
+ if (num == 0) sout<<" pas dans le modele";
+ else sout<<" ent.n0 "<<num;
+ sout<<", item transfert n0 "<<index;
+ sout<<" -> "<<nbs<<" DRAW Shapes :";
+ for (Standard_Integer j = 1; j <= nbs; j ++) {
+ sh = slb->Result().Value(j); if (nbvar < 0) nbvar = 0; nbvar ++;
+ if (sh.IsNull()) { sout<<" (no Shape recorded)"<<endl; continue; }
+ if (argc > 3 && mode > 0) sprintf (nomvar,"%s_%d",arg3,nbvar);
+ else if (argc > 2 && mode == 0) sprintf (nomvar,"%s_%d",arg2,nbvar);
+ else sprintf (nomvar,"tp_%d_%d",i,nbvar);
+ sout<<" "<<nomvar;
+ GetXSControlVars(pilot)->SetShape(nomvar,sh);
+ }
+ sout<<endl;
+ continue;
+ }
+ DeclareAndCast(Transfer_SimpleBinderOfTransient,trb,binder);
+ if (!trb.IsNull()) {
+ Handle(Standard_Transient) resu = trb->Result();
+ if (resu.IsNull()) {
+ sout<<"Entite n0 "<<num<<" : pas de resultat"<<endl;
+ continue;
+ }
+ DeclareAndCast(Geom_Geometry,geom,resu);
+ sout<<"Entite n0 "<<num<<" : resultat "<<resu->DynamicType()->Name();
+ if (geom.IsNull()) { sout<<endl; continue; }
+ nbvar ++;
+ if (nbvar == 0) {
+ if (argc > 3 && mode > 0) sprintf (nomvar,"%s",arg3);
+ else if (argc > 2 && mode == 0) sprintf (nomvar,"%s",arg2);
+ else sprintf (nomvar,"tp_%d",i);
+ } else {
+ if (argc > 3 && mode > 0) sprintf (nomvar,"%s_%d",arg3,nbvar);
+ else if (argc > 2 && mode == 0) sprintf (nomvar,"%s_%d",arg2,nbvar);
+ else sprintf (nomvar,"tp_%d",i);
+ }
+ char* nomv = nomvar;
+ GetXSControlVars(pilot)->Set (nomv,geom);
+ sout<<" -> DRAW Geom : "<<nomvar<<endl;
+ continue;
+ }
+
+ if (sh.IsNull() && trb.IsNull())
+ if (!tout) sout<<"Entite n0 "<<num<<" : resultat pas une Shape mais "<<binder->ResultTypeName()<<endl;
+ }
+
+ if (sh.IsNull()) sout<<" (No Shape)"<<endl;
+ return IFSelect_RetDone;
+}
+
+//=======================================================================
+//function : XSControl_tpcompound
+//purpose :
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_tpcompound
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Handle(Transfer_TransientProcess) &TP = XSDRAW::Session(pilot)->TransferReader()->TransientProcess();
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (TP.IsNull()) { sout<<"No Transfer Read"<<endl; return IFSelect_RetError;}
+ // **** tpcompound ****
+ if (argc < 2) { sout<<"Give a NAME for the Compound + optional givelist, else roots are taken"<<endl; return IFSelect_RetError; }
+ Handle(TopTools_HSequenceOfShape) list;
+ if (argc == 2) list = TransferBRep::Shapes(TP);
+ else {
+ Handle(TColStd_HSequenceOfTransient) lise = XSDRAW_SelectFunctions::GiveList(pilot->Session(),pilot->CommandPart(2));
+ if (lise.IsNull()) { sout<<"Not a valid entity list : "<<pilot->CommandPart(2)<<endl; return IFSelect_RetError; }
+ list = TransferBRep::Shapes (TP,lise);
+ sout<<lise->Length()<<" Entities, ";
+ }
+ if (list.IsNull()) { sout<<"No Shape listed"<<endl; return IFSelect_RetError; }
+ Standard_Integer nb = list->Length();
+ sout<<nb<<" Shape(s) listed"<<endl;
+ TopoDS_Compound C;
+ BRep_Builder B;
+ B.MakeCompound(C);
+ for (Standard_Integer i = 1; i <= nb; i ++) B.Add (C,list->Value(i));
+ GetXSControlVars(pilot)->SetShape (arg1,C);
+ return IFSelect_RetDone;
+}
+
+
+
+//=======================================================================
+//function : XSControl_traccess
+//purpose :
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_traccess
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+ // **** trdraw : TransferReader **** 26
+ // **** trsave : TransferReader **** 27
+ // **** trcomp (comp -> DRAW) **** 28
+ // **** trscomp (comp -> save) **** 29
+ Standard_Boolean cascomp = (pilot->Word(0).Location(1,'o',1,5) > 0);
+ Standard_Boolean cassave = (pilot->Word(0).Location(1,'s',1,5) > 0);
+ char nomsh[100], noms[100];
+ const Handle(XSControl_TransferReader) &TR = XSDRAW::Session(pilot)->TransferReader();
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (TR.IsNull()) { sout<<" manque init"<<endl; return IFSelect_RetError; }
+ const Handle(Interface_InterfaceModel) &mdl = TR->Model();
+ if (mdl.IsNull()) { sout<<" modele absent"<<endl; return IFSelect_RetError; }
+ Standard_Integer num = (argc > 1 ? XSDRAW_SelectFunctions::GiveEntityNumber(XSDRAW::Session(pilot),arg1) : 0);
+
+ if (argc > 1) strcpy (nomsh,arg1);
+ else strcpy (nomsh,(cascomp ? "TREAD_COMP" : "TREAD_LIST"));
+ if (cassave) sout<<" save shapes -> current directory"<<endl;
+
+ if (num == 0 || cascomp) {
+ TopoDS_Compound C; // pour cas compound
+ BRep_Builder B;
+ B.MakeCompound(C);
+
+ const Handle(TopTools_HSequenceOfShape) &list = TR->ShapeResultList(Standard_True);
+ Standard_Integer i, nb = list->Length();
+ sout<<" TOUS RESULTATS par ShapeResultList, soit "<<nb<<endl;
+ for (i = 1; i <= nb; i ++) {
+ sprintf (noms,"%s_%d",nomsh,i);
+ if ( (i%1000) == 0) sout<<"("<<i<<")"<<endl;
+ else if ( (i%100) == 0) sout<<"*";
+ else if ( (i%10) == 0) sout<<"0";
+ else sout<<".";
+ if (list->Value(i).IsNull()) continue;
+ if (!cascomp && !cassave) GetXSControlVars(pilot)->SetShape(noms,list->Value(i));
+ else if (!cascomp && cassave) BRepTools::Write (list->Value(i),noms);
+ else if (cascomp) B.Add (C,list->Value(i));
+ }
+ sout<<endl;
+ if (cascomp && !cassave) GetXSControlVars(pilot)->SetShape(nomsh,C);
+ else if (cascomp && cassave) BRepTools::Write (C,nomsh);
+ } else {
+ if (num < 1 || num > mdl->NbEntities()) { sout<<" incorrect:"<<arg1<<endl; return IFSelect_RetError; }
+ TopoDS_Shape sh = TR->ShapeResult(mdl->Value(num));
+ if (sh.IsNull()) { sout<<" Pas de resultat pour "<<arg1<<endl; return IFSelect_RetError; }
+ if (argc > 2) sprintf (nomsh,"%s",arg2);
+ else sprintf (nomsh,"TREAD_%d",num);
+ if (!cascomp && !cassave) GetXSControlVars(pilot)->SetShape(nomsh,sh);
+ else if (!cascomp && cassave) BRepTools::Write (sh,nomsh);
+ else sout<<"Option non comprise"<<endl;
+ }
+ return IFSelect_RetDone;
+}
+
+//=======================================================================
+//function : XSControl_IsEqualSubShape
+//purpose :
+//=======================================================================
+// PTV 23.08.2000 Added for checking where are an entity from.
+static Standard_Boolean XSControl_IsEqualSubShape (const TopoDS_Shape& Shape,
+ TopoDS_Shape& sh, Standard_Integer aLevel)
+{
+ if ( sh.IsSame(Shape) ) return Standard_True;
+ if (aLevel > 0) {
+ TopoDS_Shape varShape;
+ aLevel--;
+ TopoDS_Iterator it(sh);
+ for (; it.More(); it.Next() ) {
+ varShape = it.Value();
+ if ( XSControl_IsEqualSubShape(Shape, varShape, aLevel) ) return Standard_True;
+ }
+ }
+ return Standard_False;
+}
+
+//=======================================================================
+//function : XSControl_fromshape
+//purpose :
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_fromshape
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ // **** fromshape (tread) ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 2) {
+ sout<<"Give name of a DRAW Shape"<<endl;
+ return IFSelect_RetError;
+ }
+ const char* a1 = (char *)arg1;
+ TopoDS_Shape Shape = GetXSControlVars(pilot)->GetShape(a1);
+ if (Shape.IsNull()) {
+ sout<<"Not a DRAW Shape:"<<arg1<<endl;
+ return IFSelect_RetError;
+ }
+ Standard_Boolean yena = Standard_False;
+ Standard_Integer aLevel = 1;
+ if (argc >=3 )
+ aLevel = atoi(pilot->Arg(2));
+ Standard_Boolean silent = Standard_False;
+ if (aLevel <0 ) {
+ silent = Standard_True;
+ aLevel = -aLevel;
+ }
+
+ // IMPORT
+ const Handle(XSControl_TransferReader) &TR = XSDRAW::Session(pilot)->TransferReader();
+ if (TR.IsNull()) { } // sout<<"No read transfer (import) recorded"<<endl;
+ else {
+ yena = Standard_True;
+ if ( ! silent ) sout<<"Shape "<<arg1<<" : ";
+ Standard_Integer modrec = 1;
+ Handle(Standard_Transient) ent = TR->EntityFromShapeResult (Shape,modrec);
+ if (ent.IsNull()) {
+ modrec = -1;
+ ent = TR->EntityFromShapeResult (Shape,modrec);
+ }
+ if (ent.IsNull()) {
+ modrec = 2;
+ Handle(Transfer_TransientProcess) TP = TR->TransientProcess();
+ if (TP.IsNull()) {
+ if ( silent )
+ sout << "Shape "<<arg1<<" : ";
+ sout<<"no map"<<endl;
+ }
+ else {
+ TopoDS_Shape S0 = Shape;
+ TopLoc_Location L;
+ S0.Location ( L );
+ Standard_Integer i, nb = TP->NbMapped();
+ if ( ! silent ) sout<<"searching in map among "<<nb<<" ...";
+ for (i = 1; i <= nb; i ++) {
+ ent = TP->Mapped(i);
+ TopoDS_Shape sh = TransferBRep::ShapeResult(TP,ent);
+ if (sh.IsNull()) {
+ ent.Nullify();
+ continue;
+ }
+ if (XSControl_IsEqualSubShape(Shape, sh, aLevel)) break;
+ modrec = -2;
+ sh.Location ( L );
+ if (XSControl_IsEqualSubShape(S0, sh, aLevel)) break;
+ ent.Nullify();
+ modrec = 2;
+ }
+ }
+ }
+ if ( ! ent.IsNull() ) {
+ if ( silent ) sout << "Shape " << arg1 << ": ";
+ if (modrec <0) sout<<"(moved from origin) ";
+ //else sout<<"(origin) ";
+ }
+ // on affiche
+ if (ent.IsNull()) {
+ if ( ! silent ) sout<<" unknown as imported";
+ // skl 11.05.2004
+ // if Shape is a compound try to make "fromshape" for its subshapes
+ if(Shape.ShapeType()==TopAbs_COMPOUND) {
+ sout<<endl<<"Subshapes imported from entities:";
+ TopoDS_Iterator Iter(Shape);
+ for (; Iter.More(); Iter.Next()) {
+ TopoDS_Shape subsh = Iter.Value();
+ Standard_Integer submodrec = 1;
+ Handle(Standard_Transient) subent = TR->EntityFromShapeResult(subsh,submodrec);
+ if (subent.IsNull()) {
+ submodrec = -1;
+ subent = TR->EntityFromShapeResult(subsh,submodrec);
+ }
+ if (!subent.IsNull()) {
+ sout<<" "<<XSDRAW::Session(pilot)->Model()->Number(subent);
+ }
+ }
+ }
+ }
+ else {
+ sout<<"imported from entity ";
+ XSDRAW::Session(pilot)->Model()->Print(ent,sout);
+ if ( silent ) sout << " in file " << XSDRAW::Session(pilot)->LoadedFile() << endl;
+ }
+ if ( ! silent ) sout<<endl;
+ }
+
+ // ET EN EXPORT ?
+ const Handle(Transfer_FinderProcess) &FP = XSDRAW::Session(pilot)->TransferWriter()->FinderProcess();
+ if (FP.IsNull()) { }
+ else {
+ yena = Standard_True;
+ Handle(Transfer_Finder) fnd = TransferBRep::ShapeMapper (FP,Shape);
+ Handle(Standard_Transient) ent;
+ if (!fnd.IsNull()) ent = FP->FindTransient (fnd);
+ if (!ent.IsNull()) {
+ sout<<"Shape "<<arg1<<": exported to entity ";
+ XSDRAW::Session(pilot)->Model()->Print(ent,sout);
+ if ( silent ) sout << " in file " << XSDRAW::Session(pilot)->LoadedFile();
+ sout<<endl;
+ }
+ // abv 31.08.00: treat case of splitted shape (several results)
+ // it is supposed that results are of the same type and lie in one-level comp
+ else {
+ Handle(Transfer_Binder) bnd = FP->Find ( fnd );
+ if ( ! bnd.IsNull() ) {
+ Handle(Transfer_TransientListBinder) TransientListBinder =
+ Handle(Transfer_TransientListBinder)::DownCast( bnd ); //skl
+ if (! TransientListBinder.IsNull() ) {
+ Standard_Integer i = 1, nb = TransientListBinder->Result().Length();
+ if (nb > 0) sout<<"Shape "<<arg1<<": exported to entities ";
+ for (; i<=nb; i++) {
+ XSDRAW::Session(pilot)->Model()->Print( TransientListBinder->Result().Value(i), sout );
+ if (i < nb) sout<<", ";
+ }
+ if (nb > 0) {
+ if ( silent ) sout << " in file " << XSDRAW::Session(pilot)->LoadedFile();
+ sout<<endl;
+ }
+ }
+ }
+ }
+ }
+ if (!yena) sout<<"No transfer (either import or export) recorded"<<endl;
+
+ return IFSelect_RetVoid;
+}
+
+//=======================================================================
+//function : XSControl_trconnexentities
+//purpose :
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_trconnexentities
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ // **** connected entities (last transfer) ****
+ const Handle(XSControl_TransferReader) &TR = XSDRAW::Session(pilot)->TransferReader();
+ Handle(Transfer_TransientProcess) TP;
+ if (!TR.IsNull()) TP = TR->TransientProcess();
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (TP.IsNull()) { sout<<"no transfer map"<<endl; return IFSelect_RetVoid; }
+ if (argc < 2) {
+ sout<<"Give name of a DRAW Shape + optional shape type v-e-w-f(D)-s"<<endl;
+ return IFSelect_RetError;
+ }
+ const char* a1 = (const char *)arg1;
+ TopoDS_Shape Shape = GetXSControlVars(pilot)->GetShape(a1);
+ if (Shape.IsNull()) { sout<<"Not a DRAW Shape:"<<arg1<<endl; return IFSelect_RetError; }
+ sout<<"Shape "<<arg1<<" : ";
+
+ Handle(TColStd_HSequenceOfTransient) list =
+ XSControl_ConnectedShapes::AdjacentEntities (Shape,TP,TopAbs_FACE);
+ Standard_Integer i, nb = list->Length();
+ sout<<nb<<" Entities produced Connected Shapes :"<<endl;
+ const Handle(Interface_InterfaceModel) &model = XSDRAW::Session(pilot)->Model();
+ sout<<"(";
+ for (i = 1; i <= nb; i ++) {
+ if (i > 1) sout<<",";
+ sout<<model->Number(list->Value(i));
+ }
+ sout<<")"<<endl;
+ return IFSelect_RetDone;
+}
+
+//=======================================================================
+//function : XSControl_trimport
+//purpose :
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_trimport
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ // FileName ou . (pour courant) VarName GiveList (obligatoire)
+ // GiveList : * pour xst-transferrable-roots
+ Handle(XSControl_WorkSession) WS = XSDRAW::Session(pilot);
+
+ Standard_Integer argc = pilot->NbWords();
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (argc < 4) {
+ sout<<"Give : filename or . for current model; varname or . to take fileroot\n GiveList, * for all transferrable roots"<<endl;
+ return IFSelect_RetError;
+ }
+ const Standard_CString arg1 = pilot->Arg(1);
+ const Standard_CString arg2 = pilot->Arg(2);
+ const Standard_CString arg3 = pilot->Arg(3);
+
+ // File Name and Variable (root) Name
+
+ TCollection_AsciiString fnom,rnom;
+ Standard_Boolean modfic = XSDRAW_ShapeFunctions::FileAndVar
+ (WS,arg1,arg2,"IMPORT",fnom,rnom);
+ if (modfic) sout<<" File to read : "<<fnom<<endl;
+ else sout<<" Model taken from the session : "<<fnom<<endl;
+ sout<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom<<endl;
+
+ // keep the current command, because sub-commands will be called
+ TCollection_AsciiString compart = pilot->CommandPart (3);
+
+ // Reading file if required
+
+ if (modfic) {
+ TCollection_AsciiString comload ("xload ");
+ comload.AssignCat(arg1);
+ IFSelect_ReturnStatus status = pilot->Execute(comload);
+ if (status != IFSelect_RetDone)
+ { sout<<"Abandon import"<<endl; return status; }
+ } else {
+ sout<<"Currently Loaded Model"<<endl;
+ }
+
+ // Selecting Entities
+
+ Handle(TColStd_HSequenceOfTransient) list;
+ if (arg3[0] == '*' && arg3[1] == '\0') {
+ list = WS->GiveList ("xst-transferrable-roots");
+ sout<<"All Transferrable Roots : ";
+ } else {
+ sout<<"List given by "<<compart.ToCString()<<" : ";
+ list = WS->GiveList (compart.ToCString());
+ }
+ if (list.IsNull()) { sout<<"No list defined. Abandon"<<endl; return IFSelect_RetError; }
+ Standard_Integer nbl = list->Length();
+ sout<<"Nb entities selected : "<<nbl<<endl;
+
+ // Starting Transfer
+
+ WS->InitTransferReader (0);
+ const Handle(XSControl_TransferReader) &TR = WS->TransferReader();
+ if (TR.IsNull()) { sout<<" init not done or failed"<<endl; return IFSelect_RetError; }
+
+ TR->BeginTransfer();
+
+ // Transferring
+ Standard_Integer nbt = TR->TransferList(list);
+ sout<<"Nb Entities Selected : "<<nbl<<" have given "<<nbt<<" results"<<endl;
+
+ // Filling VARS. one compound (trimpcomp) or one shape per ent (trimport)
+ Standard_Boolean iscomp = (pilot->Arg(0)[5] == 'c');
+ Standard_Integer nbs = 0;
+ TopoDS_Shape sh;
+ TopoDS_Compound C;
+ BRep_Builder B;
+ B.MakeCompound (C);
+ Handle(Interface_InterfaceModel) mdl = TR->Model();
+ if (mdl.IsNull()) { sout<<" modele absent"<<endl; return IFSelect_RetError; }
+ for (Standard_Integer il= 1; il <= nbl; il ++) {
+ Handle(Standard_Transient) ent = list->Value(il);
+ sh = TR->ShapeResult(ent);
+ if (sh.IsNull()) continue;
+ nbs ++;
+ if (iscomp) B.Add (C,sh);
+ else {
+ char nomsh[50];
+ sprintf (nomsh,"%s_%d",rnom.ToCString(),nbs);
+ GetXSControlVars(pilot)->SetShape(nomsh,sh);
+ }
+ }
+ if (nbs == 0) sout<<"No Shape produced"<<endl;
+ else if (nbs == 1) {
+ sout<<"One Shape produced, named "<<rnom.ToCString()<<endl;
+ GetXSControlVars(pilot)->SetShape(rnom.ToCString(),sh);
+ } else if (iscomp) {
+ sout<<"One compound made of "<<nbs<<" Shapes, named "<<rnom.ToCString()<<endl;
+ GetXSControlVars(pilot)->SetShape(rnom.ToCString(),C);
+ } else { // several individual shapes
+ sout<<nbs<<" Shapes, named "<<rnom.ToCString()<<"_1 to "<<rnom.ToCString()<<"_"<<nbs<<endl;
+ }
+
+ return IFSelect_RetDone;
+}
+
+//=======================================================================
+//function : XSControl_twrite
+//purpose :
+//=======================================================================
+static IFSelect_ReturnStatus XSControl_twrite
+ (const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Arg(1);
+ // **** twrite ****
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ Handle(XSControl_TransferWriter) TW = XSDRAW::Session(pilot)->TransferWriter();
+ if (argc < 2) { sout<<" donner nom de shape draw"<<endl; return IFSelect_RetError; }
+ sout<<"Attention, on alimente le modele courant ..."<<endl;
+
+ // Shape
+ for (Standard_Integer i = 1; i < argc; i ++) {
+ const char* ai = (const char *)pilot->Arg(i);
+ TopoDS_Shape Shape = GetXSControlVars(pilot)->GetShape(ai);
+ if (Shape.IsNull()) { sout<<"pas un nom de shape draw:"<<arg1<<endl; continue; }
+ sout<<"Pour Shape : "<<ai;
+ Standard_Integer stat = TW->TransferWriteShape (XSDRAW::Session(pilot)->Model(),Shape);
+ sout<<" Transfer Write Status = "<<stat<<endl;
+ }
+ pilot->Session()->ComputeGraph();
+ // Transient ? (Geom) : ignore
+ return IFSelect_RetDone;
+}
+
+// ######################################################################
+// #### ####
+// #### Initialising Commands ####
+// #### ####
+// ######################################################################
+
+//=======================================================================
+//function : Init
+//purpose :
+//=======================================================================
+
+void XSDRAW_ShapeFunctions::Init ()
+{
+ static int initactor = 0;
+ if (initactor) return; initactor = 1;
+
+ XSDRAW_Activator::SetGroup("DE: General");
+
+ XSDRAW_Activator::AddFunc ("tpdraw","[mode:item or root] num|* [nomvar] Passes an ITEM to Shape Draw (Start or Result)",XSControl_tpdraw);
+
+ XSDRAW_Activator::AddFunc ("tpcompound","name:cstring [givelist] : -> compound with Shapes Root or from givelist",XSControl_tpcompound);
+
+ XSDRAW_Activator::AddFunc ("trdraw","results ->DRAW : all; or num [name] : from ent.num -> DRAW [name/tread_num]",XSControl_traccess);
+ XSDRAW_Activator::AddFunc ("trsave","results ->files : all; or num [name] : from ent.num -> DRAW [name/tread_num]",XSControl_traccess);
+ XSDRAW_Activator::AddFunc ("trcomp","results -> 1 compound -> DRAW + name optional",XSControl_traccess);
+ XSDRAW_Activator::AddFunc ("trscomp","results -> 1 compound -> file + name optional",XSControl_traccess);
+
+ XSDRAW_Activator::AddFunc ("fromshape","shape [level=1]: imported/exported entity (when known)",XSControl_fromshape);
+ XSDRAW_Activator::AddFunc ("trconnexent","name of draw shape : entities -> connected shapes (when known)",XSControl_trconnexentities);
+
+ XSDRAW_Activator::AddFunc ("trimport","filename or . varname givelist -> 1 shape per entity",XSControl_trimport);
+ XSDRAW_Activator::AddFunc ("trimpcomp","filename or . varname givelist -> one xcompound",XSControl_trimport);
+
+ XSDRAW_Activator::AddFunc ("twrite","shape : transfer write for this shape, AFTER newmodel !",XSControl_twrite);
+}
+
+// ######################################################################
+// #### ####
+// #### Additional Methods ####
+// #### ####
+// ######################################################################
+
+
+//=======================================================================
+//function : MoreShapes
+//purpose :
+//=======================================================================
+
+Standard_Integer XSDRAW_ShapeFunctions::MoreShapes
+ (const Handle(XSControl_WorkSession)& session,
+ Handle(TopTools_HSequenceOfShape)& list, const Standard_CString name)
+{
+ // name = un nom -> Draw
+ // name = "*" -> tous les transferts RACINES du TP
+ // name = "**" -> tous les transferts du TP : VRAIMENT TOUS
+ // name = "." -> reperage graphique (not yet impl)
+ // name = nom(n1-n2) avec n1,n2 entiers : les variables de nom nomn1 a nomn2
+ Handle(Message_Messenger) sout = Message::DefaultMessenger();
+ if (list.IsNull()) list = new TopTools_HSequenceOfShape();
+ if (name[0] == '*' && (name[1] == '\0' || (name[1] == '*' && name[2] == '\0'))) {
+ const Handle(Transfer_TransientProcess) &TP = session->TransferReader()->TransientProcess();
+ if (TP.IsNull()) { sout<<"last transfer : unknown"<<endl;return 0; }
+ Handle(TopTools_HSequenceOfShape) li = TransferBRep::Shapes(TP,(name[1] == '\0'));
+ if (li.IsNull()) return 0;
+ list->Append (li);
+ return li->Length();
+ }
+ Standard_Integer i, paro = 0, parf = 0, moins = 0, n1 = 0, n2 = 0;
+ for (i = 0; name[i] != '\0'; i ++) {
+ if (name[i] == '(') paro = i;
+ if (name[i] == '-') moins = i;
+ if (name[i] == ')') parf = i;
+ }
+ if (paro && moins && parf) {
+ n2 = atoi (&name[moins+1]);
+ n1 = atoi (&name[paro +1]); if (n1 < 0) n1 += n2; // sinon on a n1-n2
+ }
+ // liste
+ if (n1 <= n2 && n1 > 0) {
+ char nom[50], nomsh[60]; Standard_Integer nbsh = 0;
+ for (i = 0; i < paro; i ++) nom[i]=name[i]; nom[paro] = '\0';
+ sout<<"Shapes DRAW named : "<<nom<<n1<<" to "<<nom<<n2;
+ for (i = n1; i <= n2 ; i ++) {
+ const char* nomshh = &nomsh[0];
+ sprintf (nomsh,"%s%d",nom,i);
+ TopoDS_Shape Shape = session->Vars()->GetShape(nomshh);
+ if (Shape.IsNull()) continue;
+ list->Append(Shape);
+ nbsh ++;
+ }
+ sout<<" -> taken "<<nbsh<<" Shapes"<<endl;
+ return nbsh;
+ }
+ const char* a1 = (const char *)name;
+ TopoDS_Shape Shape = session->Vars()->GetShape(a1);
+ if (Shape.IsNull()) { sout<<"not a shape draw:"<<a1<<endl; return 0; }
+ list->Append(Shape);
+ return 1;
+}
+
+
+//=======================================================================
+//function : FileAndVar
+//purpose :
+//=======================================================================
+
+Standard_Boolean XSDRAW_ShapeFunctions::FileAndVar
+ (const Handle(XSControl_WorkSession)& session,
+ const Standard_CString file, const Standard_CString var,
+ const Standard_CString def,
+ TCollection_AsciiString& resfile, TCollection_AsciiString& resvar)
+{
+ Standard_Boolean iafic = Standard_True;
+ resfile.Clear(); resvar.Clear();
+ if (file)
+ if ( file[0] == '\0' ||
+ (file[0] == '.' && file[1] == '\0')) iafic = Standard_False;
+ if (!iafic) resfile.AssignCat (session->LoadedFile());
+ else resfile.AssignCat (file);
+
+ if (var && var[0] != '\0' && (var[0] != '.' || var[1] != '\0') )
+ resvar.AssignCat (var);
+ else if (resfile.Length() == 0) resvar.AssignCat (def);
+ else {
+ Standard_Integer nomdeb, nomfin;
+ nomdeb = resfile.SearchFromEnd ("/");
+ if (nomdeb <= 0) nomdeb = resfile.SearchFromEnd("\\"); // pour NT
+ if (nomdeb < 0) nomdeb = 0;
+ nomfin = resfile.SearchFromEnd (".");
+ if (nomfin < nomdeb) nomfin = resfile.Length() + 1;
+ resvar = resfile.SubString(nomdeb+1,nomfin-1);
+ }
+ return iafic;
+}
--- /dev/null
+// Created on: 1995-03-16
+// 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 _XSDRAW_ShapeFunctions_HeaderFile
+#define _XSDRAW_ShapeFunctions_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Handle.hxx>
+
+#include <TopTools_HSequenceOfShape.hxx>
+class XSControl_WorkSession;
+class TCollection_AsciiString;
+
+
+//! Defines additionnal commands for XSDRAW to :
+//! - control of initialisation (xinit, xnorm, newmodel)
+//! - analyse of the result of a transfer (recorded in a
+//! TransientProcess for Read, FinderProcess for Write) :
+//! statistics, various lists (roots,complete,abnormal), what
+//! about one specific entity, producing a model with the
+//! abnormal result
+//!
+//! This appendix of XSDRAW is compiled separately to distinguish
+//! basic features from user callable forms
+class XSDRAW_ShapeFunctions
+{
+ public:
+
+ //! Defines and loads all functions which work on shapes for XSDRAW (as ActFunc)
+ Standard_EXPORT static void Init();
+
+ //! Analyses a name as designating Shapes from a Vars or from
+ //! XSTEP transfer (last Transfer on Reading). <name> can be :
+ //! "*" : all the root shapes produced by last Transfer (Read)
+ //! i.e. considers roots of the TransientProcess
+ //! a name : a name of a variable DRAW
+ //!
+ //! Returns the count of designated Shapes. Their list is put in
+ //! <list>. If <list> is null, it is firstly created. Then it is
+ //! completed (Append without Clear) by the Shapes found
+ //! Returns 0 if no Shape could be found
+ Standard_EXPORT static Standard_Integer MoreShapes (const Handle(XSControl_WorkSession)& session, Handle(TopTools_HSequenceOfShape)& list, const Standard_CString name);
+
+ //! Analyses given file name and variable name, with a default
+ //! name for variables. Returns resulting file name and variable
+ //! name plus status "file to read"(True) or "already read"(False)
+ //! In the latter case, empty resfile means no file available
+ //!
+ //! If <file> is null or empty or equates ".", considers Session
+ //! and returned status is False
+ //! Else, returns resfile = file and status is True
+ //! If <var> is neither null nor empty, resvar = var
+ //! Else, the root part of <resfile> is considered, if defined
+ //! Else, <def> is taken
+ Standard_EXPORT static Standard_Boolean FileAndVar (const Handle(XSControl_WorkSession)& session, const Standard_CString file, const Standard_CString var, const Standard_CString def, TCollection_AsciiString& resfile, TCollection_AsciiString& resvar);
+};
+
+#endif // _XSDRAW_ShapeFunctions_HeaderFile
IMPLEMENT_STANDARD_RTTIEXT(XSDRAW_Vars,XSControl_Vars)
-XSDRAW_Vars::XSDRAW_Vars () { }
-
-void XSDRAW_Vars::Set
+void XSDRAW_Vars::Set
(const Standard_CString name,
const Handle(Standard_Transient)& val)
{
- //char* nam = name;
-// selon type
DeclareAndCast(Geom_Geometry,geom,val);
if (!geom.IsNull()) {
DrawTrSurf::Set(name,geom);
DrawTrSurf::Set(name,geom);
return;
}
-// ??
-}
-
-/*
-Handle(Standard_Transient) XSDRAW_Vars::Get (const Standard_CString name) const
-{
- Handle(Standard_Transient) val;
- if (!thevars->GetItem (name,val)) val.Nullify();
- return val;
}
-*/
Handle(Geom_Geometry) XSDRAW_Vars::GetGeom (Standard_CString& name) const
-{ //char* nam = name;
+{
return DrawTrSurf::Get(name);
}
Handle(Geom2d_Curve) XSDRAW_Vars::GetCurve2d (Standard_CString& name) const
-{ //char* nam = name;
+{
return DrawTrSurf::GetCurve2d(name);
}
Handle(Geom_Curve) XSDRAW_Vars::GetCurve (Standard_CString& name) const
-{ //char* nam = name;
+{
return DrawTrSurf::GetCurve(name);
}
Handle(Geom_Surface) XSDRAW_Vars::GetSurface (Standard_CString& name) const
-{ //char* nam = name;
+{
return DrawTrSurf::GetSurface(name);
}
void XSDRAW_Vars::SetPoint (const Standard_CString name, const gp_Pnt& val)
{
- //char* nam = name;
DrawTrSurf::Set (name, val);
}
Standard_Boolean XSDRAW_Vars::GetPoint (Standard_CString& name, gp_Pnt& pnt) const
-{ //char* nam = name;
- return DrawTrSurf::GetPoint (name,pnt); }
+{
+ return DrawTrSurf::GetPoint (name,pnt);
+}
void XSDRAW_Vars::SetPoint2d (const Standard_CString name, const gp_Pnt2d& val)
{
- //char* nam = name;
DrawTrSurf::Set (name, val);
}
Standard_Boolean XSDRAW_Vars::GetPoint2d (Standard_CString& name, gp_Pnt2d& pnt) const
{
- //char* nam = name;
- return DrawTrSurf::GetPoint2d (name,pnt); }
+ return DrawTrSurf::GetPoint2d (name,pnt);
+}
void XSDRAW_Vars::SetShape (const Standard_CString name, const TopoDS_Shape& val)
TopoDS_Shape XSDRAW_Vars::GetShape (Standard_CString& name) const
{
- //char* nam = name;
return DBRep::Get (name);
}
#include <Standard_Type.hxx>
#include <XSControl_Vars.hxx>
-#include <Standard_CString.hxx>
-#include <Standard_Boolean.hxx>
-class Standard_Transient;
class Geom_Geometry;
class Geom2d_Curve;
class Geom_Curve;
//! Vars for DRAW session (i.e. DBRep and DrawTrSurf)
class XSDRAW_Vars : public XSControl_Vars
{
-
-public:
-
-
- Standard_EXPORT XSDRAW_Vars();
+ public:
+ XSDRAW_Vars() {}
+
Standard_EXPORT virtual void Set (const Standard_CString name, const Handle(Standard_Transient)& val) Standard_OVERRIDE;
Standard_EXPORT virtual Handle(Geom_Geometry) GetGeom (Standard_CString& name) const Standard_OVERRIDE;
Standard_EXPORT virtual TopoDS_Shape GetShape (Standard_CString& name) const Standard_OVERRIDE;
-
-
-
DEFINE_STANDARD_RTTIEXT(XSDRAW_Vars,XSControl_Vars)
-
-protected:
-
-
-
-
-private:
-
-
-
-
};
-
-
-
-
-
-
#endif // _XSDRAW_Vars_HeaderFile
XSDRAWIGES.cxx
XSDRAWIGES.hxx
+XSDRAWIGES_Activator.cxx
+XSDRAWIGES_Activator.hxx
#include <DrawTrSurf.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
-#include <IFSelect_Functions.hxx>
-#include <IFSelect_SessionPilot.hxx>
#include <IGESControl_Controller.hxx>
#include <IGESControl_Reader.hxx>
#include <IGESControl_Writer.hxx>
#include <IGESData_IGESEntity.hxx>
#include <IGESData_IGESModel.hxx>
#include <IGESData_Protocol.hxx>
-#include <IGESSelect_Activator.hxx>
#include <IGESToBRep.hxx>
#include <IGESToBRep_Actor.hxx>
#include <IGESToBRep_Reader.hxx>
#include <Interface_Check.hxx>
#include <Interface_CheckIterator.hxx>
-#include <Interface_CheckTool.hxx>
#include <Interface_InterfaceModel.hxx>
#include <Interface_Macros.hxx>
#include <Interface_Static.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <Transfer_FinderProcess.hxx>
-#include <Transfer_IteratorOfProcessForTransient.hxx>
#include <Transfer_TransientProcess.hxx>
-#include <XSControl.hxx>
#include <XSControl_WorkSession.hxx>
#include <XSControl_TransferReader.hxx>
#include <XSDRAW.hxx>
#include <XSDRAW_Commands.hxx>
+#include <XSDRAW_SelectFunctions.hxx>
#include <XSDRAWIGES.hxx>
+#include <XSDRAWIGES_Activator.hxx>
#include <stdio.h>
// #include <IGESData_IGESWriter.hxx>
di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)\n";
di<<" To modify : command param read.iges.bspline.continuity\n";
Handle(XSControl_WorkSession) thesession = Reader.WS();
- thesession->ClearContext();
+ thesession->TransferReader()->Context().Nullify();
XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
progress->NewScope ( 80, "Translation" );
progress->Show();
di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)\n";
di<<" To modify : command param read.iges.bspline.continuity\n";
Handle(XSControl_WorkSession) thesession = Reader.WS();
- thesession->ClearContext();
+ thesession->TransferReader()->Context().Nullify();
XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
progress->NewScope ( 80, "Translation" );
progress->Show();
static Standard_Integer XSDRAWIGES_tplosttrim (Draw_Interpretor& di, Standard_Integer n, const char** a)
{
- Handle(IFSelect_SessionPilot) pilot = XSDRAW::Pilot();
-
Standard_Integer narg = n;
- const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
+ Handle(XSControl_WorkSession) WS = XSDRAW::Session();
+ const Handle(Transfer_TransientProcess) &TP = WS->TransferReader()->TransientProcess();
+
TColStd_Array1OfAsciiString strarg(1, 3);
TColStd_Array1OfAsciiString typarg(1, 3);
strarg.SetValue(1,"xst-type(CurveOnSurface)");
typarg.SetValue(3,"IGESSolid_Face");
if (TP.IsNull()) { di<<"No Transfer Read\n"; return 1; }
Standard_Integer nbFaces = 0, totFaces = 0 ;
- Handle(IFSelect_WorkSession) WS = pilot->Session();
- Transfer_IteratorOfProcessForTransient itrp = TP->AbnormalResult();
+ Transfer_TransientProcess::Iterator itrp = TP->AbnormalResult();
Standard_Integer k=0;
if(narg > 1) {
TCollection_AsciiString Arg(a[1]);
for(Standard_Integer j = 1 ; j <= 3; j++) {
TColStd_MapOfTransient aMap;
if(narg == 1) k=j;
- Handle(TColStd_HSequenceOfTransient) list = IFSelect_Functions::GiveList(pilot->Session(),strarg.Value(k).ToCString());
+ Handle(TColStd_HSequenceOfTransient) list = XSDRAW_SelectFunctions::GiveList(WS,strarg.Value(k).ToCString());
if (!list.IsNull()) itrp.Filter (list);
else {
di << "No untrimmed faces\n";
//--------------------------------------------------------------
static Standard_Integer XSDRAWIGES_TPSTAT(Draw_Interpretor& di,Standard_Integer n, const char** a)
{
- Handle(IFSelect_SessionPilot) pilot = XSDRAW::Pilot();
- Standard_Integer argc = n;//= pilot->NbWords();
- const Standard_CString arg1 = a[1];//pilot->Arg(1);
- const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
- IGESControl_Reader read; //(XSControl::Session(pilot),Standard_False);
+ Standard_Integer argc = n;
+ const Standard_CString arg1 = a[1];
+ const Handle(Transfer_TransientProcess) &TP = XSDRAW::Session()->TransferReader()->TransientProcess();
+
+ IGESControl_Reader read;
// **** tpent ****
Handle(Interface_InterfaceModel) model = TP->Model();
if (model.IsNull()) {di<<"No Transfer Read\n"; return -1;}
//
//--------------------------------------------------------------
-void XSDRAWIGES::InitSelect ()
+#include <IGESSelect_AutoCorrect.hxx>
+#include <IGESSelect_ComputeStatus.hxx>
+#include <IGESControl_FloatFormat.hxx>
+#include <IGESSelect_RemoveCurves.hxx>
+#include <IGESSelect_SetGlobalParameter.hxx>
+#include <IGESSelect_SetLabel.hxx>
+#include <IGESSelect_UpdateFileName.hxx>
+#include <IFSelect_SelectModelEntities.hxx>
+#include <IFSelect_SelectModelRoots.hxx>
+#include <XSControl_SelectForTransfer.hxx>
+#include <IGESSelect_SelectVisibleStatus.hxx>
+#include <IGESSelect_SelectSubordinate.hxx>
+#include <IGESSelect_SelectBypassGroup.hxx>
+#include <IGESSelect_SelectBypassSubfigure.hxx>
+#include <IGESSelect_SelectBasicGeom.hxx>
+#include <IGESSelect_SelectFaces.hxx>
+#include <IGESSelect_SelectPCurves.hxx>
+#include <IFSelect_SelectType.hxx>
+#include <IGESSelect_IGESTypeForm.hxx>
+#include <IGESSelect_SignStatus.hxx>
+#include <IFSelect_SignMultiple.hxx>
+#include <IFSelect_SignCounter.hxx>
+#include <IGESSelect_CounterOfLevelNumber.hxx>
+#include <IGESSelect_SignLevelNumber.hxx>
+#include <IGESSelect_IGESName.hxx>
+#include <IGESSelect_SignColor.hxx>
+#include <IGESBasic_SubfigureDef.hxx>
+#include <IFSelect_SignType.hxx>
+#include <IGESSelect_EditHeader.hxx>
+#include <IFSelect_EditForm.hxx>
+#include <IGESSelect_EditDirPart.hxx>
+#include <IGESSelect_Dumper.hxx>
+
+void XSDRAWIGES::InitSelect ()
{
- Handle(IGESSelect_Activator) igesact = new IGESSelect_Activator;
+ Handle(XSDRAWIGES_Activator) igesact = new XSDRAWIGES_Activator;
+
IGESControl_Controller::Init();
-// XSDRAW::SetNorm ("IGES"); trop tot
- XSDRAW::SetController (XSControl_Controller::Recorded("iges"));
+ Handle(XSControl_Controller) aCntl = XSControl_Controller::Recorded("iges");
+
+ static int gInit = 0;
+ if (!gInit) {
+ gInit = 1;
+ Handle(IGESSelect_Dumper) sesdump = new IGESSelect_Dumper; // ainsi,cestfait
+
+ aCntl->AddSessionItem (new IGESSelect_RemoveCurves(Standard_True) ,"iges-remove-pcurves");
+ aCntl->AddSessionItem (new IGESSelect_RemoveCurves(Standard_False),"iges-remove-curves-3d");
+ aCntl->AddSessionItem (new IGESSelect_SetLabel (0,Standard_True) ,"iges-clear-label");
+ aCntl->AddSessionItem (new IGESSelect_SetLabel (1,Standard_False),"iges-set-label-dnum");
+
+ aCntl->AddSessionItem (new IGESSelect_AutoCorrect,"iges-auto-correct",Standard_True);
+ aCntl->AddSessionItem (new IGESSelect_ComputeStatus,"iges-compute-status",Standard_True);
+
+ Handle(IGESControl_FloatFormat) flf = new IGESControl_FloatFormat;
+ flf->SetDefault (12);
+ aCntl->AddSessionItem (flf,"iges-float-digits-12",Standard_True);
+
+ // -- Sender Product Identification -- (pas un statique ...)
+ Handle(IGESSelect_SetGlobalParameter) set3 = new IGESSelect_SetGlobalParameter(3);
+ Handle(TCollection_HAsciiString) pa3 = Interface_Static::Static("write.iges.header.product")->HStringValue();
+ set3->SetValue(pa3);
+ aCntl->AddSessionItem (pa3, "iges-header-val-sender");
+ aCntl->AddSessionItem (set3,"iges-header-set-sender",Standard_True);
+
+ aCntl->AddSessionItem (new IGESSelect_UpdateFileName,"iges-update-file-name",Standard_True);
+
+ // -- Receiver -- Acces par Static, ajustable
+ Handle(IGESSelect_SetGlobalParameter) set12 = new IGESSelect_SetGlobalParameter(12);
+ Handle(TCollection_HAsciiString) pa12 = Interface_Static::Static("write.iges.header.receiver")->HStringValue();
+ set12->SetValue(pa12);
+ aCntl->AddSessionItem (pa12, "iges-header-val-receiver");
+ aCntl->AddSessionItem (set12,"iges-header-set-receiver",Standard_True);
+
+ // -- Auteur -- acces par Static (demarre par whoami), ajustable
+ Handle(IGESSelect_SetGlobalParameter) set21 = new IGESSelect_SetGlobalParameter(21);
+ Handle(TCollection_HAsciiString) pa21 = Interface_Static::Static("write.iges.header.author")->HStringValue();
+ set21->SetValue(pa21);
+ aCntl->AddSessionItem (pa21, "iges-header-val-author");
+ aCntl->AddSessionItem (set21,"iges-header-set-author",Standard_True);
+
+ // -- Compagnie (de l auteur) -- acces par Static, ajustable
+ Handle(IGESSelect_SetGlobalParameter) set22 = new IGESSelect_SetGlobalParameter(22);
+ Handle(TCollection_HAsciiString) pa22 = Interface_Static::Static("write.iges.header.company")->HStringValue();
+ set22->SetValue(pa22);
+ aCntl->AddSessionItem (pa22, "iges-header-val-company");
+ aCntl->AddSessionItem (set22,"iges-header-set-company",Standard_True);
+ }
+
+ XSDRAW::SetController (aCntl);
+
+ Handle(XSControl_WorkSession) WS = XSDRAW::Session();
+
+ // --- 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);
+
+ WS->SetSignType( typnam );
+ }
+
atexit (cleanpilot);
}
--- /dev/null
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#include <XSDRAWIGES_Activator.hxx>
+
+#include <IFSelect_IntParam.hxx>
+#include <IFSelect_PacketList.hxx>
+#include <IFSelect_SelectSignature.hxx>
+#include <IFSelect_SessionPilot.hxx>
+#include <IFSelect_WorkSession.hxx>
+#include <IGESData_IGESEntity.hxx>
+#include <IGESData_IGESModel.hxx>
+#include <IGESData_Protocol.hxx>
+#include <IGESSelect_AddGroup.hxx>
+#include <IGESSelect_AutoCorrect.hxx>
+#include <IGESSelect_ComputeStatus.hxx>
+#include <IGESSelect_DispPerDrawing.hxx>
+#include <IGESSelect_DispPerSingleView.hxx>
+#include <IGESControl_FloatFormat.hxx>
+#include <IGESSelect_IGESTypeForm.hxx>
+#include <IGESSelect_RebuildDrawings.hxx>
+#include <IGESSelect_RebuildGroups.hxx>
+#include <IGESSelect_SelectBypassGroup.hxx>
+#include <IGESSelect_SelectDrawingFrom.hxx>
+#include <IGESSelect_SelectFromDrawing.hxx>
+#include <IGESSelect_SelectFromSingleView.hxx>
+#include <IGESSelect_SelectLevelNumber.hxx>
+#include <IGESSelect_SelectName.hxx>
+#include <IGESSelect_SelectSingleViewFrom.hxx>
+#include <IGESSelect_SelectVisibleStatus.hxx>
+#include <IGESSelect_SetGlobalParameter.hxx>
+#include <IGESSelect_SetVersion5.hxx>
+#include <IGESSelect_SplineToBSpline.hxx>
+#include <IGESSelect_UpdateCreationDate.hxx>
+#include <IGESSelect_UpdateFileName.hxx>
+#include <IGESSelect_UpdateLastChange.hxx>
+#include <IGESSelect_ViewSorter.hxx>
+#include <Interface_EntityIterator.hxx>
+#include <Interface_Macros.hxx>
+#include <Standard_ErrorHandler.hxx>
+#include <Standard_Failure.hxx>
+#include <Standard_Type.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+
+#include <stdio.h>
+IMPLEMENT_STANDARD_RTTIEXT(XSDRAWIGES_Activator,IFSelect_Activator)
+
+XSDRAWIGES_Activator::XSDRAWIGES_Activator ()
+{
+ static int initActivator = 0;
+ if (initActivator) return; initActivator = 1;
+
+ SetForGroup ("XSTEP-IGES");
+
+ Add ( 5,"listviews");
+ Add ( 6,"listdrawings");
+ Add ( 7,"listsviews");
+
+ AddSet (10,"igestype");
+ AddSet (11,"bypassgroup");
+ AddSet (12,"igesname");
+ AddSet (13,"igesvisible");
+ AddSet (14,"igeslevel");
+
+ AddSet (21,"igesfromdrawing");
+ AddSet (22,"igesfromview");
+ AddSet (23,"igesdrawingfrom");
+ AddSet (24,"igesviewfrom");
+
+ AddSet (31,"igesdispdrawing");
+ AddSet (32,"igesdispview");
+
+ AddSet (40,"floatformat");
+ AddSet (41,"setglobalparam");
+ AddSet (42,"setversion5");
+ AddSet (43,"updatecreationdate");
+ AddSet (44,"updatelastchange");
+ AddSet (45,"updatefilename");
+
+ AddSet (50,"autocorrect");
+ AddSet (51,"computestatus");
+ AddSet (52,"rebuildgroups");
+ AddSet (53,"rebuilddrawings");
+ AddSet (54,"addgroup");
+
+ AddSet (60,"splinetobspline");
+
+ Add (70,"setuseflag");
+}
+
+
+IFSelect_ReturnStatus XSDRAWIGES_Activator::Do (const Standard_Integer number, const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Word(1).ToCString();
+ const Standard_CString arg2 = pilot->Word(2).ToCString();
+ const Handle(IFSelect_WorkSession) &WS = pilot->Session();
+
+ switch (number) {
+
+ case 5 : // **** ListViews (sans tri complementaire)
+ case 6 : // **** ListDrawings
+ case 7 : { // **** ListS(ingle)Views
+ Standard_Integer listmode = 0;
+ if (argc == 2 && arg1[0] == '?') argc = -1;
+ if (argc < 2) {
+ cout<<"Ajouter un argument pour avoir :\n"<<
+ " l : liste resumee"<<
+ " c : liste complete par item (mais pas pour remaining)\n"<<
+ " r : idem + liste complete remaining\n"<<
+ " sur tout le modele. Ajouter nom selection pour lister sur une partie"<<endl;
+ return (argc >= 0 ? IFSelect_RetError : IFSelect_RetVoid);
+ }
+ if (arg1[0] == 'l') {
+ listmode = 0; cout<<"Liste resumee";
+ }
+ else if (arg1[0] == 'c') {
+ listmode = 1; cout<<"Liste complete par item (pas pour Remaining)"<<endl;
+ }
+ else if (arg1[0] == 'r') {
+ listmode = 2; cout<<"Liste complete par item et pour Remaining"<<endl;
+ }
+ else {
+ cout<<"Parametre de listage non compris"<<endl; return IFSelect_RetError;
+ }
+
+ Handle(IGESSelect_ViewSorter) vs = new IGESSelect_ViewSorter;
+ vs->SetModel(GetCasted(IGESData_IGESModel,WS->Model()));
+ if (argc == 2) vs->AddModel(WS->Model());
+ else {
+// on demande une selection
+ DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg2));
+ if (sel.IsNull()) {
+ cout<<"Pas une selection : "<<arg2<<endl;
+ return IFSelect_RetError;
+ }
+ vs->AddList (WS->SelectionResult(sel));
+ }
+ Standard_Boolean listdr = (number > 5);
+ if (number == 6) vs->SortDrawings(WS->Graph());
+ if (number == 7) vs->SortSingleViews(Standard_True);
+ Handle(IFSelect_PacketList) sets = vs->Sets(listdr);
+ Standard_Integer nb = vs->NbSets(listdr);
+ cout<<" -- ViewSorter for";
+ if (number == 5) cout<<" Views & Drawings";
+ if (number == 6) cout<<" Drawings only (complete)";
+ if (number == 7) cout<<" Single Views & Drawing Frames";
+ cout<<", on "<<vs->NbEntities()<<" ent.s, give "<<nb<<" Sets"<<endl;
+
+ Interface_EntityIterator iter;
+ for (Standard_Integer i = 1; i <= nb; i ++) {
+ cout<<" -- Set n0 "<<i<<" Item=entity n0: "<<
+ WS->Model()->Number(vs->SetItem(i,listdr))<<" List:";
+ cout<<sets->NbEntities(i)<<" ent.s:"<<endl;
+ if (listmode == 0) continue;
+ iter = sets->Entities(i);
+ WS->ListEntities (iter,0);
+ }
+
+ cout <<" -- Remaining Entities (not yet sorted) :"
+ <<sets->NbDuplicated(0,Standard_False)<<endl;
+ if (listmode < 2) return IFSelect_RetVoid;
+ iter = sets->Duplicated(0,Standard_False);
+ WS->ListEntities(iter,0);
+ return IFSelect_RetVoid;
+ }
+
+ case 10 : { // **** IGESType (form Type/Form)
+ if (argc < 2) {
+ cout<<"Donner le n0 de type desire, + en option la forme\n"
+ <<" Si pas de forme, prend toutes les formes du type demande"<<endl;
+ return IFSelect_RetError;
+ }
+ char signature[20];
+ if (argc == 2) sprintf(signature,"%s",arg1);
+ else sprintf(signature,"%s %s",arg1,arg2);
+ Handle(IFSelect_SelectSignature) sel = new IFSelect_SelectSignature
+ (new IGESSelect_IGESTypeForm, signature,(argc > 2));
+ return pilot->RecordItem (sel);
+ }
+
+ case 11 : { // **** IGES BypassGroup
+ return pilot->RecordItem (new IGESSelect_SelectBypassGroup);
+ }
+
+ case 12 : { // **** IGES Name
+ if (argc < 2) {
+ cout<<"Donner un Nom de TextParam pour IGESName"<<endl;
+ return IFSelect_RetError;
+ }
+ Handle(IGESSelect_SelectName) sel = new IGESSelect_SelectName;
+ sel->SetName
+ (GetCasted(TCollection_HAsciiString,WS->NamedItem(arg1)) );
+ return pilot->RecordItem (sel);
+ }
+
+ case 13 : { // **** IGES VisibleStatus
+ return pilot->RecordItem (new IGESSelect_SelectVisibleStatus);
+ }
+
+ case 14 : { // **** IGES LevelNumber
+ if (argc < 2) {
+ cout<<"Donner nom IntParam pour Level"<<endl;
+ return IFSelect_RetError;
+ }
+ DeclareAndCast(IFSelect_IntParam,lev,WS->NamedItem(arg1));
+ if (lev.IsNull()) {
+ cout<<arg1<<" : pas un IntParam (pour Level)"<<endl;
+ return IFSelect_RetError;
+ }
+ Handle(IGESSelect_SelectLevelNumber) sel = new IGESSelect_SelectLevelNumber;
+ sel->SetLevelNumber(lev);
+ return pilot->RecordItem (sel);
+ }
+
+ case 21 : { // **** IGES FromDrawing
+ return pilot->RecordItem (new IGESSelect_SelectFromDrawing);
+ }
+ case 22 : { // **** IGES FromSingleView
+ return pilot->RecordItem (new IGESSelect_SelectFromSingleView);
+ }
+ case 23 : { // **** IGES FromDrawing
+ return pilot->RecordItem (new IGESSelect_SelectDrawingFrom);
+ }
+ case 24 : { // **** IGES FromDrawing
+ return pilot->RecordItem (new IGESSelect_SelectSingleViewFrom);
+ }
+
+ case 31 : { // **** IGES DispatchPerDrawing
+ return pilot->RecordItem (new IGESSelect_DispPerDrawing);
+ }
+ case 32 : { // **** IGES DispatchPerSingleView
+ return pilot->RecordItem (new IGESSelect_DispPerSingleView);
+ }
+
+ case 40 : { // **** FloatFormat
+ char prem = ' ';
+ if (argc < 2) prem = '?';
+ else if (argc == 5) {
+ cout<<"floatformat tout court donne les formes admises"<<endl;
+ return IFSelect_RetError;
+ }
+ else prem = arg1[0];
+ Standard_Boolean zerosup=Standard_False;
+ Standard_Integer digits = 0;
+ if (prem == 'N' || prem == 'n') zerosup = Standard_False;
+ else if (prem == 'Z' || prem == 'z') zerosup = Standard_True;
+ else if (prem >= 48 && prem <= 57) digits = atoi(arg1);
+ else {
+ cout<<"floatformat digits, digits=nb de chiffres signifiants, ou\n"
+ << "floatformat NZ %mainformat [%rangeformat [Rmin Rmax]]\n"
+ <<" NZ : N ou n pour Non-zero-suppress, Z ou z pour zero-suppress\n"
+ <<" %mainformat : format principal type printf, ex,: %E\n"
+ <<" + optionnel : format secondaire (flottants autour de 1.) :\n"
+ <<" %rangeformat Rmin Rmax : format type printf entre Rmin et Rmax\n"
+ <<" %rangeformat tout seul : format type printf entre 0.1 et 1000.\n"
+ <<flush;
+ return (prem == '?' ? IFSelect_RetVoid : IFSelect_RetError);
+ }
+ Standard_Real Rmin=0., Rmax=0.;
+ if (argc > 4) {
+ Rmin = Atof(pilot->Word(4).ToCString());
+ Rmax = Atof(pilot->Word(5).ToCString());
+ if (Rmin <= 0 || Rmax <= 0) { cout<<"intervalle : donner reels > 0"<<endl; return IFSelect_RetError; }
+ }
+ Handle(IGESControl_FloatFormat) fm = new IGESControl_FloatFormat;
+ if (argc == 2) fm->SetDefault(digits);
+ else {
+ fm->SetZeroSuppress(zerosup);
+ fm->SetFormat (arg2);
+ if (argc == 4) fm->SetFormatForRange(pilot->Word(3).ToCString());
+ else if (argc >= 6) fm->SetFormatForRange(pilot->Word(3).ToCString(),Rmin,Rmax);
+ else fm->SetFormatForRange("");
+ }
+ return pilot->RecordItem(fm);
+ }
+
+ case 41 : { // **** SetGlobalParameter
+ if (argc < 3) {
+ cout<<"Donner entier=n0 param a changer + nom TextParam pour la valeur"<<endl;
+ return IFSelect_RetError;
+ }
+ Standard_Integer numpar = atoi(arg1);
+ if (numpar <= 0) {
+ cout<<"Pas un n0 de param global correct:"<<arg1<<endl;
+ return IFSelect_RetError;
+ }
+ DeclareAndCast(TCollection_HAsciiString,val,WS->NamedItem(arg2));
+ if (val.IsNull()) {
+ cout<<"Pas un nom de TextParam:"<<arg2<<endl;
+ return IFSelect_RetError;
+ }
+ Handle(IGESSelect_SetGlobalParameter) mod =
+ new IGESSelect_SetGlobalParameter(numpar);
+ mod->SetValue(val);
+ return pilot->RecordItem (mod);
+ }
+
+ case 42 : { // **** Set IGES Version 5.1
+ return pilot->RecordItem (new IGESSelect_SetVersion5);
+ }
+ case 43 : { // **** Update Creation Date
+ return pilot->RecordItem (new IGESSelect_UpdateCreationDate);
+ }
+ case 44 : { // **** Update Last Change Date
+ return pilot->RecordItem (new IGESSelect_UpdateLastChange);
+ }
+ case 45 : { // **** Update File Name
+ return pilot->RecordItem (new IGESSelect_UpdateFileName);
+ }
+
+ case 50 : { // **** AutoCorrect
+ return pilot->RecordItem (new IGESSelect_AutoCorrect);
+ }
+ case 51 : { // **** Compute Status
+ return pilot->RecordItem (new IGESSelect_ComputeStatus);
+ }
+ case 52 : { // **** Rebuild Groups
+ return pilot->RecordItem (new IGESSelect_RebuildGroups);
+ }
+ case 53 : { // **** Rebuild Drawings
+ return pilot->RecordItem (new IGESSelect_RebuildDrawings);
+ }
+ case 54 : { // **** Add Group
+ return pilot->RecordItem (new IGESSelect_AddGroup);
+ }
+
+ case 60 : { // **** Spline To BSpline
+ if (argc < 2) {
+ cout<<"Pour SplineToBSpline, donner mode :\n"<<
+ " n pour normal, t pour tryC2"<<endl;
+ return IFSelect_RetError;
+ }
+ Standard_Boolean tryC2;
+ if (arg1[0] == 'n' || arg1[0] == 'N')
+ tryC2 = Standard_False;
+ else if (arg1[0] == 't' || arg1[0] == 'T')
+ tryC2 = Standard_True;
+ else {
+ cout<<" Mode incorrect : "<<arg1<<endl;
+ return IFSelect_RetError;
+ }
+ Handle(IGESSelect_SplineToBSpline) conv =
+ new IGESSelect_SplineToBSpline (tryC2);
+ return pilot->RecordItem(conv);
+ }
+
+ case 70 : { // **** SetUseFlag
+ Standard_Integer usefl = atoi (arg1);
+ if (argc > 2) {
+ Handle(TColStd_HSequenceOfTransient) list = WS->GiveList(pilot->CommandPart(2));
+ Standard_Integer i, nb = list->Length();
+ for (i = 1; i <= nb; i ++) {
+ DeclareAndCast(IGESData_IGESEntity,ent,list->Value(i));
+ if (!ent.IsNull()) ent->InitStatus
+ (ent->BlankStatus(),ent->SubordinateStatus(),usefl,ent->HierarchyStatus());
+ }
+ }
+ else {
+ Standard_Integer i, nb = WS->NbStartingEntities();
+ for (i = 1; i <= nb; i ++) {
+ DeclareAndCast(IGESData_IGESEntity,ent,WS->StartingEntity(i));
+ if (!ent.IsNull()) ent->InitStatus
+ (ent->BlankStatus(),ent->SubordinateStatus(),usefl,ent->HierarchyStatus());
+ }
+ }
+ return IFSelect_RetDone;
+ }
+
+ default : break;
+ }
+ return IFSelect_RetVoid;
+
+}
+
+Standard_CString XSDRAWIGES_Activator::Help (const Standard_Integer number) const
+{
+ switch (number) {
+ case 5 : return "Liste Vues (tous types). Nom selection sinon tout modele";
+ case 6 : return "Liste Drawings. Nom selection sinon tout modele";
+ case 7 : return "Liste Vues SIMPLES. Nom selection sinon tout modele";
+
+ case 10 : return "type:integer [form:integer] : cree Select IGESType";
+ case 11 : return "cree Select Bypass Group";
+ case 12 : return "name:TextParam : cree Select Name (Name/Label)";
+ case 13 : return "cree Select Visible Status (Blank Status = 0 sinon 1)";
+ case 14 : return "level:IntParam : cree Select LevelNumber";
+
+ case 21 : return "cree Select From Drawing";
+ case 22 : return "cree Select From Single View";
+ case 23 : return "cree Select Drawing From, drawing(s) pour une liste d entites";
+ case 24 : return "cree Select View From, views pour une liste d entites";
+
+ case 31 : return "cree Dispatch Per Drawing";
+ case 32 : return "cree Dispatch Per SingleView";
+
+ case 40 : return "options... : cree FloatFormat ... floatformat tout court->help";
+ case 41 : return "numpar:integer value:TextParam : cree Set Global Param";
+ case 42 : return "cree Set Version -> 5.1";
+ case 43 : return "cree Update Creation Date";
+ case 44 : return "cree Update Last Change Date";
+ case 45 : return "cree Update File Name (dynamic)";
+
+ case 50 : return "cree AutoCorrect";
+ case 51 : return "cree Compute Status (in D.E.)";
+ case 52 : return "cree Rebuild Groups";
+ case 53 : return "cree Rebuild Drawings";
+ case 54 : return "cree AddGroup";
+
+ case 60 : return "cree SplineToBSpline Conversion";
+
+ case 70 : return "useflag givelist : Set Use Flag to value";
+
+ default : break;
+ }
+ return "??";
+}
--- /dev/null
+// Created on: 1994-06-03
+// Created by: Christian CAILLET
+// Copyright (c) 1994-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _XSDRAWIGES_Activator_HeaderFile
+#define _XSDRAWIGES_Activator_HeaderFile
+
+#include <IFSelect_Activator.hxx>
+
+//! Performs Actions specific to IGESSelect, i.e. creation of
+//! IGES Selections and Dispatches, plus dumping specific to IGES
+class XSDRAWIGES_Activator : public IFSelect_Activator
+{
+ public:
+
+ Standard_EXPORT XSDRAWIGES_Activator();
+
+ //! Executes a Command Line for IGESSelect
+ Standard_EXPORT IFSelect_ReturnStatus Do (const Standard_Integer number, const Handle(IFSelect_SessionPilot)& pilot) Standard_OVERRIDE;
+
+ //! Sends a short help message for IGESSelect commands
+ Standard_EXPORT Standard_CString Help (const Standard_Integer number) const Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT(XSDRAWIGES_Activator,IFSelect_Activator)
+};
+
+#endif // _XSDRAWIGES_Activator_HeaderFile
XSDRAWSTEP.cxx
XSDRAWSTEP.hxx
+XSDRAWSTEP_Activator.cxx
+XSDRAWSTEP_Activator.hxx
#include <STEPControl_Writer.hxx>
#include <StepData_StepModel.hxx>
#include <StepGeom_Axis2Placement3d.hxx>
-#include <StepSelect_Activator.hxx>
#include <STEPSelections_AssemblyExplorer.hxx>
#include <STEPSelections_Counter.hxx>
#include <StepShape_ShapeRepresentation.hxx>
#include <XSControl_WorkSession.hxx>
#include <XSDRAW.hxx>
#include <XSDRAWSTEP.hxx>
+#include <XSDRAWSTEP_Activator.hxx>
#include <stdio.h>
// Pour le transfert (write)
//purpose :
//=======================================================================
+#include <IFSelect_Selection.hxx>
+#include <IFSelect_SignCounter.hxx>
+#include <IFSelect_SignAncestor.hxx>
+#include <IFSelect_SelectSignature.hxx>
+#include <IFSelect_SelectModelEntities.hxx>
+#include <IFSelect_SelectModelRoots.hxx>
+#include <IFSelect_EditForm.hxx>
+#include <StepAP214.hxx>
+#include <StepAP214_Protocol.hxx>
+#include <STEPSelections_SelectDerived.hxx>
+#include <STEPSelections_SelectFaces.hxx>
+#include <STEPSelections_SelectInstances.hxx>
+#include <STEPSelections_SelectGSCurves.hxx>
+#include <STEPSelections_SelectAssembly.hxx>
+#include <STEPSelections_SelectForTransfer.hxx>
+#include <APIHeaderSection_EditHeader.hxx>
+#include <STEPEdit_EditContext.hxx>
+#include <STEPEdit_EditSDR.hxx>
+
+//! Returns a SignType fit for STEP (creates the first time)
+static Handle(IFSelect_Signature) SignType()
+{
+ static Handle(StepSelect_StepType) sty;
+ if (!sty.IsNull()) return sty;
+ sty = new StepSelect_StepType;
+ sty->SetProtocol (StepAP214::Protocol());
+ return sty;
+}
+
+//! Creates a Selection for ShapeDefinitionRepresentation
+//! By default searches among root entities
+static Handle(IFSelect_SelectSignature) NewSelectSDR()
+{
+ Handle(IFSelect_SelectSignature) sel = new IFSelect_SelectSignature
+ (SignType(),"SHAPE_DEFINITION_REPRESENTATION");
+ sel->SetInput (new IFSelect_SelectModelRoots);
+ return sel;
+}
+
+//! Creates a Selection for Placed Items, i.e. MappedItem or
+//! ContextDependentShapeRepresentation, which itself refers to a
+//! RepresentationRelationship with possible subtypes (Shape...
+//! and/or ...WithTransformation)
+//! By default in the whole StepModel
+static Handle(IFSelect_SelectSignature) NewSelectPlacedItem()
+{
+ Handle(IFSelect_SelectSignature) sel = new IFSelect_SelectSignature
+ (SignType(),"MAPPED_ITEM|CONTEXT_DEPENDENT_SHAPE_REPRESENTATION",Standard_False);
+ sel->SetInput (new IFSelect_SelectModelEntities);
+ return sel;
+}
+
+//! Creates a Selection for ShapeRepresentation and its sub-types,
+//! plus ContextDependentShapeRepresentation (which is not a
+//! sub-type of ShapeRepresentation)
+//! By default in the whole StepModel
+static Handle(IFSelect_SelectSignature) NewSelectShapeRepr()
+{
+ Handle(IFSelect_SelectSignature) sel = new IFSelect_SelectSignature
+ (SignType(),"SHAPE_REPRESENTATION",Standard_False);
+ // REPRESENTATION_RELATIONSHIP passe par CONTEXT_DEPENDENT_SHAPE_REPRESENTATION
+ sel->SetInput (new IFSelect_SelectModelEntities);
+ return sel;
+}
+
void XSDRAWSTEP::Init ()
{
- Handle(StepSelect_Activator) stepact = new StepSelect_Activator;
- if (STEPControl_Controller::Init()) // XSDRAW::SetNorm("STEP AP-214"); trop tot
- XSDRAW::SetController(XSControl_Controller::Recorded("STEP"));
+ Handle(XSDRAWSTEP_Activator) stepact = new XSDRAWSTEP_Activator;
+
+ STEPControl_Controller::Init();
+ Handle(XSControl_Controller) aCntl = XSControl_Controller::Recorded("STEP");
+
+ static int gInit = 0;
+ if (!gInit) {
+ gInit = 1;
+
+ // --- SELECTIONS, SIGNATURES, COMPTEURS, EDITEURS
+ DeclareAndCast(IFSelect_Selection,xmr,aCntl->SessionItem("xst-model-roots"));
+ if (!xmr.IsNull()) {
+ Handle(IFSelect_Signature) sty = SignType();
+ aCntl->AddSessionItem (sty,"step-type");
+ Handle(IFSelect_SignCounter) tys = new IFSelect_SignCounter(sty,Standard_False,Standard_True);
+ aCntl->AddSessionItem (tys,"step-types");
+
+ //pdn S4133 18.02.99
+ aCntl->AddSessionItem (new IFSelect_SignAncestor(),"xst-derived");
+
+ Handle(STEPSelections_SelectDerived) stdvar = new STEPSelections_SelectDerived();
+ stdvar->SetProtocol(StepAP214::Protocol());
+ aCntl->AddSessionItem (stdvar,"step-derived");
+
+ Handle(IFSelect_SelectSignature) selsdr = NewSelectSDR();
+ selsdr->SetInput (xmr);
+ aCntl->AddSessionItem (selsdr,"step-shape-def-repr");
+
+ aCntl->AddSessionItem (NewSelectPlacedItem(),"step-placed-items");
+ // input deja pret avec ModelAll
+ aCntl->AddSessionItem (NewSelectShapeRepr(),"step-shape-repr");
+ }
+
+ //pdn
+ Handle(STEPSelections_SelectFaces) stfaces = new STEPSelections_SelectFaces;
+ stfaces->SetInput (xmr);
+ aCntl->AddSessionItem (stfaces,"step-faces");
+
+ Handle(STEPSelections_SelectInstances) stinst = new STEPSelections_SelectInstances;
+ aCntl->AddSessionItem (stinst,"step-instances");
+ Handle(STEPSelections_SelectGSCurves) stcurves = new STEPSelections_SelectGSCurves;
+ stcurves->SetInput (xmr);
+ aCntl->AddSessionItem (stcurves,"step-GS-curves");
+
+ Handle(STEPSelections_SelectAssembly) assembly = new STEPSelections_SelectAssembly;
+ assembly->SetInput (xmr);
+ aCntl->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");
+ aCntl->AddSessionItem (edhead,"step-header-edit");
+ aCntl->AddSessionItem (edheadf,"step-header");
+
+ Handle(STEPEdit_EditContext) edctx = new STEPEdit_EditContext;
+ Handle(IFSelect_EditForm) edctxf = new IFSelect_EditForm (edctx,Standard_False,Standard_True,"STEP Product Definition Context");
+ aCntl->AddSessionItem (edctx,"step-context-edit");
+ aCntl->AddSessionItem (edctxf,"step-context");
+
+ Handle(STEPEdit_EditSDR) edsdr = new STEPEdit_EditSDR;
+ Handle(IFSelect_EditForm) edsdrf = new IFSelect_EditForm (edsdr,Standard_False,Standard_True,"STEP Product Data (SDR)");
+ aCntl->AddSessionItem (edsdr,"step-SDR-edit");
+ aCntl->AddSessionItem (edsdrf,"step-SDR-data");
+ }
+
+ XSDRAW::SetController(aCntl);
+
+ Handle(XSControl_WorkSession) WS = XSDRAW::Session();
+
+ 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 = 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(StepAP214::Protocol());
+ WS->AddNamedItem ("step-derived",stdvar);
+
+ Handle(IFSelect_SelectSignature) selsdr = NewSelectSDR();
+ selsdr->SetInput (slr);
+ WS->AddNamedItem ("step-shape-def-repr",selsdr);
+ Handle(IFSelect_SelectSignature) selrrs = NewSelectPlacedItem();
+ WS->AddNamedItem ("step-placed-items",selrrs);
+ Handle(IFSelect_SelectSignature) selsr = 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);
+
atexit (cleanpilot);
}
--- /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_SessionPilot.hxx>
+#include <IFSelect_WorkSession.hxx>
+#include <Interface_Macros.hxx>
+#include <Standard_ErrorHandler.hxx>
+#include <Standard_Failure.hxx>
+#include <Standard_Type.hxx>
+#include <StepData_Plex.hxx>
+#include <StepData_Simple.hxx>
+#include <StepData_UndefinedEntity.hxx>
+#include <STEPControl_FloatFormat.hxx>
+#include <XSDRAWSTEP_Activator.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(XSDRAWSTEP_Activator,IFSelect_Activator)
+
+XSDRAWSTEP_Activator::XSDRAWSTEP_Activator ()
+{
+ static int initActivator = 0;
+ if (initActivator) return; initActivator = 1;
+// Add ( 0,"load");
+// Add ( 0,"loadstep"); // homonyme
+// Add ( 1,"entity");
+// Add ( 2,"liststep");
+
+// AddSet (10,"steptype");
+
+ Add ( 1,"stepschema");
+ AddSet (40,"floatformat");
+}
+
+
+IFSelect_ReturnStatus XSDRAWSTEP_Activator::Do
+ (const Standard_Integer number,
+ const Handle(IFSelect_SessionPilot)& pilot)
+{
+ Standard_Integer argc = pilot->NbWords();
+ const Standard_CString arg1 = pilot->Word(1).ToCString();
+ const Standard_CString arg2 = pilot->Word(2).ToCString();
+// const Standard_CString arg3 = pilot->Word(3).ToCString();
+
+ switch (number) {
+
+ case 1 : { // **** StepSchema
+ if (argc < 2) {
+ cout<<"Identify an entity"<<endl;
+ return IFSelect_RetError;
+ }
+ Standard_Integer num = pilot->Number(arg1);
+ if (num <= 0) {
+ cout<<"Not an entity : "<<arg2<<endl;
+ return IFSelect_RetError;
+ }
+ Handle(Standard_Transient) ent = pilot->Session()->StartingEntity(num);
+ DeclareAndCast(StepData_UndefinedEntity,und,ent);
+ if (!und.IsNull()) {
+ cout<<"Entity "<<arg2<<" : No Binding known"<<endl;
+ return IFSelect_RetVoid;
+ }
+ DeclareAndCast(StepData_Simple,sim,ent);
+ if (!sim.IsNull()) {
+ cout<<"Entity "<<arg2<<" : Late Binding"<<endl;
+ cout<<"Simple Type : "<<sim->StepType()<<endl;
+ return IFSelect_RetVoid;
+ }
+ DeclareAndCast(StepData_Plex,plx,ent);
+ if (!plx.IsNull()) {
+ cout<<"Entity "<<arg2<<" : Late Binding"<<endl;
+ cout<<"Complex Type"<<endl;
+ }
+// reste Early Binding
+ cout<<"Entity "<<arg2<<" : Early Binding"<<endl;
+ cout<<"CDL Type : "<<ent->DynamicType()->Name()<<endl;
+ return IFSelect_RetVoid;
+ }
+
+ case 40 : { // **** FloatFormat
+ char prem = ' ';
+ if (argc < 2) prem = '?';
+ else if (argc == 5) { cout<<"floatformat tout court donne les formes admises"<<endl; return IFSelect_RetError; }
+ else prem = arg1[0];
+ Standard_Boolean zerosup=Standard_False;
+ Standard_Integer digits = 0;
+ if (prem == 'N' || prem == 'n') zerosup = Standard_False;
+ else if (prem == 'Z' || prem == 'z') zerosup = Standard_True;
+ else if (prem >= 48 && prem <= 57) digits = atoi(arg1);
+ else {
+ cout<<"floatformat digits, digits=nb de chiffres signifiants, ou\n"
+ << "floatformat NZ %mainformat [%rangeformat [Rmin Rmax]]\n"
+ <<" NZ : N ou n pour Non-zero-suppress, Z ou z pour zero-suppress\n"
+ <<" %mainformat : format principal type printf, ex,: %E\n"
+ <<" + optionnel : format secondaire (flottants autour de 1.) :\n"
+ <<" %rangeformat Rmin Rmax : format type printf entre Rmin et Rmax\n"
+ <<" %rangeformat tout seul : format type printf entre 0.1 et 1000.\n"
+ <<flush;
+ return (prem == '?' ? IFSelect_RetVoid : IFSelect_RetError);
+ }
+ Standard_Real Rmin=0., Rmax=0.;
+ if (argc > 4) {
+ Rmin = Atof(pilot->Word(4).ToCString());
+ Rmax = Atof(pilot->Word(5).ToCString());
+ if (Rmin <= 0 || Rmax <= 0) { cout<<"intervalle : donner reels > 0"<<endl; return IFSelect_RetError; }
+ }
+ Handle(STEPControl_FloatFormat) fm = new STEPControl_FloatFormat;
+ if (argc == 2) fm->SetDefault(digits);
+ else {
+ fm->SetZeroSuppress(zerosup);
+ fm->SetFormat (arg2);
+ if (argc == 4) fm->SetFormatForRange(pilot->Word(3).ToCString());
+ else if (argc >= 6) fm->SetFormatForRange(pilot->Word(3).ToCString(),Rmin,Rmax);
+ else fm->SetFormatForRange("");
+ }
+ return pilot->RecordItem(fm);
+ }
+
+ default : break;
+ }
+ return IFSelect_RetVoid;
+
+}
+
+
+Standard_CString XSDRAWSTEP_Activator::Help
+ (const Standard_Integer number) const
+{
+ switch (number) {
+
+ case 40 : return "options... : cree FloatFormat ... floatformat tout court->help";
+ default : break;
+ }
+ return "";
+}
--- /dev/null
+// Created on: 1995-04-20
+// 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 _XSDRAWSTEP_Activator_HeaderFile
+#define _XSDRAWSTEP_Activator_HeaderFile
+
+#include <IFSelect_Activator.hxx>
+
+//! Performs Actions specific to StepSelect, i.e. creation of
+//! Step Selections and Counters, plus dumping specific to Step
+class XSDRAWSTEP_Activator : public IFSelect_Activator
+{
+ public:
+
+ Standard_EXPORT XSDRAWSTEP_Activator();
+
+ //! Executes a Command Line for StepSelect
+ Standard_EXPORT IFSelect_ReturnStatus Do (const Standard_Integer number, const Handle(IFSelect_SessionPilot)& pilot) Standard_OVERRIDE;
+
+ //! Sends a short help message for StepSelect commands
+ Standard_EXPORT Standard_CString Help (const Standard_Integer number) const Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT(XSDRAWSTEP_Activator,IFSelect_Activator)
+};
+
+#endif // _XSDRAWSTEP_Activator_HeaderFile