Revision 5486 org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/DefaultBuffer.java
DefaultBuffer.java | ||
---|---|---|
28 | 28 |
import org.gvsig.raster.lib.buffer.api.statistics.Histogram; |
29 | 29 |
import org.gvsig.raster.lib.buffer.api.statistics.Statistics; |
30 | 30 |
import org.gvsig.raster.lib.buffer.impl.exceptions.CreateBufferException; |
31 |
import org.gvsig.raster.lib.buffer.impl.statistics.DefaultStatistics; |
|
31 | 32 |
import org.gvsig.tools.task.SimpleTaskStatus; |
32 | 33 |
|
33 | 34 |
|
... | ... | |
46 | 47 |
private FilterList filters; |
47 | 48 |
private IProjection projection; |
48 | 49 |
private BandPageManager bandPageManager; |
50 |
private Statistics statistics; |
|
49 | 51 |
|
50 |
|
|
51 |
|
|
52 |
|
|
53 | 52 |
/** |
54 |
* @author fdiaz |
|
55 |
* |
|
56 |
*/ |
|
57 |
public class BandsIterator implements Iterator<Band> { |
|
58 |
|
|
59 |
private Band band; |
|
60 |
private int current; |
|
61 |
|
|
62 |
/** |
|
63 |
* |
|
64 |
*/ |
|
65 |
public BandsIterator() { |
|
66 |
this.current = 0; |
|
67 |
if( getBandCount()>0 ) { |
|
68 |
this.band = (Band) getBand(0); |
|
69 |
} else { |
|
70 |
this.band = null; |
|
71 |
} |
|
72 |
} |
|
73 |
|
|
74 |
@Override |
|
75 |
public boolean hasNext() { |
|
76 |
return this.current < getBandCount() ; |
|
77 |
} |
|
78 |
|
|
79 |
@Override |
|
80 |
public Band next() { |
|
81 |
this.current++; |
|
82 |
return this.band; |
|
83 |
} |
|
84 |
|
|
85 |
@Override |
|
86 |
public void remove() { |
|
87 |
throw new UnsupportedOperationException("Not supported yet."); |
|
88 |
} |
|
89 |
} |
|
90 |
|
|
91 |
|
|
92 |
/** |
|
93 | 53 |
* @param rows |
94 | 54 |
* @param columns |
95 | 55 |
* @param bandDataTypes |
... | ... | |
132 | 92 |
@Override |
133 | 93 |
public Histogram getHistogram(SimpleTaskStatus status) { |
134 | 94 |
// TODO Auto-generated method stub |
135 |
return null;
|
|
95 |
return getStatistics(status).getHistogram();
|
|
136 | 96 |
} |
137 | 97 |
|
138 | 98 |
@Override |
139 | 99 |
public Statistics getStatistics(SimpleTaskStatus status) { |
140 |
// TODO Auto-generated method stub |
|
141 |
return null; |
|
100 |
if(statistics == null){ |
|
101 |
statistics = new DefaultStatistics(bands); |
|
102 |
} |
|
103 |
if(!statistics.isCalculated()){ |
|
104 |
statistics.calculate(status); //scale ??? |
|
105 |
} |
|
106 |
return statistics; |
|
142 | 107 |
} |
143 | 108 |
|
144 | 109 |
@Override |
... | ... | |
294 | 259 |
return bandPageManager!=null; |
295 | 260 |
} |
296 | 261 |
|
262 |
/** |
|
263 |
* @author fdiaz |
|
264 |
* |
|
265 |
*/ |
|
266 |
public class BandsIterator implements Iterator<Band> { |
|
267 |
|
|
268 |
private Band band; |
|
269 |
private int current; |
|
270 |
|
|
271 |
/** |
|
272 |
* |
|
273 |
*/ |
|
274 |
public BandsIterator() { |
|
275 |
this.current = 0; |
|
276 |
if( getBandCount()>0 ) { |
|
277 |
this.band = (Band) getBand(0); |
|
278 |
} else { |
|
279 |
this.band = null; |
|
280 |
} |
|
281 |
} |
|
282 |
|
|
283 |
@Override |
|
284 |
public boolean hasNext() { |
|
285 |
return this.current < getBandCount() ; |
|
286 |
} |
|
287 |
|
|
288 |
@Override |
|
289 |
public Band next() { |
|
290 |
this.current++; |
|
291 |
return this.band; |
|
292 |
} |
|
293 |
|
|
294 |
@Override |
|
295 |
public void remove() { |
|
296 |
throw new UnsupportedOperationException("Not supported yet."); |
|
297 |
} |
|
298 |
} |
|
297 | 299 |
} |
Also available in: Unified diff