Revision 24759 branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/legend/gui/VectorialUniqueValue.java
VectorialUniqueValue.java | ||
---|---|---|
60 | 60 |
import javax.swing.JPanel; |
61 | 61 |
|
62 | 62 |
import org.apache.log4j.Logger; |
63 |
import org.gvsig.fmap.data.ReadException; |
|
64 |
import org.gvsig.fmap.data.feature.Feature; |
|
65 |
import org.gvsig.fmap.data.feature.FeatureAttributeDescriptor; |
|
66 |
import org.gvsig.fmap.data.feature.FeatureStore; |
|
63 |
import org.gvsig.fmap.dal.exception.DataException; |
|
64 |
import org.gvsig.fmap.dal.exception.ReadException; |
|
65 |
import org.gvsig.fmap.dal.feature.Feature; |
|
66 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
67 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
68 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
67 | 69 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
68 | 70 |
import org.gvsig.fmap.mapcontext.layers.operations.ClassifiableVectorial; |
69 | 71 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
... | ... | |
251 | 253 |
|
252 | 254 |
Random rand = new Random(System.currentTimeMillis()); |
253 | 255 |
|
254 |
Iterator iterator=elRs.getDataCollection().iterator(); |
|
256 |
FeatureSet set = elRs.getFeatureSet(); |
|
257 |
|
|
258 |
if (set.getSize() > 100) { |
|
259 |
int resp = JOptionPane.showConfirmDialog(this, PluginServices |
|
260 |
.getText(this, "mas_de_100_simbolos"), PluginServices |
|
261 |
.getText(this, "quiere_continuar"), |
|
262 |
JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); |
|
263 |
|
|
264 |
if ((resp == JOptionPane.NO_OPTION) |
|
265 |
|| (resp == JOptionPane.DEFAULT_OPTION)) { |
|
266 |
set.dispose(); |
|
267 |
return; |
|
268 |
} |
|
269 |
} |
|
270 |
|
|
271 |
Iterator iterator = set.iterator(); |
|
255 | 272 |
while (iterator.hasNext()) { |
256 | 273 |
Feature feature = (Feature) iterator.next(); |
257 | 274 |
clave = feature.get(fieldName); |
... | ... | |
273 | 290 |
theSymbol.setDescription(clave.toString()); |
274 | 291 |
auxLegend.addSymbol(clave, theSymbol); |
275 | 292 |
|
276 |
numSymbols++; |
|
277 | 293 |
|
278 |
if (numSymbols == 100) { |
|
279 |
int resp = JOptionPane.showConfirmDialog(this, |
|
280 |
PluginServices.getText(this, |
|
281 |
"mas_de_100_simbolos"), |
|
282 |
PluginServices.getText(this, "quiere_continuar"), |
|
283 |
JOptionPane.YES_NO_OPTION, |
|
284 |
JOptionPane.WARNING_MESSAGE); |
|
285 |
|
|
286 |
if ((resp == JOptionPane.NO_OPTION) || |
|
287 |
(resp == JOptionPane.DEFAULT_OPTION)) { |
|
288 |
return; |
|
289 |
} |
|
290 |
} |
|
291 | 294 |
} |
292 | 295 |
} // for |
293 | 296 |
|
294 | 297 |
symbolTable.fillTableFromSymbolList(auxLegend.getSymbols(), |
295 | 298 |
auxLegend.getValues(), auxLegend.getDescriptions()); |
296 | 299 |
// elRs.stop(); |
297 |
} catch (ReadException e) { |
|
300 |
set.dispose(); |
|
301 |
} catch (DataException e) { |
|
298 | 302 |
NotificationManager.addError(PluginServices.getText(this, "recovering_recordset"), e); |
299 | 303 |
} |
300 | 304 |
|
... | ... | |
317 | 321 |
FLyrVect m = (FLyrVect) layer; |
318 | 322 |
|
319 | 323 |
try { |
320 |
String fieldType=m.getFeatureStore().getDefaultFeatureType().getByOrder((int)cmbFields.getSelectedIndex()).getName(); |
|
324 |
String fieldType = m.getFeatureStore().getDefaultFeatureType() |
|
325 |
.getAttributeDescriptor(cmbFields.getSelectedIndex()) |
|
326 |
.getName(); |
|
321 | 327 |
// int fieldType = m.getSource().getRecordset().getFieldType((int)cmbFields.getSelectedIndex()); |
322 | 328 |
auxLegend.setClassifyingFieldTypes(new String[] {fieldType}); |
323 |
} catch (ReadException e) {
|
|
329 |
} catch (DataException e) {
|
|
324 | 330 |
NotificationManager.addError(PluginServices.getText(this, "could_not_setup_legend"), e); |
325 | 331 |
} |
326 | 332 |
|
327 | 333 |
auxLegend.clear(); |
328 | 334 |
|
329 | 335 |
for (int row = 0; row < symbolTable.getRowCount(); row++) { |
330 |
clave = (Object) symbolTable.getFieldValue(row, 1);
|
|
336 |
clave = symbolTable.getFieldValue(row, 1); |
|
331 | 337 |
theSymbol = (ISymbol) symbolTable.getFieldValue(row, 0); |
332 | 338 |
theSymbol.setDescription((String) symbolTable.getFieldValue(row, 2)); |
333 | 339 |
auxLegend.addSymbol(clave, theSymbol); |
... | ... | |
367 | 373 |
// |
368 | 374 |
// rs.stop(); |
369 | 375 |
|
370 |
DefaultComboBoxModel cM = new DefaultComboBoxModel((String[])names.toArray(new String[0]));
|
|
376 |
DefaultComboBoxModel cM = new DefaultComboBoxModel(names.toArray(new String[0])); |
|
371 | 377 |
cmbFields.setModel(cM); |
372 | 378 |
|
373 | 379 |
// fieldsListValor.setSelectedIndex(0); |
374 |
} catch (ReadException e) {
|
|
380 |
} catch (DataException e) {
|
|
375 | 381 |
NotificationManager.addError(PluginServices.getText(this, "recovering_recordset"), e); |
376 | 382 |
} |
377 | 383 |
} |
... | ... | |
387 | 393 |
|
388 | 394 |
getDefaultSymbolPrev(shapeType); |
389 | 395 |
|
390 |
if (symbolTable != null) |
|
391 |
pnlCenter.remove(symbolTable); |
|
396 |
if (symbolTable != null) { |
|
397 |
pnlCenter.remove(symbolTable); |
|
398 |
} |
|
392 | 399 |
symbolTable = new SymbolTable(this, SymbolTable.VALUES_TYPE, shapeType); |
393 | 400 |
pnlCenter.add(symbolTable, BorderLayout.CENTER); |
394 | 401 |
|
... | ... | |
444 | 451 |
auxLegend.setClassifyingFieldNames( |
445 | 452 |
new String[] {(String) cmbFields.getSelectedItem()}); |
446 | 453 |
|
447 |
if(defaultSymbolPrev.getSymbol() != null) |
|
454 |
if(defaultSymbolPrev.getSymbol() != null) {
|
|
448 | 455 |
auxLegend.setDefaultSymbol(defaultSymbolPrev.getSymbol()); |
456 |
} |
|
449 | 457 |
|
450 | 458 |
auxLegend.useDefaultSymbol(chbUseDefault.isSelected()); |
451 | 459 |
|
Also available in: Unified diff