Revision 2651

View differences:

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

  
83 83
	private String 						label;
84 84
	private StatusRasterInterface		status = null;
85
	private int 						posX = 0, posY = 0;
86
	private double 						posXWC = 0, posYWC = 0;
87
	private int 						r = 0, g = 0, b = 0;
85 88
		
86 89

  
87 90
	/**
......
707 710
	 * @see com.iver.cit.gvsig.fmap.layers.RasterOperations#getAttributes()
708 711
	 */
709 712
	public ArrayList getAttributes() {
710
		// TODO Auto-generated method stub
711
		return null;
713
		return wcs.getAttributes();
712 714
	}
713 715
	/* (non-Javadoc)
714 716
	 * @see com.iver.cit.gvsig.fmap.layers.RasterOperations#getHeight()
715 717
	 */
716 718
	public double getHeight() {
717
		// TODO Auto-generated method stub
718
		return 0;
719
		if(wcs.getGeoRasterFile() != null)
720
			return wcs.getGeoRasterFile().getHeight();
721
		else
722
			return 0;
719 723
	}
720 724
	/* (non-Javadoc)
721 725
	 * @see com.iver.cit.gvsig.fmap.layers.RasterOperations#getMaxX()
722 726
	 */
723 727
	public double getMaxX() {
724
		// TODO Auto-generated method stub
725
		return 0;
728
		if(wcs.getPxRaster() != null)
729
			return wcs.getPxRaster().getExtent().getMax().getX();
730
		else
731
			return 0;
726 732
	}
727 733
	/* (non-Javadoc)
728 734
	 * @see com.iver.cit.gvsig.fmap.layers.RasterOperations#getMaxY()
729 735
	 */
730 736
	public double getMaxY() {
731
		// TODO Auto-generated method stub
732
		return 0;
737
		if(wcs.getPxRaster() != null)
738
			return wcs.getPxRaster().getExtent().getMax().getY();
739
		else
740
			return 0;
733 741
	}
734 742
	/* (non-Javadoc)
735 743
	 * @see com.iver.cit.gvsig.fmap.layers.RasterOperations#getMinX()
736 744
	 */
737 745
	public double getMinX() {
738
		// TODO Auto-generated method stub
739
		return 0;
746
		if(wcs.getPxRaster() != null)
747
			return wcs.getPxRaster().getExtent().getMin().getX();
748
		else
749
			return 0;
740 750
	}
741 751
	/* (non-Javadoc)
742 752
	 * @see com.iver.cit.gvsig.fmap.layers.RasterOperations#getMinY()
743 753
	 */
744 754
	public double getMinY() {
745
		// TODO Auto-generated method stub
746
		return 0;
755
		if(wcs.getPxRaster() != null)
756
			return wcs.getPxRaster().getExtent().getMin().getY();
757
		else
758
			return 0;
747 759
	}
748 760
	/* (non-Javadoc)
749 761
	 * @see com.iver.cit.gvsig.fmap.layers.RasterOperations#getPixel(double, double)
750 762
	 */
751 763
	public int[] getPixel(double wcx, double wcy) {
752
		// TODO Auto-generated method stub
753
		return null;
764
		if(wcs.getPxRaster() != null)
765
			return wcs.getPxRaster().getPixel(wcx, wcy);
766
		else
767
			return null;
754 768
	}
755 769
	/* (non-Javadoc)
756 770
	 * @see com.iver.cit.gvsig.fmap.layers.RasterOperations#getSource()
......
763 777
	 * @see com.iver.cit.gvsig.fmap.layers.RasterOperations#getWidth()
764 778
	 */
765 779
	public double getWidth() {
766
		// TODO Auto-generated method stub
767
		return 0;
780
		if(wcs.getGeoRasterFile() != null)
781
			return wcs.getGeoRasterFile().getWidth();
782
		else
783
			return 0;
768 784
	}
769 785
	/* (non-Javadoc)
770 786
	 * @see com.iver.cit.gvsig.fmap.layers.RasterOperations#setPos(int, int)
771 787
	 */
772 788
	public void setPos(int x, int y) {
773
		// TODO Auto-generated method stub
774

  
789
		this.posX = x;
790
		this.posY = y;
775 791
	}
776 792
	/* (non-Javadoc)
777 793
	 * @see com.iver.cit.gvsig.fmap.layers.RasterOperations#setPosWC(double, double)
778 794
	 */
779 795
	public void setPosWC(double x, double y) {
780
		// TODO Auto-generated method stub
781

  
796
		this.posXWC = x;
797
		this.posYWC = y;
782 798
	}
783 799
	/* (non-Javadoc)
784 800
	 * @see com.iver.cit.gvsig.fmap.layers.RasterOperations#setRGB(int, int, int)
785 801
	 */
