Class DwgFile

java.lang.Object
org.gvsig.dwg.lib.DwgFile

public class DwgFile extends Object
The DwgFile class provides a revision-neutral interface for reading and handling DWG files Reading methods are useful for reading DWG files, and handling methods like calculateDwgPolylines() are useful for handling more complex objects in the DWG file
Author:
jmorell, azabala
  • Constructor Details

    • DwgFile

      public DwgFile(String fileName)
      Constructor.
      Parameters:
      fileName - an absolute path to the DWG file
  • Method Details

    • getDwgVersion

      public String getDwgVersion()
    • read

      public void read() throws IOException, DwgVersionNotSupportedException
      Reads a DWG file and put its objects in the dwgObjects Vector This method is version independent
      Throws:
      IOException - If the file location is wrong
      DwgVersionNotSupportedException
    • setHeader

      public void setHeader(String key, Object value)
    • getHeader

      public Object getHeader(String key)
    • addDwgLayer

      protected void addDwgLayer(DwgLayer dwgLayer)
    • getDwgLayer

      public DwgLayer getDwgLayer(DwgObject entity)
    • getDwgSuperEntity

      public DwgObject getDwgSuperEntity(DwgObject entity)
    • getLayerName

      public String getLayerName(DwgObject entity)
    • getColorByLayer

      public int getColorByLayer(DwgObject entity)
      Returns the color of the layer of a DWG object
      Parameters:
      entity - DWG object which we want to know its layer color
      Returns:
      int Layer color of the DWG object in the Autocad color code
    • calculateGisModelDwgPolylines

      public void calculateGisModelDwgPolylines()
      Configure the geometry of the polylines in a DWG file from the vertex list in this DWG file. This geometry is given by an array of Points. Besides, manage closed polylines and polylines with bulges in a GIS Data model. It means that the arcs of the polylines will be done through a set of points and a distance between these points.
    • blockManagement2

      public void blockManagement2()
      Configure the geometry of the polylines in a DWG file from the vertex list in this DWG file. This geometry is given by an array of Points Besides, manage closed polylines and polylines with bulges in a GIS Data model. It means that the arcs of the polylines will be done through a curvature parameter called bulge associated with the points of the polyline.
    • manageInsert2

      public void manageInsert2(Point2D insPoint, double[] scale, double rot, int bHandle, List dwgObjectsWithoutBlocks, Map handleObjectsWithoutBlocks)
    • getIndexOf

      public int getIndexOf(DwgObject dwgObject)
    • addDwgSectionOffset

      public void addDwgSectionOffset(String key, int seek, int size)
      Add a DWG section offset to the dwgSectionOffsets vector
      Parameters:
      key - Define the DWG section
      seek - Offset of the section
      size - Size of the section
    • getDwgSectionOffset

      public int getDwgSectionOffset(String key)
      Returns the offset of DWG section given by its key
      Parameters:
      key - Define the DWG section
      Returns:
      int Offset of the section in the DWG file
    • addDwgObjectOffset

      public void addDwgObjectOffset(int handle, int offset)
      Add a DWG object offset to the dwgObjectOffsets vector
      Parameters:
      handle - Object handle
      offset - Offset of the object data in the DWG file
    • addDwgObject

      public void addDwgObject(DwgObject dwgObject)
      Add a DWG object to the dwgObject vector
      Parameters:
      dwgObject - DWG object
    • getDwgObject

      public DwgObject getDwgObject(int index)
      Returns dwgObjects from its insertion order (position in the dwg file)
      Parameters:
      index - order in the dwg file
      Returns:
      position
    • getDwgObjectFromHandle

      public DwgObject getDwgObjectFromHandle(int handle)
    • addDwgClass

      public void addDwgClass(DwgClass dwgClass)
      Add a DWG class to the dwgClasses vector
      Parameters:
      dwgClass - DWG class
    • addDwgClass

      public void addDwgClass(DwgClass2004 dwgClass)
      Add a DWG class to the dwgClasses vector
      Parameters:
      dwgClass - DWG class
    • printClasses

      public void printClasses()
    • getDwgClasses

      public List getDwgClasses()
    • getDwgObjectOffsets

      public ArrayList getDwgObjectOffsets()
      Returns:
      Returns the dwgObjectOffsets.
    • getDwgObjects

      public List getDwgObjects()
      Returns:
      Returns the dwgObjects.
    • getFileName

      public String getFileName()
      Returns:
      Returns the fileName.
    • isDwg3DFile

      public boolean isDwg3DFile()
      Returns:
      Returns the dwg3DFile.
    • setDwg3DFile

      public void setDwg3DFile(boolean dwg3DFile)
      Parameters:
      dwg3DFile - The dwg3DFile to set.