Revision 374

View differences:

org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.io/org.gvsig.raster.io.base/src/main/java/org/gvsig/fmap/dal/coverage/dataset/io/wcs/WCSProvider.java
68 68
import org.gvsig.raster.impl.store.DefaultStoreFactory;
69 69
import org.gvsig.raster.impl.store.properties.DataStoreColorInterpretation;
70 70
import org.gvsig.raster.impl.store.properties.DataStoreTransparency;
71
import org.gvsig.raster.impl.store.properties.RemoteDataStoreStatistics;
71 72
import org.gvsig.remoteclient.wcs.WCSStatus;
72 73
import org.gvsig.tools.ToolsLocator;
73 74
import org.gvsig.tools.extensionpoint.ExtensionPoint;
......
177 178
		
178 179
		//Temporal hastq que sepamos el tipo de dato y n?mero de bandas
179 180
		mustTileRequest = false;
181
		
182
		stats = new RemoteDataStoreStatistics(this);
180 183
	}
181 184
	
182 185
	public static final WCSConnector getConnectorFromURL(URL url) throws IOException {
......
657 660
			int bufWidth, int bufHeight, BandList bandList, Buffer rasterBuf, boolean adjustToExtent) throws ProcessInterruptedException, RasterDriverException {
658 661
		WCSDataParametersImpl p = (WCSDataParametersImpl)parameters;
659 662
		Rectangle2D bBox = null;
663
		p.setWidth(bufWidth);
664
		p.setHeight(bufHeight);
660 665
		
661
		if(p.getExtent() != null) {
666
		/*if(p.getExtent() != null) {
662 667
			bBox = p.getExtent();
663 668
			extent = new ExtentImpl(p.getExtent());
664
		} else {
669
		} else {*/
665 670
			bBox = extent.toRectangle2D();
666
		}
671
		//}
667 672
		
668 673
		//extent.toRectangle2D();//new Rectangle2D.Double(ulx, lry, Math.abs(lrx - ulx), Math.abs(lry - uly));
669 674
		WCSStatus wcsStatus = loadWCSStatus(bBox);
......
920 925
		return lastRequest;
921 926
	}
922 927
	
928
	/*
929
	 * (non-Javadoc)
930
	 * @see org.gvsig.raster.impl.provider.RemoteRasterProvider#getBufferLastRequest()
931
	 */
932
	public Buffer getBufferLastRequest() throws ProcessInterruptedException, RasterDriverException {
933
		try {
934
			GdalProvider driver = new GdalProvider(lastRequest.getPath());
935
			
936
			BandList bandList = new BandListImpl();
937
			for (int i = 0; i < driver.getBandCount(); i++) {
938
				try {
939
					bandList.addBand(new DatasetBandImpl(lastRequest.getPath(), i, Buffer.TYPE_BYTE, 3), i);
940
				} catch (BandNotFoundInListException e1) {
941
				}
942
			}
943
			bandList.setDrawableBands(new int[]{0, 1, 2});
944
			Buffer newBuffer = DefaultRasterManager.getInstance().createBuffer(driver.getDataType()[0], (int)driver.getWidth(), (int)driver.getHeight(), driver.getBandCount(), true); 
945
			Buffer buf = driver.getWindow(driver.getExtent(), 
946
										(int)driver.getWidth(), 
947
										(int)driver.getHeight(), 
948
										bandList, 
949
										newBuffer, 
950
										true);
951
			driver.close();
952
			return buf;
953
		} catch (NotSupportedExtensionException e) {
954
			throw new RasterDriverException("Error building GdalDriver", e);
955
		}
956
	}
957
	
923 958
	/**
924 959
	 * ASigna el par?metro de inicializaci?n del driver.
925 960
	 */
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.impl/src/main/java/org/gvsig/raster/util/DefaultRasterUtils.java
23 23

  
24 24
import java.awt.Dimension;
25 25
import java.awt.geom.AffineTransform;
26
import java.awt.geom.Dimension2D;
27 26
import java.awt.geom.NoninvertibleTransformException;
28 27
import java.awt.geom.Point2D;
29 28
import java.awt.geom.Rectangle2D;
......
552 551
	 * (non-Javadoc)
