Ignore:
Timestamp:
2009-08-16T23:36:16+02:00 (16 years ago)
Author:
pieren
Message:

raster image feature implementation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreGrabber.java

    r16581 r17089  
    1919public class CadastreGrabber {
    2020
    21     public static final double epsilon = 1e-11;
     21    public final static double epsilon = 1e-11;
    2222
    23     private CadastreInterface wmsInterface = new CadastreInterface(this);
    24     private String lastWMSLayerName = null;
    25 
    26     CadastreGrabber() {
    27         getWmsInterface().downloadCancelled = false;
    28     }
     23    private CadastreInterface wmsInterface = new CadastreInterface();
    2924
    3025    public GeorefImage grab(WMSLayer wmsLayer, EastNorth lambertMin, EastNorth lambertMax) throws IOException, OsmTransferException {
     
    3631            else
    3732                url = getURLVector(lambertMin, lambertMax);
    38             System.out.println("grab:"+url);
    3933            BufferedImage img = grab(url);
    40             ImageModifier imageModified = new ImageModifier(img);
     34            ImageModifier imageModified;
     35            if (wmsLayer.isRaster())
     36                imageModified = new RasterImageModifier(img);
     37            else
     38                imageModified = new VectorImageModifier(img);
    4139            return new GeorefImage(imageModified.bufferedImage, lambertMin, lambertMax);
    4240        } catch (MalformedURLException e) {
     
    4644
    4745    private URL getURLRaster(WMSLayer wmsLayer, EastNorth lambertMin, EastNorth lambertMax) throws MalformedURLException {
     46        // GET /scpc/wms?version=1.1&request=GetMap&layers=CDIF:PMC@QH4480001701&format=image/png&bbox=-1186,0,13555,8830&width=576&height=345&exception=application/vnd.ogc.se_inimage&styles= HTTP/1.1
     47        final int cRasterX = 1000; // keep width constant and adjust width to original image proportions
    4848        String str = new String(wmsInterface.baseURL+"/scpc/wms?version=1.1&request=GetMap");
    4949        str += "&layers=CDIF:PMC@";
     
    5252        str += "&bbox=";
    5353        str += wmsLayer.eastNorth2raster(lambertMin, lambertMax);
    54         str += "&width=600&height=600"; // maximum allowed by wms server
     54        //str += "&width=800&height=800"; // maximum allowed by wms server
     55        str += "&width="+cRasterX+"&height="; // maximum allowed by wms server (576/345, 800/378, 1000/634)
     56        str += (int)(cRasterX*(wmsLayer.communeBBox.max.getY() - wmsLayer.communeBBox.min.getY())/(wmsLayer.communeBBox.max.getX() - wmsLayer.communeBBox.min.getX()));
    5557        str += "&exception=application/vnd.ogc.se_inimage&styles=";
    5658        return new URL(str.replace(" ", "%20"));
     
    9496    }
    9597
    96     public String getLastWMSLayerName() {
    97         return lastWMSLayerName;
    98     }
    99 
    100     public void setLastWMSLayerName(String lastWMSLayerName) {
    101         this.lastWMSLayerName = lastWMSLayerName;
    102     }
    103 
    10498}
Note: See TracChangeset for help on using the changeset viewer.