Revision 20779 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/legend/gui/VectorialInterval.java
VectorialInterval.java | ||
---|---|---|
84 | 84 |
import com.iver.cit.gvsig.fmap.rendering.LegendFactory; |
85 | 85 |
import com.iver.cit.gvsig.fmap.rendering.NullIntervalValue; |
86 | 86 |
import com.iver.cit.gvsig.fmap.rendering.VectorialIntervalLegend; |
87 |
import com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend; |
|
87 | 88 |
import com.iver.cit.gvsig.gui.panels.ColorChooserPanel; |
88 | 89 |
|
89 | 90 |
|
... | ... | |
129 | 130 |
*/ |
130 | 131 |
private void initialize() { |
131 | 132 |
this.setLayout(new BorderLayout()); |
132 |
this.setSize(490, 300);
|
|
133 |
this.setSize(700, 350);
|
|
133 | 134 |
this.add(getPnlNorth(), BorderLayout.NORTH); |
134 | 135 |
|
135 | 136 |
this.add(getPnlButtons(), BorderLayout.SOUTH); |
... | ... | |
401 | 402 |
|
402 | 403 |
FInterval interval; |
403 | 404 |
NumberFormat.getInstance().setMaximumFractionDigits(2); |
404 |
theLegend.clear(); |
|
405 |
|
|
405 |
//theLegend.clear(); |
|
406 |
auxLegend.clear(); |
|
407 |
|
|
406 | 408 |
int r; |
407 | 409 |
int g; |
408 | 410 |
int b; |
... | ... | |
413 | 415 |
// Cogemos el tipo de gradaci�n de colores que quiere el usuario y |
414 | 416 |
// Creamos el primer y �ltimo color. |
415 | 417 |
Color startColor = colorChooserPanel.getColor(); |
416 |
theLegend.setStartColor(startColor); |
|
417 |
|
|
418 |
//theLegend.setStartColor(startColor); |
|
419 |
auxLegend.setStartColor(startColor); |
|
420 |
|
|
418 | 421 |
Color endColor = colorChooserPanel1.getColor(); |
419 |
theLegend.setEndColor(endColor); |
|
420 |
|
|
422 |
//theLegend.setEndColor(endColor); |
|
423 |
auxLegend.setEndColor(endColor); |
|
424 |
|
|
421 | 425 |
r = startColor.getRed(); |
422 | 426 |
g = startColor.getGreen(); |
423 | 427 |
b = startColor.getBlue(); |
... | ... | |
506 | 510 |
|
507 | 511 |
try { |
508 | 512 |
|
509 |
return theLegend.calculateIntervals( |
|
513 |
return auxLegend.calculateIntervals( |
|
514 |
//return theLegend.calculateIntervals( |
|
510 | 515 |
((AlphanumericData) layer).getRecordset(), |
511 | 516 |
(String) cmbField.getSelectedItem(), |
512 | 517 |
intervalCount, |
... | ... | |
534 | 539 |
pnlCenter.add(symbolTable); |
535 | 540 |
fillFieldNames(); |
536 | 541 |
|
537 |
if (legend instanceof VectorialIntervalLegend) { |
|
542 |
/* if (legend instanceof VectorialIntervalLegend) {
|
|
538 | 543 |
theLegend = (VectorialIntervalLegend) legend; |
539 | 544 |
getChkDefaultvalues().setSelected(theLegend.isUseDefaultSymbol()); |
540 | 545 |
cmbField.getModel().setSelectedItem(theLegend.getClassifyingFieldNames()[0]); |
... | ... | |
551 | 556 |
theLegend.setShapeType(shapeType); |
552 | 557 |
} |
553 | 558 |
|
559 |
|
|
554 | 560 |
cmbFieldType.setSelectedIndex(theLegend.getIntervalType()); |
561 |
*/ |
|
562 |
if (VectorialIntervalLegend.class.equals(legend.getClass())) { |
|
563 |
auxLegend = (VectorialIntervalLegend) legend; |
|
564 |
getChkDefaultvalues().setSelected(auxLegend.isUseDefaultSymbol()); |
|
565 |
cmbField.getModel().setSelectedItem(auxLegend.getClassifyingFieldNames()[0]); |
|
566 |
symbolTable.fillTableFromSymbolList(auxLegend.getSymbols(), |
|
567 |
auxLegend.getValues(), auxLegend.getDescriptions()); |
|
568 |
colorChooserPanel.setColor(auxLegend.getStartColor()); |
|
569 |
colorChooserPanel1.setColor(auxLegend.getEndColor()); |
|
570 |
colorChooserPanel.repaint(); |
|
571 |
colorChooserPanel1.repaint(); |
|
572 |
} else { |
|
573 |
// Si la capa viene con otro tipo de leyenda, creamos |
|
574 |
// una nueva del tipo que maneja este panel |
|
575 |
auxLegend = new VectorialIntervalLegend(); |
|
576 |
auxLegend.setShapeType(shapeType); |
|
577 |
} |
|
578 |
|
|
579 |
cmbFieldType.setSelectedIndex(auxLegend.getIntervalType()); |
|
555 | 580 |
} |
556 | 581 |
|
557 | 582 |
|
... | ... | |
596 | 621 |
/** |
597 | 622 |
* @see com.iver.cit.gvsig.gui.legendmanager.panels.ILegendPanel#getLegend() |
598 | 623 |
*/ |
624 |
public ILegend getLegend() { |
|
625 |
fillSymbolListFromTable(); |
|
626 |
theLegend = auxLegend; |
|
627 |
return theLegend; |
|
628 |
} |
|
629 |
/* |
|
599 | 630 |
public ILegend getLegend() { |
600 | 631 |
fillSymbolListFromTable(); |
601 | 632 |
|
... | ... | |
610 | 641 |
} |
611 | 642 |
|
612 | 643 |
return theLegend; |
613 |
} |
|
644 |
}*/
|
|
614 | 645 |
|
615 | 646 |
/** |
616 | 647 |
* A partir de los registros de la tabla, regenera el FRenderer. (No solo |
617 | 648 |
* el symbolList, si no tambi�n el arrayKeys y el defaultRenderer |
618 | 649 |
*/ |
619 |
private void fillSymbolListFromTable() { |
|
650 |
/*private void fillSymbolListFromTable() {
|
|
620 | 651 |
ISymbol theSymbol; |
621 | 652 |
IInterval theInterval = null; |
622 | 653 |
|
... | ... | |
641 | 672 |
} |
642 | 673 |
|
643 | 674 |
} |
644 |
} |
|
675 |
}*/ |
|
676 |
private void fillSymbolListFromTable() { |
|
677 |
ISymbol theSymbol; |
|
678 |
IInterval theInterval = null; |
|
645 | 679 |
|
680 |
// Borramos las anteriores listas: |
|
681 |
auxLegend.clear(); |
|
682 |
|
|
683 |
String fieldName = (String) cmbField.getSelectedItem(); |
|
684 |
auxLegend.setClassifyingFieldNames(new String[] {fieldName}); |
|
685 |
|
|
686 |
DataSource rs; |
|
687 |
try { |
|
688 |
|
|
689 |
rs = ((AlphanumericData) layer).getRecordset(); |
|
690 |
rs.start(); |
|
691 |
auxLegend.setClassifyingFieldTypes(new int[] {rs.getFieldType(rs.getFieldIndexByName(fieldName))}); |
|
692 |
logger.debug("rs.start()"); |
|
693 |
rs.stop(); |
|
694 |
|
|
695 |
} catch (ReadDriverException e) { |
|
696 |
NotificationManager.addError(PluginServices.getText(this, "recovering_recordset"), e); |
|
697 |
} |
|
698 |
|
|
699 |
|
|
700 |
|
|
701 |
for (int row = 0; row < symbolTable.getRowCount(); row++) { |
|
702 |
if (!(symbolTable.getFieldValue(row, 1) instanceof FInterval)) { |
|
703 |
theSymbol = (ISymbol) symbolTable.getFieldValue(row, 0); |
|
704 |
theSymbol.setDescription((String) symbolTable.getFieldValue( |
|
705 |
row, 2)); |
|
706 |
auxLegend.addSymbol(new NullIntervalValue(), theSymbol); |
|
707 |
} else { |
|
708 |
theInterval = (IInterval) symbolTable.getFieldValue(row, 1); |
|
709 |
theSymbol = (ISymbol) symbolTable.getFieldValue(row, 0); |
|
710 |
theSymbol.setDescription((String) symbolTable.getFieldValue( |
|
711 |
row, 2)); |
|
712 |
auxLegend.addSymbol(theInterval, theSymbol); |
|
713 |
} |
|
714 |
|
|
715 |
} |
|
716 |
} |
|
717 |
|
|
646 | 718 |
/** |
647 | 719 |
* This method initializes panelC |
648 | 720 |
* |
... | ... | |
697 | 769 |
System.out.println("Nombre del campo: " + fieldName); |
698 | 770 |
symbolTable.removeAllItems(); |
699 | 771 |
|
700 |
theLegend.setClassifyingFieldNames(new String[] {fieldName}); |
|
772 |
//theLegend.setClassifyingFieldNames(new String[] {fieldName}); |
|
773 |
auxLegend.setClassifyingFieldNames(new String[] {fieldName}); |
|
701 | 774 |
} else if (e.getActionCommand() == "INTERVAL_TYPE") { |
702 | 775 |
JComboBox cb = (JComboBox) e.getSource(); |
703 | 776 |
|
704 |
if ((theLegend != null) && |
|
705 |
(cb.getSelectedIndex() != theLegend.getIntervalType())) { |
|
706 |
theLegend.setIntervalType(cb.getSelectedIndex()); |
|
777 |
//if ((theLegend != null) && |
|
778 |
if ((auxLegend != null) && |
|
779 |
// (cb.getSelectedIndex() != theLegend.getIntervalType())) { |
|
780 |
(cb.getSelectedIndex() != auxLegend.getIntervalType())) { |
|
781 |
//theLegend.setIntervalType(cb.getSelectedIndex()); |
|
782 |
auxLegend.setIntervalType(cb.getSelectedIndex()); |
|
707 | 783 |
symbolTable.removeAllItems(); |
708 | 784 |
} |
709 | 785 |
} |
Also available in: Unified diff