Revision 43868 branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/statistics/DefaultStatistics.java
DefaultStatistics.java | ||
---|---|---|
172 | 172 |
int maxCount = statisticsBands.length*3; |
173 | 173 |
for (int i = 0; i < statisticsBands.length; i++) { |
174 | 174 |
status.message("Calculating statistics "+count++ +"/"+maxCount); |
175 |
if (status.isCancelled()) { |
|
176 |
status.abort();
|
|
175 |
if (status.isCancellationRequested()) {
|
|
176 |
status.cancel();
|
|
177 | 177 |
return; |
178 | 178 |
} |
179 | 179 |
if(!statisticsBands[i].isCalculated()){ |
... | ... | |
182 | 182 |
} |
183 | 183 |
for (int i = 0; i < statisticsBands.length; i++) { |
184 | 184 |
status.message("Calculating statistics "+count++ +"/"+maxCount); |
185 |
if (status.isCancelled()) { |
|
186 |
status.abort();
|
|
185 |
if (status.isCancellationRequested()) {
|
|
186 |
status.cancel();
|
|
187 | 187 |
return; |
188 | 188 |
} |
189 | 189 |
for (int j = i; j < statisticsBands.length; j++) { |
... | ... | |
193 | 193 |
status.setIndeterminate(); |
194 | 194 |
for (int i = 0; i < statisticsBands.length; i++) { |
195 | 195 |
status.message("Calculating statistics "+count++ +"/"+maxCount); |
196 |
if (status.isCancelled()) { |
|
197 |
status.abort();
|
|
196 |
if (status.isCancellationRequested()) {
|
|
197 |
status.cancel();
|
|
198 | 198 |
return; |
199 | 199 |
} |
200 | 200 |
for (int j = 0; j < i; j++) { |
... | ... | |
221 | 221 |
status.setRangeOfValues(0, rowCount); |
222 | 222 |
for (int row = 0; row < rowCount; row++) { |
223 | 223 |
status.setCurValue(row); |
224 |
if (status.isCancellationRequested()) { |
|
225 |
status.cancel(); |
|
226 |
return 0; |
|
227 |
} |
|
224 | 228 |
for (int column = 0; column < band1.getColumns(); column++) { |
225 | 229 |
Double v1 = band1.getAsDouble(row, column); |
226 | 230 |
if (v1 != null) { |
... | ... | |
277 | 281 |
|
278 | 282 |
@Override |
279 | 283 |
public String toHTMLString() { |
280 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
284 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
285 |
if( !this.calculated ) { |
|
286 |
return i18n.getTranslation("_Need_calculate_statistics"); |
|
287 |
} |
|
281 | 288 |
|
282 | 289 |
LayerInformationBuilder builder = MapContextLocator.getMapContextManager().createLayerInformationBuilder(); |
283 | 290 |
|
... | ... | |
286 | 293 |
int bandCounter = 0; |
287 | 294 |
for (StatisticsBand statisticsBand : this) { |
288 | 295 |
|
289 |
builder.title().labelkey(i18nManager.getTranslation("_band") + " " + bandCounter);
|
|
296 |
builder.title().labelkey(i18n.getTranslation("_band") + " " + bandCounter); |
|
290 | 297 |
|
291 | 298 |
int dataType = statisticsBand.getDataType(); |
292 | 299 |
builder.property().labelkey("_dataType").value(bufferManager.getBufferTypeName(dataType)); |
... | ... | |
322 | 329 |
|
323 | 330 |
double[] covariance = matrix[bandCounter]; |
324 | 331 |
for (int bandCounter2 = 0; bandCounter2 < covariance.length; bandCounter2++) { |
325 |
builder.property().label(i18nManager.getTranslation("_covariance_with_band") + " " + bandCounter2)
|
|
332 |
builder.property().label(i18n.getTranslation("_covariance_with_band") + " " + bandCounter2) |
|
326 | 333 |
.value(Double.toString(covariance[bandCounter2])); |
327 | 334 |
} |
328 | 335 |
for (int bandCounter2 = 0; bandCounter2 < covariance.length; bandCounter2++) { |
329 | 336 |
Double pearson = covariance[bandCounter2]/(statisticsBand.getVariance()*statisticsBands[bandCounter2].getVariance()); |
330 |
builder.property().label(i18nManager.getTranslation("_pearson_correlation_coefficient_with_band") + " " + bandCounter2)
|
|
337 |
builder.property().label(i18n.getTranslation("_pearson_correlation_coefficient_with_band") + " " + bandCounter2) |
|
331 | 338 |
.value(pearson.isNaN()?"\u2015":pearson.toString()); |
332 | 339 |
} |
333 | 340 |
bandCounter++; |
Also available in: Unified diff