Revision 1916

View differences:

org.gvsig.raster.tools/trunk/templates/examples/org.gvsig.raster.roimask/org.gvsig.raster.roimask.algorithm/src/main/java/org/gvsig/raster/roimask/algorithm/ROIMaskProcess.java
97 97
			if (store == null)
98 98
				throw new ROIMaskException("...");
99 99
			
100
			Extent windowExtent = testExtent != null ? testExtent : store.getExtent();
101
			int w = testExtent != null ? testWidth : (int)store.getWidth();
102
			int h = testExtent != null ? testHeight : (int)store.getHeight();
100
			Extent windowExtent = store.getExtent();
101
			int w = (int)store.getWidth();
102
			int h = (int)store.getHeight();
103
			double cellSize = store.getCellSize();
104
			
105
			if(testExtent != null) {
106
				windowExtent = testExtent;
107
				w = testWidth;
108
				h = testHeight;
109
				cellSize = testExtent.width() / w;
110
			}
103 111

  
104 112
			RasterQuery query = RasterLocator.getManager().createQuery();
105 113
			query.setAllDrawableBands();
......
116 124

  
117 125
			bufferForTest = sourceBuffer;
118 126
			
119
			double cellsize = testExtent != null ? testExtent.width() / testWidth : store.getCellSize();
120
			
121 127
			if(rois != null && rois.length > 0) {
122 128
				if(store.getDataType()[0] == Buffer.TYPE_BYTE) {
123
					processRGB(windowExtent, w, h, cellsize);
129
					processRGB(windowExtent, w, h, cellSize);
124 130
				} else {
125
					bufferForTest = processMDT(windowExtent, sourceBuffer, cellsize);
131
					bufferForTest = processMDT(windowExtent, sourceBuffer, cellSize);
126 132
				}
127 133
			} 
128 134
			
......
130 136
				super.exportRaster(filename, 
131 137
						bufferForTest, 
132 138
						alphaBand,
133
						store.getCellSize(), 
139
						cellSize, 
134 140
						windowExtent.getULX(), 
135 141
						windowExtent.getULY());
136 142
			}

Also available in: Unified diff