Revision 29385 branches/v2_0_0_prep/libraries/libGeocoding/src-test/org/gvsig/geocoding/SimpleRangeTest.java
SimpleRangeTest.java | ||
---|---|---|
39 | 39 |
import org.gvsig.fmap.dal.DataManager; |
40 | 40 |
import org.gvsig.fmap.dal.exception.ReadException; |
41 | 41 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
42 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
43 | 42 |
import org.gvsig.fmap.dal.store.shp.SHPLibrary; |
44 | 43 |
import org.gvsig.fmap.dal.store.shp.SHPStoreParameters; |
45 | 44 |
import org.gvsig.fmap.dal.store.shp.SHPStoreProvider; |
... | ... | |
77 | 76 |
public class SimpleRangeTest extends TestCase { |
78 | 77 |
|
79 | 78 |
protected DataManager dataManager = null; |
80 |
private File shape = new File("./test-data/geocoder/streets.shp");
|
|
79 |
private File shape = new File("test-data/geocoder/streets.shp"); |
|
81 | 80 |
private Logger log = LoggerFactory.getLogger(SimpleRangeTest.class); |
82 | 81 |
|
83 | 82 |
protected void setUp() throws Exception { |
... | ... | |
102 | 101 |
Library shpLib = new SHPLibrary(); |
103 | 102 |
shpLib.initialize(); |
104 | 103 |
shpLib.postInitialize(); |
105 |
|
|
104 |
|
|
106 | 105 |
Library geocoLib = new DefaultGeocodingLibrary(); |
107 | 106 |
geocoLib.initialize(); |
108 | 107 |
geocoLib.postInitialize(); |
... | ... | |
116 | 115 |
|
117 | 116 |
/** |
118 | 117 |
* Test |
118 |
* |
|
119 | 119 |
* @throws ReadException |
120 | 120 |
*/ |
121 | 121 |
public void testGeocode() throws ReadException { |
... | ... | |
140 | 140 |
log.debug("SIMPLE RANGE GEOCODING"); |
141 | 141 |
while (it.hasNext()) { |
142 | 142 |
GeocodingResult res = it.next(); |
143 |
Point pto = (Point)res.getGeometry(); |
|
144 |
log.debug("PTO: "+pto.getX()+","+pto.getY());
|
|
143 |
Point pto = (Point) res.getGeometry();
|
|
144 |
log.debug("PTO: " + pto.getX() + "," + pto.getY());
|
|
145 | 145 |
} |
146 | 146 |
} |
147 | 147 |
|
148 | 148 |
/** |
149 | 149 |
* get the pattern |
150 |
* |
|
150 | 151 |
* @return |
151 | 152 |
*/ |
152 | 153 |
private Patterngeocoding getPattern() { |
... | ... | |
170 | 171 |
|
171 | 172 |
AbstractGeocodingStyle style = new SimpleRange(); |
172 | 173 |
DefaultLiteral relations = new DefaultLiteral(); |
173 |
relations.add(new DefaultRelationsComponent("Calle","STREET_NAM")); |
|
174 |
relations.add(new DefaultRelationsComponent("TipoVia","STREET_TYP")); |
|
175 |
relations.add(new DefaultRelationsComponent("Municipio","MUNI")); |
|
176 |
relations.add(new DefaultRelationsComponent("Provincia","PROV")); |
|
177 |
relations.add(new DefaultRelationsComponent("Pais","PAIS")); |
|
174 |
relations.add(new DefaultRelationsComponent("Calle", "STREET_NAM")); |
|
175 |
relations |
|
176 |
.add(new DefaultRelationsComponent("TipoVia", "STREET_TYP")); |
|
177 |
relations.add(new DefaultRelationsComponent("Municipio", "MUNI")); |
|
178 |
relations.add(new DefaultRelationsComponent("Provincia", "PROV")); |
|
179 |
relations.add(new DefaultRelationsComponent("Pais", "PAIS")); |
|
178 | 180 |
|
179 | 181 |
style.setRelationsLiteral(relations); |
180 | 182 |
source.setStyle(style); |
181 | 183 |
|
182 |
RelationsComponent from = new DefaultRelationsComponent("NParFrom","RF_ADD"); |
|
184 |
RelationsComponent from = new DefaultRelationsComponent("NParFrom", |
|
185 |
"RF_ADD"); |
|
183 | 186 |
; |
184 | 187 |
((SimpleRange) style).setFirstNumber(from); |
185 | 188 |
|
186 |
RelationsComponent to = new DefaultRelationsComponent("NParTo","RT_ADD"); |
|
189 |
RelationsComponent to = new DefaultRelationsComponent("NParTo", |
|
190 |
"RT_ADD"); |
|
187 | 191 |
((SimpleRange) style).setLastNumber(to); |
188 | 192 |
|
189 | 193 |
pat.setSource(source); |
... | ... | |
209 | 213 |
literal.add(new DefaultAddressComponent("Pais", "Espanya")); |
210 | 214 |
|
211 | 215 |
Address address = new DefaultNumberAddress(literal); |
212 |
((NumberAddress)address).setNumber(56); |
|
216 |
((NumberAddress) address).setNumber(56);
|
|
213 | 217 |
return address; |
214 | 218 |
} |
215 | 219 |
|
Also available in: Unified diff