Revision 10705

View differences:

branches/v10/extensions/extWCS/src/com/iver/cit/gvsig/fmap/layers/FLyrWCS.java
58 58
import java.net.URL;
59 59
import java.util.ArrayList;
60 60
import java.util.Hashtable;
61
import java.util.Iterator;
61 62
import java.util.Map;
62 63

  
63 64
import javax.print.attribute.PrintRequestAttributeSet;
......
135 136
	private int							maxTileDrawHeight = 1023;
136 137
	private int 						maxTilePrintWidth  = 250;
137 138
	private int							maxTilePrintHeight = 250;
138
	
139

  
139 140
	private Grid						grid = null;
140 141

  
141 142
	private class MyCancellable implements ICancellable
......
487 488
				px.getY() > visualStatus.rasterHeight || px.getY() < 0)
488 489
				data += "    Pixel_Point=\"Out\"\n";
489 490
			else{
490
				data += "    Pixel_Point=\""+(int)px.getX()+" , "+(int)px.getY()+"\"\n";		
491
				data += "    Pixel_Point=\""+(int)px.getX()+" , "+(int)px.getY()+"\"\n";
491 492
				data += "    Band_Value=\"";
492 493
				for(int file = 0; file < visualStatus.fileNames.length; file++ ){
493 494
					GdalFile rf;
......
497 498
						throw new DriverException("Open File Error.");
498 499
					}
499 500
					Extent ex = rf.getExtent();
500
					
501

  
501 502
					if(pReal.getX() >= ex.minX() && pReal.getX() <= ex.maxX() && pReal.getY() >= ex.minY() && pReal.getY() <= ex.maxY()){
502 503
						for(int i = 0; i < visualStatus.bandCount; i++){
503 504
							Object pxData = rf.getData((int)px.getX(), (int)px.getY(), i);
504 505
							if(pxData != null){
505 506
								if(visualStatus.dataType >= 0 && visualStatus.dataType <= 3)
506 507
									data += ((Integer)pxData).intValue()+"  ";
507
														
508

  
508 509
								if(visualStatus.dataType >= 4)
509 510
									data += ((Float)pxData).floatValue()+"  ";
510
									
511

  
511 512
								if(visualStatus.dataType >= 5)
512 513
									data += ((Double)pxData).doubleValue()+"  ";
513 514
							}
......
517 518
				}
518 519
				data += "\"\n";
519 520
			}
520
			
521

  
521 522
			if(rgb != null)
522 523
				data += "    RGB=\""+rgb[1]+"  "+rgb[2]+"  "+rgb[3]+"\"\n";
523
			
524

  
524 525
			data += "  />\n";
525 526
			data += "</file:"+getName().replaceAll("[^a-zA-Z0-9]","")+">\n";
526 527

  
......
758 759
			status.applyStatus(this);
759 760
			firstLoad = false;
760 761
		}
761
		
762

  
762 763
		grid = new Grid(rasterFile);
763 764
		grid.addRenderizer(raster);
764
		
765

  
765 766
		visualStatus.rasterWidth += rasterFile.getWidth();
766 767
		visualStatus.rasterHeight += rasterFile.getHeight();
767 768
		if(raster.getExtent().getMin().getX() < visualStatus.rasterMinX)
......
772 773
			visualStatus.rasterMaxX = raster.getExtent().getMax().getX();
773 774
		if(raster.getExtent().getMax().getY() > visualStatus.rasterMaxY)
774 775
			visualStatus.rasterMaxY = raster.getExtent().getMax().getY();
775
		
776

  
776 777
		//Recuperamos la pila de filtros si ya hubiese sido cargado antes
777 778
		if (this.filterStack!=null)
778 779
			raster.filterStack = this.filterStack;
......
847 848
		xml.putProperty("wcs.coverageName", coverageName );
848 849
		xml.putProperty("wcs.maxResX", maxRes.getX());
849 850
		xml.putProperty("wcs.maxResY", maxRes.getY());
851

  
852
		 Iterator it = onlineResources.keySet().iterator();
853
		 String strOnlines = "";
854
		 while (it.hasNext()) {
855
			 String key = (String) it.next();
856
			 String value = (String) onlineResources.get(key);
857
			 strOnlines += key+"~##SEP2##~"+value;
858
			 if (it.hasNext())
859
				 strOnlines += "~##SEP1##~";
860
		 }
861
		 xml.putProperty("onlineResources", strOnlines);
862

  
850 863
		if (status!=null)
851 864
			status.getXMLEntity(xml, true, this);
