Changeset 29828 in osm for applications


Ignore:
Timestamp:
2013-08-06T16:15:48+02:00 (11 years ago)
Author:
pieren
Message:

Add new preference setting to simplify colors in 2 bits for raster images

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

Legend:

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

    r29677 r29828  
    4242
    4343    private JCheckBox enableTableauAssemblage = new JCheckBox(tr("Use \"Tableau d''assemblage\""));
     44   
     45    private JCheckBox simplify2BitsColors = new JCheckBox(tr("Replace grey shades by white color only"));
    4446
    4547    private JCheckBox autoFirstLayer = new JCheckBox(tr("Select first WMS layer in list."));
     
    125127        reversGrey.setSelected(Main.pref.getBoolean("cadastrewms.invertGrey", false));
    126128        reversGrey.setToolTipText(tr("Invert the original black and white colors (and all intermediate greys). Useful for texts on dark backgrounds."));
    127         cadastrewms.add(reversGrey, GBC.eop().insets(00, 0, 0, 0));
     129        cadastrewms.add(reversGrey, GBC.eop().insets(0, 0, 0, 0));
    128130
    129131        // option to enable transparency
     
    290292        enableTableauAssemblage.setToolTipText(tr("Add the \"Tableau(x) d''assemblage\" in the list of cadastre sheets to grab."));
    291293        cadastrewms.add(enableTableauAssemblage, GBC.eop().insets(0, 0, 0, 0));
     294        // option to use 2 bits colors only
     295        simplify2BitsColors.setSelected(Main.pref.getBoolean("cadastrewms.raster2bitsColors", false));
     296        simplify2BitsColors.setToolTipText(tr("Replace greyscale by white color (smaller files and memory usage)."));
     297        cadastrewms.add(simplify2BitsColors, GBC.eop().insets(0, 0, 0, 0));
    292298        // the crosspiece display
    293299        JLabel jLabelCrosspieces = new JLabel(tr("Display crosspieces:"));
     
    404410        Main.pref.put("cadastrewms.noImageCropping", disableImageCropping.isSelected());
    405411        Main.pref.put("cadastrewms.useTA", enableTableauAssemblage.isSelected());
     412        Main.pref.put("cadastrewms.raster2bitsColors", simplify2BitsColors.isSelected());
    406413        if (crosspiece1.isSelected()) Main.pref.put("cadastrewms.crosspieces", "0");
    407414        else if (crosspiece2.isSelected()) Main.pref.put("cadastrewms.crosspieces", "1");
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/RasterImageModifier.java

    r29801 r29828  
    6666            int height = bufferedImage.getHeight();
    6767            BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
     68            // converting grey scale colors to black/white is configurable (use less resources but is less readable)
     69            boolean simplifyColors = Main.pref.getBoolean("cadastrewms.raster2bitsColors", false);
    6870            for (int y = 0; y < height; y++) {
    6971                for (int x = 0; x < width; x++) {
     
    7577                    Color maskedColor;
    7678                    if (rgb == cadastreBackground) {
    77                         maskedColor = new Color(r, g, b, 0x00); // transparent
     79                        maskedColor = simplifyColors ? new Color(0xff, 0xff, 0xff, 0x00) :
     80                            new Color(r, g, b, 0x00); // transparent
    7881                    } else {
    79                         maskedColor = new Color(r, g, b, 0xFF); // opaque
     82                        maskedColor = simplifyColors ? new Color(0, 0, 0, 0xFF) :
     83                            new Color(r, g, b, 0xFF); // opaque
    8084                    }
    81                     //maskedColor = new Color(r, g, b, alpha);
    8285                    bi.setRGB(x, y, maskedColor.getRGB());
    8386                }
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java

    r29714 r29828  
    248248        if (isRaster) {
    249249            str += "\n"+tr("Is not vectorized.");
    250             str += "\n"+tr("Raster size: {0}", communeBBox);
     250            str += "\n"+tr("Bounding box: {0}", communeBBox);
     251            if(images.size()>0)
     252                str += "\n"+tr("Image size (px): {0}/{1}", images.get(0).image.getWidth(), images.get(0).image.getHeight());
    251253        } else
    252254            str += "\n"+tr("Is vectorized.");
Note: See TracChangeset for help on using the changeset viewer.