|
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
|
2 |
*
|
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
|
4 |
* of the Valencian Government (CIT)
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or
|
|
7 |
* modify it under the terms of the GNU General Public License
|
|
8 |
* as published by the Free Software Foundation; either version 2
|
|
9 |
* of the License, or (at your option) any later version.
|
|
10 |
*
|
|
11 |
* This program is distributed in the hope that it will be useful,
|
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
* GNU General Public License for more details.
|
|
15 |
*
|
|
16 |
* You should have received a copy of the GNU General Public License
|
|
17 |
* along with this program; if not, write to the Free Software
|
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
19 |
* MA 02110-1301, USA.
|
|
20 |
*
|
|
21 |
*/
|
|
22 |
|
|
23 |
/*
|
|
24 |
* AUTHORS (In addition to CIT):
|
|
25 |
* 2008 Prodevelop S.L main development
|
|
26 |
*/
|
|
27 |
|
|
28 |
package org.gvsig;
|
|
29 |
|
|
30 |
import java.io.File;
|
|
31 |
|
|
32 |
import org.gvsig.fmap.dal.DALLocator;
|
|
33 |
import org.gvsig.fmap.dal.DataManager;
|
|
34 |
import org.gvsig.fmap.dal.feature.FeatureStore;
|
|
35 |
import org.gvsig.fmap.dal.store.dbf.DBFStoreParameters;
|
|
36 |
import org.gvsig.fmap.dal.store.dbf.DBFStoreProvider;
|
|
37 |
import org.gvsig.fmap.dal.store.shp.SHPStoreParameters;
|
|
38 |
import org.gvsig.fmap.dal.store.shp.SHPStoreProvider;
|
|
39 |
|
|
40 |
public class LayerServer {
|
|
41 |
|
|
42 |
private static DataManager dataManager = DALLocator.getDataManager();
|
|
43 |
|
|
44 |
private static File streets = new File(
|
|
45 |
"resources-test/geocoding/geocoder/streets.shp");
|
|
46 |
private static File regions = new File(
|
|
47 |
"resources-test/geocoding/geocoder/prov.shp");
|
|
48 |
private static File points = new File(
|
|
49 |
"resources-test/geocoding/geocoder/pointss.shp");
|
|
50 |
private static File sLines = new File(
|
|
51 |
"resources-test/geocoding/geocoder/simpleLines.shp");
|
|
52 |
private static File streetsmassive = new File(
|
|
53 |
"resources-test/geocoding/massive/streetsmassive.dbf");
|
|
54 |
|
|
55 |
public static File getStreetsFile() {
|
|
56 |
return streets;
|
|
57 |
}
|
|
58 |
|
|
59 |
public static File getRegionsFile() {
|
|
60 |
return regions;
|
|
61 |
}
|
|
62 |
|
|
63 |
public static File getPointsFile() {
|
|
64 |
return points;
|
|
65 |
}
|
|
66 |
|
|
67 |
public static File getSimpleLinesFile() {
|
|
68 |
return sLines;
|
|
69 |
}
|
|
70 |
|
|
71 |
public static File getStreetsMassiveFile() {
|
|
72 |
return streetsmassive;
|
|
73 |
}
|
|
74 |
|
|
75 |
public static FeatureStore getSHPStore(File file) throws Exception {
|
|
76 |
|
|
77 |
SHPStoreParameters params = (SHPStoreParameters) dataManager
|
|
78 |
.createStoreParameters(SHPStoreProvider.NAME);
|
|
79 |
params.setFile(file);
|
|
80 |
params.setSRSID("EPSG:23030");
|
|
81 |
FeatureStore store = (FeatureStore) dataManager.createStore(params);
|
|
82 |
|
|
83 |
return store;
|
|
84 |
}
|
|
85 |
|
|
86 |
public static FeatureStore getDBFStore(File file) throws Exception {
|
|
87 |
|
|
88 |
DBFStoreParameters provParam = (DBFStoreParameters) dataManager
|
|
89 |
.createStoreParameters(DBFStoreProvider.NAME);
|
|
90 |
provParam.setFile(file);
|
|
91 |
FeatureStore store = (FeatureStore) dataManager.createStore(provParam);
|
|
92 |
|
|
93 |
return store;
|
|
94 |
}
|
|
95 |
|
|
96 |
}
|
0 |
97 |
|