svn-gvsig-desktop / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / layers / VectorialAdapter.java @ 1283
History | View | Annotate | Download (4.56 KB)
1 | 1100 | fjp | /* 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 | 214 | fernando | package com.iver.cit.gvsig.fmap.layers; |
42 | |||
43 | 1034 | vcaballero | import com.hardcode.driverManager.DriverLoadException; |
44 | 214 | fernando | |
45 | 408 | fernando | import com.hardcode.gdbms.engine.data.DataSource; |
46 | 1034 | vcaballero | |
47 | 651 | fernando | import com.iver.cit.gvsig.fmap.DriverException; |
48 | 1233 | fjp | import com.iver.cit.gvsig.fmap.drivers.DriverAttributes; |
49 | 214 | fernando | import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
50 | import com.iver.cit.gvsig.fmap.drivers.VectorialDriver; |
||
51 | 309 | fernando | import com.iver.cit.gvsig.fmap.operations.strategies.ShapeInfo; |
52 | 214 | fernando | import com.iver.cit.gvsig.fmap.rendering.indexes.Indexable; |
53 | 1034 | vcaballero | |
54 | 1233 | fjp | import java.awt.Image; |
55 | 1034 | vcaballero | import java.awt.geom.Rectangle2D; |
56 | |||
57 | |||
58 | 214 | fernando | /**
|
59 | 1034 | vcaballero | * Clase padre de los adaptadores de los drivers. De momento mantiene solo el
|
60 | * ?ndice creado sobre la capa
|
||
61 | 214 | fernando | */
|
62 | 1034 | vcaballero | public abstract class VectorialAdapter implements ReadableVectorial, Indexable { |
63 | 214 | fernando | private VectorialDriver driver;
|
64 | 309 | fernando | private ShapeInfo shapeInfo;
|
65 | 214 | fernando | |
66 | /**
|
||
67 | 1034 | vcaballero | * 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 | 214 | fernando | |
75 | 1034 | vcaballero | /**
|
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 | 214 | fernando | |
85 | 1034 | vcaballero | /**
|
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 | 214 | fernando | |
97 | 1034 | vcaballero | /**
|
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 | 214 | fernando | |
108 | 1034 | vcaballero | /**
|
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 | 214 | fernando | * @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 | 217 | fernando | |
132 | /**
|
||
133 | 1034 | vcaballero | * Devuelve el DataSource a pasrtir del nombre.
|
134 | *
|
||
135 | * @param name Nombre.
|
||
136 | *
|
||
137 | * @return DataSource.
|
||
138 | *
|
||
139 | 408 | fernando | * @throws DriverLoadException
|
140 | 217 | fernando | */
|
141 | 1034 | vcaballero | public abstract DataSource getRecordset(String name) |
142 | throws DriverLoadException;
|
||
143 | |||
144 | 309 | fernando | /**
|
145 | 1034 | vcaballero | * Devuelve el ShapeInfo.
|
146 | *
|
||
147 | 309 | fernando | * @return Returns the shapeInfo.
|
148 | */
|
||
149 | public ShapeInfo getShapeInfo() {
|
||
150 | return shapeInfo;
|
||
151 | } |
||
152 | 1034 | vcaballero | |
153 | 309 | fernando | /**
|
154 | 1034 | vcaballero | * Inserta el ShapeInfo.
|
155 | *
|
||
156 | 309 | fernando | * @param shapeInfo The shapeInfo to set.
|
157 | */
|
||
158 | public void setShapeInfo(ShapeInfo shapeInfo) { |
||
159 | this.shapeInfo = shapeInfo;
|
||
160 | } |
||
161 | 1034 | vcaballero | |
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 | 1233 | fjp | |
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 | 214 | fernando | } |