strategis::DXFParser Class Reference

Parses DXF files and provides virtual visitors. More...

Inheritance diagram for strategis::DXFParser:

strategis::DXF2Arcgen strategis::DXFLoadGraphics

List of all members.

Public Types

enum  EEntityType {
  EETPolyline = 1, EETText = 2, EETPoint = 3, EETLWPolyline = 4,
  EETInsert = 5
}
 Entity type. More...
enum  ELineType
 Enumeration of line types.

Public Member Functions

virtual void BlockEnded ()
 Called when a block has ended.
virtual void BlocksEnded ()
 Called when a block has ended.
virtual void BlocksStarted ()
 Called when a block has started.
virtual void BlockStarted ()
 Called when a block has started.
 DXFParser ()
 Ctor.
virtual void EntitiesEnded ()
 Called when entities section has ended.
virtual void EntitiesStarted ()
 called when entities section has started
virtual void EntityEnded ()
 Called when an entity has ended.
virtual void EntityStarted ()
 Called when an entity has started.
virtual void HeaderEnded ()
 Called when header has ended.
virtual void HeaderStarted ()
 Called when header has started.
int Read (wxString const &filename)
 Call this to start parsing.
virtual void TableEnded ()
 Called when a table has ended.
virtual void TablesEnded ()
 Called when table section has ended.
virtual void TablesStarted ()
 Called when table section has started.
virtual void TableStarted ()
 Called when a table has started.
virtual ~DXFParser ()
 Dtor.

Static Public Member Functions

static void ColorIdxToRGB (int idx, unsigned char &r, unsigned char &g, unsigned char &b)
 Called when an INSERT has started.

Static Public Attributes

static wxNode * cpColorNode
 Current color node.

Protected Attributes

DXFBlock cBlock
 Last read block.
EEntityType cEntityType
 Type of last read entity. Defines which of cPoint, cPolyline and cLWPolyline was filled last.
DXFHeadercHeader
 Last read header.
std::list< wxString > cLayerNames
 List of layer names.
DXFLWPolylinecLWPolyline
 Last read LW polyline.
DXFVertex cPoint
 Last read point.
DXFPolylinecPolyline
 Last read poly line.
DXFTablecTable
 Last read table.

Private Member Functions

void _Error (char const *pError)
 Notify error.
void _Parse ()
 Parse the current file.
void _ParseBlock ()
 Parse all blocks.
void _ParseBlocks ()
 Parse all blocks.
void _ParseEntities ()
 Parse all blocks.
void _ParseHatch ()
 Parse HATCH.
void _ParseHeader ()
 Parses the header.
void _ParseInsert ()
 Parse insert entity.
void _ParseLayer ()
 Parse layer.
void _ParseLayerName ()
 Parse alyer name.
void _ParseLine ()
 Parse a line.
void _ParseLWPolyline ()
 Parse LW Poly line.
void _ParsePoint ()
void _ParsePolyline ()
 Parse a poly line.
void _ParseSection ()
 Parses a section.
void _ParseSolid ()
 Parse a solid.
void _ParseTable ()
 Parse a table.
void _ParseTables ()
 Parse tables.
void _ParseText ()
 Parse a text.
void _ParseVariable ()
 Parse some of the header variables.
void _ParseVertex ()
 Parse a vertex.
void _ReadPoint (unsigned int const &start=10)
 Reads a 2D or 3D point.
int GetNext ()
 Reads a pair of cGroup and cValueString from the following two lines.

Private Attributes

unsigned long cCurrentLine
 Current line number.
unsigned int cGroup
 The integer group code defining how next line is interpreted.
char cGroupString [256]
 Helper to get the cGroup.
FILE * cpFile
 The file being read.
char cValue [256]
 The string value, if the cGroup indicates that cValueString is of string type.
char cValueString [256]
 The value at the line after a group code.

Classes

class  DXFBlock
 A DXF block. More...
class  DXFHeader
 DXF Header. More...