852 865
		else{
......
1127 1140
	public boolean isTiled() {
1128 1141
		return mustTileDraw;
1129 1142
	}
1130
	
1143

  
1131 1144
	/**
1132 1145
	 * Obtiene el tipo de dato de la capa raster
1133 1146
	 * @return Entero que representa el tipo de dato de la capa raster.
......
1135 1148
	public int getDataType() {
1136 1149
		return rasterFile.getDataType();
1137 1150
	}
1138
	
1151

  
1139 1152
	/**
1140 1153
	 * Obtiene el grid asociado al raster que hay cargado en ese momento
1141 1154
	 * @return grid
branches/v10/extensions/extWMS/src/com/iver/cit/gvsig/fmap/layers/FLyrWMS.java
192 192
			throw new DriverIOException("Malformed host URL, '" + host + "' (" + e.toString() + ").");
193 193
		}
194 194
		try {
195
			drv = this.getDriver();			
195
			drv = this.getDriver();
196 196
		} catch (Exception e) {
197 197
			// e.printStackTrace();
198 198
			throw new DriverIOException("Can't get driver to host '" + host + "' (" + e.toString() + ").");
......
202 202
				throw new DriverIOException("Can't connect to host '" + host + "'.");
203 203

  
204 204
			WMSLayerNode wmsNode = drv.getLayer(sLayer);
205
			
205

  
206 206
			if (wmsNode == null){
207 207
				throw new DriverIOException("The server '" + host + "' doesn't has the layer '" + sLayer + "'.");
208 208
			}
209 209
			if( sFormat == null ) {
210 210
				sFormat = this.getGreatFormat(drv.getFormats());
211 211
			}
212
			
212

  
213 213
			//SRS
214 214
			Vector allSrs = wmsNode.getAllSrs();
215 215
			boolean isSRSSupported = false;
......
217 217
				for (int i=0; i<allSrs.size() ; i++){
218 218
     				if (((String)allSrs.get(i)).compareTo(sSRS) == 0){
219 219
     					isSRSSupported = true;
220
     				}     				
220
     				}
221 221
     			}
222 222
			}
223
			
223

  
224 224
     		if(!isSRSSupported) {
225 225
     			for (int i=0; i<allSrs.size() ; i++){
226 226
     				if (((String)wmsNode.getAllSrs().get(i)).compareTo("EPSG:4326") == 0){
227 227
     					sSRS = (String)wmsNode.getAllSrs().get(i);
228
     				}     				
228
     				}
229 229
     			}
230 230
     			if (sSRS==null){
231 231
     				sSRS = (String)wmsNode.getAllSrs().get(0);
......
271 271

  
272 272
	/**
273 273
	 * Clase que contiene los datos de visualizaci?n de WMS. Tiene datos que representan al
274
	 * raster en la vista. Este raster puede estar compuesto por tiles por lo que valores 
274
	 * raster en la vista. Este raster puede estar compuesto por tiles por lo que valores
275 275
	 * como el ancho total o el m?nimo o m?ximo deben ser calculados a partir de todos los
276 276
	 * tiles visualizados.
277 277
	 * @author Nacho Brodin (brodin_ign@gva.es)
......
369 369
        while (it.hasNext()) {
370 370
        	String key = (String) it.next();
371 371
        	String value = (String) onlineResources.get(key);
372
        	strOnlines = key+"~##SEP2##~"+value;
372
        	strOnlines += key+"~##SEP2##~"+value;
373 373
        	if (it.hasNext())
374 374
        		strOnlines += "~##SEP1##~";
375 375
        }
......
556 556
				wmsStatus.setHeight(vp.getImageHeight());
557 557
				wmsStatus.setWidth(vp.getImageWidth());
558 558
				wmsStatus.setOnlineResource((String) onlineResources.get("GetFeatureInfo"));
559
				
559

  
560 560
				//This is in the case we call layer.getInfo outside the info tool.
561 561
				if (wmsStatus.getSrs() == null){
562 562
					wmsStatus.setSrs(this.m_SRS);
......
567 567
				if(wmsStatus.getLayerNames().isEmpty()){
568 568
					wmsStatus.addLayerName(this.getLayerQuery());
569 569
				}
570
				
570

  
571 571
				MyCancellable c = new MyCancellable(cancellable);
572 572
				item[0] = new StringXMLItem(new String(getDriver()
573 573
						.getFeatureInfo(wmsStatus, (int) tiledPoint.getX(), (int) tiledPoint.getY(), Integer.MAX_VALUE, c)),this);
......
1074 1074
		raster = new PxRaster(rasterFile, null, rasterFile.getExtent());
1075 1075
		grid = new Grid(rasterFile);
1076 1076
		grid.addRenderizer(raster);
1077
		
1077

  
1078 1078
		if(status != null && firstLoad){
1079 1079
			status.applyStatus(this);
1080 1080
			firstLoad = false;
......
1825 1825
	public Grid getGrid(){
1826 1826
		return grid;
1827 1827
	}
1828
	
1828

  
1829 1829
	/**
1830 1830
	 * Obtiene el tipo de dato de la capa raster
1831 1831
	 * @return Entero que representa el tipo de dato de la capa raster.

Also available in: Unified diff