Package org.gvsig.dwg.lib.readers
Class DwgFileV15Reader
java.lang.Object
org.gvsig.dwg.lib.readers.DwgFileV15Reader
- All Implemented Interfaces:
IDwgFileReader
The DwgFileV15Reader reads the DWG version 15 format
- Author:
- jmorell
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidgetDwgObjectByIndex(int index) Return a dwg object from its index in the dwg filevoidread(DwgFile dwgFile, ByteBuffer bb) Reads the DWG version 15 formatprotected voidprotected voidprotected DwgObjectreadDwgObject(int offset, int index) Reads a dwg drawing entity (dwg object) given its offset in the fileprotected voidOpenDWG spec says: This section -object map- is a table which gives the location of each object in the DWG file.protected voidReads all the object referenced in the object map section of the DWG file (using their object file obsets)protected voidIt read the SECTIONS from the header of the DWG fileprotected voidintreadObjectHeader(int[] data, int offset, DwgObject dwgObject) Reads the header of an object in a DWG file Version 15intreadObjectTailer(int[] data, int offset, DwgObject dwgObject) Reads the tail of an object in a DWG file Version 15protected voidreadSpecificObject(DwgObject obj, int[] data, int bitPos)
-
Field Details
-
dwgFile
-
bb
-
-
Constructor Details
-
DwgFileV15Reader
public DwgFileV15Reader()
-
-
Method Details
-
read
Reads the DWG version 15 format- Specified by:
readin interfaceIDwgFileReader- Parameters:
dwgFile- Represents the DWG file that we want to readbb- Memory mapped byte buffer of the whole DWG file- Throws:
IOException- When DWG file path is wrong
-
checkSuperentities
protected void checkSuperentities() -
readDwgSectionOffsets
protected void readDwgSectionOffsets()It read the SECTIONS from the header of the DWG file -
readDwgObjectOffsets
OpenDWG spec says: This section -object map- is a table which gives the location of each object in the DWG file. This table is broken into sections. It is basically a list of handle/file loc pairs. It could be readed with this pseudocode: Set lastHandle to all 0 and last loc to 0L. Repeat until section size == 2 section size = read short (in bigendian order) Repeat until out of data for this section offset of this handle form last handle as modular char offset of location in file from last location as modular char End repeat End repeat- Throws:
Exception
-
readDwgClasses
- Throws:
Exception
-
readDwgClasses2
- Throws:
Exception
-
readDwgObjects
protected void readDwgObjects()Reads all the object referenced in the object map section of the DWG file (using their object file obsets) -
readObjectHeader
Reads the header of an object in a DWG file Version 15- Specified by:
readObjectHeaderin interfaceIDwgFileReader- Parameters:
data- Array of unsigned bytes obtained from the DWG binary fileoffset- The current bit offset where the value begins- Returns:
- int New offset
-
readObjectTailer
public int readObjectTailer(int[] data, int offset, DwgObject dwgObject) throws RuntimeException, CorruptedDwgEntityException Reads the tail of an object in a DWG file Version 15- Specified by:
readObjectTailerin interfaceIDwgFileReader- Parameters:
data- Array of bytes obtained from the DWG binary fileoffset- Offset for this array of bytes- Returns:
- int New offset
- Throws:
CorruptedDwgEntityExceptionRuntimeException
-
getDwgObjectByIndex
Return a dwg object from its index in the dwg file- Parameters:
index- of the requested dwg object in the dwg file
-
readDwgObject
Reads a dwg drawing entity (dwg object) given its offset in the file -
readSpecificObject
protected void readSpecificObject(DwgObject obj, int[] data, int bitPos) throws RuntimeException, CorruptedDwgEntityException -
readHeaders
protected void readHeaders()
-