Ignore:
Timestamp:
2010-08-03T08:17:26+02:00 (15 years ago)
Author:
jttt
Message:

Adapt to latest josm

Location:
applications/editors/josm/plugins/piclayer
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/piclayer/build.xml

    r21706 r22549  
    2424
    2525        <property name="commit.message" value="Changed the constructor signature of the plugin main class" />
    26         <property name="plugin.main.version" value="2830" />
     26        <property name="plugin.main.version" value="3408" />
    2727
    2828        <!--
     
    138138
    139139        <!--
    140                  ************************** Publishing the plugin *********************************** 
    141                 -->
    142         <!--
    143                 ** extracts the JOSM release for the JOSM version in ../core and saves it in the 
     140                 ************************** Publishing the plugin ***********************************
     141                -->
     142        <!--
     143                ** extracts the JOSM release for the JOSM version in ../core and saves it in the
    144144                ** property ${coreversion.info.entry.revision}
    145145                **
     
    190190
    191191        <!--
    192                 ** commits the plugin.jar 
     192                ** commits the plugin.jar
    193193                -->
    194194        <target name="commit-dist">
    195195                <echo>
    196196        ***** Properties of published ${plugin.jar} *****
    197         Commit message    : '${commit.message}'                                 
     197        Commit message    : '${commit.message}'
    198198        Plugin-Mainversion: ${plugin.main.version}
    199199        JOSM build version: ${coreversion.info.entry.revision}
    200200        Plugin-Version    : ${version.entry.commit.revision}
    201         ***** / Properties of published ${plugin.jar} *****                                     
    202                                                
     201        ***** / Properties of published ${plugin.jar} *****
     202
    203203        Now commiting ${plugin.jar} ...
    204204        </echo>
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/NewLayerFromClipboardAction.java

    r20217 r22549  
    5151                // Add layer only if successfully initialized
    5252                try {
    53                         layer.Initialize();
     53                        layer.initialize();
    5454                }
    5555                catch (IOException e) {
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/NewLayerFromFileAction.java

    r20217 r22549  
    9191                        // Add layer only if successfully initialized
    9292                        try {
    93                                 layer.Initialize();
     93                                layer.initialize();
    9494                        }
    9595                        catch (IOException e) {
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerAbstract.java

    r20217 r22549  
    2929import java.awt.Image;
    3030import java.awt.Toolkit;
     31import java.awt.event.ActionEvent;
    3132import java.awt.image.BufferedImage;
    3233import java.io.IOException;
     34import java.util.List;
    3335import java.util.Properties;
    3436
     37import javax.swing.AbstractAction;
     38import javax.swing.Action;
    3539import javax.swing.Icon;
    3640import javax.swing.ImageIcon;
    3741import javax.swing.JMenu;
    38 import javax.swing.JMenuItem;
    39 import javax.swing.JSeparator;
    4042
    4143import org.openstreetmap.josm.Main;
     
    6971    // The scale that was set on the map during image creation
    7072    private double m_initial_scale = 0;
    71     // Popup menu items
    72     private Component m_popupmenu[] = null;
    7373    // Layer icon
    7474    private Icon m_layericon = null;
     
    9393        m_counter++;
    9494
    95         // Create popup menu
    96         // Reset submenu
    97         JMenu reset_submenu = new JMenu(tr("Reset"));
    98         reset_submenu.add( new ResetPictureAllAction( this ) );
    99         reset_submenu.addSeparator();
    100         reset_submenu.add( new ResetPicturePositionAction( this ) );
    101         reset_submenu.add( new ResetPictureAngleAction( this ) );
    102         reset_submenu.add( new ResetPictureScaleAction( this ) );
    103         // Main menu
    104         m_popupmenu = new Component[]{
    105                 reset_submenu,
    106                 new JSeparator(),
    107                 new JMenuItem( new SavePictureCalibrationAction(this)),
    108                 new JMenuItem( new LoadPictureCalibrationAction(this)),
    109         };
    110 
    11195        // Load layer icon
    11296        m_layericon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(PicLayerAbstract.class.getResource("/images/layericon.png")));
     
    117101     * initial parameters. Throws exception if something fails.
    118102     */
    119     public void Initialize() throws IOException {
     103    public void initialize() throws IOException {
    120104
    121105        // Create image
     
    165149
    166150    @Override
    167     public Component[] getMenuEntries() {
    168         return m_popupmenu;
     151    public Action[] getMenuEntries() {
     152        // Main menu
     153        return new Action[] {
     154                new ResetSubmenuAction(),
     155                SeparatorLayerAction.INSTANCE,
     156                new SavePictureCalibrationAction(this),
     157                new LoadPictureCalibrationAction(this),
     158        };
    169159    }
    170160
     
    189179    public void paint(Graphics2D g2, MapView mv, Bounds bounds) {
    190180
    191         if ( m_image != null && g2 instanceof Graphics2D) {
     181        if ( m_image != null) {
    192182
    193183            // Position image at the right graphical place
     
    320310            Main.map.mapView.repaint();
    321311    }
     312
     313    private class ResetSubmenuAction extends AbstractAction implements LayerAction {
     314
     315        public ResetSubmenuAction() {
     316                super(tr("Reset"));
     317                }
     318
     319                public void actionPerformed(ActionEvent e) {
     320                }
     321
     322                public Component createMenuComponent() {
     323                        JMenu reset_submenu = new JMenu(this);
     324                reset_submenu.add( new ResetPictureAllAction( PicLayerAbstract.this ) );
     325                reset_submenu.addSeparator();
     326                reset_submenu.add( new ResetPicturePositionAction( PicLayerAbstract.this ) );
     327                reset_submenu.add( new ResetPictureAngleAction( PicLayerAbstract.this ) );
     328                reset_submenu.add( new ResetPictureScaleAction( PicLayerAbstract.this ) );
     329                return reset_submenu;
     330                }
     331
     332                public boolean supportLayers(List<Layer> layers) {
     333                        return layers.size() == 1 && layers.get(0) instanceof PicLayerAbstract;
     334                }
     335
     336    }
    322337}
Note: See TracChangeset for help on using the changeset viewer.