553 552
	 * @see org.gvsig.fmap.dal.coverage.util.RasterUtils#calculateAdjustedView(org.gvsig.fmap.dal.coverage.datastruct.Extent, java.awt.geom.AffineTransform, java.awt.geom.Dimension2D)
554 553
	 */
555
	public Extent calculateAdjustedView(Extent extToAdj, AffineTransform at, Dimension2D dim) {
554
	public Extent calculateAdjustedView(Extent extToAdj, AffineTransform at, double w, double h) {
556 555
			// Obtenemos los cuatro puntos de la petici?n de origen
557 556
		Point2D ul = new Point2D.Double(extToAdj.getULX(), extToAdj.getULY());
558 557
		Point2D lr = new Point2D.Double(extToAdj.getLRX(), extToAdj.getLRY());
......
568 567
		// Ajustamos a la dimensi?n del raster en pixeles
569 568
		if (ul.getX() < 0)
570 569
			ul.setLocation(0, ul.getY());
571
		if (ul.getX() >= dim.getWidth())
572
			ul.setLocation(dim.getWidth(), ul.getY());
570
		if (ul.getX() >= w)
571
			ul.setLocation(w, ul.getY());
573 572
		if (ul.getY() < 0)
574 573
			ul.setLocation(ul.getX(), 0);
575
		if (ul.getY() >= dim.getHeight())
576
			ul.setLocation(ul.getX(), dim.getHeight());
574
		if (ul.getY() >= h)
575
			ul.setLocation(ul.getX(), h);
577 576

  
578 577
		if (lr.getX() < 0)
579 578
			lr.setLocation(0, lr.getY());
580
		if (lr.getX() >= dim.getWidth())
581
			lr.setLocation(dim.getWidth(), lr.getY());
579
		if (lr.getX() >= w)
580
			lr.setLocation(w, lr.getY());
582 581
		if (lr.getY() < 0)
583 582
			lr.setLocation(lr.getX(), 0);
584
		if (lr.getY() >= dim.getHeight())
585
			lr.setLocation(lr.getX(), dim.getHeight());
583
		if (lr.getY() >= h)
584
			lr.setLocation(lr.getX(), h);
586 585

  
587 586
		// Lo convertimos a coordenadas reales nuevamente
588 587
		at.transform(ul, ul);
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.impl/src/main/java/org/gvsig/raster/impl/provider/DefaultRasterProvider.java
107 107
	/**
108 108
	 * Flags que representan a las bandas visualizables
109 109
	 */
110
	public static final int                 RED_BAND               = 0x01;
111
	public static final int                 GREEN_BAND             = 0x02;
112
	public static final int                 BLUE_BAND              = 0x04;
113
	public static final int                 ALPHA_BAND             = 0x08;
110
	public static final int                   RED_BAND               = 0x01;
111
	public static final int                   GREEN_BAND             = 0x02;
112
	public static final int                   BLUE_BAND              = 0x04;
113
	public static final int                   ALPHA_BAND             = 0x08;
114 114
	
115
	protected int                           bandCount              = 1;
116
	private int[]                           dataType               = null;
117
	protected double                        noData                 = 0;
118
	protected String                        wktProjection          = "";
115
	protected int                             bandCount              = 1;
116
	private int[]                             dataType               = null;
117
	protected double                          noData                 = 0;
118
	protected String                          wktProjection          = "";
119 119

  
120
	protected DataStoreStatistics           stats                  = new DataStoreStatistics(this);
121
	protected RasterProviderHistogramComputer            histogram              = null;
122
	protected DataStoreParameters           param                  = null;
123
	protected RmfBlocksManager              rmfBlocksManager       = null;
124
	protected ColorTable                    colorTable             = null;
125
	protected DataStoreColorInterpretation  colorInterpretation    = null;
120
	protected DataStoreStatistics             stats                  = new DataStoreStatistics(this);
121
	protected RasterProviderHistogramComputer histogram              = null;
122
	protected DataStoreParameters             param                  = null;
123
	protected RmfBlocksManager                rmfBlocksManager       = null;
124
	protected ColorTable                      colorTable             = null;
125
	protected DataStoreColorInterpretation    colorInterpretation    = null;
126 126

  
127 127
	/**
128 128
	 * Indica si el valor NoData esta activo
129 129
	 */
130
	protected boolean                       noDataEnabled          = false;
131
	protected FileUtils                     fileUtil               = RasterLocator.getManager().getFileUtils();
132
	protected RasterUtils                   rasterUtil             = RasterLocator.getManager().getRasterUtils();
130
	protected boolean                         noDataEnabled          = false;
131
	protected FileUtils                       fileUtil               = RasterLocator.getManager().getFileUtils();
132
	protected RasterUtils                     rasterUtil             = RasterLocator.getManager().getRasterUtils();
133 133
	
134
	protected IProjection                   proj                   = null;
135
	protected long                          fileSize               = 0;
136
	protected long                          bytesReaded            = 0;
137
	protected long                          lineCnt                = 0;
138
	protected String                        name;
139
	protected boolean                       mustTileRequest        = false;
134
	protected IProjection                     proj                   = null;
135
	protected long                            fileSize               = 0;
136
	protected long                            bytesReaded            = 0;
137
	protected long                            lineCnt                = 0;
138
	protected String                          name;
139
	protected boolean                         mustTileRequest        = false;
140 140
	
141 141
	/**
142 142
	 * Transformaci?n creada a partir de la informaci?n de georreferencia de la
143 143
	 * propia imagen. Esta informaci?n est? en la cabecera o en ficheros
144 144
	 * worldfile.
145 145
	 */
146
	protected AffineTransform               ownTransformation      = null;
146
	protected AffineTransform                 ownTransformation      = null;
147 147
	/**
148 148
	 * Transformaci?n asignada de forma externa, bien desde el fichero rmf o
149 149
	 * asignada directamente por el usuario.
150 150
	 */
151
	protected AffineTransform               externalTransformation = null;
151
	protected AffineTransform                 externalTransformation = null;
152 152
	
153 153
	public DefaultRasterProvider(AbstractRasterDataParameters params,
154 154
			DataStoreProviderServices storeServices, DynObject metadata) {
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.impl/src/main/java/org/gvsig/raster/impl/provider/RemoteRasterProvider.java
24 24
import java.awt.geom.Rectangle2D;
25 25
import java.io.File;
26 26

  
27
import org.gvsig.fmap.dal.coverage.dataset.Buffer;
28
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException;
27 29
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException;
28 30
import org.gvsig.fmap.dal.coverage.exception.RemoteServiceException;
29 31

  
......
59 61
	 */
60 62
	public File getLastRequest();
61 63
	
64
	/**
65
	 * Gets the buffer of the last request. Be careful because 
66
	 * if a complete request is tiled, this file will only contain
67
	 * the last tile. 
68
	 * @return
69
	 * @throws RasterDriverException 
70
	 * @throws ProcessInterruptedException 
71
	 */
72
	public Buffer getBufferLastRequest() throws ProcessInterruptedException, RasterDriverException;
73
	
62 74
}
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.impl/src/main/java/org/gvsig/raster/impl/store/AbstractRasterDataStore.java
21 21
 */
22 22
package org.gvsig.raster.impl.store;
23 23

  
24
import java.awt.Dimension;
25 24
import java.awt.geom.Point2D;
26 25
import java.awt.geom.Rectangle2D;
27 26
import java.util.Iterator;
......
244 243
		step = null;
245 244
		dataExtent = new ExtentImpl(x, y, x + w, y - h);
246 245

  
247
		Extent adjustedDataExtent = util.calculateAdjustedView(dataExtent, getAffineTransform(), new Dimension((int)getWidth(), (int)getHeight()));
246
		Extent adjustedDataExtent = util.calculateAdjustedView(dataExtent, getAffineTransform(), getWidth(), getHeight());
248 247
		
249 248
		return getWindow(adjustedDataExtent.getMin().getX(), adjustedDataExtent.getMax().getY(), adjustedDataExtent.width(), adjustedDataExtent.height(), currentQuery.isAdjustToExtent());
250 249
	}
......
275 274
		throws RasterDriverException, InvalidSetViewException, ProcessInterruptedException {
276 275
		step = null;
277 276
		dataExtent = new ExtentImpl(ulx, uly, lrx, lry);
278
		Extent adjustedDataExtent = util.calculateAdjustedView(dataExtent, getAffineTransform(), new Dimension((int)getWidth(), (int)getHeight()));
277
		Extent adjustedDataExtent = util.calculateAdjustedView(dataExtent, getAffineTransform(), getWidth(), getHeight());
279 278

  
280 279
		//Caso 3D: La petici?n no se ajusta al ?rea y se rellena el exterior con NoData
281 280
		if(!currentQuery.isAdjustToExtent() && !util.isInside(dataExtent, getExtent())) { 
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.impl/src/main/java/org/gvsig/raster/impl/store/properties/DataStoreStatistics.java
37 37
 * @author Nacho Brodin (nachobrodin@gmail.com)
38 38
 */
39 39
public class DataStoreStatistics extends AbstractStatistics {
40
	private RasterProvider    provider                = null;
41
	private int               bandCount               = 0;
42
	private int               percent                 = 0;
43
	private boolean           forceToRecalc           = false;
40
	protected RasterProvider    provider                = null;
41
	protected int               bandCount               = 0;
42
	protected int               percent                 = 0;
43
	protected boolean           forceToRecalc           = false;
44 44
	
45 45
	/**
46 46
	 * Constructor. Asigna el fichero asociado.
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.impl/src/main/java/org/gvsig/raster/impl/store/properties/MultiDataStoreStatistics.java
35 35
 * @author Nacho Brodin (nachobrodin@gmail.com)
36 36
 */
37 37
public class MultiDataStoreStatistics extends AbstractStatistics {
38

  
39
	protected DataStoreStatistics[]     statList      = null;
38
	protected DataStoreStatistics[]   statList      = null;
40 39
	protected RasterProvider[]        providerList  = null;
41 40
	protected int                     nDataset      = 0;
42 41

  
43
	
44 42
	/**
45 43
	 * Constructor
46 44
	 */
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.impl/src/main/java/org/gvsig/raster/impl/store/properties/RemoteDataStoreStatistics.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.raster.impl.store.properties;
23

  
24
import org.gvsig.fmap.dal.coverage.dataset.Buffer;
25
import org.gvsig.fmap.dal.coverage.exception.FileNotOpenException;
26
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException;
27
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException;
28
import org.gvsig.fmap.dal.coverage.exception.RmfSerializerException;
29
import org.gvsig.raster.impl.process.RasterTask;
30
import org.gvsig.raster.impl.process.RasterTaskQueue;
31
import org.gvsig.raster.impl.provider.RasterProvider;
32
import org.gvsig.raster.impl.provider.RemoteRasterProvider;
33
/**
34
 * Statistics for a remote raster provider.
35
 *  
36
 * @author Nacho Brodin (nachobrodin@gmail.com)
37
 */
38
public class RemoteDataStoreStatistics extends DataStoreStatistics {
39
	
40
	/**
41
	 * Constructor. Asigna el fichero asociado.
42
	 */
43
	public RemoteDataStoreStatistics(RasterProvider prov) {
44
		super(prov);
45
	}
46
	
47
	/*
48
	 * (non-Javadoc)
49
	 * @see org.gvsig.raster.hierarchy.IStatistics#calcFullStatistics()
50
	 */
51
	public void calculate() throws FileNotOpenException, RasterDriverException, ProcessInterruptedException {
52
		if (provider == null || !(provider instanceof RemoteRasterProvider))
53
			return;
54
		
55
		RemoteRasterProvider prov = (RemoteRasterProvider)provider;
56
		
57
		RasterTask task = RasterTaskQueue.get(Thread.currentThread().toString());
58
		percent = 0;
59
		
60
		bandCount = provider.getBandCount();
61
		max = new double[bandCount];
62
		min = new double[bandCount];
63
		secondMax = new double[bandCount];
64
		secondMin = new double[bandCount];
65
		maxByteUnsigned = new double[bandCount];
66
		minByteUnsigned = new double[bandCount];
67
		secondMaxByteUnsigned = new double[bandCount];
68
		secondMinByteUnsigned = new double[bandCount];
69
		mean = new double[bandCount];
70
		variance = new double[bandCount];
71

  
72
		long[] iValues = new long[bandCount];
73
		boolean[] initializedBand = new boolean[bandCount];
74
		int[] type = new int[bandCount];
75
		
76
		double z = 0;
77
		double rgb = 0;
78

  
79
		for (int iBand = 0; iBand < bandCount; iBand++) {
80
			max[iBand] = Double.NEGATIVE_INFINITY;
81
			min[iBand] = Double.POSITIVE_INFINITY;
82
			secondMax[iBand] = Double.NEGATIVE_INFINITY;
83
			secondMin[iBand] = Double.POSITIVE_INFINITY;
84
			maxByteUnsigned[iBand] = 0;
85
			minByteUnsigned[iBand] = 255;
86
			secondMaxByteUnsigned[iBand] = 0;
87
			secondMinByteUnsigned[iBand] = 255;
88
			initializedBand[iBand] = false;
89
			type[iBand] = provider.getDataType()[iBand];
90
		}
91

  
92
		Buffer buf = prov.getBufferLastRequest();
93

  
94
		if(buf == null)
95
			return;
96

  
97
		for (int iBand = 0; iBand < buf.getBandCount(); iBand++) {
98
			for (int col = 0; col < buf.getWidth(); col++) {
99
				for (int row = 0; row < buf.getHeight(); row++) {
100
					z = (buf.getDataType() == Buffer.TYPE_BYTE) ? buf.getElemByte(row, col, iBand) :
101
						(buf.getDataType() == Buffer.TYPE_SHORT) ? buf.getElemShort(row, col, iBand) :
102
						(buf.getDataType() == Buffer.TYPE_DOUBLE) ? buf.getElemDouble(row, col, iBand) :
103
						(buf.getDataType() == Buffer.TYPE_FLOAT) ? buf.getElemFloat(row, col, iBand) :
104
						(buf.getDataType() == Buffer.TYPE_INT) ? buf.getElemInt(row, col, iBand) :
105
						0;
106

  
107
						if (provider.isNoDataEnabled() && (z == provider.getNoDataValue()))
108
							continue;
109

  
110
						if (Double.isNaN(z))
111
							continue;
112

  
113
						rgb = 0;
114
						if(buf.getDataType() == Buffer.TYPE_BYTE) {
115
							rgb = ((byte) z) & 0xff;
116
							mean[iBand] += rgb;
117
							variance[iBand] += rgb * rgb;
118
						} else {
119
							//rgb = (b != null) ? ((byte) z) & 0xff : 0;
120
							mean[iBand] += z;
121
							variance[iBand] += z * z;
122
						}
123
						iValues[iBand]++;
124

  
125
						if (!initializedBand[iBand]) {
126
							secondMin[iBand] = min[iBand];
127
							secondMax[iBand] = max[iBand];
128
							min[iBand] = z;
129
							max[iBand] = z;
130
							secondMinByteUnsigned[iBand] = minByteUnsigned[iBand];
131
							secondMaxByteUnsigned[iBand] = maxByteUnsigned[iBand];
132
							minByteUnsigned[iBand] = rgb;
133
							maxByteUnsigned[iBand] = rgb;
134
							initializedBand[iBand] = true;
135
							continue;
136
						}
137

  
138
						if (z < secondMin[iBand]) {
139
							if (z < min[iBand]) {
140
								secondMin[iBand] = min[iBand];
141
								min[iBand] = z;
142
							} else {
143
								if (z > min[iBand])
144
									secondMin[iBand] = z;
145
							}
146
						}
147

  
148
						if (z > secondMax[iBand]) {
149
							if (z > max[iBand]) {
150
								secondMax[iBand] = max[iBand];
151
								max[iBand] = z;
152
							} else {
153
								if (z < max[iBand])
154
									secondMax[iBand] = z;
155
							}
156
						}
157

  
158
						if (rgb < secondMinByteUnsigned[iBand]) {
159
							if (rgb < minByteUnsigned[iBand]) {
160
								secondMinByteUnsigned[iBand] = minByteUnsigned[iBand];
161
								minByteUnsigned[iBand] = rgb;
162
							} else {
163
								if (rgb > minByteUnsigned[iBand])
164
									secondMinByteUnsigned[iBand] = rgb;
165
							}
166
						}
167

  
168
						if (rgb > secondMaxByteUnsigned[iBand]) {
169
							if (rgb > maxByteUnsigned[iBand]) {
170
								secondMaxByteUnsigned[iBand] = maxByteUnsigned[iBand];
171
								maxByteUnsigned[iBand] = rgb;
172
							} else {
173
								if (rgb < maxByteUnsigned[iBand])
174
									secondMaxByteUnsigned[iBand] = rgb;
175
							}
176
						}
177
				}
178
			}
179
			if (task.getEvent() != null)
180
				task.manageEvent(task.getEvent());
181
			percent = ((bandCount * 100) / (int)buf.getBandCount());
182
		}
183
			
184
		percent = 100;
185

  
186
		for (int iBand = 0; iBand < bandCount; iBand++) {
187
			if (iValues[iBand] > 0) {
188
				mean[iBand] = mean[iBand] / (double) iValues[iBand];
189
				variance[iBand] = variance[iBand] / (double) iValues[iBand] - mean[iBand] * mean[iBand];
190
			}
191
		}
192

  
193
		calculated = true;
194
		forceToRecalc = false;
195
		try {
196
			provider.saveObjectToRmf(RemoteDataStoreStatistics.class, this);
197
		} catch (RmfSerializerException e) {
198
			// No salva a rmf
199
		}
200
	}
201

  
202
}
0 203

  
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.impl/src/main/java/org/gvsig/raster/impl/store/DefaultRemoteRasterStore.java
352 352
	 */
353 353
	public Buffer getWindow(double ulx, double uly, double lrx, double lry, int bufWidth, int bufHeight, boolean adjustToExtent)
354 354
		throws InvalidSetViewException, ProcessInterruptedException, RasterDriverException {
355
		int dataType = Buffer.TYPE_BYTE;
356
		int bandCount = 1;
357
		if(getProvider(0).getDataType() != null) {
358
			dataType = getProvider(0).getDataType()[0];
359
			bandCount = getProvider(0).getBandCount();
360
		}
361
		Buffer buffer =  DefaultRasterManager.getInstance().createMemoryBuffer(dataType, bufWidth, bufHeight, bandCount, true);
355
		int mallocNBands = 0;
356
		if(bandList.getDrawableBands() != null)
357
			mallocNBands = bandList.getDrawableBands().length;
358
		else
359
			mallocNBands = bandList.getDrawableBandsCount();
360
		
361
		int dataType = getProvider(0).getDataType()[0];
362
		Buffer buffer =  DefaultRasterManager.getInstance().createMemoryBuffer(dataType, bufWidth, bufHeight, mallocNBands, true);
362 363
		Extent ex = rManager.getDataStructFactory().createExtent(ulx, uly, lrx, lry);
363 364
		return ((DefaultRasterProvider)providers.get(0)).getWindow(ex, bufWidth, bufHeight, bandList, buffer, adjustToExtent);
364 365
	}
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.impl/src/main/java/org/gvsig/raster/impl/grid/render/DefaultRender.java
21 21
 */
22 22
package org.gvsig.raster.impl.grid.render;
23 23

  
24
import java.awt.Dimension;
25 24
import java.awt.Graphics2D;
26 25
import java.awt.Image;
27 26
import java.awt.geom.AffineTransform;
......
683 682
			//Ajustamos la petici?n a los limites del raster, teniendo en cuenta la rotaci?n de este.
684 683
			return new ExtentImpl(ulWC, lrWC);
685 684
		}
686
		Extent adjustedRotedExtent = util.calculateAdjustedView(vp.getExtent(), ldatastore.getAffineTransform(), new Dimension((int)ldatastore.getWidth(), (int)ldatastore.getHeight()));
685
		Extent adjustedRotedExtent = util.calculateAdjustedView(vp.getExtent(), ldatastore.getAffineTransform(), ldatastore.getWidth(), ldatastore.getHeight());
687 686
		widthImage = (int)Math.round(Math.abs(adjustedRotedExtent.width() * vp.getMat().getScaleX()));
688 687
		heightImage = (int)Math.round(Math.abs(adjustedRotedExtent.height() * vp.getMat().getScaleY()));
689 688
		Point2D ul = new Point2D.Double(adjustedRotedExtent.getULX(), adjustedRotedExtent.getULY());
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.impl/src/main/java/org/gvsig/raster/impl/grid/filter/pansharp/PanSharpeningByteFilter.java
21 21
 */
22 22
package org.gvsig.raster.impl.grid.filter.pansharp;
23 23

  
24
import java.awt.Dimension;
25 24
import java.util.ArrayList;
26 25

  
27 26
import org.gvsig.fmap.dal.coverage.dataset.Buffer;
......
60 59
				bandas[i]= ((Integer) bands[i]).intValue();
61 60

  
62 61
			RasterQuery query = DefaultRasterManager.getInstance().createQuery();
63
			Extent adjustedExtent = util.calculateAdjustedView(dataset.getExtent(),dataset.getAffineTransform(), new Dimension(widthMultiespec,heightMultiespec));
62
			Extent adjustedExtent = util.calculateAdjustedView(dataset.getExtent(),dataset.getAffineTransform(), widthMultiespec, heightMultiespec);
64 63
			query.setDrawableBands(bandas);
65 64
			try {
66
				query.setAreaOfInterest(adjustedExtent.getULX(),adjustedExtent.getULY(),adjustedExtent.getLRX(), adjustedExtent.getLRY(),widthMultiespec,heightMultiespec);
65
				query.setAreaOfInterest(adjustedExtent.getULX(),adjustedExtent.getULY(),adjustedExtent.getLRX(), adjustedExtent.getLRY(), widthMultiespec, heightMultiespec);
67 66
				bufferMultiespectral = (dataset.query(query));
68 67
			} catch (RasterDriverException e) {
69 68
				e.printStackTrace();
......
73 72

  
74 73
			// Tomar buffer Pancromatica
75 74
			query = DefaultRasterManager.getInstance().createQuery();
76
			Extent adjustedExtentP = util.calculateAdjustedView(dataset.getDataStore(pancrName).getExtent(), dataset.getDataStore(pancrName).getAffineTransform(), new Dimension(widthPancr,heightPancr));
75
			Extent adjustedExtentP = util.calculateAdjustedView(dataset.getDataStore(pancrName).getExtent(), dataset.getDataStore(pancrName).getAffineTransform(), widthPancr, heightPancr);
77 76
			query.setDrawableBands(new int[]{posPancromatica});
78 77
			try {
79 78
				query.setAreaOfInterest(adjustedExtentP.getULX(),adjustedExtentP.getULY(),adjustedExtentP.getLRX(), adjustedExtentP.getLRY(),widthPancr,heightPancr);
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.api/src/main/java/org/gvsig/fmap/dal/coverage/util/RasterUtils.java
23 23

  
24 24
import java.awt.Dimension;
25 25
import java.awt.geom.AffineTransform;
26
import java.awt.geom.Dimension2D;
27 26
import java.awt.geom.NoninvertibleTransformException;
28 27
import java.awt.geom.Point2D;
29 28
import java.awt.geom.Rectangle2D;
......
292 291
	 * @param AffineTransform Matriz de transformaci?n del raster destino
293 292
	 * @return adjustedExtent Extent ajustado a m?ximos y m?nimos
294 293
	 */
295
	public Extent calculateAdjustedView(Extent extToAdj, AffineTransform at, Dimension2D dim);
294
	public Extent calculateAdjustedView(Extent extToAdj, AffineTransform at, double w, double h);
296 295

  
297 296

  
298 297
	/**

Also available in: Unified diff