Ignore:
Timestamp:
2010-03-01T18:48:22+01:00 (14 years ago)
Author:
pieren
Message:

Grabbed images resolution configurable + fixed minor issues

Location:
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr
Files:
6 edited

Legend:

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

    r19078 r20240  
    4646    private URL getURLRaster(WMSLayer wmsLayer, EastNorth lambertMin, EastNorth lambertMax) throws MalformedURLException {
    4747        // 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
    48         final int cRasterX = 800; // keep width constant and adjust width to original image proportions
     48        final int cRasterX = CadastrePlugin.imageWidth; // keep width constant and adjust width to original image proportions
    4949        String str = new String(wmsInterface.baseURL+"/scpc/wms?version=1.1&request=GetMap");
    5050        str += "&layers=CDIF:PMC@";
     
    5353        str += "&bbox=";
    5454        str += wmsLayer.eastNorth2raster(lambertMin, lambertMax);
    55         //str += "&width=800&height=800"; // maximum allowed by wms server
     55        //str += "&width=1000&height=800"; // maximum allowed by wms server
    5656        str += "&width="+cRasterX+"&height="; // maximum allowed by wms server (576/345, 800/378, 1000/634)
    5757        str += (int)(cRasterX*(wmsLayer.communeBBox.max.getY() - wmsLayer.communeBBox.min.getY())/(wmsLayer.communeBBox.max.getX() - wmsLayer.communeBBox.min.getX()));
     
    7373        str += lambertMax.east() + ",";
    7474        str += lambertMax.north();
    75         str += "&width=800&height=600"; // maximum allowed by wms server
    76         //str += "&width=1000&height=800"; // maximum allowed by wms server
     75        str += "&width="+CadastrePlugin.imageWidth+"&height="+CadastrePlugin.imageHeight;
    7776        //str += "&exception=application/vnd.ogc.se_inimage"; // used by normal client but not required
    7877        str += "&styles=LS3_90,LS2_90,LS1_90,PARCELLE_90,NUMERO_90,PT3_90,PT2_90,PT1_90,LIEUDIT_90";
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java

    r20214 r20240  
    9999 *                 - raster image rotation issues fixed, now using shift+ctrl key instead of ctrl
    100100 *                 - raster image adjustment using default system menu modifier (ctrl for windows) for Mac support
     101 *                 - image resolution configurable (high, medium, low) like the online interface
    101102 *                 - from Erik Amzallag:
    102103 *                 -     possibility to modify the auto-sourcing text just before upload
     
    129130
    130131    public static boolean drawBoundaries = false;
     132
     133    public static int imageWidth, imageHeight;
    131134
    132135    static private boolean menuEnabled = false;
     
    177180            });
    178181
    179             JMenuItem menuResetCookie = new JMenuItem(new MenuActionResetCookie());
     182            //JMenuItem menuResetCookie = new JMenuItem(new MenuActionResetCookie());
    180183            //JMenuItem menuLambertZone = new JMenuItem(new MenuActionLambertZone());
    181184            JMenuItem menuLoadFromCache = new JMenuItem(new MenuActionLoadFromCache());
     
    210213            transparency = 1.0f;
    211214        }
     215        String currentResolution = Main.pref.get("cadastrewms.resolution", "high");
     216        if (currentResolution.equals("high")) {
     217            imageWidth = 1000; imageHeight = 800;
     218        } else if (currentResolution.equals("medium")){
     219            imageWidth = 800; imageHeight = 600;
     220        } else {
     221            imageWidth = 600; imageHeight = 400;
     222        }
     223       
    212224        // overwrite F11 shortcut used from the beginning by this plugin and recently used
    213225        // for full-screen switch in JOSM core
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePreferenceSetting.java

    r19949 r20240  
    5858    private JCheckBox autoFirstLayer = new JCheckBox(tr("Automaticly select first WMS layer when grabing if multiple layers exist."));
    5959   
     60    private JRadioButton grabRes1 = new JRadioButton("high");
     61
     62    private JRadioButton grabRes2 = new JRadioButton("medium");
     63
     64    private JRadioButton grabRes3 = new JRadioButton("low");
     65
    6066    static final int DEFAULT_SQUARE_SIZE = 100;
    6167    private JTextField grabMultiplier4Size = new JTextField(5);
     
    124130        cadastrewms.add(drawBoundaries, GBC.eop().insets(0, 0, 0, 5));
    125131
     132        // option to select the single grabbed image resolution
     133        JLabel jLabelRes = new JLabel(tr("Image resolution:"));
     134        cadastrewms.add(jLabelRes, GBC.std().insets(0, 5, 10, 0));
     135        ButtonGroup bgResolution = new ButtonGroup();
     136        ActionListener resActionListener = new ActionListener() {
     137            public void actionPerformed(ActionEvent actionEvent) {
     138              AbstractButton button = (AbstractButton) actionEvent.getSource();
     139              grabMultiplier4Size.setEnabled(button == grabMultiplier4);
     140            }
     141          };
     142        grabRes1.addActionListener( resActionListener);
     143        grabRes1.setToolTipText(tr("High resolution (1000x800)"));
     144        grabRes2.addActionListener( resActionListener);
     145        grabRes2.setToolTipText(tr("Medium resolution (800x600)"));
     146        grabRes3.addActionListener( resActionListener);
     147        grabRes3.setToolTipText(tr("Low resolution (600x400)"));
     148        bgResolution.add(grabRes1);
     149        bgResolution.add(grabRes2);
     150        bgResolution.add(grabRes3);
     151        String currentResolution = Main.pref.get("cadastrewms.resolution", "high");
     152        if (currentResolution.equals("high"))
     153            grabRes1.setSelected(true);
     154        if (currentResolution.equals("medium"))
     155            grabRes2.setSelected(true);
     156        if (currentResolution.equals("low"))
     157            grabRes3.setSelected(true);
     158        cadastrewms.add(grabRes1, GBC.std().insets(5, 0, 5, 0));
     159        cadastrewms.add(grabRes2, GBC.std().insets(5, 0, 5, 0));
     160        cadastrewms.add(grabRes3, GBC.eol().fill(GBC.HORIZONTAL).insets(5, 5, 0, 5));
     161       
    126162        // option to select image zooming interpolation method
    127         JLabel jLabelImageZoomInterpolation = new JLabel(tr("Image zoom interpolation:"));
     163        JLabel jLabelImageZoomInterpolation = new JLabel(tr("Image filter interpolation:"));
    128164        cadastrewms.add(jLabelImageZoomInterpolation, GBC.std().insets(0, 0, 10, 0));
    129165        imageInterpolationMethod.addItem(tr("Nearest-Neighbor (fastest) [ Default ]"));
     
    155191        grabMultiplier1.setSelectedIcon(ImageProvider.get("preferences", "sel_box_1"));
    156192        grabMultiplier1.addActionListener( multiplierActionListener);
     193        grabMultiplier1.setToolTipText(tr("Grab one image full screen"));
    157194        grabMultiplier2.setIcon(ImageProvider.get("preferences", "unsel_box_2"));
    158195        grabMultiplier2.setSelectedIcon(ImageProvider.get("preferences", "sel_box_2"));
     
    259296        Main.pref.put("cadastrewms.brightness", Float.toString((float)sliderTrans.getValue()/10));
    260297        Main.pref.put("cadastrewms.drawBoundaries", drawBoundaries.isSelected());
     298        if (grabRes1.isSelected())
     299            Main.pref.put("cadastrewms.resolution", "high");
     300        else if (grabRes2.isSelected())
     301            Main.pref.put("cadastrewms.resolution", "medium");
     302        else if (grabRes3.isSelected())
     303            Main.pref.put("cadastrewms.resolution", "low");
    261304        if (imageInterpolationMethod.getSelectedIndex() == 2)
    262305            Main.pref.put("cadastrewms.imageInterpolation", "bicubic");
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGBuilding.java

    r18962 r20240  
    221221        str += bbox.max.east() + ",";
    222222        str += bbox.max.north();
    223         str += "&width=800&height=600"; // maximum allowed by wms server
     223        str += "&width="+CadastrePlugin.imageWidth+"&height="+CadastrePlugin.imageHeight;
    224224        str += "&exception=application/vnd.ogc.se_inimage";
    225225        str += "&styles=";
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGTask.java

    r18544 r20240  
    177177        str += bbox.max.east() + ",";
    178178        str += bbox.max.north();
    179         str += "&width=800&height=600"; // maximum allowed by wms server
     179        str += "&width="+CadastrePlugin.imageWidth+"&height="+CadastrePlugin.imageHeight;
    180180        str += "&styles=";
    181181        str += "COMMUNE_90";
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java

    r20211 r20240  
    238238            Object savedInterpolation = g.getRenderingHint(RenderingHints.KEY_INTERPOLATION);
    239239            if (savedInterpolation == null) savedInterpolation = RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;
    240             String interpolation = Main.pref.get("cadastrewms.imageInterpolation", "Standard");
     240            String interpolation = Main.pref.get("cadastrewms.imageInterpolation", "standard");
    241241            if (interpolation.equals("bilinear"))
    242242                g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
Note: See TracChangeset for help on using the changeset viewer.