Ignore:
Timestamp:
2011-08-08T09:59:19+02:00 (13 years ago)
Author:
bastik
Message:

don't copy image to a new buffered image (not necessary); fix zoom to layer for EPSG:3857

Location:
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerAbstract.java

    r25219 r26487  
    6464    private static int m_counter = 0;
    6565    // This is the main image to be displayed
    66     private BufferedImage m_image = null;
     66    private Image m_image = null;
    6767    // Initial position of the image in the real world
    6868    private EastNorth m_initial_position;
     
    132132
    133133        // Create image
    134         Image image = createImage();
    135         if ( image == null ) {
     134        m_image = createImage();
     135        if ( m_image == null ) {
    136136            throw new IOException(tr("PicLayer failed to load or import the image."));
    137137        }
    138         // Convert to Buffered Image - not sure if this is the right way...
    139         m_image = new BufferedImage( image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB );
    140         Graphics g = m_image.getGraphics();
    141         g.drawImage( image, 0, 0, null );
     138        // Load image completely
     139        (new ImageIcon(m_image)).getImage();
    142140    }
    143141
     
    224222
    225223            // Draw picture
    226             g.drawImage( m_image, -m_image.getWidth() / 2, -m_image.getHeight() / 2, null );
     224            g.drawImage( m_image, -m_image.getWidth(null) / 2, -m_image.getHeight(null) / 2, null );
    227225
    228226            // Draw additional rectangle for the active pic layer
     
    230228                g.setColor( new Color( 0xFF0000 ) );
    231229                g.drawRect(
    232                     -m_image.getWidth() / 2,
    233                     -m_image.getHeight() / 2,
    234                     m_image.getWidth(),
    235                     m_image.getHeight()
     230                    -m_image.getWidth(null) / 2,
     231                    -m_image.getHeight(null) / 2,
     232                    m_image.getWidth(null),
     233                    m_image.getHeight(null)
    236234                );
    237235            }
     
    320318        // initial scale is in m/100pix
    321319        // So for now, we support the bounding box only when everything is in meters
    322         if ( projcode.equals("EPSG:3857") || projcode.equals("EPSG:4326") )
     320        if (projcode.equals("EPSG:4326") )
    323321            return;
    324322           
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerPlugin.java

    r25219 r26487  
    6262        super(info);
    6363
     64        System.err.println("hi there!");
    6465        // Create menu entry
    6566        if ( Main.main.menu != null ) {
Note: See TracChangeset for help on using the changeset viewer.