root / branches / v10 / libraries / libFMap / src / com / iver / cit / gvsig / fmap / layers / VectorialDefaultAdapter.java @ 11137
History | View | Annotate | Download (3.42 KB)
1 | 3301 | fjp | /*
|
---|---|---|---|
2 | * Created on 10-nov-2005
|
||
3 | *
|
||
4 | * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
||
5 | 3959 | caballero | *
|
6 | 3301 | fjp | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
7 | 3959 | caballero | *
|
8 | 3301 | fjp | * This program is free software; you can redistribute it and/or
|
9 | * modify it under the terms of the GNU General Public License
|
||
10 | * as published by the Free Software Foundation; either version 2
|
||
11 | * of the License, or (at your option) any later version.
|
||
12 | 3959 | caballero | *
|
13 | 3301 | fjp | * This program is distributed in the hope that it will be useful,
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
16 | * GNU General Public License for more details.
|
||
17 | 3959 | caballero | *
|
18 | 3301 | fjp | * You should have received a copy of the GNU General Public License
|
19 | * along with this program; if not, write to the Free Software
|
||
20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||
21 | 3959 | caballero | *
|
22 | 3301 | fjp | * For more information, contact:
|
23 | *
|
||
24 | * Generalitat Valenciana
|
||
25 | * Conselleria d'Infraestructures i Transport
|
||
26 | * Av. Blasco Ib??ez, 50
|
||
27 | * 46010 VALENCIA
|
||
28 | * SPAIN
|
||
29 | *
|
||
30 | * +34 963862235
|
||
31 | * gvsig@gva.es
|
||
32 | * www.gvsig.gva.es
|
||
33 | 3959 | caballero | *
|
34 | 3301 | fjp | * or
|
35 | 3959 | caballero | *
|
36 | 3301 | fjp | * IVER T.I. S.A
|
37 | * Salamanca 50
|
||
38 | * 46005 Valencia
|
||
39 | * Spain
|
||
40 | 3959 | caballero | *
|
41 | 3301 | fjp | * +34 963163400
|
42 | * dac@iver.es
|
||
43 | */
|
||
44 | package com.iver.cit.gvsig.fmap.layers; |
||
45 | |||
46 | import java.io.IOException; |
||
47 | |||
48 | import com.hardcode.driverManager.DriverLoadException; |
||
49 | import com.hardcode.gdbms.engine.data.DataSource; |
||
50 | import com.hardcode.gdbms.engine.data.DataSourceFactory; |
||
51 | import com.hardcode.gdbms.engine.data.NoSuchTableException; |
||
52 | import com.hardcode.gdbms.engine.data.driver.ObjectDriver; |
||
53 | import com.iver.cit.gvsig.fmap.core.IGeometry; |
||
54 | import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
||
55 | |||
56 | /**
|
||
57 | * @author fjp
|
||
58 | *
|
||
59 | */
|
||
60 | public class VectorialDefaultAdapter extends VectorialAdapter { |
||
61 | 4504 | fjp | private SelectableDataSource ds;
|
62 | 3301 | fjp | /* (non-Javadoc)
|
63 | * @see com.iver.cit.gvsig.fmap.layers.VectorialAdapter#getRecordset()
|
||
64 | */
|
||
65 | 3959 | caballero | public SelectableDataSource getRecordset() throws DriverLoadException { |
66 | 3301 | fjp | if (getDriver() instanceof ObjectDriver) |
67 | { |
||
68 | 4504 | fjp | if (ds == null) { |
69 | String name = LayerFactory.getDataSourceFactory().addDataSource((ObjectDriver)getDriver());
|
||
70 | try {
|
||
71 | ds = new SelectableDataSource(LayerFactory.getDataSourceFactory().createRandomDataSource(name, DataSourceFactory.AUTOMATIC_OPENING));
|
||
72 | } catch (NoSuchTableException e) {
|
||
73 | throw new RuntimeException(e); |
||
74 | } catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
|
||
75 | throw new RuntimeException(e); |
||
76 | } |
||
77 | } |
||
78 | 6780 | jmvivo | return ds;
|
79 | 3301 | fjp | } |
80 | return null; |
||
81 | |||
82 | } |
||
83 | |||
84 | /* (non-Javadoc)
|
||
85 | * @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#start()
|
||
86 | */
|
||
87 | public void start() throws DriverIOException { |
||
88 | } |
||
89 | |||
90 | /* (non-Javadoc)
|
||
91 | * @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#stop()
|
||
92 | */
|
||
93 | public void stop() throws DriverIOException { |
||
94 | } |
||
95 | |||
96 | /* (non-Javadoc)
|
||
97 | * @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getShape(int)
|
||
98 | */
|
||
99 | public IGeometry getShape(int index) throws DriverIOException { |
||
100 | try {
|
||
101 | return getDriver().getShape(index);
|
||
102 | } catch (IOException e) { |
||
103 | throw new DriverIOException(e); |
||
104 | } |
||
105 | } |
||
106 | |||
107 | /* (non-Javadoc)
|
||
108 | * @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getShapeType()
|
||
109 | */
|
||
110 | public int getShapeType() throws DriverIOException { |
||
111 | return getDriver().getShapeType();
|
||
112 | } |
||
113 | |||
114 | } |