Class DwgFileV15Reader

java.lang.Object
org.gvsig.dwg.lib.readers.DwgFileV15Reader
All Implemented Interfaces:
IDwgFileReader

public class DwgFileV15Reader extends Object implements IDwgFileReader
The DwgFileV15Reader reads the DWG version 15 format
Author:
jmorell
  • Field Details

  • Constructor Details

    • DwgFileV15Reader

      public DwgFileV15Reader()
  • Method Details

    • read

      public void read(DwgFile dwgFile, ByteBuffer bb) throws IOException
      Reads the DWG version 15 format
      Specified by:
      read in interface IDwgFileReader
      Parameters:
      dwgFile - Represents the DWG file that we want to read
      bb - 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

      protected void readDwgObjectOffsets() throws Exception
      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

      protected void readDwgClasses() throws Exception
      Throws:
      Exception
    • readDwgClasses2

      protected void readDwgClasses2() throws Exception
      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

      public int readObjectHeader(int[] data, int offset, DwgObject dwgObject)
      Reads the header of an object in a DWG file Version 15
      Specified by:
      readObjectHeader in interface IDwgFileReader
      Parameters:
      data - Array of unsigned bytes obtained from the DWG binary file
      offset - 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:
      readObjectTailer in interface IDwgFileReader
      Parameters:
      data - Array of bytes obtained from the DWG binary file
      offset - Offset for this array of bytes
      Returns:
      int New offset
      Throws:
      CorruptedDwgEntityException
      RuntimeException
    • getDwgObjectByIndex

      public DwgObject getDwgObjectByIndex(int index)
      Return a dwg object from its index in the dwg file
      Parameters:
      index - of the requested dwg object in the dwg file
    • readDwgObject

      protected DwgObject readDwgObject(int offset, int index)
      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
      Throws:
      RuntimeException
      CorruptedDwgEntityException
    • readHeaders

      protected void readHeaders()