svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libGeocoding / src / org / gvsig / geocoding / styles / AbstractGeocodingStyle.java @ 28375
History | View | Annotate | Download (2.91 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 Main development
|
26 |
*/
|
27 |
|
28 |
/**
|
29 |
*
|
30 |
*/
|
31 |
package org.gvsig.geocoding.styles; |
32 |
|
33 |
import java.util.List; |
34 |
import java.util.Set; |
35 |
|
36 |
import org.gvsig.geocoding.address.Address; |
37 |
import org.gvsig.geocoding.address.Literal; |
38 |
import org.gvsig.geocoding.result.GeocodingResult; |
39 |
import org.gvsig.geocoding.result.ScoredFeature; |
40 |
import org.gvsig.tools.persistence.PersistenceException; |
41 |
import org.gvsig.tools.persistence.Persistent; |
42 |
import org.gvsig.tools.persistence.PersistentState; |
43 |
|
44 |
/**
|
45 |
* Style of geocoding
|
46 |
*
|
47 |
* @author <a href="mailto:jsanz@prodevelop.es"> Jorge Gaspar Sanz Salinas</a>
|
48 |
* @author <a href="mailto:vsanjaime@prodevelop.es"> Vicente Sanjaime Calvet</a>
|
49 |
*/
|
50 |
|
51 |
public abstract class AbstractGeocodingStyle implements Persistent { |
52 |
|
53 |
private static final String RELATIONSLITERAL = "relationsliteral"; |
54 |
|
55 |
private Literal relationsLiteral = null; |
56 |
|
57 |
/**
|
58 |
* Get style relation literal
|
59 |
*
|
60 |
* @return
|
61 |
*/
|
62 |
public Literal getRelationsLiteral() {
|
63 |
return relationsLiteral;
|
64 |
} |
65 |
|
66 |
/**
|
67 |
* set style relation literal
|
68 |
*
|
69 |
* @param name
|
70 |
*/
|
71 |
public void setRelationsLiteral(Literal name) { |
72 |
this.relationsLiteral = name;
|
73 |
} |
74 |
|
75 |
/**
|
76 |
* Spatial search over the geometries of the selected features
|
77 |
*
|
78 |
* @param lists
|
79 |
* list of lists with ScoredFeatures
|
80 |
* @param address
|
81 |
* @return
|
82 |
*/
|
83 |
public abstract Set<GeocodingResult> match(List<List<ScoredFeature>> lists, |
84 |
Address address); |
85 |
|
86 |
/**
|
87 |
* Saves the internal state of the object on the provided PersistentState
|
88 |
* object.
|
89 |
*
|
90 |
* @param state
|
91 |
*/
|
92 |
public void saveToState(PersistentState state) throws PersistenceException { |
93 |
state.set(RELATIONSLITERAL, this.relationsLiteral.iterator());
|
94 |
} |
95 |
|
96 |
/**
|
97 |
* Set the state of the object from the state passed as parameter.
|
98 |
*
|
99 |
* @param state
|
100 |
*/
|
101 |
public void setState(PersistentState state) throws PersistenceException { |
102 |
this.relationsLiteral = (Literal) state.get(RELATIONSLITERAL);
|
103 |
} |
104 |
|
105 |
} |