Revision 27905 branches/v2_0_0_prep/extensions/extGeocoding/src/org/gvsig/geocoding/gui/TableResultsModel.java
TableResultsModel.java | ||
---|---|---|
34 | 34 |
import javax.swing.table.AbstractTableModel; |
35 | 35 |
|
36 | 36 |
import org.cresques.cts.IProjection; |
37 |
import org.gvsig.fmap.dal.exception.DataException; |
|
38 |
import org.gvsig.fmap.dal.feature.Feature; |
|
39 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
40 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
37 | 41 |
import org.gvsig.fmap.geom.primitive.Point2D; |
38 | 42 |
import org.gvsig.fmap.mapcontext.MapContext; |
39 | 43 |
import org.gvsig.fmap.mapcontrol.MapControl; |
40 |
import org.gvsig.geocoding.Address; |
|
41 |
import org.gvsig.geocoding.AddressComponent; |
|
42 |
import org.gvsig.geocoding.ComposedAddress; |
|
43 |
import org.gvsig.geocoding.Literal; |
|
44 |
import org.gvsig.geocoding.NumberAddress; |
|
44 |
import org.gvsig.geocoding.address.Address;
|
|
45 |
import org.gvsig.geocoding.address.AddressComponent;
|
|
46 |
import org.gvsig.geocoding.address.ComposedAddress;
|
|
47 |
import org.gvsig.geocoding.address.Literal;
|
|
48 |
import org.gvsig.geocoding.address.NumberAddress;
|
|
45 | 49 |
import org.gvsig.geocoding.extension.GeocodingController; |
46 | 50 |
import org.gvsig.geocoding.result.GeocodingResult; |
47 | 51 |
import org.slf4j.Logger; |
... | ... | |
160 | 164 |
} |
161 | 165 |
} |
162 | 166 |
} |
167 |
|
|
168 |
public TableResultsModel(FeatureType type, FeatureSet set){ |
|
169 |
|
|
170 |
int siz = 0; |
|
171 |
try { |
|
172 |
siz = (int)set.getSize(); |
|
173 |
|
|
174 |
columnsNumber = type.size(); |
|
175 |
columnNames = new String[columnsNumber]; |
|
176 |
for (int i = 0; i < columnsNumber; i++) { |
|
177 |
columnNames[i]= type.getAttributeDescriptor(i).getName(); |
|
178 |
} |
|
179 |
data = new Object[siz][columnsNumber]; |
|
180 |
Iterator<Feature> it = set.iterator(); |
|
181 |
int i = 0; |
|
182 |
while(it.hasNext()){ |
|
183 |
Feature feat = it.next(); |
|
184 |
for (int j = 0; j < columnsNumber; j++) { |
|
185 |
String fieldname = type.getAttributeDescriptor(j).getName(); |
|
186 |
data[i][j]= feat.get(fieldname); |
|
187 |
} |
|
188 |
i++; |
|
189 |
} |
|
190 |
|
|
191 |
|
|
192 |
|
|
193 |
|
|
194 |
} catch (DataException e) { |
|
195 |
// TODO Auto-generated catch block |
|
196 |
e.printStackTrace(); |
|
197 |
} |
|
198 |
|
|
199 |
|
|
200 |
} |
|
201 |
|
|
163 | 202 |
|
164 | 203 |
/** |
165 | 204 |
* Get number of column in the table model |
... | ... | |
412 | 451 |
* @param row |
413 | 452 |
* @return |
414 | 453 |
*/ |
415 |
public Point2D getGeometry(int row) { |
|
416 |
Double x = (Double) getValueAt(row, 2);
|
|
417 |
Double y = (Double) getValueAt(row, 3);
|
|
454 |
public Point2D getGeometry(int row, int xColumn, int yColumn) {
|
|
455 |
Double x = (Double) getValueAt(row, xColumn);
|
|
456 |
Double y = (Double) getValueAt(row, yColumn);
|
|
418 | 457 |
return new Point2D(x, y); |
419 | 458 |
} |
420 | 459 |
|
Also available in: Unified diff