23 #include "a2dprivate.h"
29 #include <wx/wfstream.h>
38 typedef wxByte G_BYTE;
41 typedef wxUint16 TWO_G_BYTE_UNSIGNED_INTEGER;
42 typedef wxUint32 FOUR_G_BYTE_UNSIGNED_INTEGER;
43 typedef wxInt16 TWO_G_BYTE_SIGNED_INTEGER;
44 typedef wxInt32 FOUR_G_BYTE_SIGNED_INTEGER;
45 typedef wxFloat32 FOUR_G_BYTE_REAL;
46 typedef wxFloat64 EIGHT_G_BYTE_REAL;
53 #define GDS_DEFAULT_STRING_LENGTH 44 // default size of and GDS-II string
54 const int GDS_HEADERSIZE = 4;
55 #define GDSTYPE_TWO_G_BYTE_UNSIGNED_INTEGER 7 // record contains 2 byte unsigned integers
56 #define GDSTYPE_FOUR_G_BYTE_UNSIGNED_INTEGER 8 // record contains 4 byte unsigned integers
59 #define GDSTYPE_NO_DATA 0 // no data in record contained
60 #define GDSTYPE_BIT_ARRAY 1 // record contains bitarray vars
61 #define GDSTYPE_TWO_G_BYTE_SIGNED_INTEGER 2 // record contains 2 byte integers
62 #define GDSTYPE_FOUR_G_BYTE_SIGNED_INTEGER 3 // record contains 4 byte integers
63 #define GDSTYPE_FOUR_G_BYTE_REAL 4 // record contains 4 byte reals
64 #define GDSTYPE_EIGHT_G_BYTE_REAL 5 // record contains 8 byte reals
65 #define GDSTYPE_ASCII_STRING 6 // record contains GDSII ASCII-strings
77 #define GDS_BOUNDARY 8
83 #define GDS_DATATYPE 14
89 #define GDS_TEXTNODE 20
91 #define GDS_TEXTTYPE 22
92 #define GDS_PRESENTATION 23
93 #define GDS_SPACING 24
98 #define GDS_UINTEGER 29
99 #define GDS_USTRING 30
100 #define GDS_REFLIBS 31
102 #define GDS_PATHTYPE 33
103 #define GDS_GENERATIONS 34
104 #define GDS_ATTRTABLE 35
105 #define GDS_STYPTABLE 36
106 #define GDS_STRTYPE 37
107 #define GDS_ELFLAGS 38
109 #define GDS_LINKTYPE 40
110 #define GDS_LINKKEYS 41
111 #define GDS_NODETYPE 42
112 #define GDS_PROPATTR 43
113 #define GDS_PROPVALUE 44
115 #define GDS_BOXTYPE 46
117 #define GDS_BGNEXTN 48
118 #define GDS_ENDEXTN 49
119 #define GDS_TAPENUM 50
120 #define GDS_TAPECODE 51
121 #define GDS_STRCLASS 52
122 #define GDS_RESERVED 53
123 #define GDS_FORMAT 54
125 #define GDS_ENDMASKS 56
128 #define GDS_LIBDIRSIZE 57
129 #define GDS_SRFNAME 58
130 #define GDS_LIBSECUR 59
141 #define DEFAULT_STRANS_ANGLE 0
142 #define DEFAULT_STRANS_SCALE 1.0
143 #define DEFAULT_STRANS_ABS_ANGLE false
144 #define DEFAULT_STRANS_ABS_SCALE false
145 #define DEFAULT_STRANS_REFLECTION false
150 #if wxBYTE_ORDER == wxBIG_ENDIAN
151 unsigned reflection: 1;
152 unsigned reserved1 : 7;
153 unsigned reserved2 : 5;
154 unsigned abs_scale : 1;
155 unsigned abs_angle : 1;
156 unsigned reserved : 1;
158 unsigned reserved : 1;
159 unsigned abs_angle : 1;
160 unsigned abs_scale : 1;
161 unsigned reserved2 : 5;
162 unsigned reserved1 : 7;
163 unsigned reflection: 1;
172 Strans(
double nw_angle = DEFAULT_STRANS_ANGLE,
173 double nw_scale = DEFAULT_STRANS_SCALE,
174 bool nw_abs_angle = DEFAULT_STRANS_ABS_ANGLE,
175 bool nw_abs_scale = DEFAULT_STRANS_ABS_SCALE,
176 bool nw_reflection = DEFAULT_STRANS_REFLECTION );
184 void SetAngle(
double );
185 void SetScale(
double );
186 void SetAbsAngle(
bool );
187 void SetAbsScale(
bool );
188 void SetReflection(
bool );
193 bool GetReflection();
242 void SetFontType( a2dFontType fontType ) { m_fontType = fontType; }
244 void SetReadAsCameleon(
bool asCameleons ) { m_asCameleons = asCameleons; }
246 bool GetReadAsCameleon() {
return m_asCameleons; }
252 unsigned int ReadUnsignedInt();
263 void gds2double(
unsigned char fb[] );
278 bool ReadGdsHeader();
280 bool ReadLayer(
int& layer );
281 bool ReadLibraryName();
282 bool ReadLibrarySettings();
284 bool ReadStrans(
Strans& _Strans );
296 bool ReadHeader(
int type );
302 void ReadString( wxString& a_string );
322 double m_userunits_out;
327 a2dFontType m_fontType;
355 bool CanSave(
const wxObject* obj = NULL );
363 void SetReadAsCameleon(
bool asCameleons ) { m_asCameleons = asCameleons; }
365 bool GetReadAsCameleon() {
return m_asCameleons; }
381 unsigned int ReadUnsignedInt();
391 void WriteByte( G_BYTE ch );
393 void WriteUnsignedInt( TWO_G_BYTE_UNSIGNED_INTEGER i );
395 void WriteInt( TWO_G_BYTE_SIGNED_INTEGER i );
397 void WriteLong( FOUR_G_BYTE_SIGNED_INTEGER i );
399 void WriteFloat( FOUR_G_BYTE_REAL i );
405 void WriteHeader( TWO_G_BYTE_UNSIGNED_INTEGER nw_recordsize, G_BYTE nw_datatype, G_BYTE nw_recordtype );
411 void WritePoint(
double xi,
double yi );
413 void WriteVpath(
const a2dAffineMatrix& lworld,
const a2dVpath* path,
int layer,
int datatype,
int pathtype,
double width );
446 void double2gds(
unsigned char fb[] );
468 double m_userunits_out;
475 bool m_fromViewAsTop;
482 #endif //wxART2D_USE_GDSIO
wxPoint2DDouble a2dPoint2D
this to define if coordinate numbers are integer or doubles
a2dText derived from a2dCanvasObject, holds multiline text
a2dCanvasObjectReference is a reference to any a2dCanvasObject derived class.
virtual void InitializeLoad()
Inits the handler for reading.
holds GDS-II info for reflection and positioning
a2dTextGDS text based on wxDC text drawing.
virtual bool Load(a2dDocumentInputStream &stream, wxObject *obj)=0
override to read the stream and store (part of) the contents in to a specific a2dDocument or othere o...
TWO_G_BYTE_UNSIGNED_INTEGER m_recordsize
size of the last read record
virtual void InitializeSave()
Inits the handler for writing.
virtual void ResetSave()
Reset the object after saving.
polygon defined with list of points.
wxString m_strucname
structure that is being read at the moment
wxOutputStream a2dDocumentOutputStream
output stream based wxStreams
a2dCanvasDocument * m_doc
the document to store/load the data found into
Input driver for GDSII files.
using a file stream for input, stream the file into a a2dDocument or other object ...
vertex array of line and arc segments.
bool m_textAsPath
if true, convert text to a2dVpath
object to show several appearance views on what it contains
virtual bool CanLoad(a2dDocumentInputStream &stream, const wxObject *obj=NULL, wxClassInfo *docClassInfo=NULL)=0
Should return true if the handler can read from the stream.
a2dCanvasObject is the base class for Canvas Objects.
bool GetSaveTextAsVpath()
/see SetSaveTextAsVpath()
a2dCanvasObjectArrayReference is an array of a reference to any a2dCanvasObject derived class...
std::vector< int > m_mapping
mapping of GDSII layers to internal layers
vertex list of line and arc segments.
bool m_back
last read record is stored
struct gds_strans_bitflags gds_strans_bitflags
holds GDS-II info for reflection and positioning
void SetFromViewAsTop(bool fromViewAsTop)
if set, the current view its ShowObject will be saved top down.
a2dText is an abstract base class.
polyline defined with list of points.
a2dCameleonInst to show one appearance of an a2dCameleon.
layer settings for a a2dCanvasDocument Holds layers settings classes
G_BYTE m_recordtype
recordtype of last read record
G_BYTE m_datatype
the type of the data in the last read record
void SetSaveTextAsVpath(bool textAsPath)
if set text will be converted to a vectorpath, and as polygons and polylines.
bool m_back
last read record is stored
virtual bool Save(a2dDocumentOutputStream &stream, const wxObject *obj)=0
Override to write to the stream and store (part of) of the document contents in the stream...
using a file stream for output, stream a a2dDocument or other wxObject into a stream.
A 2x3 affine matrix class for 2D transformations.
a2dCanvasDocument * m_doc
the document to store/load the data found into
TWO_G_BYTE_UNSIGNED_INTEGER m_recordsize
size of the last read record
std::vector< int > m_mapping
mapping of GDSII layers to internal layers
wxInputStream a2dDocumentInputStream
input stream based wxStreams
virtual bool CanSave(const wxObject *obj=NULL)=0
Should return true if the handler can write this document to a stream.
G_BYTE m_datatype
the type of the data in the last read record
Each a2dCanvasView needs to have a a2dCanvasDocument set in order to render data. ...
class to hold GDS-II transformation info, only used within the GDSII reader
Output driver for GDSII files.
G_BYTE m_recordtype
recordtype of last read record
bool GetFromViewAsTop()
/see SetFromViewAsTop()
a2dCanvasObject for a Vector Path
virtual void WriteDouble(double d)
write a double
virtual bool LinkReferences(bool ignoreNonResolved=false)
link references to their destination
virtual void WriteString(const wxString &string)
write a string
virtual void ResetLoad()
Reset the handler after loading.
const a2dError a2dError_GDSIIparse