class  DXFLayer
 A DXF layer. More...
class  DXFLayerName
 A DXF layer name. More...
class  DXFLWPolyline
 LW (Leight weight?) poly line. More...
class  DXFPoint
 A DXF point. More...
class  DXFPolyline
 A poly line. More...
class  DXFTable
 A DXF table. More...
class  DXFVertex
 A DXF vertex. More...


Detailed Description

Parses DXF files and provides virtual visitors.

A "SAX" class rather than "DOM" class. Nothing is saved. The class provides hooks to be implemented in sub classes to take actions when different group codes are found.


Member Enumeration Documentation

Entity type.

Enumerator:
EETPolyline  Polyline.
EETText  Text.
EETPoint  Point.
EETLWPolyline  LWPolyLine.
EETInsert  Insert entity.


Constructor & Destructor Documentation

strategis::DXFParser::DXFParser (  ) 

Ctor.

Sets cHeader, cTable and cPolyline to NULL.

virtual strategis::DXFParser::~DXFParser (  )  [virtual]

Dtor.

Deltes cHeader, cTable and cPolyline.


Member Function Documentation

void strategis::DXFParser::_Parse (  )  [private]

Parse the current file.

The starting point for parsing a file. Calls _ParseSection for all "SECTION" elements in the file

See also:
Read _ParseSection

void strategis::DXFParser::_ParseBlock (  )  [private]

Parse all blocks.

Entity foundCalls method
POLYLINE_ParsePolyline()
POINT_ParsePoint()
TEXT_ParseText()
LWPOLYLINE_ParseLWPolyline()
LINE_ParseLine()

Todo:
ARC, IMAGE, 3DFACE, an more are not implemented.
See also:
_ParseBlocks

void strategis::DXFParser::_ParseBlocks (  )  [private]

Parse all blocks.

Entity foundCalls method
POLYLINE_ParsePolyline()
POINT_ParsePoint()
TEXT_ParseText()
LWPOLYLINE_ParseLWPolyline()
LINE_ParseLine()

Todo:
ARC, IMAGE, 3DFACE, an more are not implemented.
See also:
_ParseSection

void strategis::DXFParser::_ParseEntities (  )  [private]

Parse all blocks.

Entity foundCalls method
POLYLINE_ParsePolyline()
POINT_ParsePoint()
TEXT_ParseText()
LWPOLYLINE_ParseLWPolyline()
LINE_ParseLine()

Todo:
ARC, IMAGE, 3DFACE, an more are not implemented.
See also:
_ParseSection

void strategis::DXFParser::_ParseHatch (  )  [private]

Parse HATCH.

Todo:
Currently only loops until next 0 is found

void strategis::DXFParser::_ParseHeader (  )  [private]

Parses the header.

void strategis::DXFParser::_ParseInsert (  )  [private]

Parse insert entity.

Group codeAction
0Stop parsing.
10, 20, 30Read X, Y, Z.
2Set block name.
8Set layer name

void strategis::DXFParser::_ParseLayer (  )  [private]

Parse layer.

Group codeAction
62Color.
6Line type
70Frozen / not frozen
2Name

See also:
_ParseTable

void strategis::DXFParser::_ParseLayerName (  )  [private]

Parse alyer name.

Adds layer to DXFParser::cLayerNames if cGroup is 8 and cValue is not already added.

void strategis::DXFParser::_ParseLine (  )  [private]

Parse a line.

Group codeAction
0Return.
10Read first point
11Read second point
8Layer name

void strategis::DXFParser::_ParseLWPolyline (  )  [private]

Parse LW Poly line.

Group codeAction
0Call EntityEnded() and return.
38Elevation
70Closed/open, plinegen etc.
90Number of points
62Color
10, 20, 30Point
1002D/3D
210, 220, 230Extrusion direction
6Line type
8Layer name

void strategis::DXFParser::_ParsePoint (  )  [private]

Parse a point Parse a solid

