root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / layers / VectorialDefaultAdapter.java @ 3301
History | View | Annotate | Download (4.09 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.awt.geom.Rectangle2D; |
47 |
import java.io.IOException; |
48 |
|
49 |
import com.hardcode.driverManager.DriverLoadException; |
50 |
import com.hardcode.gdbms.engine.data.DataSource; |
51 |
import com.hardcode.gdbms.engine.data.DataSourceFactory; |
52 |
import com.hardcode.gdbms.engine.data.NoSuchTableException; |
53 |
import com.hardcode.gdbms.engine.data.driver.ObjectDriver; |
54 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
55 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
56 |
import com.iver.cit.gvsig.fmap.drivers.IWFSdriver; |
57 |
|
58 |
/**
|
59 |
* @author fjp
|
60 |
*
|
61 |
*/
|
62 |
public class VectorialDefaultAdapter extends VectorialAdapter { |
63 |
|
64 |
/* (non-Javadoc)
|
65 |
* @see com.iver.cit.gvsig.fmap.layers.VectorialAdapter#getRecordset()
|
66 |
*/
|
67 |
public DataSource getRecordset() throws DriverLoadException { |
68 |
if (getDriver() instanceof ObjectDriver) |
69 |
{ |
70 |
String name = LayerFactory.getDataSourceFactory().addDataSource((ObjectDriver)getDriver());
|
71 |
try {
|
72 |
DataSource ds = LayerFactory.getDataSourceFactory().createRandomDataSource(name, DataSourceFactory.AUTOMATIC_OPENING);
|
73 |
return ds;
|
74 |
} catch (NoSuchTableException e) {
|
75 |
throw new RuntimeException(e); |
76 |
} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
|
77 |
throw new RuntimeException(e); |
78 |
} |
79 |
} |
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#getShapeCount()
|
109 |
*/
|
110 |
public int getShapeCount() throws DriverIOException { |
111 |
try {
|
112 |
return getDriver().getShapeCount();
|
113 |
} catch (IOException e) { |
114 |
throw new DriverIOException(e); |
115 |
} |
116 |
} |
117 |
|
118 |
/* (non-Javadoc)
|
119 |
* @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getFullExtent()
|
120 |
*/
|
121 |
public Rectangle2D getFullExtent() throws DriverIOException { |
122 |
try {
|
123 |
return getDriver().getFullExtent();
|
124 |
} catch (IOException e) { |
125 |
throw new DriverIOException(e); |
126 |
} |
127 |
} |
128 |
|
129 |
/* (non-Javadoc)
|
130 |
* @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getShapeType()
|
131 |
*/
|
132 |
public int getShapeType() throws DriverIOException { |
133 |
return getDriver().getShapeType();
|
134 |
} |
135 |
|
136 |
} |