Revision 14821 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/legend/gui/VectorialInterval.java
VectorialInterval.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
|
1 |
/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
|
|
2 | 2 |
* |
3 | 3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
4 | 4 |
* |
... | ... | |
20 | 20 |
* |
21 | 21 |
* Generalitat Valenciana |
22 | 22 |
* Conselleria d'Infraestructures i Transport |
23 |
* Av. Blasco Ib??ez, 50
|
|
23 |
* Av. Blasco Ib��ez, 50
|
|
24 | 24 |
* 46010 VALENCIA |
25 | 25 |
* SPAIN |
26 | 26 |
* |
... | ... | |
436 | 436 |
return sym; |
437 | 437 |
} |
438 | 438 |
/** |
439 |
* Damos una primera pasada para saber los l?mites inferior y superior y
|
|
439 |
* Damos una primera pasada para saber los l�mites inferior y superior y
|
|
440 | 440 |
* rellenar un array con los valores. Luego dividimos ese array en |
441 | 441 |
* intervalos. |
442 | 442 |
*/ |
... | ... | |
448 | 448 |
FInterval[] arrayIntervalos = calculateIntervals(); |
449 | 449 |
if (arrayIntervalos == null) |
450 | 450 |
return; |
451 |
|
|
451 |
|
|
452 | 452 |
FInterval interval; |
453 | 453 |
NumberFormat.getInstance().setMaximumFractionDigits(2); |
454 | 454 |
theLegend.clear(); |
... | ... | |
460 | 460 |
int stepG; |
461 | 461 |
int stepB; |
462 | 462 |
|
463 |
// Cogemos el tipo de gradaci?n de colores que quiere el usuario y
|
|
464 |
// Creamos el primer y ?ltimo color.
|
|
463 |
// Cogemos el tipo de gradaci�n de colores que quiere el usuario y
|
|
464 |
// Creamos el primer y �ltimo color.
|
|
465 | 465 |
Color startColor = colorChooserPanel.getColor(); |
466 | 466 |
theLegend.setStartColor(startColor); |
467 | 467 |
|
... | ... | |
474 | 474 |
stepR = (endColor.getRed() - r) / arrayIntervalos.length; |
475 | 475 |
stepG = (endColor.getGreen() - g) / arrayIntervalos.length; |
476 | 476 |
stepB = (endColor.getBlue() - b) / arrayIntervalos.length; |
477 |
|
|
478 |
auxLegend = LegendFactory.createVectorialIntervalLegend(layer.getShapeType());
|
|
479 |
|
|
477 |
|
|
478 |
auxLegend = LegendFactory.createVectorialIntervalLegend(layer.getShapeType()); |
|
479 |
|
|
480 | 480 |
if (chkdefaultvalues.isSelected()) { |
481 | 481 |
auxLegend.getDefaultSymbol().setDescription("Default"); |
482 |
auxLegend.addSymbol(new NullIntervalValue(),
|
|
482 |
auxLegend.addSymbol(new NullIntervalValue(), |
|
483 | 483 |
auxLegend.getDefaultSymbol()); |
484 | 484 |
} |
485 | 485 |
|
486 | 486 |
int symbolType = layer.getShapeType(); |
487 | 487 |
int numSymbols = 0; |
488 |
|
|
489 |
|
|
488 |
|
|
490 | 489 |
for (int k = 0; k < arrayIntervalos.length; k++) { |
491 | 490 |
interval = arrayIntervalos[k]; |
492 |
|
|
491 |
|
|
493 | 492 |
ISymbol theSymbol = newSymbol(symbolType, new Color(r, g, b)); |
494 | 493 |
theSymbol.setDescription(NumberFormat.getInstance().format(interval.getMin()) + |
495 | 494 |
" - " + |
... | ... | |
548 | 547 |
throw new Exception(); |
549 | 548 |
} |
550 | 549 |
} catch (Exception e) { |
551 |
JOptionPane.showMessageDialog(this,
|
|
550 |
JOptionPane.showMessageDialog(this, |
|
552 | 551 |
PluginServices.getText(this, "invalid_interval_count_value")); |
553 | 552 |
return null; |
554 | 553 |
} |
555 |
|
|
554 |
|
|
556 | 555 |
try { |
557 |
|
|
556 |
|
|
558 | 557 |
return theLegend.calculateIntervals( |
559 | 558 |
((AlphanumericData) layer).getRecordset(), |
560 | 559 |
(String) cmbField.getSelectedItem(), |
... | ... | |
599 | 598 |
colorChooserPanel.repaint(); |
600 | 599 |
colorChooserPanel1.repaint(); |
601 | 600 |
} else { |
602 |
// Si la capa viene con otro tipo de leyenda, creamos |
|
603 |
// una nueva del tipo que maneja este panel |
|
604 |
theLegend = new VectorialIntervalLegend(); |
|
605 |
theLegend.setShapeType(shapeType); |
|
601 |
// Si la capa viene con otro tipo de leyenda, creamos
|
|
602 |
// una nueva del tipo que maneja este panel
|
|
603 |
theLegend = new VectorialIntervalLegend();
|
|
604 |
theLegend.setShapeType(shapeType);
|
|
606 | 605 |
} |
607 | 606 |
|
608 | 607 |
cmbFieldType.setSelectedIndex(theLegend.getIntervalType()); |
... | ... | |
657 | 656 |
// your settings that are not the set of symbols must be located here |
658 | 657 |
auxLegend.setClassifyingFieldNames( |
659 | 658 |
new String[] {(String) getCmbFields().getSelectedItem()}); |
660 |
|
|
661 |
|
|
662 |
|
|
659 |
|
|
660 |
|
|
661 |
|
|
663 | 662 |
theLegend = auxLegend; |
664 | 663 |
} |
665 | 664 |
|
... | ... | |
668 | 667 |
|
669 | 668 |
/** |
670 | 669 |
* A partir de los registros de la tabla, regenera el FRenderer. (No solo |
671 |
* el symbolList, si no tambi?n el arrayKeys y el defaultRenderer
|
|
670 |
* el symbolList, si no tambi�n el arrayKeys y el defaultRenderer
|
|
672 | 671 |
*/ |
673 | 672 |
private void fillSymbolListFromTable() { |
674 | 673 |
ISymbol theSymbol; |
... | ... | |
711 | 710 |
} |
712 | 711 |
|
713 | 712 |
/** |
714 |
* A?ade la fila y el s?mbolo para el resto de valores no representados.
|
|
713 |
* A�ade la fila y el s�mbolo para el resto de valores no representados.
|
|
715 | 714 |
*/ |
716 | 715 |
private void addDefault() { |
717 | 716 |
|
... | ... | |
725 | 724 |
} |
726 | 725 |
|
727 | 726 |
/** |
728 |
* Elimina la fila de la tabla y el s?mbolo del resto de valores no
|
|
729 |
* representados por ning?n valor.
|
|
727 |
* Elimina la fila de la tabla y el s�mbolo del resto de valores no
|
|
728 |
* representados por ning�n valor.
|
|
730 | 729 |
*/ |
731 | 730 |
private void delDefault() { |
732 | 731 |
auxLegend.delSymbol(new NullIntervalValue()); |
... | ... | |
762 | 761 |
} |
763 | 762 |
} |
764 | 763 |
|
765 |
//A?adir todos los elementos por valor
|
|
764 |
//A�adir todos los elementos por valor
|
|
766 | 765 |
if (e.getActionCommand() == "ADD_ALL_VALUES") { |
767 | 766 |
fillTableValues(); |
768 | 767 |
} |
769 | 768 |
|
770 |
//A?adir un ?nico elemento
|
|
769 |
//A�adir un �nico elemento
|
|
771 | 770 |
if (e.getActionCommand() == "ADD_VALUE") { |
772 | 771 |
try { |
773 | 772 |
symbolTable.addTableRecord(newSymbol( |
... | ... | |
796 | 795 |
} |
797 | 796 |
|
798 | 797 |
public ISymbol getIconSymbol() { |
799 |
if (previewSymbol == null) { |
|
800 |
try { |
|
801 |
previewSymbol = new PictureFillSymbol(); |
|
802 |
previewSymbol.setImage( |
|
803 |
new File( |
|
804 |
this.getClass().getClassLoader(). |
|
805 |
getResource("images/Intervalos.png"). |
|
806 |
getFile())); |
|
798 |
if (previewSymbol == null) { |
|
799 |
try { |
|
800 |
previewSymbol = new PictureFillSymbol(); |
|
801 |
previewSymbol.setImage( new File( |
|
802 |
PluginServices |
|
803 |
.getIconTheme().getURL("vectorial-interval").getFile())); |
|
807 | 804 |
previewSymbol.getMarkerFillProperties(). |
808 | 805 |
setFillStyle( |
809 | 806 |
IMarkerFillPropertiesStyle.SINGLE_CENTERED_SYMBOL); |
810 |
} catch (IOException e) {
|
|
811 |
return null;
|
|
812 |
}
|
|
813 |
}
|
|
814 |
return previewSymbol;
|
|
807 |
} catch (IOException e) {
|
|
808 |
return null;
|
|
809 |
}
|
|
810 |
}
|
|
811 |
return previewSymbol;
|
|
815 | 812 |
} |
816 | 813 |
|
817 | 814 |
public Class getParentClass() { |
Also available in: Unified diff