mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
1
src/IGESData/FILES
Executable file
1
src/IGESData/FILES
Executable file
@@ -0,0 +1 @@
|
||||
IGESData_Dump.hxx
|
138
src/IGESData/IGESData.cdl
Executable file
138
src/IGESData/IGESData.cdl
Executable file
@@ -0,0 +1,138 @@
|
||||
-- File: IGESData.cdl
|
||||
-- Created: Mon Apr 6 13:53:17 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
package IGESData
|
||||
|
||||
---Purpose : basic description of an IGES Interface
|
||||
|
||||
uses Standard, MMgt, TCollection, TColStd,
|
||||
LibCtl, Interface, gp, Message
|
||||
-- gp for Trsf, used by basic notion Transformation Matrix - Location
|
||||
|
||||
is
|
||||
|
||||
class Protocol;
|
||||
|
||||
class IGESModel;
|
||||
|
||||
deferred class IGESEntity; -- includes directory part
|
||||
-- following classes are used in directory part : effective types of
|
||||
-- LineFont, Transf, etc... MUST inherit them, because of type checking
|
||||
|
||||
deferred class LineFontEntity;
|
||||
deferred class LevelListEntity;
|
||||
deferred class TransfEntity; -- transformation matrix
|
||||
deferred class ViewKindEntity; -- single view or list of views
|
||||
deferred class LabelDisplayEntity;
|
||||
deferred class ColorEntity;
|
||||
deferred class NameEntity; -- possible as property
|
||||
deferred class SingleParentEntity; -- possible as associativity
|
||||
|
||||
class UndefinedEntity;
|
||||
class FreeFormatEntity;
|
||||
|
||||
class GlobalSection;
|
||||
class DefSwitch;
|
||||
|
||||
class DirChecker;
|
||||
|
||||
class IGESReaderData;
|
||||
class IGESReaderTool;
|
||||
class ParamReader;
|
||||
class ParamCursor;
|
||||
class DirPart; -- litteral description
|
||||
class IGESType;
|
||||
|
||||
deferred class FileRecognizer instantiates
|
||||
Recognizer from Interface (IGESType, IGESEntity);
|
||||
|
||||
class IGESWriter;
|
||||
class IGESDumper;
|
||||
class BasicEditor;
|
||||
|
||||
class ToolLocation;
|
||||
|
||||
deferred class GeneralModule;
|
||||
class DefaultGeneral;
|
||||
deferred class ReadWriteModule;
|
||||
deferred class SpecificModule; -- actions specific of IGES (Dump)
|
||||
class DefaultSpecific;
|
||||
class FileProtocol;
|
||||
|
||||
class WriterLib instantiates Library from LibCtl
|
||||
(IGESEntity, ReadWriteModule, Protocol from IGESData);
|
||||
class SpecificLib instantiates Library from LibCtl
|
||||
(IGESEntity, SpecificModule, Protocol from IGESData);
|
||||
|
||||
-- -- Enumerations -- --
|
||||
enumeration Status is
|
||||
EntityOK,
|
||||
EntityError,
|
||||
ReferenceError,
|
||||
TypeError;
|
||||
|
||||
enumeration DefType is DefVoid, DefValue, DefReference,
|
||||
DefAny, ErrorVal, ErrorRef;
|
||||
---Purpose : Some fields of an IGES entity may be
|
||||
-- - Undefined
|
||||
-- - Defined as a positive integer
|
||||
-- - Defined as a reference to a specialized entity.
|
||||
-- A typical example of this kind of variation is color.
|
||||
-- This enumeration allows you to identify which of the above is the case.
|
||||
-- The semantics of the terms are as follows:
|
||||
-- - DefVoid indicates that the item contained in the field is undefined
|
||||
-- - DefValue indicates that the item is defined as an immediate
|
||||
-- positive integer value (i.e. not a pointer)
|
||||
-- - DefReference indicates that the item is defined as an entity
|
||||
-- - DefAny indicates the item could not be determined
|
||||
-- - ErrorVal indicates that the item is defined as an integer
|
||||
-- but its value is incorrect (it could be out of range, for example)
|
||||
-- - ErrorRef indicates that the item is defined as an entity but
|
||||
--- is not of the required type.
|
||||
|
||||
enumeration DefList is DefNone, DefOne, DefSeveral, ErrorOne, ErrorSeveral;
|
||||
---Purpose : Some fields of an IGES entity may be
|
||||
-- - Undefined
|
||||
-- - Defined as a single item
|
||||
-- - Defined as a list of items.
|
||||
-- A typical example, which presents this kind of variation,
|
||||
-- is a level number.
|
||||
-- This enumeration allows you to identify which of the above is the case.
|
||||
-- The semantics of the terms is as follows:
|
||||
-- - DefNone indicates that the list is empty (there is not
|
||||
-- even a single item).
|
||||
-- - DefOne indicates that the list contains a single item.
|
||||
-- - DefSeveral indicates that the list contains several items.
|
||||
-- - ErrorOne indicates that the list contains one item, but
|
||||
-- that this item is incorrect
|
||||
-- - ErrorSeveral indicates that the list contains several
|
||||
-- items, but that at least one of them is incorrect.
|
||||
|
||||
enumeration ReadStage is ReadDir, ReadOwn, ReadAssocs, ReadProps, ReadEnd;
|
||||
---Purpose : gives successive stages of reading an entity (see ParamReader)
|
||||
|
||||
-- -- Instantiations -- --
|
||||
|
||||
class Array1OfDirPart instantiates Array1 from TCollection (DirPart);
|
||||
|
||||
class Array1OfIGESEntity instantiates Array1 from TCollection (IGESEntity);
|
||||
|
||||
class HArray1OfIGESEntity instantiates
|
||||
HArray1 from TCollection (IGESEntity,Array1OfIGESEntity);
|
||||
|
||||
-- General Routines --
|
||||
-- They encapsulate the general actions required to work with this
|
||||
-- package. While their use is not mandatory, it makes work easier.
|
||||
|
||||
Init;
|
||||
---Purpose : Prepares General dynamic data used for IGESData specifically :
|
||||
-- Protocol and Modules, which treat UndefinedEntity
|
||||
|
||||
Protocol returns Protocol from IGESData;
|
||||
---Purpose : Returns a Protocol from IGESData (avoids to create it)
|
||||
|
||||
end IGESData;
|
210
src/IGESData/IGESData.cxx
Executable file
210
src/IGESData/IGESData.cxx
Executable file
@@ -0,0 +1,210 @@
|
||||
// Integration to ensure SCCS base integrity
|
||||
//#58 rln 28.12.98 changing default values for Global Section
|
||||
//pdn 11.01.99 including <stdio.h> for compilation on NT
|
||||
//gka 19.01.99 changing date parameters and number of IGES version, adding parameter(ApllicationProtocol)
|
||||
//#65 rln 12.02.99 S4151 (explicitly force YYMMDD.HHMMSS before Y2000 and YYYYMMDD.HHMMSS after Y2000)
|
||||
|
||||
#include <stdio.h>
|
||||
#include <IGESData.ixx>
|
||||
#include <IGESData_Protocol.hxx>
|
||||
#include <IGESData_DefaultGeneral.hxx>
|
||||
#include <IGESData_DefaultSpecific.hxx>
|
||||
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <IGESData_GlobalSection.hxx>
|
||||
#include <IGESData_IGESModel.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
|
||||
#include <Interface_Static.hxx>
|
||||
#include <Message_MsgFile.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <OSD_Process.hxx>
|
||||
|
||||
#include <Interface_Version.hxx>
|
||||
#include <Quantity_Date.hxx>
|
||||
|
||||
|
||||
static Handle(IGESData_Protocol) proto;
|
||||
|
||||
static Handle(IGESData_DefaultGeneral) stmod;
|
||||
static Handle(IGESData_DefaultSpecific) speci;
|
||||
|
||||
|
||||
void IGESData::Init ()
|
||||
{
|
||||
if (proto.IsNull()) proto = 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;
|
||||
|
||||
OSD_Process process;
|
||||
|
||||
// Static Parameters - see also Static Standards
|
||||
// -----------------
|
||||
Interface_Static::Standards();
|
||||
|
||||
Interface_Static::Init ("XSTEP","read.iges.bspline.approxd1.mode",'e',"");
|
||||
Interface_Static::Init ("XSTEP","read.iges.bspline.approxd1.mode",'&',"ematch 0");
|
||||
Interface_Static::Init ("XSTEP","read.iges.bspline.approxd1.mode",'&',"eval Off");
|
||||
Interface_Static::Init ("XSTEP","read.iges.bspline.approxd1.mode",'&',"eval On");
|
||||
Interface_Static::SetIVal ("read.iges.bspline.approxd1.mode",0);
|
||||
|
||||
Interface_Static::Init ("XSTEP","read.iges.bspline.continuity",'i',"1");
|
||||
Interface_Static::Init ("XSTEP","read.iges.bspline.continuity",'&',"imin 0");
|
||||
Interface_Static::Init ("XSTEP","read.iges.bspline.continuity",'&',"imax 2");
|
||||
|
||||
//#58 rln Interface_Static::Init ("XSTEP","write.iges.header.product" ,'t',"");
|
||||
Interface_Static::Init ("XSTEP","write.iges.header.receiver",'t',"");//58 rln Unknown
|
||||
Interface_Static::Init ("XSTEP","write.iges.header.author" ,'t',process.UserName().ToCString());
|
||||
Interface_Static::Init ("XSTEP","write.iges.header.company" ,'t',"");//58 rln Matra Datavision
|
||||
|
||||
Interface_Static::Init ("XSTEP","write.iges.unit",'e',"");
|
||||
Interface_Static::Init ("XSTEP","write.iges.unit",'&',"enum 1");
|
||||
Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval INCH"); // 1
|
||||
Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval MM"); // 2
|
||||
Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval ??"); // 3
|
||||
Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval FT"); // 4
|
||||
Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval MI"); // 5
|
||||
Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval M"); // 6
|
||||
Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval KM"); // 7
|
||||
Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval MIL"); // 8
|
||||
Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval UM"); // 9
|
||||
Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval CM"); //10
|
||||
Interface_Static::Init ("XSTEP","write.iges.unit",'&',"eval UIN"); //11
|
||||
Interface_Static::SetCVal ("write.iges.unit","MM");
|
||||
|
||||
Interface_Static::Init ("XSTEP","write.iges.brep.mode",'e',"");
|
||||
Interface_Static::Init ("XSTEP","write.iges.brep.mode",'&',"ematch 0");
|
||||
Interface_Static::Init ("XSTEP","write.iges.brep.mode",'&',"eval Faces");
|
||||
Interface_Static::Init ("XSTEP","write.iges.brep.mode",'&',"eval BRep");
|
||||
Interface_Static::SetIVal ("write.iges.brep.mode",0);
|
||||
|
||||
//S4181 pdn 23.04.99: adding new parameter handling writing of elementary surfaces
|
||||
Interface_Static::Init ("XSTEP","write.convertsurface.mode",'e',"");
|
||||
Interface_Static::Init ("XSTEP","write.convertsurface.mode",'&',"ematch 0");
|
||||
Interface_Static::Init ("XSTEP","write.convertsurface.mode",'&',"eval Off");
|
||||
Interface_Static::Init ("XSTEP","write.convertsurface.mode",'&',"eval On");
|
||||
Interface_Static::SetIVal ("write.convertsurface.mode",0);
|
||||
|
||||
// abv 15.11.00: ShapeProcessing
|
||||
Interface_Static::Init ("XSTEP","write.iges.resource.name",'t',"IGES");
|
||||
Interface_Static::Init ("XSTEP","read.iges.resource.name",'t',"IGES");
|
||||
Interface_Static::Init ("XSTEP","write.iges.sequence",'t',"ToIGES");
|
||||
Interface_Static::Init ("XSTEP","read.iges.sequence",'t',"FromIGES");
|
||||
|
||||
// sln 11.06.2002 OCC448 : Initialize "read.onlyvisible" parameter to control transfering
|
||||
// invisiable sub entities which logicaly depend on the grouping entities
|
||||
Interface_Static::Init ("XSTEP","read.iges.onlyvisible",'e',"");
|
||||
Interface_Static::Init ("XSTEP","read.iges.onlyvisible",'&',"ematch 0");
|
||||
Interface_Static::Init ("XSTEP","read.iges.onlyvisible",'&',"eval Off");
|
||||
Interface_Static::Init ("XSTEP","read.iges.onlyvisible",'&',"eval On");
|
||||
Interface_Static::SetIVal ("read.iges.onlyvisible",0);
|
||||
|
||||
//gka added parameter for reading failed entities. 19.07
|
||||
Interface_Static::Init ("XSTEP","read.iges.faulty.entities",'e',"");
|
||||
Interface_Static::Init ("XSTEP","read.iges.faulty.entities",'&',"ematch 0");
|
||||
Interface_Static::Init ("XSTEP","read.iges.faulty.entities",'&',"eval Off");
|
||||
Interface_Static::Init ("XSTEP","read.iges.faulty.entities",'&',"eval On");
|
||||
Interface_Static::SetIVal ("read.iges.faulty.entities",0);
|
||||
// Message File for IGES
|
||||
// -----------------
|
||||
|
||||
Message_MsgFile::LoadFromEnv ("CSF_XSMessage","IGES");
|
||||
|
||||
// Creating the Global Section
|
||||
//----------------------------
|
||||
|
||||
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);
|
||||
GS.SetSeparator (',');
|
||||
GS.SetEndMark (';');
|
||||
GS.SetSendName (new TCollection_HAsciiString(Interface_Static::CVal("write.iges.header.product")));
|
||||
GS.SetFileName (new TCollection_HAsciiString("Filename.iges"));
|
||||
GS.SetSystemId (new TCollection_HAsciiString(XSTEP_SYSTEM_VERSION));//#58 rln "MATRA-DATAVISION EUCLID-QUANTUM"
|
||||
GS.SetInterfaceVersion (gsys);
|
||||
GS.SetIntegerBits ( IntegerSize() );
|
||||
GS.SetMaxPower10Single ( RealLast10Exp() );
|
||||
GS.SetMaxDigitsSingle ( RealDigits() );
|
||||
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.SetLineWeightGrad (1);
|
||||
GS.SetMaxLineWeight (0.01);
|
||||
GS.SetDate (datestr);
|
||||
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);
|
||||
}
|
||||
|
||||
Handle(IGESData_Protocol) IGESData::Protocol ()
|
||||
{
|
||||
return proto;
|
||||
}
|
111
src/IGESData/IGESData_BasicEditor.cdl
Executable file
111
src/IGESData/IGESData_BasicEditor.cdl
Executable file
@@ -0,0 +1,111 @@
|
||||
-- File: IGESData_BasicEditor.cdl
|
||||
-- Created: Fri Aug 25 15:09:44 1995
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@fidox>
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
class BasicEditor from IGESData
|
||||
|
||||
---Purpose : This class provides various functions of basic edition,
|
||||
-- such as :
|
||||
-- - setting header unit (WARNING : DOES NOT convert entities)
|
||||
-- - computation of the status (Subordinate, UseFlag) of entities
|
||||
-- of IGES Entities on a whole model
|
||||
-- - auto correction of IGES Entities, defined both by DirChecker
|
||||
-- and by specific service AutoCorrect
|
||||
-- (this auto correction performs non-ambigious, rather logic,
|
||||
-- editions)
|
||||
|
||||
uses GeneralLib, SpecificLib,
|
||||
IGESModel, IGESEntity, Protocol from IGESData
|
||||
|
||||
is
|
||||
|
||||
Create (protocol : Protocol from IGESData) returns BasicEditor;
|
||||
---Purpose : Creates a Basic Editor, with a new IGESModel, ready to run
|
||||
|
||||
Create (model : IGESModel; protocol : Protocol from IGESData)
|
||||
returns BasicEditor;
|
||||
---Purpose : Creates a Basic Editor for IGES Data, ready to run
|
||||
|
||||
Model (me) returns mutable IGESModel;
|
||||
---Purpose : Returns the designated model
|
||||
|
||||
SetUnitFlag (me : in out; flag : Integer) returns Boolean;
|
||||
---Purpose : Sets a new unit from its flag (param 14 of Global Section)
|
||||
-- Returns True if done, False if <flag> is incorrect
|
||||
|
||||
SetUnitValue (me : in out; val : Real) returns Boolean;
|
||||
---Purpose : Sets a new unit from its value in meters (rounded to the
|
||||
-- closest one, max gap 1%)
|
||||
-- Returns True if done, False if <val> is too far from a
|
||||
-- suitable value
|
||||
|
||||
SetUnitName (me : in out; name : CString) returns Boolean;
|
||||
---Purpose : Sets a new unit from its name (param 15 of Global Section)
|
||||
-- Returns True if done, False if <name> is incorrect
|
||||
-- Remark : if <flag> has been set to 3 (user defined), <name>
|
||||
-- is then free
|
||||
|
||||
ApplyUnit (me : in out; enforce : Boolean = Standard_False);
|
||||
---Purpose : Applies unit value to convert header data : Resolution,
|
||||
-- MaxCoord, MaxLineWeight
|
||||
-- Applies unit only once after SetUnit... has been called,
|
||||
-- if <enforce> is given as True.
|
||||
-- It can be called just before writing the model to a file,
|
||||
-- i.e. when definitive values are finally known
|
||||
|
||||
ComputeStatus (me : in out);
|
||||
---Purpose : Performs the re-computation of status on the whole model
|
||||
-- (Subordinate Status and Use Flag of each IGES Entity), which
|
||||
-- can have required values according the way they are referenced
|
||||
-- (see definitions of Logical use, Physical use, etc...)
|
||||
|
||||
AutoCorrect (me : in out; ent : mutable IGESEntity) returns Boolean;
|
||||
---Purpose : Performs auto-correction on an IGESEntity
|
||||
-- Returns True if something has changed, False if nothing done.
|
||||
--
|
||||
-- Works with the specific IGES Services : DirChecker which
|
||||
-- allows to correct data in "Directory Part" of Entities (such
|
||||
-- as required values for status, or references to be null), and
|
||||
-- the specific IGES service OwnCorrect, which is specialised for
|
||||
-- each type of entity.
|
||||
|
||||
AutoCorrectModel (me : in out) returns Integer;
|
||||
---Purpose : Performs auto-correction on the whole Model
|
||||
-- Returns the count of modified entities
|
||||
|
||||
|
||||
|
||||
UnitNameFlag (myclass; name : CString) returns Integer;
|
||||
---Purpose : From the name of unit, computes flag number, 0 if incorrect
|
||||
-- (in this case, user defined entity remains possible)
|
||||
|
||||
UnitFlagValue (myclass; flag : Integer) returns Real;
|
||||
---Purpose : From the flag of unit, determines value in MM, 0 if incorrect
|
||||
|
||||
UnitFlagName (myclass; flag : Integer) returns CString;
|
||||
---Purpose : From the flag of unit, determines its name, "" if incorrect
|
||||
|
||||
IGESVersionName (myclass; flag : Integer) returns CString;
|
||||
---Purpose : From the flag of IGES version, returns name, "" if incorrect
|
||||
|
||||
IGESVersionMax (myclass) returns Integer;
|
||||
---Purpose : Returns the maximum allowed value for IGESVersion Flag
|
||||
|
||||
DraftingName (myclass; flag : Integer) returns CString;
|
||||
---Purpose : From the flag of drafting standard, returns name, "" if incorrect
|
||||
|
||||
DraftingMax (myclass) returns Integer;
|
||||
---Purpose : Returns the maximum allowed value for Drafting Flag
|
||||
|
||||
fields
|
||||
|
||||
theunit : Boolean;
|
||||
theproto : Protocol from IGESData;
|
||||
themodel : IGESModel;
|
||||
theglib : GeneralLib;
|
||||
theslib : SpecificLib;
|
||||
|
||||
end BasicEditor;
|
394
src/IGESData/IGESData_BasicEditor.cxx
Executable file
394
src/IGESData/IGESData_BasicEditor.cxx
Executable file
@@ -0,0 +1,394 @@
|
||||
//#73 rln 10.03.99 S4135: "read.scale.unit" does not affect GlobalSection
|
||||
#include <IGESData_BasicEditor.ixx>
|
||||
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <IGESData_GeneralModule.hxx>
|
||||
#include <IGESData_SpecificModule.hxx>
|
||||
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
|
||||
#include <IGESData_LineFontEntity.hxx>
|
||||
#include <IGESData_LevelListEntity.hxx>
|
||||
#include <IGESData_ViewKindEntity.hxx>
|
||||
#include <IGESData_TransfEntity.hxx>
|
||||
#include <IGESData_LabelDisplayEntity.hxx>
|
||||
#include <IGESData_ColorEntity.hxx>
|
||||
#include <IGESData_DirChecker.hxx>
|
||||
|
||||
#include <Interface_Static.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <UnitsMethods.hxx>
|
||||
|
||||
|
||||
IGESData_BasicEditor::IGESData_BasicEditor
|
||||
|
||||
(const Handle(IGESData_Protocol)& protocol)
|
||||
: theunit (Standard_False) , theproto (protocol) ,
|
||||
themodel (GetCasted(IGESData_IGESModel,Interface_InterfaceModel::Template("iges"))) ,
|
||||
theglib (protocol) , theslib (protocol) { }
|
||||
|
||||
IGESData_BasicEditor::IGESData_BasicEditor
|
||||
(const Handle(IGESData_IGESModel)& model,
|
||||
const Handle(IGESData_Protocol)& protocol)
|
||||
: theunit (Standard_False) , theproto (protocol) , themodel (model) ,
|
||||
theglib (protocol) , theslib (protocol) { }
|
||||
|
||||
Handle(IGESData_IGESModel) IGESData_BasicEditor::Model () const
|
||||
{ return themodel; }
|
||||
|
||||
// #### Travaux sur le Header (GlobalSection) ####
|
||||
|
||||
Standard_Boolean IGESData_BasicEditor::SetUnitFlag
|
||||
(const Standard_Integer flag)
|
||||
{
|
||||
if (flag < 1 || flag > 11) return Standard_False;
|
||||
IGESData_GlobalSection GS = themodel->GlobalSection();
|
||||
Handle(TCollection_HAsciiString) name = GS.UnitName();
|
||||
Standard_CString nam = IGESData_BasicEditor::UnitFlagName (flag);
|
||||
if (nam[0] != '\0') name = new TCollection_HAsciiString (nam);
|
||||
GS.SetUnitFlag (flag);
|
||||
GS.SetUnitName (name);
|
||||
themodel->SetGlobalSection (GS);
|
||||
theunit = Standard_True;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IGESData_BasicEditor::SetUnitValue
|
||||
(const Standard_Real val)
|
||||
{
|
||||
if (val <= 0.) return Standard_False;
|
||||
Standard_Real vmm = val * UnitsMethods::GetCasCadeLengthUnit(); //abv 20 Feb 00: adding cascade unit factor
|
||||
//#73 rln 10.03.99 S4135: "read.scale.unit" does not affect GlobalSection
|
||||
//if (Interface_Static::IVal("read.scale.unit") == 1) vmm = vmm * 1000.;
|
||||
// vmm est exprime en MILLIMETRES
|
||||
if (vmm >= 25. && vmm <= 26. ) return SetUnitFlag(1);
|
||||
if (vmm >= 0.9 && vmm <= 1.1 ) return SetUnitFlag(2);
|
||||
if (vmm >= 300. && vmm <= 310. ) return SetUnitFlag(4);
|
||||
if (vmm >= 1600000. && vmm <= 1620000. ) return SetUnitFlag(5);
|
||||
if (vmm >= 990. && vmm <= 1010. ) return SetUnitFlag(6);
|
||||
if (vmm >= 990000. && vmm <= 1010000. ) return SetUnitFlag(7);
|
||||
if (vmm >= 0.025 && vmm <= 0.026 ) return SetUnitFlag(8);
|
||||
if (vmm >= 0.0009 && vmm <= 0.0011 ) return SetUnitFlag(9);
|
||||
if (vmm >= 9. && vmm <= 11. ) return SetUnitFlag(10);
|
||||
if (vmm >= 0.000025 && vmm <= 0.000026) return SetUnitFlag(11);
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetUnitName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IGESData_BasicEditor::SetUnitName (const Standard_CString name)
|
||||
{
|
||||
Standard_Integer flag = IGESData_BasicEditor::UnitNameFlag (name);
|
||||
IGESData_GlobalSection GS = themodel->GlobalSection();
|
||||
if (GS.UnitFlag() == 3) {
|
||||
char* nam = (char *)name;
|
||||
if (name[1] == 'H') nam = (char *)&name[2];
|
||||
GS.SetUnitName (new TCollection_HAsciiString(nam));
|
||||
themodel->SetGlobalSection (GS);
|
||||
return Standard_True;
|
||||
}
|
||||
if (flag > 0) return SetUnitFlag(flag);
|
||||
return (flag > 0);
|
||||
}
|
||||
|
||||
void IGESData_BasicEditor::ApplyUnit (const Standard_Boolean enforce)
|
||||
{
|
||||
if (!enforce && !theunit) return;
|
||||
IGESData_GlobalSection GS = themodel->GlobalSection();
|
||||
Standard_Real unit = GS.UnitValue();
|
||||
if (unit <= 0.) return;
|
||||
if (unit != 1.) {
|
||||
GS.SetMaxLineWeight (GS.MaxLineWeight () / unit);
|
||||
GS.SetResolution (GS.Resolution () / unit);
|
||||
GS.SetMaxCoord (GS.MaxCoord () / unit);
|
||||
themodel->SetGlobalSection (GS);
|
||||
}
|
||||
theunit = Standard_False;
|
||||
}
|
||||
|
||||
|
||||
// #### Travaux globaux sur les entites ####
|
||||
|
||||
void IGESData_BasicEditor::ComputeStatus ()
|
||||
{
|
||||
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
|
||||
G.ResetStatus();
|
||||
|
||||
// 2 phases : d abord on fait un calcul d ensemble. Ensuite on applique
|
||||
// Tout le modele est traite, pas de jaloux
|
||||
|
||||
// Chaque entite va donner une contribution sur ses descendents propres :
|
||||
// pour Subordinate (1 ou 2 cumulables), pour UseFlag (1 a 6 exclusifs)
|
||||
// (6 depuis IGES-5.2)
|
||||
|
||||
// Pour Subordinate : Drawing et 402 (sauf p-e dimensioned geometry ?) donnent
|
||||
// Logical, le reste implique Physical (sur descendants directs propres)
|
||||
|
||||
// Pour UseFlag, un peu plus complique :
|
||||
// D une part, les UseFlag se propagent aux descendants directs ou non
|
||||
// D autre part les cas sont plus compliques (et pas aussi clairs)
|
||||
|
||||
// ATTENTION, on ne peut traiter que ce qui se deduit du graphe en s appuyant
|
||||
// sur les "IGES Type Number", on n a pas le droit ici d acceder a la
|
||||
// description specifique des differents types : traites par AutoCorrect.
|
||||
// Exemple : une courbe est 3D ou parametrique 2D(UV), non seulement selon son
|
||||
// ascendant, mais selon le role qu elle y joue (ex. pour CurveOnSurface :
|
||||
// CurveUV/Curve3D)
|
||||
// Traites actuellement (necessaires) :
|
||||
// 1(Annotation), aussi 4(pour maillage). 5(ParamUV) traite par AutoCorrect
|
||||
|
||||
Handle(IGESData_GeneralModule) gmod;
|
||||
Standard_Integer CN;
|
||||
Standard_Integer i; // svv Jan11 2000 : porting on DEC
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
// Subordinate (sur directs en propre seulement)
|
||||
Handle(IGESData_IGESEntity) ent = themodel->Entity(i);
|
||||
Standard_Integer igt = ent->TypeNumber();
|
||||
if (theglib.Select (ent,gmod,CN)) {
|
||||
Interface_EntityIterator sh;
|
||||
gmod->OwnSharedCase (CN,ent,sh);
|
||||
for (sh.Start(); sh.More(); sh.Next()) {
|
||||
Standard_Integer nums = themodel->Number(sh.Value());
|
||||
if (igt == 402 || igt == 404) subs.SetValue (nums,subs.Value(nums) | 2);
|
||||
else subs.SetValue (nums,subs.Value(nums) | 1);
|
||||
//// cout<<"ComputeStatus : nums = "<<nums<<" ->"<<subs.Value(nums)<<endl;
|
||||
}
|
||||
}
|
||||
// UseFlag (a propager)
|
||||
if (igt / 100 == 2) {
|
||||
G.GetFromEntity(ent,Standard_True,1); // Annotation
|
||||
G.GetFromEntity(ent,Standard_False,ent->UseFlag());
|
||||
} else if (igt == 134 || igt == 116 || igt == 132) {
|
||||
Interface_EntityIterator sh = G.Sharings(ent); // Maillage ...
|
||||
if (sh.NbEntities() > 0) G.GetFromEntity(ent,Standard_True,4);
|
||||
// UV : voir AutoCorrect des classes concernees (Boundary et CurveOnSurface)
|
||||
/*
|
||||
} else if (ent->IsKind(STANDARD_TYPE(IGESGeom_CurveOnSurface))) {
|
||||
DeclareAndCast(IGESGeom_CurveOnSurface,cos,ent); // Curve UV
|
||||
G.GetFromEntity (cos->CurveUV(),Standard_True,5);
|
||||
} else if (ent->IsKind(STANDARD_TYPE(IGESGeom_Boundary))) {
|
||||
DeclareAndCast(IGESGeom_Boundary,bnd,ent); // Curve UV
|
||||
Standard_Integer nc = bnd->NbModelSpaceCurves();
|
||||
for (Standard_Integer ic = 1; ic <= nc; ic ++) {
|
||||
Standard_Integer nuv = bnd->NbParameterCurves(ic);
|
||||
for (Standard_Integer juv = 1; juv <= nuv; juv ++)
|
||||
G.GetFromEntity(bnd->ParameterCurve(ic,juv),Standard_True,5);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
// A present, on va appliquer tout cela "de force"
|
||||
// Seule exception : des UseFlags non nuls deja en place sont laisses
|
||||
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
Handle(IGESData_IGESEntity) ent = themodel->Entity(i);
|
||||
Standard_Integer bl = ent->BlankStatus();
|
||||
Standard_Integer uf = ent->UseFlag();
|
||||
if (uf == 0) uf = G.Status(i);
|
||||
Standard_Integer hy = ent->HierarchyStatus();
|
||||
//// cout<<" Ent.n0."<<i<<" Subord="<<subs.Value(i)<<" Use="<<uf<<endl;
|
||||
ent->InitStatus(bl,subs.Value(i),uf,hy);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IGESData_BasicEditor::AutoCorrect
|
||||
(const Handle(IGESData_IGESEntity)& ent)
|
||||
{
|
||||
Handle(IGESData_IGESEntity) bof, subent;
|
||||
Handle(IGESData_LineFontEntity) linefont;
|
||||
Handle(IGESData_LevelListEntity) levelist;
|
||||
Handle(IGESData_ViewKindEntity) view;
|
||||
Handle(IGESData_TransfEntity) transf;
|
||||
Handle(IGESData_LabelDisplayEntity) labdisp;
|
||||
Handle(IGESData_ColorEntity) color;
|
||||
|
||||
Standard_Boolean done = Standard_False;
|
||||
if (ent.IsNull()) return done;
|
||||
// Corrections dans l entete (entites presentes)
|
||||
// On ne verifie pas les items "Shared", presents de toute facon
|
||||
// Entete : traite par DirChecker pour les cas standard
|
||||
/*
|
||||
linefont = ent->LineFont();
|
||||
if (!linefont.IsNull() && themodel->Number(linefont) == 0) {
|
||||
linefont.Nullify();
|
||||
ent->InitLineFont(linefont,0);
|
||||
done = Standard_True;
|
||||
}
|
||||
levelist = ent->LevelList();
|
||||
if (!levelist.IsNull() && themodel->Number(levelist) == 0) {
|
||||
levelist.Nullify();
|
||||
ent->InitLevel(levelist,0);
|
||||
done = Standard_True;
|
||||
}
|
||||
view = ent->View();
|
||||
if (!view.IsNull() && themodel->Number(view) == 0) {
|
||||
view.Nullify();
|
||||
ent->InitView(view);
|
||||
done = Standard_True;
|
||||
}
|
||||
transf = ent->Transf();
|
||||
if (!transf.IsNull() && themodel->Number(transf) == 0) {
|
||||
transf.Nullify();
|
||||
ent->InitTransf(transf);
|
||||
done = Standard_True;
|
||||
}
|
||||
labdisp = ent->LabelDisplay();
|
||||
if (!labdisp.IsNull() && themodel->Number(labdisp) == 0) {
|
||||
labdisp.Nullify();
|
||||
ent->InitMisc (ent->Structure(),labdisp,ent->LineWeightNumber());
|
||||
done = Standard_True;
|
||||
}
|
||||
color = ent->Color();
|
||||
if (!color.IsNull() && themodel->Number(color) == 0) {
|
||||
color.Nullify();
|
||||
ent->InitColor(color,0);
|
||||
done = Standard_True;
|
||||
}
|
||||
*/
|
||||
|
||||
// Corrections dans les Assocs (les Props restent attachees a l Entite)
|
||||
Interface_EntityIterator iter = ent->Associativities();
|
||||
for (iter.Start(); iter.More(); iter.Next()) {
|
||||
subent = GetCasted(IGESData_IGESEntity,iter.Value());
|
||||
if (!subent.IsNull() && themodel->Number(subent) == 0)
|
||||
{ subent->Dissociate(ent); done = Standard_True; }
|
||||
}
|
||||
|
||||
// Corrections specifiques
|
||||
Handle(IGESData_GeneralModule) gmod;
|
||||
Handle(IGESData_SpecificModule) smod;
|
||||
Standard_Integer CN;
|
||||
|
||||
if (theglib.Select (ent,gmod,CN)) {
|
||||
IGESData_DirChecker DC = gmod->DirChecker(CN,ent);
|
||||
done |= DC.Correct(ent);
|
||||
}
|
||||
if (theslib.Select (ent,smod,CN)) done |= smod->OwnCorrect (CN,ent);
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
|
||||
Standard_Integer IGESData_BasicEditor::AutoCorrectModel ()
|
||||
{
|
||||
Standard_Integer res = 0;
|
||||
Standard_Integer nb = themodel->NbEntities();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
if (AutoCorrect (themodel->Entity(i))) res ++;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : UnitNameFlag
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer IGESData_BasicEditor::UnitNameFlag (const Standard_CString name)
|
||||
{
|
||||
char* nam = (char *)&name[0];
|
||||
if (name[1] == 'H') {
|
||||
nam = (char *)&name[2];
|
||||
}
|
||||
if (!strcmp (nam,"INCH")) return 1;
|
||||
if (!strcmp (nam,"IN")) return 1;
|
||||
if (!strcmp (nam,"MM")) return 2;
|
||||
if (!strcmp (nam,"FT")) return 4;
|
||||
if (!strcmp (nam,"MI")) return 5;
|
||||
if (!strcmp (nam,"M")) return 6;
|
||||
if (!strcmp (nam,"KM")) return 7;
|
||||
if (!strcmp (nam,"MIL")) return 8;
|
||||
if (!strcmp (nam,"UM")) return 9;
|
||||
if (!strcmp (nam,"CM")) return 10;
|
||||
if (!strcmp (nam,"UIN")) return 11;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Standard_Real IGESData_BasicEditor::UnitFlagValue (const Standard_Integer flag)
|
||||
{
|
||||
switch (flag) {
|
||||
case 1 : return 0.0254;
|
||||
case 2 : return 0.001;
|
||||
case 3 : return 1.;
|
||||
case 4 : return 0.3048;
|
||||
case 5 : return 1609.27;
|
||||
case 6 : return 1.;
|
||||
case 7 : return 1000.;
|
||||
case 8 : return 0.0000254;
|
||||
case 9 : return 0.000001;
|
||||
case 10 : return 0.01;
|
||||
case 11 : return 0.0000000254;
|
||||
default : break;
|
||||
}
|
||||
return 0.;
|
||||
}
|
||||
|
||||
Standard_CString IGESData_BasicEditor::UnitFlagName (const Standard_Integer flag)
|
||||
{
|
||||
Standard_CString name = "";
|
||||
switch (flag) {
|
||||
case 1 : name = "INCH"; break;
|
||||
case 2 : name = "MM"; break;
|
||||
case 4 : name = "FT"; break;
|
||||
case 5 : name = "MI"; break;
|
||||
case 6 : name = "M"; break;
|
||||
case 7 : name = "KM"; break;
|
||||
case 8 : name = "MIL"; break;
|
||||
case 9 : name = "UM"; break;
|
||||
case 10 : name = "CM"; break;
|
||||
case 11 : name = "UIN"; break;
|
||||
default : break;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
Standard_CString IGESData_BasicEditor::IGESVersionName (const Standard_Integer flag)
|
||||
{
|
||||
switch (flag) {
|
||||
case 1 : return "1.0";
|
||||
case 2 : return "ANSI Y14.26M-1981";
|
||||
case 3 : return "2.0";
|
||||
case 4 : return "3.0";
|
||||
case 5 : return "ANSI Y14.26M-1987";
|
||||
case 6 : return "4.0";
|
||||
case 7 : return "ANSI Y14.26M-1989";
|
||||
case 8 : return "5.0";
|
||||
case 9 : return "5.1";
|
||||
case 10: return "5.2";
|
||||
case 11: return "5.3";
|
||||
default : break;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
Standard_Integer IGESData_BasicEditor::IGESVersionMax ()
|
||||
{ return 11; }
|
||||
|
||||
Standard_CString IGESData_BasicEditor::DraftingName (const Standard_Integer flag)
|
||||
{
|
||||
switch (flag) {
|
||||
case 0 : return "(None)";
|
||||
case 1 : return "ISO";
|
||||
case 2 : return "AFNOR";
|
||||
case 3 : return "ANSI";
|
||||
case 4 : return "BSI";
|
||||
case 5 : return "CSA";
|
||||
case 6 : return "DIN";
|
||||
case 7 : return "JIS";
|
||||
default : break;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
Standard_Integer IGESData_BasicEditor::DraftingMax ()
|
||||
{ return 7; }
|
15
src/IGESData/IGESData_ColorEntity.cdl
Executable file
15
src/IGESData/IGESData_ColorEntity.cdl
Executable file
@@ -0,0 +1,15 @@
|
||||
-- File: ColorEntity.cdl
|
||||
-- Created: Tue Apr 7 16:01:46 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
deferred class ColorEntity from IGESData inherits IGESEntity
|
||||
|
||||
---Purpose : defines required type for Color in directory part
|
||||
-- an effective Color entity must inherits it
|
||||
|
||||
is
|
||||
|
||||
end ColorEntity;
|
2
src/IGESData/IGESData_ColorEntity.cxx
Executable file
2
src/IGESData/IGESData_ColorEntity.cxx
Executable file
@@ -0,0 +1,2 @@
|
||||
#include <IGESData_ColorEntity.ixx>
|
||||
// ColorEntity ne sert qu'au controle de type (entite Color du directory part)
|
42
src/IGESData/IGESData_DefSwitch.cdl
Executable file
42
src/IGESData/IGESData_DefSwitch.cdl
Executable file
@@ -0,0 +1,42 @@
|
||||
-- File: DefSwitch.cdl
|
||||
-- Created: Mon Apr 6 14:40:25 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class DefSwitch from IGESData inherits Storable
|
||||
|
||||
---Purpose : description of a directory componant which can be either
|
||||
-- undefined (let Void), defined as a Reference to an entity,
|
||||
-- or as a Rank, integer value adressing a builtin table
|
||||
-- The entity reference is not included here, only reference
|
||||
-- status is kept (because entity type must be adapted)
|
||||
|
||||
uses Integer, DefType
|
||||
|
||||
is
|
||||
|
||||
Create returns DefSwitch;
|
||||
---Purpose : creates a DefSwitch as Void
|
||||
|
||||
SetVoid (me : in out) is static;
|
||||
---Purpose : sets DefSwitch to "Void" status (in file : Integer = 0)
|
||||
|
||||
SetReference (me : in out) is static;
|
||||
---Purpose : sets DefSwitch to "Reference" Status (in file : Integer < 0)
|
||||
|
||||
SetRank (me : in out; val : Integer) is static;
|
||||
---Purpose : sets DefSwitch to "Rank" with a Value (in file : Integer > 0)
|
||||
|
||||
DefType (me) returns DefType is static;
|
||||
---Purpose : returns DefType status (Void,Reference,Rank)
|
||||
|
||||
Value (me) returns Integer is static;
|
||||
---Purpose : returns Value as Integer (sensefull for a Rank)
|
||||
|
||||
fields
|
||||
|
||||
theval : Integer;
|
||||
|
||||
end DefSwitch;
|
24
src/IGESData/IGESData_DefSwitch.cxx
Executable file
24
src/IGESData/IGESData_DefSwitch.cxx
Executable file
@@ -0,0 +1,24 @@
|
||||
#include <IGESData_DefSwitch.ixx>
|
||||
|
||||
// DefSwitch : represente une definition, soit vide (-> valeur = 0),
|
||||
// soit comme rang dans une table (-> valeur > 0 ce rang),
|
||||
// soit comme reference (-> valeur < 0), la reference elle-meme est ailleurs
|
||||
|
||||
|
||||
IGESData_DefSwitch::IGESData_DefSwitch () { theval = 0; }
|
||||
|
||||
void IGESData_DefSwitch::SetVoid () { theval = 0; }
|
||||
|
||||
void IGESData_DefSwitch::SetReference () { theval = -1; }
|
||||
|
||||
void IGESData_DefSwitch::SetRank (const Standard_Integer val)
|
||||
{ theval = val; }
|
||||
|
||||
IGESData_DefType IGESData_DefSwitch::DefType () const
|
||||
{
|
||||
if (theval < 0) return IGESData_DefReference;
|
||||
if (theval > 0) return IGESData_DefValue;
|
||||
return IGESData_DefVoid;
|
||||
}
|
||||
|
||||
Standard_Integer IGESData_DefSwitch::Value () const { return theval; }
|
48
src/IGESData/IGESData_DefaultGeneral.cdl
Executable file
48
src/IGESData/IGESData_DefaultGeneral.cdl
Executable file
@@ -0,0 +1,48 @@
|
||||
-- File: IGESData_DefaultGeneral.cdl
|
||||
-- Created: Wed Sep 8 16:41:51 1993
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class DefaultGeneral from IGESData inherits GeneralModule from IGESData
|
||||
|
||||
---Purpose : Processes the specific case of UndefinedEntity from IGESData
|
||||
-- (Case Number 1)
|
||||
|
||||
uses OStream, Transient,
|
||||
InterfaceModel, Check, ShareTool, EntityIterator, CopyTool,
|
||||
IGESEntity, DirChecker
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable DefaultGeneral;
|
||||
---Purpose : Creates a DefaultGeneral and puts it into GeneralLib,
|
||||
-- bound with a Protocol from IGESData
|
||||
|
||||
OwnSharedCase (me; CN : Integer; ent : IGESEntity;
|
||||
iter : in out EntityIterator);
|
||||
---Purpose : Lists the Entities shared by an IGESEntity, which must be
|
||||
-- an UndefinedEntity
|
||||
|
||||
|
||||
DirChecker (me; CN : Integer; ent : IGESEntity) returns DirChecker;
|
||||
---Purpose : Returns a DirChecker, specific for each type of Entity
|
||||
-- Here, Returns an empty DirChecker (no constraint to check)
|
||||
|
||||
OwnCheckCase (me; CN : Integer; ent : IGESEntity; shares : ShareTool;
|
||||
ach : in out Check);
|
||||
---Purpose : Performs Specific Semantic Check for each type of Entity
|
||||
-- Here, does nothing (no constraint to check)
|
||||
|
||||
|
||||
NewVoid (me; CN : Integer; entto : out mutable Transient)
|
||||
returns Boolean;
|
||||
---Purpose : Specific creation of a new void entity (UndefinedEntity only)
|
||||
|
||||
OwnCopyCase (me; CN : Integer;
|
||||
entfrom : IGESEntity; entto : mutable IGESEntity;
|
||||
TC : in out CopyTool);
|
||||
---Purpose : Copies parameters which are specific of each Type of Entity
|
||||
|
||||
end DefaultGeneral;
|
73
src/IGESData/IGESData_DefaultGeneral.cxx
Executable file
73
src/IGESData/IGESData_DefaultGeneral.cxx
Executable file
@@ -0,0 +1,73 @@
|
||||
#include <IGESData_DefaultGeneral.ixx>
|
||||
#include <IGESData_UndefinedEntity.hxx>
|
||||
#include <IGESData_FreeFormatEntity.hxx>
|
||||
#include <TColStd_HSequenceOfInteger.hxx>
|
||||
#include <Interface_UndefinedContent.hxx>
|
||||
#include <Interface_GeneralLib.hxx>
|
||||
#include <IGESData.hxx>
|
||||
#include <IGESData_Protocol.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
|
||||
IGESData_DefaultGeneral::IGESData_DefaultGeneral ()
|
||||
{ Interface_GeneralLib::SetGlobal(this, IGESData::Protocol()); }
|
||||
|
||||
void IGESData_DefaultGeneral::OwnSharedCase
|
||||
(const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
|
||||
Interface_EntityIterator& iter) const
|
||||
{
|
||||
if (CN == 0) return;
|
||||
DeclareAndCast(IGESData_UndefinedEntity,anent,ent);
|
||||
if (anent.IsNull()) return;
|
||||
Handle(Interface_UndefinedContent) cont = anent->UndefinedContent();
|
||||
Standard_Integer nb = cont->NbParams();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
if (cont->IsParamEntity(i)) iter.GetOneItem (cont->ParamEntity(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IGESData_DirChecker IGESData_DefaultGeneral::DirChecker
|
||||
(const Standard_Integer , const Handle(IGESData_IGESEntity)& ) const
|
||||
{ IGESData_DirChecker dc; return dc; } // aucun critere specifique
|
||||
|
||||
|
||||
void IGESData_DefaultGeneral::OwnCheckCase
|
||||
(const Standard_Integer , const Handle(IGESData_IGESEntity)& ,
|
||||
const Interface_ShareTool& , Handle(Interface_Check)& ) const
|
||||
{ } // aucun critere specifique
|
||||
|
||||
|
||||
Standard_Boolean IGESData_DefaultGeneral::NewVoid
|
||||
(const Standard_Integer CN, Handle(Standard_Transient)& entto) const
|
||||
{
|
||||
entto.Nullify();
|
||||
if (CN == 0) return Standard_False;
|
||||
if (CN == 1) entto = new IGESData_UndefinedEntity;
|
||||
if (CN == 2) entto = new IGESData_FreeFormatEntity;
|
||||
return (!entto.IsNull());
|
||||
}
|
||||
|
||||
void IGESData_DefaultGeneral::OwnCopyCase
|
||||
(const Standard_Integer CN,
|
||||
const Handle(IGESData_IGESEntity)& entfrom,
|
||||
const Handle(IGESData_IGESEntity)& entto,
|
||||
Interface_CopyTool& TC) const
|
||||
{
|
||||
if (CN == 0) return;
|
||||
DeclareAndCast(IGESData_UndefinedEntity,enfr,entfrom);
|
||||
DeclareAndCast(IGESData_UndefinedEntity,ento,entto);
|
||||
// ShallowCopy aura passe DirStatus
|
||||
// transmettre les contenus des UndefinedContents
|
||||
Handle(Interface_UndefinedContent) cont = new Interface_UndefinedContent;
|
||||
cont->GetFromAnother(enfr->UndefinedContent(),TC);
|
||||
ento->SetNewContent (cont);
|
||||
// FreeFormat, encore des choses
|
||||
if (enfr->IsKind(STANDARD_TYPE(IGESData_FreeFormatEntity))) {
|
||||
DeclareAndCast(IGESData_FreeFormatEntity,enf,entfrom);
|
||||
DeclareAndCast(IGESData_FreeFormatEntity,ent,entto);
|
||||
ent->ClearNegativePointers();
|
||||
ent->AddNegativePointers(enf->NegativePointers());
|
||||
}
|
||||
}
|
26
src/IGESData/IGESData_DefaultSpecific.cdl
Executable file
26
src/IGESData/IGESData_DefaultSpecific.cdl
Executable file
@@ -0,0 +1,26 @@
|
||||
-- File: IGESData_DefaultSpecific.cdl
|
||||
-- Created: Wed Sep 8 16:47:25 1993
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class DefaultSpecific from IGESData inherits SpecificModule
|
||||
|
||||
---Purpose : Specific IGES Services for UndefinedEntity, FreeFormatEntity
|
||||
|
||||
uses IGESEntity, IGESDumper,
|
||||
Messenger from Message
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable DefaultSpecific;
|
||||
---Purpose : Creates a DefaultSpecific and puts it into SpecificLib
|
||||
|
||||
OwnDump (me; CN : Integer; ent : IGESEntity;
|
||||
dumper : IGESDumper; S : Messenger from Message; own : Integer);
|
||||
---Purpose : Specific Dump for UndefinedEntity : it concerns only
|
||||
-- own parameters, the general data (Directory Part, Lists) are
|
||||
-- taken into account by the IGESDumper
|
||||
|
||||
end DefaultSpecific;
|
42
src/IGESData/IGESData_DefaultSpecific.cxx
Executable file
42
src/IGESData/IGESData_DefaultSpecific.cxx
Executable file
@@ -0,0 +1,42 @@
|
||||
#include <IGESData_DefaultSpecific.ixx>
|
||||
#include <IGESData_UndefinedEntity.hxx>
|
||||
#include <Interface_UndefinedContent.hxx>
|
||||
#include <IGESData_SpecificLib.hxx>
|
||||
#include <IGESData.hxx>
|
||||
#include <IGESData_Protocol.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
|
||||
|
||||
IGESData_DefaultSpecific::IGESData_DefaultSpecific ()
|
||||
{ IGESData_SpecificLib::SetGlobal(this, IGESData::Protocol()); }
|
||||
|
||||
void IGESData_DefaultSpecific::OwnDump
|
||||
(const Standard_Integer /*CN*/, const Handle(IGESData_IGESEntity)& ent,
|
||||
const IGESData_IGESDumper& dumper, const Handle(Message_Messenger)& S,
|
||||
const Standard_Integer /*own*/) const
|
||||
{
|
||||
DeclareAndCast(IGESData_UndefinedEntity,lent,ent);
|
||||
if (lent.IsNull()) return;
|
||||
|
||||
Standard_Integer dstat = lent->DirStatus();
|
||||
if (dstat != 0) S
|
||||
<< " -- Directory Entry Error Status = " << dstat << " --" << endl;
|
||||
Handle(Interface_UndefinedContent) cont = lent->UndefinedContent();
|
||||
Standard_Integer nb = cont->NbParams();
|
||||
S << " UNDEFINED ENTITY ...\n"<<nb
|
||||
<<" Parameters (WARNING : Odd Integer Values Interpreted as Entities)\n";
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
Interface_ParamType ptyp = cont->ParamType(i);
|
||||
if (ptyp == Interface_ParamVoid) S<<" ["<<i<<":Void]";
|
||||
else if (cont->IsParamEntity(i)) {
|
||||
DeclareAndCast(IGESData_IGESEntity,anent,cont->ParamEntity(i));
|
||||
S<<" ["<<i<<":IGES]=";
|
||||
dumper.PrintDNum(anent,S);
|
||||
}
|
||||
else { S<<" ["<<i<<"]=" << cont->ParamValue(i); }
|
||||
if ( i == (i%5)*5) S << endl;
|
||||
}
|
||||
S << endl;
|
||||
}
|
155
src/IGESData/IGESData_DirChecker.cdl
Executable file
155
src/IGESData/IGESData_DirChecker.cdl
Executable file
@@ -0,0 +1,155 @@
|
||||
-- File: DirChecker.cdl
|
||||
-- Created: Tue Nov 10 10:37:47 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@topsn2>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class DirChecker from IGESData
|
||||
|
||||
---Purpose : This class centralizes general Checks upon an IGES Entity's
|
||||
-- Directory Part. That is : such field Ignored or Required,
|
||||
-- or Required with a given Value (for an Integer field)
|
||||
-- More precise checks can be performed as necessary, by each
|
||||
-- Entity (method OwnCheck).
|
||||
--
|
||||
-- Each class of Entity defines its DirChecker (method DirChecker)
|
||||
-- and the DirChecker is able to perform its Checks on an Entity
|
||||
--
|
||||
-- A Required Value or presence of a field causes a Fail Message
|
||||
-- if criterium is not satisfied
|
||||
-- An Ignored field causes a Correction Message if the field is
|
||||
-- not null/zero
|
||||
|
||||
uses Integer, Check, IGESEntity, DefType
|
||||
|
||||
is
|
||||
|
||||
Create returns DirChecker;
|
||||
---Purpose : Returns a DirChecker, with no criterium at all to be checked
|
||||
|
||||
Create (atype : Integer) returns DirChecker;
|
||||
---Purpose : Returns a DirChecker, with no criterium except Required Type
|
||||
|
||||
Create (atype, aform : Integer) returns DirChecker;
|
||||
---Purpose : Returns a DirChecker, with no criterium except Required values
|
||||
-- for Type and Form numbers
|
||||
|
||||
Create (atype, aform1, aform2 : Integer) returns DirChecker;
|
||||
---Purpose : Returns a DirChecker, with no criterium except Required values
|
||||
-- for Type number (atype), and Required Range for Form number
|
||||
-- (which must be between aform1 and aform2 included)
|
||||
|
||||
IsSet (me) returns Boolean is static;
|
||||
---Purpose : Returns True if at least one criterium has already been set
|
||||
-- Allows user to store a DirChecker (static variable) then ask
|
||||
-- if it has been set before setting it
|
||||
|
||||
SetDefault (me : in out) is static;
|
||||
---Purpose : Sets a DirChecker with most current criteria, that is :
|
||||
-- Structure Ignored ( worths call Structure(crit = DefVoid) )
|
||||
|
||||
Structure (me : in out; crit : DefType) is static;
|
||||
---Purpose : Sets Structure criterium.
|
||||
-- If crit is DefVoid, Ignored : should not be defined
|
||||
-- If crit is DefReference, Required : must be defined
|
||||
-- Other values are not taken in account
|
||||
|
||||
LineFont (me : in out; crit : DefType) is static;
|
||||
---Purpose : Sets LineFont criterium
|
||||
-- If crit is DefVoid, Ignored : should not be defined
|
||||
-- If crit is DefAny, Required : must be defined (value or ref)
|
||||
-- If crit is DefValue, Required as a Value (error if Reference)
|
||||
-- Other values are not taken in account
|
||||
|
||||
LineWeight (me : in out; crit : DefType) is static;
|
||||
---Purpose : Sets LineWeight criterium
|
||||
-- If crit is DefVoid, Ignored : should not be defined
|
||||
-- If crit is DefValue, Required
|
||||
-- Other values are not taken in account
|
||||
|
||||
Color (me : in out; crit : DefType) is static;
|
||||
---Purpose : Sets Color criterium
|
||||
-- If crit is DefVoid, Ignored : should not be defined
|
||||
-- If crit is DefAny, Required : must be defined (value or ref)
|
||||
-- Other values are not taken in account
|
||||
|
||||
GraphicsIgnored (me : in out; hierarchy : Integer = -1) is static;
|
||||
---Purpose : Sets Graphics data (LineFont, LineWeight, Color, Level, View)
|
||||
-- to be ignored according value of Hierarchy status :
|
||||
-- If hierarchy is not given, they are Ignored any way
|
||||
-- (that is, they should not be defined)
|
||||
-- If hierarchy is given, Graphics are Ignored if the Hierarchy
|
||||
-- status has the value given in argument "hierarchy"
|
||||
|
||||
|
||||
BlankStatusIgnored (me : in out) is static;
|
||||
---Purpose : Sets Blank Status to be ignored
|
||||
-- (should not be defined, or its value should be 0)
|
||||
|
||||
BlankStatusRequired (me : in out; val : Integer) is static;
|
||||
---Purpose : Sets Blank Status to be required at a given value
|
||||
|
||||
SubordinateStatusIgnored (me : in out) is static;
|
||||
---Purpose : Sets Subordinate Status to be ignored
|
||||
-- (should not be defined, or its value should be 0)
|
||||
|
||||
SubordinateStatusRequired (me : in out; val : Integer) is static;
|
||||
---Purpose : Sets Subordinate Status to be required at a given value
|
||||
|
||||
UseFlagIgnored (me : in out) is static;
|
||||
---Purpose : Sets Blank Status to be ignored
|
||||
-- (should not be defined, or its value should be 0)
|
||||
|
||||
UseFlagRequired (me : in out; val : Integer) is static;
|
||||
---Purpose : Sets Blank Status to be required at a given value
|
||||
-- Give -1 to demand UseFlag not zero (but no precise value req.)
|
||||
|
||||
HierarchyStatusIgnored (me : in out) is static;
|
||||
---Purpose : Sets Hierarchy Status to be ignored
|
||||
-- (should not be defined, or its value should be 0)
|
||||
|
||||
HierarchyStatusRequired (me : in out; val : Integer) is static;
|
||||
---Purpose : Sets Hierarchy Status to be required at a given value
|
||||
|
||||
-- -- Checking -- --
|
||||
|
||||
Check (me; ach : in out Check; ent : IGESEntity) is static;
|
||||
---Purpose : Performs the Checks on an IGESEntity, according to the
|
||||
-- recorded criteria
|
||||
-- In addition, does minimal Checks, such as admitted range for
|
||||
-- Status, or presence of Error status in some data (Color, ...)
|
||||
|
||||
CheckTypeAndForm (me; ach : in out Check; ent : IGESEntity) is static;
|
||||
---Purpose : Performs a Check only on Values of Type Number and Form Number
|
||||
-- This allows to do a check on an Entity not yet completely
|
||||
-- filled but of which Type and Form Number have been already set
|
||||
|
||||
Correct (me; ent : mutable IGESEntity) returns Boolean is static;
|
||||
---Purpose : Corrects the Directory Entry of an IGES Entity as far as it is
|
||||
-- possible according recorded criteria without any ambiguity :
|
||||
-- - if a numeric Status is required a given value, this value is
|
||||
-- enforced
|
||||
-- - if an item is required to be Void, or if it recorded as
|
||||
-- Erroneous, it is cleared (set to Void)
|
||||
-- - Type Number is enforced
|
||||
-- - finally Form Number is enforced only if one and only Value
|
||||
-- is admitted (no range, see Constructors of DirChecker)
|
||||
|
||||
fields
|
||||
|
||||
isitset : Boolean; -- allows user to test if a DirChecked is set or not
|
||||
thetype : Integer;
|
||||
theform1 : Integer;
|
||||
theform2 : Integer;
|
||||
thestructure : DefType;
|
||||
thelinefont : DefType;
|
||||
thelineweig : DefType;
|
||||
thecolor : DefType;
|
||||
thegraphier : Integer; -- (graphics/heirarchy)
|
||||
theblankst : Integer;
|
||||
thesubordst : Integer;
|
||||
theuseflag : Integer;
|
||||
thehierst : Integer;
|
||||
|
||||
end DirChecker;
|
471
src/IGESData/IGESData_DirChecker.cxx
Executable file
471
src/IGESData/IGESData_DirChecker.cxx
Executable file
@@ -0,0 +1,471 @@
|
||||
#include <IGESData_DirChecker.ixx>
|
||||
#include <IGESData_DefList.hxx>
|
||||
#include <stdio.h>
|
||||
|
||||
// Pour Correct :
|
||||
#include <IGESData_ViewKindEntity.hxx>
|
||||
#include <IGESData_LineFontEntity.hxx>
|
||||
#include <IGESData_LevelListEntity.hxx>
|
||||
#include <IGESData_ColorEntity.hxx>
|
||||
#include <IGESData_LabelDisplayEntity.hxx>
|
||||
|
||||
// MGE 23/07/98
|
||||
#include <Message_Msg.hxx>
|
||||
|
||||
// Chaque critere est par defaut inhibe
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IGESData_DirChecker
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
IGESData_DirChecker::IGESData_DirChecker ()
|
||||
{
|
||||
thetype = theform1 = theform2 = 0;
|
||||
thestructure = thelinefont = thelineweig = thecolor = IGESData_ErrorRef;
|
||||
thegraphier = -100; // ne pas tester GraphicsIgnored
|
||||
theblankst = thesubordst = theuseflag = thehierst = -100; // ne pas tester
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IGESData_DirChecker
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
IGESData_DirChecker::IGESData_DirChecker (const Standard_Integer atype)
|
||||
{
|
||||
thetype = atype; theform1 = 0; theform2 = -1; // test de forme inhibe
|
||||
thestructure = thelinefont = thelineweig = thecolor = IGESData_ErrorRef;
|
||||
thegraphier = -100; // ne pas tester GraphicsIgnored
|
||||
theblankst = thesubordst = theuseflag = thehierst = -100; // ne pas tester
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IGESData_DirChecker
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
IGESData_DirChecker::IGESData_DirChecker(const Standard_Integer atype,
|
||||
const Standard_Integer aform)
|
||||
{
|
||||
thetype = atype; theform1 = theform2 = aform; // forme : valeur requise
|
||||
thestructure = thelinefont = thelineweig = thecolor = IGESData_ErrorRef;
|
||||
thegraphier = -100; // ne pas tester GraphicsIgnored
|
||||
theblankst = thesubordst = theuseflag = thehierst = -100; // ne pas tester
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IGESData_DirChecker
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
IGESData_DirChecker::IGESData_DirChecker(const Standard_Integer atype,
|
||||
const Standard_Integer aform1,
|
||||
const Standard_Integer aform2)
|
||||
{
|
||||
thetype = atype; theform1 = aform1; theform2 = aform2; // forme : [...]
|
||||
thestructure = thelinefont = thelineweig = thecolor = IGESData_ErrorRef;
|
||||
thegraphier = -100; // ne pas tester GraphicsIgnored
|
||||
theblankst = thesubordst = theuseflag = thehierst = -100; // ne pas tester
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsSet
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean IGESData_DirChecker::IsSet () const
|
||||
{
|
||||
return isitset;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDefault
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_DirChecker::SetDefault ()
|
||||
{
|
||||
Structure(IGESData_DefVoid);
|
||||
} // Option par defaut
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Structure
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_DirChecker::Structure (const IGESData_DefType crit)
|
||||
{
|
||||
isitset = Standard_True;
|
||||
thestructure = crit;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : LineFont
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_DirChecker::LineFont (const IGESData_DefType crit)
|
||||
{
|
||||
isitset = Standard_True;
|
||||
thelinefont = crit;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : LineWeight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_DirChecker::LineWeight (const IGESData_DefType crit)
|
||||
{
|
||||
isitset = Standard_True;
|
||||
thelineweig = crit;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Color
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_DirChecker::Color (const IGESData_DefType crit)
|
||||
{
|
||||
isitset = Standard_True;
|
||||
thecolor = crit;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GraphicsIgnored
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_DirChecker::GraphicsIgnored (const Standard_Integer hierarchy)
|
||||
{
|
||||
isitset = Standard_True;
|
||||
thegraphier = hierarchy;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BlankStatusIgnored
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_DirChecker::BlankStatusIgnored ()
|
||||
{
|
||||
isitset = Standard_True;
|
||||
theblankst = -10;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BlankStatusRequired
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_DirChecker::BlankStatusRequired (const Standard_Integer val)
|
||||
{
|
||||
isitset = Standard_True;
|
||||
theblankst = val;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SubordinateStatusIgnored
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_DirChecker::SubordinateStatusIgnored ()
|
||||
{
|
||||
isitset = Standard_True;
|
||||
thesubordst = -10;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SubordinateStatusRequired
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_DirChecker::SubordinateStatusRequired(const Standard_Integer val)
|
||||
{
|
||||
isitset = Standard_True;
|
||||
thesubordst = val;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : UseFlagIgnored
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_DirChecker::UseFlagIgnored ()
|
||||
{
|
||||
isitset = Standard_True;
|
||||
theuseflag = -10;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : UseFlagRequired
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_DirChecker::UseFlagRequired (const Standard_Integer val)
|
||||
{
|
||||
isitset = Standard_True;
|
||||
theuseflag = val;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : HierarchyStatusIgnored
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_DirChecker::HierarchyStatusIgnored ()
|
||||
{
|
||||
isitset = Standard_True;
|
||||
thehierst = -10;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : HierarchyStatusRequired
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_DirChecker::HierarchyStatusRequired (const Standard_Integer val)
|
||||
{
|
||||
isitset = Standard_True;
|
||||
thehierst = val;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Check
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_DirChecker::Check(Handle(Interface_Check)& ach,
|
||||
const Handle(IGESData_IGESEntity)& ent) const
|
||||
{
|
||||
// MGE 23/07/98
|
||||
// =====================================
|
||||
//Message_Msg Msg58 ("XSTEP_58");
|
||||
//Message_Msg Msg59 ("XSTEP_59");
|
||||
//Message_Msg Msg60 ("XSTEP_60");
|
||||
//Message_Msg Msg65 ("XSTEP_65");
|
||||
//Message_Msg Msg66 ("XSTEP_66");
|
||||
//Message_Msg Msg67 ("XSTEP_67");
|
||||
//Message_Msg Msg68 ("XSTEP_68");
|
||||
//Message_Msg Msg69 ("XSTEP_69");
|
||||
//Message_Msg Msg70 ("XSTEP_70");
|
||||
//Message_Msg Msg71 ("XSTEP_71");
|
||||
// =====================================
|
||||
|
||||
if (thetype != 0)
|
||||
{
|
||||
// Sending of message : Entity Type Number field is incorrect.
|
||||
if (ent->TypeNumber() != thetype) {
|
||||
Message_Msg Msg58 ("XSTEP_58");
|
||||
ach->SendFail(Msg58);
|
||||
}
|
||||
|
||||
// Sending of message : Form Number field is incorrect.
|
||||
if (theform1 <= theform2) {
|
||||
if (ent->FormNumber() < theform1 || ent->FormNumber() > theform2) {
|
||||
Message_Msg Msg71 ("XSTEP_71");
|
||||
ach->SendFail(Msg71);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sending of message : Structure field is undefined.
|
||||
if (thestructure == IGESData_DefReference && !ent->HasStructure()) {
|
||||
Message_Msg Msg59 ("XSTEP_59");
|
||||
ach->SendFail (Msg59);
|
||||
}
|
||||
|
||||
if (thegraphier == -1 || thegraphier == ent->HierarchyStatus()) { }
|
||||
else {
|
||||
IGESData_DefType df = ent->DefLineFont();
|
||||
|
||||
// Sending of message : Line Font Pattern field is incorrect
|
||||
if (df == IGESData_ErrorVal || df == IGESData_ErrorRef) {
|
||||
Message_Msg Msg60 ("XSTEP_60");
|
||||
ach->SendFail (Msg60);
|
||||
}
|
||||
else if (thelinefont == IGESData_DefValue && df != IGESData_DefValue) {
|
||||
Message_Msg Msg60 ("XSTEP_60");
|
||||
ach->SendWarning (Msg60);
|
||||
}
|
||||
|
||||
Standard_Integer dlw = ent->LineWeightNumber();
|
||||
Message_Msg Msg69 ("XSTEP_69");
|
||||
// Sending of message : Line Weight Number is undefined.
|
||||
if (thelineweig == IGESData_DefValue && dlw == 0) {
|
||||
// Message_Msg Msg69 ("XSTEP_69");
|
||||
ach->SendWarning (Msg69);
|
||||
}
|
||||
|
||||
df = ent->DefColor();
|
||||
|
||||
// Sending of message : Color Number field is incorrect.
|
||||
if (df == IGESData_ErrorVal || df == IGESData_ErrorRef) {
|
||||
// Message_Msg Msg69 ("XSTEP_69");
|
||||
ach->SendFail (Msg69);
|
||||
}
|
||||
else if (thecolor == IGESData_DefValue && df != IGESData_DefValue) {
|
||||
// Message_Msg Msg69 ("XSTEP_69");
|
||||
ach->SendWarning (Msg69);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer st = ent->BlankStatus();
|
||||
|
||||
// Sending of message : Blank Status field is incorrect.
|
||||
if (st < 0 || st > 1) {
|
||||
Message_Msg Msg65 ("XSTEP_65");
|
||||
ach->SendFail (Msg65);
|
||||
}
|
||||
|
||||
st = ent->SubordinateStatus();
|
||||
|
||||
// Sending of message : Subordinate Entity Switch field is incorrect.
|
||||
if (st < 0 || st > 3) {
|
||||
Message_Msg Msg66 ("XSTEP_66");
|
||||
ach->SendFail(Msg66);
|
||||
}
|
||||
|
||||
st = ent->UseFlag();
|
||||
|
||||
// Send of message : Entity Use Flag is incorrect.
|
||||
if (st < 0 || st > 5) {
|
||||
Message_Msg Msg67 ("XSTEP_67");
|
||||
ach->SendFail(Msg67);
|
||||
}
|
||||
|
||||
st = ent->HierarchyStatus();
|
||||
|
||||
//Sending of message : Hierarchy field is incorrect.
|
||||
if (st < 0 || st > 2) {
|
||||
Message_Msg Msg68 ("XSTEP_68");
|
||||
ach->SendFail(Msg68);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckTypeAndForm
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_DirChecker::CheckTypeAndForm(Handle(Interface_Check)& ach,
|
||||
const Handle(IGESData_IGESEntity)& ent) const
|
||||
{
|
||||
// CKY 30 NOV 2001 : This method is called for immediate check on reading
|
||||
// But an entity which can be read has ben already recognized.
|
||||
// To produce a FAIL here is interpreted as "FAIL ON LOADING", which is
|
||||
// not true (the entity has been recognized then properly loaded)
|
||||
// Consequence (among other) : the entity is not explored by graph of dep.s
|
||||
// so numerous "false roots" are detected
|
||||
// Alternative to switch Fail to Warning here, should be to withdraw the calls
|
||||
// to that method by all the "ReadOwn" methods, but it's heavier
|
||||
// ANYWAY, the full Check method produces a Fail if Type/Form is not in scope,
|
||||
// so it is well interpreted as "Syntactic error"
|
||||
|
||||
// MGE 23/07/98
|
||||
// =====================================
|
||||
// Message_Msg Msg58 ("XSTEP_58");
|
||||
// Message_Msg Msg71 ("XSTEP_71");
|
||||
// =====================================
|
||||
//char mess[80]; //szv#4:S4163:12Mar99 unused
|
||||
if (thetype != 0)
|
||||
{
|
||||
if (ent->TypeNumber() != thetype){
|
||||
Message_Msg Msg58 ("XSTEP_58");
|
||||
ach->SendWarning(Msg58);
|
||||
}
|
||||
|
||||
if (theform1 <= theform2)
|
||||
if (ent->FormNumber() < theform1 || ent->FormNumber() > theform2) {
|
||||
Message_Msg Msg71 ("XSTEP_71");
|
||||
ach->SendWarning(Msg71);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Correct
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean IGESData_DirChecker::Correct
|
||||
(const Handle(IGESData_IGESEntity)& ent) const
|
||||
{
|
||||
Standard_Boolean done = Standard_False;
|
||||
Standard_Integer type = ent->TypeNumber();
|
||||
Standard_Integer form = ent->FormNumber();
|
||||
if (thetype != 0) {
|
||||
if (theform1 >= 0 && theform1 == theform2 && theform1 != form)
|
||||
{ ent->InitTypeAndForm (thetype,theform1); done = Standard_True; }
|
||||
else if (thetype != type)
|
||||
{ ent->InitTypeAndForm (thetype,form); done = Standard_True; }
|
||||
}
|
||||
|
||||
Handle(IGESData_IGESEntity) structure; // par defaut Nulle
|
||||
if (thestructure != IGESData_DefVoid) structure = ent->Structure();
|
||||
Handle(IGESData_ViewKindEntity) nulview;
|
||||
Handle(IGESData_LineFontEntity) nulfont;
|
||||
Handle(IGESData_LevelListEntity) nulevel;
|
||||
Handle(IGESData_ColorEntity) nulcolor;
|
||||
Handle(IGESData_LabelDisplayEntity) label; // par defaut Nulle
|
||||
if (thegraphier != -1) label = ent->LabelDisplay();
|
||||
Standard_Integer linew = 0;
|
||||
if (thegraphier != -1 && thelineweig != IGESData_DefVoid)
|
||||
linew = ent->LineWeightNumber();
|
||||
|
||||
if (thegraphier == -1 ||
|
||||
(ent->RankLineFont() != 0 && thelinefont == IGESData_DefVoid) )
|
||||
{ ent->InitLineFont(nulfont); done = Standard_True; }
|
||||
if (thegraphier == -1 ||
|
||||
(ent->RankColor() != 0 && thecolor == IGESData_DefVoid) )
|
||||
{ ent->InitColor(nulcolor); done = Standard_True; }
|
||||
if (thegraphier == -1 &&
|
||||
(!ent->View().IsNull() || ent->Level() != 0) )
|
||||
{ ent->InitView(nulview); ent->InitLevel(nulevel); done = Standard_True; }
|
||||
if ((thegraphier == -1 &&
|
||||
(!ent->LabelDisplay().IsNull() || ent->LineWeightNumber() != 0)) ||
|
||||
(ent->HasStructure() && thestructure == IGESData_DefVoid) ) // combines :
|
||||
{ ent->InitMisc (structure,label,linew); done = Standard_True; }
|
||||
|
||||
Standard_Boolean force = Standard_False;
|
||||
Standard_Integer stb = ent->BlankStatus();
|
||||
Standard_Integer sts = ent->SubordinateStatus();
|
||||
Standard_Integer stu = ent->UseFlag();
|
||||
Standard_Integer sth = ent->HierarchyStatus();
|
||||
if (theblankst >= 0 && theblankst != stb)
|
||||
{ force = Standard_True; stb = theblankst; }
|
||||
if (thesubordst >= 0 && thesubordst != sts)
|
||||
{ force = Standard_True; sts = thesubordst; }
|
||||
if (theuseflag >= 0 && theuseflag != stu)
|
||||
{ force = Standard_True; stu = theuseflag; }
|
||||
if (thehierst >= 0 && thehierst != sth)
|
||||
{ force = Standard_True; sth = thehierst; }
|
||||
if (force) { ent->InitStatus(stb,sts,stu,sth); done = Standard_True; }
|
||||
return done;
|
||||
}
|
42
src/IGESData/IGESData_DirPart.cdl
Executable file
42
src/IGESData/IGESData_DirPart.cdl
Executable file
@@ -0,0 +1,42 @@
|
||||
-- File: DirPart.cdl
|
||||
-- Created: Mon Apr 6 14:27:54 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class DirPart from IGESData inherits Storable -- for Array
|
||||
|
||||
---Purpose : litteral/numeric description of an entity's directory section,
|
||||
-- taken from file
|
||||
|
||||
uses Integer, Character, IGESType
|
||||
|
||||
is
|
||||
|
||||
Create returns DirPart;
|
||||
---Purpose : creates an empty DirPart, ready to be filled by Init
|
||||
|
||||
Init (me : in out;
|
||||
i1,i2,i3,i4,i5,i6,i7,i8,i9,i19,i11,i12,i13,i14,i15,i16,i17 : Integer;
|
||||
res1,res2,label,subscript : CString) is static;
|
||||
---Purpose : fills DirPart with consistant data read from file
|
||||
|
||||
Values (me;
|
||||
i1,i2,i3,i4,i5,i6,i7,i8,i9,i19,i11,i12,i13,i14,i15,i16,i17 : out Integer;
|
||||
res1,res2,label,subscript : CString) is static;
|
||||
---Purpose : returns values recorded in DirPart
|
||||
-- (content of cstrings are modified)
|
||||
|
||||
Type (me) returns IGESType is static;
|
||||
---Purpose : returns "type" and "form" info, used to recognize the entity
|
||||
|
||||
fields
|
||||
|
||||
thevals : Integer[17];
|
||||
theres1 : Character[10];
|
||||
theres2 : Character[10];
|
||||
thelabl : Character[10];
|
||||
thesubs : Character[10];
|
||||
|
||||
end DirPart;
|
84
src/IGESData/IGESData_DirPart.cxx
Executable file
84
src/IGESData/IGESData_DirPart.cxx
Executable file
@@ -0,0 +1,84 @@
|
||||
#include <IGESData_DirPart.ixx>
|
||||
#include <Standard_PCharacter.hxx>
|
||||
|
||||
|
||||
|
||||
IGESData_DirPart::IGESData_DirPart () { }
|
||||
|
||||
void IGESData_DirPart::Init
|
||||
(const Standard_Integer i1, const Standard_Integer i2, const Standard_Integer i3, const Standard_Integer i4,
|
||||
const Standard_Integer i5, const Standard_Integer i6, const Standard_Integer i7, const Standard_Integer i8,
|
||||
const Standard_Integer i9, const Standard_Integer i10, const Standard_Integer i11,
|
||||
const Standard_Integer i12, const Standard_Integer i13, const Standard_Integer i14,
|
||||
const Standard_Integer i15, const Standard_Integer i16, const Standard_Integer i17,
|
||||
const Standard_CString res1, const Standard_CString res2,
|
||||
const Standard_CString label, const Standard_CString subscript)
|
||||
{
|
||||
thevals[ 0] = i1; thevals[ 1] = i2; thevals[ 2] = i3; thevals[ 3] = i4;
|
||||
thevals[ 4] = i5; thevals[ 5] = i6; thevals[ 6] = i7; thevals[ 7] = i8;
|
||||
thevals[ 8] = i9; thevals[ 9] = i10; thevals[10] = i11; thevals[11] = i12;
|
||||
thevals[12] = i13; thevals[13] = i14; thevals[14] = i15; thevals[15] = i16;
|
||||
thevals[16] = i17;
|
||||
for (Standard_Integer i = 0; i < 8; i ++) {
|
||||
theres1[i] = res1 [i]; theres2[i] = res2[i];
|
||||
thelabl[i] = label[i]; thesubs[i] = subscript[i];
|
||||
}
|
||||
theres1[8] = '\0'; theres2[8] = '\0'; thelabl[8] = '\0'; thesubs[8] = '\0';
|
||||
}
|
||||
|
||||
// CString : on modifie leur CONTENU, pas le POINTEUR LUI-MEME
|
||||
|
||||
//=======================================================================
|
||||
//function : Values
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IGESData_DirPart::Values (Standard_Integer& i1,
|
||||
Standard_Integer& i2,
|
||||
Standard_Integer& i3,
|
||||
Standard_Integer& i4,
|
||||
Standard_Integer& i5,
|
||||
Standard_Integer& i6,
|
||||
Standard_Integer& i7,
|
||||
Standard_Integer& i8,
|
||||
Standard_Integer& i9,
|
||||
Standard_Integer& i10,
|
||||
Standard_Integer& i11,
|
||||
Standard_Integer& i12,
|
||||
Standard_Integer& i13,
|
||||
Standard_Integer& i14,
|
||||
Standard_Integer& i15,
|
||||
Standard_Integer& i16,
|
||||
Standard_Integer& i17,
|
||||
const Standard_CString res1,
|
||||
const Standard_CString res2,
|
||||
const Standard_CString label,
|
||||
const Standard_CString subscript) const
|
||||
{
|
||||
Standard_PCharacter pres1, pres2, plabel, psubscript;
|
||||
Standard_Integer i;
|
||||
//
|
||||
pres1=(Standard_PCharacter)res1;
|
||||
pres2=(Standard_PCharacter)res2;
|
||||
plabel=(Standard_PCharacter)label;
|
||||
psubscript=(Standard_PCharacter)subscript;
|
||||
//
|
||||
i1 = thevals[ 0]; i2 = thevals[ 1]; i3 = thevals[ 2]; i4 = thevals[ 3];
|
||||
i5 = thevals[ 4]; i6 = thevals[ 5]; i7 = thevals[ 6]; i8 = thevals[ 7];
|
||||
i9 = thevals[ 8]; i10 = thevals[ 9]; i11 = thevals[10]; i12 = thevals[11];
|
||||
i13 = thevals[12]; i14 = thevals[13]; i15 = thevals[14]; i16 = thevals[15];
|
||||
i17 = thevals[16];
|
||||
for (i = 0; i < 8; ++i) {
|
||||
pres1 [i] = theres1[i];
|
||||
pres2 [i] = theres2[i];
|
||||
plabel[i] = thelabl[i];
|
||||
psubscript[i] = thesubs[i];
|
||||
}
|
||||
pres1[8] = '\0';
|
||||
pres2[8] = '\0';
|
||||
plabel[8] = '\0';
|
||||
psubscript[8] = '\0';
|
||||
}
|
||||
|
||||
|
||||
IGESData_IGESType IGESData_DirPart::Type () const
|
||||
{ return IGESData_IGESType(thevals[0],thevals[16]); } // type & forme
|
297
src/IGESData/IGESData_Dump.hxx
Executable file
297
src/IGESData/IGESData_Dump.hxx
Executable file
@@ -0,0 +1,297 @@
|
||||
// --------------------------
|
||||
// IGESData_Dump.hxx
|
||||
// --------------------------
|
||||
#include <gp_XY.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_XYZ.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_GTrsf.hxx>
|
||||
#include <Interface_MSG.hxx>
|
||||
|
||||
// ###############################################################
|
||||
//
|
||||
// Macros to help Dumping Parts of IGES Entities
|
||||
// (for usefull and repetitive cases but which apply to different classes
|
||||
// but with similar signatures, such as Arrays)
|
||||
// Remember that the class IGESDumper processes itself individual dump of
|
||||
// IGESEntity
|
||||
|
||||
// General Names are : IGESData_Dump***(S,arglist); S being an output Stream
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// AVAILABLE MACROS
|
||||
|
||||
// Dumping simple IGESEntity : see the class IGESDumper itself
|
||||
// Dumping a text as HAsciiString (either from PCollection or TCollection)
|
||||
// (manages an empty pointer) :
|
||||
// IGESData_DumpString(S,str) displays " "Content" " or "(undefined)"
|
||||
|
||||
// Dumping Simple Data : Level must be managed by the caller
|
||||
// (general rule : Transformed Display to be used if Level > 5)
|
||||
|
||||
// IGESData_DumpXY(S,XYval) " (Xval,Yval)" (no Transf)
|
||||
// IGESData_DumpXYT(S,XYVal,Trsf) " (Xval,Yval)" Z ignored
|
||||
// IGESData_DumpXYTZ(S,XYVal,Trsf,Z) " (Xval,Yval,Zval)" Z combined
|
||||
// IGESData_DumpXYZ(S,XYZval) " (Xval,Yval,Zval)" (no Transf)
|
||||
// IGESData_DumpXYZT(S,XYZval,Trsf) " (Xval,Yval,Zval)" (Transf)
|
||||
|
||||
// Dumping Simple Data with Level : first displays Immediate Value, then
|
||||
// if Level > 5 and Transformation is not Identity, displays Transformed Value
|
||||
|
||||
// IGESData_DumpXYL(S,Level,XYVal,Trsf) " (Xval,Yval) Transformed : (..)"
|
||||
// IGESData_DumpXYLZ(S,Level,XYVal,Trsf,Z) " (Xval,Yval,Zval) Transformed :."
|
||||
// IGESData_DumpXYZL(S,Level,XYZval,Trsf) " (Xval,Yval,Zval) Transformed :."
|
||||
|
||||
// Dumping Lists : general features
|
||||
// Lower and Upper are effective Values (immediate or given by functions).
|
||||
// Typically, give Lower = 1, Upper = ent->NbItems()
|
||||
// Item is the name of the access fonction (without its Index)
|
||||
// For Instance, Item = compcurve->Curve AND NOT compcurve->Curve(..)
|
||||
// If Level is present, it commands more or less extensive display :
|
||||
// Level = 4, only limits are displayed
|
||||
// If it is a classic list, starting from 1 with a count (which can be 0),
|
||||
// displays "Count <upper> ..." or "Empty". Else, display "(low - up) ..."
|
||||
// Level = 5, in addfition items are displayed shortly
|
||||
// (Entity Directory Numbers, XY/XYZ Coordinates)
|
||||
// Level > 5, in some cases, items are displayed with more details
|
||||
// (Entities with Type/Form, XY/XYZ with Transformed equivalents)
|
||||
|
||||
// IGESData_DumpListVal(S,Lower,Upper,Item) Item can be Real,Integer,
|
||||
// more generally, any type having operator << to Handle(Message_Messenger)
|
||||
// IGESData_DumpListXY(S,Lower,Upper,Item) Item : XY without Transformation
|
||||
// IGESData_DumpListXYZ(S,Lower,Upper,Item) Item : XYZ without Transf
|
||||
|
||||
// IGESData_DumpVals(S,Level,Lower,Upper,Item) Item : Real,Integer
|
||||
// IGESData_DumpListXYL(S,Level,Lower,Upper,Item,Trsf) Item : XY
|
||||
// IGESData_DumpListXYLZ(S,Level,Lower,Upper,Item,Trsf,Z) Item : XY. Z is a
|
||||
// Common Displacement
|
||||
// IGESData_DumpListXYZL(S,Level,Lower,Upper,Item,Trsf) Item : XYZ
|
||||
|
||||
// IGESData_DumpStrings(S,Level,Lower,Upper,Item) Item : HAsciiString
|
||||
// IGESData_DumpEntities(S,Dumper,Level,Lower,Upper,Item) Item : IGESEntity
|
||||
// Dumper is an IGESDumper which displays IGES Entities
|
||||
|
||||
// Dumping Complex Arrays : only the most useful cases are taken into account
|
||||
// Doubles Arrays (Rectangles) and Single Arrays of Single Arrays (Jagged)
|
||||
|
||||
// IGESData_DumpRectVals(S,Level,LowerRow,UpperRow,LowerCol,UpperCol,Item)
|
||||
// LowerRow,LowerCol,UpperRow,UpperCol : effective values
|
||||
// Item : Real,Integer
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
#define IGESData_DumpString(S,str) \
|
||||
if (str.IsNull()) S << "(undefined)";\
|
||||
else { S << '"' << str << '"'; }
|
||||
|
||||
#define IGESData_DumpXY(S,XYval) \
|
||||
S << " (" << XYval.X() << "," << XYval.Y() << ")"
|
||||
|
||||
#define IGESData_DumpXYZ(S,XYZval) \
|
||||
S << " (" << XYZval.X() << "," << XYZval.Y() << "," << XYZval.Z() << ")"
|
||||
|
||||
|
||||
#define IGESData_DumpXYT(S,XYval,Trsf) \
|
||||
{\
|
||||
gp_XYZ XYZval(XYval.X(),XYval.Y(),0.);\
|
||||
Trsf.Transforms(XYZval);\
|
||||
IGESData_DumpXY(S,XYZval);\
|
||||
}
|
||||
|
||||
#define IGESData_DumpXYTZ(S,XYval,Trsf,Z) \
|
||||
{\
|
||||
gp_XYZ XYZval(XYval.X(),XYval.Y(),Z);\
|
||||
Trsf.Transforms(XYZval);\
|
||||
IGESData_DumpXYZ(S,XYZval);\
|
||||
}
|
||||
|
||||
#define IGESData_DumpXYZT(S,XYZval,Trsf) \
|
||||
{\
|
||||
gp_XYZ XYZTval(XYZval.X(),XYZval.Y(),XYZval.Z());\
|
||||
Trsf.Transforms(XYZTval);\
|
||||
IGESData_DumpXYZ(S,XYZTval);\
|
||||
}
|
||||
|
||||
|
||||
#define IGESData_DumpXYL(S,Level,XYval,Trsf) \
|
||||
{\
|
||||
IGESData_DumpXY(S,XYval);\
|
||||
if (Level > 5 && Trsf.Form() != gp_Identity) {\
|
||||
S << " Transformed :";\
|
||||
IGESData_DumpXYT(S,XYval,Trsf);\
|
||||
}\
|
||||
}
|
||||
|
||||
#define IGESData_DumpXYLZ(S,Level,XYval,Trsf,Z) \
|
||||
{\
|
||||
IGESData_DumpXY(S,XYval);\
|
||||
if (Level > 5 && Trsf.Form() != gp_Identity) {\
|
||||
S << " Transformed :";\
|
||||
IGESData_DumpXYTZ(S,XYval,Trsf,Z);\
|
||||
}\
|
||||
}
|
||||
|
||||
#define IGESData_DumpXYZL(S,Level,XYZval,Trsf) \
|
||||
{\
|
||||
IGESData_DumpXYZ(S,XYZval);\
|
||||
if (Level > 5 && Trsf.Form() != gp_Identity) {\
|
||||
S << " Transformed :";\
|
||||
IGESData_DumpXYZT(S,XYZval,Trsf);\
|
||||
}\
|
||||
}
|
||||
|
||||
|
||||
#define IGESData_DumpListHeader(S,lower,upper) \
|
||||
{\
|
||||
if (lower > upper) S << " (Empty List)";\
|
||||
else if (lower == 1) S << " (Count : " << upper << ")";\
|
||||
else S << " (" << lower << " - " << upper << ")";\
|
||||
}
|
||||
|
||||
|
||||
#define IGESData_DumpListVal(S,lower,upper,item) \
|
||||
{\
|
||||
Standard_Integer lo = lower; Standard_Integer up = upper;\
|
||||
IGESData_DumpListHeader(S,lo,up);\
|
||||
S << " :";\
|
||||
for (Standard_Integer iopa = lo; iopa <= up; iopa ++) S << " " << item(iopa);\
|
||||
}
|
||||
|
||||
#define IGESData_DumpListXY(S,lower,upper,item) \
|
||||
{\
|
||||
Standard_Integer lo = lower; Standard_Integer up = upper;\
|
||||
IGESData_DumpListHeader(S,lo,up);\
|
||||
S << " :";\
|
||||
for (Standard_Integer iopa = lo; iopa <= up; iopa ++) IGESData_DumpXY(S,item(iopa));\
|
||||
}
|
||||
|
||||
#define IGESData_DumpListXYZ(S,lower,upper,item) \
|
||||
{\
|
||||
Standard_Integer lo = lower; Standard_Integer up = upper;\
|
||||
IGESData_DumpListHeader(S,lo,up);\
|
||||
S << " :";\
|
||||
for (Standard_Integer iopa = lo; iopa <= up; iopa ++) IGESData_DumpXYZ(S,item(iopa));\
|
||||
}
|
||||
|
||||
|
||||
#define IGESData_DumpVals(S,Level,lower,upper,item) \
|
||||
{\
|
||||
Standard_Integer lo = lower; Standard_Integer up = upper;\
|
||||
IGESData_DumpListHeader(S,lo,up);\
|
||||
if (lo > up) {}\
|
||||
else if (Level == 4 || Level == -4) S <<" [content : ask level > 4]";\
|
||||
else if (Level > 0) {\
|
||||
S << " :";\
|
||||
for (Standard_Integer iopa = lo; iopa <= up; iopa ++) S << " " << item(iopa);\
|
||||
}\
|
||||
}
|
||||
|
||||
#define IGESData_DumpListXYL(S,Level,lower,upper,item,Trsf) \
|
||||
{\
|
||||
Standard_Integer lo = lower; Standard_Integer up = upper;\
|
||||
IGESData_DumpListHeader(S,lo,up);\
|
||||
if (lo > up) {}\
|
||||
else if (Level == 4 || Level == -4)\
|
||||
S <<" [content : ask level > 4, transformed : level > 5]";\
|
||||
else if (Level > 0) {\
|
||||
S << " :";\
|
||||
for (Standard_Integer iopa = lo; iopa <= up; iopa ++) IGESData_DumpXY(S,item(iopa));\
|
||||
if (Trsf.Form() != gp_Identity) {\
|
||||
S<< "\n Transformed :";\
|
||||
if (Level == 5) S<<" [ask level > 5]";\
|
||||
else\
|
||||
for (Standard_Integer jopa = lo; jopa <= up; jopa ++)\
|
||||
IGESData_DumpXYT(S,item(jopa),Trsf);\
|
||||
}\
|
||||
}\
|
||||
}
|
||||
|
||||
#define IGESData_DumpListXYLZ(S,Level,lower,upper,item,Trsf,Z) \
|
||||
{\
|
||||
Standard_Integer lo = lower; Standard_Integer up = upper;\
|
||||
IGESData_DumpListHeader(S,lo,up);\
|
||||
if (lo > up) {}\
|
||||
else if (Level == 4 || Level == -4)\
|
||||
S <<" [content : ask level > 4, transformed : level > 5]";\
|
||||
else if (Level > 0) {\
|
||||
S << " :";\
|
||||
for (Standard_Integer iopa = lo; iopa <= up; iopa ++) IGESData_DumpXY(S,item(iopa));\
|
||||
if (Trsf.Form() != gp_Identity) {\
|
||||
S<< "\n Transformed :";\
|
||||
if (Level == 5) S<<" [ask level > 5]";\
|
||||
else\
|
||||
for (Standard_Integer jopa = lo; jopa <= up; jopa ++)\
|
||||
IGESData_DumpXYTZ(S,item(jopa),Trsf,Z);\
|
||||
}\
|
||||
}\
|
||||
}
|
||||
|
||||
|
||||
#define IGESData_DumpListXYZL(S,Level,lower,upper,item,Trsf) \
|
||||
{\
|
||||
Standard_Integer lo = lower; Standard_Integer up = upper;\
|
||||
IGESData_DumpListHeader(S,lo,up);\
|
||||
if (lo > up) {}\
|
||||
else if (Level == 4 || Level == -4)\
|
||||
S <<" [content : ask level > 4, transformed : level > 5]";\
|
||||
else if (Level > 0) {\
|
||||
S << " :";\
|
||||
for (Standard_Integer iopa = lo; iopa <= up; iopa ++) IGESData_DumpXYZ(S,item(iopa));\
|
||||
if (Trsf.Form() != gp_Identity) {\
|
||||
S<< "\n Transformed :";\
|
||||
if (Level == 5) S<<" [ask level > 5]";\
|
||||
else\
|
||||
for (Standard_Integer jopa = lo; jopa <= up; jopa ++)\
|
||||
IGESData_DumpXYZT(S,item(jopa),Trsf);\
|
||||
}\
|
||||
}\
|
||||
}
|
||||
|
||||
|
||||
#define IGESData_DumpStrings(S,Level,lower,upper,item) \
|
||||
{\
|
||||
Standard_Integer lo = lower; Standard_Integer up = upper;\
|
||||
IGESData_DumpListHeader(S,lo,up);\
|
||||
if (lo > up) {}\
|
||||
else if (Level == 4 || Level == -4) S <<" [content : ask level > 4]";\
|
||||
else if (Level > 0) {\
|
||||
S << " :";\
|
||||
for (Standard_Integer iopa = lo; iopa <= up; iopa ++)\
|
||||
{ S << "\n["<<Interface_MSG::Blanks(iopa,3)<<iopa<<"]:\"" << item(iopa) << '"'; }\
|
||||
S << "\n";\
|
||||
}\
|
||||
}
|
||||
|
||||
#define IGESData_DumpEntities(S,dumper,Level,lower,upper,item) \
|
||||
{\
|
||||
Standard_Integer lo = lower; Standard_Integer up = upper;\
|
||||
IGESData_DumpListHeader(S,lo,up);\
|
||||
if (lo > up) {}\
|
||||
else if (Level == 4 || Level == -4) S <<" [content : ask level > 4]";\
|
||||
else if (Level > 0) {\
|
||||
S << " :";\
|
||||
for (Standard_Integer iopa = lo; iopa <= up; iopa ++) {\
|
||||
if (Level == 5) { S << " " ; dumper.PrintDNum (item(iopa),S); }\
|
||||
else { S << "\n["<<Interface_MSG::Blanks(iopa,3)<<iopa<<"]:"; dumper.PrintShort (item(iopa),S); }\
|
||||
}\
|
||||
}\
|
||||
}
|
||||
|
||||
|
||||
#define IGESData_DumpRectVals(S,Level,LowCol,UpCol,LowRow,UpRow,Item) \
|
||||
{\
|
||||
int loco = LowCol; int upc = UpCol; int lor = LowRow; int upr = UpRow;\
|
||||
S <<" (Row :"<< lor <<" - "<< upr <<" ; Col :"<< loco <<" - "<< upc <<")";\
|
||||
if (loco > upc || lor > upr) {}\
|
||||
else if (Level == 4 || Level == -4) S <<" [content : ask level > 4]";\
|
||||
else if (Level > 0) {\
|
||||
S << "\n";\
|
||||
for (int ir = lor; ir <= upr; ir ++) {\
|
||||
S << "Row "<<ir<<":[";\
|
||||
for (int ic = loco; ic <= upc; ic ++) S << " " << Item(ic,ir);\
|
||||
S << " ]\n";\
|
||||
}\
|
||||
}\
|
||||
}
|
37
src/IGESData/IGESData_FileProtocol.cdl
Executable file
37
src/IGESData/IGESData_FileProtocol.cdl
Executable file
@@ -0,0 +1,37 @@
|
||||
-- File: IGESData_FileProtocol.cdl
|
||||
-- Created: Tue Oct 26 10:24:13 1993
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@sdsun2>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class FileProtocol from IGESData inherits Protocol from IGESData
|
||||
|
||||
---Purpose : This class allows to define complex protocols, in order to
|
||||
-- treat various sub-sets (or the complete set) of the IGES Norm,
|
||||
-- such as Solid + Draw (which are normally independant), etc...
|
||||
-- While it inherits Protocol from IGESData, it admits
|
||||
-- UndefinedEntity too
|
||||
|
||||
uses Protocol from Interface
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable FileProtocol;
|
||||
---Purpose : Returns an empty FileProtocol
|
||||
|
||||
Add (me : mutable; protocol : Protocol from IGESData);
|
||||
---Purpose : Adds a resource
|
||||
|
||||
NbResources (me) returns Integer is redefined;
|
||||
---Purpose : Gives the count of Resources : the count of Added Protocols
|
||||
|
||||
Resource (me; num : Integer) returns Protocol from Interface is redefined;
|
||||
---Purpose : Returns a Resource, given a rank (rank of call to Add)
|
||||
|
||||
fields
|
||||
|
||||
theresource : Protocol from IGESData;
|
||||
thenext : FileProtocol from IGESData;
|
||||
|
||||
end FileProtocol;
|
31
src/IGESData/IGESData_FileProtocol.cxx
Executable file
31
src/IGESData/IGESData_FileProtocol.cxx
Executable file
@@ -0,0 +1,31 @@
|
||||
#include <IGESData_FileProtocol.ixx>
|
||||
|
||||
|
||||
IGESData_FileProtocol::IGESData_FileProtocol () { }
|
||||
|
||||
void IGESData_FileProtocol::Add (const Handle(IGESData_Protocol)& protocol)
|
||||
{
|
||||
if (theresource.IsNull()) theresource = protocol;
|
||||
else if (theresource->IsInstance(protocol->DynamicType())) return; // passer
|
||||
else if (!thenext.IsNull()) thenext->Add(protocol);
|
||||
else {
|
||||
thenext = new IGESData_FileProtocol;
|
||||
thenext->Add(protocol);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer IGESData_FileProtocol::NbResources () const
|
||||
{
|
||||
Standard_Integer nb = (theresource.IsNull() ? 0 : 1);
|
||||
if (!thenext.IsNull()) nb += thenext->NbResources();
|
||||
return nb;
|
||||
}
|
||||
|
||||
Handle(Interface_Protocol) IGESData_FileProtocol::Resource
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
Handle(IGESData_Protocol) res;
|
||||
if (num == 1) return theresource;
|
||||
else if (!thenext.IsNull()) return thenext->Resource(num-1);
|
||||
return res; // Null
|
||||
}
|
128
src/IGESData/IGESData_FreeFormatEntity.cdl
Executable file
128
src/IGESData/IGESData_FreeFormatEntity.cdl
Executable file
@@ -0,0 +1,128 @@
|
||||
-- File: FreeFormatEntity.cdl
|
||||
-- Created: Fri Dec 18 11:20:13 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@topsn2>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class FreeFormatEntity from IGESData inherits UndefinedEntity
|
||||
|
||||
---Purpose : This class allows to create IGES Entities in a literal form :
|
||||
-- their definition is free, but they are not recognized as
|
||||
-- instances of specific classes.
|
||||
--
|
||||
-- This is a way to define test files without having to create
|
||||
-- and fill specific classes of Entities, or creating an IGES
|
||||
-- File ex nihilo, with respect for all format constraints
|
||||
-- (such a way is very difficult to run and to master).
|
||||
--
|
||||
-- This class has the same content as an UndefinedEntity, only
|
||||
-- it gives way to act on its content
|
||||
|
||||
uses HAsciiString from TCollection, HSequenceOfInteger from TColStd,
|
||||
ParamType, IGESEntity, HArray1OfIGESEntity, IGESWriter
|
||||
|
||||
raises OutOfRange, InterfaceError
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable FreeFormatEntity;
|
||||
---Purpose : Creates a completely empty FreeFormatEntity
|
||||
|
||||
SetTypeNumber (me : mutable; typenum : Integer);
|
||||
---Purpose : Sets Type Number to a new Value, and Form Number to Zero
|
||||
|
||||
SetFormNumber (me : mutable; formnum : Integer);
|
||||
---Purpose : Sets Form Number to a new Value (to called after SetTypeNumber)
|
||||
|
||||
-- Setting Directory informations : see general methods provided by
|
||||
-- IGESEntity itself : InitTransf, InitView, InitLineFont, InitLevel,
|
||||
-- InitColor, InitStatus, SetLabel, InitMisc, AddProperty, Associate
|
||||
|
||||
-- -- Access to Parameters -- --
|
||||
-- (own Parameters, in addition to Properties and Associativities
|
||||
-- list, and to Directory informations)
|
||||
|
||||
NbParams (me) returns Integer;
|
||||
---Purpose : Gives count of recorded parameters
|
||||
|
||||
ParamData (me; num : Integer; ptype : out ParamType;
|
||||
ent : out mutable IGESEntity;
|
||||
val : out HAsciiString from TCollection)
|
||||
returns Boolean;
|
||||
---Purpose : Returns data of a Parameter : its type, and the entity if it
|
||||
-- designates en entity ("ent") or its literal value else ("str")
|
||||
-- Returned value (Boolean) : True if it is an Entity, False else
|
||||
|
||||
ParamType (me; num : Integer) returns ParamType raises OutOfRange;
|
||||
---Purpose : Returns the ParamType of a Param, given its rank
|
||||
-- Error if num is not between 1 and NbParams
|
||||
|
||||
IsParamEntity (me; num : Integer) returns Boolean raises OutOfRange;
|
||||
---Purpose : Returns True if a Parameter is recorded as an entity
|
||||
-- Error if num is not between 1 and NbParams
|
||||
|
||||
ParamEntity (me; num : Integer) returns mutable IGESEntity
|
||||
raises InterfaceError, OutOfRange;
|
||||
---Purpose : Returns Entity corresponding to a Param, given its rank
|
||||
-- Error if out of range or if Param num does not designate
|
||||
-- an Entity
|
||||
|
||||
IsNegativePointer (me; num : Integer) returns Boolean;
|
||||
---Purpose : Returns True if <num> is noted as for a "Negative Pointer"
|
||||
-- (see AddEntity for details). Senseful only if IsParamEntity
|
||||
-- answers True for <num>, else returns False.
|
||||
|
||||
ParamValue (me; num : Integer) returns HAsciiString from TCollection
|
||||
raises InterfaceError, OutOfRange;
|
||||
---Purpose : Returns litteral value of a Parameter, given its rank
|
||||
-- Error if num is out of range, or if Parameter is not literal
|
||||
|
||||
NegativePointers (me) returns HSequenceOfInteger from TColStd;
|
||||
---Purpose : Returns the complete list of Ramks of Parameters which have
|
||||
-- been noted as Negative Pointers
|
||||
-- Warning : It is returned as a Null Handle if none was noted
|
||||
|
||||
AddLiteral (me : mutable; ptype : ParamType;
|
||||
val : HAsciiString from TCollection);
|
||||
---Purpose : Adds a literal Parameter to the list (as such)
|
||||
|
||||
AddLiteral (me : mutable; ptype : ParamType; val : CString);
|
||||
---Purpose : Adds a literal Parameter to the list (builds an HAsciiString)
|
||||
|
||||
AddEntity (me : mutable; ptype : ParamType;
|
||||
ent : mutable IGESEntity; negative : Boolean = Standard_False);
|
||||
---Purpose : Adds a Parameter which references an Entity. If the Entity is
|
||||
-- Null, the added parameter will define a "Null Pointer" (0)
|
||||
-- If <negative> is given True, this will command Sending to File
|
||||
-- (see IGESWriter) to produce a "Negative Pointer"
|
||||
-- (Default is False)
|
||||
|
||||
AddEntities (me : mutable; ents : HArray1OfIGESEntity)
|
||||
raises InterfaceError;
|
||||
---Purpose : Adds a set of Entities, given as a HArray1OfIGESEntity
|
||||
-- Causes creation of : an Integer Parameter which gives count
|
||||
-- of Entities, then the list of Entities of the Array
|
||||
-- Error if an Entity is not an IGESEntity
|
||||
-- All these Entities will be interpreted as "Positive Pointers"
|
||||
-- by IGESWriter
|
||||
|
||||
AddNegativePointers (me : mutable; list : HSequenceOfInteger from TColStd);
|
||||
---Purpose : Adds a list of Ranks of Parameters to be noted as Negative
|
||||
-- Pointers (this will be taken into account for Parameters
|
||||
-- which are Entities)
|
||||
|
||||
ClearNegativePointers (me : mutable);
|
||||
---Purpose : Clears all informations about Negative Pointers, hence every
|
||||
-- Entity kind Parameter will be send normally, as Positive
|
||||
|
||||
|
||||
WriteOwnParams (me; IW : in out IGESWriter) is redefined;
|
||||
---Purpose : WriteOwnParams is redefined for FreeFormatEntity to take
|
||||
-- into account the supplementary information "Negative Pointer"
|
||||
|
||||
fields
|
||||
|
||||
thenegptrs : HSequenceOfInteger from TColStd;
|
||||
|
||||
end FreeFormatEntity;
|
136
src/IGESData/IGESData_FreeFormatEntity.cxx
Executable file
136
src/IGESData/IGESData_FreeFormatEntity.cxx
Executable file
@@ -0,0 +1,136 @@
|
||||
#include <IGESData_FreeFormatEntity.ixx>
|
||||
#include <Interface_UndefinedContent.hxx>
|
||||
#include <Interface_InterfaceError.hxx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
|
||||
// Donne un acces simple a la constitution d une UndefinedEntity :
|
||||
// Methodes de UndefinedContent, + Type & Form, + AddEntities (little gadget)
|
||||
|
||||
|
||||
IGESData_FreeFormatEntity::IGESData_FreeFormatEntity () { }
|
||||
|
||||
void IGESData_FreeFormatEntity::SetTypeNumber
|
||||
(const Standard_Integer typenum)
|
||||
{ InitTypeAndForm (typenum,0); }
|
||||
|
||||
void IGESData_FreeFormatEntity::SetFormNumber
|
||||
(const Standard_Integer formnum)
|
||||
{ InitTypeAndForm (TypeNumber(), formnum); }
|
||||
|
||||
|
||||
Standard_Integer IGESData_FreeFormatEntity::NbParams () const
|
||||
{ return UndefinedContent()->NbParams(); }
|
||||
|
||||
Standard_Boolean IGESData_FreeFormatEntity::ParamData
|
||||
(const Standard_Integer num, Interface_ParamType& ptype,
|
||||
Handle(IGESData_IGESEntity)& ent, Handle(TCollection_HAsciiString)& val) const
|
||||
{ return UndefinedContent()->ParamData (num,ptype,ent,val); }
|
||||
|
||||
|
||||
Interface_ParamType IGESData_FreeFormatEntity::ParamType
|
||||
(const Standard_Integer num) const
|
||||
{ return UndefinedContent()->ParamType(num); }
|
||||
|
||||
Standard_Boolean IGESData_FreeFormatEntity::IsParamEntity
|
||||
(const Standard_Integer num) const
|
||||
{ return UndefinedContent()->IsParamEntity(num); }
|
||||
|
||||
Handle(IGESData_IGESEntity) IGESData_FreeFormatEntity::ParamEntity
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
return Handle(IGESData_IGESEntity)::DownCast
|
||||
(UndefinedContent()->ParamEntity(num));
|
||||
}
|
||||
|
||||
Standard_Boolean IGESData_FreeFormatEntity::IsNegativePointer
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
if (thenegptrs.IsNull()) return Standard_False;
|
||||
Standard_Integer nb = thenegptrs->Length();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++)
|
||||
if (thenegptrs->Value(i) == num) return Standard_True;
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESData_FreeFormatEntity::ParamValue
|
||||
(const Standard_Integer num) const
|
||||
{ return UndefinedContent()->ParamValue(num); }
|
||||
|
||||
Handle(TColStd_HSequenceOfInteger) IGESData_FreeFormatEntity::NegativePointers () const
|
||||
{ return thenegptrs; }
|
||||
|
||||
|
||||
void IGESData_FreeFormatEntity::AddLiteral
|
||||
(const Interface_ParamType ptype, const Handle(TCollection_HAsciiString)& val)
|
||||
{ UndefinedContent()->AddLiteral (ptype,val); }
|
||||
|
||||
void IGESData_FreeFormatEntity::AddLiteral
|
||||
(const Interface_ParamType ptype, const Standard_CString val)
|
||||
{ UndefinedContent()->AddLiteral (ptype,new TCollection_HAsciiString(val)); }
|
||||
|
||||
void IGESData_FreeFormatEntity::AddEntity
|
||||
(const Interface_ParamType ptype,
|
||||
const Handle(IGESData_IGESEntity)& ent, const Standard_Boolean negative)
|
||||
{
|
||||
UndefinedContent()->AddEntity (ptype,ent);
|
||||
if (!negative) return;
|
||||
if (thenegptrs.IsNull()) thenegptrs = new TColStd_HSequenceOfInteger();
|
||||
thenegptrs->Append(NbParams());
|
||||
}
|
||||
|
||||
void IGESData_FreeFormatEntity::AddEntities
|
||||
(const Handle(IGESData_HArray1OfIGESEntity)& ents)
|
||||
{
|
||||
if (ents.IsNull()) {
|
||||
AddLiteral ( Interface_ParamInteger, new TCollection_HAsciiString("0") );
|
||||
return;
|
||||
}
|
||||
AddLiteral ( Interface_ParamInteger, new TCollection_HAsciiString(ents->Length()) );
|
||||
Standard_Integer iup = ents->Upper();
|
||||
for (Standard_Integer i = ents->Lower(); i <= iup; i ++) {
|
||||
AddEntity (Interface_ParamIdent,ents->Value(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void IGESData_FreeFormatEntity::AddNegativePointers
|
||||
(const Handle(TColStd_HSequenceOfInteger)& list)
|
||||
{
|
||||
if (thenegptrs.IsNull()) thenegptrs = new TColStd_HSequenceOfInteger();
|
||||
thenegptrs->Append(list);
|
||||
}
|
||||
|
||||
void IGESData_FreeFormatEntity::ClearNegativePointers ()
|
||||
{ thenegptrs.Nullify(); }
|
||||
|
||||
|
||||
void IGESData_FreeFormatEntity::WriteOwnParams
|
||||
(IGESData_IGESWriter& IW) const
|
||||
{
|
||||
// Redefini de UndefinedEntity pour : NegativePointers
|
||||
Standard_Integer neg = 0;
|
||||
Standard_Integer fneg = 0;
|
||||
if (!thenegptrs.IsNull())
|
||||
if (!thenegptrs->IsEmpty()) { neg = thenegptrs->Value(1); fneg = 1; }
|
||||
|
||||
Standard_Integer nb = UndefinedContent()->NbParams();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
Interface_ParamType ptyp = UndefinedContent()->ParamType(i);
|
||||
if (ptyp == Interface_ParamVoid) IW.SendVoid();
|
||||
else if (UndefinedContent()->IsParamEntity(i)) {
|
||||
DeclareAndCast(IGESData_IGESEntity,anent,UndefinedContent()->ParamEntity(i));
|
||||
// Send Entity : Redefini
|
||||
if (i == neg) {
|
||||
IW.Send(anent,Standard_True);
|
||||
if (fneg >= thenegptrs->Length()) neg = 0;
|
||||
else { fneg ++; neg = thenegptrs->Value(fneg); }
|
||||
}
|
||||
else IW.Send(anent,Standard_False);
|
||||
}
|
||||
else IW.SendString (UndefinedContent()->ParamValue(i));
|
||||
}
|
||||
}
|
117
src/IGESData/IGESData_GeneralModule.cdl
Executable file
117
src/IGESData/IGESData_GeneralModule.cdl
Executable file
@@ -0,0 +1,117 @@
|
||||
-- File: IGESData_GeneralModule.cdl
|
||||
-- Created: Mon May 10 15:00:51 1993
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
deferred class GeneralModule from IGESData
|
||||
inherits GeneralModule from Interface
|
||||
|
||||
---Purpose : Definition of General Services adapted to IGES.
|
||||
-- This Services comprise : Shared & Implied Lists, Copy, Check
|
||||
-- They are adapted according to the organisation of IGES
|
||||
-- Entities : Directory Part, Lists of Associativities and
|
||||
-- Properties are specifically processed
|
||||
|
||||
uses Transient, HAsciiString from TCollection,
|
||||
InterfaceModel, Check, ShareTool, EntityIterator, CopyTool,
|
||||
IGESEntity, DirChecker
|
||||
|
||||
is
|
||||
|
||||
FillSharedCase (me; CN : Integer; ent : Transient;
|
||||
iter : in out EntityIterator);
|
||||
---Purpose : Fills the list of Entities shared by an IGESEntity <ent>,
|
||||
-- according a Case Number <CN> (formerly computed by CaseNum).
|
||||
-- Considers Properties and Directory Part, and calls
|
||||
-- OwnSharedCase (which is adapted to each Type of Entity)
|
||||
|
||||
OwnSharedCase (me; CN : Integer; ent : IGESEntity;
|
||||
iter : in out EntityIterator) is deferred;
|
||||
---Purpose : Lists the Entities shared by a given IGESEntity <ent>, from
|
||||
-- its specific parameters : specific for each type
|
||||
|
||||
ListImpliedCase (me; CN : Integer; ent : Transient;
|
||||
iter : in out EntityIterator) is redefined;
|
||||
---Purpose : Lists the Implied References of <ent>. Here, these are the
|
||||
-- Associativities, plus the Entities defined by OwnSharedCase
|
||||
|
||||
OwnImpliedCase (me; CN : Integer; ent : IGESEntity;
|
||||
iter : in out EntityIterator) is virtual;
|
||||
---Purpose : Specific list of Entities implied by a given IGESEntity <ent>
|
||||
-- (in addition to Associativities). By default, there are none,
|
||||
-- but this method can be redefined as required
|
||||
|
||||
|
||||
|
||||
CheckCase (me; CN : Integer; ent : Transient; shares : ShareTool;
|
||||
ach : in out Check);
|
||||
---Purpose : Semantic Checking of an IGESEntity. Performs general Checks,
|
||||
-- which use DirChecker, then call OwnCheck which does a check
|
||||
-- specific for each type of Entity
|
||||
|
||||
DirChecker (me; CN : Integer; ent : IGESEntity) returns DirChecker
|
||||
is deferred;
|
||||
---Purpose : Returns a DirChecker, specific for each type of Entity
|
||||
-- (identified by its Case Number) : this DirChecker defines
|
||||
-- constraints which must be respected by the DirectoryPart
|
||||
|
||||
OwnCheckCase (me; CN : Integer; ent : IGESEntity; shares : ShareTool;
|
||||
ach : in out Check) is deferred;
|
||||
---Purpose : Performs Specific Semantic Check for each type of Entity
|
||||
|
||||
|
||||
CanCopy (me; CN : Integer; ent : Transient) returns Boolean is redefined;
|
||||
---Purpose : Specific answer to the question "is Copy properly implemented"
|
||||
-- For IGES, answer is always True
|
||||
|
||||
NewVoid (me; CN : Integer; entto : out mutable Transient)
|
||||
returns Boolean is deferred;
|
||||
---Purpose : Specific creation of a new void entity
|
||||
|
||||
CopyCase (me; CN : Integer;
|
||||
entfrom : Transient; entto : mutable Transient;
|
||||
TC : in out CopyTool);
|
||||
---Purpose : Copy ("Deep") from <entfrom> to <entto> (same type)
|
||||
-- by using a CopyTool which provides its working Map.
|
||||
-- For IGESEntities, Copies general data (Directory Part, List of
|
||||
-- Properties) and call OwnCopyCase
|
||||
|
||||
OwnCopyCase (me; CN : Integer;
|
||||
entfrom : IGESEntity; entto : mutable IGESEntity;
|
||||
TC : in out CopyTool) is deferred;
|
||||
---Purpose : Copies parameters which are specific of each Type of Entity
|
||||
|
||||
RenewImpliedCase (me; CN : Integer;
|
||||
entfrom : Transient; entto : mutable Transient;
|
||||
TC : CopyTool) is redefined;
|
||||
---Purpose : Renewing of Implied References.
|
||||
-- For IGESEntities, Copies general data(List of Associativities)
|
||||
-- and calls OwnRenewCase
|
||||
|
||||
OwnRenewCase (me; CN : Integer;
|
||||
entfrom : IGESEntity; entto : mutable IGESEntity;
|
||||
TC : CopyTool) is virtual;
|
||||
---Purpose : Renews parameters which are specific of each Type of Entity :
|
||||
-- the provided default does nothing, but this method may be
|
||||
-- redefined as required
|
||||
|
||||
WhenDeleteCase (me; CN : Integer;
|
||||
ent : mutable Transient; dispatched : Boolean) is redefined;
|
||||
---Purpose : Prepares an IGES Entity for delete : works on directory part
|
||||
-- then calls OwnDeleteCase
|
||||
-- While dispatch requires to copy the entities, <dispatched> is
|
||||
-- ignored, entities are cleared in any case
|
||||
|
||||
OwnDeleteCase (me; CN : Integer;
|
||||
ent : mutable IGESEntity) is virtual;
|
||||
---Purpose : Specific preparation for delete, acts on own parameters
|
||||
-- Default does nothing, to be redefined as required
|
||||
|
||||
Name (me; CN : Integer; ent : Transient; shares : ShareTool from Interface)
|
||||
returns HAsciiString from TCollection is redefined virtual;
|
||||
---Purpose : Returns the name of an IGES Entity (its NameValue)
|
||||
-- Can be redefined for an even more specific case ...
|
||||
|
||||
end GeneralModule;
|
184
src/IGESData/IGESData_GeneralModule.cxx
Executable file
184
src/IGESData/IGESData_GeneralModule.cxx
Executable file
@@ -0,0 +1,184 @@
|
||||
#include <IGESData_GeneralModule.ixx>
|
||||
#include <Interface_GeneralLib.hxx>
|
||||
#include <IGESData.hxx>
|
||||
#include <IGESData_Protocol.hxx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
|
||||
|
||||
void IGESData_GeneralModule::FillSharedCase
|
||||
(const Standard_Integer CN, const Handle(Standard_Transient)& ent,
|
||||
Interface_EntityIterator& iter) const
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESEntity,anent,ent);
|
||||
if (anent.IsNull()) return;
|
||||
// .... Directory Part
|
||||
iter.AddItem (anent->DirFieldEntity (3));
|
||||
iter.AddItem (anent->DirFieldEntity (4));
|
||||
iter.AddItem (anent->DirFieldEntity (5));
|
||||
iter.AddItem (anent->DirFieldEntity (6));
|
||||
iter.AddItem (anent->DirFieldEntity (7));
|
||||
iter.AddItem (anent->DirFieldEntity (8));
|
||||
iter.AddItem (anent->DirFieldEntity (13));
|
||||
|
||||
// .... Own Parameters
|
||||
OwnSharedCase (CN,anent,iter);
|
||||
|
||||
// .... Properties
|
||||
Interface_EntityIterator assocs = anent->Properties();
|
||||
for (; assocs.More(); assocs.Next()) iter.AddItem (assocs.Value());
|
||||
}
|
||||
|
||||
void IGESData_GeneralModule::ListImpliedCase
|
||||
(const Standard_Integer CN, const Handle(Standard_Transient)& ent,
|
||||
Interface_EntityIterator& iter) const
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESEntity,anent,ent);
|
||||
if (anent.IsNull()) return;
|
||||
OwnImpliedCase (CN,anent,iter);
|
||||
Interface_EntityIterator assocs = anent->Associativities();
|
||||
for (; assocs.More(); assocs.Next()) iter.AddItem (assocs.Value());
|
||||
}
|
||||
|
||||
|
||||
void IGESData_GeneralModule::OwnImpliedCase
|
||||
(const Standard_Integer , const Handle(IGESData_IGESEntity)& ,
|
||||
Interface_EntityIterator& ) const
|
||||
{ } // par defaut, rien (redefinissable)
|
||||
|
||||
|
||||
|
||||
void IGESData_GeneralModule::CheckCase
|
||||
(const Standard_Integer CN, const Handle(Standard_Transient)& ent,
|
||||
const Interface_ShareTool& shares, Handle(Interface_Check)& ach) const
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESEntity,anent,ent);
|
||||
|
||||
IGESData_DirChecker dc = DirChecker(CN,anent);
|
||||
dc.Check(ach,anent);
|
||||
OwnCheckCase (CN,anent,shares,ach);
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IGESData_GeneralModule::CanCopy
|
||||
(const Standard_Integer CN, const Handle(Standard_Transient)& ent) const
|
||||
{ return Standard_True; }
|
||||
|
||||
void IGESData_GeneralModule::CopyCase
|
||||
(const Standard_Integer CN, const Handle(Standard_Transient)& entfrom,
|
||||
const Handle(Standard_Transient)& entto, Interface_CopyTool& TC) const
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESEntity,ento,entto);
|
||||
DeclareAndCast(IGESData_IGESEntity,enfr,entfrom);
|
||||
//// ento->Clear();
|
||||
|
||||
// ... Reprendre entete ...
|
||||
//? ento->InitTypeAndForm (enfr->TypeNumber(), enfr->FormNumber());ShallowCopy
|
||||
|
||||
if (enfr->DefLineFont() == IGESData_DefReference) ento->InitLineFont
|
||||
(GetCasted(IGESData_LineFontEntity, TC.Transferred(enfr->LineFont())));
|
||||
else ento->InitLineFont (enfr->LineFont() , enfr->RankLineFont());
|
||||
|
||||
if (enfr->DefLevel() == IGESData_DefSeveral) ento->InitLevel
|
||||
(GetCasted(IGESData_LevelListEntity,TC.Transferred(enfr->LevelList())),-1);
|
||||
else ento->InitLevel (enfr->LevelList() , enfr->Level());
|
||||
|
||||
if (enfr->DefView() != IGESData_DefNone) ento->InitView
|
||||
(GetCasted(IGESData_ViewKindEntity, TC.Transferred(enfr->View())));
|
||||
|
||||
if (enfr->HasTransf()) ento->InitTransf
|
||||
(GetCasted(IGESData_TransfEntity, TC.Transferred(enfr->Transf())));
|
||||
|
||||
ento->InitStatus (enfr->BlankStatus() ,
|
||||
enfr->SubordinateStatus() ,
|
||||
enfr->UseFlag() ,
|
||||
enfr->HierarchyStatus() );
|
||||
|
||||
if (enfr->DefColor() == IGESData_DefReference) ento->InitColor
|
||||
(GetCasted(IGESData_ColorEntity,TC.Transferred(enfr->Color())));
|
||||
else ento->InitColor (enfr->Color() , enfr->RankColor());
|
||||
|
||||
if (enfr->HasShortLabel()) ento->SetLabel
|
||||
(new TCollection_HAsciiString(enfr->ShortLabel()),
|
||||
enfr->SubScriptNumber());
|
||||
else ento->SetLabel (enfr->ShortLabel() , enfr->SubScriptNumber());
|
||||
|
||||
// Directory Part : Miscellaneous
|
||||
Handle(IGESData_IGESEntity) Structure;
|
||||
if (enfr->HasStructure()) Structure =
|
||||
GetCasted(IGESData_IGESEntity, TC.Transferred(enfr->Structure()));
|
||||
if (enfr->HasLabelDisplay()) ento->InitMisc
|
||||
(Structure,
|
||||
GetCasted(IGESData_LabelDisplayEntity,TC.Transferred(enfr->LabelDisplay())),
|
||||
enfr->LineWeightNumber());
|
||||
else ento->InitMisc
|
||||
(Structure , enfr->LabelDisplay() , enfr->LineWeightNumber());
|
||||
|
||||
// LineWeightValue, Res1, Res2 : through action of ShallowCopy ?
|
||||
|
||||
OwnCopyCase (CN,enfr,ento,TC);
|
||||
|
||||
// .. Properties
|
||||
if (enfr->NbProperties() != 0) {
|
||||
for (Interface_EntityIterator iter = enfr->Properties();
|
||||
iter.More(); iter.Next()) {
|
||||
ento->AddProperty
|
||||
(GetCasted(IGESData_IGESEntity,TC.Transferred(iter.Value())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IGESData_GeneralModule::RenewImpliedCase
|
||||
(const Standard_Integer CN, const Handle(Standard_Transient)& entfrom,
|
||||
const Handle(Standard_Transient)& entto, const Interface_CopyTool& TC) const
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESEntity,ento,entto);
|
||||
DeclareAndCast(IGESData_IGESEntity,enfr,entfrom);
|
||||
|
||||
OwnRenewCase (CN,enfr,ento,TC);
|
||||
|
||||
// .. Associativities
|
||||
if (enfr->NbAssociativities() != 0) {
|
||||
for (Interface_EntityIterator iter = enfr->Associativities();
|
||||
iter.More(); iter.Next()) {
|
||||
Handle(Standard_Transient) anent = iter.Value();
|
||||
Handle(Standard_Transient) newent;
|
||||
if (TC.Search(anent,newent)) ento->AddAssociativity
|
||||
(GetCasted(IGESData_IGESEntity,newent));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IGESData_GeneralModule::OwnRenewCase
|
||||
(const Standard_Integer , const Handle(IGESData_IGESEntity)& ,
|
||||
const Handle(IGESData_IGESEntity)& , const Interface_CopyTool& ) const
|
||||
{ }
|
||||
|
||||
void IGESData_GeneralModule::WhenDeleteCase
|
||||
(const Standard_Integer CN, const Handle(Standard_Transient)& ent,
|
||||
const Standard_Boolean ) const // dispatched : ignored
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESEntity,anent,ent);
|
||||
if (anent.IsNull()) return;
|
||||
anent->Clear();
|
||||
OwnDeleteCase (CN,anent);
|
||||
}
|
||||
|
||||
void IGESData_GeneralModule::OwnDeleteCase
|
||||
(const Standard_Integer , const Handle(IGESData_IGESEntity)& ) const
|
||||
{ } // par defaut, rien (redefinissable)
|
||||
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESData_GeneralModule::Name
|
||||
(const Standard_Integer , const Handle(Standard_Transient)& ent,
|
||||
const Interface_ShareTool& ) const
|
||||
{
|
||||
Handle(TCollection_HAsciiString) name;
|
||||
DeclareAndCast(IGESData_IGESEntity,anent,ent);
|
||||
if (anent.IsNull()) return name;
|
||||
name = anent->NameValue ();
|
||||
return name;
|
||||
}
|
240
src/IGESData/IGESData_GlobalSection.cdl
Executable file
240
src/IGESData/IGESData_GlobalSection.cdl
Executable file
@@ -0,0 +1,240 @@
|
||||
-- File: GlobalSection.cdl
|
||||
-- Created: Mon Apr 6 14:59:45 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class GlobalSection from IGESData
|
||||
|
||||
---Purpose : Description of a global section (corresponds to file header)
|
||||
-- used as well in IGESModel, IGESReader and IGESWriter
|
||||
-- Warning : From IGES-5.1, a parameter is added : LastChangeDate (concerns
|
||||
-- transferred set of data, not the file itself)
|
||||
-- Of course, it can be absent if read from earlier versions
|
||||
-- (a default is then to be set to current date)
|
||||
-- From 5.3, one more : ApplicationProtocol (optional)
|
||||
|
||||
uses Integer, Character, Real, HAsciiString from TCollection,
|
||||
XYZ from gp, ParamSet, Check
|
||||
|
||||
is
|
||||
|
||||
Create returns GlobalSection;
|
||||
---Purpose : Creates an empty GlobalSection, ready to be filled,
|
||||
-- Warning : No default value is provided
|
||||
|
||||
Init (me : in out; params : ParamSet; ach : in out Check) is static;
|
||||
---Purpose : Fills GlobalSection from a ParamSet (i.e. taken from file)
|
||||
-- undefined parameters do not change default values when defined
|
||||
-- Fills Check about Corrections or Fails
|
||||
|
||||
CopyRefs (me : in out) is static;
|
||||
---Purpose : Copies data referenced by Handle (that is, Strings)
|
||||
-- usefull to "isolate" a GlobalSection after copy by "="
|
||||
-- (from a Model to another Model for instance)
|
||||
|
||||
Params (me) returns ParamSet is static;
|
||||
---Purpose : Returns all contained data in the form of a ParamSet
|
||||
-- Remark : Strings are given under Hollerith form
|
||||
|
||||
TranslatedFromHollerith (me; astr : HAsciiString from TCollection)
|
||||
returns HAsciiString from TCollection is static;
|
||||
---Purpose : Returns a string withpout its Hollerith marks (nnnH ahead).
|
||||
-- Remark : all strings stored in GlobalSection are expurged
|
||||
-- from Hollerith informations (without nnnH)
|
||||
-- If <astr> is not Hollerith form, it is simply copied
|
||||
|
||||
-- -- Specific Queries -- --
|
||||
|
||||
Separator (me) returns Character is static;
|
||||
--- Purpose: Returns the parameter delimiter character.
|
||||
|
||||
EndMark (me) returns Character is static;
|
||||
---Purpose: Returns the record delimiter character.
|
||||
|
||||
SendName (me) returns HAsciiString from TCollection is static;
|
||||
---Purpose: Returns the name of the sending system.
|
||||
|
||||
FileName (me) returns HAsciiString from TCollection is static;
|
||||
---Purpose: Returns the name of the IGES file.
|
||||
|
||||
SystemId (me) returns HAsciiString from TCollection is static;
|
||||
---Purpose: Returns the Native System ID of the system that created the IGES file.
|
||||
|
||||
InterfaceVersion (me) returns HAsciiString from TCollection is static;
|
||||
---Purpose: Returns the name of the pre-processor used to write the IGES file.
|
||||
|
||||
IntegerBits (me) returns Integer is static;
|
||||
---Purpose: Returns the number of binary bits for integer representations.
|
||||
|
||||
MaxPower10Single (me) returns Integer is static;
|
||||
---Purpose: Returns the maximum power of a decimal representation of a
|
||||
-- single-precision floating point number in the sending system.
|
||||
|
||||
|
||||
MaxDigitsSingle (me) returns Integer is static;
|
||||
MaxPower10Double (me) returns Integer is static;
|
||||
|
||||
--- Purpose: Returns the maximum power of a decimal representation of a
|
||||
-- double-precision floating point number in the sending system.
|
||||
|
||||
MaxDigitsDouble (me) returns Integer is static;
|
||||
|
||||
ReceiveName (me) returns HAsciiString from TCollection is static;
|
||||
---Purpose: Returns the name of the receiving system.
|
||||
Scale (me) returns Real is static;
|
||||
---Purpose: Returns the scale used in the IGES file.
|
||||
|
||||
UnitFlag (me) returns Integer is static;
|
||||
---Purpose: Returns the unit flag that was used to write the IGES file.
|
||||
UnitName (me) returns HAsciiString from TCollection is static;
|
||||
--- Purpose: Returns the name of the unit the IGES file was written in.
|
||||
|
||||
LineWeightGrad (me) returns Integer is static;
|
||||
---Purpose: Returns the maximum number of line weight gradations.
|
||||
|
||||
MaxLineWeight (me) returns Real is static;
|
||||
---Purpose: Returns the of maximum line weight width in IGES file units.
|
||||
|
||||
Date (me) returns HAsciiString from TCollection is static;
|
||||
---Purpose: Returns the IGES file creation date.
|
||||
|
||||
Resolution (me) returns Real is static;
|
||||
---Purpose: Returns the resolution used in the IGES file.
|
||||
|
||||
MaxCoord (me) returns Real is static;
|
||||
---Purpose: Returns the approximate maximum coordinate value found in the model.
|
||||
|
||||
HasMaxCoord (me) returns Boolean is static;
|
||||
---Purpose: Returns True if the approximate maximum coordinate value found in
|
||||
-- the model is greater than 0.
|
||||
|
||||
AuthorName (me) returns HAsciiString from TCollection is static;
|
||||
---Purpose: Returns the name of the IGES file author.
|
||||
|
||||
CompanyName (me) returns HAsciiString from TCollection is static;
|
||||
--- Purpose: Returns the name of the company where the IGES file was written.
|
||||
|
||||
IGESVersion (me) returns Integer is static;
|
||||
---Purpose: Returns the IGES version that the IGES file was written in.
|
||||
|
||||
DraftingStandard (me) returns Integer is static;
|
||||
|
||||
LastChangeDate (me) returns HAsciiString from TCollection is static;
|
||||
---Purpose: Returns the date and time when the model was created or last
|
||||
-- modified (for IGES 5.1 and later).
|
||||
|
||||
HasLastChangeDate (me) returns Boolean is static;
|
||||
--- Purpose: Returns True if the date and time when the model was created or
|
||||
-- last modified are specified, i.e. not defaulted to NULL.
|
||||
|
||||
SetLastChangeDate (me : in out) is static;
|
||||
|
||||
ApplicationProtocol (me) returns HAsciiString from TCollection;
|
||||
HasApplicationProtocol (me) returns Boolean;
|
||||
|
||||
NewDateString (myclass; year,month,day,hour,minut,second : Integer;
|
||||
mode : Integer = -1)
|
||||
returns mutable HAsciiString from TCollection;
|
||||
---Purpose : Returns a string built from year,
|
||||
-- month, day, hour, minute and second values. The form of the
|
||||
-- resulting string is defined as follows:
|
||||
-- - -1: YYMMDD.HHNNSS,
|
||||
-- - 0: YYYYMMDD.HHNNSS,
|
||||
-- - 1: YYYY-MM-DD:HH-NN-SS, where:
|
||||
-- - YYYY or YY is 4 or 2 digit year,
|
||||
-- - HH is hour (00-23),
|
||||
-- - MM is month (01-12),
|
||||
-- - NN is minute (00-59)
|
||||
-- - DD is day (01-31),
|
||||
-- - SS is second (00-59).
|
||||
|
||||
NewDateString (myclass; date : HAsciiString from TCollection;
|
||||
mode : Integer = 1)
|
||||
returns mutable HAsciiString from TCollection;
|
||||
---Purpose : Converts the string given in the
|
||||
-- form YYMMDD.HHNNSS or YYYYMMDD.HHNNSS to either
|
||||
-- YYMMDD.HHNNSS, YYYYMMDD.HHNNSS or YYYY-MM-DD:HH-NN-SS.
|
||||
|
||||
UnitValue (me) returns Real is static;
|
||||
---Purpose : Returns the unit value (in
|
||||
-- meters) that the IGES file was written in.
|
||||
|
||||
|
||||
SetSeparator (me : in out; val : Character) is static;
|
||||
SetEndMark (me : in out; val : Character) is static;
|
||||
|
||||
SetSendName (me : in out; val : HAsciiString from TCollection) is static;
|
||||
SetFileName (me : in out; val : HAsciiString from TCollection) is static;
|
||||
SetSystemId (me : in out; val : HAsciiString from TCollection) is static;
|
||||
SetInterfaceVersion (me : in out; val : HAsciiString from TCollection) is static;
|
||||
|
||||
SetIntegerBits (me : in out; val : Integer) is static;
|
||||
SetMaxPower10Single (me : in out; val : Integer) is static;
|
||||
SetMaxDigitsSingle (me : in out; val : Integer) is static;
|
||||
SetMaxPower10Double (me : in out; val : Integer) is static;
|
||||
SetMaxDigitsDouble (me : in out; val : Integer) is static;
|
||||
|
||||
SetReceiveName (me : in out; val : HAsciiString from TCollection) is static;
|
||||
|
||||
SetScale (me : in out; val : Real) is static;
|
||||
SetUnitFlag (me : in out; val : Integer) is static;
|
||||
SetUnitName (me : in out; val : HAsciiString from TCollection) is static;
|
||||
SetLineWeightGrad (me : in out; val : Integer) is static;
|
||||
SetMaxLineWeight (me : in out; val : Real) is static;
|
||||
SetDate (me : in out; val : HAsciiString from TCollection) is static;
|
||||
SetResolution (me : in out; val : Real) is static;
|
||||
SetMaxCoord (me : in out; val : Real = 0.0) is static;
|
||||
-- Without Argument : resets MaxCoord. Argument positive : sets MaxCoord
|
||||
|
||||
MaxMaxCoord (me : in out; val : Real = 0.0);
|
||||
-- Sets MaxCoord to the max of <actual MaxCoord> , Abs(val)
|
||||
MaxMaxCoords (me : in out; xyz : XYZ from gp);
|
||||
-- MaxMaxCoord on X,Y,Z of <xyz>
|
||||
|
||||
SetAuthorName (me : in out; val : HAsciiString from TCollection) is static;
|
||||
SetCompanyName (me : in out; val : HAsciiString from TCollection) is static;
|
||||
SetIGESVersion (me : in out; val : Integer) is static;
|
||||
SetDraftingStandard (me : in out; val : Integer) is static;
|
||||
|
||||
SetLastChangeDate (me : in out; val : HAsciiString from TCollection) is static;
|
||||
SetApplicationProtocol (me : in out; val : HAsciiString from TCollection);
|
||||
|
||||
fields
|
||||
|
||||
theSeparator : Character; -- default is ','
|
||||
theEndMark : Character; -- default is ';'
|
||||
|
||||
theSendName : HAsciiString from TCollection;
|
||||
theFileName : HAsciiString from TCollection;
|
||||
theSystemId : HAsciiString from TCollection;
|
||||
theInterfaceVersion : HAsciiString from TCollection;
|
||||
|
||||
theIntegerBits : Integer;
|
||||
theMaxPower10Single : Integer;
|
||||
theMaxDigitsSingle : Integer;
|
||||
theMaxPower10Double : Integer;
|
||||
theMaxDigitsDouble : Integer;
|
||||
|
||||
theReceiveName : HAsciiString from TCollection;
|
||||
|
||||
theScale : Real;
|
||||
theUnitFlag : Integer;
|
||||
theUnitName : HAsciiString from TCollection;
|
||||
theLineWeightGrad : Integer;
|
||||
theMaxLineWeight : Real;
|
||||
theDate : HAsciiString from TCollection;
|
||||
theResolution : Real;
|
||||
theMaxCoord : Real;
|
||||
hasMaxCoord : Boolean;
|
||||
|
||||
theAuthorName : HAsciiString from TCollection;
|
||||
theCompanyName : HAsciiString from TCollection;
|
||||
theIGESVersion : Integer;
|
||||
theDraftingStandard : Integer;
|
||||
|
||||
theLastChangeDate : HAsciiString from TCollection; -- only from IGES-5.1
|
||||
theAppliProtocol : HAsciiString from TCollection; -- only from IGES-5.3
|
||||
|
||||
end GlobalSection;
|
889
src/IGESData/IGESData_GlobalSection.cxx
Executable file
889
src/IGESData/IGESData_GlobalSection.cxx
Executable file
@@ -0,0 +1,889 @@
|
||||
//#52 rln 06.01.99 writing value 1.e-07
|
||||
//gka 19.01.99 changing size of ParamSet
|
||||
//#65 rln 12.02.99 S4151 (explicitly force YYMMDD.HHMMSS before Y2000 and YYYYMMDD.HHMMSS after Y2000)
|
||||
//#66 rln Setting IGES 5.3 by default
|
||||
//#73 rln 10.03.99 S4135: "read.scale.unit" is applied after translation
|
||||
#include <IGESData_GlobalSection.ixx>
|
||||
#include <Interface_ParamType.hxx>
|
||||
#include <Interface_FloatWriter.hxx>
|
||||
#include <Interface_FileReaderData.hxx>
|
||||
#include <Interface_FileParameter.hxx>
|
||||
#include <OSD_Process.hxx>
|
||||
#include <Quantity_Date.hxx>
|
||||
#include <Interface_Static.hxx>
|
||||
#include <IGESData_BasicEditor.hxx>
|
||||
#include <stdio.h>
|
||||
|
||||
// MGE 21/07/98
|
||||
#include <Message_Msg.hxx>
|
||||
|
||||
#include <UnitsMethods.hxx>
|
||||
|
||||
// valeurs en MILLIMETRE pardefaut, reajustable
|
||||
//static Standard_Real convunit = 1000.;
|
||||
|
||||
|
||||
// Routines locales copiant une string [l`ideal serait : astr = astr->Copy()]
|
||||
// et transformant un CString (Hollerith ou non) en HAsciiString non Holl.
|
||||
// et l inverse
|
||||
|
||||
|
||||
static void CopyString (Handle(TCollection_HAsciiString)& astr);
|
||||
|
||||
static void MakeHollerith(const Handle(TCollection_HAsciiString)& astr,
|
||||
char* text, Standard_Integer& lt);
|
||||
|
||||
void CopyString (Handle(TCollection_HAsciiString)& astr)
|
||||
{
|
||||
if (astr.IsNull()) return; // ne rien faire si String pas definie !
|
||||
Handle(TCollection_HAsciiString) S = new TCollection_HAsciiString("");
|
||||
S->AssignCat(astr); astr = S;
|
||||
}
|
||||
|
||||
void MakeHollerith(const Handle(TCollection_HAsciiString)& astr,
|
||||
char* text, Standard_Integer& lt)
|
||||
{
|
||||
lt = 0; text[0] = '\0';
|
||||
if (astr.IsNull()) return;
|
||||
Standard_Integer ln = astr->Length();
|
||||
if (ln == 0) return;
|
||||
sprintf (text,"%dH%s",ln,astr->ToCString());
|
||||
lt = ln+2; if (ln >= 10) lt ++; if (ln >= 100) lt ++; // strlen text
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IGESData_GlobalSection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
IGESData_GlobalSection::IGESData_GlobalSection ()
|
||||
{
|
||||
// convunit = 1000.;
|
||||
//#73 rln 10.03.99 S4135: "read.scale.unit" is applied after translation
|
||||
//if (Interface_Static::IVal("read.scale.unit") == 1) convunit = 1;
|
||||
}
|
||||
|
||||
|
||||
// pourrait etre une methode generale au package en fait
|
||||
//=======================================================================
|
||||
//function : TranslatedFromHollerith
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESData_GlobalSection::TranslatedFromHollerith
|
||||
(const Handle(TCollection_HAsciiString)& astr) const
|
||||
{
|
||||
Handle(TCollection_HAsciiString) res;
|
||||
if (astr.IsNull()) return res;
|
||||
Standard_Integer n = astr->Search("H");
|
||||
if (n > 1) {
|
||||
if (!astr->Token("H")->IsIntegerValue()) n = 0;
|
||||
}
|
||||
if (n > 1 && n < astr->Length()) res = astr->SubString(n+1,astr->Length());
|
||||
else if(astr->ToCString()== NULL)
|
||||
res = new TCollection_HAsciiString;
|
||||
else res = new TCollection_HAsciiString(astr->ToCString());
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_GlobalSection::Init(const Handle(Interface_ParamSet)& params,
|
||||
Handle(Interface_Check)& ach)
|
||||
{
|
||||
// MGE 21/07/98
|
||||
// Building of messages
|
||||
//======================================
|
||||
//Message_Msg Msg39 ("XSTEP_39");
|
||||
//Message_Msg Msg48 ("XSTEP_48");
|
||||
//Message_Msg Msg49 ("XSTEP_49");
|
||||
//======================================
|
||||
|
||||
theSeparator = ','; theEndMark = ';';
|
||||
theSendName.Nullify(); theFileName.Nullify(); theSystemId.Nullify();
|
||||
theInterfaceVersion.Nullify();
|
||||
theIntegerBits = 32; // par defaut, simple = entier = 32b, double = 64
|
||||
theMaxPower10Single = 38; theMaxDigitsSingle = 6;
|
||||
theMaxPower10Double = 308; theMaxDigitsDouble = 15;
|
||||
theReceiveName.Nullify();
|
||||
theScale = 1.0;
|
||||
theUnitFlag = 0; theUnitName.Nullify();
|
||||
theLineWeightGrad = 1; theMaxLineWeight = 0.;
|
||||
theDate.Nullify();
|
||||
theResolution = 0.; theMaxCoord = 0.; hasMaxCoord = Standard_False;
|
||||
theAuthorName.Nullify(); theCompanyName.Nullify();
|
||||
theIGESVersion = 11;//3 //#66 rln Setting IGES 5.3 by default(To avoid misleading fails below)
|
||||
theDraftingStandard = 0;
|
||||
theLastChangeDate.Nullify(); // nouveaute 5.1 (peut etre absente)
|
||||
theAppliProtocol.Nullify(); // nouveaute 5.3 (peut etre absente)
|
||||
|
||||
Standard_Integer nbp = params->NbParams();
|
||||
|
||||
// Sending of message : Incorrect number of parameters (following the IGES version)
|
||||
// Version less than 5.3
|
||||
if (theIGESVersion < 11)
|
||||
if ((nbp < 24) || (nbp > 25)) {
|
||||
// 24 or 25 parameters are expected (parameter 25 is not required)
|
||||
Message_Msg Msg39 ("XSTEP_39");
|
||||
Msg39.Arg(24);
|
||||
Msg39.Arg(25);
|
||||
if (nbp < 24) ach->SendFail(Msg39);
|
||||
else ach->SendWarning(Msg39);
|
||||
}
|
||||
|
||||
// Version 5.3
|
||||
else if ((nbp < 25) || (nbp > 26)) {
|
||||
// 25 or 26 parameters are expected (parameter 25 is not required)
|
||||
Message_Msg Msg39 ("XSTEP_39");
|
||||
Msg39.Arg(25);
|
||||
Msg39.Arg(26);
|
||||
if (nbp < 25) ach->SendFail(Msg39);
|
||||
else ach->SendWarning(Msg39);
|
||||
}
|
||||
|
||||
for (Standard_Integer i = 1; i <= nbp; i ++) {
|
||||
Standard_Integer intval = 0; Standard_Real realval = 0.0;
|
||||
Handle(TCollection_HAsciiString) strval; // doit repartir a null
|
||||
//char message[80]; //szv#4:S4163:12Mar99 unused
|
||||
Standard_CString val = params->Param(i).CValue();
|
||||
Interface_ParamType fpt = params->Param(i).ParamType();
|
||||
if (fpt == Interface_ParamVoid) continue;
|
||||
|
||||
// if the param is an Integer
|
||||
if (fpt == Interface_ParamInteger) {
|
||||
// but a real is expected
|
||||
if ( i == 13 || i == 17 || i == 19 || i == 20)
|
||||
realval = atof(val);
|
||||
intval = atoi(val);
|
||||
}
|
||||
|
||||
// if the param is a Real
|
||||
else if (fpt == Interface_ParamReal || fpt == Interface_ParamEnum) {
|
||||
char text[50];
|
||||
Standard_Integer k , j = 0;
|
||||
for (k = 0; k < 50; k ++) {
|
||||
if (val[k] == 'D' || val[k] == 'd')
|
||||
text[j++] = 'e';
|
||||
else
|
||||
text[j++] = val[k];
|
||||
if (val[k] == '\0') break;
|
||||
}
|
||||
realval = atof(text);//Interface_FileReaderData::Fastof(val);
|
||||
}
|
||||
|
||||
// if the param is a text
|
||||
else if (fpt == Interface_ParamText) {
|
||||
strval = new TCollection_HAsciiString (val);
|
||||
if (val[0] != '\0') {
|
||||
Standard_Integer nhol = strval->Search("H");
|
||||
Standard_Integer lhol = strval->Length();
|
||||
if (nhol > 1)
|
||||
if (!strval->Token("H")->IsIntegerValue()) nhol = 0;
|
||||
if (nhol > 1 && nhol < lhol)
|
||||
strval = strval->SubString(nhol+1,lhol);
|
||||
}
|
||||
}
|
||||
|
||||
char sepend = '\0';
|
||||
if (i < 3) {
|
||||
if (val[0] != '\0') sepend = val[0];
|
||||
if (val[1] == 'H') sepend = val[2]; // prioritaire
|
||||
}
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 1 : if (sepend != '\0') theSeparator = sepend; break;
|
||||
case 2 : if (sepend != '\0') theEndMark = sepend; break;
|
||||
case 3 : theSendName = strval; break;
|
||||
case 4 : theFileName = strval; break;
|
||||
case 5 : theSystemId = strval; break;
|
||||
case 6 : theInterfaceVersion = strval; break;
|
||||
case 7 : theIntegerBits = intval; break;
|
||||
case 8 : theMaxPower10Single = intval; break;
|
||||
case 9 : theMaxDigitsSingle = intval; break;
|
||||
case 10 : theMaxPower10Double = intval; break;
|
||||
case 11 : theMaxDigitsDouble = intval; break;
|
||||
case 12 : theReceiveName = strval; break;
|
||||
case 13 : theScale = realval; break;
|
||||
case 14 : theUnitFlag = intval; break;
|
||||
case 15 : theUnitName = strval; break;
|
||||
case 16 : theLineWeightGrad = intval; break;
|
||||
case 17 : theMaxLineWeight = realval; break;
|
||||
case 18 : theDate = strval; break;
|
||||
case 19 : theResolution = realval; break;
|
||||
case 20 : theMaxCoord = realval;
|
||||
hasMaxCoord = Standard_True; break;
|
||||
case 21 : theAuthorName = strval; break;
|
||||
case 22 : theCompanyName = strval; break;
|
||||
case 23 : theIGESVersion = intval; break;
|
||||
case 24 : theDraftingStandard = intval; break;
|
||||
case 25 : theLastChangeDate = strval; break;
|
||||
case 26 : theAppliProtocol = strval; break;
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
|
||||
//:45 by abv 11.12.97: if UnitFlag is not defined in the file,
|
||||
// restore it from UnitName. Repris par CKY 13-FEV-1998
|
||||
if ( theUnitFlag == 0 || theUnitFlag == 3 ) {
|
||||
Standard_Integer corrected = 0 ;
|
||||
if(theUnitName.IsNull())
|
||||
//default (inches) value taken
|
||||
corrected = 1;
|
||||
else
|
||||
corrected = IGESData_BasicEditor::UnitNameFlag (theUnitName->ToCString());
|
||||
if (corrected > 0) theUnitFlag = corrected;
|
||||
else if (theUnitFlag == 3) {
|
||||
Message_Msg Msg49 ("XSTEP_49");
|
||||
ach->SendWarning (Msg49);
|
||||
}
|
||||
else {
|
||||
Message_Msg Msg48 ("XSTEP_48");
|
||||
ach->SendFail (Msg48);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CopyRefs
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_GlobalSection::CopyRefs ()
|
||||
{
|
||||
CopyString(theSendName); CopyString(theFileName); CopyString(theSystemId);
|
||||
CopyString(theInterfaceVersion); CopyString(theReceiveName);
|
||||
CopyString(theUnitName); CopyString(theDate);
|
||||
CopyString(theAuthorName); CopyString(theCompanyName);
|
||||
CopyString(theLastChangeDate); CopyString(theAppliProtocol);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Params
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Interface_ParamSet) IGESData_GlobalSection::Params () const
|
||||
{
|
||||
char vide[1]; char uncar[2]; char nombre[20]; char text[200];
|
||||
Standard_Integer lt;
|
||||
vide[0] = uncar[1] = '\0'; uncar[0] = ',';
|
||||
Handle(Interface_ParamSet) res = new Interface_ParamSet(26); //gka 19.01.99
|
||||
if (theSeparator == ',') res->Append (vide,0,Interface_ParamVoid,0);
|
||||
else { uncar[0] = theSeparator; res->Append (uncar,1,Interface_ParamMisc,0); }
|
||||
|
||||
if (theEndMark == ';') res->Append (vide,0,Interface_ParamVoid,0);
|
||||
else { uncar[0] = theEndMark; res->Append (uncar,1,Interface_ParamMisc,0); }
|
||||
|
||||
MakeHollerith (theSendName,text,lt);
|
||||
res->Append (text,lt, Interface_ParamText,0);
|
||||
|
||||
MakeHollerith (theFileName,text,lt);
|
||||
res->Append (text,lt, Interface_ParamText,0);
|
||||
|
||||
MakeHollerith (theSystemId,text,lt);
|
||||
res->Append (text,lt, Interface_ParamText,0);
|
||||
|
||||
MakeHollerith (theInterfaceVersion,text,lt);
|
||||
res->Append (text,lt, Interface_ParamText,0);
|
||||
|
||||
sprintf(nombre,"%d",theIntegerBits);
|
||||
res->Append (nombre,strlen(nombre),Interface_ParamInteger,0);
|
||||
|
||||
sprintf(nombre,"%d",theMaxPower10Single);
|
||||
res->Append (nombre,strlen(nombre),Interface_ParamInteger,0);
|
||||
|
||||
sprintf(nombre,"%d",theMaxDigitsSingle);
|
||||
res->Append (nombre,strlen(nombre),Interface_ParamInteger,0);
|
||||
|
||||
sprintf(nombre,"%d",theMaxPower10Double);
|
||||
res->Append (nombre,strlen(nombre),Interface_ParamInteger,0);
|
||||
|
||||
sprintf(nombre,"%d",theMaxDigitsDouble);
|
||||
res->Append (nombre,strlen(nombre),Interface_ParamInteger,0);
|
||||
|
||||
MakeHollerith (theReceiveName,text,lt);
|
||||
res->Append (text,lt, Interface_ParamText,0);
|
||||
|
||||
Interface_FloatWriter::Convert (theScale,nombre,Standard_True,0.,0.,"%f","%f");
|
||||
// sprintf(nombre,"%f",theScale);
|
||||
res->Append (nombre,strlen(nombre),Interface_ParamReal,0);
|
||||
|
||||
sprintf(nombre,"%d",theUnitFlag);
|
||||
res->Append (nombre,strlen(nombre),Interface_ParamInteger,0);
|
||||
|
||||
MakeHollerith (theUnitName,text,lt);
|
||||
res->Append (text,lt, Interface_ParamText,0);
|
||||
|
||||
sprintf(nombre,"%d",theLineWeightGrad);
|
||||
res->Append (nombre,strlen(nombre),Interface_ParamInteger,0);
|
||||
|
||||
Interface_FloatWriter::Convert (theMaxLineWeight,nombre,Standard_True,0.,0.,"%f","%f");
|
||||
// sprintf(nombre,"%f",theMaxLineWeight);
|
||||
res->Append (nombre,strlen(nombre),Interface_ParamReal,0);
|
||||
|
||||
MakeHollerith (theDate,text,lt);
|
||||
res->Append (text,lt, Interface_ParamText,0);
|
||||
|
||||
Interface_FloatWriter::Convert (theResolution,nombre,Standard_True,0.,0.,"%g","%g");
|
||||
// sprintf(nombre,"%f",theResolution);
|
||||
res->Append (nombre,strlen(nombre),Interface_ParamReal,0);
|
||||
|
||||
if (hasMaxCoord)
|
||||
Interface_FloatWriter::Convert (theMaxCoord,nombre,Standard_True,0.,0.,"%f","%f");
|
||||
// sprintf(nombre,"%f",theMaxCoord);
|
||||
else nombre[0] = '\0';
|
||||
res->Append (nombre,strlen(nombre),Interface_ParamReal,0);
|
||||
|
||||
MakeHollerith (theAuthorName,text,lt);
|
||||
res->Append (text,lt, Interface_ParamText,0);
|
||||
|
||||
MakeHollerith (theCompanyName,text,lt);
|
||||
res->Append (text,lt, Interface_ParamText,0);
|
||||
|
||||
sprintf(nombre,"%d",theIGESVersion);
|
||||
res->Append (nombre,strlen(nombre),Interface_ParamInteger,0);
|
||||
|
||||
sprintf(nombre,"%d",theDraftingStandard);
|
||||
res->Append (nombre,strlen(nombre),Interface_ParamInteger,0);
|
||||
|
||||
if (!theLastChangeDate.IsNull()) {
|
||||
MakeHollerith (theLastChangeDate,text,lt);
|
||||
res->Append (text,lt, Interface_ParamText,0);
|
||||
}
|
||||
|
||||
if (!theAppliProtocol.IsNull()) {
|
||||
MakeHollerith (theAppliProtocol,text,lt);
|
||||
res->Append (text,lt, Interface_ParamText,0);
|
||||
}
|
||||
// Ici : parametre absent ignore
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
// ############### QUERIES ###############
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Separator
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Character IGESData_GlobalSection::Separator () const
|
||||
{
|
||||
return theSeparator;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : EndMark
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Character IGESData_GlobalSection::EndMark () const
|
||||
{
|
||||
return theEndMark;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SendName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESData_GlobalSection::SendName () const
|
||||
{
|
||||
return theSendName;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : FileName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESData_GlobalSection::FileName () const
|
||||
{
|
||||
return theFileName;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SystemId
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESData_GlobalSection::SystemId () const
|
||||
{
|
||||
return theSystemId;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : InterfaceVersion
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESData_GlobalSection::InterfaceVersion () const
|
||||
{
|
||||
return theInterfaceVersion;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IntegerBits
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer IGESData_GlobalSection::IntegerBits () const
|
||||
{
|
||||
return theIntegerBits;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MaxPower10Single
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer IGESData_GlobalSection::MaxPower10Single () const
|
||||
{
|
||||
return theMaxPower10Single;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MaxDigitsSingle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer IGESData_GlobalSection::MaxDigitsSingle () const
|
||||
{
|
||||
return theMaxDigitsSingle;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MaxPower10Double
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer IGESData_GlobalSection::MaxPower10Double () const
|
||||
{
|
||||
return theMaxPower10Double;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MaxDigitsDouble
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer IGESData_GlobalSection::MaxDigitsDouble () const
|
||||
{
|
||||
return theMaxDigitsDouble;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ReceiveName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESData_GlobalSection::ReceiveName () const
|
||||
{
|
||||
return theReceiveName;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Scale
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real IGESData_GlobalSection::Scale () const
|
||||
{
|
||||
return theScale;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : UnitFlag
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer IGESData_GlobalSection::UnitFlag () const
|
||||
{
|
||||
return theUnitFlag;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : UnitName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESData_GlobalSection::UnitName () const
|
||||
{
|
||||
return theUnitName;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : LineWeightGrad
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer IGESData_GlobalSection::LineWeightGrad () const
|
||||
{
|
||||
return theLineWeightGrad;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MaxLineWeight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real IGESData_GlobalSection::MaxLineWeight () const
|
||||
{
|
||||
return theMaxLineWeight;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Date
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESData_GlobalSection::Date () const
|
||||
{
|
||||
return theDate;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Resolution
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real IGESData_GlobalSection::Resolution () const
|
||||
{
|
||||
return theResolution;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MaxCoord
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real IGESData_GlobalSection::MaxCoord () const
|
||||
{
|
||||
return theMaxCoord;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : HasMaxCoord
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean IGESData_GlobalSection::HasMaxCoord () const
|
||||
{
|
||||
return hasMaxCoord;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : AuthorName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESData_GlobalSection::AuthorName () const
|
||||
{
|
||||
return theAuthorName;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CompanyName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESData_GlobalSection::CompanyName () const
|
||||
{
|
||||
return theCompanyName;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IGESVersion
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer IGESData_GlobalSection::IGESVersion () const
|
||||
{
|
||||
return theIGESVersion;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : DraftingStandard
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer IGESData_GlobalSection::DraftingStandard () const
|
||||
{
|
||||
return theDraftingStandard;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : LastChangeDate
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESData_GlobalSection::LastChangeDate () const
|
||||
{
|
||||
return theLastChangeDate;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : HasLastChangeDate
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean IGESData_GlobalSection::HasLastChangeDate () const
|
||||
{
|
||||
return (!theLastChangeDate.IsNull());
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetLastChangeDate
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_GlobalSection::SetLastChangeDate ()
|
||||
{
|
||||
if (HasLastChangeDate()) return;
|
||||
Standard_Integer mois,jour,annee,heure,minute,seconde,millisec,microsec;
|
||||
OSD_Process system;
|
||||
Quantity_Date ladate = system.SystemDate();
|
||||
ladate.Values (mois,jour,annee,heure,minute,seconde,millisec,microsec);
|
||||
if (annee < 2000)
|
||||
//#65 rln 12.02.99 S4151 (explicitly force YYMMDD.HHMMSS before Y2000)
|
||||
theLastChangeDate = NewDateString (annee,mois,jour,heure,minute,seconde,0);
|
||||
else
|
||||
//#65 rln 12.02.99 S4151 (explicitly force YYYYMMDD.HHMMSS after Y2000)
|
||||
theLastChangeDate = NewDateString (annee,mois,jour,heure,minute,seconde, -1);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : HasApplicationProtocol
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean IGESData_GlobalSection::HasApplicationProtocol () const
|
||||
{
|
||||
return !theAppliProtocol.IsNull();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ApplicationProtocol
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESData_GlobalSection::ApplicationProtocol () const
|
||||
{
|
||||
return theAppliProtocol;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NewDateString
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESData_GlobalSection::NewDateString
|
||||
(const Standard_Integer annee, const Standard_Integer mois,
|
||||
const Standard_Integer jour, const Standard_Integer heure,
|
||||
const Standard_Integer minute, const Standard_Integer seconde,
|
||||
const Standard_Integer mode)
|
||||
{
|
||||
// 0 : IGES annee a l ancienne 00-99 -1 IGES annee complete 1 lisible
|
||||
char madate[60];
|
||||
Standard_Integer moi = mois , jou = jour , anne = annee;
|
||||
Standard_Integer heur = heure , minut = minute , second = seconde;
|
||||
if (annee == 0) {
|
||||
Standard_Integer millisec,microsec;
|
||||
OSD_Process system;
|
||||
Quantity_Date ladate = system.SystemDate();
|
||||
ladate.Values (moi,jou,anne,heur,minut,second,millisec,microsec);
|
||||
}
|
||||
if (mode == 0 || mode == -1) {
|
||||
Standard_Integer an = anne % 100;
|
||||
Standard_Boolean dizaine = (an >= 10);
|
||||
if (!dizaine) an += 10;
|
||||
if (mode < 0) { an = anne; dizaine = Standard_True; }
|
||||
Standard_Integer date1 = (an) * 10000 + moi * 100 + jou;
|
||||
Standard_Integer date2 = (heur + 100) * 10000 + minut * 100 + second;
|
||||
sprintf (madate,"%d%d",date1,date2);
|
||||
madate[(mode == 0 ? 6: 8)] = '.';
|
||||
if (!dizaine) madate[0] = '0';
|
||||
} else if (mode == 1) {
|
||||
sprintf (madate,"%4.4d-%2.2d-%2.2d:%2.2d-%2.2d-%2.2d",
|
||||
anne,moi,jou,heur,minut,second);
|
||||
}
|
||||
return new TCollection_HAsciiString(madate);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NewDateString
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESData_GlobalSection::NewDateString
|
||||
(const Handle(TCollection_HAsciiString)& date, const Standard_Integer mode)
|
||||
{
|
||||
Standard_Integer anne,moi,jou,heur,minut,second;
|
||||
if (date.IsNull()) return date;
|
||||
Standard_Integer i0 = 0;
|
||||
if (date->Length() == 15) i0 = 2;
|
||||
else if (date->Length() != 13) return date;
|
||||
if (date->Value(i0+7) != '.') return date;
|
||||
anne = (date->Value(i0+ 1) - 48) * 10 + (date->Value(i0+ 2) - 48);
|
||||
if (i0 == 0) {
|
||||
anne = anne + 1900;
|
||||
if (anne < 1980) anne += 100;
|
||||
} else {
|
||||
anne = anne + (date->Value(1) - 48) *1000 + (date->Value(2) - 48) * 100;
|
||||
}
|
||||
moi = (date->Value(i0+ 3) - 48) * 10 + (date->Value(i0+ 4) - 48);
|
||||
jou = (date->Value(i0+ 5) - 48) * 10 + (date->Value(i0+ 6) - 48);
|
||||
heur = (date->Value(i0+ 8) - 48) * 10 + (date->Value(i0+ 9) - 48);
|
||||
minut = (date->Value(i0+10) - 48) * 10 + (date->Value(i0+11) - 48);
|
||||
second = (date->Value(i0+12) - 48) * 10 + (date->Value(i0+13) - 48);
|
||||
|
||||
return IGESData_GlobalSection::NewDateString (anne,moi,jou,heur,minut,second,mode);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : UnitValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real IGESData_GlobalSection::UnitValue () const
|
||||
{
|
||||
return UnitsMethods::GetLengthFactorValue ( theUnitFlag ) /
|
||||
UnitsMethods::GetCasCadeLengthUnit(); //abv 22 Feb 00: adding cascade unit factor
|
||||
}
|
||||
|
||||
|
||||
// ############### UPDATES ###############
|
||||
|
||||
void IGESData_GlobalSection::SetSeparator (const Standard_Character val)
|
||||
{ theSeparator = val; }
|
||||
|
||||
void IGESData_GlobalSection::SetEndMark (const Standard_Character val)
|
||||
{ theEndMark = val; }
|
||||
|
||||
void IGESData_GlobalSection::SetSendName (const Handle(TCollection_HAsciiString)& val)
|
||||
{ theSendName = TranslatedFromHollerith(val); }
|
||||
|
||||
void IGESData_GlobalSection::SetFileName (const Handle(TCollection_HAsciiString)& val)
|
||||
{ theFileName = TranslatedFromHollerith(val); }
|
||||
|
||||
void IGESData_GlobalSection::SetSystemId (const Handle(TCollection_HAsciiString)& val)
|
||||
{ theSystemId = TranslatedFromHollerith(val); }
|
||||
|
||||
void IGESData_GlobalSection::SetInterfaceVersion (const Handle(TCollection_HAsciiString)& val)
|
||||
{ theInterfaceVersion = TranslatedFromHollerith(val); }
|
||||
|
||||
void IGESData_GlobalSection::SetIntegerBits (const Standard_Integer val)
|
||||
{ theIntegerBits = val; }
|
||||
|
||||
void IGESData_GlobalSection::SetMaxPower10Single (const Standard_Integer val)
|
||||
{ theMaxPower10Single = val; }
|
||||
|
||||
void IGESData_GlobalSection::SetMaxDigitsSingle (const Standard_Integer val)
|
||||
{ theMaxDigitsSingle = val; }
|
||||
|
||||
void IGESData_GlobalSection::SetMaxPower10Double (const Standard_Integer val)
|
||||
{ theMaxPower10Double = val; }
|
||||
|
||||
void IGESData_GlobalSection::SetMaxDigitsDouble (const Standard_Integer val)
|
||||
{ theMaxDigitsDouble = val; }
|
||||
|
||||
void IGESData_GlobalSection::SetReceiveName (const Handle(TCollection_HAsciiString)& val)
|
||||
{ theReceiveName = TranslatedFromHollerith(val); }
|
||||
|
||||
void IGESData_GlobalSection::SetScale (const Standard_Real val)
|
||||
{ theScale = val; }
|
||||
|
||||
void IGESData_GlobalSection::SetUnitFlag (const Standard_Integer val)
|
||||
{ theUnitFlag = val; }
|
||||
|
||||
void IGESData_GlobalSection::SetUnitName (const Handle(TCollection_HAsciiString)& val)
|
||||
{ theUnitName = TranslatedFromHollerith(val); }
|
||||
|
||||
void IGESData_GlobalSection::SetLineWeightGrad (const Standard_Integer val)
|
||||
{ theLineWeightGrad = val; }
|
||||
|
||||
void IGESData_GlobalSection::SetMaxLineWeight (const Standard_Real val)
|
||||
{ theMaxLineWeight = val; }
|
||||
|
||||
void IGESData_GlobalSection::SetDate (const Handle(TCollection_HAsciiString)& val)
|
||||
{ theDate = TranslatedFromHollerith(val); }
|
||||
|
||||
void IGESData_GlobalSection::SetResolution (const Standard_Real val)
|
||||
{ theResolution = val; }
|
||||
|
||||
void IGESData_GlobalSection::SetMaxCoord (const Standard_Real val)
|
||||
{
|
||||
hasMaxCoord = (val > 0.);
|
||||
theMaxCoord = (hasMaxCoord ? val : 0.);
|
||||
}
|
||||
|
||||
void IGESData_GlobalSection::MaxMaxCoord (const Standard_Real val)
|
||||
{
|
||||
Standard_Real aval = Abs(val);
|
||||
if (hasMaxCoord) { if (aval > theMaxCoord) theMaxCoord = aval; }
|
||||
else SetMaxCoord (aval);
|
||||
}
|
||||
|
||||
void IGESData_GlobalSection::MaxMaxCoords (const gp_XYZ& xyz)
|
||||
{ MaxMaxCoord (xyz.X()); MaxMaxCoord (xyz.Y()); MaxMaxCoord (xyz.Z()); }
|
||||
|
||||
|
||||
void IGESData_GlobalSection::SetAuthorName (const Handle(TCollection_HAsciiString)& val)
|
||||
{ theAuthorName = TranslatedFromHollerith(val); }
|
||||
|
||||
void IGESData_GlobalSection::SetCompanyName (const Handle(TCollection_HAsciiString)& val)
|
||||
{ theCompanyName = TranslatedFromHollerith(val); }
|
||||
|
||||
void IGESData_GlobalSection::SetIGESVersion (const Standard_Integer val)
|
||||
{ theIGESVersion = val; }
|
||||
|
||||
void IGESData_GlobalSection::SetDraftingStandard (const Standard_Integer val)
|
||||
{ theDraftingStandard = val; }
|
||||
|
||||
void IGESData_GlobalSection::SetLastChangeDate (const Handle(TCollection_HAsciiString)& val)
|
||||
{ theLastChangeDate = TranslatedFromHollerith(val); }
|
||||
|
||||
void IGESData_GlobalSection::SetApplicationProtocol (const Handle(TCollection_HAsciiString)& val)
|
||||
{ theAppliProtocol = TranslatedFromHollerith(val); }
|
90
src/IGESData/IGESData_IGESDumper.cdl
Executable file
90
src/IGESData/IGESData_IGESDumper.cdl
Executable file
@@ -0,0 +1,90 @@
|
||||
-- File: IGESData_IGESDumper.cdl
|
||||
-- Created: Mon Sep 6 14:50:24 1993
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class IGESDumper from IGESData
|
||||
|
||||
---Purpose : Provides a way to obtain a clear Dump of an IGESEntity
|
||||
-- (distinct from normalized output). It works with tools
|
||||
-- attached to Entities, as for normalized Reade and Write
|
||||
--
|
||||
-- For each Entity, displaying data is splitted in own data
|
||||
-- (specific to each type) and other attached data, which are
|
||||
-- defined for all IGES Types (either from "Directory Entry" or
|
||||
-- from Lists of Associativities and Properties)
|
||||
|
||||
uses Messenger from Message, Protocol from IGESData, IGESModel, IGESEntity, SpecificLib
|
||||
|
||||
raises InterfaceError
|
||||
|
||||
is
|
||||
|
||||
Create (model : IGESModel; protocol : Protocol from IGESData)
|
||||
returns IGESDumper;
|
||||
---Purpose : Returns an IGESDumper ready to work. The IGESModel provides
|
||||
-- the numbering of Entities : as for any InterfaceModel, it
|
||||
-- gives each Entity a number; but for IGESEntities, the "Number
|
||||
-- of Directory Entry" according to the definition of IGES Files,
|
||||
-- is also usefull
|
||||
|
||||
PrintDNum (me; ent : IGESEntity; S : Messenger from Message)
|
||||
---Purpose : Prints onto an output, the "Number of Directory Entry" which
|
||||
-- corresponds to an IGESEntity in the IGESModel, under the form
|
||||
-- "D#nnn" (a Null Handle gives D#0)
|
||||
raises InterfaceError;
|
||||
-- Error if <ent> is not contained in the IGESModel
|
||||
|
||||
PrintShort (me; ent : IGESEntity; S : Messenger from Message)
|
||||
---Purpose : Prints onto an output, the "Number of Directory Entry" (see
|
||||
-- PrintDNum) plus IGES Type and Form Numbers, which gives
|
||||
-- "D#nnn Type nnn Form nnn"
|
||||
raises InterfaceError;
|
||||
-- Error if <ent> is not contained in the IGESModel
|
||||
|
||||
Dump (me; ent : IGESEntity; S : Messenger from Message;
|
||||
own : Integer; attached : Integer = -1)
|
||||
-- <own> commands level for proper data :
|
||||
-- 0 : Only DNum (PrintDNum)
|
||||
-- 1 : DNum with IGES Type and Form N0s (PrintShort) & Type Name
|
||||
-- 2 : idem plus (if defined) DNum of Transf and of View, and
|
||||
-- (if defined) ShortLabel and Subscript Number
|
||||
-- 3 : idem plus (if defined) Value of Transf, DNum or Value of
|
||||
-- other Directory Data (Color, etc...)
|
||||
-- 4 and over : idem plus calls method OwnDump
|
||||
--
|
||||
-- When Implementing OwnDump, Please use this convention :
|
||||
-- Anyway, give true complete IGES Name for Entity
|
||||
-- 4 : proper values as store in the fields of the Entity,
|
||||
-- abbreviated if list is very long ...
|
||||
-- 5 : idem but complete display of fields (even if long)
|
||||
-- 6 : data under a comprehensive form if necessary, especially
|
||||
-- taking in account Transf (e.g. for a Circle : give in 3D
|
||||
-- Center, Radius, Axis ...)
|
||||
-- In addition, for referenced Entities, simply display them by
|
||||
-- call to PrintDNum above
|
||||
--
|
||||
-- <attached> commands level for Properties and Associativities
|
||||
-- with same signification as <own>, except for value 0 :
|
||||
-- if <own> = 0 or 1, these lists are NOT printed at all
|
||||
-- if <own> = 2, for each attached entity, call to PrintDNum
|
||||
-- if <own> over 2, for each attached entity, call to PrintShort
|
||||
-- (DNum with Type and Form numbers)
|
||||
-- In addition, -1 inhibits output (only DNum are printed)
|
||||
raises InterfaceError;
|
||||
-- Error if <ent> is not contained in the IGESModel
|
||||
-- Remark : if <ent> is Null, the message "(Null)" is displayed
|
||||
|
||||
|
||||
OwnDump (me; ent : IGESEntity; S : Messenger from Message; own : Integer);
|
||||
---Purpose : Specific Dump for each IGES Entity, call by Dump (just above)
|
||||
-- <own> is the parameter <own> from Dump
|
||||
|
||||
fields
|
||||
|
||||
themodel : IGESModel;
|
||||
thelib : SpecificLib;
|
||||
|
||||
end IGESDumper;
|
175
src/IGESData/IGESData_IGESDumper.cxx
Executable file
175
src/IGESData/IGESData_IGESDumper.cxx
Executable file
@@ -0,0 +1,175 @@
|
||||
#include <IGESData_IGESDumper.ixx>
|
||||
#include <Interface_InterfaceError.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <Interface_MSG.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <IGESData_SpecificLib.hxx>
|
||||
#include <IGESData_SpecificModule.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
|
||||
IGESData_IGESDumper::IGESData_IGESDumper
|
||||
(const Handle(IGESData_IGESModel)& model,
|
||||
const Handle(IGESData_Protocol)& protocol)
|
||||
: thelib (protocol)
|
||||
{ themodel = model; }
|
||||
|
||||
|
||||
void IGESData_IGESDumper::PrintDNum
|
||||
(const Handle(IGESData_IGESEntity)& ent, const Handle(Message_Messenger)& S) const
|
||||
{
|
||||
// Affichage garanti sur 12 caracteres 12345/D24689
|
||||
Standard_Integer num = 0;
|
||||
if (!ent.IsNull()) {
|
||||
if (themodel.IsNull()) S<<" D??? ";
|
||||
else if ( (num = themodel->Number(ent)) == 0) S<<" 0:D?????";
|
||||
// Interface_InterfaceError::Raise ("IGESDumper : PrintDNum");
|
||||
else {
|
||||
S<<Interface_MSG::Blanks(num,9)<<num<<":D"<<2*num-1<<Interface_MSG::Blanks(2*num-1,9);
|
||||
}
|
||||
}
|
||||
else S<<" D0(Null) ";
|
||||
}
|
||||
|
||||
void IGESData_IGESDumper::PrintShort
|
||||
(const Handle(IGESData_IGESEntity)& ent, const Handle(Message_Messenger)& S) const
|
||||
{
|
||||
// PrintDNum(ent,S);
|
||||
if (!ent.IsNull()) {
|
||||
Standard_Integer num = 0;
|
||||
if (!themodel.IsNull()) num = themodel->Number(ent);
|
||||
if (num > 0) S<<num<<":D"<<2*num-1;
|
||||
S << " Type:" << ent->TypeNumber() << " Form:" << ent->FormNumber()
|
||||
<< Interface_MSG::Blanks (ent->FormNumber(),3)
|
||||
<< " Class:"<< Interface_InterfaceModel::ClassName(ent->DynamicType()->Name());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void IGESData_IGESDumper::Dump
|
||||
(const Handle(IGESData_IGESEntity)& ent, const Handle(Message_Messenger)& S,
|
||||
const Standard_Integer own, const Standard_Integer attached) const
|
||||
{
|
||||
Standard_Integer att = attached;
|
||||
Standard_Integer diratt = 1;
|
||||
if (own < 3) diratt = own - 1;
|
||||
if (att == 0) att = diratt; // -1 signifie : ne rien sortir
|
||||
|
||||
if (own < 0) return;
|
||||
if (own > 1) S<<"\n";
|
||||
if (ent.IsNull()) { S<<"(Null)"; if (own > 1) S<<"\n"; return; }
|
||||
if (own == 0) { PrintDNum (ent,S); return; } // affichage auxiliaire
|
||||
if (own == 1) { PrintShort (ent,S); return; } // affichage auxiliaire
|
||||
|
||||
if (own > 0) S<<"**** Dump IGES, level "<<own<<" ( ";
|
||||
switch (own) {
|
||||
case 0 : break;
|
||||
case 1 : S<<"D.E. Number + Type + Name"; break;
|
||||
case 2 : S<<"D.E. Number + Type, Name + Transf, View"; break;
|
||||
case 3 : S<<"Complete Directory Part"; break;
|
||||
case 4 : S<<"Directory Part + Parameters, no Arrays"; break;
|
||||
case 5 : S<<"Complete"; break;
|
||||
default : S<<"Complete + Transformed Values"; break;
|
||||
}
|
||||
S<<" ) ****"<<endl;
|
||||
|
||||
// **** Entity 1234:D2467 ** Type:102 Form:56 ** CompositeCurve **
|
||||
S<<"\n"<<"**** Entity "; PrintShort (ent,S); S<<endl;
|
||||
|
||||
S<<" Directory Part"<<"\n";
|
||||
// ** Status : Blank:1 Subordinate:2 UseFlag:3 Hierarchy:4
|
||||
if (own >= 2)
|
||||
S <<"** Status Number : Blank:"<<ent->BlankStatus()
|
||||
<<" Subordinate:"<<ent->SubordinateStatus()
|
||||
<<" UseFlag:"<<ent->UseFlag()
|
||||
<<" Hierarchy:"<<ent->HierarchyStatus()<<"\n";
|
||||
if (own >= 1) {
|
||||
if (ent->HasShortLabel()) S<<"**** Label :"<<ent->ShortLabel()->ToCString();
|
||||
if (ent->HasSubScriptNumber()) S<<" SubScript:"<<ent->SubScriptNumber();
|
||||
if (ent->HasShortLabel()) S<<endl;
|
||||
|
||||
if (ent->HasTransf())
|
||||
{ S<<"** Transf.Matrix :"; PrintDNum(ent->Transf(),S); S<<"\n"; }
|
||||
IGESData_DefList viewkind = ent->DefView();
|
||||
if (viewkind == IGESData_DefOne)
|
||||
{ S<<"** View :"; PrintDNum (ent->View(),S); S<<"\n"; }
|
||||
if (viewkind == IGESData_DefSeveral)
|
||||
{ S<<"** View (List) :"; PrintDNum (ent->ViewList(),S); S<<"\n"; }
|
||||
|
||||
}
|
||||
|
||||
if (own >= 2) {
|
||||
|
||||
if (ent->HasStructure())
|
||||
{ S<<"** Structure :"; PrintDNum (ent->Structure(),S); S<<"\n"; }
|
||||
|
||||
S<<"\n"<<" Graphic Attributes"<<"\n";
|
||||
if (ent->DefLineFont() == IGESData_DefValue)
|
||||
{ S<<"** LineFont Value:"<<ent->RankLineFont()<<"\n"; }
|
||||
else if (ent->DefLineFont() == IGESData_DefReference)
|
||||
{ S<<"** LineFont Ref :"; PrintDNum (ent->LineFont(),S); S<<"\n"; }
|
||||
|
||||
if (ent->Level() > 0) S<<"** Level Value :"<<ent->Level()<<"\n";
|
||||
else if (ent->Level() < 0)
|
||||
{ S<<"** Level List :"; PrintDNum(ent->LevelList(),S); S<<"\n"; }
|
||||
|
||||
if (ent->HasLabelDisplay())
|
||||
{ S<<"** Label Display :"; PrintDNum (ent->LabelDisplay(),S); S<<"\n"; }
|
||||
if (ent->LineWeightNumber() != 0) {
|
||||
S <<"** LineWeight Num:"<<ent->LineWeightNumber();
|
||||
if (diratt > 0) S<<" -> Value:"<<ent->LineWeight();
|
||||
S<<endl;
|
||||
}
|
||||
if (ent->DefColor() == IGESData_DefValue)
|
||||
{ S<<"** Color Value :"<<ent->RankColor(); }
|
||||
else if (ent->DefColor() == IGESData_DefReference)
|
||||
{ S<<"** Color Ref :"; PrintDNum (ent->Color(),S); }
|
||||
S<<endl;
|
||||
|
||||
if (own > 3) {
|
||||
S<<"**** Own Data ****"<<"\n\n";
|
||||
OwnDump(ent,S,own);
|
||||
}
|
||||
}
|
||||
|
||||
// Donnees attachees : Properties, Associativities, et Sharings
|
||||
if (att < 0) return;
|
||||
Interface_EntityIterator iter = ent->Properties();
|
||||
Standard_Integer nb = iter.NbEntities();
|
||||
Standard_Boolean iasuit = (nb > 0);
|
||||
if (nb > 0) {
|
||||
S<<"\n"<<"**** Properties (nb:"<<nb<<") ****"<<"\n";
|
||||
for (;iter.More(); iter.Next()) {
|
||||
DeclareAndCast(IGESData_IGESEntity,ent2,iter.Value());
|
||||
Dump (ent2,S,att,-1);
|
||||
}
|
||||
}
|
||||
iter = ent->Associativities();
|
||||
nb = iter.NbEntities();
|
||||
if (nb > 0) iasuit = Standard_True;
|
||||
if (nb > 0) {
|
||||
S<<"\n"<<"**** Associativities (nb:"<<nb<<") ****"<<"\n";
|
||||
for (;iter.More(); iter.Next()) {
|
||||
DeclareAndCast(IGESData_IGESEntity,ent2,iter.Value());
|
||||
Dump(ent2,S,att,-1);
|
||||
}
|
||||
}
|
||||
if (iasuit) { if (att <= 1) S << "\n"; }
|
||||
S<<"\n"<<"**** End of Dump ****"<<"\n"<<endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void IGESData_IGESDumper::OwnDump
|
||||
(const Handle(IGESData_IGESEntity)& ent, const Handle(Message_Messenger)& S,
|
||||
const Standard_Integer own) const
|
||||
{
|
||||
Handle(IGESData_SpecificModule) module; Standard_Integer CN;
|
||||
if (thelib.Select(ent,module,CN))
|
||||
module->OwnDump(CN,ent,*this,S,own);
|
||||
else if (themodel.IsNull())
|
||||
S <<" **** Dump impossible. Type "<<ent->DynamicType()->Name()<<endl;
|
||||
else
|
||||
S <<" **** Dump Impossible, n0:id:"<<themodel->Number(ent)<<":D"
|
||||
<<themodel->DNum(ent)<<" Type "<<ent->DynamicType()->Name()<<endl;
|
||||
}
|
362
src/IGESData/IGESData_IGESEntity.cdl
Executable file
362
src/IGESData/IGESData_IGESEntity.cdl
Executable file
@@ -0,0 +1,362 @@
|
||||
-- File: IGESEntity.cdl
|
||||
-- Created: Tue Apr 7 09:14:03 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
deferred class IGESEntity from IGESData inherits TShared
|
||||
|
||||
---Purpose : defines root of IGES Entity definition, including Directory
|
||||
-- Part, lists of (optionnal) Properties and Associativities
|
||||
|
||||
uses CString, Type, HAsciiString from TCollection, OStream, GTrsf,
|
||||
EntityList, EntityIterator,
|
||||
IGESType, DefSwitch, DefType, DefList,
|
||||
LineFontEntity, LevelListEntity, ViewKindEntity,
|
||||
TransfEntity, LabelDisplayEntity, ColorEntity
|
||||
|
||||
raises InterfaceError
|
||||
|
||||
is
|
||||
|
||||
Initialize;
|
||||
---Purpose : prepares lists of optionnal data, set values to defaults
|
||||
|
||||
Clear (me : mutable) is private;
|
||||
---Purpose : Clears specific IGES data
|
||||
|
||||
-- -- Queries on Componants (Directory Part, optional lists) -- --
|
||||
|
||||
IGESType (me) returns IGESType;
|
||||
---Purpose : gives IGES typing info (includes "Type" and "Form" data)
|
||||
|
||||
TypeNumber (me) returns Integer;
|
||||
---Purpose : gives IGES Type Number (often coupled with Form Number)
|
||||
|
||||
FormNumber (me) returns Integer;
|
||||
---Purpose : Returns the form number for that
|
||||
-- type of an IGES entity. The default form number is 0.
|
||||
|
||||
|
||||
DirFieldEntity (me; fieldnum : Integer) returns IGESEntity;
|
||||
---Purpose : Returns the Entity which has been recorded for a given
|
||||
-- Field Number, i.e. without any cast. Maps with :
|
||||
-- 3 : Structure 4 : LineFont 5 : LevelList 6 : View
|
||||
-- 7 : Transf(ormation Matrix) 8 : LabelDisplay
|
||||
-- 13 : Color. Other values give a null handle
|
||||
-- It can then be of any kind, while specific items have a Type
|
||||
|
||||
HasStructure (me) returns Boolean;
|
||||
---Purpose : returns True if an IGESEntity is defined with a Structure
|
||||
-- (it is normally reserved for certain classes, such as Macros)
|
||||
|
||||
Structure (me) returns IGESEntity;
|
||||
---Purpose : Returns Structure (used by some types of IGES Entities only)
|
||||
-- Returns a Null Handle if Structure is not defined
|
||||
|
||||
DefLineFont (me) returns DefType is virtual;
|
||||
---Purpose : Returns the definition status of LineFont
|
||||
|
||||
RankLineFont (me) returns Integer;
|
||||
---Purpose : Returns LineFont definition as an Integer (if defined as Rank)
|
||||
-- If LineFont is defined as an Entity, returns a negative value
|
||||
|
||||
LineFont (me) returns LineFontEntity;
|
||||
---Purpose : Returns LineFont as an Entity (if defined as Reference)
|
||||
-- Returns a Null Handle if DefLineFont is not "DefReference"
|
||||
|
||||
DefLevel (me) returns DefList is virtual;
|
||||
---Purpose : Returns the definition status of Level
|
||||
|
||||
Level (me) returns Integer;
|
||||
---Purpose : Returns the level the entity
|
||||
-- belongs to. Returns -1 if the entity belongs to more than one level.
|
||||
|
||||
LevelList (me) returns LevelListEntity;
|
||||
---Purpose : Returns LevelList if Level is
|
||||
-- defined as a list. Returns a null handle if DefLevel is not DefSeveral.
|
||||
|
||||
DefView (me) returns DefList is virtual;
|
||||
---Purpose : Returns the definition status of
|
||||
-- the view. This can be: none, one or several.
|
||||
|
||||
View (me) returns ViewKindEntity;
|
||||
---Purpose : Returns the view of this IGES entity.
|
||||
-- This view can be a single view or a list of views.
|
||||
-- Warning A null handle is returned if the view is not defined.
|
||||
|
||||
SingleView (me) returns ViewKindEntity;
|
||||
---Purpose : Returns the view as a single view
|
||||
-- if it was defined as such and not as a list of views.
|
||||
-- Warning A null handle is returned if DefView does not have the value DefOne.
|
||||
|
||||
ViewList (me) returns ViewKindEntity;
|
||||
---Purpose : Returns the view of this IGES entity as a list.
|
||||
-- Warning A null handle is returned if the
|
||||
-- definition status does not have the value DefSeveral.
|
||||
|
||||
HasTransf (me) returns Boolean;
|
||||
---Purpose : Returns True if a Transformation Matrix is defined
|
||||
|
||||
Transf (me) returns TransfEntity;
|
||||
---Purpose : Returns the Transformation Matrix (under IGES definition)
|
||||
-- Returns a Null Handle if there is none
|
||||
-- for a more complete use, see Location & CompoundLocation
|
||||
|
||||
HasLabelDisplay (me) returns Boolean;
|
||||
---Purpose : Returns True if a LabelDisplay mode is defined for this entity
|
||||
|
||||
LabelDisplay (me) returns LabelDisplayEntity;
|
||||
---Purpose : Returns the Label Display
|
||||
-- Associativity Entity if there is one. Returns a null handle if there is none.
|
||||
|
||||
BlankStatus (me) returns Integer;
|
||||
---Purpose : gives Blank Status (0 visible, 1 blanked)
|
||||
|
||||
SubordinateStatus (me) returns Integer;
|
||||
---Purpose : gives Subordinate Switch (0-1-2-3)
|
||||
|
||||
UseFlag (me) returns Integer;
|
||||
---Purpose : gives Entity's Use Flag (0 to 5)
|
||||
|
||||
HierarchyStatus (me) returns Integer;
|
||||
---Purpose : gives Hierarchy status (0-1-2)
|
||||
|
||||
LineWeightNumber (me) returns Integer;
|
||||
---Purpose : Returns the LineWeight Number (0 not defined), see also LineWeight
|
||||
|
||||
LineWeight (me) returns Real;
|
||||
---Purpose : Returns the true Line Weight, computed from LineWeightNumber and
|
||||
-- Global Parameter in the Model by call to SetLineWeight
|
||||
|
||||
DefColor (me) returns DefType is virtual;
|
||||
---Purpose : Returns the definition status of Color.
|
||||
|
||||
RankColor (me) returns Integer;
|
||||
---Purpose : Returns the color definition as
|
||||
-- an integer value if the color was defined as a rank.
|
||||
-- Warning A negative value is returned if the color was defined as an entity.
|
||||
|
||||
Color (me) returns ColorEntity;
|
||||
---Purpose : Returns the IGES entity which
|
||||
-- describes the color of the entity.
|
||||
-- Returns a null handle if this entity was defined as an integer.
|
||||
|
||||
CResValues (me; res1,res2 : CString) returns Boolean;
|
||||
---Purpose : returns "reserved" alphanumeric values res1 and res2
|
||||
-- res1 and res2 have to be reserved as Character[9 at least]
|
||||
-- (remark : their content is changed)
|
||||
-- returned values are ended by null character in 9th
|
||||
-- returned Boolean is False if res1 and res2 are blank, true else
|
||||
|
||||
HasShortLabel (me) returns Boolean;
|
||||
---Purpose : Returns true if a short label is defined.
|
||||
-- A short label is a non-blank 8-character string.
|
||||
|
||||
ShortLabel (me) returns HAsciiString from TCollection;
|
||||
---Purpose : Returns the label value for this IGES entity as a string.
|
||||
-- Warning If the label is blank, this string is null.
|
||||
|
||||
HasSubScriptNumber (me) returns Boolean is virtual;
|
||||
---Purpose : Returns true if a subscript number is defined.
|
||||
-- A subscript number is an integer used to identify a label.
|
||||
|
||||
SubScriptNumber (me) returns Integer;
|
||||
---Purpose : Returns the integer subscript number used to identify this IGES entity.
|
||||
-- Warning 0 is returned if no subscript number is defined for this IGES entity.
|
||||
|
||||
InitTypeAndForm (me : mutable; typenum,formnum : Integer) is protected;
|
||||
---Purpose : Initializes Type and Form Numbers to new values. Reserved for
|
||||
-- special uses
|
||||
|
||||
InitDirFieldEntity (me : mutable; fieldnum : Integer; ent : IGESEntity);
|
||||
---Purpose : Initializes a directory field as an Entiy of any kind
|
||||
-- See DirFieldEntity for more details
|
||||
|
||||
InitTransf (me : mutable; ent : TransfEntity);
|
||||
---Purpose : Initializes Transf, or erases it if <ent> is given Null
|
||||
|
||||
InitView (me : mutable; ent : ViewKindEntity);
|
||||
---Purpose : Initializes View, or erases it if <ent> is given Null
|
||||
|
||||
InitLineFont (me : mutable; ent : LineFontEntity; rank : Integer = 0);
|
||||
---Purpose : Initializes LineFont : if <ent> is not Null, it gives LineFont,
|
||||
-- else <rank> gives or erases (if zero) RankLineFont
|
||||
|
||||
InitLevel (me : mutable; ent : LevelListEntity; val : Integer = 0);
|
||||
---Purpose : Initializes Level : if <ent> is not Null, it gives LevelList,
|
||||
-- else <val> gives or erases (if zero) unique Level
|
||||
|
||||
InitColor (me : mutable; ent : ColorEntity; rank : Integer = 0);
|
||||
---Purpose : Initializes Color data : if <ent> is not Null, it gives Color,
|
||||
-- else <rank> gives or erases (if zero) RankColor
|
||||
|
||||
InitStatus (me : mutable; blank, subordinate, useflag, hierarchy : Integer);
|
||||
---Purpose : Initializes the Status of Directory Part
|
||||
|
||||
SetLabel (me : mutable; label : HAsciiString from TCollection;
|
||||
sub : Integer = -1);
|
||||
---Purpose : Sets a new Label to an IGES Entity
|
||||
-- If <sub> is given, it sets value of SubScriptNumber
|
||||
-- else, SubScriptNumber is erased
|
||||
|
||||
InitMisc (me : mutable; str : IGESEntity; lab : LabelDisplayEntity;
|
||||
weightnum : Integer);
|
||||
---Purpose : Initializes various data (those not yet seen above), or erases
|
||||
-- them if they are given as Null (Zero for <weightnum>) :
|
||||
-- <str> for Structure, <lab> for LabelDisplay, and
|
||||
-- <weightnum> for WeightNumber
|
||||
|
||||
-- -- Complements (with a basic sense) -- --
|
||||
|
||||
HasOneParent (me) returns Boolean;
|
||||
---Purpose : Returns True if an entity has one and only one parent, defined
|
||||
-- by a SingleParentEntity Type Associativity (explicit sharing).
|
||||
-- Thus, implicit sharing remains defined at model level
|
||||
-- (see class ToolLocation)
|
||||
|
||||
UniqueParent (me) returns IGESEntity raises InterfaceError;
|
||||
---Purpose : Returns the Unique Parent (in the sense given by HasOneParent)
|
||||
-- Error if there is none or several
|
||||
|
||||
Location (me) returns GTrsf;
|
||||
---Purpose : Returns Location given by Transf in Directory Part (see above)
|
||||
-- It must be considered for local definition : if the Entity is
|
||||
-- set in a "Parent", that one can add its one Location, but this
|
||||
-- is not taken in account here : see CompoundLocation for that.
|
||||
-- If no Transf is defined, returns Identity
|
||||
-- If Transf is itself compound, gives the final result
|
||||
|
||||
VectorLocation (me) returns GTrsf;
|
||||
---Purpose : Returns Location considered for Vectors, i.e. without its
|
||||
-- Translation Part. As Location, it gives local definition.
|
||||
|
||||
CompoundLocation (me) returns GTrsf;
|
||||
---Purpose : Returns Location by taking in account a Parent which has its
|
||||
-- own Location : that one will be combined to that of <me>
|
||||
-- The Parent is considered only if HasOneParent is True,
|
||||
-- else it is ignored and CompoundLocation = Location
|
||||
|
||||
HasName (me) returns Boolean;
|
||||
---Purpose : says if a Name is defined, as Short Label or as Name Property
|
||||
-- (Property is looked first, else ShortLabel is considered)
|
||||
|
||||
NameValue (me) returns HAsciiString from TCollection;
|
||||
---Purpose : returns Name value as a String (Property Name or ShortLabel)
|
||||
-- if SubNumber is defined, it is concatenated after ShortLabel
|
||||
-- as follows label(number). Ignored with a Property Name
|
||||
|
||||
-- -- Optionnal lists of Associativities and Properties -- --
|
||||
|
||||
ArePresentAssociativities (me) returns Boolean;
|
||||
---Purpose : Returns True if the Entity is defined with an Associativity
|
||||
-- list, even empty (that is, file contains its length 0)
|
||||
-- Else, the file contained NO idencation at all about this list.
|
||||
|
||||
NbAssociativities (me) returns Integer;
|
||||
---Purpose : gives number of recorded associativities (0 no list defined)
|
||||
|
||||
Associativities (me) returns EntityIterator;
|
||||
---Purpose : Returns the Associativity List under the form of an EntityIterator.
|
||||
|
||||
NbTypedAssociativities (me; atype : Type) returns Integer;
|
||||
---Purpose : gives how many Associativities have a given type
|
||||
|
||||
TypedAssociativity (me; atype : Type)
|
||||
returns mutable IGESEntity raises InterfaceError;
|
||||
---Purpose : returns the Associativity of a given Type (if only one exists)
|
||||
-- Error if none or more than one
|
||||
|
||||
AddAssociativity (me : mutable; ent : IGESEntity) is private;
|
||||
---Purpose : Adds an Associativity in the list (called by Associate only)
|
||||
|
||||
RemoveAssociativity (me : mutable; ent : IGESEntity) is private;
|
||||
---Purpose : Removes an Associativity from the list (called by Dissociate)
|
||||
|
||||
LoadAssociativities (me : mutable; list : EntityList) is protected;
|
||||
---Purpose : Loads a complete, already loaded, List of Asociativities
|
||||
-- (used during Read or Copy Operations)
|
||||
|
||||
ClearAssociativities (me : mutable) is private;
|
||||
---Purpose : Removes all associativities in once
|
||||
|
||||
Associate (me ; ent : mutable IGESEntity);
|
||||
---Purpose : Sets "me" in the Associativity list of another Entity
|
||||
|
||||
Dissociate (me ; ent : mutable IGESEntity);
|
||||
---Purpose : Resets "me" from the Associativity list of another Entity
|
||||
|
||||
|
||||
ArePresentProperties (me) returns Boolean;
|
||||
---Purpose : Returns True if the Entity is defined with a Property list,
|
||||
-- even empty (that is, file contains its length 0)
|
||||
-- Else, the file contained NO idencation at all about this list
|
||||
|
||||
NbProperties (me) returns Integer;
|
||||
---Purpose : Gives number of recorded properties (0 no list defined)
|
||||
|
||||
Properties (me) returns EntityIterator;
|
||||
---Purpose : Returns Property List under the form of an EntityIterator
|
||||
|
||||
NbTypedProperties (me; atype : Type) returns Integer;
|
||||
---Purpose : gives how many Properties have a given type
|
||||
|
||||
TypedProperty (me; atype : Type; anum : Integer = 0)
|
||||
returns mutable IGESEntity raises InterfaceError;
|
||||
---Purpose : returns the Property of a given Type
|
||||
-- Error if none or more than one
|
||||
|
||||
AddProperty (me : mutable; ent : IGESEntity);
|
||||
---Purpose : Adds a Property in the list
|
||||
|
||||
RemoveProperty (me : mutable; ent : IGESEntity);
|
||||
---Purpose : Removes a Property from the list
|
||||
|
||||
LoadProperties (me : mutable; list : EntityList) is protected;
|
||||
---Purpose : Loads a complete, already loaded, List of Properties
|
||||
-- (used during Read or Copy Operations)
|
||||
|
||||
ClearProperties (me : mutable) is protected;
|
||||
---Purpose : Removes all properties in once
|
||||
|
||||
-- -- General actions -- --
|
||||
|
||||
SetLineWeight (me : mutable; defw,maxw : Real; gradw : Integer);
|
||||
---Purpose : computes and sets "true" line weight according IGES rules from
|
||||
-- global data MaxLineWeight (maxv) and LineWeightGrad (gradw),
|
||||
-- or sets it to defw (Default) if LineWeightNumber is null
|
||||
|
||||
fields
|
||||
-- Entities are recorded as any, this allows special uses (with user defs)
|
||||
|
||||
theType : Integer;
|
||||
theForm : Integer;
|
||||
theStructure : IGESEntity; -- used by some Entities
|
||||
theDefLineFont : DefSwitch;
|
||||
theLineFont : IGESEntity; -- LineFont if Def if "Reference"
|
||||
theDefLevel : Integer; -- >0 (One level) =0 (None) <0 (Several)
|
||||
theLevelList : IGESEntity; -- LevelList if Def is "Several"
|
||||
theView : IGESEntity; -- Simple View, List of Views, Null,other
|
||||
theTransf : IGESEntity; -- Transformation Matrix or Null
|
||||
theLabDisplay : IGESEntity; -- LabelDisplay .. or Null
|
||||
theStatusNum : Integer; -- for BlankSt,SubordinateSt,UseFlag,Hierarchy
|
||||
theLWeightNum : Integer; -- recorded LineWeightNumber (can be 0)
|
||||
theLWeightVal : Real; -- LineWeight computed from global data
|
||||
theDefColor : DefSwitch;
|
||||
theColor : IGESEntity; -- ColorEntity if DefColor is "Reference"
|
||||
theRes1 : Character[9]; -- reserved for future use
|
||||
theRes2 : Character[9];
|
||||
theShortLabel : HAsciiString from TCollection; -- .. or Null if blank
|
||||
theSubScriptN : Integer; -- <0 blank, =0 given 0, >0 defined
|
||||
|
||||
|
||||
theAssocs : EntityList; -- Associativity list
|
||||
theProps : EntityList; -- Property list
|
||||
|
||||
friends
|
||||
|
||||
class ReadWriteModule from IGESData , class GeneralModule from IGESData ,
|
||||
class IGESReaderTool from IGESData , class DirChecker from IGESData
|
||||
|
||||
end IGESEntity;
|
464
src/IGESData/IGESData_IGESEntity.cxx
Executable file
464
src/IGESData/IGESData_IGESEntity.cxx
Executable file
@@ -0,0 +1,464 @@
|
||||
#include <IGESData_IGESEntity.ixx>
|
||||
#include <IGESData_NameEntity.hxx>
|
||||
#include <IGESData_SingleParentEntity.hxx>
|
||||
#include <Interface_InterfaceError.hxx>
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <Standard_PCharacter.hxx>
|
||||
|
||||
|
||||
#define ThisEntity Handle(IGESData_IGESEntity)::DownCast(This())
|
||||
|
||||
// theStatusNum :
|
||||
#define IGESFlagAssocs 131072
|
||||
#define IGESFlagProps 262144
|
||||
#define IGESFourStatus 65535
|
||||
#define IGESStatusField 15
|
||||
#define IGESShiftSubord 4
|
||||
#define IGESShiftUse 8
|
||||
#define IGESShiftHier 12
|
||||
|
||||
|
||||
|
||||
IGESData_IGESEntity::IGESData_IGESEntity ()
|
||||
{ Clear(); theRes1[0] = theRes2[0] = '\0'; }
|
||||
|
||||
void IGESData_IGESEntity::Clear ()
|
||||
{
|
||||
// Handle et DefSwitch
|
||||
theStructure.Nullify();
|
||||
theDefLineFont.SetVoid(); theLineFont.Nullify();
|
||||
theDefColor.SetVoid(); theColor.Nullify();
|
||||
theDefLevel = 0; theLevelList.Nullify();
|
||||
theView.Nullify(); theTransf.Nullify(); theLabDisplay.Nullify();
|
||||
theSubScriptN = 0; theShortLabel.Nullify();
|
||||
|
||||
// Autres Valeurs, Listes
|
||||
theType = theForm = 0;
|
||||
theStatusNum = theLWeightNum = 0;
|
||||
theLWeightVal = 0.;
|
||||
// theRes1[0] = theRes2[0] = '\0';
|
||||
theProps.Clear(); theAssocs.Clear();
|
||||
}
|
||||
|
||||
|
||||
// #########################################################################
|
||||
// .... Definition IGES : Directory Entry ....
|
||||
|
||||
IGESData_IGESType IGESData_IGESEntity::IGESType () const
|
||||
{ return IGESData_IGESType(theType,theForm); }
|
||||
|
||||
Standard_Integer IGESData_IGESEntity::TypeNumber () const
|
||||
{ return theType; }
|
||||
|
||||
Standard_Integer IGESData_IGESEntity::FormNumber () const
|
||||
{ return theForm; }
|
||||
|
||||
|
||||
Handle(IGESData_IGESEntity) IGESData_IGESEntity::DirFieldEntity
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
Handle(IGESData_IGESEntity) ent;
|
||||
if (num == 3) ent = theStructure;
|
||||
if (num == 4) ent = theLineFont;
|
||||
if (num == 5) ent = theLevelList;
|
||||
if (num == 6) ent = theView;
|
||||
if (num == 7) ent = theTransf;
|
||||
if (num == 8) ent = theLabDisplay;
|
||||
if (num == 13) ent = theColor;
|
||||
return ent;
|
||||
}
|
||||
|
||||
Standard_Boolean IGESData_IGESEntity::HasStructure () const
|
||||
{ return (!theStructure.IsNull()); }
|
||||
|
||||
Handle(IGESData_IGESEntity) IGESData_IGESEntity::Structure () const
|
||||
{ return theStructure; }
|
||||
|
||||
IGESData_DefType IGESData_IGESEntity::DefLineFont () const
|
||||
{ return theDefLineFont.DefType(); }
|
||||
|
||||
Standard_Integer IGESData_IGESEntity::RankLineFont () const
|
||||
{ return theDefLineFont.Value(); }
|
||||
|
||||
Handle(IGESData_LineFontEntity) IGESData_IGESEntity::LineFont () const
|
||||
{ return GetCasted(IGESData_LineFontEntity,theLineFont); }
|
||||
|
||||
IGESData_DefList IGESData_IGESEntity::DefLevel () const
|
||||
{
|
||||
if (theDefLevel > 0) return IGESData_DefOne;
|
||||
if (theDefLevel < 0) return IGESData_DefSeveral;
|
||||
return IGESData_DefNone;
|
||||
}
|
||||
|
||||
Standard_Integer IGESData_IGESEntity::Level () const
|
||||
{ return theDefLevel; }
|
||||
|
||||
Handle(IGESData_LevelListEntity) IGESData_IGESEntity::LevelList () const
|
||||
{ return GetCasted(IGESData_LevelListEntity,theLevelList); }
|
||||
|
||||
|
||||
IGESData_DefList IGESData_IGESEntity::DefView () const
|
||||
{
|
||||
if (View().IsNull()) return IGESData_DefNone;
|
||||
if (View()->IsSingle()) return IGESData_DefOne;
|
||||
else return IGESData_DefSeveral;
|
||||
}
|
||||
|
||||
Handle(IGESData_ViewKindEntity) IGESData_IGESEntity::View () const
|
||||
{ return GetCasted(IGESData_ViewKindEntity,theView); }
|
||||
|
||||
Handle(IGESData_ViewKindEntity) IGESData_IGESEntity::SingleView () const
|
||||
{
|
||||
Handle(IGESData_ViewKindEntity) nulvue;
|
||||
if (DefView() != IGESData_DefOne) return nulvue;
|
||||
return View();
|
||||
}
|
||||
|
||||
Handle(IGESData_ViewKindEntity) IGESData_IGESEntity::ViewList () const
|
||||
{
|
||||
Handle(IGESData_ViewKindEntity) nulvue;
|
||||
if (DefView() != IGESData_DefSeveral) return nulvue;
|
||||
return View();
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IGESData_IGESEntity::HasTransf () const
|
||||
{ return (!theTransf.IsNull()); }
|
||||
|
||||
Handle(IGESData_TransfEntity) IGESData_IGESEntity::Transf () const
|
||||
{ return GetCasted(IGESData_TransfEntity,theTransf); }
|
||||
|
||||
|
||||
Standard_Boolean IGESData_IGESEntity::HasLabelDisplay () const
|
||||
{ return (!theLabDisplay.IsNull()); }
|
||||
|
||||
Handle(IGESData_LabelDisplayEntity) IGESData_IGESEntity::LabelDisplay
|
||||
() const
|
||||
{ return GetCasted(IGESData_LabelDisplayEntity,theLabDisplay); }
|
||||
|
||||
// Status : un Integer pour BlankStatus,SubrodinateStatus,USeFlag,HierarchySt.
|
||||
// Decoupage : 4 bits chacun (BlankStatus tout a droite, etc)
|
||||
|
||||
Standard_Integer IGESData_IGESEntity::BlankStatus () const
|
||||
{ return (theStatusNum & IGESStatusField); }
|
||||
|
||||
Standard_Integer IGESData_IGESEntity::SubordinateStatus () const
|
||||
{ return ((theStatusNum >> IGESShiftSubord) & IGESStatusField); }
|
||||
|
||||
Standard_Integer IGESData_IGESEntity::UseFlag () const
|
||||
{ return ((theStatusNum >> IGESShiftUse) & IGESStatusField); }
|
||||
|
||||
Standard_Integer IGESData_IGESEntity::HierarchyStatus () const
|
||||
{ return ((theStatusNum >> IGESShiftHier) & IGESStatusField); }
|
||||
|
||||
Standard_Integer IGESData_IGESEntity::LineWeightNumber () const
|
||||
{ return theLWeightNum; }
|
||||
|
||||
Standard_Real IGESData_IGESEntity::LineWeight () const
|
||||
{ return theLWeightVal; }
|
||||
|
||||
|
||||
IGESData_DefType IGESData_IGESEntity::DefColor () const
|
||||
{ return theDefColor.DefType(); }
|
||||
|
||||
Standard_Integer IGESData_IGESEntity::RankColor () const
|
||||
{ return theDefColor.Value(); }
|
||||
|
||||
Handle(IGESData_ColorEntity) IGESData_IGESEntity::Color () const
|
||||
{ return GetCasted(IGESData_ColorEntity,theColor); }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CResValues
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IGESData_IGESEntity::CResValues (const Standard_CString res1,
|
||||
const Standard_CString res2) const
|
||||
{
|
||||
Standard_Boolean res = Standard_False;
|
||||
Standard_PCharacter pres1, pres2;
|
||||
//
|
||||
pres1=(Standard_PCharacter)res1;
|
||||
pres2=(Standard_PCharacter)res2;
|
||||
//
|
||||
for (Standard_Integer i = 0; i < 8; i ++) {
|
||||
pres1[i] = theRes1[i];
|
||||
pres2[i] = theRes2[i];
|
||||
if (theRes1[i] > ' ' || theRes2[i] > ' ') {
|
||||
res = Standard_True;
|
||||
}
|
||||
}
|
||||
pres1[8] = '\0';
|
||||
pres2[8] = '\0';
|
||||
//
|
||||
return res;
|
||||
}
|
||||
|
||||
Standard_Boolean IGESData_IGESEntity::HasShortLabel () const
|
||||
{ return (!theShortLabel.IsNull()); }
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESData_IGESEntity::ShortLabel () const
|
||||
{ return theShortLabel; }
|
||||
|
||||
Standard_Boolean IGESData_IGESEntity::HasSubScriptNumber () const
|
||||
{ return (theSubScriptN >= 0); } // =0 nul mais defini, <0 absent
|
||||
|
||||
Standard_Integer IGESData_IGESEntity::SubScriptNumber () const
|
||||
{
|
||||
if (theSubScriptN < 0) return 0;
|
||||
return theSubScriptN;
|
||||
}
|
||||
|
||||
// .... (Re)Initialisation du Directory ....
|
||||
|
||||
void IGESData_IGESEntity::InitTypeAndForm
|
||||
(const Standard_Integer typenum, const Standard_Integer formnum)
|
||||
{ theType = typenum; theForm = formnum; }
|
||||
|
||||
void IGESData_IGESEntity::InitDirFieldEntity
|
||||
(const Standard_Integer num, const Handle(IGESData_IGESEntity)& ent)
|
||||
{
|
||||
if (num == 3) theStructure = ent;
|
||||
if (num == 4) theLineFont = ent;
|
||||
if (num == 5) theLevelList = ent;
|
||||
if (num == 6) theView = ent;
|
||||
if (num == 7) theTransf = ent;
|
||||
if (num == 8) theLabDisplay = ent;
|
||||
if (num == 13) theColor = ent;
|
||||
}
|
||||
|
||||
void IGESData_IGESEntity::InitTransf
|
||||
(const Handle(IGESData_TransfEntity)& ent)
|
||||
{ theTransf = ent; }
|
||||
|
||||
void IGESData_IGESEntity::InitView
|
||||
(const Handle(IGESData_ViewKindEntity)& ent)
|
||||
{ theView = ent; }
|
||||
|
||||
void IGESData_IGESEntity::InitLineFont
|
||||
(const Handle(IGESData_LineFontEntity)& ent, const Standard_Integer rank)
|
||||
{ theDefLineFont.SetRank((ent.IsNull() ? rank : -1)); theLineFont = ent; }
|
||||
|
||||
void IGESData_IGESEntity::InitLevel
|
||||
(const Handle(IGESData_LevelListEntity)& ent, const Standard_Integer val)
|
||||
{ theLevelList = ent; theDefLevel = (ent.IsNull() ? val : -1); }
|
||||
|
||||
void IGESData_IGESEntity::InitColor
|
||||
(const Handle(IGESData_ColorEntity)& ent, const Standard_Integer rank)
|
||||
{ theDefColor.SetRank((ent.IsNull() ? rank : -1)); theColor = ent; }
|
||||
|
||||
void IGESData_IGESEntity::InitStatus
|
||||
(const Standard_Integer blank, const Standard_Integer subordinate,
|
||||
const Standard_Integer useflag, const Standard_Integer hierarchy)
|
||||
{
|
||||
theStatusNum = (theStatusNum & (!IGESFourStatus));
|
||||
theStatusNum += (blank & IGESStatusField) |
|
||||
((subordinate & IGESStatusField) << IGESShiftSubord) |
|
||||
((useflag & IGESStatusField) << IGESShiftUse) |
|
||||
((hierarchy & IGESStatusField) << IGESShiftHier);
|
||||
}
|
||||
|
||||
void IGESData_IGESEntity::SetLabel
|
||||
(const Handle(TCollection_HAsciiString)& label, const Standard_Integer sub)
|
||||
{ theShortLabel = label; theSubScriptN = sub; }
|
||||
|
||||
void IGESData_IGESEntity::InitMisc
|
||||
(const Handle(IGESData_IGESEntity)& str,
|
||||
const Handle(IGESData_LabelDisplayEntity)& lab,
|
||||
const Standard_Integer weightnum)
|
||||
{
|
||||
theStructure = str; theLabDisplay = lab;
|
||||
if (theLWeightNum != 0) theLWeightVal *= (weightnum/theLWeightNum);
|
||||
else if (weightnum == 0) theLWeightVal = 0;
|
||||
theLWeightNum = weightnum;
|
||||
}
|
||||
|
||||
// .... Notions derivees importantes ....
|
||||
|
||||
|
||||
// SingleParent : ici on ne traite que l Associativity SingleParent
|
||||
// Pour considerer le partage implicite, il faut remonter au Modele ...
|
||||
|
||||
Standard_Boolean IGESData_IGESEntity::HasOneParent () const
|
||||
{
|
||||
return (NbTypedProperties(STANDARD_TYPE(IGESData_SingleParentEntity)) == 1);
|
||||
}
|
||||
|
||||
Handle(IGESData_IGESEntity) IGESData_IGESEntity::UniqueParent () const
|
||||
{
|
||||
if (NbTypedProperties(STANDARD_TYPE(IGESData_SingleParentEntity)) != 1)
|
||||
Interface_InterfaceError::Raise ("IGESEntity : UniqueParent");
|
||||
else {
|
||||
DeclareAndCast(IGESData_SingleParentEntity,PP,
|
||||
TypedProperty(STANDARD_TYPE(IGESData_SingleParentEntity)));
|
||||
return PP->SingleParent();
|
||||
}
|
||||
return this; // ne rime a rien (cf exception) mais calme le compilateur
|
||||
}
|
||||
|
||||
|
||||
gp_GTrsf IGESData_IGESEntity::Location () const
|
||||
{
|
||||
//szv#4:S4163:12Mar99 unreachcble eliminated
|
||||
//if (!HasTransf()) return gp_GTrsf(); // Identite
|
||||
//else return Transf()->Value(); // c-a-d Compoound
|
||||
if (!HasTransf()) return gp_GTrsf(); // Identite
|
||||
Handle(IGESData_TransfEntity) trsf = Transf();
|
||||
return (trsf.IsNull())? gp_GTrsf() : trsf->Value();
|
||||
}
|
||||
|
||||
gp_GTrsf IGESData_IGESEntity::VectorLocation () const
|
||||
{
|
||||
if (!HasTransf()) return gp_GTrsf(); // Identite
|
||||
// Prendre Location et anuler TranslationPart
|
||||
gp_GTrsf loca = Transf()->Value(); // c-a-d Compoound
|
||||
loca.SetTranslationPart (gp_XYZ(0.,0.,0.));
|
||||
return loca;
|
||||
}
|
||||
|
||||
gp_GTrsf IGESData_IGESEntity::CompoundLocation () const
|
||||
{
|
||||
gp_GTrsf loca = Location();
|
||||
if (!HasOneParent()) return loca;
|
||||
gp_GTrsf locp = UniqueParent()->CompoundLocation();
|
||||
loca.PreMultiply(locp);
|
||||
return loca;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IGESData_IGESEntity::HasName () const
|
||||
{
|
||||
if (HasShortLabel()) return Standard_True;
|
||||
return (NbTypedProperties(STANDARD_TYPE(IGESData_NameEntity)) == 1);
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESData_IGESEntity::NameValue () const
|
||||
{
|
||||
Handle(TCollection_HAsciiString) nom; // au depart vide
|
||||
// Question : concatene-t-on le SubScript ? Oui, forme label(subscript)
|
||||
Standard_Integer nbname = NbTypedProperties(STANDARD_TYPE(IGESData_NameEntity));
|
||||
if (nbname == 0) {
|
||||
if (!HasShortLabel()) return nom;
|
||||
if (theSubScriptN < 0) return theShortLabel;
|
||||
char lenom[50];
|
||||
sprintf (lenom,"%s(%d)",theShortLabel->ToCString(),theSubScriptN);
|
||||
nom = new TCollection_HAsciiString (lenom);
|
||||
}
|
||||
else if (nbname > 0) {
|
||||
DeclareAndCast(IGESData_NameEntity,name,
|
||||
TypedProperty(STANDARD_TYPE(IGESData_NameEntity), 1));
|
||||
nom = name->Value();
|
||||
}
|
||||
|
||||
return nom;
|
||||
}
|
||||
|
||||
|
||||
// .... Listes d'infos Optionnelles (Assocs,Props) ....
|
||||
|
||||
Standard_Boolean IGESData_IGESEntity::ArePresentAssociativities () const
|
||||
{
|
||||
if (!theAssocs.IsEmpty()) return Standard_True;
|
||||
return (theStatusNum & IGESFlagAssocs);
|
||||
}
|
||||
|
||||
Standard_Integer IGESData_IGESEntity::NbAssociativities () const
|
||||
{
|
||||
if (theAssocs.IsEmpty()) return 0;
|
||||
return theAssocs.NbEntities();
|
||||
}
|
||||
|
||||
Interface_EntityIterator IGESData_IGESEntity::Associativities () const
|
||||
{
|
||||
Interface_EntityIterator iter;
|
||||
theAssocs.FillIterator(iter);
|
||||
return iter;
|
||||
}
|
||||
|
||||
Standard_Integer IGESData_IGESEntity::NbTypedAssociativities
|
||||
(const Handle(Standard_Type)& atype) const
|
||||
{ return theAssocs.NbTypedEntities(atype); }
|
||||
|
||||
Handle(IGESData_IGESEntity) IGESData_IGESEntity::TypedAssociativity
|
||||
(const Handle(Standard_Type)& atype) const
|
||||
{ return GetCasted(IGESData_IGESEntity,theAssocs.TypedEntity(atype)); }
|
||||
|
||||
void IGESData_IGESEntity::AddAssociativity
|
||||
(const Handle(IGESData_IGESEntity)& ent)
|
||||
{ theAssocs.Append(ent); }
|
||||
|
||||
void IGESData_IGESEntity::RemoveAssociativity
|
||||
(const Handle(IGESData_IGESEntity)& ent)
|
||||
{ theAssocs.Remove(ent); }
|
||||
|
||||
void IGESData_IGESEntity::LoadAssociativities
|
||||
(const Interface_EntityList& list)
|
||||
{ theAssocs = list; theStatusNum = (theStatusNum | IGESFlagAssocs); }
|
||||
|
||||
void IGESData_IGESEntity::ClearAssociativities ()
|
||||
{ theAssocs.Clear(); }
|
||||
|
||||
void IGESData_IGESEntity::Associate
|
||||
(const Handle(IGESData_IGESEntity)& ent) const
|
||||
{ if (!ent.IsNull()) ent->AddAssociativity(ThisEntity); }
|
||||
|
||||
void IGESData_IGESEntity::Dissociate
|
||||
(const Handle(IGESData_IGESEntity)& ent) const
|
||||
{ if (!ent.IsNull()) ent->RemoveAssociativity(ThisEntity); }
|
||||
|
||||
|
||||
Standard_Boolean IGESData_IGESEntity::ArePresentProperties () const
|
||||
{
|
||||
if (!theProps.IsEmpty()) return Standard_True;
|
||||
return (theStatusNum & IGESFlagProps);
|
||||
}
|
||||
|
||||
Standard_Integer IGESData_IGESEntity::NbProperties () const
|
||||
{
|
||||
if (theProps.IsEmpty()) return 0;
|
||||
return theProps.NbEntities();
|
||||
}
|
||||
|
||||
Interface_EntityIterator IGESData_IGESEntity::Properties () const
|
||||
{
|
||||
Interface_EntityIterator iter;
|
||||
theProps.FillIterator(iter);
|
||||
return iter;
|
||||
}
|
||||
|
||||
Standard_Integer IGESData_IGESEntity::NbTypedProperties
|
||||
(const Handle(Standard_Type)& atype) const
|
||||
{ return theProps.NbTypedEntities(atype); }
|
||||
|
||||
Handle(IGESData_IGESEntity) IGESData_IGESEntity::TypedProperty
|
||||
(const Handle(Standard_Type)& atype, const Standard_Integer anum) const
|
||||
{ return GetCasted(IGESData_IGESEntity,theProps.TypedEntity(atype, anum)); }
|
||||
|
||||
void IGESData_IGESEntity::AddProperty
|
||||
(const Handle(IGESData_IGESEntity)& ent)
|
||||
{ theProps.Append(ent); }
|
||||
|
||||
void IGESData_IGESEntity::RemoveProperty
|
||||
(const Handle(IGESData_IGESEntity)& ent)
|
||||
{ theProps.Remove(ent); }
|
||||
|
||||
void IGESData_IGESEntity::LoadProperties
|
||||
(const Interface_EntityList& list)
|
||||
{ theProps = list; theStatusNum = (theStatusNum | IGESFlagProps); }
|
||||
|
||||
void IGESData_IGESEntity::ClearProperties ()
|
||||
{ theProps.Clear(); }
|
||||
|
||||
// .... Actions liees au Transfert ....
|
||||
|
||||
void IGESData_IGESEntity::SetLineWeight
|
||||
(const Standard_Real defw, const Standard_Real maxw,
|
||||
const Standard_Integer gradw)
|
||||
{
|
||||
if (theLWeightNum == 0) theLWeightVal = defw;
|
||||
else if (gradw == 1) theLWeightVal = maxw*theLWeightNum;
|
||||
else theLWeightVal = (maxw*theLWeightNum)/gradw;
|
||||
}
|
142
src/IGESData/IGESData_IGESModel.cdl
Executable file
142
src/IGESData/IGESData_IGESModel.cdl
Executable file
@@ -0,0 +1,142 @@
|
||||
-- File: IGESModel.cdl
|
||||
-- Created: Mon Apr 6 15:40:52 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class IGESModel from IGESData inherits InterfaceModel
|
||||
|
||||
---Purpose : Defines the file header and
|
||||
-- entities for IGES files. These headers and entities result from
|
||||
-- a complete data translation using the IGES data exchange processor.
|
||||
-- Each entity is contained in a single model only and has a
|
||||
-- unique identifier. You can access this identifier using the method Number.
|
||||
-- Gives an access to the general data in the Start and the Global
|
||||
-- sections of an IGES file.
|
||||
-- The IGES file includes the following sections:
|
||||
-- -Start,
|
||||
-- -Global,
|
||||
-- -Directory Entry,
|
||||
-- -Parameter Data,
|
||||
-- -Terminate
|
||||
|
||||
uses Check, CString,
|
||||
Messenger from Message,
|
||||
HAsciiString from TCollection, HSequenceOfHAsciiString,
|
||||
IGESEntity, GlobalSection, IGESWriter
|
||||
|
||||
|
||||
raises InterfaceError
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable IGESModel;
|
||||
|
||||
ClearHeader (me : mutable);
|
||||
---Purpose : Erases all data specific to IGES file Header (Start + Global)
|
||||
|
||||
DumpHeader (me; S : Messenger from Message; level : Integer = 0);
|
||||
---Purpose : Prints the IGES file header
|
||||
-- (Start and Global Sections) to the log file. The integer
|
||||
-- parameter is intended to be used as a level indicator but is not used at present.
|
||||
|
||||
StartSection (me) returns HSequenceOfHAsciiString is static;
|
||||
---Purpose : Returns Model's Start Section (list of comment lines)
|
||||
|
||||
NbStartLines (me) returns Integer is static;
|
||||
---Purpose : Returns the count of recorded Start Lines
|
||||
|
||||
StartLine (me; num : Integer) returns CString is static;
|
||||
---Purpose : Returns a line from the IGES file
|
||||
-- Start section by specifying its number. An empty string is
|
||||
-- returned if the number given is out of range, the range being
|
||||
-- from 1 to NbStartLines.
|
||||
|
||||
ClearStartSection (me : mutable) is static;
|
||||
---Purpose : Clears the IGES file Start Section
|
||||
|
||||
SetStartSection (me : mutable; list : mutable HSequenceOfHAsciiString;
|
||||
copy : Boolean = Standard_True) is static;
|
||||
---Purpose : Sets a new Start section from a list of strings.
|
||||
-- If copy is false, the Start section will be shared. Any
|
||||
-- modifications made to the strings later on, will have an effect on
|
||||
-- the Start section. If copy is true (default value),
|
||||
-- an independent copy of the strings is created and used as
|
||||
-- the Start section. Any modifications made to the strings
|
||||
-- later on, will have no effect on the Start section.
|
||||
|
||||
AddStartLine (me : mutable; line : CString; atnum : Integer = 0) is static;
|
||||
---Purpose : Adds a new string to the existing
|
||||
-- Start section at the end if atnum is 0 or not given, or before
|
||||
-- atnumth line.
|
||||
|
||||
GlobalSection (me) returns GlobalSection;
|
||||
---Purpose : Returns the Global section of the IGES file.
|
||||
---C++ : return const &
|
||||
|
||||
SetGlobalSection (me : mutable; header : GlobalSection);
|
||||
---Purpose : Sets the Global section of the IGES file.
|
||||
|
||||
ApplyStatic (me : mutable; param : CString = "") returns Boolean;
|
||||
---Purpose : Sets some of the Global section
|
||||
-- parameters with the values defined by the translation
|
||||
-- parameters. param may be:
|
||||
-- - receiver (value read in XSTEP.iges.header.receiver),
|
||||
-- - author (value read in XSTEP.iges.header.author),
|
||||
-- - company (value read in XSTEP.iges.header.company).
|
||||
-- The default value for param is an empty string.
|
||||
-- Returns True when done and if param is given, False if param is
|
||||
-- unknown or empty. Note: Set the unit in the IGES
|
||||
-- file Global section via IGESData_BasicEditor class.
|
||||
|
||||
Entity (me; num : Integer) returns IGESEntity;
|
||||
---Purpose : Returns an IGES entity given by its rank number.
|
||||
|
||||
DNum (me; ent : IGESEntity) returns Integer;
|
||||
---Purpose : Returns the equivalent DE Number for an Entity, i.e.
|
||||
-- 2*Number(ent)-1 , or 0 if <ent> is unknown from <me>
|
||||
-- This DE Number is used for File Writing for instance
|
||||
|
||||
GetFromAnother (me : mutable; other : InterfaceModel);
|
||||
---Purpose : gets Header (GlobalSection) from another Model
|
||||
|
||||
NewEmptyModel (me) returns mutable InterfaceModel;
|
||||
---Purpose : Returns a New Empty Model, same type as <me> i.e. IGESModel
|
||||
|
||||
VerifyCheck (me; ach : in out Check) is redefined;
|
||||
---Purpose : Checks that the IGES file Global
|
||||
-- section contains valid data that conforms to the IGES specifications.
|
||||
|
||||
SetLineWeights (me : mutable; defw : Real);
|
||||
---Purpose : Sets LineWeights of contained Entities according header data
|
||||
-- (MaxLineWeight and LineWeightGrad) or to a default value for
|
||||
-- undefined weights
|
||||
|
||||
|
||||
ClearLabels (me : mutable);
|
||||
---Purpose : erases specific labels, i.e. does nothing
|
||||
|
||||
PrintLabel (me; ent : Transient; S : Messenger from Message);
|
||||
---Purpose : Prints label specific to IGES norm for a given entity, i.e.
|
||||
-- its directory entry number (2*Number-1)
|
||||
|
||||
PrintToLog (me; ent : Transient; S : Messenger from Message) is redefined;
|
||||
---Purpose : Prints label specific to IGES norm for a given -- --
|
||||
-- entity, i.e. its directory entry number (2*Number-1)
|
||||
-- in the log file format.
|
||||
|
||||
PrintInfo (me; ent : Transient; S : Messenger from Message);
|
||||
---Purpose : Prints label specific to IGES norm for a given entity, i.e.
|
||||
-- its directory entry number (2*Number-1)
|
||||
|
||||
StringLabel (me; ent : Transient) returns HAsciiString from TCollection;
|
||||
---Purpose : Returns a string with the label attached to a given entity,
|
||||
-- i.e. a string "Dnn" with nn = directory entry number (2*N-1)
|
||||
|
||||
fields
|
||||
|
||||
thestart : HSequenceOfHAsciiString;
|
||||
theheader : GlobalSection;
|
||||
|
||||
end IGESModel;
|
616
src/IGESData/IGESData_IGESModel.cxx
Executable file
616
src/IGESData/IGESData_IGESModel.cxx
Executable file
@@ -0,0 +1,616 @@
|
||||
//pdn 11.01.99 modification for linking on NT
|
||||
//#73 rln 10.03.99 S4135: "read.scale.unit" does not affect GlobalSection
|
||||
//#13 smh 13.01.2000 : Parsing long year date
|
||||
#include <IGESData_IGESModel.ixx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <IGESData_Protocol.hxx>
|
||||
#include <IGESData_BasicEditor.hxx>
|
||||
#include <Interface_Static.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <Message_Msg.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
static Standard_CString voidline = "";
|
||||
|
||||
// Routine interne utilisee pour VerifyCheck
|
||||
void IGESData_VerifyDate
|
||||
(const Handle(TCollection_HAsciiString)& str,
|
||||
Handle(Interface_Check)& ach, const Standard_CString mess);
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IGESData_IGESModel
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
IGESData_IGESModel::IGESData_IGESModel ()
|
||||
{
|
||||
thestart = new TColStd_HSequenceOfHAsciiString();
|
||||
// thecheckstx = new Interface_Check;
|
||||
// thechecksem = new Interface_Check;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ClearHeader
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_IGESModel::ClearHeader ()
|
||||
{
|
||||
IGESData_GlobalSection newheader; // Un peu brutal, certes
|
||||
theheader = newheader;
|
||||
thestart = new TColStd_HSequenceOfHAsciiString();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpHeader
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_IGESModel::DumpHeader
|
||||
(const Handle(Message_Messenger)& S, const Standard_Integer ) const
|
||||
{
|
||||
Standard_Integer ns = thestart->Length();
|
||||
S<<"**** Dump of IGES Model , Start and Global Sections ****"<<endl;
|
||||
if (ns > 0) {
|
||||
S << "**** Start Section : "<<ns<<" Line(s) ****"<<"\n";
|
||||
for (Standard_Integer i = 1; i <= ns; i ++)
|
||||
S<<"["<<(i<10 ? " ": "")<<i<<"]:"<<thestart->Value(i)->ToCString()<<endl;
|
||||
}
|
||||
S << "\n"<<"**** Global Section ****"<<"\n";
|
||||
char sep = theheader.Separator();
|
||||
if (sep == ',') S << "[ 1] Default Separator : " << sep;
|
||||
else S << "[ 1] Non Default Separator : " << sep;
|
||||
char emk = theheader.EndMark();
|
||||
if (emk == ';') S << " [ 2] Default End Mark : " << emk;
|
||||
else S << " [ 2] Non Default End Mark : " << emk;
|
||||
S<<"\n";
|
||||
Handle(TCollection_HAsciiString) str;
|
||||
str = theheader.SendName();
|
||||
if (!str.IsNull()) S<<"[ 3] Sender : "<<str->ToCString()<<endl;
|
||||
str = theheader.FileName();
|
||||
if (!str.IsNull()) S<<"[ 4] (recorded) File Name : "<<str->ToCString()<<endl;
|
||||
str = theheader.SystemId();
|
||||
if (!str.IsNull()) S<<"[ 5] System Identification : "<<str->ToCString()<<endl;
|
||||
str = theheader.InterfaceVersion();
|
||||
if (!str.IsNull()) S<<"[ 6] Interface Version : "<<str->ToCString()<<endl;
|
||||
S<<endl;
|
||||
S << "[ 7] Integer Bits : " << theheader.IntegerBits()
|
||||
<< " Features for Reals : " << endl;
|
||||
S << "[ 8] Single Max.Power(10) : " << theheader.MaxPower10Single();
|
||||
S << " [ 9] Digits : " << theheader.MaxDigitsSingle()<<"\n";
|
||||
S << "[10] Double Max.Power(10) : " << theheader.MaxPower10Double();
|
||||
S << " [11] Digits : " << theheader.MaxDigitsDouble() << "\n\n";
|
||||
str = theheader.ReceiveName();
|
||||
if (!str.IsNull()) S<<"[12] Receiver : "<<str->ToCString()<<"\n";
|
||||
S << "[13] Scale : " << theheader.Scale()<<"\n";
|
||||
S << "[14] Unit Flag : " << theheader.UnitFlag();
|
||||
// if (Interface_Static::IVal("read.scale.unit") == 1)
|
||||
//#73 rln 10.03.99 S4135: "read.scale.unit" does not affect GlobalSection
|
||||
// S << " -> Value (in Meter) = " << theheader.UnitValue() / 1000 <<"\n";
|
||||
// else S << " -> Value (in Millimeter) = " << theheader.UnitValue()<<"\n";
|
||||
//abv 02 Mar 00: no unit parameter in OCC
|
||||
S << " -> Value (in CASCADE units) = " << theheader.UnitValue() <<"\n";
|
||||
|
||||
str = theheader.UnitName();
|
||||
if (!str.IsNull()) S<<"[15] Unit Name : " << str->ToCString()<<"\n\n";
|
||||
S << "[16] Line Weight Gradient : " << theheader.LineWeightGrad()<<"\n";
|
||||
S << "[17] Line Weight Max Value: " << theheader.MaxLineWeight()<<"\n";
|
||||
|
||||
str = theheader.Date();
|
||||
if (!str.IsNull()) S<<"[18] (Creation) Date : "<<str->ToCString()
|
||||
<<" i.e. "<<IGESData_GlobalSection::NewDateString(str,1)->ToCString()<<"\n";
|
||||
S << "[19] Resolution : " << theheader.Resolution()<<"\n";
|
||||
if (theheader.HasMaxCoord())
|
||||
S<<"[20] Maximum Coord : " << theheader.MaxCoord() << "\n\n";
|
||||
else S<<"[20] Maximum Coord not defined"<<"\n\n";
|
||||
|
||||
str = theheader.AuthorName();
|
||||
if (!str.IsNull()) S<<"[21] Author : "<<str->ToCString()<<"\n";
|
||||
str = theheader.CompanyName();
|
||||
if (!str.IsNull()) S<<"[22] Company : "<<str->ToCString()<<"\n";
|
||||
Standard_Integer num = theheader.IGESVersion();
|
||||
S << "[23] IGES Version Number : " << num << " -> Name : "
|
||||
<< IGESData_BasicEditor::IGESVersionName(num);
|
||||
|
||||
num = theheader.DraftingStandard();
|
||||
S << "\n"<<"[24] Drafting Standard : " << num;
|
||||
if (num > 0) S<< " -> Name : " << IGESData_BasicEditor::DraftingName(num);
|
||||
S<<endl;
|
||||
|
||||
if (theheader.HasLastChangeDate()) {
|
||||
str = theheader.LastChangeDate();
|
||||
S << "[25] Last Change Date : " << str->ToCString()
|
||||
<<" i.e. "<<IGESData_GlobalSection::NewDateString(str,1)->ToCString()<<endl;
|
||||
}
|
||||
else S<<"[25] Last Change Date not defined (version IGES < 5.1)" << endl;
|
||||
|
||||
if (theheader.HasApplicationProtocol()) {
|
||||
str = theheader.ApplicationProtocol();
|
||||
S << "[26] Application Protocol : " << str->ToCString() <<endl;
|
||||
}
|
||||
|
||||
S << " **** End of Dump ****"<<endl;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : StartSection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TColStd_HSequenceOfHAsciiString) IGESData_IGESModel::StartSection
|
||||
() const
|
||||
{ return thestart; }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbStartLines
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer IGESData_IGESModel::NbStartLines () const
|
||||
{ return thestart->Length(); }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : StartLine
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_CString IGESData_IGESModel::StartLine
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
if (num > 0 && num <= thestart->Length()) return
|
||||
thestart->Value(num)->ToCString();
|
||||
return voidline;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ClearStartSection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_IGESModel::ClearStartSection ()
|
||||
{ thestart->Clear(); }
|
||||
|
||||
void IGESData_IGESModel::SetStartSection
|
||||
(const Handle(TColStd_HSequenceOfHAsciiString)& list,
|
||||
const Standard_Boolean copy)
|
||||
{
|
||||
if (copy) {
|
||||
thestart = new TColStd_HSequenceOfHAsciiString();
|
||||
if (list.IsNull()) return;
|
||||
Standard_Integer i, nb = list->Length();
|
||||
for (i = 1; i <= nb; i ++) thestart->Append
|
||||
(new TCollection_HAsciiString(list->Value(i)->ToCString()));
|
||||
}
|
||||
else if (list.IsNull()) thestart = new TColStd_HSequenceOfHAsciiString();
|
||||
else thestart = list;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : AddStartLine
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_IGESModel::AddStartLine
|
||||
(const Standard_CString line, const Standard_Integer atnum)
|
||||
{
|
||||
if (atnum <= 0 || atnum > thestart->Length())
|
||||
thestart->Append (new TCollection_HAsciiString(line));
|
||||
else thestart->InsertBefore (atnum,new TCollection_HAsciiString(line));
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GlobalSection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const IGESData_GlobalSection& IGESData_IGESModel::GlobalSection () const
|
||||
{ return theheader; }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetGlobalSection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_IGESModel::SetGlobalSection
|
||||
(const IGESData_GlobalSection& header)
|
||||
{ theheader = header; }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ApplyStatic
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean IGESData_IGESModel::ApplyStatic
|
||||
(const Standard_CString param)
|
||||
{
|
||||
if (param[0] == '\0') {
|
||||
//Standard_Boolean ret = Standard_True; //szv#4:S4163:12Mar99 not needed
|
||||
ApplyStatic("receiver"); //szv#4:S4163:12Mar99 'ret =' not needed
|
||||
ApplyStatic("author"); //szv#4:S4163:12Mar99 'ret =' not needed
|
||||
ApplyStatic("company"); //szv#4:S4163:12Mar99 'ret =' not needed
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_CString val;
|
||||
if (param[0] == 'r') {
|
||||
val = Interface_Static::CVal("write.iges.header.receiver");
|
||||
if (!val || val[0] == '\0') return Standard_False;
|
||||
theheader.SetReceiveName (new TCollection_HAsciiString(val));
|
||||
}
|
||||
if (param[0] == 'a') {
|
||||
val = Interface_Static::CVal("write.iges.header.author");
|
||||
if (!val || val[0] == '\0') return Standard_False;
|
||||
theheader.SetAuthorName (new TCollection_HAsciiString(val));
|
||||
}
|
||||
if (param[0] == 'c') {
|
||||
val = Interface_Static::CVal("write.iges.header.company");
|
||||
if (!val || val[0] == '\0') return Standard_False;
|
||||
theheader.SetCompanyName (new TCollection_HAsciiString(val));
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Entity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(IGESData_IGESEntity) IGESData_IGESModel::Entity
|
||||
(const Standard_Integer num) const
|
||||
{ return GetCasted(IGESData_IGESEntity,Value(num)); }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : DNum
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer IGESData_IGESModel::DNum
|
||||
(const Handle(IGESData_IGESEntity)& ent) const
|
||||
{
|
||||
Standard_Integer num = Number(ent);
|
||||
if (num == 0) return 0;
|
||||
else return 2*num-1;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetFromAnother
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_IGESModel::GetFromAnother
|
||||
(const Handle(Interface_InterfaceModel)& other)
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESModel,another,other);
|
||||
theheader = another->GlobalSection();
|
||||
theheader.CopyRefs();
|
||||
SetStartSection (another->StartSection(),Standard_True);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmptyModel
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Interface_InterfaceModel) IGESData_IGESModel::NewEmptyModel () const
|
||||
{ return new IGESData_IGESModel; }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : VerifyCheck
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_IGESModel::VerifyCheck (Handle(Interface_Check)& ach) const
|
||||
{
|
||||
// MGE 23/07/98
|
||||
// =====================================
|
||||
//Message_Msg Msg40 ("XSTEP_40");
|
||||
//Message_Msg Msg41 ("XSTEP_41");
|
||||
//Message_Msg Msg42 ("XSTEP_42");
|
||||
//Message_Msg Msg43 ("XSTEP_43");
|
||||
//Message_Msg Msg44 ("XSTEP_44");
|
||||
//Message_Msg Msg45 ("XSTEP_45");
|
||||
//Message_Msg Msg46 ("XSTEP_46");
|
||||
//Message_Msg Msg47 ("XSTEP_47");
|
||||
//Message_Msg Msg48 ("XSTEP_48");
|
||||
//Message_Msg Msg50 ("XSTEP_50");
|
||||
//Message_Msg Msg51 ("XSTEP_51");
|
||||
//Message_Msg Msg52 ("XSTEP_52");
|
||||
//Message_Msg Msg53 ("XSTEP_53");
|
||||
//Message_Msg Msg54 ("XSTEP_54");
|
||||
//Message_Msg Msg55 ("XSTEP_55");
|
||||
// =====================================
|
||||
|
||||
char del[2];
|
||||
del[0] = theheader.Separator();
|
||||
del[1] = theheader.EndMark();
|
||||
// Sending of message : Parameter Delimiter Character and Record Delimiter Character must be different.
|
||||
if (del[0] == del[1]) {
|
||||
Message_Msg Msg40 ("XSTEP_40");
|
||||
ach->SendFail(Msg40);
|
||||
}
|
||||
for (int i = 0; i <= 1; i ++) {
|
||||
if ( del[i] <= 32 || del[i] == 43 || del[i] == 45 || del[i] == 46 ||
|
||||
(del[i] >= 48 && del[i] <= 57) || del[i] == 68 || del[i] == 69 ||
|
||||
del [i] == 72 || del[i] >= 127) {
|
||||
// Sending of message : Parameter Delimiter Character is incorrect.
|
||||
if (i == 0) {
|
||||
Message_Msg Msg41 ("XSTEP_41");
|
||||
ach->SendFail(Msg41);
|
||||
}
|
||||
// Sending of message : Character Record Delimiter parameter is incorrect.
|
||||
else {
|
||||
Message_Msg Msg42 ("XSTEP_42");
|
||||
ach->SendFail (Msg42);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Sending of message : Single Precision Magnitude parameter is incorrect.
|
||||
if (theheader.MaxPower10Single() <= 0) {
|
||||
Message_Msg Msg43 ("XSTEP_43");
|
||||
ach->SendFail(Msg43);
|
||||
}
|
||||
|
||||
// Sending of message : Precision Significance parameter is incorrect.
|
||||
if (theheader.MaxDigitsSingle() <= 0) {
|
||||
Message_Msg Msg44 ("XSTEP_44");
|
||||
ach->SendFail(Msg44);
|
||||
}
|
||||
|
||||
// Sending of messages : Double Precision Magnitude parameter is incorrect.
|
||||
if (theheader.MaxPower10Double() <= 0) {
|
||||
Message_Msg Msg45 ("XSTEP_45");
|
||||
ach->SendFail(Msg45);
|
||||
}
|
||||
|
||||
// Sending of message : Double Precision Significance parameter is incorrect.
|
||||
if (theheader.MaxDigitsDouble() <= 0) {
|
||||
Message_Msg Msg46 ("XSTEP_46");
|
||||
ach->SendFail(Msg46);
|
||||
}
|
||||
|
||||
// Sending of message : Model Space Scale parameter is incorrect.
|
||||
if (theheader.Scale() <= 0.) {
|
||||
Message_Msg Msg47 ("XSTEP_47");
|
||||
ach->SendFail(Msg47);
|
||||
}
|
||||
|
||||
Standard_Integer unf = theheader.UnitFlag();
|
||||
|
||||
// Sending of message : Unit Flag parameter is incorrect.
|
||||
if (unf < 1 || unf > 11) {
|
||||
Message_Msg Msg48 ("XSTEP_48");
|
||||
ach->SendFail(Msg48);
|
||||
}
|
||||
|
||||
// .. verifie-t-on UnitName en accord avec UnitFlag ?
|
||||
if (theheader.UnitName().IsNull()) {
|
||||
// Sending of message : Unit Name parameter is undefined.
|
||||
if (unf == 3) {
|
||||
Message_Msg Msg50 ("XSTEP_50");
|
||||
ach->SendFail(Msg50);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Standard_CString unm = theheader.UnitName()->ToCString();
|
||||
Standard_Boolean unok = Standard_True;
|
||||
switch (unf) {
|
||||
case 1 : unok = (!strcmp(unm,"IN") || !strcmp(unm,"INCH")); break;
|
||||
case 2 : unok = !strcmp(unm,"MM"); break;
|
||||
case 3 : unok = Standard_True; break; // nom libre
|
||||
case 4 : unok = !strcmp(unm,"FT"); break;
|
||||
case 5 : unok = !strcmp(unm,"MI"); break;
|
||||
case 6 : unok = !strcmp(unm,"M"); break;
|
||||
case 7 : unok = !strcmp(unm,"KM"); break;
|
||||
case 8 : unok = !strcmp(unm,"MIL"); break;
|
||||
case 9 : unok = !strcmp(unm,"UM"); break;
|
||||
case 10 : unok = !strcmp(unm,"CM"); break;
|
||||
case 11 : unok = !strcmp(unm,"UIN"); break;
|
||||
default : Message_Msg Msg48 ("XSTEP_48"); ach->SendFail(Msg48);
|
||||
break;
|
||||
}
|
||||
// Sending of message : Flag parameter doesn`t correspond to the Unit Name parameter.
|
||||
if (!unok) {
|
||||
Message_Msg Msg51 ("XSTEP_51");
|
||||
ach->SendFail(Msg51);
|
||||
}
|
||||
}
|
||||
|
||||
IGESData_VerifyDate (theheader.Date(),ach,"Creation Date");
|
||||
// Sending of message : Minimum Resolution parameter is incorrect.
|
||||
if (theheader.Resolution() <= 0.) {
|
||||
Message_Msg Msg52 ("XSTEP_52");
|
||||
ach->SendFail(Msg52);
|
||||
}
|
||||
// .. comment verifier les coordonnees max ?
|
||||
|
||||
// Sending of message : Version Flag parameter is incorrect.
|
||||
if (theheader.IGESVersion() < 1 ||
|
||||
theheader.IGESVersion() > IGESData_BasicEditor::IGESVersionMax()) {
|
||||
Message_Msg Msg53 ("XSTEP_53");
|
||||
ach->SendWarning(Msg53);
|
||||
}
|
||||
|
||||
// Sending of message : Drafting Standard Flag parameter is incorrect.
|
||||
if (theheader.DraftingStandard() < 0 ||
|
||||
theheader.DraftingStandard() > IGESData_BasicEditor::DraftingMax()) {
|
||||
Message_Msg Msg54 ("XSTEP_54");
|
||||
ach->SendWarning(Msg54);
|
||||
}
|
||||
|
||||
// Sending of message :
|
||||
if (theheader.IGESVersion() >= 9) {
|
||||
// Sending of message : Last change Date parameter is undefined.
|
||||
if (!theheader.HasLastChangeDate()) {
|
||||
Message_Msg Msg55 ("XSTEP_55");
|
||||
ach->SendWarning(Msg55);
|
||||
}
|
||||
else IGESData_VerifyDate (theheader.LastChangeDate(),ach,"Last Change Date");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void IGESData_VerifyDate(const Handle(TCollection_HAsciiString)& str,
|
||||
Handle(Interface_Check)& ach,
|
||||
const Standard_CString mess)
|
||||
{
|
||||
// MGE 23/07/98
|
||||
// =====================================
|
||||
Message_Msg Msg57 ("XSTEP_57");
|
||||
// =====================================
|
||||
|
||||
// Attention c est du Hollerith
|
||||
if (str.IsNull())
|
||||
{ ach->SendFail(Msg57); return; }
|
||||
|
||||
Handle(TCollection_HAsciiString) stdvar = str;
|
||||
if (strcmp(mess,"Last Change Date")==0)
|
||||
Msg57.Arg(25);
|
||||
else
|
||||
Msg57.Arg(18);
|
||||
if (((stdvar->Length() != 13) && (stdvar->Length() != 15)) || !stdvar->IsRealValue()) ach->SendFail(Msg57);
|
||||
//smh#13 For short year date
|
||||
else if ((stdvar->Value(3) > '1' ||
|
||||
(stdvar->Value(3) == '1' && stdvar->Value(4) > '2'))&&(stdvar->Length() == 13)) ach->SendFail(Msg57);
|
||||
|
||||
else if ((stdvar->Value(5) > '3' ||
|
||||
(stdvar->Value(5) == '3' && stdvar->Value(6) > '1'))&&(stdvar->Length() == 13)) ach->SendFail(Msg57);
|
||||
else if ((stdvar->Value(7) != '.' || stdvar->Value(10) > '5' || stdvar->Value(12) > '5')&&(stdvar->Length() == 13))
|
||||
ach->SendFail(Msg57);
|
||||
else if ((stdvar->Value(8) > '2' ||
|
||||
stdvar->Value(8) == '2' && stdvar->Value(9) > '3')&&(stdvar->Length() == 13)) ach->SendFail(Msg57);
|
||||
//smh#13 For long year date
|
||||
else if ( (stdvar->Value(5) > '1' ||
|
||||
(stdvar->Value(5) == '1' && stdvar->Value(6) > '2'))&&(stdvar->Length() == 15)) ach->SendFail(Msg57);
|
||||
else if ((stdvar->Value(7) > '3' ||
|
||||
(stdvar->Value(7) == '3' && stdvar->Value(8) > '1'))&&(stdvar->Length() == 15)) ach->SendFail(Msg57);
|
||||
else if ((stdvar->Value(9) != '.' || stdvar->Value(12) > '5' || stdvar->Value(14) > '5')&&(stdvar->Length() == 15))
|
||||
ach->SendFail(Msg57);
|
||||
else if ((stdvar->Value(10) > '2' ||
|
||||
stdvar->Value(10) == '2' && stdvar->Value(11) > '3')&&(stdvar->Length() == 15)) ach->SendFail(Msg57);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetLineWeights
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_IGESModel::SetLineWeights (const Standard_Real defw)
|
||||
{
|
||||
Standard_Integer nb = NbEntities();
|
||||
Standard_Integer lwg = theheader.LineWeightGrad();
|
||||
Standard_Real maxw = theheader.MaxLineWeight();
|
||||
if (lwg > 0) { maxw = maxw/lwg; lwg = 1; }
|
||||
for (Standard_Integer i = 1; i <= nb; i ++)
|
||||
Entity(i)->SetLineWeight(defw,maxw,lwg);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ClearLabels
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_IGESModel::ClearLabels ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PrintLabel
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_IGESModel::PrintLabel
|
||||
(const Handle(Standard_Transient)& ent, const Handle(Message_Messenger)& S) const
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,ent);
|
||||
if (igesent.IsNull()) S<<"Null";
|
||||
else {
|
||||
Standard_Integer num = Number(ent);
|
||||
if (num == 0) S<<"??";
|
||||
else S<<"D"<<(2*num-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PrintToLog
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_IGESModel::PrintToLog
|
||||
(const Handle(Standard_Transient)& ent, const Handle(Message_Messenger)& S) const
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,ent);
|
||||
if (!igesent.IsNull()) {
|
||||
Standard_Integer num = Number(ent);
|
||||
if (num == 0) S<<"??";
|
||||
else {
|
||||
S<<" DE : "<<(2*num-1) << " type : " << igesent->TypeNumber();
|
||||
// Standard_Integer num2 = igesent->TypeNumber();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PrintInfo
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_IGESModel::PrintInfo
|
||||
(const Handle(Standard_Transient)& ent, const Handle(Message_Messenger)& S) const
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,ent);
|
||||
if (igesent.IsNull()) S<<"(NOT IGES)";
|
||||
else {
|
||||
Standard_Integer num = Number(ent);
|
||||
if (num == 0) S<<"??";
|
||||
else {
|
||||
S<<(2*num-1) << "type " << Type(ent)->Name();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : StringLabel
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESData_IGESModel::StringLabel(const Handle(Standard_Transient)& ent) const
|
||||
{
|
||||
Handle(TCollection_HAsciiString) label;
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,ent);
|
||||
if (igesent.IsNull()) return new TCollection_HAsciiString("(NOT IGES)");
|
||||
else {
|
||||
char text[20];
|
||||
Standard_Integer num = Number(ent);
|
||||
if (num > 0) sprintf(text,"D%d",2*num-1);
|
||||
else sprintf(text,"D0...");
|
||||
label = new TCollection_HAsciiString(text);
|
||||
}
|
||||
return label;
|
||||
}
|
105
src/IGESData/IGESData_IGESReaderData.cdl
Executable file
105
src/IGESData/IGESData_IGESReaderData.cdl
Executable file
@@ -0,0 +1,105 @@
|
||||
-- File: IGESReaderData.cdl
|
||||
-- Created: Mon Apr 6 16:10:29 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class IGESReaderData from IGESData inherits FileReaderData
|
||||
|
||||
---Purpose : specific FileReaderData for IGES
|
||||
-- contains header as GlobalSection, and for each Entity, its
|
||||
-- directory part as DirPart, list of Parameters as ParamSet
|
||||
-- Each Item has a DirPart, plus classically a ParamSet and the
|
||||
-- correspondant recognized Entity (inherited from FileReaderData)
|
||||
-- Parameters are accessed through specific objects, ParamReaders
|
||||
|
||||
uses Integer, Boolean, CString, HAsciiString, HSequenceOfHAsciiString,
|
||||
ParamType, ParamSet, Check,
|
||||
GlobalSection, DirPart, Array1OfDirPart, IGESType, ReadStage
|
||||
|
||||
is
|
||||
|
||||
Create (nbe,nbp : Integer) returns mutable IGESReaderData;
|
||||
---Purpose : creates IGESReaderData correctly dimensionned (for arrays)
|
||||
-- <nbe> count of entities, that is, half nb of directory lines
|
||||
-- <nbp> : count of parameters
|
||||
|
||||
AddStartLine (me : mutable; aval : CString);
|
||||
---Purpose : adds a start line to start section
|
||||
|
||||
StartSection (me) returns HSequenceOfHAsciiString;
|
||||
---Purpose : Returns the Start Section in once
|
||||
|
||||
AddGlobal (me : mutable; atype : ParamType; aval : CString);
|
||||
---Purpose : adds a parameter to global section's parameter list
|
||||
|
||||
SetGlobalSection (me : mutable);
|
||||
---Purpose : reads header (as GlobalSection) content from the ParamSet
|
||||
-- after it has been filled by successive calls to AddGlobal
|
||||
|
||||
GlobalSection (me) returns GlobalSection;
|
||||
---Purpose : returns header as GlobalSection
|
||||
---C++ : return const &
|
||||
|
||||
SetDirPart (me : mutable; num : Integer;
|
||||
i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16,i17 : Integer;
|
||||
res1,res2,label,subs : CString);
|
||||
---Purpose : fills a DirPart, designated by its rank (that is, (N+1)/2 if N
|
||||
-- is its first number in section D)
|
||||
|
||||
DirPart (me; num : Integer) returns DirPart;
|
||||
---Purpose : returns DirPart identified by record no (half Dsect number)
|
||||
---C++ : return const &
|
||||
|
||||
DirValues (me; num : Integer;
|
||||
i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16,i17 : out Integer;
|
||||
res1,res2,label,subs : out CString);
|
||||
---Purpose : returns values recorded in directory part n0 <num>
|
||||
|
||||
DirType (me; num : Integer) returns IGESType;
|
||||
---Purpose : returns "type" and "form" info from a directory part
|
||||
|
||||
-- -- General -- --
|
||||
|
||||
NbEntities (me) returns Integer is redefined;
|
||||
---Purpose : Returns count of recorded Entities (i.e. size of Directory)
|
||||
|
||||
FindNextRecord (me; num : Integer) returns Integer;
|
||||
---Purpose : determines next suitable record from num; that is num+1 except
|
||||
-- for last one which gives 0
|
||||
|
||||
SetEntityNumbers (me : mutable);
|
||||
---Purpose : determines reference numbers in EntityNumber fields (called by
|
||||
-- SetEntities from IGESReaderTool)
|
||||
-- works on "Integer" type Parameters, because IGES does not
|
||||
-- distinguish Integer and Entity Refs : every Integer which is
|
||||
-- odd and less than twice NbRecords can be an Entity Ref ...
|
||||
-- (Ref Number is then (N+1)/2 if N is the Integer Value)
|
||||
|
||||
-- Loading the IGESModel --
|
||||
|
||||
GlobalCheck (me) returns Check;
|
||||
---Purpose : Returns the recorded Global Check
|
||||
|
||||
SetDefaultLineWeight (me : mutable; defw : Real);
|
||||
---Purpose : allows to set a default line weight, will be later applied at
|
||||
-- load time, on Entities which have no specified line weight
|
||||
|
||||
DefaultLineWeight (me) returns Real;
|
||||
---Purpose : Returns the recorded Default Line Weight, if there is
|
||||
-- (else, returns 0)
|
||||
|
||||
fields
|
||||
|
||||
thecnum : Integer; -- current entity number for recognize
|
||||
thectyp : IGESType; -- its IGESType (for purpose of optimization)
|
||||
thestar : HSequenceOfHAsciiString; -- start section
|
||||
theparh : ParamSet; -- ParamSet reading global parameters
|
||||
thehead : GlobalSection;
|
||||
thedirs : Array1OfDirPart;
|
||||
thestep : ReadStage; -- to continue an interrupted party
|
||||
thedefw : Real; -- default line weight (if desired)
|
||||
thechk : Check; -- check on header (kept by IGESModel)
|
||||
|
||||
end IGESReaderData;
|
170
src/IGESData/IGESData_IGESReaderData.cxx
Executable file
170
src/IGESData/IGESData_IGESReaderData.cxx
Executable file
@@ -0,0 +1,170 @@
|
||||
#include <IGESData_IGESReaderData.ixx>
|
||||
#include <IGESData_IGESModel.hxx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESData_UndefinedEntity.hxx>
|
||||
#include <Interface_FileParameter.hxx>
|
||||
#include <Interface_ParamList.hxx>
|
||||
#include <Interface_ParamType.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
|
||||
IGESData_IGESReaderData::IGESData_IGESReaderData
|
||||
(const Standard_Integer nbe, const Standard_Integer nbp)
|
||||
: Interface_FileReaderData (nbe,nbp) , thectyp (0,0) , thedirs(0,nbe)
|
||||
{
|
||||
thestep = IGESData_ReadDir; thedefw = 0.;
|
||||
theparh = new Interface_ParamSet(30);
|
||||
thestar = new TColStd_HSequenceOfHAsciiString();
|
||||
thechk = new Interface_Check;
|
||||
}
|
||||
|
||||
|
||||
void IGESData_IGESReaderData::AddStartLine
|
||||
(const Standard_CString aval)
|
||||
{
|
||||
thestar->Append (new TCollection_HAsciiString(aval));
|
||||
}
|
||||
|
||||
Handle(TColStd_HSequenceOfHAsciiString) IGESData_IGESReaderData::StartSection
|
||||
() const
|
||||
{ return thestar; }
|
||||
|
||||
void IGESData_IGESReaderData::AddGlobal
|
||||
(const Interface_ParamType atype, const Standard_CString aval)
|
||||
{
|
||||
theparh->Append(aval,strlen(aval),atype,0);
|
||||
}
|
||||
|
||||
void IGESData_IGESReaderData::SetGlobalSection ()
|
||||
{ thehead.Init(theparh,thechk); }
|
||||
|
||||
const IGESData_GlobalSection& IGESData_IGESReaderData::GlobalSection () const
|
||||
{ return thehead; }
|
||||
|
||||
void IGESData_IGESReaderData::SetDirPart
|
||||
(const Standard_Integer num,
|
||||
const Standard_Integer i1, const Standard_Integer i2,
|
||||
const Standard_Integer i3, const Standard_Integer i4,
|
||||
const Standard_Integer i5, const Standard_Integer i6,
|
||||
const Standard_Integer i7, const Standard_Integer i8,
|
||||
const Standard_Integer i9, const Standard_Integer i10,
|
||||
const Standard_Integer i11, const Standard_Integer i12,
|
||||
const Standard_Integer i13, const Standard_Integer i14,
|
||||
const Standard_Integer i15, const Standard_Integer i16,
|
||||
const Standard_Integer i17,
|
||||
const Standard_CString res1, const Standard_CString res2,
|
||||
const Standard_CString label, const Standard_CString subs)
|
||||
{
|
||||
IGESData_DirPart& DP = thedirs(num);
|
||||
DP.Init(i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,
|
||||
i15,i16,i17,res1,res2,label,subs);
|
||||
//// thedirs(num) = DP; // verifier si utile
|
||||
//InitParams(num); gka optimization memory
|
||||
}
|
||||
|
||||
|
||||
const IGESData_DirPart& IGESData_IGESReaderData::DirPart
|
||||
(const Standard_Integer num) const
|
||||
{ return thedirs(num); }
|
||||
|
||||
void IGESData_IGESReaderData::DirValues
|
||||
(const Standard_Integer num,
|
||||
Standard_Integer& i1, Standard_Integer& i2, Standard_Integer& i3,
|
||||
Standard_Integer& i4, Standard_Integer& i5, Standard_Integer& i6,
|
||||
Standard_Integer& i7, Standard_Integer& i8, Standard_Integer& i9,
|
||||
Standard_Integer& i10, Standard_Integer& i11, Standard_Integer& i12,
|
||||
Standard_Integer& i13, Standard_Integer& i14, Standard_Integer& i15,
|
||||
Standard_Integer& i16, Standard_Integer& i17,
|
||||
Standard_CString& res1, Standard_CString& res2,
|
||||
Standard_CString& label, Standard_CString& subs) const
|
||||
{
|
||||
thedirs(num).Values(i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,
|
||||
i15,i16,i17,res1,res2,label,subs);
|
||||
}
|
||||
|
||||
IGESData_IGESType IGESData_IGESReaderData::DirType
|
||||
(const Standard_Integer num) const
|
||||
{ return thedirs(num).Type(); }
|
||||
|
||||
Standard_Integer IGESData_IGESReaderData::NbEntities () const
|
||||
{ return thedirs.Upper(); }
|
||||
|
||||
Standard_Integer IGESData_IGESReaderData::FindNextRecord
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
if (num >= thedirs.Upper()) return 0;
|
||||
else return (num + 1);
|
||||
}
|
||||
|
||||
|
||||
// Reference a d'autres entites : c'est a la fois tres simple et problematique
|
||||
// Tres simple : une reference a une entite est un numero (dans directory list)
|
||||
// qui vaut (2*N-1) si N est le rang vrai de l'entite
|
||||
// Problematique : ce numero est un Entier ... rien ne le distingue d'un autre
|
||||
// D'ou critere : tout entier impair inferieur a 2*NbRecords PEUT etre une
|
||||
// reference ... C'est a chaque entite de faire ensuite son tri ...
|
||||
// Attention, une reference peut etre donnee en "Pointeur Negatif"
|
||||
// N.B.: DirPart non concernes (lecture specifique assuree par IGESEntity)
|
||||
|
||||
void IGESData_IGESReaderData::SetEntityNumbers ()
|
||||
{
|
||||
// On essaie de se baser uniquement sur calcul de IGESRead
|
||||
/*
|
||||
Standard_Integer nbd = thedirs.Upper();
|
||||
for (Standard_Integer i = 1; i <= nbd; i ++) {
|
||||
Standard_Integer nbp = NbParams(i);
|
||||
for (Standard_Integer j = 1; j <= nbp; j ++) {
|
||||
Interface_FileParameter& FP = ChangeParam(i,j);
|
||||
if (FP.ParamType() == Interface_ParamInteger) {
|
||||
Standard_Integer val = atoi(FP.CValue());
|
||||
if (val > 0) {
|
||||
if (val != ((val/2) *2) && val < 2*nbd) { // candidat possible
|
||||
FP.SetEntityNumber((val+1)/2);
|
||||
}
|
||||
} else if (val < 0) {
|
||||
Standard_Integer mval = -val;
|
||||
if (mval != ((mval/2) *2) && mval < 2*nbd) { // candidat possible
|
||||
FP.SetEntityNumber((mval+1)/2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GlobalCheck
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Interface_Check) IGESData_IGESReaderData::GlobalCheck () const
|
||||
{
|
||||
return thechk;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDefaultLineWeight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_IGESReaderData::SetDefaultLineWeight (const Standard_Real defw)
|
||||
{
|
||||
thedefw = defw;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : DefaultLineWeight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real IGESData_IGESReaderData::DefaultLineWeight () const
|
||||
{
|
||||
return thedefw;
|
||||
}
|
100
src/IGESData/IGESData_IGESReaderTool.cdl
Executable file
100
src/IGESData/IGESData_IGESReaderTool.cdl
Executable file
@@ -0,0 +1,100 @@
|
||||
-- File: IGESReaderTool.cdl
|
||||
-- Created: Mon Apr 6 16:10:29 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class IGESReaderTool from IGESData inherits FileReaderTool
|
||||
|
||||
---Purpose : specific FileReaderTool for IGES
|
||||
-- Parameters are accessed through specific objects, ParamReaders
|
||||
|
||||
uses Integer, Boolean, Transient,
|
||||
Check, InterfaceModel, GeneralLib, ReaderLib, ParamList,
|
||||
IGESReaderData, Protocol from IGESData, FileRecognizer,
|
||||
IGESType, IGESEntity, DirPart, ReadStage, ParamReader
|
||||
|
||||
is
|
||||
|
||||
Create (reader : mutable IGESReaderData; protocol : Protocol from IGESData)
|
||||
returns IGESReaderTool;
|
||||
---Purpose : creates IGESReaderTool to work with an IGESReaderData and an
|
||||
-- IGES Protocol.
|
||||
-- Actually, no Lib is used
|
||||
|
||||
-- -- General -- --
|
||||
|
||||
Prepare (me : in out; reco : mutable FileRecognizer);
|
||||
---Purpose : binds empty entities to records, works with the Protocol
|
||||
-- (from IGESData) stored and later used
|
||||
-- RQ : Actually, sets DNum into IGES Entities
|
||||
-- Also loads the list of parameters for ParamReader
|
||||
|
||||
Recognize (me : in out; num : Integer;
|
||||
ach : in out Check; ent : out mutable Transient)
|
||||
returns Boolean;
|
||||
---Purpose : recognizes records by asking Protocol (on data of DirType)
|
||||
|
||||
-- Loading the IGESModel --
|
||||
|
||||
BeginRead (me : in out; amodel : mutable InterfaceModel);
|
||||
---Purpose : fills model's header, that is, its GlobalSection
|
||||
|
||||
AnalyseRecord (me : in out;
|
||||
num : Integer; anent : mutable Transient; acheck : in out Check)
|
||||
returns Boolean;
|
||||
---Purpose : fills an entity, given record no; works by calling ReadDirPart
|
||||
-- then ReadParams (with help of a ParamReader), then if required
|
||||
-- ReadProps and ReadAssocs, from IGESEntity
|
||||
-- Returns True if no fail has been recorded
|
||||
|
||||
EndRead (me : in out; amodel : mutable InterfaceModel) is redefined;
|
||||
---Purpose : after reading entities, true line weights can be computed
|
||||
|
||||
-- For each IGESEntity --
|
||||
|
||||
ReadDir (me; ent : mutable IGESEntity; IR : IGESReaderData;
|
||||
DP : DirPart; ach : in out Check);
|
||||
---Purpose : Reads directory part componants from file; DP is the litteral
|
||||
-- directory part, IR detains entities referenced by DP
|
||||
|
||||
ReadOwnParams (me; ent : mutable IGESEntity;
|
||||
IR : IGESReaderData; PR : in out ParamReader);
|
||||
---Purpose : Performs Reading of own Parameters for each IGESEntity
|
||||
-- Works with the ReaderLib loaded with ReadWriteModules for IGES
|
||||
-- In case of failure, tries UndefinedEntity from IGES
|
||||
|
||||
ReadProps (me; ent : mutable IGESEntity; IR : IGESReaderData;
|
||||
PR : in out ParamReader);
|
||||
---Purpose : Reads Property List, if there is (if not, does nothing)
|
||||
-- criterium is : current parameter of PR remains inside params
|
||||
-- list, and Stage is "Own"
|
||||
-- Current parameter must be a positive integer, which value
|
||||
-- gives the length of the list; else, a Fail is produced (into
|
||||
-- Check of PR) and reading process is stopped
|
||||
|
||||
ReadAssocs (me; ent : mutable IGESEntity; IR : IGESReaderData;
|
||||
PR : in out ParamReader);
|
||||
---Purpose : Reads Associativity List, if there is (if not, does nothing)
|
||||
-- criterium is : current parameter of PR remains inside params
|
||||
-- list, and Stage is "Own"
|
||||
-- Same conditions as above; in addition, no parameter must be
|
||||
-- let after the list once read
|
||||
-- Note that "Associated" entities are not declared "Shared"
|
||||
|
||||
fields
|
||||
|
||||
thelist : ParamList; -- (loaded once, allows optimization)
|
||||
thereco : FileRecognizer;
|
||||
theglib : GeneralLib;
|
||||
therlib : ReaderLib;
|
||||
thecnum : Integer; -- current entity number for recognize
|
||||
thectyp : IGESType; -- its IGESType (for purpose of optimization)
|
||||
thestep : ReadStage; -- to continue an interrupted party
|
||||
thechk : Check; -- check on header (kept by IGESModel)
|
||||
thegradweight : Integer;
|
||||
themaxweight : Real;
|
||||
thedefweight : Real;
|
||||
|
||||
end IGESReaderTool;
|
409
src/IGESData/IGESData_IGESReaderTool.cxx
Executable file
409
src/IGESData/IGESData_IGESReaderTool.cxx
Executable file
@@ -0,0 +1,409 @@
|
||||
#include <IGESData_IGESReaderTool.ixx>
|
||||
#include <IGESData_IGESReaderData.hxx>
|
||||
#include <IGESData_ParamCursor.hxx>
|
||||
#include <Interface_ReaderModule.hxx>
|
||||
#include <IGESData_ReadWriteModule.hxx>
|
||||
#include <IGESData_IGESModel.hxx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESData_UndefinedEntity.hxx>
|
||||
#include <Interface_FileParameter.hxx>
|
||||
#include <Interface_ParamList.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <stdio.h>
|
||||
|
||||
// MGE 17/06/98
|
||||
// To use Msg class
|
||||
#include <Message_Msg.hxx>
|
||||
|
||||
|
||||
IGESData_IGESReaderTool::IGESData_IGESReaderTool
|
||||
(const Handle(IGESData_IGESReaderData)& reader,
|
||||
const Handle(IGESData_Protocol)& protocol)
|
||||
: theglib(protocol) , therlib(protocol)
|
||||
{ SetData (reader,protocol); }
|
||||
|
||||
|
||||
// ###########################################################################
|
||||
// ######## PREPARATION ########
|
||||
|
||||
void IGESData_IGESReaderTool::Prepare
|
||||
(const Handle(IGESData_FileRecognizer)& reco)
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESReaderData,igesdat,Data());
|
||||
igesdat->SetEntityNumbers();
|
||||
thereco = reco;
|
||||
SetEntities();
|
||||
thelist = igesdat->Params(0);
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IGESData_IGESReaderTool::Recognize
|
||||
(const Standard_Integer num, Handle(Interface_Check)& ach,
|
||||
Handle(Standard_Transient)& ent)
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESReaderData,igesdat,Data());
|
||||
thecnum = num; thectyp = igesdat->DirType(num);
|
||||
Handle(IGESData_IGESEntity) anent;
|
||||
Standard_Boolean res = Standard_False;
|
||||
|
||||
// Recognizer -> Liste limitative
|
||||
if (!thereco.IsNull()) res = thereco->Evaluate(thectyp,anent);
|
||||
if (res) ent = anent;
|
||||
// Sinon, Library
|
||||
else res = RecognizeByLib (num,theglib,therlib,ach,ent);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################################
|
||||
// ######## LECTURE (Controle General) ########
|
||||
|
||||
// (Elements enchaines par la classe de base Interface_FileReaderTool)
|
||||
|
||||
void IGESData_IGESReaderTool::BeginRead
|
||||
(const Handle(Interface_InterfaceModel)& amodel)
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESModel,amod,amodel);
|
||||
DeclareAndCast(IGESData_IGESReaderData,igesdat,Data());
|
||||
const IGESData_GlobalSection& gs = igesdat->GlobalSection();
|
||||
amod->SetStartSection (igesdat->StartSection(),Standard_False);
|
||||
amod->SetGlobalSection (gs);
|
||||
Handle(Interface_Check) glob = amod->GlobalCheck();
|
||||
glob->GetMessages (igesdat->GlobalCheck());
|
||||
amod->SetGlobalCheck (glob);
|
||||
themaxweight = gs.MaxLineWeight();
|
||||
thegradweight = gs.LineWeightGrad();
|
||||
if (thegradweight > 0)
|
||||
{ themaxweight = themaxweight/thegradweight; thegradweight = 1; }
|
||||
thedefweight = igesdat->DefaultLineWeight();
|
||||
}
|
||||
|
||||
|
||||
// Manquent les procedures de reprise sur erreur en cours de route ...
|
||||
Standard_Boolean IGESData_IGESReaderTool::AnalyseRecord
|
||||
(const Standard_Integer num, const Handle(Standard_Transient)& anent,
|
||||
Handle(Interface_Check)& ach)
|
||||
{
|
||||
|
||||
Handle(TCollection_HAsciiString) lab;
|
||||
|
||||
DeclareAndCast(IGESData_IGESEntity,ent,anent);
|
||||
DeclareAndCast(IGESData_IGESReaderData,igesdat,Data());
|
||||
|
||||
// Demarrage de la lecture : Faire Clear
|
||||
ent->Clear();
|
||||
|
||||
// UndefinedEntity : une pre-analyse est faite
|
||||
DeclareAndCast(IGESData_UndefinedEntity,undent,ent);
|
||||
if (!undent.IsNull()) {
|
||||
IGESData_DirPart DP = igesdat->DirPart(num); // qui le copie ...
|
||||
undent->ReadDir (igesdat,DP,ach); // DP a pu etre modifie
|
||||
ReadDir (ent,igesdat,DP,ach); // Lecture avec ce DP
|
||||
}
|
||||
else ReadDir (ent,igesdat,igesdat->DirPart(num),ach);
|
||||
|
||||
thestep = IGESData_ReadDir;
|
||||
|
||||
// Liste de Parametres : controle de son entete
|
||||
// Handle(Interface_ParamList) list = Data()->Params(num);
|
||||
Standard_Integer nbpar = Data()->NbParams(num);
|
||||
Standard_Integer n0par = (num == 1 ? 1 : (Data()->ParamFirstRank(num-1) +1));
|
||||
if (nbpar < 1) {
|
||||
// Liste vide non admise, sauf si Undefined (par exemple type nul)
|
||||
if (!undent.IsNull()) return Standard_True;
|
||||
// Sending of message : DE : no parameter
|
||||
Message_Msg Msg27 ("XSTEP_27");
|
||||
Msg27.Arg(thecnum);
|
||||
ach->SendFail(Msg27);
|
||||
return Standard_False;
|
||||
}
|
||||
const Interface_FileParameter& FP = thelist->Value(n0par);
|
||||
if ((FP.ParamType() != Interface_ParamInteger) || (atoi(FP.CValue()) != ent->TypeNumber()))
|
||||
{
|
||||
// Sending of message : DE : Incorrect type
|
||||
Message_Msg Msg28 ("XSTEP_28");
|
||||
Msg28.Arg(thecnum);
|
||||
ach->SendFail(Msg28);
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
IGESData_ParamReader PR (thelist,ach,n0par,nbpar,num);
|
||||
thestep = IGESData_ReadOwn;
|
||||
ReadOwnParams (ent,igesdat,PR);
|
||||
if ((thestep = PR.Stage()) == IGESData_ReadOwn) PR.NextStage();
|
||||
if (thestep == IGESData_ReadEnd) {
|
||||
if (!PR.IsCheckEmpty()) ach = PR.Check();
|
||||
return (!ach->HasFailed());
|
||||
}
|
||||
|
||||
ReadAssocs (ent,igesdat,PR);
|
||||
if ((thestep = PR.Stage()) == IGESData_ReadAssocs) PR.NextStage();
|
||||
if (thestep == IGESData_ReadEnd) {
|
||||
if (!PR.IsCheckEmpty()) ach = PR.Check();
|
||||
return (!ach->HasFailed());
|
||||
}
|
||||
ReadProps (ent,igesdat,PR);
|
||||
// thestep = IGESData_ReadEnd;
|
||||
if (!PR.IsCheckEmpty()) ach = PR.Check();
|
||||
return (!ach->HasFailed());
|
||||
}
|
||||
|
||||
void IGESData_IGESReaderTool::EndRead
|
||||
(const Handle(Interface_InterfaceModel)& /* amodel */)
|
||||
{
|
||||
/*
|
||||
DeclareAndCast(IGESData_IGESModel,amod,amodel);
|
||||
DeclareAndCast(IGESData_IGESReaderData,igesdat,Data());
|
||||
amod->SetLineWeights(igesdat->DefaultLineWeight());
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ###########################################################################
|
||||
// ######## UNE ENTITE ########
|
||||
|
||||
// ######## Directory Part ########
|
||||
|
||||
void IGESData_IGESReaderTool::ReadDir
|
||||
(const Handle(IGESData_IGESEntity)& ent,
|
||||
const Handle(IGESData_IGESReaderData)& IR,
|
||||
const IGESData_DirPart& DP, Handle(Interface_Check)& ach) const
|
||||
{
|
||||
|
||||
Standard_Integer v[17];
|
||||
Standard_Character nom[9]; Standard_Character snum[9], theRes1[9],theRes2[9];
|
||||
//char mess[50]; //szv#4:S4163:12Mar99 unused
|
||||
|
||||
DP.Values(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8],v[9],v[10],v[11],
|
||||
v[12],v[13],v[14],v[15],v[16],theRes1,theRes2,nom,snum);
|
||||
|
||||
ent->InitTypeAndForm (v[0] , v[16]);
|
||||
Handle(IGESData_IGESEntity) fieldent, Structure, fieldlab;
|
||||
if (v[2] < 0) Structure = GetCasted
|
||||
(IGESData_IGESEntity, IR->BoundEntity( (1-v[2])/2 ));
|
||||
|
||||
Handle(IGESData_LineFontEntity) Lnf;
|
||||
if (v[3] < 0) {
|
||||
fieldent = GetCasted(IGESData_IGESEntity, IR->BoundEntity( (1-v[3])/2 ));
|
||||
Lnf = GetCasted(IGESData_LineFontEntity, fieldent);
|
||||
if (Lnf.IsNull()) {
|
||||
// Sending of message : Incorrect Line Font Pattern
|
||||
Message_Msg Msg29 ("XSTEP_29");
|
||||
Msg29.Arg(thecnum);
|
||||
Msg29.Arg(thectyp.Type());
|
||||
ach->SendWarning(Msg29);
|
||||
ent->InitDirFieldEntity(4,fieldent);
|
||||
}
|
||||
else ent->InitLineFont (Lnf);
|
||||
}
|
||||
else ent->InitLineFont(Lnf,v[3]); // ici Lnf Null
|
||||
|
||||
Handle(IGESData_LevelListEntity) Lvs;
|
||||
if (v[4] < 0) {
|
||||
fieldent = GetCasted(IGESData_IGESEntity, IR->BoundEntity( (1-v[4])/2 ));
|
||||
Lvs = GetCasted(IGESData_LevelListEntity, fieldent);
|
||||
if (Lvs.IsNull()) {
|
||||
// Sending of message : Incorrect Line Font Pattern
|
||||
Message_Msg Msg30 ("XSTEP_30");
|
||||
Msg30.Arg(thecnum);
|
||||
Msg30.Arg(thectyp.Type());
|
||||
ach->SendWarning(Msg30);
|
||||
ent->InitDirFieldEntity(5,fieldent);
|
||||
}
|
||||
else ent->InitLevel(Lvs,-1);
|
||||
}
|
||||
else ent->InitLevel(Lvs,v[4]); // ici Lvs Null
|
||||
|
||||
if (v[5] != 0) {
|
||||
fieldent = GetCasted(IGESData_IGESEntity,IR->BoundEntity( (1+v[5])/2 ));
|
||||
DeclareAndCast(IGESData_ViewKindEntity,View,fieldent);
|
||||
if (View.IsNull()) {
|
||||
// Sending of message : Incorrect View
|
||||
Message_Msg Msg31 ("XSTEP_31");
|
||||
Msg31.Arg(thecnum);
|
||||
Msg31.Arg(thectyp.Type());
|
||||
ach->SendWarning(Msg31);
|
||||
ent->InitDirFieldEntity(6,fieldent);
|
||||
}
|
||||
else ent->InitView(View);
|
||||
}
|
||||
|
||||
if (v[6] != 0) {
|
||||
fieldent = GetCasted(IGESData_IGESEntity,IR->BoundEntity( (1+v[6])/2 ));
|
||||
DeclareAndCast(IGESData_TransfEntity,Transf,fieldent);
|
||||
if (Transf.IsNull()) {
|
||||
// Sending of message : Incorrect Transformation Matrix
|
||||
Message_Msg Msg32 ("XSTEP_32");
|
||||
Msg32.Arg(thecnum);
|
||||
Msg32.Arg(thectyp.Type());
|
||||
ach->SendWarning(Msg32);
|
||||
ent->InitDirFieldEntity(7,fieldent);
|
||||
}
|
||||
else ent->InitTransf(Transf);
|
||||
}
|
||||
|
||||
Handle(IGESData_LabelDisplayEntity) Lbd;
|
||||
if (v[7] != 0) {
|
||||
fieldlab = GetCasted(IGESData_IGESEntity,IR->BoundEntity( (1+v[7])/2 ));
|
||||
Lbd = GetCasted(IGESData_LabelDisplayEntity,fieldent);
|
||||
if (Lbd.IsNull()) {
|
||||
// Sending of message : Incorrect Label Display
|
||||
Message_Msg Msg33 ("XSTEP_33");
|
||||
Msg33.Arg(thecnum);
|
||||
Msg33.Arg(thectyp.Type());
|
||||
ach->SendWarning(Msg33);
|
||||
}
|
||||
}
|
||||
|
||||
ent->InitStatus (v[8] , v[9] , v[10] , v[11]);
|
||||
|
||||
Standard_Integer LWeightNum = v[13];
|
||||
|
||||
Handle(IGESData_ColorEntity) Color;
|
||||
if (v[14] < 0) {
|
||||
fieldent = GetCasted(IGESData_IGESEntity,IR->BoundEntity( (1-v[14])/2 ));
|
||||
Color = GetCasted(IGESData_ColorEntity, fieldent);
|
||||
if (Color.IsNull()) {
|
||||
// Sending of message : Incorrect Color Number
|
||||
Message_Msg Msg34 ("XSTEP_34");
|
||||
Msg34.Arg(thecnum);
|
||||
Msg34.Arg(thectyp.Type());
|
||||
ach->SendWarning(Msg34);
|
||||
ent->InitDirFieldEntity(13,fieldent);
|
||||
}
|
||||
else ent->InitColor(Color);
|
||||
}
|
||||
else ent->InitColor(Color,v[14]);
|
||||
|
||||
ent->InitMisc (Structure,Lbd,LWeightNum);
|
||||
ent->InitDirFieldEntity(8,fieldlab);
|
||||
|
||||
// ignores : 1(type),2(ptrPsect),13(type),16(lignesPsect),17(form)
|
||||
// type et forme sont lus directement du DirPart; autres infos recalculees
|
||||
|
||||
// Restent a analyser nom (short label) et snum (subscript number)
|
||||
Handle(TCollection_HAsciiString) ShortLabel;
|
||||
Standard_Integer SubScriptN = -1;
|
||||
Standard_Integer iacar = 0;
|
||||
Standard_Integer i; // svv Jan11 2000 : porting on DEC
|
||||
for (i = 0; i < 8; i ++) { if (nom[i] > ' ') iacar = 1; }
|
||||
if (iacar > 0) ShortLabel = new TCollection_HAsciiString(nom);
|
||||
iacar = 0;
|
||||
for (i = 0; i < 8; i ++)
|
||||
{ if (snum[i] > ' ') iacar = 1; if(snum[i] == 0) break; }
|
||||
if (iacar > 0) SubScriptN = atoi(snum);
|
||||
ent->SetLabel(ShortLabel,SubScriptN);
|
||||
|
||||
// Enfin, SetLineWeight, tenant compte du defaut
|
||||
ent->SetLineWeight (IR->DefaultLineWeight(),themaxweight,thegradweight);
|
||||
}
|
||||
|
||||
|
||||
// ######## Partie Specifique ########
|
||||
|
||||
void IGESData_IGESReaderTool::ReadOwnParams
|
||||
(const Handle(IGESData_IGESEntity)& ent,
|
||||
const Handle(IGESData_IGESReaderData)& IR,
|
||||
IGESData_ParamReader& PR) const
|
||||
{
|
||||
Handle(Interface_Check) ach = new Interface_Check;;
|
||||
Handle(IGESData_ReadWriteModule) module; Standard_Integer CN;
|
||||
|
||||
// Les Modules font tout
|
||||
if (therlib.Select(ent,module,CN))
|
||||
module->ReadOwnParams(CN,ent,IR,PR);
|
||||
else if (ent.IsNull()) {
|
||||
// Pas trouve dutout
|
||||
// Sending of message : Null Entity
|
||||
Message_Msg Msg35 ("XSTEP_35");
|
||||
Msg35.Arg(thecnum);
|
||||
ach->SendFail(Msg35);
|
||||
// Cas de UndefinedEntity
|
||||
} else if (ent->IsKind(STANDARD_TYPE(IGESData_UndefinedEntity))) {
|
||||
DeclareAndCast(IGESData_UndefinedEntity,undent,ent);
|
||||
undent->ReadOwnParams(IR,PR);
|
||||
// IGESEntity creee puis non reconnue ... (bizarre, non ?)
|
||||
} else {
|
||||
// IGESData_IGESType DT = ent->IGESType();
|
||||
// Sending of message : Unknown Entity
|
||||
Message_Msg Msg36 ("XSTEP_36");
|
||||
Msg36.Arg(thecnum);
|
||||
ach->SendFail(Msg36);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ######## Proprietes ########
|
||||
|
||||
void IGESData_IGESReaderTool::ReadProps
|
||||
(const Handle(IGESData_IGESEntity)& ent,
|
||||
const Handle(IGESData_IGESReaderData)& IR,
|
||||
IGESData_ParamReader& PR) const
|
||||
{
|
||||
// MGE 17/06/98
|
||||
// Building of Messages
|
||||
//=====================================
|
||||
Message_Msg Msg38 ("XSTEP_38");
|
||||
//Message_Msg Msg221 ("XSTEP_221");
|
||||
//=====================================
|
||||
Handle(Interface_Check) ach = new Interface_Check;
|
||||
Msg38.Arg(thecnum);
|
||||
Msg38.Arg(thectyp.Type());
|
||||
if (PR.Stage() != IGESData_ReadProps) ach->SendFail(Msg38);
|
||||
Standard_Integer ncur = PR.CurrentNumber();
|
||||
Standard_Integer nbp = PR.NbParams();
|
||||
if (ncur == nbp + 1) { PR.EndAll(); return; }
|
||||
else if (ncur > nbp || ncur == 0) ach->SendWarning(Msg38);
|
||||
|
||||
Standard_Integer nbprops = 0;
|
||||
if (!PR.DefinedElseSkip()) return;
|
||||
if (!PR.ReadInteger(ncur,nbprops)) {
|
||||
Message_Msg Msg221 ("XSTEP_221");
|
||||
PR.SendFail(Msg221);
|
||||
return;
|
||||
}
|
||||
if (nbprops == 0) return; ncur ++;
|
||||
Interface_EntityList props;
|
||||
if (PR.ReadEntList
|
||||
(IR,PR.CurrentList(nbprops),Msg38, props,Standard_False) )
|
||||
ent->LoadProperties(props);
|
||||
}
|
||||
|
||||
|
||||
// ######## Associativites ########
|
||||
|
||||
void IGESData_IGESReaderTool::ReadAssocs
|
||||
(const Handle(IGESData_IGESEntity)& ent,
|
||||
const Handle(IGESData_IGESReaderData)& IR,
|
||||
IGESData_ParamReader& PR) const
|
||||
{
|
||||
// MGE 17/06/98
|
||||
// Building of Messages
|
||||
//=====================================
|
||||
Message_Msg Msg37 ("XSTEP_37");
|
||||
// Message_Msg Msg220 ("XSTEP_220");
|
||||
//=====================================
|
||||
Msg37.Arg(thecnum);
|
||||
Msg37.Arg(thectyp.Type());
|
||||
Handle(Interface_Check) ach = new Interface_Check;
|
||||
if (PR.Stage() != IGESData_ReadAssocs) ach->SendFail(Msg37);
|
||||
Standard_Integer ncur = PR.CurrentNumber();
|
||||
Standard_Integer nbp = PR.NbParams();
|
||||
if (ncur == nbp + 1) { PR.EndAll(); return; }
|
||||
else if (ncur > nbp || ncur == 0) ach->SendWarning(Msg37);
|
||||
|
||||
Standard_Integer nbassocs = 0;
|
||||
if (!PR.DefinedElseSkip()) return;
|
||||
if (!PR.ReadInteger(PR.Current(),nbassocs)){
|
||||
Message_Msg Msg220 ("XSTEP_220");
|
||||
PR.SendFail(Msg220);
|
||||
return;
|
||||
}
|
||||
if (nbassocs == 0) return;
|
||||
Interface_EntityList assocs;
|
||||
if (PR.ReadEntList
|
||||
(IR,PR.CurrentList(nbassocs),Msg37, assocs,Standard_False) )
|
||||
ent->LoadAssociativities(assocs);
|
||||
}
|
39
src/IGESData/IGESData_IGESType.cdl
Executable file
39
src/IGESData/IGESData_IGESType.cdl
Executable file
@@ -0,0 +1,39 @@
|
||||
-- File: IGESType.cdl
|
||||
-- Created: Mon Apr 6 14:24:36 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class IGESType from IGESData
|
||||
|
||||
---Purpose : taken from directory part of an entity (from file or model),
|
||||
-- gives "type" and "form" data, used to recognize entity's type
|
||||
|
||||
uses Integer
|
||||
|
||||
is
|
||||
|
||||
Create returns IGESType; -- default constructor (gives type = form = 0)
|
||||
|
||||
Create (atype, aform : Integer) returns IGESType;
|
||||
|
||||
Type (me) returns Integer is static;
|
||||
---Purpose : returns "type" data
|
||||
|
||||
Form (me) returns Integer is static;
|
||||
---Purpose : returns "form" data
|
||||
|
||||
IsEqual (me; another : IGESType) returns Boolean is static;
|
||||
---Purpose : compares two IGESTypes, avoiding comparing their fields
|
||||
---C++ : alias operator ==
|
||||
|
||||
Nullify (me : in out) is static;
|
||||
---Purpose : resets fields (usefull when an IGESType is stored as mask)
|
||||
|
||||
fields
|
||||
|
||||
thetype : Integer;
|
||||
theform : Integer;
|
||||
|
||||
end IGESType;
|
18
src/IGESData/IGESData_IGESType.cxx
Executable file
18
src/IGESData/IGESData_IGESType.cxx
Executable file
@@ -0,0 +1,18 @@
|
||||
#include <IGESData_IGESType.ixx>
|
||||
|
||||
|
||||
|
||||
IGESData_IGESType::IGESData_IGESType () { thetype = 0; theform = 0; }
|
||||
|
||||
IGESData_IGESType::IGESData_IGESType
|
||||
(const Standard_Integer atype, const Standard_Integer aform)
|
||||
{ thetype = atype; theform = aform; }
|
||||
|
||||
Standard_Integer IGESData_IGESType::Type () const { return thetype; }
|
||||
|
||||
Standard_Integer IGESData_IGESType::Form () const { return theform; }
|
||||
|
||||
Standard_Boolean IGESData_IGESType::IsEqual (const IGESData_IGESType& other) const
|
||||
{ return (thetype == other.Type() && theform == other.Form()); }
|
||||
|
||||
void IGESData_IGESType::Nullify () { thetype = 0; theform = 0; }
|
194
src/IGESData/IGESData_IGESWriter.cdl
Executable file
194
src/IGESData/IGESData_IGESWriter.cdl
Executable file
@@ -0,0 +1,194 @@
|
||||
-- File: IGESWriter.cdl
|
||||
-- Created: Tue Apr 7 14:06:46 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class IGESWriter from IGESData
|
||||
|
||||
---Purpose : manages atomic file writing, under control of IGESModel :
|
||||
-- prepare text to be sent then sends it
|
||||
-- takes into account distinction between successive Sections
|
||||
|
||||
uses Integer, Real, Character,
|
||||
HAsciiString from TCollection, HSequenceOfHAsciiString from TColStd,
|
||||
Array1OfInteger from TColStd,
|
||||
IGESModel, GlobalSection, IGESEntity, Array1OfDirPart, ReadStage,
|
||||
Protocol from IGESData, WriterLib, LineBuffer, FloatWriter,
|
||||
XY, XYZ
|
||||
|
||||
raises InterfaceMismatch
|
||||
|
||||
is
|
||||
|
||||
Create (amodel : IGESModel) returns IGESWriter;
|
||||
---Purpose : Creates an IGESWriter, empty ready to work
|
||||
-- (see the methods SendModel and Print)
|
||||
|
||||
Create returns IGESWriter;
|
||||
---Purpose : Default constructor (not used) to satisfy the compiler
|
||||
|
||||
Create (other : IGESWriter) returns IGESWriter;
|
||||
---Purpose : Constructor by copy (not used) to satisfy the compiler
|
||||
|
||||
-- Options for Sending Forms --
|
||||
|
||||
FloatWriter (me : in out) returns FloatWriter;
|
||||
---Purpose : Returns the embedded FloatWriter, which controls sending Reals
|
||||
-- Use this method to access FloatWriter in order to consult or
|
||||
-- change its options (MainFormat, FormatForRange,ZeroSuppress),
|
||||
-- because it is returned as the address of its field
|
||||
---C++ : return &
|
||||
|
||||
WriteMode (me : in out) returns Integer;
|
||||
---Purpose : Returns the write mode, in order to be read and/or changed
|
||||
-- Write Mode controls the way final print works
|
||||
-- 0 (D) : Normal IGES, 10 : FNES
|
||||
---C++ : return &
|
||||
|
||||
-- -- Management of building file -- --
|
||||
|
||||
SendStartLine (me : in out; startline : CString);
|
||||
---Purpose : Sends an additionnal Starting Line : this is the way used to
|
||||
-- send comments in an IGES File (at beginning of the file).
|
||||
-- If the line is more than 72 char.s long, it is splited into
|
||||
-- as many lines as required to send it completely
|
||||
|
||||
SendModel (me : in out; protocol : Protocol from IGESData);
|
||||
---Purpose : Sends the complete IGESModel (Global Section, Entities as
|
||||
-- Directory Entries & Parameter Lists, etc...)
|
||||
-- i.e. fills a list of texts. Once filled, it can be sent by
|
||||
-- method Print
|
||||
|
||||
SectionS (me : in out) raises InterfaceMismatch;
|
||||
---Purpose : declares sending of S section (only a declaration)
|
||||
-- error if state is not initial
|
||||
|
||||
SectionG (me : in out; header : GlobalSection) raises InterfaceMismatch;
|
||||
---Purpose : prepares sending of header, from a GlobalSection (stores it)
|
||||
-- error if SectionS was not called just before
|
||||
-- takes in account special characters (Separator, EndMark)
|
||||
|
||||
SectionsDP (me : in out) raises InterfaceMismatch;
|
||||
---Purpose : prepares sending of list of entities, as Sections D (directory
|
||||
-- list) and P (Parameters lists, one per entity)
|
||||
-- Entities will be then processed, one after the other
|
||||
-- error if SectionG has not be called just before
|
||||
|
||||
SectionT (me : in out) raises InterfaceMismatch;
|
||||
---Purpose : declares sending of T section (only a declaration)
|
||||
-- error if does not follow Entities sending
|
||||
|
||||
DirPart (me : in out; anent : IGESEntity) raises InterfaceMismatch;
|
||||
---Purpose : translates directory part of an Entity into a litteral DirPart
|
||||
-- Some infos are computed after sending parameters
|
||||
-- Error if not in sections DP or Stage not "Dir"
|
||||
|
||||
OwnParams (me : in out; anent : IGESEntity) raises InterfaceMismatch;
|
||||
---Purpose : sends own parameters of the entity, by sending firstly its
|
||||
-- type, then calling specific method WriteOwnParams
|
||||
-- Error if not in sections DP or Stage not "Own"
|
||||
|
||||
Associativities (me : in out; anent : IGESEntity) raises InterfaceMismatch;
|
||||
---Purpose : sends associativity list, as complement of parameters list
|
||||
-- error if not in sections DP or Stage not "Associativity"
|
||||
|
||||
Properties (me : in out; anent : IGESEntity) raises InterfaceMismatch;
|
||||
---Purpose : sends property list, as complement of parameters list
|
||||
-- error if not in sections DP or Stage not "Property"
|
||||
|
||||
EndEntity (me : in out) raises InterfaceMismatch;
|
||||
---Purpose : declares end of sending an entity (ends param list by ';')
|
||||
|
||||
-- -- Sending parameters (to be used by WriteOwnParams) -- --
|
||||
|
||||
AddString (me : in out; val : HAsciiString from TCollection;
|
||||
more : Integer = 0) is private;
|
||||
---Purpose : Basic action of adding a string to current parameter list as a
|
||||
-- line; manages size limit (64 or 72 according Sestion G or P)
|
||||
-- <more>, if precised, requires that <more> characters will
|
||||
-- remain free on the current line once this AddString done
|
||||
|
||||
AddString (me : in out; val : CString; lnval : Integer = 0;
|
||||
more : Integer = 0) is private;
|
||||
---Purpose : Basic action of adding a string to current parameter list as a
|
||||
-- line. Manages size limit (64 or 72 according Sestion G or P)
|
||||
-- <val> is the string and <lnval> its length. If <lnval> is not
|
||||
-- given, it is computed by strlen(val).
|
||||
-- <more>, if precised, requires that <more> characters will
|
||||
-- remain free on the current line once this AddString done
|
||||
|
||||
AddChar (me : in out; val : Character; more : Integer = 0) is private;
|
||||
---Purpose : Adds a string defined as a single character (for instance, the
|
||||
-- parameter separator). Manages size limit
|
||||
-- <more>, if precised, requires that <more> characters will
|
||||
-- remain free on the current line once this AddString done
|
||||
|
||||
|
||||
SendVoid (me : in out);
|
||||
---Purpose : sends a void parameter, that is null text
|
||||
|
||||
Send (me : in out; val : Integer);
|
||||
---Purpose : sends an Integer parameter
|
||||
|
||||
SendBoolean (me : in out; val : Boolean);
|
||||
---Purpose : sends a Boolean parameter as an Integer value 0(False)/1(True)
|
||||
|
||||
Send (me : in out; val : Real);
|
||||
---Purpose : sends a Real parameter. Works with FloatWriter
|
||||
|
||||
Send (me : in out; val : HAsciiString from TCollection);
|
||||
---Purpose : sends a Text parameter under Hollerith form
|
||||
|
||||
Send (me : in out; val : IGESEntity; negative : Boolean = Standard_False);
|
||||
---Purpose : sends a Reference to an Entity (if its Number is N, its
|
||||
-- pointer is 2*N-1)
|
||||
-- If <val> is Null, "0" will be sent
|
||||
-- If <negative> is True, "Pointer" is sent as negative
|
||||
|
||||
SendString (me : in out; val : HAsciiString from TCollection);
|
||||
---Purpose : sends a parameter under its exact form given as a string
|
||||
|
||||
Send (me : in out; val : XY);
|
||||
---Purpose : Sends a XY, interpreted as a couple of 2 Reals (X & Y)
|
||||
|
||||
Send (me : in out; val : XYZ);
|
||||
---Purpose : Sends a XYZ, interpreted as a couple of 2 Reals (X , Y & Z)
|
||||
|
||||
-- -- Conclusion : printing on an output -- --
|
||||
|
||||
SectionStrings (me; numsec : Integer)
|
||||
returns HSequenceOfHAsciiString from TColStd;
|
||||
---Purpose : Returns the list of strings for a section given its rank
|
||||
-- 1 : Start (if not empty) 2 : Global 3 or 4 : Parameters
|
||||
-- RQ: no string list for Directory section
|
||||
-- An empty section gives a null handle
|
||||
|
||||
Print (me; S : in out OStream) returns Boolean
|
||||
---Purpose : Writes result on an output defined as an OStream
|
||||
-- resolves stored infos at this time; in particular, numbers of
|
||||
-- lines used to adress P-section from D-section and final totals
|
||||
-- Takes WriteMode into account
|
||||
raises InterfaceMismatch;
|
||||
-- Error if not at Section "T"
|
||||
|
||||
fields
|
||||
|
||||
themodel : IGESModel;
|
||||
thestar : HSequenceOfHAsciiString from TColStd; -- starting lines
|
||||
thehead : HSequenceOfHAsciiString from TColStd; -- parameters for header
|
||||
|
||||
thesep : Character; -- separator (gotten from GlobalSection)
|
||||
theendm : Character; -- end mark ( id )
|
||||
thedirs : Array1OfDirPart;
|
||||
thepnum : Array1OfInteger from TColStd; -- rank in P-section for each entity
|
||||
thepars : HSequenceOfHAsciiString from TColStd; -- parameters for file
|
||||
thesect : Integer; -- section number (initial:0-S-G-DP-T)
|
||||
thestep : ReadStage; -- step for each entity
|
||||
thecurr : LineBuffer; -- current line (for sections G then P)
|
||||
|
||||
themodew : Integer; -- control of writing mode
|
||||
thefloatw : FloatWriter; -- control of sending Reals
|
||||
|
||||
end IGESWriter;
|
600
src/IGESData/IGESData_IGESWriter.cxx
Executable file
600
src/IGESData/IGESData_IGESWriter.cxx
Executable file
@@ -0,0 +1,600 @@
|
||||
#include <IGESData_IGESWriter.ixx>
|
||||
#include <IGESData_DefType.hxx>
|
||||
#include <IGESData_DirPart.hxx>
|
||||
#include <Interface_ParamSet.hxx>
|
||||
#include <Interface_ReportEntity.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_InterfaceError.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Message.hxx>
|
||||
|
||||
#include <IGESData_WriterLib.hxx>
|
||||
#include <IGESData_ReadWriteModule.hxx>
|
||||
#include <IGESData_UndefinedEntity.hxx>
|
||||
|
||||
#include <IGESData_LineFontEntity.hxx>
|
||||
#include <IGESData_LevelListEntity.hxx>
|
||||
#include <IGESData_TransfEntity.hxx>
|
||||
#include <IGESData_ViewKindEntity.hxx>
|
||||
#include <IGESData_LabelDisplayEntity.hxx>
|
||||
#include <IGESData_ColorEntity.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <Interface_FileParameter.hxx>
|
||||
#include <Interface_ParamList.hxx>
|
||||
#include <stdio.h>
|
||||
#include <Standard_PCharacter.hxx>
|
||||
|
||||
#define MaxcarsG 72
|
||||
#define MaxcarsP 64
|
||||
|
||||
//#define PATIENCELOG
|
||||
|
||||
|
||||
// Constructeur complet : taille OK, et se remplit depuis le modele en direct
|
||||
|
||||
IGESData_IGESWriter::IGESData_IGESWriter
|
||||
(const Handle(IGESData_IGESModel)& amodel)
|
||||
: thedirs(0,amodel->NbEntities()) , thepnum(1,amodel->NbEntities()+1),
|
||||
thecurr (MaxcarsG+1) , themodew (0) , thefloatw (9)
|
||||
{
|
||||
themodel = amodel;
|
||||
thehead = new TColStd_HSequenceOfHAsciiString();
|
||||
thesep = ',';
|
||||
theendm = ';';
|
||||
thepars = new TColStd_HSequenceOfHAsciiString();
|
||||
thepnum.SetValue(1,1); // debut des parametres de la 1re entite
|
||||
thesect = 0;
|
||||
thepnum.Init(0);
|
||||
// Format flottant : cf FloatWriter
|
||||
}
|
||||
|
||||
IGESData_IGESWriter::IGESData_IGESWriter ()
|
||||
: thedirs (0,0) , thepnum (1,1) , thecurr (MaxcarsG+1) , thefloatw (9) { }
|
||||
|
||||
IGESData_IGESWriter::IGESData_IGESWriter (const IGESData_IGESWriter& )
|
||||
: thedirs (0,0) , thepnum (1,1) , thecurr (MaxcarsG+1) , thefloatw (9) { }
|
||||
|
||||
|
||||
// .... Controle d Envoi des Flottants ....
|
||||
|
||||
Interface_FloatWriter& IGESData_IGESWriter::FloatWriter ()
|
||||
{ return thefloatw; } // s y reporter
|
||||
|
||||
Standard_Integer& IGESData_IGESWriter::WriteMode ()
|
||||
{ return themodew; }
|
||||
|
||||
// #####################################################################
|
||||
// ######## GENERATION DU FICHIER ########
|
||||
|
||||
//=======================================================================
|
||||
//function : SendStartLine
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IGESData_IGESWriter::SendStartLine (const Standard_CString startline)
|
||||
{
|
||||
Standard_PCharacter pstartline;
|
||||
//
|
||||
pstartline=(Standard_PCharacter)startline;
|
||||
//
|
||||
Standard_Integer lst = strlen (startline);
|
||||
if (lst == 0) return;
|
||||
if (thestar.IsNull()) thestar = new TColStd_HSequenceOfHAsciiString();
|
||||
if (lst <= MaxcarsG) {
|
||||
thestar->Append (new TCollection_HAsciiString(startline));
|
||||
return;
|
||||
}
|
||||
// Trop longue : on passe par bouts
|
||||
char startchar = startline[MaxcarsG];
|
||||
pstartline[MaxcarsG] = '\0';
|
||||
SendStartLine(startline);
|
||||
pstartline[MaxcarsG] = startchar;
|
||||
SendStartLine (&startline[MaxcarsG]);
|
||||
}
|
||||
|
||||
void IGESData_IGESWriter::SendModel
|
||||
(const Handle(IGESData_Protocol)& protocol)
|
||||
{
|
||||
Handle(Message_Messenger) sout = Message::DefaultMessenger();
|
||||
IGESData_WriterLib lib(protocol);
|
||||
|
||||
Standard_Integer nb = themodel->NbEntities();
|
||||
#ifdef PATIENCELOG
|
||||
sout<< " IGESWriter : " << nb << " Entities (* = 1000 Ent.s)" << endl;
|
||||
#endif
|
||||
SectionS ();
|
||||
Standard_Integer ns = themodel->NbStartLines();
|
||||
Standard_Integer i; // svv Jan11 2000 : porting on DEC
|
||||
for (i = 1; i <= ns; i ++) SendStartLine (themodel->StartLine(i));
|
||||
SectionG (themodel->GlobalSection());
|
||||
SectionsDP ();
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
Handle(IGESData_IGESEntity) ent = themodel->Entity(i);
|
||||
Handle(IGESData_IGESEntity) cnt = ent;
|
||||
#ifdef PATIENCELOG
|
||||
if (i % 1000 == 1) cout << "*" << flush;
|
||||
#endif
|
||||
// Attention aux cas d erreur : contenu redefini
|
||||
if (themodel->IsRedefinedContent(i)) {
|
||||
sout << " -- IGESWriter : Erroneous Entity N0."<<i<<" --"<<endl;
|
||||
Handle(Interface_ReportEntity) rep = themodel->ReportEntity(i);
|
||||
if (!rep.IsNull()) cnt = GetCasted(IGESData_IGESEntity,rep->Content());
|
||||
if (cnt.IsNull()) cnt = ent; // secours
|
||||
}
|
||||
|
||||
DirPart (cnt);
|
||||
OwnParams (ent); // preparation : porte sur le vrai <ent> ...
|
||||
|
||||
// Envoi proprement dit des Parametres proprement definis
|
||||
Handle(IGESData_ReadWriteModule) module; Standard_Integer CN;
|
||||
// Differents cas
|
||||
if (lib.Select(cnt,module,CN))
|
||||
module->WriteOwnParams (CN,cnt,*this);
|
||||
else if (cnt->IsKind(STANDARD_TYPE(IGESData_UndefinedEntity))) {
|
||||
DeclareAndCast(IGESData_UndefinedEntity,undent,cnt);
|
||||
undent->WriteOwnParams (*this);
|
||||
}
|
||||
else sout<<" -- IGESWriter : Not Processed for n0."<<i<<" in file, Type "
|
||||
<<cnt->TypeNumber()<<" Form "<<cnt->FormNumber()<<endl;
|
||||
|
||||
Associativities (cnt);
|
||||
Properties (cnt);
|
||||
EndEntity ();
|
||||
}
|
||||
#ifdef PATIENCELOG
|
||||
cout << " Envoi des Entites Termine"<<endl;
|
||||
#endif
|
||||
SectionT();
|
||||
}
|
||||
|
||||
|
||||
void IGESData_IGESWriter::SectionS ()
|
||||
{
|
||||
if (thesect != 0) Interface_InterfaceError::Raise("IGESWriter : SectionS");
|
||||
thesect = 1;
|
||||
}
|
||||
|
||||
void IGESData_IGESWriter::SectionG (const IGESData_GlobalSection& header)
|
||||
{
|
||||
if (thesect != 1) Interface_InterfaceError::Raise("IGESWriter : SectionG");
|
||||
thesect = 2;
|
||||
thesep = header.Separator();
|
||||
theendm = header.EndMark();
|
||||
thecurr.SetMax (MaxcarsG);
|
||||
// Important : les Parametres sont sortis sous leur forme definitive
|
||||
// (c-a-d Hollerith pour les Textes ...)
|
||||
Handle(Interface_ParamSet) gl = header.Params();
|
||||
Standard_Integer nb = gl->NbParams();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
const Interface_FileParameter& FP = gl->Param(i);
|
||||
AddString(FP.CValue());
|
||||
if (i < nb) AddChar(thesep);
|
||||
else AddChar(theendm);
|
||||
}
|
||||
if (thecurr.Length() > 0) thehead->Append(thecurr.Moved());
|
||||
}
|
||||
|
||||
void IGESData_IGESWriter::SectionsDP ()
|
||||
{
|
||||
if (thesect != 2) Interface_InterfaceError::Raise("IGESWriter : SectionsDP");
|
||||
thesect = 3;
|
||||
thecurr.SetMax (MaxcarsP);
|
||||
thestep = IGESData_ReadEnd;
|
||||
}
|
||||
|
||||
void IGESData_IGESWriter::SectionT ()
|
||||
{
|
||||
if (thesect != 3) Interface_InterfaceError::Raise("IGESWriter : SectionT");
|
||||
thesect = 4;
|
||||
thepnum.SetValue(thepnum.Length(),thepars->Length()+1);
|
||||
}
|
||||
|
||||
|
||||
void IGESData_IGESWriter::DirPart
|
||||
(const Handle(IGESData_IGESEntity)& anent)
|
||||
{
|
||||
if (thesect != 3 && thestep != IGESData_ReadEnd)
|
||||
Interface_InterfaceError::Raise("IGESWriter : DirPart");
|
||||
Standard_Integer v[17]; Standard_Character res1[9],res2[9],label[9],snum[9];
|
||||
Standard_Integer nument = themodel->Number(anent);
|
||||
if (nument == 0) return;
|
||||
IGESData_DirPart& DP = thedirs.ChangeValue(nument);
|
||||
// Remplissage du DirPart
|
||||
v[0] = anent->TypeNumber();
|
||||
v[1] = 0; // numero en section P : calcule ulterieurement
|
||||
if (anent->HasStructure()) v[2] = - themodel->DNum(anent->DirFieldEntity(3));
|
||||
else v[2] = 0;
|
||||
|
||||
IGESData_DefType linet = anent->DefLineFont();
|
||||
if (linet == IGESData_DefReference) v[3] = - themodel->DNum(anent->DirFieldEntity(4));
|
||||
else if (linet == IGESData_DefValue) v[3] = anent->RankLineFont();
|
||||
else v[3] = 0;
|
||||
|
||||
IGESData_DefList levt = anent->DefLevel();
|
||||
if (levt == IGESData_DefSeveral) v[4] = - themodel->DNum(anent->DirFieldEntity(5));
|
||||
else if (levt == IGESData_DefOne) v[4] = anent->Level();
|
||||
else v[4] = 0;
|
||||
|
||||
IGESData_DefList viewt = anent->DefView();
|
||||
if (viewt == IGESData_DefSeveral || viewt == IGESData_DefOne)
|
||||
v[5] = themodel->DNum(anent->DirFieldEntity(6));
|
||||
else v[5] = 0;
|
||||
|
||||
if (anent->HasTransf()) v[6] = themodel->DNum(anent->DirFieldEntity(7));
|
||||
else v[6] = 0;
|
||||
|
||||
if (anent->HasLabelDisplay()) v[7] = themodel->DNum(anent->DirFieldEntity(8));
|
||||
else v[7] = 0;
|
||||
|
||||
v[8] = anent->BlankStatus();
|
||||
v[9] = anent->SubordinateStatus();
|
||||
v[10] = anent->UseFlag();
|
||||
v[11] = anent->HierarchyStatus();
|
||||
v[12] = v[0]; // type repete
|
||||
v[13] = anent->LineWeightNumber();
|
||||
|
||||
IGESData_DefType colt = anent->DefColor();
|
||||
if (colt == IGESData_DefReference) v[14] = - themodel->DNum(anent->DirFieldEntity(13));
|
||||
else if (colt == IGESData_DefValue) v[14] = anent->RankColor();
|
||||
else v[14] = 0;
|
||||
|
||||
v[15] = 0; // nb lignes section P : calcule plus tard
|
||||
v[16] = anent->FormNumber();
|
||||
|
||||
anent->CResValues(res1,res2);
|
||||
Standard_Integer i; // svv Jan11 2000 : porting on DEC
|
||||
for (i = 0; i < 8; i ++) label[i] = snum[i] = ' ';
|
||||
if (anent->HasShortLabel()) {
|
||||
Handle(TCollection_HAsciiString) slab = anent->ShortLabel();
|
||||
for (i = 0; i < slab->Length(); i ++) label[i] = slab->Value(i+1);
|
||||
}
|
||||
if (anent->HasSubScriptNumber()) {
|
||||
Standard_Integer sn = anent->SubScriptNumber(); // -> cadres a droite
|
||||
snum[7] = '0'; i = 7;
|
||||
while (sn != 0) {
|
||||
snum[i] = (char) ((sn % 10) + 48);
|
||||
sn = sn / 10; i --;
|
||||
}
|
||||
}
|
||||
|
||||
DP.Init(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8],v[9],v[10],v[11],v[12],
|
||||
v[13],v[14],v[15],v[16],res1,res2,label,snum);
|
||||
// DP ChangeValue donc mis a jour d office
|
||||
thestep = IGESData_ReadDir;
|
||||
}
|
||||
|
||||
void IGESData_IGESWriter::OwnParams
|
||||
(const Handle(IGESData_IGESEntity)& anent)
|
||||
{
|
||||
char text[20];
|
||||
if (thesect != 3 && thestep != IGESData_ReadDir)
|
||||
Interface_InterfaceError::Raise("IGESWriter : OwnParams");
|
||||
thepnum.SetValue(themodel->Number(anent),thepars->Length()+1);
|
||||
thecurr.Clear();
|
||||
sprintf(text,"%d",anent->TypeNumber());
|
||||
AddString(text);
|
||||
thestep = IGESData_ReadOwn;
|
||||
}
|
||||
|
||||
void IGESData_IGESWriter::Properties
|
||||
(const Handle(IGESData_IGESEntity)& anent)
|
||||
{
|
||||
if (thesect != 3 && thestep != IGESData_ReadOwn)
|
||||
Interface_InterfaceError::Raise("IGESWriter : Properties");
|
||||
thestep = IGESData_ReadProps;
|
||||
if (!anent->ArePresentProperties()) return;
|
||||
Send(anent->NbProperties());
|
||||
for (Interface_EntityIterator iter = anent->Properties();
|
||||
iter.More(); iter.Next()) {
|
||||
DeclareAndCast(IGESData_IGESEntity,localent,iter.Value());
|
||||
Send(localent);
|
||||
}
|
||||
}
|
||||
|
||||
void IGESData_IGESWriter::Associativities
|
||||
(const Handle(IGESData_IGESEntity)& anent)
|
||||
{
|
||||
if (thesect != 3 && thestep != IGESData_ReadOwn)
|
||||
Interface_InterfaceError::Raise("IGESWriter : Associativities");
|
||||
thestep = IGESData_ReadAssocs;
|
||||
if (!anent->ArePresentAssociativities() && !anent->ArePresentProperties())
|
||||
return; // Properties suivent : ne pas les omettre !
|
||||
Send(anent->NbAssociativities());
|
||||
for (Interface_EntityIterator iter = anent->Associativities();
|
||||
iter.More(); iter.Next()) {
|
||||
DeclareAndCast(IGESData_IGESEntity,localent,iter.Value());
|
||||
Send(localent);
|
||||
}
|
||||
thestep = IGESData_ReadAssocs;
|
||||
}
|
||||
|
||||
void IGESData_IGESWriter::EndEntity ()
|
||||
{
|
||||
if (thesect != 3 && thestep != IGESData_ReadOwn)
|
||||
Interface_InterfaceError::Raise("IGESWriter : EndEntity");
|
||||
AddChar(theendm);
|
||||
if (thecurr.Length() > 0) thepars->Append(thecurr.Moved());
|
||||
thestep = IGESData_ReadEnd;
|
||||
}
|
||||
|
||||
// .... Alimentation des parametres ....
|
||||
|
||||
void IGESData_IGESWriter::AddString
|
||||
(const Handle(TCollection_HAsciiString)& val, const Standard_Integer more)
|
||||
{
|
||||
if (val.IsNull()) return;
|
||||
AddString (val->ToCString(),val->Length(),more);
|
||||
}
|
||||
|
||||
void IGESData_IGESWriter::AddString
|
||||
(const Standard_CString val, const Standard_Integer lnval,
|
||||
const Standard_Integer more)
|
||||
{
|
||||
Standard_Integer lnstr = lnval;
|
||||
if (lnstr <= 0) lnstr = strlen(val);
|
||||
if (!thecurr.CanGet (lnstr + more + 1)) {
|
||||
// + 1 (18-SEP-1996) pour etre sur que le separateur n est pas en tete de ligne
|
||||
if (thesect < 3) thehead->Append(thecurr.Moved());
|
||||
else thepars->Append(thecurr.Moved());
|
||||
}
|
||||
Standard_Integer maxcars = (thesect == 3 ? MaxcarsP : MaxcarsG);
|
||||
Standard_Integer n2 = 0;
|
||||
// .. pb de taille limite (30-DEC-1996)
|
||||
while (lnstr > maxcars) {
|
||||
thecurr.Add (&val[n2],lnstr);
|
||||
if (thesect < 3) thehead->Append(thecurr.Moved());
|
||||
else thepars->Append(thecurr.Moved());
|
||||
n2 += maxcars; lnstr -= maxcars;
|
||||
}
|
||||
thecurr.Add (&val[n2],lnstr);
|
||||
}
|
||||
|
||||
void IGESData_IGESWriter::AddChar
|
||||
(const Standard_Character val,
|
||||
const Standard_Integer more)
|
||||
{
|
||||
// 1 seul caractere : cas particulier simplifie
|
||||
char text[2];
|
||||
text[0] = val;
|
||||
text[1] = '\0';
|
||||
if (!thecurr.CanGet (1 + more)) {
|
||||
if (thesect < 3) thehead->Append(thecurr.Moved());
|
||||
else thepars->Append(thecurr.Moved());
|
||||
}
|
||||
thecurr.Add (text,1);
|
||||
}
|
||||
|
||||
|
||||
void IGESData_IGESWriter::SendVoid ()
|
||||
{ AddChar(thesep); }
|
||||
|
||||
void IGESData_IGESWriter::Send (const Standard_Integer val)
|
||||
{
|
||||
char text[20];
|
||||
AddChar(thesep);
|
||||
sprintf(text,"%d",val);
|
||||
AddString(text);
|
||||
}
|
||||
|
||||
void IGESData_IGESWriter::SendBoolean (const Standard_Boolean val)
|
||||
{
|
||||
AddChar(thesep);
|
||||
if (val) AddString("1");
|
||||
else AddString("0");
|
||||
}
|
||||
|
||||
void IGESData_IGESWriter::Send (const Standard_Real val)
|
||||
{
|
||||
// Valeur flottante, expurgee de "0000" qui trainent et de "E+00"
|
||||
char lval[24];
|
||||
AddChar(thesep);
|
||||
Standard_Integer lng = thefloatw.Write (val,lval);
|
||||
AddString(lval,lng);
|
||||
}
|
||||
|
||||
void IGESData_IGESWriter::Send (const Handle(TCollection_HAsciiString)& val)
|
||||
{
|
||||
AddChar(thesep);
|
||||
if (val.IsNull()) return;
|
||||
Standard_Integer lns = val->Length();
|
||||
if (lns == 0) return; // string vide : void vaut mieux que 0H
|
||||
Handle(TCollection_HAsciiString) hol = new TCollection_HAsciiString(lns);
|
||||
hol->AssignCat("H"); hol->AssignCat(val->ToCString());
|
||||
AddString(hol);
|
||||
}
|
||||
|
||||
void IGESData_IGESWriter::Send
|
||||
(const Handle(IGESData_IGESEntity)& val, const Standard_Boolean negative)
|
||||
{
|
||||
Standard_Integer num = 0;
|
||||
if (!val.IsNull()) num = themodel->DNum(val);
|
||||
if (negative) num = -num;
|
||||
Send(num); // qui faut tout, une fois Entity convertie en Integer
|
||||
}
|
||||
|
||||
void IGESData_IGESWriter::Send (const gp_XY& val)
|
||||
{ Send(val.X()); Send(val.Y()); }
|
||||
|
||||
void IGESData_IGESWriter::Send (const gp_XYZ& val)
|
||||
{ Send(val.X()); Send(val.Y()); Send(val.Z()); }
|
||||
|
||||
|
||||
void IGESData_IGESWriter::SendString (const Handle(TCollection_HAsciiString)& val)
|
||||
{
|
||||
AddChar(thesep);
|
||||
AddString(val); // envoi en l etat
|
||||
}
|
||||
|
||||
|
||||
// .... Envoi final ....
|
||||
|
||||
Handle(TColStd_HSequenceOfHAsciiString) IGESData_IGESWriter::SectionStrings
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
Handle(TColStd_HSequenceOfHAsciiString) res;
|
||||
if (num == 1) res = thestar;
|
||||
if (num == 2) res = thehead;
|
||||
if (num >= 3) res = thepars;
|
||||
return res;
|
||||
}
|
||||
|
||||
static void writefnes (Standard_OStream& S, const Standard_CString ligne)
|
||||
{
|
||||
char val;
|
||||
for (Standard_Integer i = 0; i < 80; i ++) {
|
||||
if (ligne[i] == '\0') return;
|
||||
val = ligne[i] ^ (150 + (i & 3));
|
||||
S << val;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean IGESData_IGESWriter::Print (Standard_OStream& S) const
|
||||
{
|
||||
// ATTENTION MODEFNES : si themodew = 10 ... alors on ecrit du FNES
|
||||
// quesaco ? fnes = iges + xor sur les caracteres (150,151,152,153,150...)
|
||||
// avec en plus une ligne qcq en tete ...
|
||||
// donc tous les 4 car.s, on fait un tour de modulo. ainsi a 64 et a 72 ...
|
||||
// On a une mini-routine qui ecrit un morceau de texte "en fnes", et les
|
||||
// blancs qui sont optimises (quand meme ...)
|
||||
|
||||
Standard_Boolean isGood = (S.good() );
|
||||
Standard_Boolean fnes = (themodew >= 10);
|
||||
if(!isGood)
|
||||
return isGood;
|
||||
char ligne[81];
|
||||
#ifdef PATIENCELOG
|
||||
Standard_Integer lignespatience = 1000;
|
||||
#endif
|
||||
char blancs[73];
|
||||
Standard_Integer i; // svv Jan11 2000 : porting on DEC
|
||||
for (i = 0; i < MaxcarsG; i ++) blancs[i] = ' ';
|
||||
blancs[MaxcarsG] = '\0';
|
||||
if (fnes) for (i = 0; i < MaxcarsG; i ++) blancs[i] = blancs[i] ^ (150 + (i & 3));
|
||||
|
||||
if (thesect != 4) Interface_InterfaceError::Raise
|
||||
("IGESWriter not ready for Print");
|
||||
// Start Section (assez simple, somme toute). Attention si commentaires
|
||||
Handle(TCollection_HAsciiString) line;
|
||||
Standard_Integer nbs = 1;
|
||||
if (thestar.IsNull()) {
|
||||
if (fnes) {
|
||||
S << " *** EUCLID/STRIM DESKTOP CLIPBOARD ***"<<endl;
|
||||
writefnes (S," S0000001");
|
||||
}
|
||||
else S<<" S0000001";
|
||||
// 123456789 123456789 123456789 123456789 123456789 123456789 123456789 12
|
||||
S << endl;
|
||||
} else {
|
||||
nbs = thestar->Length();
|
||||
for (i = 1; i <= nbs; i ++) {
|
||||
char finlin[20];
|
||||
sprintf(finlin,"S%7.7d",i);
|
||||
line = thestar->Value(i);
|
||||
|
||||
if (fnes) writefnes (S,line->ToCString());
|
||||
else S << line->ToCString();
|
||||
// for (Standard_Integer k = line->Length()+1; k <= MaxcarsG; k ++) S<<' ';
|
||||
S << &blancs[line->Length()];
|
||||
if (fnes) writefnes (S,finlin);
|
||||
else S << finlin; S << endl;
|
||||
}
|
||||
}
|
||||
#ifdef PATIENCELOG
|
||||
cout << "Global Section : " << flush;
|
||||
#endif
|
||||
isGood = S.good();
|
||||
// Global Section : convertie dans <thehead>
|
||||
Standard_Integer nbg = thehead->Length();
|
||||
for (i = 1; i <= nbg && isGood ;i++) {
|
||||
char finlin[20];
|
||||
sprintf(finlin,"G%7.7d",i);
|
||||
line = thehead->Value(i);
|
||||
|
||||
if (fnes) writefnes (S,line->ToCString());
|
||||
else S << line->ToCString();
|
||||
// for (Standard_Integer k = line->Length()+1; k <= MaxcarsG; k ++) S<<' ';
|
||||
S << &blancs[line->Length()];
|
||||
if (fnes) writefnes (S,finlin);
|
||||
else S << finlin; S << endl;
|
||||
isGood = S.good();
|
||||
}
|
||||
if(!isGood)
|
||||
return isGood;
|
||||
#ifdef PATIENCELOG
|
||||
cout << nbg << " lines" << endl;
|
||||
#endif
|
||||
|
||||
// Directory Section
|
||||
Standard_Integer nbd = thedirs.Upper(); // 0 -> NbEnts
|
||||
#ifdef PATIENCELOG
|
||||
cout << "\nDirectory section : " << nbd << " Entites" << endl;
|
||||
#endif
|
||||
for (i = 1; i <= nbd && isGood ; i ++) {
|
||||
Standard_Integer v[17]; char res1[9],res2[9],lab[9],num[9];
|
||||
thedirs.Value(i).Values(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8],v[9],
|
||||
v[10],v[11],v[12],v[13],v[14],v[15],v[16],
|
||||
res1,res2,lab,num);
|
||||
v[1] = thepnum.Value(i); // debut en P
|
||||
v[15] = thepnum.Value(i+1)-thepnum.Value(i); // nb de lignes en P
|
||||
sprintf(ligne,"%8d%8d%8d%8d%8d%8d%8d%8d%2.2d%2.2d%2.2d%2.2dD%7.7d",
|
||||
v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],
|
||||
v[8],v[9],v[10],v[11] ,2*i-1);
|
||||
if (fnes) writefnes (S,ligne);
|
||||
else S << ligne; S<< "\n";
|
||||
sprintf(ligne,"%8d%8d%8d%8d%8d%8s%8s%8s%8sD%7.7d",
|
||||
v[0],v[13],v[14],v[15],v[16],res1,res2,lab,num,2*i);
|
||||
if (fnes) writefnes (S,ligne);
|
||||
else S << ligne; S<< "\n";
|
||||
// cout << "Ent.no "<<i<<" No en P "<<thepnum.Value(i)<<
|
||||
// " Lignes P:"<<thepnum.Value(i+1)-thepnum.Value(i)<<endl;
|
||||
// for (j = 0; j < 17; j ++) S<<v[j]<<" ";
|
||||
// S<<res1<<res2<<" label:"<<lab<<" subnum:"<<num<<endl;
|
||||
isGood = S.good();
|
||||
}
|
||||
if(!isGood)
|
||||
return isGood;
|
||||
// Parameter Section
|
||||
#ifdef PATIENCELOG
|
||||
cout<<" Parameter Section : "<<thepnum.Value(nbd)-1
|
||||
<<" lines (* = 1000 lines) "<<flush;
|
||||
#endif
|
||||
|
||||
blancs[MaxcarsP] = '\0';
|
||||
for (i = 1; i <= nbd && isGood; i ++) {
|
||||
for (Standard_Integer j = thepnum.Value(i); j < thepnum.Value(i+1); j ++) {
|
||||
char finlin[20];
|
||||
sprintf(finlin," %7.7dP%7.7d",2*i-1,j);
|
||||
line = thepars->Value(j);
|
||||
// line->LeftJustify(MaxcarsP,' '); remplace par plus economique ! :
|
||||
|
||||
if (fnes) writefnes (S,line->ToCString());
|
||||
else S << line->ToCString();
|
||||
// for (Standard_Integer k = line->Length()+1; k <= MaxcarsP; k ++)S<<' ';
|
||||
S << &blancs[line->Length()];
|
||||
if (fnes) writefnes (S,finlin);
|
||||
else S << finlin; S << endl;
|
||||
isGood = S.good();
|
||||
#ifdef PATIENCELOG
|
||||
lignespatience --;
|
||||
if (lignespatience <= 0) { cout<<"*"<<flush; lignespatience = 1000; }
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if(!isGood)
|
||||
return isGood;
|
||||
// Terminal Section (pas trop compliquee, ma foi)
|
||||
sprintf (ligne,
|
||||
"S%7dG%7dD%7dP%7d T0000001",
|
||||
nbs,nbg,nbd*2,thepnum.Value(thepnum.Length())-1);
|
||||
// 12345678- 16- 24- 32 56789 123456789 123456789 123456789 12
|
||||
if (fnes) writefnes (S,ligne);
|
||||
else S << ligne; S<< "\n";
|
||||
S.flush();
|
||||
isGood = S.good();
|
||||
#ifdef PATIENCELOG
|
||||
cout <<"\n Section T (lines counts) : G "<<nbg<<" D "<<nbd
|
||||
<<" P "<<thepnum.Value(thepnum.Length())-1<<" T 1"<<endl;
|
||||
#endif
|
||||
return isGood;
|
||||
}
|
15
src/IGESData/IGESData_LabelDisplayEntity.cdl
Executable file
15
src/IGESData/IGESData_LabelDisplayEntity.cdl
Executable file
@@ -0,0 +1,15 @@
|
||||
-- File: LabelDisplayEntity.cdl
|
||||
-- Created: Tue Apr 7 16:01:15 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
deferred class LabelDisplayEntity from IGESData inherits IGESEntity
|
||||
|
||||
---Purpose : defines required type for LabelDisplay in directory part
|
||||
-- an effective LabelDisplay entity must inherits it
|
||||
|
||||
is
|
||||
|
||||
end LabelDisplayEntity;
|
2
src/IGESData/IGESData_LabelDisplayEntity.cxx
Executable file
2
src/IGESData/IGESData_LabelDisplayEntity.cxx
Executable file
@@ -0,0 +1,2 @@
|
||||
#include <IGESData_LabelDisplayEntity.ixx>
|
||||
// LabelDisplayEntity ne sert qu'au controle de type (pour le directory part)
|
30
src/IGESData/IGESData_LevelListEntity.cdl
Executable file
30
src/IGESData/IGESData_LevelListEntity.cdl
Executable file
@@ -0,0 +1,30 @@
|
||||
-- File: LevelListEntity.cdl
|
||||
-- Created: Tue Apr 7 16:00:09 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
deferred class LevelListEntity from IGESData inherits IGESEntity
|
||||
|
||||
---Purpose : defines required type for LevelList in directory part
|
||||
-- an effective LevelList entity must inherits it
|
||||
|
||||
uses Boolean, Integer
|
||||
|
||||
raises OutOfRange
|
||||
|
||||
is
|
||||
|
||||
NbLevelNumbers (me) returns Integer is deferred;
|
||||
---Purpose : Must return the count of levels
|
||||
|
||||
LevelNumber (me; num : Integer) returns Integer
|
||||
raises OutOfRange is deferred;
|
||||
---Purpose : returns the Level Number of <me>, indicated by <num>
|
||||
-- raises an exception if num is out of range
|
||||
|
||||
HasLevelNumber (me; level : Integer) returns Boolean;
|
||||
---Purpose : returns True if <level> is in the list
|
||||
|
||||
end LevelListEntity;
|
14
src/IGESData/IGESData_LevelListEntity.cxx
Executable file
14
src/IGESData/IGESData_LevelListEntity.cxx
Executable file
@@ -0,0 +1,14 @@
|
||||
#include <IGESData_LevelListEntity.ixx>
|
||||
// LevelListEntity ne sert qu'au controle de type (pour le directory part)
|
||||
|
||||
|
||||
Standard_Boolean IGESData_LevelListEntity::HasLevelNumber
|
||||
(const Standard_Integer level) const
|
||||
{
|
||||
Standard_Integer nb = NbLevelNumbers();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
if (LevelNumber(i) == level) return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
15
src/IGESData/IGESData_LineFontEntity.cdl
Executable file
15
src/IGESData/IGESData_LineFontEntity.cdl
Executable file
@@ -0,0 +1,15 @@
|
||||
-- File: LineFontEntity.cdl
|
||||
-- Created: Tue Apr 7 15:51:55 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
deferred class LineFontEntity from IGESData inherits IGESEntity
|
||||
|
||||
---Purpose : defines required type for LineFont in directory part
|
||||
-- an effective LineFont entity must inherits it
|
||||
|
||||
is
|
||||
|
||||
end LineFontEntity;
|
2
src/IGESData/IGESData_LineFontEntity.cxx
Executable file
2
src/IGESData/IGESData_LineFontEntity.cxx
Executable file
@@ -0,0 +1,2 @@
|
||||
#include <IGESData_LineFontEntity.ixx>
|
||||
// LineTypeEntity ne sert qu'au controle de type (pour le directory part)
|
21
src/IGESData/IGESData_NameEntity.cdl
Executable file
21
src/IGESData/IGESData_NameEntity.cdl
Executable file
@@ -0,0 +1,21 @@
|
||||
-- File: NameEntity.cdl
|
||||
-- Created: Tue Apr 7 15:43:06 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
deferred class NameEntity from IGESData inherits IGESEntity
|
||||
|
||||
---Purpose : a NameEntity is a kind of IGESEntity which can provide a Name
|
||||
-- under alphanumeric (String) form, from Properties list
|
||||
-- an effective Name entity must inherit it
|
||||
|
||||
uses HAsciiString from TCollection
|
||||
|
||||
is
|
||||
|
||||
Value (me) returns HAsciiString from TCollection is deferred;
|
||||
---Purpose : Retyrns the alphanumeric value of the Name, to be defined
|
||||
|
||||
end NameEntity;
|
2
src/IGESData/IGESData_NameEntity.cxx
Executable file
2
src/IGESData/IGESData_NameEntity.cxx
Executable file
@@ -0,0 +1,2 @@
|
||||
#include <IGESData_NameEntity.ixx>
|
||||
// NameEntity sert a decrire des entites "propriete nom" (Value a definir)
|
131
src/IGESData/IGESData_ParamCursor.cdl
Executable file
131
src/IGESData/IGESData_ParamCursor.cdl
Executable file
@@ -0,0 +1,131 @@
|
||||
-- File: ParamCursor.cdl
|
||||
-- Created: Mon Oct 26 16:25:39 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@topsn2>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class ParamCursor from IGESData
|
||||
|
||||
---Purpose : Auxiliary class for ParamReader.
|
||||
-- It stores commands for a ParamReader to manage the current
|
||||
-- parameter number. Used by methods Read... from ParamReader.
|
||||
-- It allows to define the following commands :
|
||||
-- - read a parameter specified by a precise Number (basic case)
|
||||
-- - read a parameter then set Current Number to follow its number
|
||||
-- - read the current parameter (with Current Number) then
|
||||
-- advance Current Number by one
|
||||
-- - idem with several : read "nb" parameters from one specified,
|
||||
-- included, with or without setting Current Number to follow
|
||||
-- last parameter read
|
||||
-- - read several parameter from the current one, then advance
|
||||
-- Current Number to follow the last one read
|
||||
-- - Read several parameters (as above) but in interlaced lists,
|
||||
-- i.e. from complex items (each one including successively for
|
||||
-- instance, an Integer, a Real, an Entity ...)
|
||||
--
|
||||
-- If commands to advance Current Number are not set, it must be
|
||||
-- set by the user (with method SetCurrent from ParamReader)
|
||||
-- ParamReader offers methods which create most useful cases
|
||||
---See also : class ParamReader
|
||||
|
||||
uses Integer, Boolean
|
||||
|
||||
raises InterfaceError
|
||||
|
||||
is
|
||||
|
||||
Create (num : Integer) returns ParamCursor;
|
||||
---Purpose : Creates a Cursor to read a precise parameter of ParamReader,
|
||||
-- identified by its number, then set Current Number to "num + 1"
|
||||
-- (this constructor allows to simply give a Number to a method
|
||||
-- Read... from ParamReader, which will be translated into a
|
||||
-- ParamCursor by compiler)
|
||||
|
||||
Create (num, nb : Integer; size : Integer = 1) returns ParamCursor;
|
||||
---Purpose : Creates a Cursor to read a list of parameters (count "nb")
|
||||
-- starting from a precise one (number "num") included, then
|
||||
-- set Current Number of ParamNumber to the first following one
|
||||
-- ("num + nb")
|
||||
-- If size is given, it means that each parameter is made of more
|
||||
-- than one term. One term is the normal (default) case : for
|
||||
-- instance, a Parameter comprises one Integer, or one Entity ...
|
||||
-- Size gives the complete size of each Item if it is complex.
|
||||
-- To be used ONLY IF it is constant
|
||||
|
||||
SetTerm (me : in out; size : Integer; autoadv : Boolean = Standard_True)
|
||||
raises InterfaceError is static;
|
||||
---Purpose : Defines the size of a term to read in the item : this commands
|
||||
-- ParamReader to read "size" parameters for each item, then
|
||||
-- skip the remainder of the item to the same term of next Item
|
||||
-- (that is, skip "item size" - "term size")
|
||||
--
|
||||
-- In addition, Offset from beginning of Item is managed :
|
||||
-- After being created, and for the frist call to SetTerm, the
|
||||
-- part of Item to be read begins exactly as the Item begins
|
||||
-- But after a SetTerm, the next read will add an offset which is
|
||||
-- the size of former term.
|
||||
--
|
||||
-- autoadv commands Advance management. If it is True (default),
|
||||
-- the last SetTerm (Item size has been covered) calls SetAdvance
|
||||
-- If it is False, SetAdvance must be called directly if necessary
|
||||
--
|
||||
-- Error if a SetTerm overpasses the size of the Item
|
||||
|
||||
SetOne (me : in out; autoadv : Boolean = Standard_True)
|
||||
raises InterfaceError is static;
|
||||
---Purpose : Defines a term of one Parameter (very current case)
|
||||
|
||||
SetXY (me : in out; autoadv : Boolean = Standard_True)
|
||||
raises InterfaceError is static;
|
||||
---Purpose : Defines a term of two Parameters for a XY (current case)
|
||||
|
||||
SetXYZ (me : in out; autoadv : Boolean = Standard_True)
|
||||
raises InterfaceError is static;
|
||||
---Purpose : Defines a term of three Parameters for XYZ (current case)
|
||||
|
||||
|
||||
SetAdvance (me : in out; advance : Boolean) is static;
|
||||
---Purpose : Changes command to advance current cursor after reading
|
||||
-- parameters. If "advance" True, sets advance, if "False",
|
||||
-- resets it. ParamCursor is created by default with True.
|
||||
|
||||
Start (me) returns Integer is static;
|
||||
---Purpose : Returns (included) starting number for reading parameters
|
||||
---C++: inline
|
||||
|
||||
Limit (me) returns Integer is static;
|
||||
---Purpose : Returns (excluded) upper limit number for reading parameters
|
||||
---C++ : inline
|
||||
|
||||
Count (me) returns Integer is static;
|
||||
---Purpose : Returns required count of items to be read
|
||||
---C++ : inline
|
||||
|
||||
ItemSize (me) returns Integer is static;
|
||||
---Purpose : Returns length of item (count of parameters per item)
|
||||
---C++ : inline
|
||||
|
||||
TermSize (me) returns Integer is static;
|
||||
---Purpose : Returns length of current term (count of parameters) in item
|
||||
---C++ : inline
|
||||
|
||||
Offset (me) returns Integer is static;
|
||||
---Purpose : Returns offset from which current term must be read in item
|
||||
---C++ : inline
|
||||
|
||||
Advance (me) returns Boolean is static;
|
||||
---Purpose : Returns True if Advance command has been set
|
||||
---C++ : inline
|
||||
|
||||
fields
|
||||
|
||||
thestart : Integer;
|
||||
thelimit : Integer;
|
||||
thecount : Integer;
|
||||
theisize : Integer;
|
||||
theoffst : Integer;
|
||||
thetsize : Integer;
|
||||
theadv : Boolean;
|
||||
|
||||
end ParamCursor;
|
45
src/IGESData/IGESData_ParamCursor.cxx
Executable file
45
src/IGESData/IGESData_ParamCursor.cxx
Executable file
@@ -0,0 +1,45 @@
|
||||
#include <IGESData_ParamCursor.ixx>
|
||||
#include <Interface_InterfaceError.hxx>
|
||||
|
||||
|
||||
|
||||
IGESData_ParamCursor::IGESData_ParamCursor (const Standard_Integer num)
|
||||
{
|
||||
thestart = num; thelimit = thestart+1;
|
||||
thecount = 1; theadv = Standard_True;
|
||||
theisize = 1; theoffst = 0; thetsize = 1;
|
||||
}
|
||||
|
||||
IGESData_ParamCursor::IGESData_ParamCursor
|
||||
(const Standard_Integer num,
|
||||
const Standard_Integer nb, const Standard_Integer size)
|
||||
{
|
||||
thestart = num; thelimit = num + (nb*size);
|
||||
thecount = nb; theadv = Standard_True;
|
||||
theisize = size; theoffst = 0; thetsize = size;
|
||||
}
|
||||
|
||||
void IGESData_ParamCursor::SetTerm
|
||||
(const Standard_Integer size, const Standard_Boolean autoadv)
|
||||
{
|
||||
theoffst += thetsize;
|
||||
thetsize = size;
|
||||
if (autoadv) theadv = (theoffst + thetsize == theisize);
|
||||
if (theoffst + thetsize > theisize) Interface_InterfaceError::Raise
|
||||
("IGESDAta ParamCursor : required Term size overpass whole Item size");
|
||||
}
|
||||
|
||||
void IGESData_ParamCursor::SetOne (const Standard_Boolean autoadv)
|
||||
{ SetTerm (1, autoadv); }
|
||||
|
||||
void IGESData_ParamCursor::SetXY (const Standard_Boolean autoadv)
|
||||
{ SetTerm (2, autoadv); }
|
||||
|
||||
void IGESData_ParamCursor::SetXYZ (const Standard_Boolean autoadv)
|
||||
{ SetTerm (3, autoadv); }
|
||||
|
||||
void IGESData_ParamCursor::SetAdvance(const Standard_Boolean advance)
|
||||
{ theadv = advance; }
|
||||
|
||||
// LA SUITE : inline , cf lxx
|
||||
// (Start,Limit,Count,ItemSize,TermSize,Offset,Advance)
|
22
src/IGESData/IGESData_ParamCursor.lxx
Executable file
22
src/IGESData/IGESData_ParamCursor.lxx
Executable file
@@ -0,0 +1,22 @@
|
||||
// IGESData_ParamCursor inline
|
||||
|
||||
inline Standard_Integer IGESData_ParamCursor::Start () const
|
||||
{ return thestart; }
|
||||
|
||||
inline Standard_Integer IGESData_ParamCursor::Limit () const
|
||||
{ return thelimit; }
|
||||
|
||||
inline Standard_Integer IGESData_ParamCursor::Count () const
|
||||
{ return thecount; }
|
||||
|
||||
inline Standard_Integer IGESData_ParamCursor::ItemSize () const
|
||||
{ return theisize; }
|
||||
|
||||
inline Standard_Integer IGESData_ParamCursor::TermSize () const
|
||||
{ return thetsize; }
|
||||
|
||||
inline Standard_Integer IGESData_ParamCursor::Offset () const
|
||||
{ return theoffst; }
|
||||
|
||||
inline Standard_Boolean IGESData_ParamCursor::Advance() const
|
||||
{ return theadv; }
|
481
src/IGESData/IGESData_ParamReader.cdl
Executable file
481
src/IGESData/IGESData_ParamReader.cdl
Executable file
@@ -0,0 +1,481 @@
|
||||
-- File: ParamReader.cdl
|
||||
-- Created: Mon Apr 6 17:15:18 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class ParamReader from IGESData
|
||||
|
||||
---Purpose : access to a list of parameters, with management of read stage
|
||||
-- (owned parameters, properties, associativities) and current
|
||||
-- parameter number, read errors (which feed a Check), plus
|
||||
-- convenient facilities to read parameters, in particular :
|
||||
-- - first parameter is ignored (it repeats entity type), hence
|
||||
-- number 1 gives 2nd parameter, etc...
|
||||
-- - lists are not explicit, list-reading methods are provided
|
||||
-- which manage a current param. number
|
||||
-- - interpretation is made as possible (texts, reals, entities ...)
|
||||
-- (in particular, Reading a Real accepts an Integer)
|
||||
|
||||
uses Integer, Boolean, Real, CString,
|
||||
HAsciiString from TCollection, XY, XYZ,
|
||||
HArray1OfInteger from TColStd, HArray1OfReal from TColStd,
|
||||
HArray1OfHAsciiString from Interface, HArray1OfIGESEntity,
|
||||
EntityList, ParamType, ParamList, Check,
|
||||
IGESEntity, ReadStage, IGESReaderData, ParamCursor, Msg from Message,
|
||||
Status from IGESData
|
||||
|
||||
raises InterfaceError
|
||||
|
||||
is
|
||||
|
||||
Create (list : ParamList; ach : Check;
|
||||
base : Integer = 1; nbpar : Integer = 0; num : Integer = 0)
|
||||
returns ParamReader;
|
||||
---Purpose : Prepares a ParamReader, stage "Own", current param = 1
|
||||
-- It considers a part of the list, from <base> (excluded) for
|
||||
-- <nbpar> parameters; <nbpar> = 0 commands to take list length.
|
||||
-- Default is (1 to skip type)
|
||||
|
||||
EntityNumber (me) returns Integer;
|
||||
---Purpose : Returns the entity number in the file
|
||||
|
||||
-- -- State management -- --
|
||||
|
||||
Clear (me : in out);
|
||||
---Purpose : resets state (stage, current param number, check with no fail)
|
||||
|
||||
CurrentNumber (me) returns Integer;
|
||||
---Purpose : returns the current parameter number
|
||||
-- This notion is involved by the organisation of an IGES list of
|
||||
-- parameter : it can be ended by two lists (Associativities and
|
||||
-- Properties), which can be empty, or even absent. Hence, it is
|
||||
-- necessary to know, at the end of specific reading, how many
|
||||
-- parameters have been read : the optionnal lists follow
|
||||
---See Also : methods Current, CurrentList and Read...
|
||||
|
||||
SetCurrentNumber (me : in out; num : Integer);
|
||||
---Purpose : sets current parameter number to a new value
|
||||
-- must be done at end of each step : set on first parameter
|
||||
-- following last read one; is done by some Read... methods
|
||||
-- (must be done directly if these method are not used)
|
||||
-- num greater than NbParams means that following lists are empty
|
||||
-- If current num is not managed, it remains at 1, which probably
|
||||
-- will cause error when successive steps of reading are made
|
||||
|
||||
Stage (me) returns ReadStage;
|
||||
---Purpose : gives current stage (Own-Props-Assocs-End, begins at Own)
|
||||
|
||||
NextStage (me : in out);
|
||||
---Purpose : passes to next stage (must be linked with setting Current)
|
||||
|
||||
EndAll (me : in out);
|
||||
---Purpose : passes directly to the end of reading process
|
||||
|
||||
-- -- Queries on Parameters -- --
|
||||
|
||||
NbParams (me) returns Integer;
|
||||
---Purpose : returns number of parameters (minus the first one)
|
||||
-- following method skip the first parameter (1 gives the 2nd)
|
||||
|
||||
ParamType (me; num : Integer) returns ParamType;
|
||||
---Purpose : returns type of parameter; note that "Ident" or "Sub" cannot
|
||||
-- be encountered, they correspond to "Integer", see also below
|
||||
|
||||
ParamValue (me; num : Integer) returns CString;
|
||||
---Purpose : returns litteral value of a parameter, as it was in file
|
||||
---C++ : return const
|
||||
|
||||
-- -- Adapted Helps for Reading -- --
|
||||
|
||||
IsParamDefined (me; num : Integer) returns Boolean;
|
||||
---Purpose : says if a parameter is defined (not void)
|
||||
-- See also DefinedElseSkip
|
||||
|
||||
IsParamEntity (me; num : Integer) returns Boolean;
|
||||
---Purpose : says if a parameter can be regarded as an entity reference
|
||||
-- (see Prepare from IGESReaderData for more explanation)
|
||||
-- Note that such a parameter can seen as be a plain Integer too
|
||||
|
||||
ParamNumber (me; num : Integer) returns Integer;
|
||||
---Purpose : returns entity number corresponding to a parameter if there is
|
||||
-- otherwise zero (according criterium IsParamEntity)
|
||||
|
||||
ParamEntity (me : in out; IR : IGESReaderData; num : Integer)
|
||||
returns mutable IGESEntity
|
||||
---Purpose : directly returns entity referenced by a parameter
|
||||
raises InterfaceError;
|
||||
-- Error if <num> cannot be regarded as an Entity reference
|
||||
-- (causes recording fail into check and raising an exception)
|
||||
-- More complete ways of reading -- --
|
||||
-- The following methods (Read...) allow to read data, manage errors,
|
||||
-- and manage Current number (through a ParamCursor)
|
||||
-- Managing error is done as follows :
|
||||
-- - the Check (contained in the ParamReader) is filled with a Fail
|
||||
-- message, composed with "mess" given as argument
|
||||
-- - returned Value is False
|
||||
-- - Finally, if it is not precise enough, status for last call to a
|
||||
-- method Read.. can be asked (but not ParamEntity or IsParamDefined)
|
||||
-- If a Correction occurs, returned Value is True, as a normal read
|
||||
-- (but a Warning message is recorded and LastStatus is different)
|
||||
--
|
||||
-- Params are identified through a ParamCursor, which allows :
|
||||
-- - basically, to designate a Parameter by its Number
|
||||
-- - also, to designate several ones (that is, a list)
|
||||
-- - and more, to define lists of complex items (involving interlaced
|
||||
-- lists for each term)
|
||||
-- - optionnally to work with the Current Number (this is the default):
|
||||
-- - Number of parameter (first one for a list) is Current Number;
|
||||
-- - after Reading, Current Number will follow the last paameter read
|
||||
-- Hence, SetCurrentNumber has not to be called
|
||||
-- - Except a Defined Parameter, else Skip Current Parameter if it is Void
|
||||
-- Options provided by methods Current and CurrentList
|
||||
-- Remark : If Read... receives directly an Integer value, it will be
|
||||
-- converted into a ParamCursor by the C++ compiler
|
||||
|
||||
Current (me) returns ParamCursor;
|
||||
---Purpose : Creates a ParamCursor from the Current Number, to read one
|
||||
-- parameter, and to advance Current Number after reading
|
||||
|
||||
CurrentList (me; nb : Integer; size : Integer = 1) returns ParamCursor;
|
||||
---Purpose : Creates a ParamCursor from the Current Number, to read a list
|
||||
-- of "nb" items, and to advance Current Number after reading
|
||||
-- By default, each item is made of one parameter
|
||||
-- If size is given, it precises the number of params per item
|
||||
|
||||
-- For Message
|
||||
PrepareRead (me : in out; PC : ParamCursor; several : Boolean; size : Integer = 1)
|
||||
returns Boolean is private;
|
||||
|
||||
|
||||
PrepareRead (me : in out; PC : ParamCursor; mess : CString;
|
||||
several : Boolean; size : Integer = 1)
|
||||
returns Boolean is private;
|
||||
---Purpose : Prepares work for Read... methods which call it to begin
|
||||
-- The required count of parameters must not overpass NbParams.
|
||||
-- If several is given False, PC count must be one.
|
||||
-- If size is given, the TermSize from ParmCursor must be a
|
||||
-- multiple count of this size.
|
||||
-- If one of above condition is not satisfied, a Fail Message is
|
||||
-- recorded into Check, using the root "mess" and return is False
|
||||
|
||||
FirstRead (me : in out; nb : Integer = 1) returns Integer is static private;
|
||||
---Purpose : Gets the first parameter number to be read, determined from
|
||||
-- ParamCursor data read by PrepareRead (Start + Offset)
|
||||
-- Then commands to skip 1 parameter (default) or nb if given
|
||||
|
||||
NextRead (me : in out; nb : Integer = 1) returns Integer is static private;
|
||||
---Purpose : Gets the next parameter number to be read. Skips to next Item
|
||||
-- if TermSize has been read.
|
||||
-- Then commands to skip 1 parameter (default) or nb if given
|
||||
|
||||
DefinedElseSkip (me : in out) returns Boolean;
|
||||
---Purpose : Allows to simply process a parameter which can be defaulted.
|
||||
-- Waits on the Current Number a defined parameter or skips it :
|
||||
-- If the parameter <num> is defined, changes nothing and returns True
|
||||
-- Hence, the next reading with current cursor will concern <num>
|
||||
-- If it is void, advances Current Position by one, and returns False
|
||||
-- The next reading will concern <num+1> (except if <num> = NbParams)
|
||||
--
|
||||
-- This allows to process Default values as follows (C++) :
|
||||
-- if (PR.DefinedElseSkip()) {
|
||||
-- .. PR.Read... (current parameter);
|
||||
-- } else {
|
||||
-- <current parameter> = default value
|
||||
-- .. nothing else to do with ParamReader
|
||||
-- }
|
||||
-- For Message
|
||||
ReadInteger (me : in out; PC : ParamCursor;
|
||||
val : out Integer) returns Boolean;
|
||||
|
||||
ReadInteger (me : in out; PC : ParamCursor; mess : CString;
|
||||
val : out Integer) returns Boolean;
|
||||
---Purpose : Reads an Integer value designated by PC
|
||||
-- The method Current designates the current parameter and
|
||||
-- advances the Current Number by one after reading
|
||||
-- Note that if a count (not 1) is given, it is ignored
|
||||
-- If it is not an Integer, fills Check with a Fail (using mess)
|
||||
-- and returns False
|
||||
|
||||
-- For Message
|
||||
ReadBoolean (me : in out; PC : ParamCursor; amsg : Msg from Message;
|
||||
val : out Boolean; exact : Boolean = Standard_True) returns Boolean;
|
||||
|
||||
ReadBoolean (me : in out; PC : ParamCursor; mess : CString;
|
||||
val : out Boolean; exact : Boolean = Standard_True) returns Boolean;
|
||||
---Purpose : Reads a Boolean value from parameter "num"
|
||||
-- A Boolean is given as an Integer value 0 (False) or 1 (True)
|
||||
-- Anyway, an Integer is demanded (else, Check is filled)
|
||||
-- If exact is given True, those precise values are demanded
|
||||
-- Else, Correction is done, as False for 0 or <0, True for >0
|
||||
-- (with a Warning error message, and return is True)
|
||||
-- In case of error (not an Integer, or not 0/1 and exact True),
|
||||
-- Check is filled with a Fail (using mess) and return is False
|
||||
|
||||
-- For Message
|
||||
ReadReal (me : in out; PC : ParamCursor;
|
||||
val : out Real) returns Boolean;
|
||||
|
||||
ReadReal (me : in out; PC : ParamCursor; mess : CString;
|
||||
val : out Real) returns Boolean;
|
||||
---Purpose : Reads a Real value from parameter "num"
|
||||
-- An Integer is accepted (Check is filled with a Warning
|
||||
-- message) and causes return to be True (as normal case)
|
||||
-- In other cases, Check is filled with a Fail and return is False
|
||||
|
||||
-- For Message
|
||||
ReadXY (me : in out; PC : ParamCursor;amsg : out Msg from Message ;
|
||||
val : out XY) returns Boolean;
|
||||
|
||||
ReadXY (me : in out; PC : ParamCursor; mess : CString;
|
||||
val : out XY) returns Boolean;
|
||||
---Purpose : Reads a couple of Real values (X,Y) from parameter "num"
|
||||
-- Integers are accepted (Check is filled with a Warning
|
||||
-- message) and cause return to be True (as normal case)
|
||||
-- In other cases, Check is filled with a Fail and return is False
|
||||
|
||||
-- For Message
|
||||
ReadXYZ (me : in out; PC : ParamCursor; amsg : out Msg from Message;
|
||||
val : out XYZ) returns Boolean;
|
||||
|
||||
ReadXYZ (me : in out; PC : ParamCursor; mess : CString;
|
||||
val : out XYZ) returns Boolean;
|
||||
---Purpose : Reads a triplet of Real values (X,Y,Z) from parameter "num"
|
||||
-- Integers are accepted (Check is filled with a Warning
|
||||
-- message) and cause return to be True (as normal case)
|
||||
-- In other cases, Check is filled with a Fail and return is False
|
||||
-- For Message
|
||||
ReadText (me : in out; PC : ParamCursor; amsg : Msg from Message;
|
||||
val : out HAsciiString from TCollection) returns Boolean;
|
||||
|
||||
ReadText (me : in out; PC : ParamCursor; mess : CString;
|
||||
val : out HAsciiString from TCollection) returns Boolean;
|
||||
---Purpose : Reads a Text value from parameter "num", as a String from
|
||||
-- Collection, that is, Hollerith text without leading "nnnH"
|
||||
-- If it is not a String, fills Check with a Fail (using mess)
|
||||
-- and returns False
|
||||
|
||||
-- For Message
|
||||
ReadEntity (me : in out; IR : IGESReaderData;
|
||||
PC : ParamCursor;
|
||||
aStatus: in out Status from IGESData;
|
||||
val : out mutable IGESEntity;
|
||||
canbenul : Boolean = Standard_False)
|
||||
returns Boolean;
|
||||
|
||||
ReadEntity (me : in out; IR : IGESReaderData; PC : ParamCursor; mess : CString;
|
||||
val : out mutable IGESEntity; canbenul : Boolean = Standard_False) returns Boolean;
|
||||
---Purpose : Reads an IGES entity from parameter "num"
|
||||
-- An Entity is known by its reference, which has the form of an
|
||||
-- odd Integer Value (a number in the Directory)
|
||||
-- If <canbenul> is given True, a Reference can also be Null :
|
||||
-- in this case, the result is a Null Handle with no Error
|
||||
-- If <canbenul> is False, a Null Reference causes an Error
|
||||
-- If the parameter cannot refer to an entity (or null), fills
|
||||
-- Check with a Fail (using mess) and returns False
|
||||
|
||||
|
||||
-- For Message
|
||||
ReadEntity (me : in out; IR : IGESReaderData;
|
||||
PC : ParamCursor;
|
||||
aStatus: in out Status from IGESData;
|
||||
type : Type from Standard;
|
||||
val : out mutable IGESEntity;
|
||||
canbenul : Boolean = Standard_False) returns Boolean;
|
||||
|
||||
ReadEntity (me : in out; IR : IGESReaderData;
|
||||
PC : ParamCursor;
|
||||
mess : CString;
|
||||
type : Type from Standard;
|
||||
val : out mutable IGESEntity;
|
||||
canbenul : Boolean = Standard_False) returns Boolean;
|
||||
---Purpose : Works as ReadEntity without Type, but in addition checks the
|
||||
-- Type of the Entity, which must be "kind of" a given <type>
|
||||
-- Then, gives the same fail cases as ReadEntity without Type,
|
||||
-- plus the case "Incorrect Type"
|
||||
-- (in such a case, returns False and givel <val> = Null)
|
||||
|
||||
-- For Message
|
||||
ReadInts (me : in out; PC : ParamCursor; amsg : Msg from Message;
|
||||
val : out HArray1OfInteger from TColStd; index : Integer = 1) returns Boolean;
|
||||
|
||||
ReadInts (me : in out; PC : ParamCursor; mess : CString;
|
||||
val : out HArray1OfInteger from TColStd; index : Integer = 1) returns Boolean;
|
||||
---Purpose : Reads a list of Integer values, defined by PC (with a count of
|
||||
-- parameters). PC can start from Current Number and command it
|
||||
-- to advance after reading (use method CurrentList to do this)
|
||||
-- The list is given as a HArray1, numered from "index"
|
||||
-- If all params are not Integer, Check is filled (using mess)
|
||||
-- and return value is False
|
||||
|
||||
-- For Message
|
||||
ReadReals (me : in out; PC : ParamCursor;amsg : out Msg from Message;
|
||||
val : out HArray1OfReal from TColStd; index : Integer = 1) returns Boolean;
|
||||
|
||||
ReadReals (me : in out; PC : ParamCursor; mess : CString;
|
||||
val : out HArray1OfReal from TColStd; index : Integer = 1) returns Boolean;
|
||||
---Purpose : Reads a list of Real values defined by PC
|
||||
-- Same conditions as for ReadInts, for PC and index
|
||||
-- An Integer parameter is accepted, if at least one parameter is
|
||||
-- Integer, Check is filled with a "Warning" message
|
||||
-- If all params are neither Real nor Integer, Check is filled
|
||||
-- (using mess) and return value is False
|
||||
|
||||
-- For Message
|
||||
ReadTexts (me : in out; PC : ParamCursor; amsg : Msg from Message;
|
||||
val : out HArray1OfHAsciiString; index : Integer = 1) returns Boolean;
|
||||
|
||||
ReadTexts (me : in out; PC : ParamCursor; mess : CString;
|
||||
val : out HArray1OfHAsciiString; index : Integer = 1) returns Boolean;
|
||||
---Purpose : Reads a list of Hollerith Texts, defined by PC
|
||||
-- Texts are read as Hollerith texts without leading "nnnH"
|
||||
-- Same conditions as for ReadInts, for PC and index
|
||||
-- If all params are not Text, Check is filled (using mess)
|
||||
-- and return value is False
|
||||
|
||||
-- For Message
|
||||
ReadEnts (me : in out; IR : IGESReaderData; PC : ParamCursor;amsg : Msg from Message;
|
||||
val : out HArray1OfIGESEntity; index : Integer = 1) returns Boolean;
|
||||
|
||||
ReadEnts (me : in out; IR : IGESReaderData; PC : ParamCursor; mess : CString;
|
||||
val : out HArray1OfIGESEntity; index : Integer = 1) returns Boolean;
|
||||
---Purpose : Reads a list of Entities defined by PC
|
||||
-- Same conditions as for ReadInts, for PC and index
|
||||
-- The list is given as a HArray1, numered from "index"
|
||||
-- If all params cannot be read as Entities, Check is filled
|
||||
-- (using mess) and return value is False
|
||||
-- Remark : Null references are accepted, they are ignored
|
||||
-- (negative pointers too : they provoke a Warning message)
|
||||
-- If the caller wants to check them, a loop on ReadEntity should
|
||||
-- be used
|
||||
|
||||
|
||||
-- For Message
|
||||
ReadEntList (me : in out; IR : IGESReaderData; PC : ParamCursor;amsg : in out Msg from Message;
|
||||
val : in out EntityList; ord : Boolean = Standard_True) returns Boolean;
|
||||
|
||||
ReadEntList (me : in out; IR : IGESReaderData; PC : ParamCursor; mess : CString;
|
||||
val : in out EntityList; ord : Boolean = Standard_True) returns Boolean;
|
||||
---Purpose : Reads a list of Entities defined by PC
|
||||
-- Same conditions as for ReadEnts, for PC
|
||||
-- The list is given as an EntityList
|
||||
-- (index has no meaning; the EntityList starts from clear)
|
||||
-- If "ord" is given True (default), entities will be added to
|
||||
-- the list in their original order
|
||||
-- Remark : Negative or Null Pointers are ignored
|
||||
-- Else ("ord" False), order is not garanteed (faster mode)
|
||||
-- If all params cannot be read as Entities, same as above
|
||||
-- Warning Give "ord" to False ONLY if order is not significant
|
||||
|
||||
-- For Message
|
||||
ReadingReal (me : in out; num : Integer;
|
||||
val : out Real) returns Boolean;
|
||||
|
||||
ReadingReal (me : in out; num : Integer; mess : CString;
|
||||
val : out Real) returns Boolean;
|
||||
---Purpose : Routine which reads a Real parameter, given its number
|
||||
-- Same conditions as ReadReal for mess, val, and return value
|
||||
|
||||
-- For Message
|
||||
ReadingEntityNumber (me : in out; num : Integer;
|
||||
val : out Integer) returns Boolean;
|
||||
|
||||
ReadingEntityNumber (me : in out; num : Integer; mess : CString;
|
||||
val : out Integer) returns Boolean;
|
||||
---Purpose : Routine which reads an Entity Number (which allows to read the
|
||||
-- Entity in the IGESReaderData by BoundEntity), given its number
|
||||
-- in the list of Parameters
|
||||
-- Same conditions as ReadEntity for mess, val, and return value
|
||||
-- In particular, returns True and val to zero means Null Entity,
|
||||
-- and val not zero means Entity read by BoundEntity
|
||||
|
||||
|
||||
-- -- Check management for Message -- --
|
||||
|
||||
SendFail (me : in out; amsg : Msg from Message)
|
||||
is static;
|
||||
|
||||
|
||||
SendWarning (me : in out; amsg :Msg from Message)
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
|
||||
-- -- Check management -- --
|
||||
|
||||
AddFail (me : in out; idm : CString; af,bf : HAsciiString from TCollection)
|
||||
is static private;
|
||||
---Purpose : internal method which builds a Fail message from an
|
||||
-- identification "idm" and a diagnostic ("afail")
|
||||
-- Also feeds LastReadStatus
|
||||
-- <af> for final message, bf (can be different) for original
|
||||
|
||||
AddFail (me : in out; idm, afail : CString; bfail : CString)
|
||||
is static private;
|
||||
---Purpose : Same as above but with CString
|
||||
-- <bf> empty means = <af>
|
||||
|
||||
AddWarning (me : in out; idm : CString; aw,bw : HAsciiString from TCollection)
|
||||
is static private;
|
||||
---Purpose : internal method which builds a Warning message from an
|
||||
-- identification "idm" and a diagnostic
|
||||
-- <aw> is final message, bw is original (can be different)
|
||||
-- Also feeds LastReadStatus
|
||||
|
||||
AddWarning (me : in out; idm, aw : CString; bw : CString)
|
||||
is static private;
|
||||
---Purpose : Same as above but with CString
|
||||
-- <bw> empty means = <aw>
|
||||
|
||||
AddFail (me : in out; afail : CString; bfail : CString = "") is static;
|
||||
AddFail (me : in out; af,bf : HAsciiString from TCollection) is static;
|
||||
---Purpose : feeds the Check with a new fail (as a String or as a CString)
|
||||
|
||||
AddWarning (me : in out; awarn : CString; bwarn : CString = "") is static;
|
||||
AddWarning (me : in out; aw,bw : HAsciiString from TCollection) is static;
|
||||
---Purpose : feeds the Check with a new Warning message
|
||||
|
||||
Mend (me : in out; pref : CString = "");
|
||||
--Purpose : Mends the Fail messages, by calling Mend from Check
|
||||
|
||||
HasFailed (me) returns Boolean is static;
|
||||
---Purpose : says if fails have been recorded into the Check
|
||||
|
||||
Check (me) returns Check is static;
|
||||
---Purpose : returns the Check
|
||||
-- Note that any error signaled above is also recorded into it
|
||||
---C++ : return const&
|
||||
|
||||
CCheck (me : in out) returns Check is static;
|
||||
---Purpose : returns the check in a way which allows to work on it directly
|
||||
-- (i.e. messages added to the Check are added to ParamReader too)
|
||||
---C++ : return &
|
||||
|
||||
|
||||
IsCheckEmpty (me) returns Boolean is static;
|
||||
---Purpose : Returns True if the Check is Empty
|
||||
-- Else, it has to be recorded with the Read Entity
|
||||
|
||||
fields
|
||||
|
||||
theparams : ParamList;
|
||||
thecheck : Check;
|
||||
thebase : Integer;
|
||||
thenbpar : Integer;
|
||||
thecurr : Integer;
|
||||
thestage : ReadStage; -- following organisation of an IGESEntity
|
||||
thelast : Boolean; -- LastReadStatus
|
||||
theindex : Integer; -- data to manage Read... process
|
||||
thenbitem : Integer;
|
||||
theitemsz : Integer;
|
||||
theoffset : Integer;
|
||||
thetermsz : Integer;
|
||||
themaxind : Integer;
|
||||
thenbterm : Integer;
|
||||
pbrealint : Integer;
|
||||
pbrealform : Integer;
|
||||
thenum : Integer;
|
||||
|
||||
end ParamReader;
|
1580
src/IGESData/IGESData_ParamReader.cxx
Executable file
1580
src/IGESData/IGESData_ParamReader.cxx
Executable file
File diff suppressed because it is too large
Load Diff
46
src/IGESData/IGESData_Protocol.cdl
Executable file
46
src/IGESData/IGESData_Protocol.cdl
Executable file
@@ -0,0 +1,46 @@
|
||||
-- File: IGESData_Protocol.cdl
|
||||
-- Created: Wed May 5 11:30:30 1993
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
class Protocol from IGESData inherits Protocol from Interface
|
||||
|
||||
---Purpose : Description of basic Protocol for IGES
|
||||
-- This comprises treatement of IGESModel and Recognition of
|
||||
-- Undefined-FreeFormat-Entity
|
||||
|
||||
uses OStream, Type, InterfaceModel, Check
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable Protocol from IGESData;
|
||||
|
||||
NbResources (me) returns Integer;
|
||||
---Purpose : Gives the count of Resource Protocol. Here, none
|
||||
|
||||
Resource (me; num : Integer) returns Protocol from Interface;
|
||||
---Purpose : Returns a Resource, given a rank. Here, none
|
||||
|
||||
TypeNumber (me; atype : any Type) returns Integer;
|
||||
---Purpose : Returns a Case Number, specific of each recognized Type
|
||||
-- Here, Undefined and Free Format Entities have the Number 1.
|
||||
|
||||
-- -- General Services (defined at Norm level) -- --
|
||||
|
||||
NewModel (me) returns mutable InterfaceModel;
|
||||
---Purpose : Creates an empty Model for IGES Norm
|
||||
|
||||
IsSuitableModel (me; model : InterfaceModel) returns Boolean;
|
||||
---Purpose : Returns True if <model> is a Model of IGES Norm
|
||||
|
||||
UnknownEntity (me) returns mutable Transient;
|
||||
---Purpose : Creates a new Unknown Entity for IGES (UndefinedEntity)
|
||||
|
||||
IsUnknownEntity (me; ent : Transient) returns Boolean;
|
||||
---Purpose : Returns True if <ent> is an Unknown Entity for the Norm, i.e.
|
||||
-- Type UndefinedEntity, status Unknown
|
||||
|
||||
end Protocol;
|
40
src/IGESData/IGESData_Protocol.cxx
Executable file
40
src/IGESData/IGESData_Protocol.cxx
Executable file
@@ -0,0 +1,40 @@
|
||||
#include <IGESData_Protocol.ixx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESData_UndefinedEntity.hxx>
|
||||
#include <IGESData_FreeFormatEntity.hxx>
|
||||
#include <IGESData_IGESModel.hxx>
|
||||
|
||||
|
||||
|
||||
IGESData_Protocol::IGESData_Protocol () { }
|
||||
|
||||
|
||||
Standard_Integer IGESData_Protocol::NbResources () const { return 0; }
|
||||
|
||||
Handle(Interface_Protocol) IGESData_Protocol::Resource
|
||||
(const Standard_Integer num) const
|
||||
{ Handle(Interface_Protocol) nulpro; return nulpro; }
|
||||
|
||||
|
||||
// TypeNumber : Ici, on reconnait UndefinedEntity (faut bien quelqu un)
|
||||
|
||||
Standard_Integer IGESData_Protocol::TypeNumber
|
||||
(const Handle(Standard_Type)& atype) const
|
||||
{
|
||||
if (atype->SubType(STANDARD_TYPE(IGESData_UndefinedEntity))) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Handle(Interface_InterfaceModel) IGESData_Protocol::NewModel () const
|
||||
{ return new IGESData_IGESModel; }
|
||||
|
||||
Standard_Boolean IGESData_Protocol::IsSuitableModel
|
||||
(const Handle(Interface_InterfaceModel)& model) const
|
||||
{ return model->IsKind(STANDARD_TYPE(IGESData_IGESModel)); }
|
||||
|
||||
Handle(Standard_Transient) IGESData_Protocol::UnknownEntity () const
|
||||
{ return new IGESData_UndefinedEntity; }
|
||||
|
||||
Standard_Boolean IGESData_Protocol::IsUnknownEntity
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
{ return ent->IsKind(STANDARD_TYPE(IGESData_UndefinedEntity)); }
|
76
src/IGESData/IGESData_ReadWriteModule.cdl
Executable file
76
src/IGESData/IGESData_ReadWriteModule.cdl
Executable file
@@ -0,0 +1,76 @@
|
||||
-- File: IGESData_ReadWriteModule.cdl
|
||||
-- Created: Mon Sep 6 19:22:12 1993
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
deferred class ReadWriteModule from IGESData
|
||||
inherits ReaderModule from Interface
|
||||
|
||||
---Purpose : Defines basic File Access Module, under the control of
|
||||
-- IGESReaderTool for Reading and IGESWriter for Writing :
|
||||
-- Specific actions concern : Read and Write Own Parameters of
|
||||
-- an IGESEntity.
|
||||
-- The common parts (Directory Entry, Lists of Associativities
|
||||
-- and Properties) are processed by IGESReaderTool & IGESWriter
|
||||
--
|
||||
-- Each sub-class of ReadWriteModule is used in conjunction with
|
||||
-- a sub-class of Protocol from IGESData and processes several
|
||||
-- types of IGESEntity (typically, them of a package) :
|
||||
-- The Protocol gives a unique positive integer Case Number for
|
||||
-- each type of IGESEntity it recognizes, the corresponding
|
||||
-- ReadWriteModule processes an Entity by using the Case Number
|
||||
-- to known what is to do
|
||||
-- On Reading, the general service NewVoid is used to create an
|
||||
-- IGES Entity the first time
|
||||
--
|
||||
-- Warning : Works with an IGESReaderData which stores "DE parts" of Items
|
||||
|
||||
uses Transient, FileReaderData, Check,
|
||||
IGESEntity, DirPart, IGESReaderData, ParamReader, IGESWriter
|
||||
|
||||
raises DomainError
|
||||
|
||||
is
|
||||
|
||||
CaseNum (me; data : FileReaderData; num : Integer) returns Integer;
|
||||
---Purpose : Translates the Type of record <num> in <data> to a positive
|
||||
-- Case Number, or 0 if failed.
|
||||
-- Works with IGESReaderData which provides Type & Form Numbers,
|
||||
-- and calls CaseIGES (see below)
|
||||
|
||||
CaseIGES (me; typenum, formnum : Integer) returns Integer is deferred;
|
||||
---Purpose : Defines Case Numbers corresponding to the Entity Types taken
|
||||
-- into account by a sub-class of ReadWriteModule (hence, each
|
||||
-- sub-class of ReadWriteModule has to redefine this method)
|
||||
-- Called by CaseNum. Its result will then be used to call
|
||||
-- Read, etc ...
|
||||
|
||||
Read (me; CN : Integer; data : FileReaderData; num : Integer;
|
||||
ach : in out Check; ent : mutable Transient)
|
||||
raises DomainError;
|
||||
---Purpose : General Read Function. See IGESReaderTool for more info
|
||||
|
||||
ReadOwnParams (me; CN : Integer; ent : mutable IGESEntity;
|
||||
IR : IGESReaderData; PR : in out ParamReader)
|
||||
raises DomainError is deferred;
|
||||
---Purpose : Reads own parameters from file for an Entity; <PR> gives
|
||||
-- access to them, <IR> detains parameter types and values
|
||||
-- For each class, there must be a specific action provided
|
||||
-- Note that Properties and Associativities Lists are Read by
|
||||
-- specific methods (see below), they are called under control
|
||||
-- of reading process (only one call) according Stage recorded
|
||||
-- in ParamReader
|
||||
|
||||
|
||||
WriteOwnParams (me; CN : Integer; ent : IGESEntity;
|
||||
IW : in out IGESWriter)
|
||||
is deferred;
|
||||
---Purpose : Writes own parameters to IGESWriter; defined for each class
|
||||
-- (to be redefined for other IGES ReadWriteModules)
|
||||
-- Warning : Properties and Associativities are directly managed by
|
||||
-- WriteIGES, must not be sent by this method
|
||||
|
||||
end ReadWriteModule;
|
26
src/IGESData/IGESData_ReadWriteModule.cxx
Executable file
26
src/IGESData/IGESData_ReadWriteModule.cxx
Executable file
@@ -0,0 +1,26 @@
|
||||
#include <IGESData_ReadWriteModule.ixx>
|
||||
#include <IGESData_IGESType.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
|
||||
|
||||
Standard_Integer IGESData_ReadWriteModule::CaseNum
|
||||
(const Handle(Interface_FileReaderData)& data,
|
||||
const Standard_Integer num) const
|
||||
{
|
||||
IGESData_IGESType DT = GetCasted(IGESData_IGESReaderData,data)->DirType(num);
|
||||
return CaseIGES (DT.Type() , DT.Form());
|
||||
}
|
||||
|
||||
|
||||
void IGESData_ReadWriteModule::Read
|
||||
(const Standard_Integer ,
|
||||
const Handle(Interface_FileReaderData)& , const Standard_Integer ,
|
||||
Handle(Interface_Check)& , const Handle(Standard_Transient)& ) const
|
||||
{
|
||||
#ifdef DEB
|
||||
cout<<"IGESData_ReadWriteModule, Read called"<<endl;
|
||||
#endif
|
||||
}
|
||||
// IGESReaderTool fait tout
|
31
src/IGESData/IGESData_SingleParentEntity.cdl
Executable file
31
src/IGESData/IGESData_SingleParentEntity.cdl
Executable file
@@ -0,0 +1,31 @@
|
||||
-- File: SingleParentEntity.cdl
|
||||
-- Created: Wed Oct 21 18:19:01 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@topsn2>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
deferred class SingleParentEntity from IGESData inherits IGESEntity
|
||||
|
||||
---Purpose : a SingleParentEntity is a kind of IGESEntity which can refer
|
||||
-- to a (Single) Parent, from Associativities list of an Entity
|
||||
-- a effective SingleParent definition entity must inherit it
|
||||
|
||||
uses Integer
|
||||
|
||||
raises OutOfRange
|
||||
|
||||
is
|
||||
|
||||
SingleParent (me) returns IGESEntity is deferred;
|
||||
---Purpose : Returns the parent designated by the Entity, if only one !
|
||||
|
||||
NbChildren (me) returns Integer is deferred;
|
||||
---Purpose : Returns the count of Entities designated as children
|
||||
|
||||
Child (me; num : Integer) returns IGESEntity
|
||||
---Purpose : Returns a Child given its rank
|
||||
raises OutOfRange is deferred;
|
||||
-- Error if <num> is below one or over <NbChildren>
|
||||
|
||||
end SingleParentEntity;
|
3
src/IGESData/IGESData_SingleParentEntity.cxx
Executable file
3
src/IGESData/IGESData_SingleParentEntity.cxx
Executable file
@@ -0,0 +1,3 @@
|
||||
#include <IGESData_SingleParentEntity.ixx>
|
||||
// SingleParentEntity sert a decrire des entites "associativite parent"
|
||||
// (methode Parent a definir)
|
47
src/IGESData/IGESData_SpecificModule.cdl
Executable file
47
src/IGESData/IGESData_SpecificModule.cdl
Executable file
@@ -0,0 +1,47 @@
|
||||
-- File: IGESData_SpecificModule.cdl
|
||||
-- Created: Tue Sep 7 11:14:37 1993
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
deferred class SpecificModule from IGESData inherits Transient
|
||||
|
||||
---Purpose : This class defines some Services which are specifically
|
||||
-- attached to IGES Entities : Dump
|
||||
|
||||
uses IGESEntity, IGESDumper,
|
||||
Messenger from Message
|
||||
|
||||
is
|
||||
|
||||
OwnDump (me; CN : Integer; ent : IGESEntity;
|
||||
dumper : IGESDumper; S : Messenger from Message; own : Integer)
|
||||
is deferred;
|
||||
---Purpose : Specific Dump for each type of IGES Entity : it concerns only
|
||||
-- own parameters, the general data (Directory Part, Lists) are
|
||||
-- taken into account by the IGESDumper
|
||||
-- See class IGESDumper for the rules to follow for <own> and
|
||||
-- <attached> level
|
||||
|
||||
OwnCorrect (me; CN : Integer; ent : mutable IGESEntity)
|
||||
returns Boolean is virtual;
|
||||
---Purpose : Specific Automatic Correction on own Parameters of an Entity.
|
||||
-- It works by setting in accordance redundant data, if there are
|
||||
-- when there is no ambiguity (else, it does nothing).
|
||||
-- Remark that classic Corrections on Directory Entry (to set
|
||||
-- void data) are taken into account alsewhere.
|
||||
--
|
||||
-- For instance, many "Associativity Entities" have a Number of
|
||||
-- Properties which must have a fixed value.
|
||||
-- Or, a ConicalArc has its Form Number which records the kind of
|
||||
-- Conic, also determined from its coefficients
|
||||
-- But, a CircularArc of which Distances (Center-Start) and
|
||||
-- (Center-End) are not equal cannot be corrected ...
|
||||
--
|
||||
-- Returns True if something has been corrected in <ent>
|
||||
-- By default, does nothing. If at least one of the Types
|
||||
-- processed by a sub-class of SpecificModule has a Correct
|
||||
-- procedure attached, this method can be redefined
|
||||
|
||||
end SpecificModule;
|
6
src/IGESData/IGESData_SpecificModule.cxx
Executable file
6
src/IGESData/IGESData_SpecificModule.cxx
Executable file
@@ -0,0 +1,6 @@
|
||||
#include <IGESData_SpecificModule.ixx>
|
||||
|
||||
|
||||
Standard_Boolean IGESData_SpecificModule::OwnCorrect
|
||||
(const Standard_Integer , const Handle(IGESData_IGESEntity)& ) const
|
||||
{ return Standard_False; } // par defaut, ne fait rien
|
156
src/IGESData/IGESData_ToolLocation.cdl
Executable file
156
src/IGESData/IGESData_ToolLocation.cdl
Executable file
@@ -0,0 +1,156 @@
|
||||
-- File: IGESData_ToolLocation.cdl
|
||||
-- Created: Tue Sep 21 17:08:46 1993
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@sdsun2>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class ToolLocation from IGESData inherits TShared
|
||||
|
||||
---Purpose : This Tool determines and gives access to effective Locations
|
||||
-- of IGES Entities as defined by the IGES Norm. These Locations
|
||||
-- can be for each Entity :
|
||||
-- - on one part, explicitly defined by a Transf in Directory
|
||||
-- Part (this Transf can be itself compound); if not defined,
|
||||
-- no proper Transformation is defined
|
||||
-- - on the other part, implicitly defined by a reference from
|
||||
-- another Entity : its Parent
|
||||
-- Both implicit and explicit locations are combinable.
|
||||
--
|
||||
-- Implicit definition can be itself defined, either through the
|
||||
-- definition of an Entity (i.e. a Composite Curve references
|
||||
-- a list of Curves), or by a specific Associativity, of type
|
||||
-- SingleParentEntity, by which the Location of the Parent is
|
||||
-- applied to the Childs defined by this Associativity.
|
||||
-- Remark that a Transf itself has no Location, but it can be
|
||||
-- compound
|
||||
--
|
||||
-- This is a TShared object, then it is easier to use in an
|
||||
-- interactive session
|
||||
|
||||
|
||||
uses GTrsf from gp, Trsf from gp, Array1OfInteger from TColStd,
|
||||
GeneralLib, IGESEntity, IGESModel, Protocol from IGESData
|
||||
|
||||
raises DomainError
|
||||
|
||||
is
|
||||
|
||||
Create (amodel : IGESModel; protocol : Protocol from IGESData)
|
||||
returns mutable ToolLocation;
|
||||
---Purpose : Creates a ToolLocation on a given Model, filled with the help
|
||||
-- of a Protocol (which allows to known Entities referenced by
|
||||
-- other ones)
|
||||
|
||||
Load (me : mutable);
|
||||
---Purpose : Does the effective work of determining Locations of Entities
|
||||
|
||||
SetPrecision (me : mutable; prec : Real) is static;
|
||||
---Purpose : Sets a precision for the Analysis of Locations
|
||||
-- (default by constructor is 1.E-05)
|
||||
|
||||
-- -- Internal Actions to Compute and Edit the Result -- --
|
||||
|
||||
SetReference (me : mutable; parent, child : IGESEntity) is static;
|
||||
---Purpose : Sets the "Reference" information for <child> as being <parent>
|
||||
-- Sets an Error Status if already set (see method IsAmbiguous)
|
||||
|
||||
SetParentAssoc (me : mutable; parent, child : IGESEntity) is static;
|
||||
---Purpose : Sets the "Associativity" information for <child> as being
|
||||
-- <parent> (it must be the Parent itself, not the Associativity)
|
||||
|
||||
ResetDependences (me : mutable; child : IGESEntity) is static;
|
||||
---Purpose : Resets all informations about dependences for <child>
|
||||
|
||||
SetOwnAsDependent (me : mutable; ent : IGESEntity);
|
||||
---Purpose : Unitary action which defines Entities referenced by <ent>
|
||||
-- (except those in Directory Part and Associativities List)
|
||||
-- as Dependent (their Locations are related to that of <ent>)
|
||||
|
||||
-- -- Queries -- --
|
||||
|
||||
IsTransf (me; ent : IGESEntity) returns Boolean is static;
|
||||
---Purpose : Returns True if <ent> is kind of TransfEntity. Then, it has
|
||||
-- no location, while it can be used to define a Location)
|
||||
|
||||
IsAssociativity (me; ent : IGESEntity) returns Boolean is static;
|
||||
---Purpose : Returns True if <ent> is an Associativity (IGES Type 402).
|
||||
-- Then, Location does not apply.
|
||||
|
||||
HasTransf (me; ent : IGESEntity) returns Boolean is static;
|
||||
---Purpose : Returns True if <ent> has a Transformation Matrix in proper
|
||||
-- (referenced from its Directory Part)
|
||||
|
||||
ExplicitLocation (me; ent : IGESEntity) returns GTrsf from gp is static;
|
||||
---Purpose : Returns the Explicit Location defined by the Transformation
|
||||
-- Matrix of <ent>. Identity if there is none
|
||||
|
||||
|
||||
IsAmbiguous (me; ent : IGESEntity) returns Boolean is static;
|
||||
---Purpose : Returns True if more than one Parent has been determined for
|
||||
-- <ent>, by adding direct References and Associativities
|
||||
|
||||
HasParent (me; ent : IGESEntity) returns Boolean
|
||||
---Purpose : Returns True if <ent> is dependent from one and only one other
|
||||
-- Entity, either by Reference or by Associativity
|
||||
raises DomainError is static;
|
||||
-- Error if more than one Parent has been noted
|
||||
|
||||
Parent (me; ent : IGESEntity) returns IGESEntity
|
||||
---Purpose : Returns the unique Parent recorded for <ent>.
|
||||
-- Returns a Null Handle if there is none
|
||||
raises DomainError is static;
|
||||
-- Error if more than one Parent has been noted
|
||||
|
||||
HasParentByAssociativity (me; ent : IGESEntity) returns Boolean
|
||||
---Purpose : Returns True if the Parent, if there is one, is defined by
|
||||
-- a SingleParentEntity Associativity
|
||||
-- Else, if HasParent is True, it is by Reference
|
||||
raises DomainError is static;
|
||||
-- Error if more than one Parent has been noted
|
||||
|
||||
ParentLocation (me; ent : IGESEntity) returns GTrsf from gp
|
||||
---Purpose : Returns the effective Location of the Parent of <ent>, if
|
||||
-- there is one : this Location is itself given as compound
|
||||
-- according dependences on the Parent, if there are some.
|
||||
-- Returns an Identity Transformation if no Parent is recorded.
|
||||
raises DomainError is static;
|
||||
-- Error if more than one Parent has been noted
|
||||
|
||||
EffectiveLocation (me; ent : IGESEntity) returns GTrsf from gp
|
||||
---Purpose : Returns the effective Location of an Entity, i.e. the
|
||||
-- composition of its proper Transformation Matrix (returned by
|
||||
-- Transf) and its Parent's Location (returned by ParentLocation)
|
||||
raises DomainError is static;
|
||||
-- Error if more than one Parent has been noted
|
||||
|
||||
AnalyseLocation (me; loc : GTrsf from gp; result : out Trsf from gp)
|
||||
returns Boolean is static;
|
||||
---Purpose : Analysis a Location given as a GTrsf, by trying to convert it
|
||||
-- to a Trsf (i.e. to a True Location of which effect is
|
||||
-- described by an Isometry or a Similarity)
|
||||
-- Works with the Precision given by default or by SetPrecision
|
||||
-- Calls ConvertLocation (see below)
|
||||
|
||||
ConvertLocation (myclass; prec : Real;
|
||||
loc : GTrsf from gp; result : out Trsf from gp; uni : Real = 1)
|
||||
returns Boolean;
|
||||
---Purpose : Convertion of a Location, from GTrsf form to Trsf form
|
||||
-- Works with a precision given as argument.
|
||||
-- Returns True if the Conversion is possible, (hence, <result>
|
||||
-- contains the converted location), False else
|
||||
-- <unit>, if given, indicates the unit in which <loc> is defined
|
||||
-- in meters. It concerns the translation part (to be converted.
|
||||
--
|
||||
-- As a class method, it can be called separately
|
||||
|
||||
|
||||
fields
|
||||
|
||||
theprec : Real;
|
||||
themodel : IGESModel;
|
||||
thelib : GeneralLib;
|
||||
therefs : Array1OfInteger from TColStd;
|
||||
theassocs : Array1OfInteger from TColStd;
|
||||
|
||||
end ToolLocation;
|
239
src/IGESData/IGESData_ToolLocation.cxx
Executable file
239
src/IGESData/IGESData_ToolLocation.cxx
Executable file
@@ -0,0 +1,239 @@
|
||||
//szv#9:PRO19565:04Oct99 loss of rotation matrix corrected
|
||||
#include <IGESData_ToolLocation.ixx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <IGESData_TransfEntity.hxx>
|
||||
#include <IGESData_SingleParentEntity.hxx>
|
||||
#include <IGESData_GeneralModule.hxx>
|
||||
#include <gp_XYZ.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
|
||||
#define TYPEFORASSOC 402
|
||||
|
||||
IGESData_ToolLocation::IGESData_ToolLocation (const Handle(IGESData_IGESModel)& amodel,
|
||||
const Handle(IGESData_Protocol)& protocol)
|
||||
: thelib (protocol),
|
||||
therefs (0,amodel->NbEntities()),
|
||||
theassocs (0,amodel->NbEntities())
|
||||
{
|
||||
theprec = 1.e-05;
|
||||
themodel = amodel;
|
||||
therefs.Init(0); theassocs.Init(0);
|
||||
Load();
|
||||
}
|
||||
|
||||
void IGESData_ToolLocation::Load ()
|
||||
{
|
||||
// Pour chaque Entite, sauf Transf et Assoc (sauf SingleParent), on considere
|
||||
// ses "OwnShared" comme etant dependents
|
||||
Standard_Integer nb = themodel->NbEntities();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
Handle(IGESData_IGESEntity) ent = themodel->Entity(i);
|
||||
if (ent->IsKind(STANDARD_TYPE(IGESData_TransfEntity))) continue;
|
||||
// Cas de SingleParentEntity
|
||||
if (ent->IsKind(STANDARD_TYPE(IGESData_SingleParentEntity))) {
|
||||
DeclareAndCast(IGESData_SingleParentEntity,assoc,ent);
|
||||
Standard_Integer nbc = assoc->NbChildren();
|
||||
Handle(IGESData_IGESEntity) parent = assoc->SingleParent();
|
||||
for (Standard_Integer j = 1; j <= nbc; j ++)
|
||||
SetParentAssoc(parent,assoc->Child(j));
|
||||
continue;
|
||||
}
|
||||
if (ent->TypeNumber() == TYPEFORASSOC) continue; // Assoc sauf SingleParent
|
||||
// Cas courant
|
||||
SetOwnAsDependent (ent); // qui opere
|
||||
}
|
||||
}
|
||||
|
||||
void IGESData_ToolLocation::SetPrecision (const Standard_Real prec)
|
||||
{ theprec = prec; }
|
||||
|
||||
void IGESData_ToolLocation::SetReference (const Handle(IGESData_IGESEntity)& parent,
|
||||
const Handle(IGESData_IGESEntity)& child)
|
||||
{
|
||||
Standard_Integer np = themodel->Number(parent);
|
||||
Standard_Integer nc = themodel->Number(child);
|
||||
if (np == 0 || nc == 0) return;
|
||||
if (therefs(nc) > 0) np = -1; // note ambigu
|
||||
therefs.SetValue(nc,np);
|
||||
}
|
||||
|
||||
void IGESData_ToolLocation::SetParentAssoc (const Handle(IGESData_IGESEntity)& parent,
|
||||
const Handle(IGESData_IGESEntity)& child)
|
||||
{
|
||||
Standard_Integer np = themodel->Number(parent);
|
||||
Standard_Integer nc = themodel->Number(child);
|
||||
if (np == 0 || nc == 0) return;
|
||||
if (theassocs(nc) > 0) np = -1; // note ambigu
|
||||
theassocs.SetValue(nc,np);
|
||||
}
|
||||
|
||||
void IGESData_ToolLocation::ResetDependences (const Handle(IGESData_IGESEntity)& child)
|
||||
{
|
||||
Standard_Integer nc = themodel->Number(child);
|
||||
if (nc == 0) return;
|
||||
therefs.SetValue(nc,0);
|
||||
theassocs.SetValue(nc,0);
|
||||
}
|
||||
|
||||
void IGESData_ToolLocation::SetOwnAsDependent (const Handle(IGESData_IGESEntity)& ent)
|
||||
{
|
||||
Handle(IGESData_GeneralModule) module;
|
||||
Standard_Integer CN;
|
||||
if (!thelib.Select(ent,module,CN)) return;
|
||||
Interface_EntityIterator list;
|
||||
module->OwnSharedCase(CN,ent,list);
|
||||
// Remarque : en toute rigueur, il faudrait ignorer les entites referencees
|
||||
// dont le SubordinateStatus vaut 0 ou 2 ...
|
||||
// Question : ce Status est-il toujours bien comme il faut ?
|
||||
for (list.Start(); list.More(); list.Next())
|
||||
SetReference (ent, GetCasted(IGESData_IGESEntity,list.Value()) );
|
||||
}
|
||||
|
||||
// #########################################################################
|
||||
// ######## RESULTATS ########
|
||||
|
||||
Standard_Boolean IGESData_ToolLocation::IsTransf
|
||||
(const Handle(IGESData_IGESEntity)& ent) const
|
||||
{ return ent->IsKind(STANDARD_TYPE(IGESData_TransfEntity)); }
|
||||
|
||||
Standard_Boolean IGESData_ToolLocation::IsAssociativity
|
||||
(const Handle(IGESData_IGESEntity)& ent) const
|
||||
{ return (ent->TypeNumber() == TYPEFORASSOC); }
|
||||
|
||||
Standard_Boolean IGESData_ToolLocation::HasTransf
|
||||
(const Handle(IGESData_IGESEntity)& ent) const
|
||||
{ return ent->HasTransf(); }
|
||||
|
||||
gp_GTrsf IGESData_ToolLocation::ExplicitLocation
|
||||
(const Handle(IGESData_IGESEntity)& ent) const
|
||||
{ return ent->Location(); }
|
||||
|
||||
|
||||
Standard_Boolean IGESData_ToolLocation::IsAmbiguous
|
||||
(const Handle(IGESData_IGESEntity)& ent) const
|
||||
{
|
||||
Standard_Integer num = themodel->Number(ent);
|
||||
if (num == 0) return Standard_False;
|
||||
if (therefs(num) < 0 || theassocs(num) < 0) return Standard_True;
|
||||
if (therefs(num) != 0 && theassocs(num) != 0) return Standard_True;
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Standard_Boolean IGESData_ToolLocation::HasParent
|
||||
(const Handle(IGESData_IGESEntity)& ent) const
|
||||
{
|
||||
Standard_Integer num = themodel->Number(ent);
|
||||
if (num == 0) return Standard_False;
|
||||
if (therefs(num) < 0 || theassocs(num) < 0) Standard_DomainError::Raise
|
||||
("IGESData_ToolLocation : HasParent");
|
||||
if (therefs(num) != 0 && theassocs(num) != 0) Standard_DomainError::Raise
|
||||
("IGESData_ToolLocation : HasParent");
|
||||
if (therefs(num) != 0 || theassocs(num) != 0) return Standard_True;
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Handle(IGESData_IGESEntity) IGESData_ToolLocation::Parent
|
||||
(const Handle(IGESData_IGESEntity)& ent) const
|
||||
{
|
||||
Handle(IGESData_IGESEntity) parent;
|
||||
Standard_Integer num = themodel->Number(ent);
|
||||
if (num == 0) return parent;
|
||||
if (therefs(num) < 0 || theassocs(num) < 0) Standard_DomainError::Raise
|
||||
("IGESData_ToolLocation : Parent");
|
||||
if (therefs(num) != 0 && theassocs(num) != 0) Standard_DomainError::Raise
|
||||
("IGESData_ToolLocation : Parent");
|
||||
if (therefs(num) != 0) parent = themodel->Entity (therefs (num));
|
||||
if (theassocs(num) != 0) parent = themodel->Entity (theassocs (num));
|
||||
return parent;
|
||||
}
|
||||
|
||||
Standard_Boolean IGESData_ToolLocation::HasParentByAssociativity
|
||||
(const Handle(IGESData_IGESEntity)& ent) const
|
||||
{
|
||||
Standard_Integer num = themodel->Number(ent);
|
||||
if (num == 0) return Standard_False;
|
||||
if (therefs(num) < 0 || theassocs(num) < 0) Standard_DomainError::Raise
|
||||
("IGESData_ToolLocation : HasParentByAssociativity");
|
||||
if (therefs(num) != 0 && theassocs(num) != 0) Standard_DomainError::Raise
|
||||
("IGESData_ToolLocation : HasParentByAssociativity");
|
||||
if (theassocs(num) != 0) return Standard_True;
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
gp_GTrsf IGESData_ToolLocation::ParentLocation
|
||||
(const Handle(IGESData_IGESEntity)& ent) const
|
||||
{
|
||||
gp_GTrsf locat; // par defaut, identite
|
||||
Handle(IGESData_IGESEntity) parent = Parent(ent);
|
||||
// Definition recursive
|
||||
if (!parent.IsNull()) locat = EffectiveLocation(parent);
|
||||
return locat;
|
||||
}
|
||||
|
||||
gp_GTrsf IGESData_ToolLocation::EffectiveLocation
|
||||
(const Handle(IGESData_IGESEntity)& ent) const
|
||||
{
|
||||
gp_GTrsf locat = ent->Location();
|
||||
// Combiner Transf et ParentLocation
|
||||
locat.PreMultiply (ParentLocation(ent)); // ne pas se tromper de sens !
|
||||
return locat;
|
||||
}
|
||||
|
||||
Standard_Boolean IGESData_ToolLocation::AnalyseLocation (const gp_GTrsf& loc,
|
||||
gp_Trsf& result) const
|
||||
{ return ConvertLocation (theprec,loc,result); }
|
||||
|
||||
Standard_Boolean IGESData_ToolLocation::ConvertLocation (const Standard_Real prec,
|
||||
const gp_GTrsf& loc,
|
||||
gp_Trsf& result,
|
||||
const Standard_Real unit)
|
||||
{
|
||||
if (result.Form() != gp_Identity) result = gp_Trsf(); // Identite forcee au depart
|
||||
// On prend le contenu de <loc>. Attention a l adressage
|
||||
gp_XYZ v1 ( loc.Value(1,1), loc.Value(1,2), loc.Value(1,3) );
|
||||
gp_XYZ v2 ( loc.Value(2,1), loc.Value(2,2), loc.Value(2,3) );
|
||||
gp_XYZ v3 ( loc.Value(3,1), loc.Value(3,2), loc.Value(3,3) );
|
||||
// A-t-on affaire a une similitude ?
|
||||
Standard_Real m1 = v1.Modulus();
|
||||
Standard_Real m2 = v2.Modulus();
|
||||
Standard_Real m3 = v3.Modulus();
|
||||
// D abord est-elle singuliere cette matrice ?
|
||||
if (m1 < prec || m2 < prec || m3 < prec) return Standard_False;
|
||||
Standard_Real mm = (m1+m2+m3)/3.; // voici la Norme moyenne, cf Scale
|
||||
if ( Abs(m1 - mm) > prec*mm ||
|
||||
Abs(m2 - mm) > prec*mm ||
|
||||
Abs(m3 - mm) > prec*mm ) return Standard_False;
|
||||
v1.Divide(m1);
|
||||
v2.Divide(m2);
|
||||
v3.Divide(m3);
|
||||
if ( Abs(v1.Dot(v2)) > prec ||
|
||||
Abs(v2.Dot(v3)) > prec ||
|
||||
Abs(v3.Dot(v1)) > prec ) return Standard_False;
|
||||
// Ici, Orthogonale et memes normes. En plus on l a Normee
|
||||
// Restent les autres caracteristiques :
|
||||
if (Abs(mm - 1.) > prec) result.SetScale(gp_Pnt(0,0,0),mm);
|
||||
gp_XYZ tp = loc.TranslationPart();
|
||||
if (unit != 1.) tp.Multiply(unit);
|
||||
if (tp.X() != 0. || tp.Y() != 0. || tp.Z() != 0.) result.SetTranslationPart(tp);
|
||||
// On isole le cas de l Identite (tellement facile et avantageux)
|
||||
if (v1.X() != 1. || v1.Y() != 0. || v1.Z() != 0. ||
|
||||
v2.X() != 0. || v2.Y() != 1. || v2.Z() != 0. ||
|
||||
v3.X() != 0. || v3.Y() != 0. || v3.Z() != 1. ) {
|
||||
// Pas Identite : vraie construction depuis un Ax3
|
||||
gp_Dir d1(v1);
|
||||
gp_Dir d2(v2);
|
||||
gp_Dir d3(v3);
|
||||
gp_Ax3 axes (gp_Pnt(0,0,0),d3,d1);
|
||||
d3.Cross(d1);
|
||||
if (d3.Dot(d2) < 0) axes.YReverse();
|
||||
gp_Trsf transf;
|
||||
transf.SetTransformation(axes);
|
||||
result *= transf; //szv#9:PRO19565:04Oct99
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
24
src/IGESData/IGESData_TransfEntity.cdl
Executable file
24
src/IGESData/IGESData_TransfEntity.cdl
Executable file
@@ -0,0 +1,24 @@
|
||||
-- File: TransfEntity.cdl
|
||||
-- Created: Tue Apr 7 16:00:42 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
deferred class TransfEntity from IGESData inherits IGESEntity
|
||||
|
||||
---Purpose : defines required type for Transf in directory part
|
||||
-- an effective Transf entity must inherits it
|
||||
|
||||
uses GTrsf
|
||||
|
||||
is
|
||||
|
||||
Value (me) returns GTrsf is deferred;
|
||||
---Purpose : gives value of the transformation, as a GTrsf
|
||||
-- To be defined by an effective class of Transformation Entity
|
||||
-- Warning : Must take in account Composition : if a TransfEntity has in
|
||||
-- its Directory Part, a Transf, this means that it is Compound,
|
||||
-- Value must return the global result
|
||||
|
||||
end TransfEntity;
|
3
src/IGESData/IGESData_TransfEntity.cxx
Executable file
3
src/IGESData/IGESData_TransfEntity.cxx
Executable file
@@ -0,0 +1,3 @@
|
||||
#include <IGESData_TransfEntity.ixx>
|
||||
// TransfEntity ne sert que pour controle de Type, et fourniture par Value
|
||||
// de la GTrsf correspondante
|
87
src/IGESData/IGESData_UndefinedEntity.cdl
Executable file
87
src/IGESData/IGESData_UndefinedEntity.cdl
Executable file
@@ -0,0 +1,87 @@
|
||||
-- File: UndefinedEntity.cdl
|
||||
-- Created: Tue Apr 7 15:04:59 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class UndefinedEntity from IGESData inherits IGESEntity
|
||||
|
||||
---Purpose : undefined (unknown or error) entity specific of IGES
|
||||
-- DirPart can be correct or not : if it is not, a flag indicates
|
||||
-- it, and each corrupted field has an associated error flag
|
||||
|
||||
uses OStream, Check, UndefinedContent, CopyTool,
|
||||
DefType, DefList, IGESReaderData, DirPart, ParamReader, IGESWriter
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable UndefinedEntity;
|
||||
---Purpose : creates an unknown entity
|
||||
|
||||
UndefinedContent (me) returns mutable UndefinedContent;
|
||||
---Purpose : Returns own data as an UndefinedContent
|
||||
|
||||
ChangeableContent (me : mutable) returns mutable UndefinedContent;
|
||||
---Purpose : Returns own data as an UndefinedContent, in order to touch it
|
||||
|
||||
SetNewContent (me : mutable; cont : mutable UndefinedContent);
|
||||
---Purpose : Redefines a completely new UndefinedContent
|
||||
-- Used by a Copy which begins by ShallowCopy, for instance
|
||||
|
||||
IsOKDirPart (me) returns Boolean;
|
||||
---Purpose : says if DirPart is OK or not (if not, it is erroneous)
|
||||
-- Note that if it is not, Def* methods can return Error status
|
||||
|
||||
DirStatus (me) returns Integer;
|
||||
---Purpose : returns Directory Error Status (used for Copy)
|
||||
|
||||
SetOKDirPart (me : mutable);
|
||||
---Purpose : Erases the Directory Error Status
|
||||
-- Warning : Be sure that data are consistent to call this method ...
|
||||
|
||||
|
||||
DefLineFont (me) returns DefType is redefined;
|
||||
---Purpose : returns Error status if necessary, else calls original method
|
||||
|
||||
DefLevel (me) returns DefList is redefined;
|
||||
---Purpose : returns Error status if necessary, else calls original method
|
||||
|
||||
DefView (me) returns DefList is redefined;
|
||||
---Purpose : returns Error status if necessary, else calls original method
|
||||
|
||||
DefColor (me) returns DefType is redefined;
|
||||
---Purpose : returns Error status if necessary, else calls original method
|
||||
|
||||
HasSubScriptNumber (me) returns Boolean is redefined;
|
||||
---Purpose : returns Error status if necessary, else calls original method
|
||||
-- (that is, if SubScript field is not blank or positive integer)
|
||||
|
||||
|
||||
ReadDir (me : mutable; IR : IGESReaderData; DP : in out DirPart;
|
||||
ach : in out Check)
|
||||
returns Boolean is virtual;
|
||||
---Purpose : Computes the Directory Error Status, to be called before
|
||||
-- standard ReadDir from IGESReaderTool
|
||||
-- Returns True if OK (hence, Directory can be loaded),
|
||||
-- Else returns False and the DirPart <DP> is modified
|
||||
-- (hence, Directory Error Status is non null; and standard Read
|
||||
-- will work with an acceptable DirectoryPart)
|
||||
|
||||
ReadOwnParams (me : mutable; IR : IGESReaderData; PR : in out ParamReader)
|
||||
is virtual;
|
||||
---Purpose : reads own parameters from file; PR gives access to them, IR
|
||||
-- detains parameter types and values
|
||||
-- Here, reads all parameters, integers are considered as entity
|
||||
-- reference unless they cannot be; no list interpretation
|
||||
-- No property or associativity list is managed
|
||||
|
||||
WriteOwnParams (me; IW : in out IGESWriter) is virtual;
|
||||
---Purpose : writes parameters to IGESWriter, taken from UndefinedContent
|
||||
|
||||
fields
|
||||
|
||||
thedstat : Integer; -- DirPart error bitwise flags (none set -> OK)
|
||||
thecont : UndefinedContent;
|
||||
|
||||
end UndefinedEntity;
|
358
src/IGESData/IGESData_UndefinedEntity.cxx
Executable file
358
src/IGESData/IGESData_UndefinedEntity.cxx
Executable file
@@ -0,0 +1,358 @@
|
||||
#include <IGESData_UndefinedEntity.ixx>
|
||||
#include <IGESData_LineFontEntity.hxx>
|
||||
#include <IGESData_LevelListEntity.hxx>
|
||||
#include <IGESData_ViewKindEntity.hxx>
|
||||
#include <IGESData_TransfEntity.hxx>
|
||||
#include <IGESData_LabelDisplayEntity.hxx>
|
||||
#include <IGESData_ColorEntity.hxx>
|
||||
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
// MGE 23/07/98
|
||||
#include <Message_Msg.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IGESData_UndefinedEntity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
IGESData_UndefinedEntity::IGESData_UndefinedEntity ()
|
||||
{
|
||||
thecont = new Interface_UndefinedContent;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : UndefinedContent
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Interface_UndefinedContent) IGESData_UndefinedEntity::UndefinedContent () const
|
||||
{
|
||||
return thecont;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeableContent
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Interface_UndefinedContent) IGESData_UndefinedEntity::ChangeableContent ()
|
||||
{
|
||||
return thecont;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetNewContent
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_UndefinedEntity::SetNewContent
|
||||
(const Handle(Interface_UndefinedContent)& cont)
|
||||
{
|
||||
thecont = cont;
|
||||
}
|
||||
|
||||
|
||||
// .... (Re)definitions specifiques a UndefinedEntity ....
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsOKDirPart
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean IGESData_UndefinedEntity::IsOKDirPart () const
|
||||
{
|
||||
return (thedstat == 0);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : DirStatus
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer IGESData_UndefinedEntity::DirStatus () const
|
||||
{
|
||||
return thedstat;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetOKDirPart
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_UndefinedEntity::SetOKDirPart ()
|
||||
{
|
||||
thedstat = 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : DefLineFont
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
IGESData_DefType IGESData_UndefinedEntity::DefLineFont () const
|
||||
{
|
||||
Standard_Integer st = ((thedstat/4) & 3);
|
||||
if (st == 0) return IGESData_IGESEntity::DefLineFont();
|
||||
else if (st == 1) return IGESData_ErrorVal;
|
||||
else return IGESData_ErrorRef;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : DefLevel
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
IGESData_DefList IGESData_UndefinedEntity::DefLevel () const
|
||||
{
|
||||
Standard_Integer st = ((thedstat/16) & 3);
|
||||
if (st == 0) return IGESData_IGESEntity::DefLevel();
|
||||
else if (st == 1) return IGESData_ErrorOne;
|
||||
else return IGESData_ErrorSeveral;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : DefView
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
IGESData_DefList IGESData_UndefinedEntity::DefView () const
|
||||
{
|
||||
Standard_Integer st = ((thedstat/64) & 3);
|
||||
if (st == 0) return IGESData_IGESEntity::DefView();
|
||||
else if (st == 1) return IGESData_ErrorOne;
|
||||
else return IGESData_ErrorSeveral;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : DefColor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
IGESData_DefType IGESData_UndefinedEntity::DefColor () const
|
||||
{
|
||||
Standard_Integer st = ((thedstat/256) & 3);
|
||||
if (st == 0) return IGESData_IGESEntity::DefColor();
|
||||
else if (st == 1) return IGESData_ErrorVal;
|
||||
else return IGESData_ErrorRef;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : HasSubScriptNumber
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean IGESData_UndefinedEntity::HasSubScriptNumber () const
|
||||
{
|
||||
Standard_Integer st = ((thedstat/1024) & 1);
|
||||
if (st == 0) return IGESData_IGESEntity::HasSubScriptNumber();
|
||||
else return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
// ReadDir verifie les donnees, s il y a des erreurs les note (status),
|
||||
// genere un nouveau DirPart sans ces erreurs, et appelle ReadDir de base
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadDir
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean IGESData_UndefinedEntity::ReadDir
|
||||
(const Handle(IGESData_IGESReaderData)& IR, IGESData_DirPart& DP,
|
||||
Handle(Interface_Check)& ach)
|
||||
{
|
||||
// MGE 23/07/98
|
||||
// =====================================
|
||||
//Message_Msg Msg60 ("XSTEP_60");
|
||||
//Message_Msg Msg61 ("XSTEP_61");
|
||||
//Message_Msg Msg62 ("XSTEP_62");
|
||||
//Message_Msg Msg63 ("XSTEP_63");
|
||||
//Message_Msg Msg64 ("XSTEP_64");
|
||||
//Message_Msg Msg70 ("XSTEP_70");
|
||||
//Message_Msg Msg72 ("XSTEP_72");
|
||||
// =====================================
|
||||
|
||||
Standard_Integer v[17]; Standard_Character res1[9],res2[9],lab[9],subs[9];
|
||||
Standard_Integer max = 2 * IR->NbRecords(); // valeur maxi pour DSectNum
|
||||
thedstat = 0;
|
||||
|
||||
Handle(IGESData_IGESEntity) anent; Standard_Boolean iapb;
|
||||
DP.Values(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8],v[9],v[10],
|
||||
v[11],v[12],v[13],v[14],v[15],v[16],res1,res2,lab,subs);
|
||||
|
||||
iapb = Standard_False;
|
||||
if (v[3] < -max) iapb = Standard_True;
|
||||
else if (v[3] < 0) {
|
||||
anent = GetCasted(IGESData_IGESEntity,IR->BoundEntity((-1-v[3])/2));
|
||||
if (!anent->IsKind(STANDARD_TYPE(IGESData_LineFontEntity))) iapb = Standard_True;
|
||||
}
|
||||
// Sending of message : Line Font Pattern field is incorrect.
|
||||
if (iapb) {
|
||||
Message_Msg Msg60 ("XSTEP_60");
|
||||
ach->SendFail(Msg60);
|
||||
thedstat += 8;
|
||||
v[3] = 0;
|
||||
}
|
||||
|
||||
iapb = Standard_False;
|
||||
if (v[4] < -max) iapb = Standard_True;
|
||||
else if (v[4] < 0) {
|
||||
anent = GetCasted(IGESData_IGESEntity,IR->BoundEntity((-1-v[4])/2));
|
||||
if (!anent->IsKind(STANDARD_TYPE(IGESData_LevelListEntity))) iapb = Standard_True;
|
||||
}
|
||||
|
||||
// Sending of message : Level field is incorrect.
|
||||
if (iapb) {
|
||||
Message_Msg Msg61 ("XSTEP_61");
|
||||
ach->SendFail(Msg61);
|
||||
thedstat += 32;
|
||||
v[3] = 0;
|
||||
}
|
||||
|
||||
iapb = Standard_False;
|
||||
if (v[5] < 0 || v[5] > max) iapb = Standard_True;
|
||||
else if (v[5] > 0) {
|
||||
anent = GetCasted(IGESData_IGESEntity,IR->BoundEntity((1+v[5])/2));
|
||||
if (!anent->IsKind(STANDARD_TYPE(IGESData_ViewKindEntity))) iapb = Standard_True;
|
||||
}
|
||||
|
||||
// Sending of message : View field is incorrect.
|
||||
if (iapb) {
|
||||
Message_Msg Msg62 ("XSTEP_62");
|
||||
ach->SendFail(Msg62);
|
||||
thedstat += 128;
|
||||
v[5] = 0;
|
||||
}
|
||||
|
||||
iapb = Standard_False;
|
||||
if (v[6] < 0 || v[6] > max) iapb = Standard_True;
|
||||
else if (v[6] > 0) {
|
||||
anent = GetCasted(IGESData_IGESEntity,IR->BoundEntity((1+v[6])/2));
|
||||
if (!anent->IsKind(STANDARD_TYPE(IGESData_TransfEntity))) iapb = Standard_True;
|
||||
}
|
||||
|
||||
// Sending of message : Transformation Matrix field is incorrect
|
||||
if (iapb) {
|
||||
Message_Msg Msg63 ("XSTEP_63");
|
||||
ach->SendFail(Msg63);
|
||||
thedstat |= 1;
|
||||
v[6] = 0;
|
||||
}
|
||||
|
||||
iapb = Standard_False;
|
||||
if (v[7] < 0 || v[7] > max) iapb = Standard_True;
|
||||
else if (v[7] < 0) {
|
||||
anent = GetCasted(IGESData_IGESEntity,IR->BoundEntity((1+v[7])/2));
|
||||
if (!anent->IsKind(STANDARD_TYPE(IGESData_LabelDisplayEntity))) iapb = Standard_True;
|
||||
}
|
||||
|
||||
// Sending of message : Label Display Entity field is incorrect.
|
||||
if (iapb) {
|
||||
Message_Msg Msg64 ("XSTEP_64");
|
||||
ach->SendFail(Msg64);
|
||||
thedstat |= 1;
|
||||
v[7] = 0;
|
||||
}
|
||||
|
||||
iapb = Standard_False;
|
||||
if (v[14] < 0 || v[14] > max) iapb = Standard_True;
|
||||
else if (v[14] < 0) {
|
||||
anent = GetCasted(IGESData_IGESEntity,IR->BoundEntity((1+v[14])/2));
|
||||
if (!anent->IsKind(STANDARD_TYPE(IGESData_ColorEntity)))
|
||||
{ thedstat += 512; v[14] = 0; }
|
||||
}
|
||||
|
||||
// Sending of message : Color Number field is incorrect.
|
||||
if (iapb) {
|
||||
Message_Msg Msg70 ("XSTEP_70");
|
||||
ach->SendFail(Msg70);
|
||||
thedstat += 512;
|
||||
v[14] = 0;
|
||||
}
|
||||
|
||||
iapb = Standard_False;
|
||||
Standard_Integer i; // svv Jan11 2000 : porting on DEC
|
||||
for (i = 0; i < 8; i ++) {
|
||||
if (subs[i] == '\0') break; // fin de ligne
|
||||
if (subs[i] != ' ' && (subs[i] < 48 || subs[i] > 57)) iapb = Standard_True;
|
||||
}
|
||||
|
||||
// Sending of message : Entity Subscript Number field is incorrect.
|
||||
if (iapb) {
|
||||
Message_Msg Msg72 ("XSTEP_72");
|
||||
ach->SendFail(Msg72);
|
||||
thedstat += 1024;
|
||||
for (i = 0; i < 8; i ++) subs[i] = ' ';
|
||||
}
|
||||
|
||||
// ... Fin de cette analyse : si necessaire on reconstruit DP ...
|
||||
if (thedstat == 0) return Standard_True;
|
||||
else {
|
||||
DP.Init(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8],v[9],v[10],
|
||||
v[11],v[12],v[13],v[14],v[15],v[16],res1,res2,lab,subs);
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Parametres indifferencies : assocs et props ignores
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadOwnParams
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_UndefinedEntity::ReadOwnParams
|
||||
(const Handle(IGESData_IGESReaderData)& /*IR*/, IGESData_ParamReader& PR)
|
||||
{
|
||||
Standard_Integer nb = PR.NbParams();
|
||||
|
||||
thecont->Reservate(nb,nb);
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
Interface_ParamType ptyp = PR.ParamType(i);
|
||||
/* if (PR.IsParamEntity(i)) {
|
||||
thecont->AddEntity (ptyp,PR.ParamEntity(IR,i));
|
||||
}
|
||||
else thecont->AddLiteral (ptyp,new TCollection_HAsciiString(PR.ParamValue(i)));
|
||||
*/
|
||||
// On est TOUJOURS en mode litteral, c est bien plus clair !
|
||||
thecont->AddLiteral (ptyp,new TCollection_HAsciiString(PR.ParamValue(i)));
|
||||
}
|
||||
PR.SetCurrentNumber(nb+1);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteOwnParams
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IGESData_UndefinedEntity::WriteOwnParams(IGESData_IGESWriter& IW) const
|
||||
{
|
||||
Standard_Integer nb = thecont->NbParams();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
Interface_ParamType ptyp = thecont->ParamType(i);
|
||||
if (ptyp == Interface_ParamVoid) IW.SendVoid();
|
||||
else if (thecont->IsParamEntity(i)) {
|
||||
DeclareAndCast(IGESData_IGESEntity,anent,thecont->ParamEntity(i));
|
||||
IW.Send(anent);
|
||||
}
|
||||
else IW.SendString (thecont->ParamValue(i));
|
||||
}
|
||||
}
|
34
src/IGESData/IGESData_ViewKindEntity.cdl
Executable file
34
src/IGESData/IGESData_ViewKindEntity.cdl
Executable file
@@ -0,0 +1,34 @@
|
||||
-- File: ViewKindEntity.cdl
|
||||
-- Created: Tue Apr 7 16:06:14 1992
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
deferred class ViewKindEntity from IGESData inherits IGESEntity
|
||||
|
||||
---Purpose : defines required type for ViewKind in directory part
|
||||
-- that is, Single view or Multiple view
|
||||
-- An effective ViewKind entity must inherit it and define
|
||||
-- IsSingle (True for Single, False for List of Views),
|
||||
-- NbViews and ViewItem (especially for a List)
|
||||
|
||||
uses Boolean
|
||||
|
||||
raises OutOfRange
|
||||
|
||||
is
|
||||
|
||||
IsSingle (me) returns Boolean is deferred;
|
||||
---Purpose : says if "me" is a Single View (True) or a List of Views (False)
|
||||
|
||||
NbViews (me) returns Integer is deferred;
|
||||
---Purpose : Returns the count of Views for a List of Views. For a Single
|
||||
-- View, may return simply 1
|
||||
|
||||
ViewItem (me; num : Integer) returns ViewKindEntity
|
||||
raises OutOfRange is deferred;
|
||||
---Purpose : Returns the View n0. <num> for a List of Views. For a Single
|
||||
-- Views, may return <me> itself
|
||||
|
||||
end ViewKindEntity;
|
4
src/IGESData/IGESData_ViewKindEntity.cxx
Executable file
4
src/IGESData/IGESData_ViewKindEntity.cxx
Executable file
@@ -0,0 +1,4 @@
|
||||
#include <IGESData_ViewKindEntity.ixx>
|
||||
// ViewKindEntity ne sert qu'au controle de type (entite View du directory part
|
||||
// qui peut etre une Vue Simple ou une Liste de Vue
|
||||
// Vue Simple doit implementer IsSingle a Standard_True, Liste de Vue a Standard_False
|
Reference in New Issue
Block a user