mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0022807: Loading of STEP entities in model during reading of STEP file requires redundant memory
This commit is contained in:
@@ -25,16 +25,28 @@ uses CString, HSequenceOfAsciiString from TColStd,
|
||||
|
||||
is
|
||||
|
||||
Create returns BitMap;
|
||||
---Purpose : Creates a empty BitMap
|
||||
|
||||
Create (nbitems : Integer; resflags : Integer = 0) returns BitMap;
|
||||
---Purpose : Creates a BitMap for <nbitems> items
|
||||
-- One flag is defined, n0 0
|
||||
-- <resflags> prepares allocation for <resflags> more flags
|
||||
-- Flags values start at false
|
||||
|
||||
|
||||
Initialize(me : in out; nbitems : Integer; resflags : Integer = 0);
|
||||
---Purpose : Initialize empty bit by <nbitems> items
|
||||
-- One flag is defined, n0 0
|
||||
-- <resflags> prepares allocation for <resflags> more flags
|
||||
-- Flags values start at false
|
||||
|
||||
Create (other : BitMap; copied : Boolean = Standard_False) returns BitMap;
|
||||
---Purpose : Creates a BitMap from another one
|
||||
-- if <copied> is True, copies data
|
||||
-- else, data are not copied, only the header object is
|
||||
|
||||
Initialize(me : in out; other : BitMap; copied : Boolean = Standard_False);
|
||||
---Purpose : Initialize a BitMap from another one
|
||||
|
||||
Internals (me; nbitems , nbwords, nbflags : out Integer;
|
||||
flags : out mutable HArray1OfInteger;
|
||||
@@ -108,6 +120,9 @@ is
|
||||
Init (me; val : Boolean; flag : Integer = 0);
|
||||
---Purpose : Initialises all the values of Flag Number <flag> to a given
|
||||
-- value <val>
|
||||
|
||||
Clear(me: in out);
|
||||
---Purpose : Clear all field of bit map
|
||||
|
||||
fields
|
||||
|
||||
|
@@ -2,18 +2,39 @@
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
|
||||
Interface_BitMap::Interface_BitMap()
|
||||
{
|
||||
Initialize(0);
|
||||
}
|
||||
|
||||
Interface_BitMap::Interface_BitMap
|
||||
(const Standard_Integer nbitems, const Standard_Integer resflags)
|
||||
|
||||
Interface_BitMap::Interface_BitMap
|
||||
(const Standard_Integer nbitems, const Standard_Integer resflags)
|
||||
{
|
||||
Initialize(nbitems,resflags);
|
||||
}
|
||||
|
||||
void Interface_BitMap::Initialize(const Standard_Integer nbitems, const Standard_Integer resflags)
|
||||
{
|
||||
thenbitems = nbitems;
|
||||
thenbwords = nbitems/32 + 1;
|
||||
thenbflags = 0;
|
||||
theflags = new TColStd_HArray1OfInteger (0,thenbwords*(resflags+1)); theflags->Init(0);
|
||||
if(nbitems)
|
||||
{
|
||||
theflags = new TColStd_HArray1OfInteger (0,thenbwords*(resflags+1));
|
||||
theflags->Init(0);
|
||||
}
|
||||
}
|
||||
|
||||
Interface_BitMap::Interface_BitMap
|
||||
(const Interface_BitMap& other, const Standard_Boolean copied)
|
||||
Interface_BitMap::Interface_BitMap
|
||||
(const Interface_BitMap& other, const Standard_Boolean copied)
|
||||
{
|
||||
|
||||
Initialize(other,copied);
|
||||
}
|
||||
|
||||
void Interface_BitMap::Initialize(const Interface_BitMap& other,
|
||||
const Standard_Boolean copied)
|
||||
{
|
||||
other.Internals (thenbitems,thenbwords,thenbflags,theflags,thenames);
|
||||
if (!copied) return;
|
||||
@@ -31,18 +52,18 @@
|
||||
thenames = names;
|
||||
}
|
||||
|
||||
void Interface_BitMap::Internals
|
||||
(Standard_Integer& nbitems, Standard_Integer& nbwords,
|
||||
Standard_Integer& nbflags,
|
||||
Handle(TColStd_HArray1OfInteger)& flags,
|
||||
Handle(TColStd_HSequenceOfAsciiString)& names) const
|
||||
void Interface_BitMap::Internals
|
||||
(Standard_Integer& nbitems, Standard_Integer& nbwords,
|
||||
Standard_Integer& nbflags,
|
||||
Handle(TColStd_HArray1OfInteger)& flags,
|
||||
Handle(TColStd_HSequenceOfAsciiString)& names) const
|
||||
{
|
||||
nbitems = thenbitems; nbwords = thenbwords; nbflags = thenbflags;
|
||||
flags = theflags; names = thenames;
|
||||
}
|
||||
|
||||
|
||||
void Interface_BitMap::Reservate (const Standard_Integer moreflags)
|
||||
void Interface_BitMap::Reservate (const Standard_Integer moreflags)
|
||||
{
|
||||
Standard_Integer nb = theflags->Upper ();
|
||||
Standard_Integer nbflags = nb / thenbwords - 1; // flag 0 non compte ...
|
||||
@@ -57,7 +78,7 @@
|
||||
}
|
||||
|
||||
|
||||
void Interface_BitMap::SetLength (const Standard_Integer nbitems)
|
||||
void Interface_BitMap::SetLength (const Standard_Integer nbitems)
|
||||
{
|
||||
Standard_Integer nbw = nbitems/32 + 1;
|
||||
if (nbw == thenbwords) return;
|
||||
@@ -77,7 +98,7 @@
|
||||
}
|
||||
|
||||
|
||||
Standard_Integer Interface_BitMap::AddFlag (const Standard_CString name)
|
||||
Standard_Integer Interface_BitMap::AddFlag (const Standard_CString name)
|
||||
{
|
||||
Reservate(1);
|
||||
Standard_Integer deja = 0;
|
||||
@@ -86,7 +107,7 @@
|
||||
Standard_Integer i, nb = thenames->Length();
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
if (thenames->Value(i).IsEqual("."))
|
||||
{ thenames->ChangeValue(i).AssignCat(name); deja = i; }
|
||||
{ thenames->ChangeValue(i).AssignCat(name); deja = i; }
|
||||
}
|
||||
}
|
||||
if (!deja) thenames->Append (TCollection_AsciiString(name));
|
||||
@@ -94,8 +115,8 @@
|
||||
return (deja ? deja : thenbflags);
|
||||
}
|
||||
|
||||
Standard_Integer Interface_BitMap::AddSomeFlags
|
||||
(const Standard_Integer more)
|
||||
Standard_Integer Interface_BitMap::AddSomeFlags
|
||||
(const Standard_Integer more)
|
||||
{
|
||||
Reservate(more);
|
||||
if (thenames.IsNull()) thenames = new TColStd_HSequenceOfAsciiString();
|
||||
@@ -105,8 +126,8 @@
|
||||
return thenbflags;
|
||||
}
|
||||
|
||||
Standard_Boolean Interface_BitMap::RemoveFlag
|
||||
(const Standard_Integer num)
|
||||
Standard_Boolean Interface_BitMap::RemoveFlag
|
||||
(const Standard_Integer num)
|
||||
{
|
||||
if (num < 1 || num > thenames->Length()) return Standard_False;
|
||||
if (num == thenames->Length()) thenames->Remove (thenames->Length());
|
||||
@@ -115,8 +136,8 @@
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean Interface_BitMap::SetFlagName
|
||||
(const Standard_Integer num, const Standard_CString name)
|
||||
Standard_Boolean Interface_BitMap::SetFlagName
|
||||
(const Standard_Integer num, const Standard_CString name)
|
||||
{
|
||||
if (num < 1 || num > thenames->Length()) return Standard_False;
|
||||
Standard_Integer deja = (name[0] == '\0' ? 0 : FlagNumber (name) );
|
||||
@@ -125,22 +146,22 @@
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Integer Interface_BitMap::NbFlags () const
|
||||
{ return thenbflags; }
|
||||
Standard_Integer Interface_BitMap::NbFlags () const
|
||||
{ return thenbflags; }
|
||||
|
||||
Standard_Integer Interface_BitMap::Length () const
|
||||
{ return thenbitems; }
|
||||
Standard_Integer Interface_BitMap::Length () const
|
||||
{ return thenbitems; }
|
||||
|
||||
Standard_CString Interface_BitMap::FlagName
|
||||
(const Standard_Integer num) const
|
||||
Standard_CString Interface_BitMap::FlagName
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
if (theflags.IsNull()) return "";
|
||||
if (num < 1 || num > thenames->Length()) return "";
|
||||
return thenames->Value(num).ToCString();
|
||||
}
|
||||
|
||||
Standard_Integer Interface_BitMap::FlagNumber
|
||||
(const Standard_CString name) const
|
||||
Standard_Integer Interface_BitMap::FlagNumber
|
||||
(const Standard_CString name) const
|
||||
{
|
||||
if (name[0] == '\0') return 0;
|
||||
if (thenames.IsNull()) return 0;
|
||||
@@ -153,8 +174,8 @@
|
||||
|
||||
// Les valeurs ...
|
||||
|
||||
Standard_Boolean Interface_BitMap::Value
|
||||
(const Standard_Integer item, const Standard_Integer flag) const
|
||||
Standard_Boolean Interface_BitMap::Value
|
||||
(const Standard_Integer item, const Standard_Integer flag) const
|
||||
{
|
||||
Standard_Integer numw = (thenbwords * flag) + (item >> 5);
|
||||
const Standard_Integer& val = theflags->Value (numw);
|
||||
@@ -164,24 +185,24 @@
|
||||
return ( ((1 << numb) & val) != 0);
|
||||
}
|
||||
|
||||
void Interface_BitMap::SetValue
|
||||
(const Standard_Integer item, const Standard_Boolean val,
|
||||
const Standard_Integer flag) const
|
||||
void Interface_BitMap::SetValue
|
||||
(const Standard_Integer item, const Standard_Boolean val,
|
||||
const Standard_Integer flag) const
|
||||
{
|
||||
if (val) SetTrue (item,flag);
|
||||
else SetFalse (item,flag);
|
||||
}
|
||||
|
||||
void Interface_BitMap::SetTrue
|
||||
(const Standard_Integer item, const Standard_Integer flag) const
|
||||
void Interface_BitMap::SetTrue
|
||||
(const Standard_Integer item, const Standard_Integer flag) const
|
||||
{
|
||||
Standard_Integer numw = (thenbwords * flag) + (item >> 5);
|
||||
Standard_Integer numb = item & 31;
|
||||
theflags->ChangeValue (numw) |= (1 << numb);
|
||||
}
|
||||
|
||||
void Interface_BitMap::SetFalse
|
||||
(const Standard_Integer item, const Standard_Integer flag) const
|
||||
void Interface_BitMap::SetFalse
|
||||
(const Standard_Integer item, const Standard_Integer flag) const
|
||||
{
|
||||
Standard_Integer numw = (thenbwords * flag) + (item >> 5);
|
||||
Standard_Integer& val = theflags->ChangeValue (numw);
|
||||
@@ -190,8 +211,8 @@
|
||||
theflags->ChangeValue (numw) &= ~(1 << numb);
|
||||
}
|
||||
|
||||
Standard_Boolean Interface_BitMap::CTrue
|
||||
(const Standard_Integer item, const Standard_Integer flag) const
|
||||
Standard_Boolean Interface_BitMap::CTrue
|
||||
(const Standard_Integer item, const Standard_Integer flag) const
|
||||
{
|
||||
Standard_Integer numw = (thenbwords * flag) + (item >> 5);
|
||||
Standard_Integer numb = item & 31;
|
||||
@@ -203,8 +224,8 @@
|
||||
return (res != 0);
|
||||
}
|
||||
|
||||
Standard_Boolean Interface_BitMap::CFalse
|
||||
(const Standard_Integer item, const Standard_Integer flag) const
|
||||
Standard_Boolean Interface_BitMap::CFalse
|
||||
(const Standard_Integer item, const Standard_Integer flag) const
|
||||
{
|
||||
Standard_Integer numw = (thenbwords * flag) + (item >> 5);
|
||||
Standard_Integer numb = item & 31;
|
||||
@@ -217,11 +238,17 @@
|
||||
}
|
||||
|
||||
|
||||
void Interface_BitMap::Init
|
||||
(const Standard_Boolean val, const Standard_Integer flag) const
|
||||
void Interface_BitMap::Init
|
||||
(const Standard_Boolean val, const Standard_Integer flag) const
|
||||
{
|
||||
Standard_Integer i, ii = thenbwords, i1 = thenbwords *flag;
|
||||
if (flag < 0) { i1 = 0; ii = thenbwords*(thenbflags+1); }
|
||||
if (val) for (i = 0; i < ii; i ++) theflags->SetValue (i1+i,~(0));
|
||||
else for (i = 0; i < ii; i ++) theflags->SetValue (i1+i, 0 );
|
||||
}
|
||||
|
||||
void Interface_BitMap::Clear()
|
||||
{
|
||||
theflags.Nullify();
|
||||
Initialize(0);
|
||||
}
|
@@ -174,7 +174,10 @@ is
|
||||
EndRead (me : in out; amodel : mutable InterfaceModel) is virtual;
|
||||
---Purpose : Ends file reading after reading all the entities
|
||||
-- default is doing nothing; redefinable as necessary
|
||||
|
||||
|
||||
|
||||
Clear(me : in out);
|
||||
---Purpose : Clear filelds
|
||||
|
||||
fields
|
||||
|
||||
|
@@ -547,5 +547,13 @@ Handle(Standard_Transient) Interface_FileReaderTool::LoadedEntity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Interface_FileReaderTool::Destroy(){}
|
||||
void Interface_FileReaderTool::Destroy()
|
||||
{}
|
||||
|
||||
void Interface_FileReaderTool::Clear()
|
||||
{
|
||||
theproto.Nullify();
|
||||
thereader.Nullify();
|
||||
themodel.Nullify();
|
||||
thereports.Nullify();
|
||||
}
|
@@ -67,17 +67,17 @@ Standard_Boolean Interface_GTool::Select (const Handle(Standard_Transient)& ent
|
||||
Standard_Integer& CN,
|
||||
const Standard_Boolean enforce)
|
||||
{
|
||||
// const Handle(Standard_Type)& aType = ent->DynamicType();
|
||||
Standard_Integer num = thentmod.FindIndex (ent);
|
||||
const Handle(Standard_Type)& aType = ent->DynamicType();
|
||||
Standard_Integer num = thentmod.FindIndex(aType);// (ent);
|
||||
if (num == 0 || enforce) {
|
||||
if (thelib.Select (ent,gmod,CN)) {
|
||||
num = thentmod.Add (ent,gmod);
|
||||
thentnum.Bind (ent,CN);
|
||||
num = thentmod.Add (aType,gmod);
|
||||
thentnum.Bind (aType,CN);
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
gmod = Handle(Interface_GeneralModule)::DownCast (thentmod.FindFromIndex(num));
|
||||
CN = thentnum.Find (ent);
|
||||
gmod = Handle(Interface_GeneralModule)::DownCast (thentmod.FindFromKey(aType));
|
||||
CN = thentnum.Find (aType);
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -28,39 +28,45 @@ class Graph from Interface
|
||||
-- be changed or reset (i.e. to come back to standard answer)
|
||||
|
||||
uses Transient, Type,
|
||||
Array1OfInteger from TColStd,
|
||||
HArray1OfInteger from TColStd,
|
||||
HArray1OfTransient from TColStd,
|
||||
HSequenceOfTransient from TColStd,
|
||||
HArray1OfListOfInteger from TColStd,
|
||||
AsciiString from TCollection, HAsciiString from TCollection,
|
||||
Protocol from Interface, GeneralLib, InterfaceModel, GTool,
|
||||
EntityIterator, IntList, BitMap
|
||||
EntityIterator, BitMap
|
||||
|
||||
raises DomainError
|
||||
|
||||
is
|
||||
|
||||
Create (amodel : InterfaceModel; lib : GeneralLib) returns Graph;
|
||||
Create (amodel : InterfaceModel; lib : GeneralLib; theModeStats : Boolean = Standard_True ) returns Graph;
|
||||
---Purpose : 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
|
||||
|
||||
Create (amodel : InterfaceModel; protocol : Protocol from Interface)
|
||||
Create (amodel : InterfaceModel; protocol : Protocol from Interface;
|
||||
theModeStats : Boolean = Standard_True)
|
||||
returns Graph;
|
||||
---Purpose : Same as above, but the Library is defined through a Protocol
|
||||
|
||||
Create (amodel : InterfaceModel; gtool : GTool from Interface)
|
||||
Create (amodel : InterfaceModel; gtool : GTool from Interface;
|
||||
theModeStats : Boolean = Standard_True)
|
||||
returns Graph;
|
||||
---Purpose : Same as above, but the Library is defined through a Protocol
|
||||
|
||||
Create (amodel : InterfaceModel) returns Graph;
|
||||
Create (amodel : InterfaceModel;theModeStats : Boolean = Standard_True) returns Graph;
|
||||
---Purpose : Same a above but works with the Protocol recorded in the Model
|
||||
|
||||
Create (agraph : Graph; copied : Boolean = Standard_False) returns Graph;
|
||||
|
||||
Create (agraph : Graph; copied : Boolean = Standard_False) returns Graph;
|
||||
---Purpose : Creates a Graph from another one, getting all its data
|
||||
-- Remark that status are copied from <agraph>, but the other
|
||||
-- lists (sharing/shared) are copied only if <copied> = True
|
||||
|
||||
Evaluate (me : in out; lib : GeneralLib; gtool : GTool) is static private;
|
||||
|
||||
Evaluate (me : in out ) is static private;
|
||||
---Purpose : Performs the Evaluation of the Graph, from an initial Library,
|
||||
-- either defined through a Protocol, or given dierctly
|
||||
-- Called by the non-empty Constructors
|
||||
@@ -69,25 +75,6 @@ is
|
||||
-- GeneralLib directly, it cannot be used
|
||||
-- If <gtool> is defined, it has priority
|
||||
|
||||
EvalSharings (me : in out) is static;
|
||||
---Purpose : Reevaluates the Sharing Lists of the Graph, starting from the
|
||||
-- Shared Lists (priority to the redefined ones)
|
||||
|
||||
|
||||
BasicSharedTable (me) returns IntList is static private;
|
||||
---Purpose : Returns the Table of Basic Shared lists. Used to Create
|
||||
-- another Graph from <me>
|
||||
|
||||
RedefinedSharedTable (me) returns IntList is static private;
|
||||
---Purpose : Returns the Table of redefined Shared lists. Used to Create
|
||||
-- another Graph from <me>. Null Handle is no one redefinition
|
||||
|
||||
SharingTable (me) returns IntList is static private;
|
||||
---Purpose : Returns the Table of Sharing lists. Used to Create
|
||||
-- another Graph from <me>
|
||||
|
||||
|
||||
-- NbVertex(me) returns Integer is static; -- for GraphTools requirements
|
||||
|
||||
Reset (me : in out) is static;
|
||||
---Purpose : Erases data, making graph ready to rebegin from void
|
||||
@@ -101,6 +88,9 @@ is
|
||||
---Purpose : Returns size (max nb of entities, i.e. Model's nb of entities)
|
||||
|
||||
-- -- Fine Actions -- --
|
||||
|
||||
NbStatuses(me) returns Integer;
|
||||
---Purpose : Returns size of array of statuses
|
||||
|
||||
EntityNumber (me; ent : Transient) returns Integer is static;
|
||||
---Purpose : Returns the Number of the entity in the Map, computed at
|
||||
@@ -125,10 +115,6 @@ is
|
||||
Status (me; num : Integer) returns Integer is static;
|
||||
---Purpose : Returns Status associated to a numero (only to read it)
|
||||
|
||||
CStatus (me : in out; num : Integer) returns Integer is static;
|
||||
---Purpose : Returns Status associated to a numero, to be read or changed
|
||||
---C++ : return &
|
||||
|
||||
SetStatus (me : in out; num : Integer; stat : Integer) is static;
|
||||
---Purpose : Modifies Status associated to a numero
|
||||
|
||||
@@ -215,23 +201,16 @@ is
|
||||
-- Remark : apart from the status HasShareError, these items
|
||||
-- are ignored
|
||||
|
||||
HasRedefinedShareds (me; ent : Transient) returns Boolean is static;
|
||||
---Purpose : Returns True if Shared list of <ent> has been redefined
|
||||
-- (Thus, Shareds from Graph gives a result different from
|
||||
-- general service Shareds)
|
||||
|
||||
GetShareds(me; ent : Transient) returns HSequenceOfTransient;
|
||||
---Purpose : Returns the sequence of Entities Shared by an Entity
|
||||
|
||||
Shareds (me; ent : Transient) returns EntityIterator
|
||||
---Purpose : Returns the list of Entities Shared by an Entity, as recorded
|
||||
-- by the Graph. That is, by default Basic Shared List, else it
|
||||
-- can be redefined by methods SetShare, SetNoShare ... see below
|
||||
raises DomainError is static;
|
||||
-- Error if <ent> is not contained by the model used for Creation
|
||||
|
||||
SharedNums (me; num : Integer) returns IntList is static;
|
||||
---Purpose : Same as Shareds, but under the form of a list of Integers,
|
||||
-- each one beeing the Number of a Shared Entity in the Graph
|
||||
-- Especially intended for fast internal uses
|
||||
-- Returns a Null Handle if <num> is not contained by <themodel>
|
||||
|
||||
|
||||
Sharings (me; ent : Transient) returns EntityIterator
|
||||
---Purpose : Returns the list of Entities which Share an Entity, computed
|
||||
@@ -239,83 +218,46 @@ is
|
||||
raises DomainError is static;
|
||||
-- Error if <ent> is not contained by the model used for Creation
|
||||
|
||||
SharingNums (me; num : Integer) returns IntList is static;
|
||||
---Purpose : Same as Sharings, but under the form of a list of Integers
|
||||
-- each one beeing the Number of a Sharing Entity in the Graph
|
||||
|
||||
TypedSharings (me; ent : Transient; type : Type) returns EntityIterator;
|
||||
|
||||
GetSharings(me; ent : Transient) returns HSequenceOfTransient;
|
||||
---Purpose : Returns the sequence of Entities Sharings by an Entity
|
||||
|
||||
TypedSharings (me; ent : Transient; type : Type) returns EntityIterator;
|
||||
---Purpose : Returns the list of sharings entities, AT ANY LEVEL, which are
|
||||
-- kind of a given type. A sharing entity kind of this type
|
||||
-- ends the exploration of its branch
|
||||
|
||||
|
||||
RootEntities (me) returns EntityIterator is static;
|
||||
---Purpose : Returns the Entities which are not Shared (their Sharing List
|
||||
-- is empty) in the Model
|
||||
|
||||
-- -- Redefinitions of Shared-Sharing Lists -- --
|
||||
|
||||
SetShare (me : in out; ent : Transient) is static;
|
||||
---Purpose : Sets explicit the shared list of an Entity <ent>, that is,
|
||||
-- available for a further edit (Add/Remove). All SetShare and
|
||||
-- SetNoShare methods allow further edit operations.
|
||||
-- Effect cancelled by ResetShare
|
||||
-- Remark that all Redefinition methods work on Shared Lists,
|
||||
-- but also manage (update) the Sharing Lists
|
||||
|
||||
SetShare (me : in out; ent : Transient; list : EntityIterator)
|
||||
is static;
|
||||
---Purpose : Sets as Shared list of an Entity <ent> considered by <me>,
|
||||
-- the list given as an EntityIterator <iter>. It can be empty.
|
||||
-- This list will now be considered by method Shareds above
|
||||
-- Does nothing if <ent> is not contained by <themodel>
|
||||
|
||||
SetShare (me : in out; ent : Transient; list : IntList)
|
||||
is static;
|
||||
---Purpose : Same as above, but the list is given as the list of Numbers
|
||||
-- of the Entities shared by <ent>
|
||||
|
||||
SetNoShare (me : in out; ent : Transient) is static;
|
||||
---Purpose : Sets the Shared list of an Entity considered in <me> as beeing
|
||||
-- Empty (if <ent> is contained by <themodel>)
|
||||
|
||||
SetNoShare (me : in out; list : EntityIterator) is static;
|
||||
---Purpose : Sets the Shared lists of a list of Entities to be Empty
|
||||
|
||||
AddShared (me : in out; ent,shared : Transient)
|
||||
---Purpose : Adds a shared Entity to a redefined Shared List (formerly
|
||||
-- defined by SetShare or SetNoShare). Does nothing if already in
|
||||
raises DomainError is static;
|
||||
-- Error if no shared list was formerly redefined for <ent>
|
||||
|
||||
RemoveShared (me : in out; ent,shared : Transient)
|
||||
---Purpose : Removes a shared Entity from a redefined Shared List (formerly
|
||||
-- defined ...). Does nothing if <shared> no in the list
|
||||
raises DomainError is static;
|
||||
-- Error if no shared list was formerly redefined for <ent>
|
||||
|
||||
ResetShare (me : in out; ent : Transient) is static;
|
||||
---Purpose : Comes back to the standard Shared list for <ent> : Cancels all
|
||||
-- the former redefinitions for it
|
||||
|
||||
ResetAllShare (me : in out) is static;
|
||||
---Purpose : Clears all effects of former redefinition of Shared lists
|
||||
|
||||
|
||||
Name (me; ent : Transient) returns HAsciiString;
|
||||
---Purpose : Determines the name attached to an entity, by using the
|
||||
-- general service Name in GeneralModule
|
||||
-- Returns a null handle if no name could be computed or if
|
||||
-- the entity is not in the model
|
||||
|
||||
|
||||
|
||||
SharingTable (me) returns HArray1OfListOfInteger from TColStd; --HArray1OfTransient from TColStd ;
|
||||
---C++ : return const &
|
||||
---Purpose : Returns the Table of Sharing lists. Used to Create
|
||||
-- another Graph from <me>
|
||||
|
||||
InitStats(me : in out) is protected;
|
||||
---Purpose : Initialize statuses and flags
|
||||
|
||||
ModeStat(me) returns Boolean;
|
||||
---Purpose : Returns mode resposible for computation of statuses;
|
||||
|
||||
fields
|
||||
|
||||
themodel : InterfaceModel; -- Model which contains the Entities
|
||||
thepresents : AsciiString from TCollection; -- flags present/or not
|
||||
thestats : Array1OfInteger from TColStd; -- numeric status
|
||||
themodel : InterfaceModel is protected ; -- Model which contains the Entities
|
||||
thepresents : AsciiString from TCollection is protected ; -- flags present/or not
|
||||
thestats : HArray1OfInteger from TColStd is protected; -- numeric status
|
||||
theflags : BitMap; -- logical flags status
|
||||
|
||||
theshareds : IntList; -- Basic Shared Lists (one per Entity)
|
||||
thesharnews : IntList; -- Shared Lists Redefinitions
|
||||
thesharings : IntList; -- The Sharing Lists (one per Entity)
|
||||
|
||||
thesharings : HArray1OfListOfInteger from TColStd is protected; --HArray1OfTransient from TColStd is protected;
|
||||
|
||||
end Graph;
|
||||
|
@@ -4,8 +4,9 @@
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <Interface_ShareTool.hxx>
|
||||
|
||||
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
#include <Interface_GTool.hxx>
|
||||
|
||||
// Flags : 0 = Presence, 1 = Sharing Error
|
||||
#define Graph_Present 0
|
||||
@@ -19,362 +20,327 @@
|
||||
// .... Construction a partir de la connaissance des Entites ....
|
||||
|
||||
|
||||
Interface_Graph::Interface_Graph
|
||||
(const Handle(Interface_InterfaceModel)& amodel,
|
||||
const Interface_GeneralLib& lib)
|
||||
: themodel (amodel), thepresents ("") , thestats (0,amodel->NbEntities()) ,
|
||||
theflags (amodel->NbEntities(),2) ,
|
||||
theshareds (amodel->NbEntities()) , /*thesharnews(amodel->NbEntities()) , */
|
||||
thesharings (amodel->NbEntities())
|
||||
Interface_Graph::Interface_Graph
|
||||
(const Handle(Interface_InterfaceModel)& amodel,
|
||||
const Interface_GeneralLib& lib,
|
||||
Standard_Boolean theModeStat)
|
||||
: themodel (amodel), thepresents ("")
|
||||
{
|
||||
Handle(Interface_GTool) gtool; // null
|
||||
theflags.AddFlag ("ShareError"); // -> flag n0 1
|
||||
Evaluate(lib,gtool);
|
||||
if(theModeStat)
|
||||
InitStats();
|
||||
Evaluate();
|
||||
}
|
||||
|
||||
Interface_Graph::Interface_Graph
|
||||
(const Handle(Interface_InterfaceModel)& amodel,
|
||||
const Handle(Interface_Protocol)& protocol)
|
||||
: themodel (amodel) , thepresents ("") ,
|
||||
thestats (0,amodel->NbEntities()) , theflags (amodel->NbEntities(),2) ,
|
||||
theshareds (amodel->NbEntities()) , /*thesharnews(amodel->NbEntities()) ,*/
|
||||
thesharings (amodel->NbEntities())
|
||||
Interface_Graph::Interface_Graph
|
||||
(const Handle(Interface_InterfaceModel)& amodel,
|
||||
const Handle(Interface_Protocol)& protocol,
|
||||
Standard_Boolean theModeStat)
|
||||
: themodel (amodel) , thepresents ("")
|
||||
|
||||
{
|
||||
Handle(Interface_GTool) gtool; // null
|
||||
theflags.AddFlag ("ShareError"); // -> flag n0 1
|
||||
Evaluate(Interface_GeneralLib(protocol),gtool);
|
||||
if(theModeStat)
|
||||
InitStats();
|
||||
Evaluate();
|
||||
}
|
||||
|
||||
Interface_Graph::Interface_Graph
|
||||
(const Handle(Interface_InterfaceModel)& amodel,
|
||||
const Handle(Interface_GTool)& gtool)
|
||||
: themodel (amodel) , thepresents ("") ,
|
||||
thestats (0,amodel->NbEntities()) , theflags (amodel->NbEntities(),2) ,
|
||||
theshareds (amodel->NbEntities()) , /*thesharnews(amodel->NbEntities()) , */
|
||||
thesharings (amodel->NbEntities())
|
||||
Interface_Graph::Interface_Graph
|
||||
(const Handle(Interface_InterfaceModel)& amodel,
|
||||
const Handle(Interface_GTool)& gtool,
|
||||
Standard_Boolean theModeStat)
|
||||
: themodel (amodel) , thepresents ("")
|
||||
{
|
||||
theflags.AddFlag ("ShareError"); // -> flag n0 1
|
||||
Evaluate(gtool->Lib(),gtool);
|
||||
if(theModeStat)
|
||||
InitStats();
|
||||
Evaluate();
|
||||
}
|
||||
|
||||
Interface_Graph::Interface_Graph
|
||||
(const Handle(Interface_InterfaceModel)& amodel)
|
||||
: themodel (amodel) , thepresents ("") ,
|
||||
thestats (0,amodel->NbEntities()) , theflags (amodel->NbEntities(),2) ,
|
||||
theshareds (amodel->NbEntities()) ,
|
||||
/*thesharnews(amodel->NbEntities()) ,*/ thesharings (amodel->NbEntities())
|
||||
Interface_Graph::Interface_Graph
|
||||
(const Handle(Interface_InterfaceModel)& amodel,
|
||||
Standard_Boolean theModeStat)
|
||||
: themodel (amodel) , thepresents ("")
|
||||
{
|
||||
theflags.AddFlag ("ShareError"); // -> flag n0 1
|
||||
Handle(Interface_GTool) gtool = amodel->GTool();
|
||||
if (gtool.IsNull()) return;
|
||||
gtool->Reservate(amodel->NbEntities());
|
||||
Evaluate (gtool->Lib(),gtool);
|
||||
if(theModeStat)
|
||||
InitStats();
|
||||
Evaluate ();
|
||||
}
|
||||
|
||||
void Interface_Graph::Evaluate
|
||||
(const Interface_GeneralLib& lib, const Handle(Interface_GTool)& gtool)
|
||||
{
|
||||
// Evaluation d un Graphe de dependances : sur chaque Entite, on prend sa
|
||||
// liste "Shared". On en deduit les "Sharing" directement
|
||||
|
||||
Standard_Boolean patool = gtool.IsNull();
|
||||
Standard_Integer n = Size(), total = 0;
|
||||
theshareds.Clear();
|
||||
thesharings.Clear();
|
||||
TColStd_Array1OfInteger counts (0,n); counts.Init(0);
|
||||
TColStd_Array1OfInteger lasts (0,n); lasts.Init(0);
|
||||
Standard_Integer i; // svv Jan11 2000 : porting on DEC
|
||||
for (i = 1; i <= n; i ++) {
|
||||
theshareds.SetNumber (i);
|
||||
|
||||
// ATTENTION : Si Entite non chargee donc illisible, basculer sur son
|
||||
// "Contenu" equivalent
|
||||
Handle(Standard_Transient) ent = themodel->Value(i);
|
||||
if (themodel->IsRedefinedContent(i)) ent = themodel->ReportEntity(i)->Content();
|
||||
|
||||
// Resultat obtenu via GeneralLib
|
||||
Interface_EntityIterator iter;
|
||||
Handle(Interface_GeneralModule) module;
|
||||
Standard_Integer CN;
|
||||
|
||||
if (patool) {
|
||||
if (lib.Select(ent,module,CN)) module->FillShared(themodel,CN,ent,iter);
|
||||
} else {
|
||||
if (gtool->Select(ent,module,CN)) module->FillShared(themodel,CN,ent,iter);
|
||||
}
|
||||
|
||||
theshareds.Reservate (iter.NbEntities());
|
||||
// Mise en forme : liste d entiers
|
||||
for (iter.Start(); iter.More(); iter.Next()) {
|
||||
// num = 0 -> on sort du Model de depart, le noter "Error" et passer
|
||||
Standard_Integer num = EntityNumber(iter.Value());
|
||||
if (num == 0) theflags.SetTrue (i,Graph_ShareError);
|
||||
else {
|
||||
// controle d unicite de couple (pere-fils)
|
||||
if (lasts(num) == i) continue;
|
||||
total ++;
|
||||
lasts.ChangeValue(num) = i;
|
||||
theshareds.Add (num);
|
||||
counts.ChangeValue(num) ++;
|
||||
// References inverses : plus tard
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Les references inverses : preallocation (pour compte > 1 seulement)
|
||||
|
||||
thesharings.SetNumber(0); thesharings.Reservate (total);
|
||||
for (i = 1; i <= n; i ++) {
|
||||
if (counts(i) < 2) continue;
|
||||
thesharings.SetNumber(i);
|
||||
thesharings.Reservate (-counts(i));
|
||||
}
|
||||
// Enregistrement par inversion
|
||||
for (i = 1; i <= n; i ++) {
|
||||
theshareds.SetNumber (i);
|
||||
Standard_Integer j,num, nb = theshareds.Length();
|
||||
for (j = 1; j <= nb; j ++) {
|
||||
num = theshareds.Value(j);
|
||||
thesharings.SetNumber(-num);
|
||||
thesharings.Add(-i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Interface_Graph::EvalSharings ()
|
||||
{
|
||||
thesharings.Clear();
|
||||
Standard_Integer n = thesharings.NbEntities();
|
||||
|
||||
// Difference avec Evaluate : SharedNums prend les Redefinis si necessaire
|
||||
|
||||
for (Standard_Integer i = 1; i <= n; i ++) {
|
||||
Standard_Integer nb, num;
|
||||
if (thesharnews.IsRedefined(i)) {
|
||||
thesharnews.SetNumber(i);
|
||||
nb = thesharnews.Length();
|
||||
for (Standard_Integer j = 1; j <= nb; j ++) {
|
||||
num = thesharnews.Value (j);
|
||||
thesharings.SetNumber (num);
|
||||
thesharings.Reservate (thesharings.Length()+1);
|
||||
thesharings.Add (i);
|
||||
}
|
||||
} else {
|
||||
theshareds.SetNumber(i);
|
||||
nb = theshareds.Length();
|
||||
for (Standard_Integer j = 1; j <= nb; j ++) {
|
||||
num = theshareds.Value (j);
|
||||
thesharings.SetNumber (num);
|
||||
thesharings.Reservate (thesharings.Length()+1);
|
||||
thesharings.Add (i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// .... Construction depuis un autre Graph ....
|
||||
|
||||
Interface_Graph::Interface_Graph
|
||||
(const Interface_Graph& agraph, const Standard_Boolean /*copied*/)
|
||||
: themodel (agraph.Model()), thepresents ("") ,
|
||||
thestats (0,agraph.Size()) ,
|
||||
theflags (agraph.BitMap(),Standard_True) ,
|
||||
theshareds (agraph.BasicSharedTable(),Standard_True) ,
|
||||
thesharnews (agraph.RedefinedSharedTable(),Standard_True) ,
|
||||
thesharings (agraph.SharingTable(),Standard_True)
|
||||
Interface_Graph::Interface_Graph
|
||||
(const Interface_Graph& agraph, const Standard_Boolean /*copied*/)
|
||||
: themodel (agraph.Model()), thepresents ("")
|
||||
{
|
||||
Standard_Integer nb = Size();
|
||||
thesharings = agraph.SharingTable();
|
||||
Standard_Integer nb = agraph.NbStatuses();
|
||||
if(!nb)
|
||||
return;
|
||||
if(thestats.IsNull())
|
||||
thestats = new TColStd_HArray1OfInteger(1,nb);
|
||||
for (Standard_Integer i = 1; i <= nb; i ++)
|
||||
thestats.SetValue (i,agraph.Status(i));
|
||||
thestats->SetValue (i,agraph.Status(i));
|
||||
theflags.Initialize(agraph.BitMap(),Standard_True);
|
||||
}
|
||||
|
||||
Interface_IntList Interface_Graph::BasicSharedTable () const
|
||||
{ return theshareds; }
|
||||
void Interface_Graph::InitStats()
|
||||
{
|
||||
thestats = new TColStd_HArray1OfInteger(1,themodel->NbEntities()) ,
|
||||
theflags.Initialize(themodel->NbEntities(),2);
|
||||
theflags.AddFlag ("ShareError");
|
||||
}
|
||||
|
||||
Interface_IntList Interface_Graph::RedefinedSharedTable () const
|
||||
{ return thesharnews; }
|
||||
Standard_Integer Interface_Graph::NbStatuses() const
|
||||
{
|
||||
return (thestats.IsNull() ? 0 : thestats->Length());
|
||||
}
|
||||
|
||||
Interface_IntList Interface_Graph::SharingTable () const
|
||||
{ return thesharings; }
|
||||
const Handle(TColStd_HArray1OfListOfInteger)& Interface_Graph::SharingTable () const
|
||||
{ return thesharings; }
|
||||
|
||||
void Interface_Graph::Evaluate()
|
||||
{
|
||||
// Evaluation d un Graphe de dependances : sur chaque Entite, on prend sa
|
||||
// liste "Shared". On en deduit les "Sharing" directement
|
||||
Standard_Integer n = Size(), total = 0;
|
||||
thesharings = new TColStd_HArray1OfListOfInteger(1,n);//TColStd_HArray1OfTransient(1,n);//Clear();
|
||||
if(themodel->GTool().IsNull())
|
||||
return;
|
||||
|
||||
|
||||
Standard_Integer i; // svv Jan11 2000 : porting on DEC
|
||||
for (i = 1; i <= n; i ++) {
|
||||
// ATTENTION : Si Entite non chargee donc illisible, basculer sur son
|
||||
// "Contenu" equivalent
|
||||
Handle(Standard_Transient) ent = themodel->Value(i);
|
||||
|
||||
|
||||
// Resultat obtenu via GeneralLib
|
||||
Interface_EntityIterator iter = GetShareds(ent);
|
||||
|
||||
// Mise en forme : liste d entiers
|
||||
for (iter.Start(); iter.More(); iter.Next()) {
|
||||
// num = 0 -> on sort du Model de depart, le noter "Error" et passer
|
||||
Handle(Standard_Transient) entshare = iter.Value();
|
||||
if(entshare == ent)
|
||||
continue;
|
||||
|
||||
Standard_Integer num = EntityNumber(entshare);
|
||||
|
||||
if (!num )
|
||||
{
|
||||
if(!thestats.IsNull())
|
||||
theflags.SetTrue (i,Graph_ShareError);
|
||||
continue;
|
||||
}
|
||||
thesharings->ChangeValue(num).Append(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// .... Construction depuis un autre Graph ....
|
||||
|
||||
|
||||
// ###########################################################################
|
||||
|
||||
// .... ACCES UNITAIRES AUX DONNEES DE BASE ....
|
||||
|
||||
void Interface_Graph::Reset ()
|
||||
void Interface_Graph::Reset ()
|
||||
{
|
||||
thestats.Init(0);
|
||||
theflags.Init (Standard_False, Graph_Present);
|
||||
thesharnews.Clear();
|
||||
EvalSharings();
|
||||
if(!thestats.IsNull())
|
||||
{
|
||||
thestats.Nullify();
|
||||
theflags.Init (Standard_False, Graph_Present);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Interface_Graph::ResetStatus ()
|
||||
{ thestats.Init(0); theflags.Init (Standard_False, Graph_Present); }
|
||||
|
||||
|
||||
Standard_Integer Interface_Graph::Size () const
|
||||
{ return thestats.Upper(); }
|
||||
|
||||
Standard_Integer Interface_Graph::EntityNumber
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
{ return themodel->Number(ent); }
|
||||
|
||||
Standard_Boolean Interface_Graph::IsPresent
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
if (num <= 0 || num > Size()) return Standard_False;
|
||||
return theflags.Value (num,Graph_Present);
|
||||
}
|
||||
|
||||
Standard_Boolean Interface_Graph::IsPresent
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
{ return IsPresent(EntityNumber(ent)); }
|
||||
|
||||
const Handle(Standard_Transient)& Interface_Graph::Entity
|
||||
(const Standard_Integer num) const
|
||||
{ return themodel->Value(num); }
|
||||
|
||||
|
||||
Standard_Integer Interface_Graph::Status (const Standard_Integer num) const
|
||||
{ return thestats.Value(num); }
|
||||
|
||||
Standard_Integer& Interface_Graph::CStatus (const Standard_Integer num)
|
||||
{ return thestats.ChangeValue(num); }
|
||||
|
||||
void Interface_Graph::SetStatus
|
||||
(const Standard_Integer num, const Standard_Integer stat)
|
||||
{ thestats.SetValue(num,stat); }
|
||||
|
||||
void Interface_Graph::RemoveItem(const Standard_Integer num)
|
||||
{
|
||||
thestats.SetValue(num,0); theflags.SetFalse (num,Graph_Present);
|
||||
}
|
||||
|
||||
void Interface_Graph::ChangeStatus
|
||||
(const Standard_Integer oldstat, const Standard_Integer newstat)
|
||||
{
|
||||
Standard_Integer nb = thestats.Upper();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
if (thestats.Value(i) == oldstat) thestats.SetValue(i,newstat);
|
||||
void Interface_Graph::ResetStatus ()
|
||||
{
|
||||
if(!thestats.IsNull())
|
||||
{
|
||||
thestats->Init(0);
|
||||
theflags.Init (Standard_False, Graph_Present);
|
||||
}
|
||||
}
|
||||
|
||||
void Interface_Graph::RemoveStatus(const Standard_Integer stat)
|
||||
|
||||
Standard_Integer Interface_Graph::Size () const
|
||||
{ return themodel->NbEntities(); }//thestats.Upper(); }
|
||||
|
||||
Standard_Integer Interface_Graph::EntityNumber
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
{ return themodel->Number(ent); }
|
||||
|
||||
Standard_Boolean Interface_Graph::IsPresent
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
Standard_Integer nb = thestats.Upper();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
if (thestats.Value(i) == stat) RemoveItem(i);
|
||||
if (num <= 0 || num > Size())
|
||||
return Standard_False;
|
||||
return (!thestats.IsNull() ? theflags.Value (num,Graph_Present) : Standard_False);
|
||||
}
|
||||
|
||||
Standard_Boolean Interface_Graph::IsPresent
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
{ return IsPresent(EntityNumber(ent)); }
|
||||
|
||||
const Handle(Standard_Transient)& Interface_Graph::Entity
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
return themodel->Value(num);
|
||||
}
|
||||
|
||||
|
||||
Standard_Integer Interface_Graph::Status (const Standard_Integer num) const
|
||||
{
|
||||
return (!thestats.IsNull() ? thestats->Value(num) : 0);
|
||||
}
|
||||
|
||||
void Interface_Graph::SetStatus
|
||||
(const Standard_Integer num, const Standard_Integer stat)
|
||||
{
|
||||
if(!thestats.IsNull())
|
||||
thestats->SetValue(num,stat);
|
||||
}
|
||||
|
||||
void Interface_Graph::RemoveItem(const Standard_Integer num)
|
||||
{
|
||||
if(!thestats.IsNull())
|
||||
{
|
||||
thestats->SetValue(num,0);
|
||||
theflags.SetFalse (num,Graph_Present);
|
||||
}
|
||||
}
|
||||
|
||||
const Interface_BitMap& Interface_Graph::BitMap () const
|
||||
{ return theflags; }
|
||||
void Interface_Graph::ChangeStatus
|
||||
(const Standard_Integer oldstat, const Standard_Integer newstat)
|
||||
{
|
||||
if(thestats.IsNull())
|
||||
return;
|
||||
Standard_Integer nb = thestats->Upper();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
if (thestats->Value(i) == oldstat)
|
||||
thestats->SetValue(i,newstat);
|
||||
}
|
||||
}
|
||||
|
||||
Interface_BitMap& Interface_Graph::CBitMap ()
|
||||
{ return theflags; }
|
||||
void Interface_Graph::RemoveStatus(const Standard_Integer stat)
|
||||
{
|
||||
if(thestats.IsNull())
|
||||
return;
|
||||
Standard_Integer nb = thestats->Upper();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
if (thestats->Value(i) == stat) RemoveItem(i);
|
||||
}
|
||||
}
|
||||
|
||||
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; }
|
||||
const Handle(Interface_InterfaceModel)& Interface_Graph::Model() const
|
||||
{ return themodel; }
|
||||
|
||||
void Interface_Graph::GetFromModel ()
|
||||
void Interface_Graph::GetFromModel ()
|
||||
{
|
||||
if (themodel.IsNull()) return; // no model ... (-> on n ira pas loin)
|
||||
if (themodel.IsNull() || thestats.IsNull())
|
||||
return; // no model ... (-> on n ira pas loin)
|
||||
theflags.Init (Standard_True,Graph_Present);
|
||||
thestats.Init (0);
|
||||
thestats->Init (0);
|
||||
}
|
||||
|
||||
void Interface_Graph::GetFromEntity
|
||||
(const Handle(Standard_Transient)& ent, const Standard_Boolean shared,
|
||||
const Standard_Integer newstat)
|
||||
void Interface_Graph::GetFromEntity
|
||||
(const Handle(Standard_Transient)& ent, const Standard_Boolean shared,
|
||||
const Standard_Integer newstat)
|
||||
{
|
||||
if(thestats.IsNull())
|
||||
return;
|
||||
Standard_Integer num = EntityNumber(ent);
|
||||
if (num == 0) return;
|
||||
if (!num )
|
||||
return;
|
||||
if (theflags.CTrue(num,Graph_Present)) return; // deja pris : on passe
|
||||
thestats.SetValue(num,newstat);
|
||||
thestats->SetValue(num,newstat);
|
||||
if (!shared) return;
|
||||
// Attention a la redefinition !
|
||||
Interface_IntList list = thesharnews;
|
||||
if (!list.IsRedefined(num)) list = theshareds;
|
||||
list.SetNumber (num);
|
||||
// Attention a la redefinition !
|
||||
Interface_EntityIterator aIter = GetShareds(ent);
|
||||
|
||||
Standard_Integer nb = list.Length();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) GetFromEntity
|
||||
(themodel->Value (list.Value(i)),Standard_True,newstat);
|
||||
for ( ; aIter.More() ; aIter.Next())
|
||||
GetFromEntity(aIter.Value(),Standard_True,newstat);
|
||||
}
|
||||
|
||||
void Interface_Graph::GetFromEntity
|
||||
(const Handle(Standard_Transient)& ent, const Standard_Boolean shared,
|
||||
const Standard_Integer newstat, const Standard_Integer overlapstat,
|
||||
const Standard_Boolean cumul)
|
||||
void Interface_Graph::GetFromEntity
|
||||
(const Handle(Standard_Transient)& ent, const Standard_Boolean shared,
|
||||
const Standard_Integer newstat, const Standard_Integer overlapstat,
|
||||
const Standard_Boolean cumul)
|
||||
{
|
||||
if(thestats.IsNull())
|
||||
return;
|
||||
Standard_Integer num = EntityNumber(ent);
|
||||
if (num == 0) return;
|
||||
if (!num ) return;
|
||||
Standard_Boolean pasla = !theflags.CTrue (num,Graph_Present);
|
||||
Standard_Integer stat = thestats.Value(num);
|
||||
Standard_Integer stat = thestats->Value(num);
|
||||
|
||||
if (pasla) {
|
||||
/// theflags.SetTrue (num, Graph_Present); // nouveau : noter avec newstat
|
||||
thestats.SetValue(num,newstat);
|
||||
/// theflags.SetTrue (num, Graph_Present); // nouveau : noter avec newstat
|
||||
thestats->SetValue(num,newstat);
|
||||
} else {
|
||||
Standard_Integer overstat = stat;
|
||||
if (stat != newstat) { // deja pris, meme statut : passer
|
||||
if (cumul) overstat += overlapstat; // nouveau statut : avec cumul ...
|
||||
else overstat = overlapstat; // ... ou sans (statut force)
|
||||
if (stat != overstat) // si repasse deja faite, passer
|
||||
thestats.SetValue(num,overstat);
|
||||
thestats->SetValue(num,overstat);
|
||||
}
|
||||
}
|
||||
if (!shared) return;
|
||||
// Attention a la redefinition !
|
||||
Interface_IntList list = thesharnews;
|
||||
if (!list.IsRedefined(num)) list = theshareds;
|
||||
list.SetNumber (num);
|
||||
Standard_Integer nb = list.Length();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) GetFromEntity
|
||||
(themodel->Value (list.Value(i)),Standard_True,newstat);
|
||||
// Attention a la redefinition !
|
||||
Interface_EntityIterator aIter = GetShareds(ent);
|
||||
|
||||
for ( ; aIter.More() ; aIter.Next())
|
||||
GetFromEntity(aIter.Value(),Standard_True,newstat);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Interface_Graph::GetFromIter
|
||||
(const Interface_EntityIterator& iter, const Standard_Integer newstat)
|
||||
void Interface_Graph::GetFromIter
|
||||
(const Interface_EntityIterator& iter, const Standard_Integer newstat)
|
||||
{
|
||||
if(thestats.IsNull())
|
||||
return;
|
||||
for (iter.Start(); iter.More(); iter.Next()) {
|
||||
Handle(Standard_Transient) ent = iter.Value();
|
||||
Standard_Integer num = EntityNumber(ent);
|
||||
if (num == 0) continue;
|
||||
if (theflags.CTrue(num,Graph_Present)) continue;
|
||||
thestats.SetValue(num,newstat);
|
||||
if (!num)
|
||||
continue;
|
||||
if (theflags.CTrue(num,Graph_Present))
|
||||
continue;
|
||||
thestats->SetValue(num,newstat);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Interface_Graph::GetFromIter
|
||||
(const Interface_EntityIterator& iter,
|
||||
const Standard_Integer newstat, const Standard_Integer overlapstat,
|
||||
const Standard_Boolean cumul)
|
||||
void Interface_Graph::GetFromIter
|
||||
(const Interface_EntityIterator& iter,
|
||||
const Standard_Integer newstat, const Standard_Integer overlapstat,
|
||||
const Standard_Boolean cumul)
|
||||
{
|
||||
if(thestats.IsNull())
|
||||
return;
|
||||
for (iter.Start(); iter.More(); iter.Next()) {
|
||||
Handle(Standard_Transient) ent = iter.Value();
|
||||
Standard_Integer num = EntityNumber(ent);
|
||||
if (num == 0) continue;
|
||||
if (!num)
|
||||
continue;
|
||||
/*Standard_Boolean pasla = !*/theflags.Value(num,Graph_Present);
|
||||
/*Standard_Integer stat = */thestats.Value(num);
|
||||
/*Standard_Integer stat = */thestats->Value(num);
|
||||
GetFromEntity (ent,Standard_False,newstat,overlapstat,cumul);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Interface_Graph::GetFromGraph (const Interface_Graph& agraph)
|
||||
void Interface_Graph::GetFromGraph (const Interface_Graph& agraph)
|
||||
{
|
||||
if (Model() != agraph.Model()) Standard_DomainError::Raise
|
||||
("Graph from Interface : GetFromGraph");
|
||||
@@ -385,8 +351,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
void Interface_Graph::GetFromGraph
|
||||
(const Interface_Graph& agraph, const Standard_Integer stat)
|
||||
void Interface_Graph::GetFromGraph
|
||||
(const Interface_Graph& agraph, const Standard_Integer stat)
|
||||
{
|
||||
if (Model() != agraph.Model()) Standard_DomainError::Raise
|
||||
("Graph from Interface : GetFromGraph");
|
||||
@@ -401,280 +367,109 @@
|
||||
|
||||
// .... Listage des Entites Partagees ....
|
||||
|
||||
Standard_Boolean Interface_Graph::HasShareErrors
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
Standard_Boolean Interface_Graph::HasShareErrors
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
{
|
||||
if(thestats.IsNull())
|
||||
return Standard_False;
|
||||
Standard_Integer num = EntityNumber(ent);
|
||||
if (num == 0) return Standard_True;
|
||||
return theflags.Value (num,Graph_ShareError);
|
||||
}
|
||||
|
||||
// A chaque entite, on peut attacher une Liste de numeros d entites partagees
|
||||
// Si elle est nulle, BasicShareds convient, sinon on prend RedefinedShareds
|
||||
|
||||
Standard_Boolean Interface_Graph::HasRedefinedShareds
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
Interface_EntityIterator Interface_Graph::Shareds
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
{
|
||||
Standard_Integer num = EntityNumber(ent);
|
||||
if (num == 0) return Standard_False;
|
||||
return thesharnews.IsRedefined (num);
|
||||
}
|
||||
|
||||
Interface_EntityIterator Interface_Graph::Shareds
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
{
|
||||
Standard_Integer num = EntityNumber(ent);
|
||||
if (num == 0) Standard_DomainError::Raise ("Interface : Shareds");
|
||||
|
||||
Interface_EntityIterator iter;
|
||||
Interface_IntList list = thesharnews;
|
||||
if (!list.IsRedefined(num)) list = theshareds;
|
||||
list.SetNumber (num);
|
||||
Standard_Integer nb = list.Length();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++)
|
||||
iter.GetOneItem (themodel->Value (list.Value(i) ));
|
||||
Standard_Integer num = EntityNumber(ent);
|
||||
if(!num)
|
||||
return iter;
|
||||
|
||||
Handle(Standard_Transient) aCurEnt = ent;
|
||||
if (themodel->IsRedefinedContent(num))
|
||||
aCurEnt = themodel->ReportEntity(num)->Content();
|
||||
|
||||
//if (num == 0) Standard_DomainError::Raise ("Interface : Shareds");
|
||||
Handle(Interface_GeneralModule) module;
|
||||
Standard_Integer CN;
|
||||
if (themodel->GTool()->Select(aCurEnt,module,CN))
|
||||
module->FillShared(themodel,CN,aCurEnt,iter);
|
||||
return iter;
|
||||
}
|
||||
|
||||
Interface_IntList Interface_Graph::SharedNums
|
||||
(const Standard_Integer num) const
|
||||
Handle(TColStd_HSequenceOfTransient) Interface_Graph::GetShareds(const Handle(Standard_Transient)& ent) const
|
||||
{
|
||||
Interface_IntList list = thesharnews;
|
||||
if (!list.IsRedefined(num)) list = theshareds;
|
||||
list.SetNumber (num);
|
||||
return list;
|
||||
Handle(TColStd_HSequenceOfTransient) aseq = new TColStd_HSequenceOfTransient;
|
||||
Interface_EntityIterator iter = Shareds(ent);
|
||||
for( ; iter.More(); iter.Next())
|
||||
aseq->Append(iter.Value());
|
||||
return aseq;
|
||||
}
|
||||
|
||||
Interface_EntityIterator Interface_Graph::Sharings
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
Handle(TColStd_HSequenceOfTransient) Interface_Graph::GetSharings(const Handle(Standard_Transient)& ent) const
|
||||
{
|
||||
Standard_Integer num = EntityNumber(ent);
|
||||
if (num == 0) Standard_DomainError::Raise ("Interface : Sharings");
|
||||
|
||||
Interface_EntityIterator iter;
|
||||
Interface_IntList list = thesharings; list.SetNumber (num);
|
||||
Standard_Integer nb = list.Length();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++)
|
||||
iter.GetOneItem (themodel->Value(list.Value(i)));
|
||||
return iter;
|
||||
if(!num)
|
||||
return 0;
|
||||
//return Handle(TColStd_HSequenceOfTransient)::DownCast(thesharings->Value(num));
|
||||
const TColStd_ListOfInteger& alist = thesharings->Value(num);
|
||||
Handle(TColStd_HSequenceOfTransient) aSharings = new TColStd_HSequenceOfTransient;
|
||||
TColStd_ListIteratorOfListOfInteger aIt(alist);
|
||||
for( ; aIt.More() ; aIt.Next())
|
||||
aSharings->Append(Entity(aIt.Value()));
|
||||
return aSharings;
|
||||
}
|
||||
|
||||
Interface_IntList Interface_Graph::SharingNums
|
||||
(const Standard_Integer num) const
|
||||
Interface_EntityIterator Interface_Graph::Sharings
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
{
|
||||
Interface_IntList list = thesharings;
|
||||
if (num > 0) list.SetNumber (num);
|
||||
return list;
|
||||
}
|
||||
Interface_EntityIterator iter;
|
||||
iter.AddList(GetSharings(ent));
|
||||
return iter;
|
||||
|
||||
}
|
||||
|
||||
static void AddTypedSharings
|
||||
(const Handle(Standard_Transient)& ent, const Handle(Standard_Type)& type,
|
||||
Interface_EntityIterator& iter, const Standard_Integer n,
|
||||
const Interface_Graph& G)
|
||||
(const Handle(Standard_Transient)& ent, const Handle(Standard_Type)& type,
|
||||
Interface_EntityIterator& iter, const Standard_Integer n,
|
||||
const Interface_Graph& G)
|
||||
{
|
||||
if (ent.IsNull()) return;
|
||||
if (ent->IsKind(type)) { iter.AddItem (ent); return; }
|
||||
if (iter.NbEntities() > n) return;
|
||||
|
||||
Interface_IntList list = G.SharingNums(G.EntityNumber(ent));
|
||||
Standard_Integer nb = list.Length();
|
||||
Handle(TColStd_HSequenceOfTransient) list = G.GetSharings(ent);
|
||||
if(list.IsNull())
|
||||
return;
|
||||
|
||||
Standard_Integer nb = list->Length();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++)
|
||||
AddTypedSharings (G.Entity(list.Value(i)) ,type,iter,nb,G);
|
||||
AddTypedSharings (list->Value(i) ,type,iter,nb,G);
|
||||
}
|
||||
|
||||
Interface_EntityIterator Interface_Graph::TypedSharings
|
||||
(const Handle(Standard_Transient)& ent, const Handle(Standard_Type)& type) const
|
||||
Interface_EntityIterator Interface_Graph::TypedSharings
|
||||
(const Handle(Standard_Transient)& ent, const Handle(Standard_Type)& type) const
|
||||
{
|
||||
Interface_EntityIterator iter;
|
||||
Standard_Integer n = Size();
|
||||
AddTypedSharings (ent,type,iter,n,*this);
|
||||
return iter;
|
||||
}
|
||||
|
||||
|
||||
Interface_EntityIterator Interface_Graph::RootEntities () const
|
||||
|
||||
Interface_EntityIterator Interface_Graph::RootEntities () const
|
||||
{
|
||||
Interface_EntityIterator iter;
|
||||
Standard_Integer nb = Size();
|
||||
Interface_IntList list (thesharings);
|
||||
Standard_Integer nb = thesharings->Length();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
list.SetNumber (i);
|
||||
if (list.Length() == 0) iter.GetOneItem (themodel->Value(i));
|
||||
if(!thesharings->Value(i).IsEmpty())
|
||||
continue;
|
||||
iter.AddItem(Entity(i));
|
||||
}
|
||||
return iter;
|
||||
}
|
||||
|
||||
|
||||
// ######################################################################
|
||||
|
||||
// .... Redefinition des listes Shared-Sharing ....
|
||||
|
||||
void Interface_Graph::SetShare
|
||||
(const Handle(Standard_Transient)& ent)
|
||||
{
|
||||
Standard_Integer num = EntityNumber(ent);
|
||||
if (num == 0) return;
|
||||
SetShare (ent,SharedNums(num));
|
||||
}
|
||||
|
||||
void Interface_Graph::SetShare
|
||||
(const Handle(Standard_Transient)& ent,
|
||||
const Interface_EntityIterator& list)
|
||||
{
|
||||
if(!thesharnews.NbEntities())
|
||||
thesharnews.Initialize(themodel->NbEntities());
|
||||
Standard_Integer num = EntityNumber(ent);
|
||||
if (num == 0) return;
|
||||
thesharnews.SetNumber (num);
|
||||
thesharnews.SetRedefined (Standard_True);
|
||||
thesharnews.Reservate (list.NbEntities());
|
||||
|
||||
for (list.Start(); list.More(); list.Next()) {
|
||||
Standard_Integer nsh = EntityNumber(list.Value());
|
||||
if (nsh != 0) thesharnews.Add (nsh);
|
||||
}
|
||||
}
|
||||
|
||||
void Interface_Graph::SetShare
|
||||
(const Handle(Standard_Transient)& ent, const Interface_IntList& list)
|
||||
{
|
||||
Standard_Integer num = EntityNumber(ent);
|
||||
if (num == 0) return;
|
||||
if(!thesharnews.NbEntities())
|
||||
thesharnews.Initialize(themodel->NbEntities());
|
||||
Standard_Integer i, n = list.Length();
|
||||
thesharnews.SetNumber (num);
|
||||
thesharnews.SetRedefined (Standard_True);
|
||||
thesharnews.Reservate (n);
|
||||
for (i = 1; i <= n; i ++) {
|
||||
Standard_Integer nsh = list.Value(i);
|
||||
if (nsh != 0) thesharnews.Add (nsh);
|
||||
}
|
||||
}
|
||||
|
||||
void Interface_Graph::SetNoShare
|
||||
(const Handle(Standard_Transient)& ent)
|
||||
{
|
||||
Standard_Integer num = EntityNumber(ent);
|
||||
if (num == 0) return;
|
||||
if(!thesharnews.NbEntities()) return;
|
||||
|
||||
thesharnews.SetNumber (num);
|
||||
thesharnews.SetRedefined (Standard_False);
|
||||
}
|
||||
|
||||
void Interface_Graph::SetNoShare (const Interface_EntityIterator& list)
|
||||
{
|
||||
for (list.Start(); list.More(); list.Next()) SetNoShare(list.Value());
|
||||
}
|
||||
|
||||
void Interface_Graph::AddShared
|
||||
(const Handle(Standard_Transient)& ent,
|
||||
const Handle(Standard_Transient)& shared)
|
||||
{
|
||||
//Standard_Integer i, nb; svv Feb21 2000 : porting on SIL
|
||||
Standard_Integer num = EntityNumber(ent);
|
||||
Standard_Integer nsh = EntityNumber(shared);
|
||||
|
||||
if (!thesharnews.IsRedefined(num) || num == 0 || nsh == 0) Standard_DomainError::Raise
|
||||
("Interface Graph : AddShared, cannot be applied");
|
||||
if(!thesharnews.NbEntities())
|
||||
thesharnews.Initialize(themodel->NbEntities());
|
||||
// Liste Shared(ent)
|
||||
thesharnews.SetNumber (num);
|
||||
thesharnews.Reservate (thesharnews.Length()+1);
|
||||
thesharnews.Add (nsh);
|
||||
|
||||
// Liste Sharing(shared)
|
||||
thesharings.SetNumber (nsh);
|
||||
thesharings.Reservate (thesharings.Length()+1);
|
||||
thesharings.Add (num);
|
||||
}
|
||||
|
||||
|
||||
void Interface_Graph::RemoveShared
|
||||
(const Handle(Standard_Transient)& ent,
|
||||
const Handle(Standard_Transient)& shared)
|
||||
{
|
||||
Standard_Integer num = EntityNumber(ent);
|
||||
Standard_Integer nsh = EntityNumber(shared);
|
||||
if (!thesharnews.IsRedefined(num) || num == 0 || nsh == 0) Standard_DomainError::Raise
|
||||
("Interface Graph : RemoveShared, cannot be applied");
|
||||
|
||||
// Liste Shared (ent)
|
||||
if(!thesharnews.NbEntities())
|
||||
thesharnews.Initialize(themodel->NbEntities());
|
||||
|
||||
thesharnews.SetNumber (num);
|
||||
Standard_Integer i,nbsh = thesharnews.Length();
|
||||
for (i = nbsh; i > 0; i --)
|
||||
if (thesharnews.Value(i) == nsh) thesharnews.Remove(i);
|
||||
|
||||
// Liste Sharing (shared)
|
||||
thesharings.SetNumber (nsh);
|
||||
nbsh = thesharings.Length();
|
||||
for (i = nbsh; i > 0; i --)
|
||||
if (thesharings.Value(i) == num) thesharings.Remove(i);
|
||||
}
|
||||
|
||||
|
||||
void Interface_Graph::ResetShare
|
||||
(const Handle(Standard_Transient)& ent)
|
||||
{
|
||||
Standard_Integer num = EntityNumber(ent);
|
||||
if (num == 0) return;
|
||||
|
||||
Interface_IntList snew(thesharnews);
|
||||
|
||||
if (!thesharnews.NbEntities() || !snew.IsRedefined(num)) return;
|
||||
snew.SetNumber (num);
|
||||
Interface_IntList sold(theshareds);
|
||||
sold.SetNumber (num);
|
||||
|
||||
// Attention aux Sharings ... Il va falloir ajouter, supprimer ... laisser !
|
||||
// Tableau // Entites : 0 hors jeu 1 reapparait 2 disparait 3 reste
|
||||
|
||||
Standard_Integer n = Size();
|
||||
TColStd_Array1OfInteger oldnew(1,n); oldnew.Init(0);
|
||||
Standard_Integer ns = sold.Length();
|
||||
Standard_Integer i; // svv Jan11 2000 : porting on DEC
|
||||
for (i = 1; i <= ns; i ++)
|
||||
oldnew.SetValue(sold.Value(i),1); // pourra passer en 3 plus tard ...
|
||||
ns = snew.Length();
|
||||
for (i = 1; i <= ns; i ++) {
|
||||
Standard_Integer oldstat = oldnew.Value(snew.Value(i));
|
||||
oldnew.SetValue(snew.Value(i),oldstat+2); // 0 -> 2, 1 -> 3
|
||||
}
|
||||
|
||||
// Muni de ces donnees, on pourra modifier les listes Sharings impliquees
|
||||
for (i = 1; i <= n; i ++) {
|
||||
Standard_Integer oldstat = oldnew.Value(snew.Value(i));
|
||||
if (oldstat == 0 || oldstat == 2) continue;
|
||||
thesharings.SetNumber(i);
|
||||
if (oldstat == 1) {
|
||||
thesharings.Reservate (thesharings.Length()+1);
|
||||
thesharings.Add (num);
|
||||
} else if (oldstat == 3) {
|
||||
Standard_Integer j,nbsh = thesharings.Length();
|
||||
for (j = nbsh; j > 0; j --)
|
||||
if (thesharings.Value(j) == num) thesharings.Remove(j);
|
||||
}
|
||||
}
|
||||
|
||||
// Shared : beaucoup plus simple, ANNULER Redefined
|
||||
thesharnews.SetRedefined (Standard_False);
|
||||
}
|
||||
|
||||
void Interface_Graph::ResetAllShare ()
|
||||
{
|
||||
thesharnews.Clear();
|
||||
EvalSharings();
|
||||
}
|
||||
|
||||
|
||||
Handle(TCollection_HAsciiString) Interface_Graph::Name
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
Handle(TCollection_HAsciiString) Interface_Graph::Name(const Handle(Standard_Transient)& ent) const
|
||||
{
|
||||
Handle(TCollection_HAsciiString) str;
|
||||
if (themodel.IsNull()) return str;
|
||||
@@ -690,3 +485,8 @@ static void AddTypedSharings
|
||||
Interface_ShareTool sht (*this);
|
||||
return module->Name (CN,ent,sht);
|
||||
}
|
||||
|
||||
Standard_Boolean Interface_Graph::ModeStat() const
|
||||
{
|
||||
return (!thestats.IsNull());
|
||||
}
|
||||
|
@@ -17,14 +17,13 @@
|
||||
Interface_GraphContent::Interface_GraphContent
|
||||
(const Interface_Graph& agraph, const Handle(Standard_Transient)& ent)
|
||||
{
|
||||
Interface_IntList list =
|
||||
agraph.SharedNums(agraph.EntityNumber(ent));
|
||||
Standard_Integer nb = list.Length();
|
||||
Interface_EntityIterator list = agraph.Shareds(ent);
|
||||
Standard_Integer nb = list.NbEntities();
|
||||
if (nb == 0) return; // Liste redefinie a VIDE
|
||||
Handle(Interface_InterfaceModel) mod = agraph.Model();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
Standard_Integer num = list.Value(i);
|
||||
if (agraph.IsPresent(num)) GetOneItem (agraph.Entity(num));
|
||||
for( ; list.More(); list.Next()) {
|
||||
Handle(Standard_Transient) curent = list.Value();
|
||||
if (agraph.IsPresent(agraph.EntityNumber(curent)))
|
||||
GetOneItem (curent);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -20,21 +20,25 @@ is
|
||||
Create (agraph : Graph) returns mutable HGraph;
|
||||
---Purpose : Creates an HGraph directly from a Graph.
|
||||
-- Remark that the starting Graph is duplicated
|
||||
|
||||
Create (amodel : InterfaceModel; lib : GeneralLib) returns mutable HGraph;
|
||||
|
||||
Create (amodel : InterfaceModel; lib : GeneralLib;
|
||||
theModeStats : Boolean = Standard_True) returns mutable HGraph;
|
||||
---Purpose : Creates an HGraph with a Graph created from <amodel> and <lib>
|
||||
|
||||
Create (amodel : InterfaceModel; protocol : Protocol from Interface)
|
||||
Create (amodel : InterfaceModel; protocol : Protocol from Interface;
|
||||
theModeStats : Boolean = Standard_True)
|
||||
returns mutable HGraph;
|
||||
---Purpose : Creates an HGraph with a graph itself created from <amodel>
|
||||
-- and <protocol>
|
||||
|
||||
Create (amodel : InterfaceModel; gtool : GTool from Interface)
|
||||
Create (amodel : InterfaceModel; gtool : GTool from Interface;
|
||||
theModeStats : Boolean = Standard_True)
|
||||
returns mutable HGraph;
|
||||
---Purpose : Creates an HGraph with a graph itself created from <amodel>
|
||||
-- and <protocol>
|
||||
|
||||
Create (amodel : InterfaceModel) returns mutable HGraph
|
||||
Create (amodel : InterfaceModel;
|
||||
theModeStats : Boolean = Standard_True) returns mutable HGraph
|
||||
---Purpose : Same a above, but works with the GTool in the model
|
||||
raises DomainError;
|
||||
-- Error if no Active Protocol is defined
|
||||
|
@@ -1,32 +1,35 @@
|
||||
#include <Interface_HGraph.ixx>
|
||||
|
||||
|
||||
|
||||
Interface_HGraph::Interface_HGraph (const Interface_Graph& agraph)
|
||||
Interface_HGraph::Interface_HGraph (const Interface_Graph& agraph)
|
||||
: thegraph(agraph) { }
|
||||
|
||||
|
||||
|
||||
Interface_HGraph::Interface_HGraph
|
||||
(const Handle(Interface_InterfaceModel)& amodel,
|
||||
const Interface_GeneralLib& lib)
|
||||
: thegraph (amodel,lib) { }
|
||||
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)
|
||||
: thegraph (amodel,protocol) { }
|
||||
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)
|
||||
: thegraph (amodel,gtool) { }
|
||||
const Handle(Interface_GTool)& gtool,
|
||||
const Standard_Boolean theModeStat)
|
||||
: thegraph (amodel,gtool,theModeStat) { }
|
||||
|
||||
|
||||
Interface_HGraph::Interface_HGraph
|
||||
(const Handle(Interface_InterfaceModel)& amodel)
|
||||
: thegraph (amodel) { }
|
||||
(const Handle(Interface_InterfaceModel)& amodel,
|
||||
const Standard_Boolean theModeStat)
|
||||
: thegraph (amodel,theModeStat) { }
|
||||
|
||||
|
||||
const Interface_Graph& Interface_HGraph::Graph () const
|
||||
|
@@ -46,19 +46,21 @@
|
||||
}
|
||||
|
||||
Interface_ShareFlags::Interface_ShareFlags (const Interface_Graph& agraph)
|
||||
: theflags (agraph.Model()->NbEntities())
|
||||
{
|
||||
themodel = agraph.Model();
|
||||
Standard_Integer nb = themodel->NbEntities();
|
||||
if (nb == 0) return;
|
||||
theroots = new TColStd_HSequenceOfTransient();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
// Resultat obtenu depuis le Graph
|
||||
Interface_IntList list = agraph.SharingNums(i);
|
||||
if (list.Length() > 0) theflags.SetTrue(i);
|
||||
else theroots->Append (themodel->Value(i));
|
||||
}
|
||||
}
|
||||
: theflags (agraph.Model()->NbEntities())
|
||||
{
|
||||
themodel = agraph.Model();
|
||||
Standard_Integer nb = themodel->NbEntities();
|
||||
if (nb == 0) return;
|
||||
theroots = new TColStd_HSequenceOfTransient();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
// Resultat obtenu depuis le Graph
|
||||
Handle(Standard_Transient) ent = themodel->Value(i);
|
||||
Handle(TColStd_HSequenceOfTransient) list = agraph.GetSharings(ent);
|
||||
|
||||
if (!list.IsNull() && list->Length() > 0) theflags.SetTrue(i);
|
||||
else theroots->Append (ent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Interface_ShareFlags::Evaluate
|
||||
|
@@ -46,7 +46,7 @@ is
|
||||
|
||||
Create (ahgraph : HGraph) returns ShareTool;
|
||||
|
||||
AddImplied (me : in out; gtool : GTool from Interface);
|
||||
--AddImplied (me : in out; gtool : GTool from Interface);
|
||||
---Purpose : Completes the Graph by Adding Implied References. Hence, they
|
||||
-- are considered as Sharing References in all the other queries
|
||||
|
||||
|
@@ -31,15 +31,16 @@ Interface_ShareTool::Interface_ShareTool (const Handle(Interface_InterfaceModel)
|
||||
|
||||
Interface_ShareTool::Interface_ShareTool (const Interface_Graph& agraph)
|
||||
{
|
||||
theHGraph = new Interface_HGraph(agraph);
|
||||
theHGraph = new Interface_HGraph(agraph.Model());
|
||||
}
|
||||
|
||||
Interface_ShareTool::Interface_ShareTool (const Handle(Interface_HGraph)& ahgraph)
|
||||
: theHGraph(ahgraph)
|
||||
{}
|
||||
{
|
||||
theHGraph = ahgraph;
|
||||
}
|
||||
|
||||
// Ajout des "Implied" sur toutes les Entites du Graphe
|
||||
void Interface_ShareTool::AddImplied (const Handle(Interface_GTool)& gtool)
|
||||
/*void Interface_ShareTool::AddImplied (const Handle(Interface_GTool)& gtool)
|
||||
{
|
||||
Interface_Graph& thegraph = theHGraph->CGraph();
|
||||
Standard_Integer nb = thegraph.Size();
|
||||
@@ -59,7 +60,7 @@ void Interface_ShareTool::AddImplied (const Handle(Interface_GTool)& gtool)
|
||||
}
|
||||
}
|
||||
if (yena) thegraph.EvalSharings();
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
Handle(Interface_InterfaceModel) Interface_ShareTool::Model () const
|
||||
@@ -75,9 +76,9 @@ void Interface_ShareTool::AddImplied (const Handle(Interface_GTool)& gtool)
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
{
|
||||
const Interface_Graph& thegraph = theHGraph->Graph();
|
||||
Interface_IntList list =
|
||||
thegraph.SharingNums (thegraph.EntityNumber(ent));
|
||||
return (list.Length() > 0);
|
||||
Handle(TColStd_HSequenceOfTransient) list =
|
||||
thegraph.GetShareds (ent);
|
||||
return (!list.IsNull() && list->Length() > 0);
|
||||
}
|
||||
|
||||
Interface_EntityIterator Interface_ShareTool::Shareds
|
||||
@@ -94,12 +95,14 @@ void Interface_ShareTool::AddImplied (const Handle(Interface_GTool)& gtool)
|
||||
const Handle(Standard_Type)& atype) const
|
||||
{
|
||||
Interface_Graph& thegraph = theHGraph->CGraph();
|
||||
Interface_IntList list =
|
||||
thegraph.SharingNums (thegraph.EntityNumber(ent));
|
||||
Handle(TColStd_HSequenceOfTransient) list = thegraph.GetSharings (ent);
|
||||
if(list.IsNull())
|
||||
return 0;
|
||||
|
||||
Standard_Integer result = 0;
|
||||
Standard_Integer n = list.Length();
|
||||
Standard_Integer n = list->Length();
|
||||
for (Standard_Integer i = 1; i <= n; i ++) {
|
||||
Handle(Standard_Transient) entsh = thegraph.Entity(list.Value(i));
|
||||
Handle(Standard_Transient) entsh = list->Value(i);
|
||||
if (entsh.IsNull()) continue;
|
||||
if (entsh->IsKind(atype)) result ++;
|
||||
}
|
||||
@@ -111,13 +114,14 @@ void Interface_ShareTool::AddImplied (const Handle(Interface_GTool)& gtool)
|
||||
const Handle(Standard_Type)& atype) const
|
||||
{
|
||||
Interface_Graph& thegraph = theHGraph->CGraph();
|
||||
Interface_IntList list =
|
||||
thegraph.SharingNums (thegraph.EntityNumber(ent));
|
||||
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();
|
||||
Standard_Integer n = list->Length();
|
||||
for (Standard_Integer i = 1; i <= n; i ++) {
|
||||
Handle(Standard_Transient) entsh = thegraph.Entity(list.Value(i));
|
||||
Handle(Standard_Transient) entsh = list->Value(i);
|
||||
if (entsh.IsNull()) continue;
|
||||
if (entsh->IsKind(atype)) {
|
||||
entresult = entsh;
|
||||
|
Reference in New Issue
Block a user