Revision 10627 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/VectorialAdapter.java
VectorialAdapter.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
import java.awt.Image; |
44 | 44 |
import java.awt.geom.Rectangle2D; |
45 |
import java.io.IOException; |
|
46 | 45 |
|
47 | 46 |
import com.hardcode.driverManager.DriverLoadException; |
47 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
48 | 48 |
import com.hardcode.gdbms.engine.data.DataSource; |
49 |
import com.hardcode.gdbms.engine.data.DataSourceFactory; |
|
50 |
import com.hardcode.gdbms.engine.data.driver.ObjectDriver; |
|
51 |
import com.hardcode.gdbms.engine.data.edition.DataWare; |
|
52 | 49 |
import com.hardcode.gdbms.engine.values.Value; |
53 |
import com.iver.cit.gvsig.fmap.DriverException;
|
|
50 |
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException;
|
|
54 | 51 |
import com.iver.cit.gvsig.fmap.core.DefaultFeature; |
55 | 52 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
56 | 53 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
57 | 54 |
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes; |
58 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
|
59 |
import com.iver.cit.gvsig.fmap.drivers.IFeatureIterator; |
|
60 |
import com.iver.cit.gvsig.fmap.drivers.RandomAccessFeatureIterator; |
|
61 |
import com.iver.cit.gvsig.fmap.drivers.VectorialDatabaseDriver; |
|
62 | 55 |
import com.iver.cit.gvsig.fmap.drivers.VectorialDriver; |
63 | 56 |
|
64 | 57 |
/** |
... | ... | |
70 | 63 |
|
71 | 64 |
/** |
72 | 65 |
* Establece el driver sobre el que act?a el adaptador |
73 |
*
|
|
66 |
* |
|
74 | 67 |
* @param driver |
75 | 68 |
*/ |
76 | 69 |
public void setDriver(VectorialDriver driver) { |
... | ... | |
80 | 73 |
/** |
81 | 74 |
* Obtiene una referencia al objeto que implementa la interfaz vectorial con |
82 | 75 |
* el fin de que las Strategy puedan optimizar en funci?n del driver. |
83 |
*
|
|
76 |
* |
|
84 | 77 |
* @return VectorialDriver |
85 | 78 |
*/ |
86 | 79 |
public VectorialDriver getDriver() { |
... | ... | |
89 | 82 |
|
90 | 83 |
/** |
91 | 84 |
* Devuelve el DataSource a pasrtir del nombre. |
92 |
*
|
|
85 |
* |
|
93 | 86 |
* @return DataSource. |
94 |
*
|
|
87 |
* |
|
95 | 88 |
* @throws DriverLoadException |
89 |
* @throws ReadDriverException |
|
96 | 90 |
*/ |
97 | 91 |
public abstract SelectableDataSource getRecordset() |
98 |
throws DriverLoadException; |
|
92 |
throws DriverLoadException, ReadDriverException;
|
|
99 | 93 |
|
100 | 94 |
/** |
101 | 95 |
* Por defecto devuelve null, y se le pone el icono por defecto. Si el |
102 | 96 |
* driver reescribe este m?todo, se usar? este icono en el TOC. |
103 |
*
|
|
97 |
* |
|
104 | 98 |
* @return |
105 | 99 |
*/ |
106 | 100 |
public Image getImageIcon() { |
... | ... | |
116 | 110 |
/** |
117 | 111 |
* @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getShapeCount() |
118 | 112 |
*/ |
119 |
public int getShapeCount() throws DriverIOException { |
|
120 |
try { |
|
121 |
return getDriver().getShapeCount(); |
|
122 |
} catch (IOException e) { |
|
123 |
throw new DriverIOException(e); |
|
124 |
} |
|
113 |
public int getShapeCount() throws ReadDriverException { |
|
114 |
return getDriver().getShapeCount(); |
|
125 | 115 |
} |
126 | 116 |
|
127 | 117 |
/** |
128 | 118 |
* @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getFullExtent() |
129 | 119 |
*/ |
130 |
public Rectangle2D getFullExtent() throws DriverIOException {
|
|
120 |
public Rectangle2D getFullExtent() throws ReadDriverException {
|
|
131 | 121 |
try { |
132 | 122 |
Rectangle2D aux = getDriver().getFullExtent(); |
133 | 123 |
// Para evitar que una nueva capa a?adida a una vista vac?a no |
... | ... | |
135 | 125 |
if (aux == null) |
136 | 126 |
aux = new Rectangle2D.Double(1,1,10,10); |
137 | 127 |
return aux; |
138 |
} catch (IOException e) {
|
|
139 |
throw new DriverIOException(e);
|
|
128 |
} catch (ExpansionFileReadException e) {
|
|
129 |
throw new ReadDriverException(getDriver().getName(),e);
|
|
140 | 130 |
} |
141 | 131 |
} |
142 | 132 |
|
... | ... | |
144 | 134 |
* En la implementaci?n por defecto podemos hacer que cada feature tenga ID = |
145 | 135 |
* numero de registro. En el DBAdapter podr?amos "overrride" este m?todo y |
146 | 136 |
* poner como ID de la Feature el campo ?nico escogido en la base de datos. |
147 |
*
|
|
137 |
* |
|
148 | 138 |
* @param numReg |
149 | 139 |
* @return |
150 |
* @throws DriverException |
|
151 | 140 |
*/ |
152 |
public IFeature getFeature(int numReg) throws DriverException { |
|
141 |
public IFeature getFeature(int numReg) throws ReadDriverException {
|
|
153 | 142 |
IGeometry geom; |
154 | 143 |
IFeature feat = null; |
155 | 144 |
try { |
... | ... | |
161 | 150 |
} |
162 | 151 |
|
163 | 152 |
feat = new DefaultFeature(geom, regAtt, numReg + ""); |
164 |
} catch (DriverIOException e) { |
|
165 |
throw new DriverException(e); |
|
166 |
} catch (DriverLoadException e) { |
|
167 |
throw new DriverException(e); |
|
168 |
} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) { |
|
169 |
throw new DriverException(e); |
|
153 |
} catch (ExpansionFileReadException e) { |
|
154 |
throw new ReadDriverException(getDriver().getName(),e); |
|
170 | 155 |
} |
171 | 156 |
return feat; |
172 | 157 |
} |
173 | 158 |
|
174 | 159 |
/* |
175 | 160 |
* (non-Javadoc) |
176 |
*
|
|
161 |
* |
|
177 | 162 |
* @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getFeatureIterator(java.awt.geom.Rectangle2D, |
178 | 163 |
* java.lang.String) Lo sobreescribir?n los adapters para base de datos |
179 | 164 |
* espacial. Por defecto, suponemos un buen acceso aleatorio y usamos |
Also available in: Unified diff