svn-gvsig-desktop / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / layers / VectorialDefaultAdapter.java @ 4928
History | View | Annotate | Download (3.44 KB)
1 |
/*
|
---|---|
2 |
* Created on 10-nov-2005
|
3 |
*
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
5 |
*
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
7 |
*
|
8 |
* 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 |
*
|
13 |
* 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 |
*
|
18 |
* 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 |
*
|
22 |
* 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 |
*
|
34 |
* or
|
35 |
*
|
36 |
* IVER T.I. S.A
|
37 |
* Salamanca 50
|
38 |
* 46005 Valencia
|
39 |
* Spain
|
40 |
*
|
41 |
* +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 |
private SelectableDataSource ds;
|
62 |
/* (non-Javadoc)
|
63 |
* @see com.iver.cit.gvsig.fmap.layers.VectorialAdapter#getRecordset()
|
64 |
*/
|
65 |
public SelectableDataSource getRecordset() throws DriverLoadException { |
66 |
if (getDriver() instanceof ObjectDriver) |
67 |
{ |
68 |
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 |
else
|
79 |
return ds;
|
80 |
} |
81 |
return null; |
82 |
|
83 |
} |
84 |
|
85 |
/* (non-Javadoc)
|
86 |
* @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#start()
|
87 |
*/
|
88 |
public void start() throws DriverIOException { |
89 |
} |
90 |
|
91 |
/* (non-Javadoc)
|
92 |
* @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#stop()
|
93 |
*/
|
94 |
public void stop() throws DriverIOException { |
95 |
} |
96 |
|
97 |
/* (non-Javadoc)
|
98 |
* @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getShape(int)
|
99 |
*/
|
100 |
public IGeometry getShape(int index) throws DriverIOException { |
101 |
try {
|
102 |
return getDriver().getShape(index);
|
103 |
} catch (IOException e) { |
104 |
throw new DriverIOException(e); |
105 |
} |
106 |
} |
107 |
|
108 |
/* (non-Javadoc)
|
109 |
* @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getShapeType()
|
110 |
*/
|
111 |
public int getShapeType() throws DriverIOException { |
112 |
return getDriver().getShapeType();
|
113 |
} |
114 |
|
115 |
} |