Revision 27464 branches/v2_0_0_prep/extensions/extGeocoding/src/org/gvsig/geocoding/extension/GeocodingTask.java
GeocodingTask.java | ||
---|---|---|
30 | 30 |
import java.util.List; |
31 | 31 |
import java.util.Set; |
32 | 32 |
|
33 |
import javax.swing.JTable; |
|
34 |
|
|
33 | 35 |
import org.gvsig.geocoding.Address; |
34 | 36 |
import org.gvsig.geocoding.DataGeocoder; |
35 | 37 |
import org.gvsig.geocoding.DataGeocoderImpl; |
38 |
import org.gvsig.geocoding.gui.TableResultsModel; |
|
36 | 39 |
import org.gvsig.geocoding.pattern.Patterngeocoding; |
37 | 40 |
import org.gvsig.geocoding.result.GeocodingResult; |
38 | 41 |
import org.slf4j.Logger; |
... | ... | |
76 | 79 |
|
77 | 80 |
String log = ""; |
78 | 81 |
|
82 |
Address address = null; |
|
83 |
|
|
79 | 84 |
// SIMPLE GEOCODING |
80 | 85 |
if (finalStep == 1) { |
81 | 86 |
log = PluginServices.getText(this, "addressgeocoded"); |
82 | 87 |
|
83 | 88 |
if (!isCanceled()) { |
84 | 89 |
setCurrentStep(1); |
85 |
setNote(1 + " " + log);
|
|
90 |
address = getSimpleAddress();
|
|
86 | 91 |
Set<GeocodingResult> result = geocoding(control.getPattern(), |
87 |
getSimpleAddress());
|
|
92 |
address);
|
|
88 | 93 |
control.getGmodel().addResult(result); |
94 |
setNote(1 + " " + log); |
|
89 | 95 |
} else { |
90 | 96 |
return; |
91 | 97 |
} |
... | ... | |
95 | 101 |
// TABLE GEOCODING (MASSIVE) |
96 | 102 |
else { |
97 | 103 |
log = PluginServices.getText(this, "addressesgeocoded"); |
98 |
for (int i = 0; i < finalStep + 1; i++) {
|
|
104 |
for (int i = 1; i < finalStep + 1; i++) {
|
|
99 | 105 |
if (!isCanceled()) { |
100 | 106 |
setCurrentStep(i); |
101 |
setNote(i + " " + log);
|
|
107 |
address = getTableAddress(i - 1);
|
|
102 | 108 |
Set<GeocodingResult> result = geocoding(control |
103 |
.getPattern(), getTableAddress(i));
|
|
109 |
.getPattern(), address);
|
|
104 | 110 |
control.getGmodel().addResult(result); |
111 |
setNote(i + " " + log); |
|
105 | 112 |
} else { |
106 | 113 |
return; |
107 | 114 |
} |
108 | 115 |
} |
109 | 116 |
} |
117 |
|
|
118 |
List<Set<GeocodingResult>> results = control.getGmodel() |
|
119 |
.getAllResults(); |
|
120 |
Set<GeocodingResult> result = results.get(0); |
|
121 |
control.getGmodel().setNumResultShowed(0); |
|
122 |
if (result.size() > 0) { |
|
123 |
int max = control.getPattern().getSettings().getResultsNumber(); |
|
124 |
|
|
125 |
JTable jTableResults = control.getJTableResults(); |
|
126 |
TableResultsModel model = new TableResultsModel(control, address); |
|
127 |
model.setResultSet(result, max, control.getPattern().getSettings() |
|
128 |
.getScore()); |
|
129 |
jTableResults.setModel(model); |
|
130 |
jTableResults.validate(); |
|
131 |
jTableResults.repaint(); |
|
132 |
|
|
133 |
if (results.size() > 1) { |
|
134 |
control.getGpanel().activeTableGUIFeatures(true); |
|
135 |
control.getGpanel().setLabRow(control.ROW + 1); |
|
136 |
control.getGmodel().setNumResultShowed(0); |
|
137 |
} |
|
138 |
|
|
139 |
} |
|
110 | 140 |
} |
111 | 141 |
|
112 | 142 |
/** |
Also available in: Unified diff