void strategis::DXFParser::_ParsePolyline (  )  [private]

Parse a poly line.

Group codeAction
0If "VERTEX", call _ParseVertex(). If "SEQEND", stop.
70Set if 2D/3D and if closed/open.
62Set color
6Set Continuous etc.
8Set layer name

See also:
_ParseBlocks _ParseEntities

void strategis::DXFParser::_ParseSection (  )  [private]

Parses a section.

Calls the following methods:
Section foundCalls method
HEADER_ParseHeader()
TABLES_ParseTables()
BLOCKS_ParseBlocks()
ENTITIES_ParseEntities()

See also:
_Parse

void strategis::DXFParser::_ParseSolid (  )  [private]

Parse a solid.

Group codeAction
0Return.
10Read first point
11Read second point
12Read third point
13Read fourth point
8Layer name

void strategis::DXFParser::_ParseTable (  )  [private]

Parse a table.

void strategis::DXFParser::_ParseTables (  )  [private]

Parse tables.

void strategis::DXFParser::_ParseText (  )  [private]

Parse a text.

Group codeAction
0Return.
10Read first point
1Read the text
8Layer name

void strategis::DXFParser::_ParseVariable (  )  [private]

Parse some of the header variables.

Parses $EXTMIN, $EXTMAX,$LIMMIN, $LIMMAX, $UCSORG

See also:
_ParseHeader

void strategis::DXFParser::_ParseVertex (  )  [private]

Parse a vertex.

Group codeAction
0Return.
10Read point
8Layer name

void strategis::DXFParser::_ReadPoint ( unsigned int const &  start = 10  )  [private]

Reads a 2D or 3D point.

Reads X at start, Y at start+1, and Z at start+2. Result is stored in DXFParser::cPoint.

Parameters:
start Points start at multiples of 10, e.g. 10, 20, 30 etc. This varaible stated the start of the point to read

static void strategis::DXFParser::ColorIdxToRGB ( int  idx,
unsigned char &  r,
unsigned char &  g,
unsigned char &  b 
) [static]

Called when an INSERT has started.

Called when an INSERT has ended Convert color index to RGB

Todo:
Only assigns random color from a 256-entry palette. Donīt know the actual color table.
See also:
SGIS_Config::GetNextColor

virtual void strategis::DXFParser::EntitiesEnded (  )  [inline, virtual]

Called when entities section has ended.

The last read entity is stored in internal member for the type

virtual void strategis::DXFParser::EntitiesStarted (  )  [inline, virtual]

called when entities section has started

See also:
EntityStarted

virtual void strategis::DXFParser::EntityEnded (  )  [inline, virtual]

Called when an entity has ended.

Last entity is found in DXFParser::cPoint, DXFParser::cPolyline, or DXFParser::cLWPolyline depending on DXFParser::cEntityType.

See also:
EntityStarted

Reimplemented in strategis::DXFLoadGraphics, and strategis::DXF2Arcgen.

virtual void strategis::DXFParser::EntityStarted (  )  [inline, virtual]

Called when an entity has started.

See also:
EntitiesStarted

virtual void strategis::DXFParser::HeaderEnded (  )  [inline, virtual]

Called when header has ended.

The last read header is stored in DXFParser::cHeader

Reimplemented in strategis::DXFLoadGraphics.

int strategis::DXFParser::Read ( wxString const &  filename  ) 

Call this to start parsing.

Opens the file and calls _Parse().

See also:
_Parse

virtual void strategis::DXFParser::TablesEnded (  )  [inline, virtual]

Called when table section has ended.

The last read table is stored in DXFParser::cTable

virtual void strategis::DXFParser::TablesStarted (  )  [inline, virtual]

Called when table section has started.

See also:
TableStarted

virtual void strategis::DXFParser::TableStarted (  )  [inline, virtual]

Called when a table has started.

See also:
TablesStarted


The documentation for this class was generated from the following file:

Generated on Mon May 11 13:03:37 2009   ReVisitor AB