svn-gvsig-desktop / branches / v2_0_0_prep / extensions / org.gvsig.geocoding.extension / src / org / gvsig / geocoding / gui / GeocodingModel.java @ 32526
History | View | Annotate | Download (5.77 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 |
* 2008 Prodevelop S.L. main developer
|
26 |
*/
|
27 |
|
28 |
package org.gvsig.geocoding.gui; |
29 |
|
30 |
import java.io.File; |
31 |
import java.util.ArrayList; |
32 |
import java.util.List; |
33 |
import java.util.Set; |
34 |
|
35 |
import org.gvsig.fmap.dal.DataStore; |
36 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
37 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
38 |
import org.gvsig.geocoding.pattern.GeocodingPattern; |
39 |
import org.gvsig.geocoding.result.GeocodingResult; |
40 |
|
41 |
/**
|
42 |
* Model of geocoding extension
|
43 |
*
|
44 |
* @author <a href="mailto:jsanz@prodevelop.es"> Jorge Gaspar Sanz Salinas</a>
|
45 |
* @author <a href="mailto:vsanjaime@prodevelop.es"> Vicente Sanjaime Calvet</a>
|
46 |
*/
|
47 |
|
48 |
public class GeocodingModel implements IGeocodingModel { |
49 |
|
50 |
private GeocodingPattern pattern = null; |
51 |
|
52 |
private File patternFile = null; |
53 |
|
54 |
private FLyrVect lyr = null; |
55 |
|
56 |
private List<Set<GeocodingResult>> listResults; |
57 |
|
58 |
private boolean simple = true; |
59 |
|
60 |
private List<String> selDescs = null; |
61 |
|
62 |
private FeatureStore selectedTableStore = null; |
63 |
|
64 |
private int numResultShowed; |
65 |
|
66 |
private Integer[] exportElements = null; |
67 |
|
68 |
private String idFieldMassiveTable = null; |
69 |
|
70 |
|
71 |
/**
|
72 |
* Constructor
|
73 |
*
|
74 |
*/
|
75 |
public GeocodingModel() {
|
76 |
listResults = new ArrayList<Set<GeocodingResult>>(); |
77 |
} |
78 |
|
79 |
/**
|
80 |
* This method gets the Geocoding Pattern
|
81 |
*
|
82 |
* @return
|
83 |
*/
|
84 |
public GeocodingPattern getPattern() {
|
85 |
return pattern;
|
86 |
} |
87 |
|
88 |
/**
|
89 |
* This method sets the Geocoding Pattern
|
90 |
*
|
91 |
* @param pat
|
92 |
*/
|
93 |
public void setPattern(GeocodingPattern pat) { |
94 |
pattern = pat; |
95 |
} |
96 |
|
97 |
/**
|
98 |
* This method gets the layer source
|
99 |
*
|
100 |
* @return
|
101 |
*/
|
102 |
public FLyrVect getLyr() {
|
103 |
return lyr;
|
104 |
} |
105 |
|
106 |
/**
|
107 |
* This method sets the layer source
|
108 |
*
|
109 |
* @param lyr
|
110 |
*/
|
111 |
public void setLyr(FLyrVect lyr) { |
112 |
this.lyr = lyr;
|
113 |
} |
114 |
|
115 |
/**
|
116 |
* Get the pattern file
|
117 |
*
|
118 |
* @return
|
119 |
*/
|
120 |
public File getPatternFile() { |
121 |
return patternFile;
|
122 |
} |
123 |
|
124 |
/**
|
125 |
* Save the pattern file
|
126 |
*
|
127 |
* @param file
|
128 |
*/
|
129 |
public void setPatternFile(File file) { |
130 |
this.patternFile = file;
|
131 |
} |
132 |
|
133 |
/**
|
134 |
* @return the one results
|
135 |
*/
|
136 |
public Set<GeocodingResult> getOneGroupResults(int index) { |
137 |
return listResults.get(index);
|
138 |
} |
139 |
|
140 |
/**
|
141 |
* @return the results list
|
142 |
*/
|
143 |
public List<Set<GeocodingResult>> getAllResults() { |
144 |
return listResults;
|
145 |
} |
146 |
|
147 |
/**
|
148 |
* @param one
|
149 |
* group of results the results to set
|
150 |
*/
|
151 |
public void setOneGroupResults(Set<GeocodingResult> result) { |
152 |
this.listResults.add(result);
|
153 |
} |
154 |
|
155 |
/**
|
156 |
* @param one
|
157 |
* group of results the results to set
|
158 |
*/
|
159 |
public void setAllResults(List<Set<GeocodingResult>> results) { |
160 |
this.listResults.clear();
|
161 |
this.listResults = results;
|
162 |
} |
163 |
|
164 |
/**
|
165 |
* @return the simple
|
166 |
*/
|
167 |
public boolean isSimple() { |
168 |
return simple;
|
169 |
} |
170 |
|
171 |
/**
|
172 |
* @param simple
|
173 |
* the simple to set
|
174 |
*/
|
175 |
public void setSimple(boolean simple) { |
176 |
this.simple = simple;
|
177 |
} |
178 |
|
179 |
/**
|
180 |
* get list fields descriptor selected table
|
181 |
*
|
182 |
* @return
|
183 |
*/
|
184 |
public List<String> getListDescriptorSelectedTable() { |
185 |
return selDescs;
|
186 |
} |
187 |
|
188 |
/**
|
189 |
* set list of field descriptors of selected table
|
190 |
*
|
191 |
* @param descs
|
192 |
*/
|
193 |
public void setListDescriptorSelectedTable( |
194 |
List<String> descs) { |
195 |
selDescs = descs; |
196 |
|
197 |
} |
198 |
|
199 |
/**
|
200 |
* get table store of selected table (massive geocoding process)
|
201 |
*
|
202 |
* @return
|
203 |
*/
|
204 |
public FeatureStore getSelectedTableStore() {
|
205 |
return selectedTableStore;
|
206 |
} |
207 |
|
208 |
/**
|
209 |
* set table store of selected table (massive geocoding process)
|
210 |
*/
|
211 |
public void setSelectedTableStore(FeatureStore selectedTableStore) { |
212 |
this.selectedTableStore = selectedTableStore;
|
213 |
} |
214 |
|
215 |
/**
|
216 |
* Add one result to list of results
|
217 |
*
|
218 |
* @param result
|
219 |
*/
|
220 |
public void addResult(Set<GeocodingResult> result) { |
221 |
this.listResults.add(result);
|
222 |
} |
223 |
|
224 |
/**
|
225 |
* Clear list of geocoding results
|
226 |
*/
|
227 |
public void clearResults() { |
228 |
this.listResults.clear();
|
229 |
} |
230 |
|
231 |
/**
|
232 |
* get number of result of the results list showed
|
233 |
*/
|
234 |
public int getNumResultShowed() { |
235 |
return numResultShowed;
|
236 |
} |
237 |
|
238 |
/**
|
239 |
* set number of result of results list showed
|
240 |
*
|
241 |
* @param
|
242 |
*/
|
243 |
public void setNumResultShowed(int i) { |
244 |
this.numResultShowed = i;
|
245 |
|
246 |
} |
247 |
|
248 |
/**
|
249 |
* get results export elements
|
250 |
*
|
251 |
* @return
|
252 |
*/
|
253 |
public Integer[] getExportElements() { |
254 |
return exportElements;
|
255 |
} |
256 |
|
257 |
/**
|
258 |
* set results export elemnts
|
259 |
*
|
260 |
* @param exportElements
|
261 |
*/
|
262 |
public void setExportElements(Integer[] exportElements) { |
263 |
this.exportElements = exportElements;
|
264 |
} |
265 |
|
266 |
/**
|
267 |
* get descriptor id field of massive table
|
268 |
*
|
269 |
* @return
|
270 |
*/
|
271 |
public String getIdMasiveTable() { |
272 |
return idFieldMassiveTable;
|
273 |
} |
274 |
|
275 |
/**
|
276 |
* set descriptor id field of massive table
|
277 |
*
|
278 |
* @param descriptor
|
279 |
*/
|
280 |
public void setIdMasiveTable(String descriptor) { |
281 |
this.idFieldMassiveTable = descriptor;
|
282 |
} |
283 |
|
284 |
|
285 |
|
286 |
} |