Revision 8618

View differences:

trunk/extensions/extWCS/src/com/iver/cit/gvsig/fmap/layers/FLyrWCS.java
197 197

  
198 198
	/**
199 199
	 * Clase que contiene los datos de visualizaci?n de WCS. Tiene datos que representan al
200
	 * raster en la vista. Este raster puede estar compuesto por tiles por lo que valores 
200
	 * raster en la vista. Este raster puede estar compuesto por tiles por lo que valores
201 201
	 * como el ancho total o el m?nimo o m?ximo deben ser calculados a partir de todos los
202 202
	 * tiles visualizados.
203 203
	 * @author Nacho Brodin (brodin_ign@gva.es)
......
211 211
		private double						minX = 0D, minY = 0D, maxX = 0D, maxY = 0D;
212 212
		private int 						bandCount = 0;
213 213
		private int							dataType = DataBuffer.TYPE_UNDEFINED;
214
		
214

  
215 215
		/**
216 216
		 * Ancho y alto total del raster que ser? la suma de todos los tiles.
217 217
		 */
......
455 455
	 */
456 456
	public XMLItem[] getInfo(Point point, double tolerance, Cancellable cancel ) throws DriverException {
457 457
		String data = "<file:"+getName().replaceAll("[^a-zA-Z0-9]","")+">\n";
458
		
458

  
459 459
		Point2D pReal = getMapContext().getViewPort().toMapPoint(point);
460 460
		Point2D px = null;
461
		if(	pReal.getX() > this.getMinX() && 
462
			pReal.getX() < this.getMaxX() && 
463
			pReal.getY() > this.getMinY() && 
461
		if(	pReal.getX() > this.getMinX() &&
462
			pReal.getX() < this.getMaxX() &&
463
			pReal.getY() > this.getMinY() &&
464 464
			pReal.getY() < this.getMaxY()){
465
			
465

  
466 466
			px = new Point2D.Double();
467 467
			double w = (visualStatus.rasterMaxX - visualStatus.rasterMinX);
468 468
			double h = (visualStatus.rasterMaxY - visualStatus.rasterMinY);
469
			px.setLocation(((pReal.getX() - visualStatus.rasterMinX) * visualStatus.rasterWidth) / w, 
469
			px.setLocation(((pReal.getX() - visualStatus.rasterMinX) * visualStatus.rasterWidth) / w,
470 470
							((visualStatus.rasterMaxY - pReal.getY()) * visualStatus.rasterHeight) / h);
471 471
		}
472
		
472

  
473 473
		int[] rgb = this.getPixel(pReal.getX(), pReal.getY());
474
		
475
		StringXMLItem[] item = new StringXMLItem[1]; 
476 474

  
475
		StringXMLItem[] item = new StringXMLItem[1];
476

  
477 477
		data += "  <raster\n";
478 478
		data += "    View_Point=\""+point.getX()+" , "+point.getY()+"\"\n";
479 479
		data += "    World_Point=\""+DoubleUtilities.format(pReal.getX(), 3)+" , "+ DoubleUtilities.format(pReal.getY(), 3)+"\"\n";
480
		if(	px == null || px.getX() > visualStatus.rasterWidth || px.getX() < 0 || 
480
		if(	px == null || px.getX() > visualStatus.rasterWidth || px.getX() < 0 ||
481 481
			px.getY() > visualStatus.rasterHeight || px.getY() < 0)
482 482
			data += "    Pixel_Point=\"Out\"\n";
483 483
		else
......
514 514
			}
515 515
			rf.close();
516 516
		}
517
		
517

  
518 518
		data += "\"\n";
519 519
		data += "  />\n";
520 520
		data += "</file:"+getName().replaceAll("[^a-zA-Z0-9]","")+">\n";
521
		
522
		item[0] = new StringXMLItem(data, this); 
521

  
522
		item[0] = new StringXMLItem(data, this);
523 523
		return item;
524 524
	}
525
    
525

  
526 526
	/*
527 527
	 *  (non-Javadoc)
528 528
	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getFullExtent()
......
613 613
        }
614 614

  
615 615
		try {
616
			sz = new Dimension(wImg, hImg);
617
			Rectangle2D.intersect(vp.getAdjustedExtent(), extent, bBox);
618

  
616 619
			wcsStatus.setCoveraName( coverageName );
617 620
			wcsStatus.setExtent( bBox );
618 621
			wcsStatus.setFormat( format );
......
641 644
			rasterProcess(g, vpData, f);
642 645

  
643 646
		} catch (ValidationException e) {
644
			UnknownResponseFormatExceptionType type = 
647
			UnknownResponseFormatExceptionType type =
645 648
				new UnknownResponseFormatExceptionType();
646 649
			type.setLayerName(getName());
647 650
			try {
......
657 660
//	azabala		throw new DriverException(PluginServices.getText(this, "unknown_response_format"), e);
658 661
		}
659 662
		catch (UnsupportedVersionException e) {
660
			UnsuportedProtocolVersionExceptionType type = 
663
			UnsuportedProtocolVersionExceptionType type =
661 664
				new UnsuportedProtocolVersionExceptionType();
662 665
			type.setLayerName(getName());
663 666
			try {
664 667
				type.setDriverName(getDriver().getName());
665
			} catch (Exception ex){	
668
			} catch (Exception ex){
666 669
			}
667 670
			type.setUrl(host);
668 671
			throw new DriverException(PluginServices.getText(this, "version_conflict"), e, type);
669
			
672

  
670 673
//	azabala		throw new DriverException(PluginServices.getText(this, "version_conflict"), e);
671 674
		} catch (IOException e) {
672 675
			ConnectionErrorExceptionType type = new ConnectionErrorExceptionType();
......
674 677
			try {
675 678
				type.setDriverName(getDriver().getName());
676 679
			} catch (Exception e1) {
677
			} 
680
			}
678 681
			type.setHost(host);
679 682
			throw new DriverException(PluginServices.
680 683
					getText(this, "connect_error"), e, type);
......
685 688
			try {
686 689
				type.setDriverName(getDriver().getName());
687 690
			} catch (Exception e1) {
688
			} 
691
			}
689 692
			type.setWcsStatus(wcsStatus);
690 693
			this.setVisible(false);
691 694
			throw new DriverException("Error WCS", e,  type);
692
			
695

  
693 696
//            JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), e.getMessage());
694
            
697

  
695 698
        }//catch
696 699
	}
697 700

  
......
741 744
		//Creamos el PxRaster
742 745
		rasterFile = new GdalFile(vpData.getProjection(), file.getAbsolutePath());
743 746
		raster = new PxRaster(rasterFile, null, rasterFile.getExtent());
744
		
747

  
745 748
		visualStatus.rasterWidth += rasterFile.getWidth();
746 749
		visualStatus.rasterHeight += rasterFile.getHeight();
747 750
		if(raster.getExtent().getMin().getX() < visualStatus.rasterMinX)
......
752 755
			visualStatus.rasterMaxX = raster.getExtent().getMax().getX();
753 756
		if(raster.getExtent().getMax().getY() > visualStatus.rasterMaxY)
754 757
			visualStatus.rasterMaxY = raster.getExtent().getMax().getY();
755
		
758

  
756 759
		//Recuperamos la pila de filtros si ya hubiese sido cargado antes
757 760
		if (this.filterStack!=null)
758 761
			raster.filterStack = this.filterStack;

Also available in: Unified diff