Revision 24759 branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/legend/gui/VectorialInterval.java
VectorialInterval.java | ||
---|---|---|
61 | 61 |
import javax.swing.JTextField; |
62 | 62 |
|
63 | 63 |
import org.apache.log4j.Logger; |
64 |
import org.gvsig.fmap.data.ReadException; |
|
65 |
import org.gvsig.fmap.data.feature.FeatureAttributeDescriptor; |
|
66 |
import org.gvsig.fmap.data.feature.FeatureStore; |
|
67 |
import org.gvsig.fmap.data.feature.FeatureType; |
|
64 |
import org.gvsig.fmap.dal.DataTypes; |
|
65 |
import org.gvsig.fmap.dal.exception.DataException; |
|
66 |
import org.gvsig.fmap.dal.exception.ReadException; |
|
67 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
68 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
69 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
68 | 70 |
import org.gvsig.fmap.mapcontext.exceptions.LegendLayerException; |
69 | 71 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
70 | 72 |
import org.gvsig.fmap.mapcontext.layers.operations.ClassifiableVectorial; |
... | ... | |
396 | 398 |
|
397 | 399 |
try { |
398 | 400 |
FInterval[] arrayIntervalos = calculateIntervals(); |
399 |
if (arrayIntervalos == null) |
|
400 |
return; |
|
401 |
if (arrayIntervalos == null) { |
|
402 |
return; |
|
403 |
} |
|
401 | 404 |
|
402 | 405 |
FInterval interval; |
403 | 406 |
NumberFormat.getInstance().setMaximumFractionDigits(2); |
... | ... | |
517 | 520 |
intervalCount, |
518 | 521 |
layer.getShapeType() |
519 | 522 |
); |
520 |
} catch (ReadException e) {
|
|
523 |
} catch (DataException e) {
|
|
521 | 524 |
return null; |
522 | 525 |
} |
523 | 526 |
} |
... | ... | |
531 | 534 |
NotificationManager.addError(PluginServices.getText(this, "generating_intervals"), e); |
532 | 535 |
} |
533 | 536 |
|
534 |
if (symbolTable != null) |
|
535 |
pnlCenter.remove(symbolTable); |
|
537 |
if (symbolTable != null) { |
|
538 |
pnlCenter.remove(symbolTable); |
|
539 |
} |
|
536 | 540 |
|
537 | 541 |
getDefaultSymbolPrev(shapeType); |
538 | 542 |
|
... | ... | |
602 | 606 |
|
603 | 607 |
nomFields = new ArrayList(); |
604 | 608 |
|
605 |
String type;
|
|
609 |
int type;
|
|
606 | 610 |
Iterator iterator=((FeatureType)rs.getFeatureTypes().get(0)).iterator(); |
607 | 611 |
while (iterator.hasNext()) { |
608 | 612 |
FeatureAttributeDescriptor descriptor = (FeatureAttributeDescriptor) iterator.next(); |
... | ... | |
615 | 619 |
// continue; |
616 | 620 |
// } |
617 | 621 |
|
618 |
if (type.equals(FeatureAttributeDescriptor.TYPE_INT) || |
|
619 |
type.equals(FeatureAttributeDescriptor.TYPE_DOUBLE) || |
|
620 |
type.equals(FeatureAttributeDescriptor.TYPE_FLOAT) || |
|
621 |
type.equals(FeatureAttributeDescriptor.TYPE_LONG)) { |
|
622 |
nomFields.add(descriptor.getName().trim()); |
|
622 |
if (type == DataTypes.INT || |
|
623 |
type == DataTypes.DOUBLE || |
|
624 |
type == DataTypes.FLOAT || |
|
625 |
type == DataTypes.LONG) |
|
626 |
{ |
|
627 |
nomFields.add(descriptor.getName().trim()); |
|
623 | 628 |
} |
624 | 629 |
} |
625 | 630 |
|
626 | 631 |
// rs.stop(); |
627 |
} catch (ReadException e) {
|
|
632 |
} catch (DataException e) {
|
|
628 | 633 |
NotificationManager.addError(PluginServices.getText(this, "recovering_recordset"), e); |
629 | 634 |
} |
630 | 635 |
|
... | ... | |
639 | 644 |
*/ |
640 | 645 |
public ILegend getLegend() { |
641 | 646 |
fillSymbolListFromTable(); |
642 |
if(defaultSymbolPrev.getSymbol() != null) |
|
647 |
if(defaultSymbolPrev.getSymbol() != null) {
|
|
643 | 648 |
auxLegend.setDefaultSymbol(defaultSymbolPrev.getSymbol()); |
649 |
} |
|
644 | 650 |
|
645 | 651 |
auxLegend.useDefaultSymbol(chkdefaultvalues.isSelected()); |
646 | 652 |
|
... | ... | |
712 | 718 |
rs = ((FLyrVect) layer).getFeatureStore(); |
713 | 719 |
// rs.start(); |
714 | 720 |
FeatureType featureType=rs.getDefaultFeatureType(); |
715 |
auxLegend.setClassifyingFieldTypes(new String[]{((FeatureAttributeDescriptor)featureType.get(featureType.getFieldIndex(fieldName))).getDataType()}); |
|
721 |
auxLegend |
|
722 |
.setClassifyingFieldTypes(new Integer[] { new Integer( |
|
723 |
featureType.getAttributeDescriptor(fieldName) |
|
724 |
.getDataType()) }); |
|
716 | 725 |
logger.debug("rs.start()"); |
717 | 726 |
// rs.stop(); |
718 | 727 |
|
... | ... | |
870 | 879 |
return VectorialIntervalLegend.class; |
871 | 880 |
} |
872 | 881 |
|
873 |
private boolean isNumericField(String fieldType) { |
|
874 |
if (fieldType.equals(FeatureAttributeDescriptor.TYPE_DOUBLE) || |
|
875 |
fieldType.equals(FeatureAttributeDescriptor.TYPE_FLOAT) || |
|
876 |
fieldType.equals(FeatureAttributeDescriptor.TYPE_LONG) || |
|
877 |
fieldType.equals(FeatureAttributeDescriptor.TYPE_INT)){ |
|
882 |
private boolean isNumericField(int fieldType) { |
|
883 |
if (fieldType == DataTypes.DOUBLE || fieldType == DataTypes.FLOAT |
|
884 |
|| fieldType == DataTypes.LONG || fieldType == DataTypes.INT) { |
|
878 | 885 |
return true; |
879 | 886 |
}else{ |
880 | 887 |
return false; |
... | ... | |
912 | 919 |
return true; |
913 | 920 |
} |
914 | 921 |
} |
915 |
} catch (ReadException e) {
|
|
922 |
} catch (DataException e) {
|
|
916 | 923 |
return false; |
917 | 924 |
} |
918 | 925 |
} |
Also available in: Unified diff