Revision 4934
trunk/extensions/extWCS/src/com/iver/cit/gvsig/fmap/layers/FLyrWCS.java | ||
---|---|---|
94 | 94 |
*/ |
95 | 95 |
public class FLyrWCS extends FLyrDefault implements RasterOperations, InfoByPoint{ |
96 | 96 |
private FMapWCSDriver wcs = null; |
97 |
|
|
97 |
|
|
98 | 98 |
private URL host; |
99 | 99 |
private String coverageName; |
100 | 100 |
private Rectangle2D fullExtent; |
... | ... | |
119 | 119 |
private int transparency = -1; |
120 | 120 |
private int rband, gband, bband; |
121 | 121 |
private VisualStatus visualStatus = new VisualStatus(); |
122 |
|
|
122 |
|
|
123 | 123 |
private int maxTilePrintWidth = 80000; |
124 | 124 |
private int maxTilePrintHeight = 80000; |
125 |
|
|
125 |
|
|
126 | 126 |
private FMapWCSDriver driver; |
127 | 127 |
|
128 | 128 |
public FLyrWCS(){ |
... | ... | |
174 | 174 |
} |
175 | 175 |
|
176 | 176 |
} |
177 |
|
|
177 |
|
|
178 | 178 |
/** |
179 | 179 |
* Clase que contiene los datos de visualizaci?n de WMS. |
180 | 180 |
* @author Nacho Brodin (brodin_ign@gva.es) |
... | ... | |
189 | 189 |
private int bandCount = 0; |
190 | 190 |
private int dataType = DataBuffer.TYPE_UNDEFINED; |
191 | 191 |
} |
192 |
|
|
192 |
|
|
193 | 193 |
/* |
194 | 194 |
* (non-Javadoc) |
195 | 195 |
* @see com.iver.cit.gvsig.fmap.layers.RasterOperations#setRGB(int, int, int) |
... | ... | |
258 | 258 |
public int[] getPixel(double wcx, double wcy) { |
259 | 259 |
if(getPxRaster() != null) |
260 | 260 |
return getPxRaster().getPixel(wcx, wcy); |
261 |
return null;
|
|
261 |
return null;
|
|
262 | 262 |
} |
263 | 263 |
|
264 | 264 |
/* |
... | ... | |
324 | 324 |
dataType = "Double"; |
325 | 325 |
else |
326 | 326 |
dataType = "Unknown"; |
327 |
|
|
327 |
|
|
328 | 328 |
Object [][] a = { |
329 |
{"Filename",rasterFile.getName().substring(rasterFile.getName().lastIndexOf("/")+1, rasterFile.getName().length())},
|
|
330 |
{"Filesize",new Long(0)},
|
|
331 |
{"Width",new Integer((int)this.getWidth())},
|
|
332 |
{"Height", new Integer((int)this.getHeight())},
|
|
333 |
{"Bands", new Integer(visualStatus.bandCount)},
|
|
334 |
{"BandDataType", dataType}
|
|
329 |
{"Filename",rasterFile.getName().substring(rasterFile.getName().lastIndexOf("/")+1, rasterFile.getName().length())}, |
|
330 |
{"Filesize",new Long(0)}, |
|
331 |
{"Width",new Integer((int)this.getWidth())}, |
|
332 |
{"Height", new Integer((int)this.getHeight())}, |
|
333 |
{"Bands", new Integer(visualStatus.bandCount)}, |
|
334 |
{"BandDataType", dataType} |
|
335 | 335 |
}; |
336 | 336 |
for (int i=0; i<a.length; i++) |
337 | 337 |
attr.add(a[i]); |
338 |
|
|
338 |
|
|
339 | 339 |
return attr; |
340 | 340 |
} |
341 | 341 |
return null; |
... | ... | |
400 | 400 |
data += " File=\""+getName()+"\"\n"; |
401 | 401 |
for (int i=0; i<attr.size(); i++) { |
402 | 402 |
Object [] a = (Object []) attr.get(i); |
403 |
|
|
403 |
|
|
404 | 404 |
data += " "+a[0].toString()+"="; |
405 | 405 |
if (a[1].toString() instanceof String) |
406 | 406 |
data += "\""+a[1].toString()+"\"\n"; |
... | ... | |
411 | 411 |
data += " Point_WC=\""+posXWC+" , "+posYWC+"\"\n"; |
412 | 412 |
data += " RGB=\""+r+", "+g+", "+b+"\"\n"; |
413 | 413 |
data += " />\n"; |
414 |
|
|
414 |
|
|
415 | 415 |
data += "</file:"+getName().replaceAll("[^a-zA-Z0-9]","")+">\n"; |
416 | 416 |
System.out.println(data); |
417 | 417 |
return data; |
... | ... | |
441 | 441 |
visualStatus.maxX = viewPort.getAdjustedExtent().getMaxX(); |
442 | 442 |
visualStatus.maxY = viewPort.getAdjustedExtent().getMaxY(); |
443 | 443 |
|
444 |
Rectangle r = new Rectangle((int) p.getX(), (int) p.getY(), viewPort.getImageWidth() - 1, viewPort.getImageHeight() - 1); |
|
445 |
Tiling tiles = new Tiling(maxTilePrintWidth, maxTilePrintHeight, r); |
|
446 |
tiles.setAffineTransform((AffineTransform) viewPort.getAffineTransform().clone()); |
|
447 |
for (int tileNr=0; tileNr < tiles.getNumTiles(); tileNr++) { |
|
448 |
// drawing part |
|
449 |
try { |
|
450 |
ViewPort vp = tiles.getTileViewPort(viewPort, tileNr); |
|
451 |
drawTile(g, vp, cancel); |
|
452 |
} catch (NoninvertibleTransformException e) { |
|
453 |
e.printStackTrace(); |
|
444 |
Rectangle r = new Rectangle((int) p.getX(), (int) p.getY(), viewPort.getImageWidth() - 1, viewPort.getImageHeight() - 1); |
|
445 |
Tiling tiles = new Tiling(maxTilePrintWidth, maxTilePrintHeight, r); |
|
446 |
tiles.setAffineTransform((AffineTransform) viewPort.getAffineTransform().clone()); |
|
447 |
for (int tileNr=0; tileNr < tiles.getNumTiles(); tileNr++) { |
|
448 |
// drawing part |
|
449 |
try { |
|
450 |
ViewPort vp = tiles.getTileViewPort(viewPort, tileNr); |
|
451 |
drawTile(g, vp, cancel); |
|
452 |
} catch (NoninvertibleTransformException e) { |
|
453 |
e.printStackTrace(); |
|
454 |
} |
|
454 | 455 |
} |
455 |
} |
|
456 | 456 |
} |
457 | 457 |
Runtime r = Runtime.getRuntime(); |
458 | 458 |
long mem = r.totalMemory() - r.freeMemory(); |
459 | 459 |
System.err.println("Memoria total: " + (mem / 1024) +"KB"); |
460 | 460 |
} |
461 |
|
|
461 |
|
|
462 | 462 |
/** |
463 | 463 |
* This is the method used to draw a tile in a WMS mosaic layer. |
464 | 464 |
*/ |
465 | 465 |
private void drawTile(Graphics2D g, ViewPort vp, Cancellable cancel) throws DriverException { |
466 |
|
|
466 |
|
|
467 | 467 |
// Compute the query geometry |
468 | 468 |
// 1. Check if it is within borders |
469 | 469 |
Rectangle2D extent = getFullExtent(); |
470 |
if ((vp.getExtent().getMinX() > extent.getMaxX()) || |
|
471 |
(vp.getExtent().getMinY() > extent.getMaxY()) || |
|
472 |
(vp.getExtent().getMaxX() < extent.getMinX()) || |
|
473 |
(vp.getExtent().getMaxY() < extent.getMinY())) { |
|
474 |
return; |
|
475 |
} |
|
470 |
if ((vp.getExtent().getMinX() > extent.getMaxX()) || |
|
471 |
(vp.getExtent().getMinY() > extent.getMaxY()) || |
|
472 |
(vp.getExtent().getMaxX() < extent.getMinX()) || |
|
473 |
(vp.getExtent().getMaxY() < extent.getMinY())) { |
|
474 |
return; |
|
475 |
} |
|
476 |
|
|
477 |
// 2. Compute extent to be requested. |
|
478 |
Rectangle2D bBox = new Rectangle2D.Double(); |
|
479 |
Rectangle2D.intersect(vp.getExtent(), extent, bBox); |
|
480 |
|
|
481 |
// 3. Compute size in pixels |
|
482 |
double scalex = vp.getAffineTransform().getScaleX(); |
|
483 |
double scaley = vp.getAffineTransform().getScaleY(); |
|
484 |
int wImg = (int) Math.ceil(Math.abs(bBox.getWidth() * scalex) + 1); |
|
485 |
int hImg = (int) Math.ceil(Math.abs(bBox.getHeight() * scaley) + 1); |
|
486 |
Dimension sz = new Dimension(wImg, hImg); |
|
487 |
|
|
488 |
if ((wImg <= 0) || (hImg <= 0)) { |
|
489 |
return; |
|
490 |
} |
|
476 | 491 |
|
477 |
// 2. Compute extent to be requested. |
|
478 |
Rectangle2D bBox = new Rectangle2D.Double(); |
|
479 |
Rectangle2D.intersect(vp.getExtent(), extent, bBox); |
|
480 |
|
|
481 |
// 3. Compute size in pixels |
|
482 |
double scalex = vp.getAffineTransform().getScaleX(); |
|
483 |
double scaley = vp.getAffineTransform().getScaleY(); |
|
484 |
int wImg = (int) Math.ceil(Math.abs(bBox.getWidth() * scalex) + 1); |
|
485 |
int hImg = (int) Math.ceil(Math.abs(bBox.getHeight() * scaley) + 1); |
|
486 |
Dimension sz = new Dimension(wImg, hImg); |
|
487 |
|
|
488 |
if ((wImg <= 0) || (hImg <= 0)) { |
|
489 |
return; |
|
490 |
} |
|
491 |
|
|
492 | 492 |
try { |
493 | 493 |
wcsStatus.setCoveraName( coverageName ); |
494 | 494 |
wcsStatus.setExtent( bBox ); |
... | ... | |
509 | 509 |
firstLoad = false; |
510 | 510 |
} |
511 | 511 |
ViewPortData vpData = new ViewPortData( |
512 |
vp.getProjection(), new Extent(bBox), sz );
|
|
512 |
vp.getProjection(), new Extent(bBox), sz ); |
|
513 | 513 |
vpData.setMat(vp.getAffineTransform()); |
514 |
|
|
514 |
|
|
515 | 515 |
rasterProcess(g, vpData, f); |
516 | 516 |
|
517 | 517 |
} catch (ValidationException e) { |
... | ... | |
521 | 521 |
} catch (IOException e) { |
522 | 522 |
throw new DriverException(PluginServices.getText(this, "connect_error"), e); |
523 | 523 |
} catch (WCSException e) { |
524 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), e.getMessage());
|
|
524 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), e.getMessage());
|
|
525 | 525 |
this.setVisible(false); |
526 | 526 |
} |
527 | 527 |
} |
... | ... | |
539 | 539 |
private FMapWCSDriver getDriver() throws IllegalStateException, ValidationException, UnsupportedVersionException, IOException { |
540 | 540 |
if (wcs == null) { |
541 | 541 |
wcs = new FMapWCSDriver(); |
542 |
wcs.createClient(host);
|
|
543 |
}
|
|
542 |
wcs.createClient(host);
|
|
543 |
}
|
|
544 | 544 |
return wcs; |
545 | 545 |
} |
546 |
|
|
546 |
|
|
547 | 547 |
/** |
548 | 548 |
* Calcula el contenido del fichero de georreferenciaci?n de una imagen. |
549 | 549 |
* @param bBox Tama?o y posici?n de la imagen (en coordenadas de usuario) |
... | ... | |
553 | 553 |
*/ |
554 | 554 |
public String getDataWorldFile(Rectangle2D bBox, Dimension sz) throws IOException { |
555 | 555 |
StringBuffer data = new StringBuffer(); |
556 |
data.append((bBox.getMaxX() - bBox.getMinX())/(sz.getWidth() - 1)+"\n");
|
|
557 |
data.append("0.0\n");
|
|
558 |
data.append("0.0\n");
|
|
559 |
data.append((bBox.getMaxY() - bBox.getMinY())/(sz.getHeight() - 1)+"\n");
|
|
560 |
data.append(""+bBox.getMinX()+"\n");
|
|
561 |
data.append(""+bBox.getMinY()+"\n");
|
|
562 |
return data.toString();
|
|
556 |
data.append((bBox.getMaxX() - bBox.getMinX())/(sz.getWidth() - 1)+"\n");
|
|
557 |
data.append("0.0\n");
|
|
558 |
data.append("0.0\n");
|
|
559 |
data.append((bBox.getMaxY() - bBox.getMinY())/(sz.getHeight() - 1)+"\n");
|
|
560 |
data.append(""+bBox.getMinX()+"\n");
|
|
561 |
data.append(""+bBox.getMinY()+"\n");
|
|
562 |
return data.toString();
|
|
563 | 563 |
} |
564 | 564 |
|
565 | 565 |
/** |
... | ... | |
579 | 579 |
raster.filterStack = this.filterStack; |
580 | 580 |
|
581 | 581 |
raster.setTransparency(false); |
582 |
|
|
582 |
|
|
583 | 583 |
//Asignamos transparencia y orden de bandas |
584 | 584 |
if (this.transparency==-1 && !firstLoad); |
585 | 585 |
else |
... | ... | |
588 | 588 |
raster.setBand(GeoRasterFile.RED_BAND,rband); |
589 | 589 |
raster.setBand(GeoRasterFile.GREEN_BAND, gband); |
590 | 590 |
raster.setBand(GeoRasterFile.BLUE_BAND, bband); |
591 |
|
|
591 |
|
|
592 | 592 |
//Despues del primer pxRaster asignamos el stackManager guardado para los siguientes. |
593 | 593 |
//Con esto conseguimos asignar los cambios que se hayan producido desde el cuadro de |
594 | 594 |
//propiedades cuando creamos un nuevo pxRaster |
595 | 595 |
if (this.stackManager != null) |
596 | 596 |
raster.setStackManager(this.stackManager); |
597 |
|
|
597 |
|
|
598 | 598 |
if (visualStatus != null){ |
599 | 599 |
visualStatus.bandCount = raster.getBandCount(); |
600 | 600 |
visualStatus.dataType = raster.getDataType(); |
... | ... | |
617 | 617 |
public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale) throws DriverException { |
618 | 618 |
draw(null, g, viewPort, cancel, scale); |
619 | 619 |
} |
620 |
|
|
620 |
|
|
621 | 621 |
/** |
622 | 622 |
* @return Returns the raster. |
623 | 623 |
*/ |
624 | 624 |
public PxRaster getPxRaster() { |
625 | 625 |
return raster; |
626 | 626 |
} |
627 |
|
|
627 |
|
|
628 | 628 |
/** |
629 | 629 |
* Returns the XMLEntity containing the necessary info for reproduce |
630 | 630 |
* the layer. |
... | ... | |
637 | 637 |
*/ |
638 | 638 |
public XMLEntity getXMLEntity() throws XMLException { |
639 | 639 |
XMLEntity xml = super.getXMLEntity(); |
640 |
|
|
640 |
|
|
641 | 641 |
xml.putProperty("wcs.host", getHost()); |
642 | 642 |
xml.putProperty("wcs.fullExtent", StringUtilities.rect2String( fullExtent )); |
643 | 643 |
xml.putProperty("wcs.layerQuery", coverageName ); |
... | ... | |
656 | 656 |
} |
657 | 657 |
return xml; |
658 | 658 |
} |
659 |
|
|
659 |
|
|
660 | 660 |
/** |
661 | 661 |
* Reproduces the layer from an XMLEntity. |
662 | 662 |
* |
663 | 663 |
* A partir del XMLEntity reproduce la capa. |
664 | 664 |
* |
665 |
* @param xml XMLEntity |
|
665 |
* @param xml XMLEntity
|
|
666 | 666 |
* |
667 | 667 |
* @throws XMLException |
668 | 668 |
* @throws DriverException |
... | ... | |
706 | 706 |
maxRes = new Point2D.Double(xml.getDoubleProperty("wcs.maxResX"), xml.getDoubleProperty("wcs.maxResY")); |
707 | 707 |
|
708 | 708 |
// OnlineResources |
709 |
if (xml.contains("onlineResources")) {
|
|
710 |
String[] operations = xml.getStringProperty("onlineResources").split("~##SEP1##~");
|
|
711 |
for (int i = 0; i < operations.length; i++) {
|
|
709 |
if (xml.contains("onlineResources")) {
|
|
710 |
String[] operations = xml.getStringProperty("onlineResources").split("~##SEP1##~");
|
|
711 |
for (int i = 0; i < operations.length; i++) {
|
|
712 | 712 |
String[] resources = operations[i].split("~##SEP2##~"); |
713 | 713 |
if (resources.length==2 && resources[1]!="") |
714 | 714 |
onlineResources.put(resources[0], resources[1]); |
715 | 715 |
} |
716 |
}
|
|
716 |
}
|
|
717 | 717 |
String claseStr = null; |
718 | 718 |
if (xml.contains("raster.class")) { |
719 | 719 |
claseStr = xml.getStringProperty("raster.class"); |
... | ... | |
746 | 746 |
} |
747 | 747 |
firstLoad = true; |
748 | 748 |
} |
749 |
|
|
749 |
|
|
750 | 750 |
public void setCoverageName(String coverageName) { |
751 | 751 |
this.coverageName = coverageName; |
752 | 752 |
} |
753 |
|
|
753 |
|
|
754 | 754 |
public void setParameter(String parametersString) { |
755 | 755 |
this.parameter = parametersString; |
756 | 756 |
} |
757 |
|
|
757 |
|
|
758 | 758 |
public void setTime(String time) { |
759 | 759 |
this.time = time; |
760 | 760 |
} |
761 |
|
|
761 |
|
|
762 | 762 |
public void setSRS(String srs) { |
763 | 763 |
this.srs = srs; |
764 | 764 |
} |
765 |
|
|
765 |
|
|
766 | 766 |
public void setFormat(String format) { |
767 | 767 |
this.format = format; |
768 | 768 |
} |
769 |
|
|
770 |
|
|
769 |
|
|
770 |
|
|
771 | 771 |
/** |
772 | 772 |
* Inserta el URL. |
773 | 773 |
* |
... | ... | |
790 | 790 |
public void setHost(URL host) { |
791 | 791 |
this.host = host; |
792 | 792 |
} |
793 |
|
|
793 |
|
|
794 | 794 |
/** |
795 | 795 |
* Sets the layer's full extent. |
796 | 796 |
* |
... | ... | |
810 | 810 |
public URL getHost() { |
811 | 811 |
return host; |
812 | 812 |
} |
813 |
|
|
813 |
|
|
814 | 814 |
/** |
815 | 815 |
* Remote source layers have a bunch of properties that are required for get them from |
816 | 816 |
* the servers. This method supplies a hash table containing any needed field. This hash |
... | ... | |
838 | 838 |
|
839 | 839 |
return info; |
840 | 840 |
} |
841 |
|
|
841 |
|
|
842 | 842 |
/** |
843 | 843 |
* Obtiene la extensi?n del fichero de georreferenciaci?n |
844 | 844 |
* @return String con la extensi�n del fichero de georreferenciaci�n dependiendo |
... | ... | |
846 | 846 |
*/ |
847 | 847 |
private String getExtensionWorldFile(){ |
848 | 848 |
String extWorldFile = ".wld"; |
849 |
if (format.equals("image/tif") || format.equals("image/tiff"))
|
|
850 |
extWorldFile = ".tfw";
|
|
851 |
if (format.equals("image/jpeg"))
|
|
852 |
extWorldFile = ".jpgw";
|
|
853 |
return extWorldFile;
|
|
849 |
if (format.equals("image/tif") || format.equals("image/tiff"))
|
|
850 |
extWorldFile = ".tfw";
|
|
851 |
if (format.equals("image/jpeg"))
|
|
852 |
extWorldFile = ".jpgw";
|
|
853 |
return extWorldFile;
|
|
854 | 854 |
} |
855 | 855 |
|
856 | 856 |
public void setMaxResolution(Point2D maxResolution) { |
857 | 857 |
this.maxRes = maxResolution; |
858 | 858 |
} |
859 |
|
|
859 |
|
|
860 | 860 |
/** |
861 | 861 |
* Gets the last open GeoRasterFile against the temp file received |
862 | 862 |
* |
... | ... | |
908 | 908 |
return maxRes; |
909 | 909 |
} |
910 | 910 |
|
911 |
|
|
911 |
|
|
912 | 912 |
public void setDriver(FMapWCSDriver driver) { |
913 | 913 |
this.driver = driver; |
914 | 914 |
} |
915 |
|
|
916 |
/** |
|
917 |
* The full extent of the layer. |
|
918 |
* |
|
919 |
* La extensi?n completa de la layer. |
|
920 |
* |
|
921 |
* @return Rectangle2D |
|
922 |
* / |
|
923 |
public Rectangle2D getFullExtent(){// throws DriverException { |
|
924 |
try { |
|
925 |
return getWCSAdaptor().getFullExtent(); |
|
926 |
} catch (IOException e) { |
|
927 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
|
928 |
"error_comunicacion_servidor", "Error", JOptionPane.ERROR_MESSAGE); |
|
929 |
} catch (DriverException e) { |
|
930 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
|
931 |
"servidor_wcs_no_responde", "Error", JOptionPane.ERROR_MESSAGE); |
|
932 |
} |
|
933 |
return null; |
|
934 |
} |
|
935 |
|
|
936 |
/** |
|
937 |
* Draws the layer on the ViewPort using PxRaster. |
|
938 |
* |
|
939 |
* Dibuja la capa en el ViewPort con PxRaster. |
|
940 |
* / |
|
941 |
public void draw(BufferedImage image, Graphics2D g, |
|
942 |
ViewPort viewPort, Cancellable cancel, double scale) throws DriverException { |
|
943 |
/* This try loop I've moved here is for show an alert window when it is not |
|
944 |
* possible to download the coverage. |
|
945 |
* / |
|
946 |
try { |
|
947 |
if (!isWithinScale(scale)) |
|
948 |
return; |
|
949 |
|
|
950 |
if(status!=null && wcs.firstLoad){ |
|
951 |
wcs.draw(image, g, viewPort, cancel); |
|
952 |
status.applyStatus(this); |
|
953 |
wcs.firstLoad = false; |
|
954 |
} |
|
955 |
|
|
956 |
wcs.draw(image, g, viewPort, cancel); |
|
957 |
} catch (ServerErrorResponseException e) { |
|
958 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), e.getMessage(), "Error", |
|
959 |
JOptionPane.ERROR_MESSAGE); |
|
960 |
} catch (IOException e){ |
|
961 |
this.setActive(false); |
|
962 |
this.setVisible(false); |
|
963 |
throw new DriverException("Error en la conexi?n", e); |
|
964 |
} |
|
965 |
} |
|
966 |
/** |
|
967 |
* Prints the layer. |
|
968 |
* |
|
969 |
* Imprime la cobertura. |
|
970 |
* / |
|
971 |
public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale) |
|
972 |
throws DriverException { |
|
973 |
draw(null, g, viewPort, cancel, scale); |
|
974 |
} |
|
975 |
|
|
976 |
/** |
|
977 |
* Sets the layer's label. That what is going to be used at the TOC. |
|
978 |
* |
|
979 |
* Establece la etiqueta de la cobertura. La que se usar? en el TOC. |
|
980 |
* |
|
981 |
* @param lbl |
|
982 |
* / |
|
983 |
public void setLabel(String lbl) { |
|
984 |
label = lbl; |
|
985 |
} |
|
986 |
|
|
987 |
/** |
|
988 |
* Sets the layer's full extent. |
|
989 |
* |
|
990 |
* Establece la extensi?n m?xima de la capa. |
|
991 |
* |
|
992 |
* @param rect |
|
993 |
* / |
|
994 |
public void setFullExtent(Rectangle2D rect) { |
|
995 |
wcs.setFullExtent(rect); |
|
996 |
} |
|
997 |
|
|
998 |
/** |
|
999 |
* Recovers the name of the layer shown on the TOC. The text used for the name |
|
1000 |
* is not the actual coverage's name but that what appears in the wizard's text |
|
1001 |
* field which initially correponds with the "label" specified by the server for |
|
1002 |
* the coverage and may be edited by the user for choose whatever she/he wants. |
|
1003 |
* |
|
1004 |
* Recupera el nom de la capa mostrada al TOC. El text per al nom no ?s el |
|
1005 |
* nom de la cobertura sin? el text que apareix al camp de text del wizard, |
|
1006 |
* que es correspon amb la "label" que el servidor especifica per a la |
|
1007 |
* covertura, i pot ser modificat per l'usuari al wizard per a gastar el que |
|
1008 |
* dessitge. |
|
1009 |
* |
|
1010 |
* @return String |
|
1011 |
* / |
|
1012 |
public String getLabel() { |
|
1013 |
return this.label; |
|
1014 |
} |
|
1015 |
|
|
1016 |
/** |
|
1017 |
* Remote source layers have a bunch of properties that are required for get them from |
|
1018 |
* the servers. This method supplies a hash table containing any needed field. This hash |
|
1019 |
* table may be used to let the client to connect to a server and restore a previously saved |
|
1020 |
* layer. So, the layer itself may not be saved to the disk since the actual saved |
|
1021 |
* info is just its properties. |
|
1022 |
* |
|
1023 |
* @return Returns a hash table containing all the required information for |
|
1024 |
* set up a wms layer |
|
1025 |
* / |
|
1026 |
public Hashtable getProperties(){ |
|
1027 |
Hashtable info = new Hashtable(); |
|
1028 |
info.put( "name", getCoverageName()); |
|
1029 |
info.put( "host", getHost()); |
|
1030 |
info.put( "crs", wcs.getSRS()); |
|
1031 |
info.put( "format", wcs.getFormat()); |
|
1032 |
String str = wcs.getTime(); |
|
1033 |
if (str==null) |
|
1034 |
str = ""; |
|
1035 |
info.put( "time", str); |
|
1036 |
str = wcs.getParameter(); |
|
1037 |
if (str==null) |
|
1038 |
str = ""; |
|
1039 |
info.put("parameter", str); |
|
1040 |
|
|
1041 |
return info; |
|
1042 |
} |
|
1043 |
|
|
1044 |
|
|
1045 |
/** |
|
1046 |
* Returns the coverage name. |
|
1047 |
* |
|
1048 |
* Obtiene el nombre de la cobertura. |
|
1049 |
* @return String |
|
1050 |
* / |
|
1051 |
public String getCoverageName() { |
|
1052 |
return wcs.getCoverageName(); |
|
1053 |
} |
|
1054 |
|
|
1055 |
/** |
|
1056 |
* Returns the coverage format. |
|
1057 |
* |
|
1058 |
* Obtiene el formato en que la cobertura est? codificado. |
|
1059 |
* @return String |
|
1060 |
* / |
|
1061 |
public String getFormat() { |
|
1062 |
return wcs.getFormat(); |
|
1063 |
} |
|
1064 |
|
|
1065 |
/** |
|
1066 |
* Returns the WCS server URL. |
|
1067 |
* |
|
1068 |
* Obtiene la direcci?n URL del servidor WCS |
|
1069 |
* |
|
1070 |
* @return String |
|
1071 |
* / |
|
1072 |
public String getHost() { |
|
1073 |
return wcs.getHost(); |
|
1074 |
} |
|
1075 |
|
|
1076 |
/** |
|
1077 |
* Returns the parameter value. |
|
1078 |
* |
|
1079 |
* Obtiene el valor del par?metro. |
|
1080 |
* @return String |
|
1081 |
* / |
|
1082 |
public String getParameter() { |
|
1083 |
return wcs.getParameter(); |
|
1084 |
} |
|
1085 |
|
|
1086 |
/** |
|
1087 |
* Returns the current SRS. |
|
1088 |
* |
|
1089 |
* Obtiene el SRS actual de la cobertura. |
|
1090 |
* @return String |
|
1091 |
* / |
|
1092 |
public String getSRS() { |
|
1093 |
return wcs.getSRS(); |
|
1094 |
} |
|
1095 |
|
|
1096 |
/** |
|
1097 |
* Returns the TIME value in the WCS query. |
|
1098 |
* |
|
1099 |
* Obtiene el valor para TIME en la consulta WCS. |
|
1100 |
* @return String |
|
1101 |
* / |
|
1102 |
public String getTime() { |
|
1103 |
return wcs.getTime(); |
|
1104 |
} |
|
1105 |
|
|
1106 |
/** |
|
1107 |
* Sets the FORMAT parameter that we are requesting the WCS coverage. |
|
1108 |
* |
|
1109 |
* Establece el par?metro FORMAT en que se pide la cobertura WCS |
|
1110 |
* @param format |
|
1111 |
* / |
|
1112 |
public void setFormat(String format) { |
|
1113 |
wcs.setFormat(format); |
|
1114 |
} |
|
1115 |
|
|
1116 |
/** |
|
1117 |
* Sets the server's URL. |
|
1118 |
* |
|
1119 |
* Establece la direcci?n URL del servidor WCS |
|
1120 |
* @param host |
|
1121 |
* / |
|
1122 |
public void setHost(String host) { |
|
1123 |
if (wcs == null) { |
|
1124 |
wcs = new FMapWCSAdapter(); |
|
1125 |
wcs.setDriver(new FMapWCSDriver()); |
|
1126 |
} |
|
1127 |
wcs.setHost(host); |
|
1128 |
} |
|
1129 |
|
|
1130 |
/** |
|
1131 |
* Sets the parameter. It is defined by a name-value pair and the value is |
|
1132 |
* a comma-separated list of values. |
|
1133 |
* |
|
1134 |
* Establece el nombre y el valor (lista de valores separados por comas) |
|
1135 |
* del par?metro de la consulta WCS |
|
1136 |
* @param parameter |
|
1137 |
* / |
|
1138 |
public void setParameter(String parameter) { |
|
1139 |
wcs.setParameter(parameter); |
|
1140 |
} |
|
1141 |
|
|
1142 |
/** |
|
1143 |
* Sets the SRS parameter within the WCS query. |
|
1144 |
* |
|
1145 |
* Establece el SRS de la consulta WCS. |
|
1146 |
* @param srs |
|
1147 |
* / |
|
1148 |
public void setSRS(String srs) { |
|
1149 |
wcs.setSRS(srs); |
|
1150 |
} |
|
1151 |
|
|
1152 |
/** |
|
1153 |
* Sets the TIME parameter within the WCS query. |
|
1154 |
* |
|
1155 |
* Establece el par?metro TIME de la consulta WCS. |
|
1156 |
* @param time |
|
1157 |
* / |
|
1158 |
public void setTime(String time) { |
|
1159 |
wcs.setTime(time); |
|
1160 |
} |
|
1161 |
|
|
1162 |
/** |
|
1163 |
* Sets the COVERAGE parameter within the WCS query. |
|
1164 |
* |
|
1165 |
* Establece el par?metro COVERAGE de la consulta WCS. |
|
1166 |
* @param coverageName |
|
1167 |
* / |
|
1168 |
public void setCoverageName(String coverageName) { |
|
1169 |
wcs.setCoverageName(coverageName); |
|
1170 |
} |
|
1171 |
|
|
1172 |
/** |
|
1173 |
* Gets the max resolution allowed by the coverage. Requesting a higher resolution |
|
1174 |
* than this value does not cause any error, but the info responsed is just an |
|
1175 |
* interpolation. |
|
1176 |
* |
|
1177 |
* In exchange for obtaining a greater file and without additional information, |
|
1178 |
* we can easily connect it at the View. |
|
1179 |
* |
|
1180 |
* |
|
1181 |
* Obtiene la resoluci?n m?xima soportada por la cobertura. La petici?n |
|
1182 |
* de una resoluci?n superior a la soportada no provoca ning?n error, aunque |
|
1183 |
* la informaci?n obtenida s?lo es una mera interpolaci?n de informaci?n. |
|
1184 |
* |
|
1185 |
* A cambio de obtener un archivo mayor y sin informaci?n adicional, podemos |
|
1186 |
* f?cilmente acoplarlo a la vista. |
|
1187 |
* |
|
1188 |
* @return double |
|
1189 |
* / |
|
1190 |
public Point2D getMaxResolution() { |
|
1191 |
return wcs.getMaxResolution(); |
|
1192 |
} |
|
1193 |
|
|
1194 |
/** |
|
1195 |
* Sets the MAX resolution supported by the coverage. |
|
1196 |
* |
|
1197 |
* The max resolution is given by the server within the DescribeCoverage document |
|
1198 |
* in the SpationDomain section. |
|
1199 |
* |
|
1200 |
* Use this method only to load this value from there (the DescribeCoverage document) |
|
1201 |
* of from an already saved project because an incorrect value will bring |
|
1202 |
* computing errors when doing "zoom to raster resolution". |
|
1203 |
* |
|
1204 |
* |
|
1205 |
* |
|
1206 |
* Establece la resoluci?n M?XIMA que soporta la cobertura. |
|
1207 |
* |
|
1208 |
* La resoluci?n m?xima viene fijada por el servidor dentro documento |
|
1209 |
* DescribeCoverage en la secci?n SpatialDomain. |
|
1210 |
* |
|
1211 |
* Use este m?todo ?nicamente para cargar el valor para la resoluci?n m?xima |
|
1212 |
* desde all? o desde un proyecto guardado en anterioridad, puesto que un |
|
1213 |
* valor incorrecto reportar? (conllevar?) errores de c?lculo cuando se haga |
|
1214 |
* un "zoom a la resoluci?n del r?ster". |
|
1215 |
* |
|
1216 |
* @param res |
|
1217 |
* / |
|
1218 |
//public void setMaxResolution(double res){ |
|
1219 |
public void setMaxResolution(Point2D res){ |
|
1220 |
wcs.setMaxResolution(res); |
|
1221 |
} |
|
1222 |
|
|
1223 |
/** |
|
1224 |
* Returns the adaptor. |
|
1225 |
* |
|
1226 |
* Obtiene el adaptor. |
|
1227 |
* / |
|
1228 |
public FMapWCSAdapter getWCSAdaptor(){ |
|
1229 |
return wcs; |
|
1230 |
} |
|
1231 |
|
|
1232 |
/** |
|
1233 |
* Sets the adaptor. |
|
1234 |
* |
|
1235 |
* Establece el adaptador. |
|
1236 |
* |
|
1237 |
* @deprecated |
|
1238 |
* @param wcs |
|
1239 |
* / |
|
1240 |
public void setWCSAdaptor(FMapWCSAdapter wcs){ |
|
1241 |
this.wcs = wcs; |
|
1242 |
} |
|
1243 |
|
|
1244 |
/** |
|
1245 |
* Returns the bounding box that is being used. |
|
1246 |
* |
|
1247 |
* Obtiene la Bounding Box sobre la que se est? operando |
|
1248 |
* @return Rectangle2D |
|
1249 |
* / |
|
1250 |
private Rectangle2D getBbox() { |
|
1251 |
return wcs.getBbox(); |
|
1252 |
} |
|
1253 |
|
|
1254 |
/** |
|
1255 |
* Returns the current resolution for the coverage at the view. |
|
1256 |
* |
|
1257 |
* Obtiene la resoluci?n actual para la cobertura de la vista. |
|
1258 |
* @return |
|
1259 |
* / |
|
1260 |
private Point2D getRes() { |
|
1261 |
return wcs.getRes(); |
|
1262 |
} |
|
1263 |
|
|
1264 |
/** |
|
1265 |
* Sets the current resolution for the coverage at the view. |
|
1266 |
* This value is automatically calculated by gvSIG. Thus, this method should |
|
1267 |
* be used only to reload this value from a previously saved project. |
|
1268 |
* |
|
1269 |
* Establece la resoluci?n actual para la cobertura de la vista. |
|
1270 |
* Este valor es calculado autom?ticamente por gvSIG. ?ste m?todo deber?a |
|
1271 |
* ser usado ?nicamente para recuperar este valor de un proyecto |
|
1272 |
* anteriormente guardado. |
|
1273 |
* @param res |
|
1274 |
* / |
|
1275 |
//private void setRes(double res) { |
|
1276 |
private void setRes(Point2D res) { |
|
1277 |
wcs.setRes(res); |
|
1278 |
} |
|
1279 |
|
|
1280 |
/** |
|
1281 |
* Sets the area of the coverage to request. |
|
1282 |
* This value is automatically calculated by gvSIG. Thus, this method should |
|
1283 |
* be used only to reload this value from a previuosly saved project. |
|
1284 |
* |
|
1285 |
* Establece el ?rea de la cobertura a pedir. |
|
1286 |
* Este valor es calculado autom?ticamente por gvSIG. ?ste m?todo deber?a |
|
1287 |
* ser usado ?nicamente para recuperar el valor de un proyecto anteriormente |
|
1288 |
* guardado. |
|
1289 |
* |
|
1290 |
* @param rect |
|
1291 |
* / |
|
1292 |
private void setBBox(Rectangle2D rect) { |
|
1293 |
wcs.setBBox(rect); |
|
1294 |
} |
|
1295 |
|
|
1296 |
/** |
|
1297 |
* Builds a coverage starting from a full GetCoverage URL. |
|
1298 |
* (Using this is not a regular function) |
|
1299 |
* |
|
1300 |
* Inicializa una cobertura a partir de una URL GetCoverage completa. |
|
1301 |
* (To use this method supposes to skip all the regular operation) |
|
1302 |
* |
|
1303 |
* / |
|
1304 |
public void initFromQueryString(String queryString){ |
|
1305 |
System.out.println("Query = "+queryString); |
|
1306 |
TreeMap map = new TreeMap(); |
|
1307 |
String[] params = queryString.split("&"); |
|
1308 |
for (int i = 0; i < params.length; i++) { |
|
1309 |
String[] nameValue = params[i].split("="); |
|
1310 |
map.put(nameValue[0].toUpperCase(), nameValue[1]); |
|
1311 |
} |
|
1312 |
try { |
|
1313 |
String coverageName = (String) map.get((String) "COVERAGE"); |
|
1314 |
String crs = (String) map.get((String) "CRS"); |
|
1315 |
String format = (String) map.get((String) "FORMAT"); |
|
1316 |
String time = (String) map.get((String) "TIME"); |
|
1317 |
String bands = (String) map.get((String) "BANDS"); |
|
1318 |
|
|
1319 |
setSRS(crs); |
|
1320 |
setCoverageName(coverageName); |
|
1321 |
if (time != null) |
|
1322 |
setTime("TIME="+time); |
|
1323 |
OGCWCSService service = (OGCWCSService) wcs.getDriver(); |
|
1324 |
service.connect(); |
|
1325 |
|
|
1326 |
setLabel( service.getLabel(coverageName) ); |
|
1327 |
setName( getLabel() ); |
|
1328 |
setFullExtent ( service.getFullExtent(coverageName, crs) ); |
|
1329 |
setFormat( format ); |
|
1330 |
setParameter( "BANDS="+bands ); |
|
1331 |
setMaxResolution ( service.getMaxResolution(coverageName) ); |
|
1332 |
|
|
1333 |
} catch (IOException e) { |
|
1334 |
e.printStackTrace(); |
|
1335 |
} catch (DriverException e) { |
|
1336 |
e.printStackTrace(); |
|
1337 |
} |
|
1338 |
} |
|
1339 |
|
|
1340 |
|
|
1341 |
|
|
1342 |
/** |
|
1343 |
* Builds a coverage starting from a full GetCoverage URL. |
|
1344 |
* (Using this is not a regular function) |
|
1345 |
* |
|
1346 |
* Inicializa una cobertura a partir de una URL GetCoverage completa. |
|
1347 |
* (Usar este m?todo supone saltarse todo el funcionamiento normal) |
|
1348 |
* |
|
1349 |
* TODO Por completar y probar |
|
1350 |
* @param queryString |
|
1351 |
* / |
|
1352 |
public void initFromQueryString2(String queryString){ |
|
1353 |
|
|
1354 |
String host = queryString.substring(0, queryString.indexOf('?')); |
|
1355 |
String[] params = queryString.substring(queryString.indexOf('?')+1, queryString.length()).split("="); |
|
1356 |
setHost(host); |
|
1357 |
for (int i = 0; i < params.length; i++) { |
|
1358 |
String[] par_nombreValor = params[i].split("="); |
|
1359 |
String nombre = par_nombreValor[0].toUpperCase(); |
|
1360 |
String valor = par_nombreValor[1]; |
|
1361 |
if (nombre.equals("COVERAGE")) setCoverageName(valor); |
|
1362 |
else if (nombre.equals("TIME")) setTime(valor); |
|
1363 |
else if (nombre.equals("FORMAT")) setFormat(valor); |
|
1364 |
else if (nombre.equals("CRS")) setSRS(valor); |
|
1365 |
else if (nombre.equals("EXCEPTIONS")) continue; |
|
1366 |
else if (nombre.equals("RESX")) continue; |
|
1367 |
else if (nombre.equals("RESY")) continue; |
|
1368 |
else if (nombre.equals("RESZ")) continue; |
|
1369 |
else if (nombre.equals("WIDTH")) continue; |
|
1370 |
else if (nombre.equals("HEIGHT")) continue; |
|
1371 |
else if (nombre.equals("DEPTH")) continue; |
|
1372 |
else if (nombre.equals("BBOX")) continue; |
|
1373 |
else if (nombre.equals("RESPONSE_CRS")) continue; |
|
1374 |
else setParameter(nombre+"="+valor); |
|
1375 |
} |
|
1376 |
OGCWCSService service = (OGCWCSService) wcs.getDriver(); |
|
1377 |
try { |
|
1378 |
service.connect(); |
|
1379 |
String coverageName = getCoverageName(); |
|
1380 |
setLabel( service.getLabel(coverageName) ); |
|
1381 |
setName( getLabel() ); |
|
1382 |
setFullExtent ( service.getFullExtent(coverageName, getSRS()) ); |
|
1383 |
setMaxResolution ( service.getMaxResolution(coverageName) ); |
|
1384 |
} catch (IOException e) { |
|
1385 |
e.printStackTrace(); |
|
1386 |
} catch (DriverException e) { |
|
1387 |
e.printStackTrace(); |
|
1388 |
} |
|
1389 |
|
|
1390 |
} |
|
1391 |
|
|
1392 |
/** |
|
1393 |
* Devuelve la pila de filtros aplicada sobre la capa raster. |
|
1394 |
* |
|
1395 |
* @return RasterFilterStack. |
|
1396 |
* / |
|
1397 |
public RasterFilterStack getFilterStack() { |
|
1398 |
return wcs.getFilterStack(); |
|
1399 |
} |
|
1400 |
|
|
1401 |
/** |
|
1402 |
* Asigna la pila de filtros aplicada al raster |
|
1403 |
* @return |
|
1404 |
* / |
|
1405 |
public void setFilterStack(RasterFilterStack stack){ |
|
1406 |
wcs.setFilterStack(stack); |
|
1407 |
} |
|
1408 |
|
|
1409 |
/* (non-Javadoc) |
|
1410 |
* @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#setTransparency(int) |
|
1411 |
* / |
|
1412 |
public void setTransparency(int trans) { |
|
1413 |
wcs.setTransparency(trans); |
|
1414 |
} |
|
1415 |
|
|
1416 |
/* (non-Javadoc) |
|
1417 |
* @see com.iver.cit.gvsig.fmap.layers.RasterOperations#setBand(int, int) |
|
1418 |
* / |
|
1419 |
public void setBand(int flag, int nBand) { |
|
1420 |
switch(flag){ |
|
1421 |
case GeoRasterFile.RED_BAND:wcs.setBandR(nBand);break; |
|
1422 |
case GeoRasterFile.GREEN_BAND:wcs.setBandG(nBand);break; |
|
1423 |
case GeoRasterFile.BLUE_BAND:wcs.setBandB(nBand);break; |
|
1424 |
} |
|
1425 |
} |
|
1426 |
|
|
1427 |
/* (non-Javadoc) |
|
1428 |
* @see com.iver.cit.gvsig.fmap.layers.RasterOperations#getAttributes() |
|
1429 |
* / |
|
1430 |
public ArrayList getAttributes() { |
|
1431 |
return wcs.getAttributes(); |
|
1432 |
} |
|
1433 |
/* (non-Javadoc) |
|
1434 |
* @see com.iver.cit.gvsig.fmap.layers.RasterOperations#getHeight() |
|
1435 |
* / |
|
1436 |
public double getHeight() { |
|
1437 |
if(wcs.getGeoRasterFile() != null) |
|
1438 |
return wcs.getGeoRasterFile().getHeight(); |
|
1439 |
else |
|
1440 |
return 0; |
|
1441 |
} |
|
1442 |
/* (non-Javadoc) |
|
1443 |
* @see com.iver.cit.gvsig.fmap.layers.RasterOperations#getMaxX() |
|
1444 |
* / |
|
1445 |
public double getMaxX() { |
|
1446 |
if(wcs.getPxRaster() != null) |
|
1447 |
return wcs.getPxRaster().getExtent().getMax().getX(); |
|
1448 |
else |
|
1449 |
return 0; |
|
1450 |
} |
|
1451 |
/* (non-Javadoc) |
|
1452 |
* @see com.iver.cit.gvsig.fmap.layers.RasterOperations#getMaxY() |
|
1453 |
* / |
|
1454 |
public double getMaxY() { |
|
1455 |
if(wcs.getPxRaster() != null) |
|
1456 |
return wcs.getPxRaster().getExtent().getMax().getY(); |
|
1457 |
else |
|
1458 |
return 0; |
|
1459 |
} |
|
1460 |
/* (non-Javadoc) |
|
1461 |
* @see com.iver.cit.gvsig.fmap.layers.RasterOperations#getMinX() |
|
1462 |
* / |
|
1463 |
public double getMinX() { |
|
1464 |
if(wcs.getPxRaster() != null) |
|
1465 |
return wcs.getPxRaster().getExtent().getMin().getX(); |
|
1466 |
else |
|
1467 |
return 0; |
|
1468 |
} |
|
1469 |
/* (non-Javadoc) |
|
1470 |
* @see com.iver.cit.gvsig.fmap.layers.RasterOperations#getMinY() |
|
1471 |
* / |
|
1472 |
public double getMinY() { |
|
1473 |
if(wcs.getPxRaster() != null) |
|
1474 |
return wcs.getPxRaster().getExtent().getMin().getY(); |
|
1475 |
else |
|
1476 |
return 0; |
|
1477 |
} |
|
1478 |
/* (non-Javadoc) |
|
1479 |
* @see com.iver.cit.gvsig.fmap.layers.RasterOperations#getPixel(double, double) |
|
1480 |
* / |
|
1481 |
public int[] getPixel(double wcx, double wcy) { |
|
1482 |
if(wcs.getPxRaster() != null) |
|
1483 |
return wcs.getPxRaster().getPixel(wcx, wcy); |
|
1484 |
else |
|
1485 |
return null; |
|
1486 |
} |
|
1487 |
/* (non-Javadoc) |
|
1488 |
* @see com.iver.cit.gvsig.fmap.layers.RasterOperations#getSource() |
|
1489 |
* / |
|
1490 |
public RasterAdapter getSource() { |
|
1491 |
// TODO Auto-generated method stub |
|
1492 |
return null; |
|
1493 |
} |
|
1494 |
/* (non-Javadoc) |
|
1495 |
* @see com.iver.cit.gvsig.fmap.layers.RasterOperations#getWidth() |
|
1496 |
* / |
|
1497 |
public double getWidth() { |
|
1498 |
if(wcs.getGeoRasterFile() != null) |
|
1499 |
return wcs.getGeoRasterFile().getWidth(); |
|
1500 |
else |
|
1501 |
return 0; |
|
1502 |
} |
|
1503 |
/* (non-Javadoc) |
|
1504 |
* @see com.iver.cit.gvsig.fmap.layers.RasterOperations#setPos(int, int) |
|
1505 |
* / |
|
1506 |
public void setPos(int x, int y) { |
|
1507 |
this.posX = x; |
|
1508 |
this.posY = y; |
|
1509 |
} |
|
1510 |
/* (non-Javadoc) |
|
1511 |
* @see com.iver.cit.gvsig.fmap.layers.RasterOperations#setPosWC(double, double) |
|
1512 |
* / |
|
1513 |
public void setPosWC(double x, double y) { |
|
1514 |
this.posXWC = x; |
|
1515 |
this.posYWC = y; |
|
1516 |
} |
|
1517 |
/* (non-Javadoc) |
|
1518 |
* @see com.iver.cit.gvsig.fmap.layers.RasterOperations#setRGB(int, int, int) |
|
1519 |
* / |
|
1520 |
public void setRGB(int r, int g, int b) { |
|
1521 |
this.r = r; |
|
1522 |
this.g = g; |
|
1523 |
this.b = b; |
|
1524 |
} |
|
1525 |
/* (non-Javadoc) |
|
1526 |
* @see com.iver.cit.gvsig.fmap.layers.RasterOperations#setSource(com.iver.cit.gvsig.fmap.layers.RasterAdapter) |
|
1527 |
* / |
|
1528 |
public void setSource(RasterAdapter ra) { |
|
1529 |
// TODO Auto-generated method stub |
|
1530 |
|
|
1531 |
} |
|
1532 |
/* (non-Javadoc) |
|
1533 |
* @see com.iver.cit.gvsig.fmap.layers.layerOperations.InfoByPoint#queryByPoint(java.awt.Point) |
|
1534 |
* / |
|
1535 |
public String queryByPoint(Point p) throws DriverException { |
|
1536 |
String data = "<file:"+getName().replaceAll("[^a-zA-Z0-9]","")+">\n"; |
|
1537 |
ArrayList attr = this.getAttributes(); |
|
1538 |
data += " <raster\n"; |
|
1539 |
data += " File=\""+getName()+"\"\n"; |
|
1540 |
for (int i=0; i<attr.size(); i++) { |
|
1541 |
Object [] a = (Object []) attr.get(i); |
|
1542 |
|
|
1543 |
data += " "+a[0].toString()+"="; |
|
1544 |
if (a[1].toString() instanceof String) |
|
1545 |
data += "\""+a[1].toString()+"\"\n"; |
|
1546 |
else |
|
1547 |
data += a[1].toString()+"\n"; |
|
1548 |
} |
|
1549 |
data += " Point=\""+posX+" , "+posY+"\"\n"; |
|
1550 |
data += " Point_WC=\""+posXWC+" , "+posYWC+"\"\n"; |
|
1551 |
data += " RGB=\""+r+", "+g+", "+b+"\"\n"; |
|
1552 |
data += " />\n"; |
|
1553 |
|
|
1554 |
data += "</file:"+getName().replaceAll("[^a-zA-Z0-9]","")+">\n"; |
|
1555 |
System.out.println(data); |
|
1556 |
return data; |
|
1557 |
} |
|
1558 |
|
|
1559 |
|
|
1560 |
/* (non-Javadoc) |
|
1561 |
* @see com.iver.cit.gvsig.fmap.layers.RasterOperations#setTempExtent(com.iver.cit.gvsig.fmap.ViewPort) |
|
1562 |
* / |
|
1563 |
public void setTempExtent(ViewPort vp){ |
|
1564 |
|
|
1565 |
} |
|
1566 |
/**/ |
|
1567 |
|
|
1568 |
|
|
1569 |
|
|
1570 | 915 |
} |
Also available in: Unified diff