com.iver.cit.jdwglib.dwg
Class DwgFile

java.lang.Object
  extended bycom.iver.cit.jdwglib.dwg.DwgFile

public class DwgFile
extends java.lang.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

Constructor Summary
DwgFile(java.lang.String fileName)
          Creates a new DwgFile object given the absolute path to a DWG file
 
Method Summary
 void addDwgClass(DwgClass dwgClass)
          Add a DWG class to the dwgClasses vector
 void addDwgObject(DwgObject dwgObject)
          Add a DWG object to the dwgObject vector
 void addDwgObjectOffset(int handle, int offset)
          Add a DWG object offset to the dwgObjectOffsets vector
 void addDwgSectionOffset(java.lang.String key, int seek, int size)
          Add a DWG section offset to the dwgSectionOffsets vector
 void applyExtrusions()
          Modify the geometry of the objects applying the Extrusion vector where it is necessary
 void blockManagement()
          Modify the geometry of the objects contained in the blocks of a DWG file and add these objects to the DWG object list.
 void calculateCadModelDwgPolylines()
          Configure the geometry of the polylines in a DWG file from the vertex list in this DWG file.
 void calculateGisModelDwgPolylines()
          Configure the geometry of the polylines in a DWG file from the vertex list in this DWG file.
 int getColorByLayer(DwgObject entity)
          Returns the color of the layer of a DWG object
 java.util.Vector getDwgObjectOffsets()
           
 java.util.Vector getDwgObjects()
           
 int getDwgSectionOffset(java.lang.String key)
          Returns the offset of DWG section given by its key
 java.lang.String getFileName()
           
 java.lang.String getLayerName(DwgObject entity)
          Returns the name of the layer of a DWG object
 void initializeLayerTable()
          Initialize a new Vector that contains the DWG file layers.
 boolean isDwg3DFile()
           
 void read()
          Reads a DWG file and put its objects in the dwgObjects Vector This method is version independent
 void setDwg3DFile(boolean dwg3DFile)
           
 void testDwg3D()
          Test if the DWG file is 2D or 3D.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DwgFile

public DwgFile(java.lang.String fileName)
Creates a new DwgFile object given the absolute path to a DWG file

Parameters:
fileName - an absolute path to the DWG file
Method Detail

read

public void read()
          throws java.io.IOException
Reads a DWG file and put its objects in the dwgObjects Vector This method is version independent

Throws:
java.io.IOException - If the file location is wrong

applyExtrusions

public void applyExtrusions()
Modify the geometry of the objects applying the Extrusion vector where it is necessary


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.


calculateCadModelDwgPolylines

public void calculateCadModelDwgPolylines()
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.


blockManagement

public void blockManagement()
Modify the geometry of the objects contained in the blocks of a DWG file and add these objects to the DWG object list.


initializeLayerTable

public void initializeLayerTable()
Initialize a new Vector that contains the DWG file layers. Each layer have three parameters. These parameters are handle, name and color


getLayerName

public java.lang.String getLayerName(DwgObject entity)
Returns the name of the layer of a DWG object

Parameters:
entity - DWG object which we want to know its layer name
Returns:
String Layer name of the DWG object

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

testDwg3D

public void testDwg3D()
Test if the DWG file is 2D or 3D. If there is any object with a non cero elevation value, the file is considered 3D.


addDwgSectionOffset

public void addDwgSectionOffset(java.lang.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(java.lang.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

addDwgClass

public void addDwgClass(DwgClass dwgClass)
Add a DWG class to the dwgClasses vector

Parameters:
dwgClass - DWG class

getDwgObjectOffsets

public java.util.Vector getDwgObjectOffsets()
Returns:
Returns the dwgObjectOffsets.

getDwgObjects

public java.util.Vector getDwgObjects()
Returns:
Returns the dwgObjects.

getFileName

public java.lang.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.