com.iver.cit.gvsig.fmap.drivers.shp
Class DemoSHPDriver

java.lang.Object
  extended bycom.iver.cit.gvsig.fmap.drivers.shp.DemoSHPDriver
All Implemented Interfaces:
BoundedShapes, ExternalData, VectorialDriver, VectorialFileDriver

public class DemoSHPDriver
extends java.lang.Object
implements VectorialFileDriver, BoundedShapes, ExternalData

Driver del formato SHP.

Author:
$author$

Constructor Summary
DemoSHPDriver()
           
 
Method Summary
 boolean accept(java.io.File f)
          Define los tipos de fichero que puede leer el driver.
 void close()
          Cierra el fichero.
 java.lang.String getDataDriverName()
          Obtiene el nombre del driver que leerá la tabla de datos de la capa
 java.io.File getDataFile(java.io.File f)
          Obtiene el nombre del fichero de datos asociado al fichero que se pasa como parámetro
 DriverAttributes getDriverAttributes()
          Devuelve los atributos que necesitemos conocer de un driver.
 java.awt.geom.Rectangle2D getFullExtent()
          Obtiene el bounding box de la capa
 java.lang.String getName()
           
 IGeometry getShape(int index)
          Devuelve la geometria a partir de un índice.
 java.awt.geom.Rectangle2D getShapeBounds(int index)
          Obtiene el extent del shape a partir de un índice.
 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

DemoSHPDriver

public DemoSHPDriver()
Method Detail

close

public void close()
           throws java.io.IOException
Cierra el fichero.

Specified by:
close in interface VectorialFileDriver
Throws:
java.io.IOException
See Also:
VectorialFileDriver.close()

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
See Also:
VectorialFileDriver.open(java.io.File)

getShape

public IGeometry getShape(int index)
                   throws java.io.IOException
Devuelve la geometria a partir de un índice.

Specified by:
getShape in interface VectorialFileDriver
Parameters:
index - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!

getShapeCount

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

Specified by:
getShapeCount in interface VectorialFileDriver
Returns:
int
See Also:
VectorialFileDriver.getShapeCount()

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.
See Also:
VectorialDriver.getShapeType()

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
See Also:
VectorialFileDriver.initialize()

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
See Also:
VectorialFileDriver.getFullExtent()

getShapeBounds

public java.awt.geom.Rectangle2D getShapeBounds(int index)
                                         throws java.io.IOException
Obtiene el extent del shape a partir de un índice.

Specified by:
getShapeBounds in interface BoundedShapes
Parameters:
index - Índice.
Returns:
Rectángulo.
Throws:
java.io.IOException
See Also:
com.iver.cit.gvsig.fmap.drivers.BoundedShapes#getShapeBounds()

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
See Also:
VectorialFileDriver.accept(java.io.File)

getName

public java.lang.String getName()
See Also:
com.hardcode.driverManager.Driver#getType()

getDataDriverName

public java.lang.String getDataDriverName()
Description copied from interface: ExternalData
Obtiene el nombre del driver que leerá la tabla de datos de la capa

Specified by:
getDataDriverName in interface ExternalData
Returns:
Nombre del driver
See Also:
com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#getDataDriverName()

getDataFile

public java.io.File getDataFile(java.io.File f)
Description copied from interface: ExternalData
Obtiene el nombre del fichero de datos asociado al fichero que se pasa como parámetro

Specified by:
getDataFile in interface ExternalData
Parameters:
f - Fichero cuyo fichero con datos se quiere conocer. Sólo se invocará con ficheros que pasados como parámetro a accept, éste devuelve true
Returns:
Fichero con los datos alfanuméricos del fichero que se pasa como parámetro
See Also:
com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#getDataFile(java.io.File)

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:

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: