svn-gvsig-desktop / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / layers / VectorialAdapter.java @ 1283
History | View | Annotate | Download (4.56 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package com.iver.cit.gvsig.fmap.layers; |
42 |
|
43 |
import com.hardcode.driverManager.DriverLoadException; |
44 |
|
45 |
import com.hardcode.gdbms.engine.data.DataSource; |
46 |
|
47 |
import com.iver.cit.gvsig.fmap.DriverException; |
48 |
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes; |
49 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
50 |
import com.iver.cit.gvsig.fmap.drivers.VectorialDriver; |
51 |
import com.iver.cit.gvsig.fmap.operations.strategies.ShapeInfo; |
52 |
import com.iver.cit.gvsig.fmap.rendering.indexes.Indexable; |
53 |
|
54 |
import java.awt.Image; |
55 |
import java.awt.geom.Rectangle2D; |
56 |
|
57 |
|
58 |
/**
|
59 |
* Clase padre de los adaptadores de los drivers. De momento mantiene solo el
|
60 |
* ?ndice creado sobre la capa
|
61 |
*/
|
62 |
public abstract class VectorialAdapter implements ReadableVectorial, Indexable { |
63 |
private VectorialDriver driver;
|
64 |
private ShapeInfo shapeInfo;
|
65 |
|
66 |
/**
|
67 |
* Establece el driver sobre el que act?a el adaptador
|
68 |
*
|
69 |
* @param driver
|
70 |
*/
|
71 |
public void setDriver(VectorialDriver driver) { |
72 |
this.driver = driver;
|
73 |
} |
74 |
|
75 |
/**
|
76 |
* Obtiene una referencia al objeto que implementa la interfaz vectorial
|
77 |
* con el fin de que las Strategy puedan optimizar en funci?n del driver.
|
78 |
*
|
79 |
* @return VectorialDriver
|
80 |
*/
|
81 |
public VectorialDriver getDriver() {
|
82 |
return driver;
|
83 |
} |
84 |
|
85 |
/**
|
86 |
* Crea un ?ndice para la capa. Se comprueba si el driver implementa
|
87 |
* Indexable. Si lo es, se delega la creaci?n en el driver, si no se crea
|
88 |
* un ?ndice interno con IndexFactory
|
89 |
*
|
90 |
* @param boundingBox Rect?ngulo.
|
91 |
*
|
92 |
* @throws DriverIOException
|
93 |
*/
|
94 |
public void createIndex(Rectangle2D boundingBox) throws DriverIOException { |
95 |
} |
96 |
|
97 |
/**
|
98 |
* Mira si la capa tiene un ?ndice, bien propio del tipo de capa, bien
|
99 |
* interno de gvSIG
|
100 |
*
|
101 |
* @return True si la capa contiene ?ndice.
|
102 |
*/
|
103 |
public boolean hasIndex() { |
104 |
//TODO Implementar bien
|
105 |
return false; |
106 |
} |
107 |
|
108 |
/**
|
109 |
* Si el driver es indexable devuelve el valor de la invocaci?n a
|
110 |
* getIndexFile del driver, si no, devuelve la ruta del fichero de ?ndices
|
111 |
* interno de gvSIG
|
112 |
*
|
113 |
* @return String.
|
114 |
*/
|
115 |
public String getIndexFile() { |
116 |
//TODO implementar bien
|
117 |
return null; |
118 |
} |
119 |
|
120 |
/**
|
121 |
* @see com.iver.cit.gvsig.fmap.rendering.indexes.Index#openIndexFile(java.lang.String)
|
122 |
*/
|
123 |
public void openIndexFile(String file) { |
124 |
} |
125 |
|
126 |
/**
|
127 |
* @see com.iver.cit.gvsig.fmap.rendering.indexes.Index#closeIndexFile()
|
128 |
*/
|
129 |
public void closeIndexFile() { |
130 |
} |
131 |
|
132 |
/**
|
133 |
* Devuelve el DataSource a pasrtir del nombre.
|
134 |
*
|
135 |
* @param name Nombre.
|
136 |
*
|
137 |
* @return DataSource.
|
138 |
*
|
139 |
* @throws DriverLoadException
|
140 |
*/
|
141 |
public abstract DataSource getRecordset(String name) |
142 |
throws DriverLoadException;
|
143 |
|
144 |
/**
|
145 |
* Devuelve el ShapeInfo.
|
146 |
*
|
147 |
* @return Returns the shapeInfo.
|
148 |
*/
|
149 |
public ShapeInfo getShapeInfo() {
|
150 |
return shapeInfo;
|
151 |
} |
152 |
|
153 |
/**
|
154 |
* Inserta el ShapeInfo.
|
155 |
*
|
156 |
* @param shapeInfo The shapeInfo to set.
|
157 |
*/
|
158 |
public void setShapeInfo(ShapeInfo shapeInfo) { |
159 |
this.shapeInfo = shapeInfo;
|
160 |
} |
161 |
|
162 |
/**
|
163 |
* M?todo abstracto que se ejecutar? cuando se cambie el nombre del
|
164 |
* DataSource.
|
165 |
*
|
166 |
* @param newName Nuevo nombre.
|
167 |
*
|
168 |
* @throws DriverException
|
169 |
*/
|
170 |
public abstract void changeRecordsetName(String newName) |
171 |
throws DriverException;
|
172 |
|
173 |
/**
|
174 |
* Por defecto devuelve null, y se le pone el icono por defecto.
|
175 |
* Si el driver reescribe este m?todo, se usar? este icono en el TOC.
|
176 |
*
|
177 |
* @return
|
178 |
*/
|
179 |
public Image getImageIcon() |
180 |
{ |
181 |
return null; |
182 |
} |
183 |
|
184 |
public DriverAttributes getDriverAttributes()
|
185 |
{ |
186 |
return driver.getDriverAttributes();
|
187 |
} |
188 |
} |