786 802
	public void setRGB(int r, int g, int b) {
787
		// TODO Auto-generated method stub
788

  
803
		this.r = r;
804
		this.g = g;
805
		this.b = b;
789 806
	}
790 807
	/* (non-Javadoc)
791 808
	 * @see com.iver.cit.gvsig.fmap.layers.RasterOperations#setSource(com.iver.cit.gvsig.fmap.layers.RasterAdapter)
......
798 815
	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.InfoByPoint#queryByPoint(java.awt.Point)
799 816
	 */
800 817
	public String queryByPoint(Point p) throws DriverException {
801
		// TODO Auto-generated method stub
802
		return null;
818
		String data = "<file:"+getName().replaceAll(" ","_")+">\n";
819

  
820
		ArrayList attr = this.getAttributes();
821
		data += "  <raster\n";
822
		data += "    File=\""+getName()+"\"\n";
823
		for (int i=0; i<attr.size(); i++) {
824
			Object [] a = (Object []) attr.get(i);
825

  
826
			data += "    "+a[0].toString()+"=";
827
			if (a[1].toString() instanceof String)
828
				data += "\""+a[1].toString()+"\"\n";
829
			else
830
				data += a[1].toString()+"\n";
831
		}
832
		data += "    Point=\""+posX+" , "+posY+"\"\n";
833
		data += "    Point_WC=\""+posXWC+" , "+posYWC+"\"\n";
834
		data += "    RGB=\""+r+", "+g+", "+b+"\"\n";
835
		data += "  />\n";
836

  
837
		data += "</file:"+getName().replaceAll(" ","_")+">\n";
838
		System.out.println(data);
839
		return data;
803 840
	}
804 841
}
trunk/extensions/extWCS/src/com/iver/cit/gvsig/fmap/layers/FMapWCSAdapter.java
46 46
import java.awt.geom.Point2D;
47 47
import java.awt.geom.Rectangle2D;
48 48
import java.awt.image.BufferedImage;
49
import java.awt.image.DataBuffer;
49 50
import java.io.File;
50 51
import java.io.IOException;
52
import java.util.ArrayList;
51 53

  
52 54
import org.cresques.geo.ViewPortData;
53 55
import org.cresques.io.GdalFile;
......
65 67

  
66 68
import com.iver.cit.gvsig.fmap.DriverException;
67 69
import com.iver.cit.gvsig.fmap.ViewPort;
70
import com.iver.cit.gvsig.fmap.drivers.RasterDriver;
68 71
import com.iver.cit.gvsig.fmap.drivers.wcs.FMapWCSDriver;
69 72
import com.iver.cit.gvsig.fmap.operations.Cancellable;
70 73

  
......
273 276
	}
274 277
	
275 278
	/**
279
	 * Obtiene la lista de atributos de raster
280
	 * @return	lista de atributos. Cada elmento de la lista es un array Object
281
	 * con dos elementos. El primero el nombre del atributo y el segundo el valor
282
	 * del mismo.
283
	 */
284
	public ArrayList getAttributes() {
285
		if(rasterFile != null){
286
			ArrayList attr = new ArrayList();
287
			String dataType = "Byte";
288
			if (rasterFile.getDataType() == DataBuffer.TYPE_BYTE) dataType = "Byte";
289
			else if (rasterFile.getDataType() == DataBuffer.TYPE_SHORT)
290
				dataType = "Short";
291
			else if (rasterFile.getDataType() == DataBuffer.TYPE_USHORT)
292
				dataType = "Unsigned Short";
293
			else if (rasterFile.getDataType() == DataBuffer.TYPE_INT)
294
				dataType = "Integer";
295
			else if (rasterFile.getDataType() == DataBuffer.TYPE_FLOAT)
296
				dataType = "Float";
297
			else if (rasterFile.getDataType() == DataBuffer.TYPE_DOUBLE)
298
				dataType = "Double";
299
			else
300
				dataType = "Unknown";
301
			Object [][] a = {
302
				{"Filename",rasterFile.getName().substring(rasterFile.getName().lastIndexOf("/")+1, rasterFile.getName().length())},
303
				{"Filesize",new Long(rasterFile.getFileSize())},
304
				{"Width",new Integer(rasterFile.getWidth())},
305
				{"Height", new Integer(rasterFile.getHeight())},
306
				{"Bands", new Integer(rasterFile.getBandCount())}
307
				//{"BandDataType", dataType}
308
			};
309
			for (int i=0; i<a.length; i++){
310
				System.out.println("===> "+a[i][0]+" "+a[i][1]);
311
				attr.add(a[i]);
312
			}
313
			return attr;
314
		}
315
		return  null;
316
	}
317
	
318
	/**
276 319
	 * Sets the filter stack
277 320
	 * 
278 321
	 * Establece la pila de filtros

Also available in: Unified diff