Revision 10996
trunk/libraries/libRaster/src/org/gvsig/raster/dataaccess/buffer/RasterMemoryBuffer.java | ||
---|---|---|
31 | 31 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
32 | 32 |
* |
33 | 33 |
*/ |
34 |
public class RasterMemoryBuffer extends RasterBuffer implements IBuffer {
|
|
34 |
public class RasterMemoryBuffer extends RasterBuffer { |
|
35 | 35 |
private ByteBand[] byteBuf = null; |
36 | 36 |
private ShortBand[] shortBuf = null; |
37 | 37 |
private IntBand[] intBuf = null; |
... | ... | |
1269 | 1269 |
} |
1270 | 1270 |
} |
1271 | 1271 |
|
1272 |
/* |
|
1273 |
* (non-Javadoc) |
|
1274 |
* @see org.gvsig.raster.driver.datasetproperties.IHistogramable#getPercent() |
|
1275 |
*/ |
|
1276 |
public int getPercent() { |
|
1277 |
return super.percent; |
|
1278 |
} |
|
1279 | 1272 |
|
1280 | 1273 |
} |
trunk/libraries/libRaster/src/org/gvsig/raster/dataaccess/buffer/RasterBuffer.java | ||
---|---|---|
381 | 381 |
return null; |
382 | 382 |
Histogram hist = new Histogram(getBandCount(), 256); |
383 | 383 |
for (int iBand = 0; iBand < getBandCount(); iBand++) |
384 |
for (int row = 0; row < getHeight(); row++) |
|
384 |
for (int row = 0; row < getHeight(); row++) {
|
|
385 | 385 |
for (int col = 0; col < getWidth(); col++) |
386 | 386 |
hist.incrementPxValue(iBand, (getElemByte(row, col, iBand) & 0xff)); |
387 |
percent = ((iBand*getHeight() + row) * 100) /(getHeight() * getBandCount()); |
|
388 |
} |
|
387 | 389 |
percent = 100; |
388 | 390 |
return hist; |
389 | 391 |
} |
... | ... | |
412 | 414 |
} |
413 | 415 |
return hist; |
414 | 416 |
} |
417 |
|
|
418 |
public int getPercent() { |
|
419 |
return percent; |
|
420 |
} |
|
415 | 421 |
} |
trunk/libraries/libRaster/src/org/gvsig/raster/dataaccess/cache/RasterReadOnlyHugeBuffer.java | ||
---|---|---|
17 | 17 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
18 | 18 |
* |
19 | 19 |
*/ |
20 |
public class RasterReadOnlyHugeBuffer extends RasterBuffer implements IBuffer {
|
|
20 |
public class RasterReadOnlyHugeBuffer extends RasterBuffer { |
|
21 | 21 |
private Cache cache = null; |
22 | 22 |
private LRUAlgorithm lru = null; |
23 | 23 |
|
... | ... | |
577 | 577 |
public void assignBandToNotValid(int iBand) { |
578 | 578 |
|
579 | 579 |
} |
580 |
|
|
581 |
public int getPercent() { |
|
582 |
return super.percent; |
|
583 |
} |
|
584 | 580 |
|
585 |
} |
|
581 |
} |
trunk/libraries/libRaster/src/org/gvsig/raster/dataaccess/cache/RasterCache.java | ||
---|---|---|
47 | 47 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
48 | 48 |
* |
49 | 49 |
*/ |
50 |
public class RasterCache extends RasterBuffer implements IBuffer {
|
|
50 |
public class RasterCache extends RasterBuffer { |
|
51 | 51 |
|
52 | 52 |
private Cache cache = null; |
53 | 53 |
private LRUAlgorithm lru = null; |
... | ... | |
778 | 778 |
break; |
779 | 779 |
} |
780 | 780 |
} |
781 |
|
|
782 |
public int getPercent() { |
|
783 |
return super.percent; |
|
784 |
} |
|
785 | 781 |
} |
trunk/libraries/libRaster/src/org/gvsig/raster/util/Histogram.java | ||
---|---|---|
126 | 126 |
* Devuelve el histograma acumulado |
127 | 127 |
* @return |
128 | 128 |
*/ |
129 |
|
|
129 | 130 |
public long[][] getAccumulatedHistogram() { |
130 |
if(histogram != null){ |
|
131 |
if (histogram != null){
|
|
131 | 132 |
long[][] hist = new long[histogram.length][histogram[0].length]; |
132 | 133 |
for (int iBand = 0; iBand < hist.length; iBand++) { |
133 |
for (int j = 0; j < hist[iBand].length; j++) { |
|
134 |
if(j == 0) |
|
135 |
hist[iBand][j] = histogram[iBand][j]; |
|
136 |
else |
|
137 |
hist[iBand][j] += histogram[iBand][j - 1]; |
|
134 |
hist[iBand][0] = histogram[iBand][0]; |
|
135 |
for (int j = 1; j < hist[iBand].length; j++) { |
|
136 |
hist[iBand][j] = hist[iBand][j - 1] + histogram[iBand][j]; |
|
138 | 137 |
} |
139 | 138 |
} |
139 |
return hist; |
|
140 | 140 |
} |
141 | 141 |
return null; |
142 | 142 |
} |
trunk/libraries/libRaster/src/org/gvsig/raster/dataset/RasterDataset.java | ||
---|---|---|
815 | 815 |
return histogram; |
816 | 816 |
} |
817 | 817 |
|
818 |
public int getPercent() { |
|
819 |
return histogram.getPercent(); |
|
820 |
} |
|
818 | 821 |
} |
trunk/libraries/libRaster/src/org/gvsig/raster/dataset/properties/DatasetHistogram.java | ||
---|---|---|
50 | 50 |
*/ |
51 | 51 |
private RasterDataset dataset = null; |
52 | 52 |
|
53 |
private int percent = 0; |
|
54 |
|
|
53 | 55 |
/** |
54 | 56 |
* Constructor |
55 | 57 |
* @param dataset |
... | ... | |
103 | 105 |
* @return histograma |
104 | 106 |
*/ |
105 | 107 |
private Histogram getHistogramByValue() throws InvalidSetViewException, FileNotOpenException, RasterDriverException { |
108 |
percent = 0; |
|
106 | 109 |
if(dataset.getDataType() != IBuffer.TYPE_BYTE) |
107 | 110 |
return null; |
108 | 111 |
|
... | ... | |
112 | 115 |
byte[] bLine = (byte[])obj; |
113 | 116 |
for (int k = 0; k < bLine.length; k++) |
114 | 117 |
histogram.incrementPxValue(band, (bLine[k] & 0xff)); |
118 |
percent = ((band * dataset.getHeight() + line) * 100) / (dataset.getBandCount() * dataset.getHeight()); |
|
115 | 119 |
} |
116 | 120 |
} |
121 |
percent = 100; |
|
117 | 122 |
return histogram; |
118 | 123 |
} |
119 | 124 |
|
... | ... | |
170 | 175 |
} |
171 | 176 |
return histogram; |
172 | 177 |
} |
178 |
|
|
179 |
public int getPercent() { |
|
180 |
return percent; |
|
181 |
} |
|
173 | 182 |
} |
trunk/libraries/libRaster/src/org/gvsig/raster/dataset/properties/DatasetListHistogram.java | ||
---|---|---|
38 | 38 |
* clases en las que se divide el histograma |
39 | 39 |
*/ |
40 | 40 |
private DataClassList classes = null; |
41 |
|
|
41 | 42 |
/** |
42 | 43 |
* Histograma de la imagen completa |
43 | 44 |
*/ |
... | ... | |
102 | 103 |
return null; |
103 | 104 |
} |
104 | 105 |
|
106 |
public int getPercent() { |
|
107 |
int percent = 0; |
|
108 |
for (int i = 0; i < multiDataset.getDatasetCount(); i++) { |
|
109 |
percent += multiDataset.getDataset(i).getPercent(); |
|
110 |
} |
|
111 |
percent = percent / multiDataset.getDatasetCount(); |
|
112 |
return percent; |
|
113 |
} |
|
105 | 114 |
} |
trunk/libraries/libRaster/src/org/gvsig/raster/dataset/RasterMultiDataset.java | ||
---|---|---|
54 | 54 |
private ArrayList palettes = new ArrayList(); |
55 | 55 |
private DatasetListStatistics stats = null; |
56 | 56 |
private DatasetListHistogram histogram = null; |
57 |
int percent = 0; |
|
58 | 57 |
|
59 | 58 |
//TODO: FUNCIONALIDAD: Contructores igual a RasterDataset + String[] nameFiles |
60 | 59 |
public RasterMultiDataset(String name){ |
... | ... | |
826 | 825 |
* @see org.gvsig.raster.driver.datasetproperties.IHistogramable#getHistogram() |
827 | 826 |
*/ |
828 | 827 |
public Histogram getHistogram() throws HistogramException { |
829 |
percent = 0; |
|
830 | 828 |
if(histogram == null) |
831 | 829 |
histogram = new DatasetListHistogram(this); |
832 | 830 |
|
833 | 831 |
try { |
834 | 832 |
Histogram tmp = histogram.getHistogram(); |
835 |
percent = 100; |
|
836 | 833 |
return tmp; |
837 | 834 |
} catch (FileNotOpenException e) { |
838 | 835 |
throw new HistogramException("FileNotOpenException"); |
... | ... | |
863 | 860 |
* @see org.gvsig.raster.util.IHistogramable#getPercent() |
864 | 861 |
*/ |
865 | 862 |
public int getPercent() { |
866 |
return percent; |
|
863 |
if (histogram != null) |
|
864 |
return histogram.getPercent(); |
|
865 |
return 0; |
|
867 | 866 |
} |
868 | 867 |
|
869 | 868 |
} |
Also available in: Unified diff