com.iver.cit.gvsig.fmap.drivers.dxf
Class DXFDriver

java.lang.Object
  extended bycom.iver.cit.gvsig.fmap.drivers.dxf.DXFDriver
All Implemented Interfaces:
BoundedShapes, VectorialDriver, VectorialFileDriver

public class DXFDriver
extends java.lang.Object
implements VectorialFileDriver, BoundedShapes

Version:
13-dic-2004
Author:
jmorell (jose.morell@gmail.com)

Constructor Summary
DXFDriver()
           
 
Method Summary
 boolean accept(java.io.File f)
          Define los tipos de fichero que puede leer el driver.
 void close()
          Cuando se terminan las operaciones sobre el fichero se invoca éste método para cerrar el descriptor que se abrió en f
 boolean fileAccepted(java.io.File f)
           
 java.lang.String getDataDriverName()
           
 java.io.File getDataFile(java.io.File f)
           
 DriverAttributes getDriverAttributes()
          Devuelve los atributos que necesitemos conocer de un driver.
 int getFieldCount()
           
 java.lang.String getFieldName(int arg0)
           
 Value getFieldValue(long arg0, int arg1)
           
 java.awt.geom.Rectangle2D getFullExtent()
          Obtiene el bounding box de la capa
 java.lang.String getName()
           
 long getRowCount()
           
 IGeometry getShape(int i)
          Obtiene del fichero abierto en open la geometría index-ésima
 java.awt.geom.Rectangle2D getShapeBounds(int index)
          Obtiene el Rectángulo de la geometría iésima
 int getShapeCount()
          Obtiene el número de geometrías que contiene la capa
 int getShapeType()
          Devuelve el tipo de los shapes que hay en el fichero.
 int getShapeType(int index)
          Devuelve el tipo de la geometría.
 void initialize()
          Método invocado una sóla vez durante la ejecución justo antes de visualizar una capa.
 void open(java.io.File f)
          Abre el fichero para una serie de operaciones.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DXFDriver

public DXFDriver()
Method Detail

open

public void open(java.io.File f)
          throws java.io.IOException
Description copied from interface: VectorialFileDriver
Abre el fichero para una serie de operaciones.

Specified by:
open in interface VectorialFileDriver
Parameters:
f - Fichero sobre el que se va a operar
Throws:
java.io.IOException - Si se produce algún error

close

public void close()
           throws java.io.IOException
Description copied from interface: VectorialFileDriver
Cuando se terminan las operaciones sobre el fichero se invoca éste método para cerrar el descriptor que se abrió en f

Specified by:
close in interface VectorialFileDriver
Throws:
java.io.IOException - Si se produce algún error

getShape

public IGeometry getShape(int i)
                   throws java.io.IOException
Description copied from interface: VectorialFileDriver
Obtiene del fichero abierto en open la geometría index-ésima

Specified by:
getShape in interface VectorialFileDriver
Parameters:
i - Índice de la geometría que se quiere obtener
Returns:
IGeometry. Construida mediante llamadas a ShapeFactory
Throws:
java.io.IOException - Si se produce algún error

getShapeCount

public int getShapeCount()
                  throws java.io.IOException
Description copied from interface: VectorialFileDriver
Obtiene el número de geometrías que contiene la capa

Specified by:
getShapeCount in interface VectorialFileDriver
Returns:
int
Throws:
java.io.IOException - Si se produce algún error

getFullExtent

public java.awt.geom.Rectangle2D getFullExtent()
                                        throws java.io.IOException
Description copied from interface: VectorialFileDriver
Obtiene el bounding box de la capa

Specified by:
getFullExtent in interface VectorialFileDriver
Returns:
Rectangle2D
Throws:
java.io.IOException - Si se produce algún error

initialize

public void initialize()
                throws java.io.IOException
Description copied from interface: VectorialFileDriver
Método invocado una sóla vez durante la ejecución justo antes de visualizar una capa. En él se deben de hacer las inicializaciones necesarias

Specified by:
initialize in interface VectorialFileDriver
Throws:
java.io.IOException - Si se produce algún error

accept

public boolean accept(java.io.File f)
Description copied from interface: VectorialFileDriver
Define los tipos de fichero que puede leer el driver. Si devuelve true, el fichero está aceptado (es de los que el driver puede leer), si devuelve false es porque no lo puede leer.

Specified by:
accept in interface VectorialFileDriver
Parameters:
f - Fichero
Returns:
boolean

getDataDriverName

public java.lang.String getDataDriverName()

getDataFile

public java.io.File getDataFile(java.io.File f)

getShapeType

public int getShapeType()
Description copied from interface: VectorialDriver
Devuelve el tipo de los shapes que hay en el fichero. Pueden haber varios tipos de shapes y para indicar esto se devuelve un bitoring de los tipos que contiene el fichero. Por ejemplo un fichero que contenga textos y lineas devolverá la expresión (FShape.LINE | FShape.TEXT)

Specified by:
getShapeType in interface VectorialDriver
Returns:
tipo de shape.

getName

public java.lang.String getName()

getShapeBounds

public java.awt.geom.Rectangle2D getShapeBounds(int index)
                                         throws java.io.IOException
Description copied from interface: BoundedShapes
Obtiene el Rectángulo de la geometría iésima

Specified by:
getShapeBounds in interface BoundedShapes
Parameters:
index - Índice
Returns:
Rectángulo.
Throws:
java.io.IOException

getShapeType

public int getShapeType(int index)
Description copied from interface: BoundedShapes
Devuelve el tipo de la geometría. Con .shp está claro. Con PostGIS, existe una función: GeometryType(geometry) Returns the type of the geometry as a string. Eg: 'LINESTRING', 'POLYGON', 'MULTIPOINT', etc. OGC SPEC s2.1.1.1 - Returns the name of the instantiable subtype of Geometry of which this Geometry instance is a member. The name of the instantiable subtype of Geometry is returned as a string. NOTA: CREO QUE ESTO NO TIENE SENTIDO CON BASES DE DATOS. LA ESTRATEGIA CON BASES DE DATOS DEBE SER PEDIR LAS GEOMETRIES CONTENIDAS EN UN RECTANGULO, Y PREGUNTARLE A CADA GEOMETRY SU BOUNDINGBOX (Y GUARDARLO CON UN SHAPEINFO). TENGO LA SENSACIÓN QUE ESTO LO VAMOS A USAR SOLO CON SHAPES

Specified by:
getShapeType in interface BoundedShapes
Parameters:
index -
Returns:

fileAccepted

public boolean fileAccepted(java.io.File f)

getFieldValue

public Value getFieldValue(long arg0,
                           int arg1)
                    throws DriverException
Throws:
DriverException

getFieldCount

public int getFieldCount()
                  throws DriverException
Throws:
DriverException

getFieldName

public java.lang.String getFieldName(int arg0)
                              throws DriverException
Throws:
DriverException

getRowCount

public long getRowCount()
                 throws DriverException
Throws:
DriverException

getDriverAttributes

public DriverAttributes getDriverAttributes()
Description copied from interface: VectorialDriver
Devuelve los atributos que necesitemos conocer de un driver. Por ejemplo, si se carga en memoria, o cualquier otra cosa que necesitemos. Pasa a través del adapter para que una FLayer pueda conocer ciertos aspectos del driver que le está entregando las features.

Specified by:
getDriverAttributes in interface VectorialDriver
Returns: