Revision 43162

View differences:

branches/org.gvsig.desktop-2.0.166-SP/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/main/java/org/gvsig/fmap/dal/store/jdbc2/spi/JDBCStoreProviderBase.java
92 92
    public class EnvelopeValue implements CalculatedValue<Envelope> {
93 93
        
94 94
        private Envelope value = null;
95
        private boolean needCalculate = true;
95 96

  
96 97
        @Override
97 98
        public void calculate() {
98 99
            try {
100
                value = null;
99 101
                String columnName = getFeatureStore()
100 102
                        .getDefaultFeatureType()
101 103
                        .getDefaultGeometryAttributeName();
104
                if( columnName==null ) {
105
                    return;
106
                }
102 107
                IProjection crs = getFeatureStore()
103 108
                        .getDefaultFeatureType()
104 109
                        .getDefaultSRS();
......
115 120
                        crs
116 121
                    );
117 122
                value = (Envelope) calculateEnvelopeOfColumn.perform();
123
                
118 124
            } catch(Exception ex) {
119 125
                throw new RuntimeException("Can't calculate envelope.", ex);
126
            } finally {
127
               needCalculate = false;
120 128
            }
121 129
        }
122 130
        
123 131
        @Override
124 132
        public void reset() {
125 133
            this.value = null;
134
            this.needCalculate = true;
126 135
        }
127 136
        
128 137
        @Override
129 138
        public Envelope get() {
130
            if( this.value == null ) {
139
            if( needCalculate ) {
131 140
                this.calculate();
132 141
            }
133 142
            return this.value;

Also available in: Unified diff