svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libGeocoding / src / org / gvsig / geocoding / pattern / impl / DefaultGeocodingSource.java @ 28375
History | View | Annotate | Download (3.39 KB)
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 |
* 2009 Prodevelop S.L. main development
|
26 |
*/
|
27 |
|
28 |
package org.gvsig.geocoding.pattern.impl; |
29 |
|
30 |
import org.gvsig.fmap.dal.DataStore; |
31 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
32 |
import org.gvsig.geocoding.pattern.GeocodingSource; |
33 |
import org.gvsig.geocoding.styles.AbstractGeocodingStyle; |
34 |
import org.gvsig.tools.persistence.PersistenceException; |
35 |
import org.gvsig.tools.persistence.PersistentState; |
36 |
import org.slf4j.Logger; |
37 |
import org.slf4j.LoggerFactory; |
38 |
|
39 |
/**
|
40 |
* GeocodingSource class implementation. This class has the geocoding style and the FeatureStore of the
|
41 |
* data source
|
42 |
*
|
43 |
* @author <a href="mailto:jsanz@prodevelop.es"> Jorge Gaspar Sanz Salinas</a>
|
44 |
* @author <a href="mailto:vsanjaime@prodevelop.es"> Vicente Sanjaime Calvet</a>
|
45 |
*/
|
46 |
public class DefaultGeocodingSource implements GeocodingSource { |
47 |
|
48 |
@SuppressWarnings("unused") |
49 |
private static final Logger log = LoggerFactory |
50 |
.getLogger(DefaultGeocodingSource.class); |
51 |
|
52 |
private static final String STYLE = "style"; |
53 |
private static final String LAYERSOURCE = "layersource"; |
54 |
|
55 |
private AbstractGeocodingStyle style;
|
56 |
private DataStore layerSource;
|
57 |
|
58 |
/**
|
59 |
* Default constructor
|
60 |
*/
|
61 |
public DefaultGeocodingSource() {
|
62 |
|
63 |
} |
64 |
|
65 |
/**
|
66 |
* Constructor with parameters
|
67 |
*
|
68 |
* @param _style
|
69 |
* @param _layerSource
|
70 |
*/
|
71 |
public DefaultGeocodingSource(AbstractGeocodingStyle _style,
|
72 |
FeatureStore _layerSource) { |
73 |
this.style = _style;
|
74 |
this.layerSource = _layerSource;
|
75 |
} |
76 |
|
77 |
/**
|
78 |
* Get the style
|
79 |
*
|
80 |
* @return
|
81 |
*/
|
82 |
public AbstractGeocodingStyle getStyle() {
|
83 |
return style;
|
84 |
} |
85 |
|
86 |
/**
|
87 |
* Set the style
|
88 |
*
|
89 |
* @param style
|
90 |
*/
|
91 |
public void setStyle(AbstractGeocodingStyle style) { |
92 |
this.style = style;
|
93 |
} |
94 |
|
95 |
/**
|
96 |
* Get layer source
|
97 |
*
|
98 |
* @return
|
99 |
*/
|
100 |
public DataStore getLayerSource() {
|
101 |
return layerSource;
|
102 |
} |
103 |
|
104 |
/**
|
105 |
* Set layer source
|
106 |
*
|
107 |
* @param layerSource
|
108 |
*/
|
109 |
public void setLayerSource(DataStore layerSource) { |
110 |
this.layerSource = layerSource;
|
111 |
} |
112 |
|
113 |
/**
|
114 |
* Set the state of the GeocodingSource from the state passed as parameter.
|
115 |
*
|
116 |
* @param state
|
117 |
*/
|
118 |
public void setState(PersistentState state) throws PersistenceException { |
119 |
this.layerSource = (FeatureStore) state.get(LAYERSOURCE);
|
120 |
this.style = (AbstractGeocodingStyle) state.get(STYLE);
|
121 |
} |
122 |
|
123 |
public void saveToState(PersistentState state) throws PersistenceException { |
124 |
state.set(LAYERSOURCE, this.layerSource);
|
125 |
state.set(STYLE, this.style);
|
126 |
|
127 |
} |
128 |
|
129 |
} |