Ignore:
Timestamp:
2011-02-03T22:55:49+01:00 (14 years ago)
Author:
bastik
Message:

'applied #J5852 (patch by Petschge) - new shear option'

Location:
applications/editors/josm/plugins/piclayer
Files:
3 added
9 edited

Legend:

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

    r25199 r25219  
    2323<project name="PicLayer" default="dist" basedir=".">
    2424
    25         <property name="commit.message" value="Changed the constructor signature of the plugin main class" />
     25        <property name="commit.message" value="applied #J5852 (patch by Petschge) - new shear option" />
    2626        <property name="plugin.main.version" value="3835" />
    2727
     
    8686                                <attribute name="Plugin-Description" value="This plugin allows to display any picture as a background in the editor and align it with the map."/>
    8787                                <attribute name="Plugin-Icon" value="images/layericon.png"/>
     88                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/PicLayer"/>
    8889                                <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
    8990                                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/MovePictureAction.java

    r23190 r25219  
    3333import org.openstreetmap.josm.data.coor.EastNorth;
    3434
    35 //TODO: Move/Rotate/Scale action classes are similar. Do the redesign!
     35//TODO: Move/Rotate/Scale/Shear action classes are similar. Do the redesign!
    3636
    3737/**
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerAbstract.java

    r24308 r25219  
    7474    private double m_scalex = 1.0;
    7575    private double m_scaley = 1.0;
     76    // Shear of the image
     77    private double m_shearx = 0.0;
     78    private double m_sheary = 0.0;
    7679    // The scale that was set on the map during image creation
    7780    private double m_initial_scale = 1.0;
     
    8891    private final String SCALEX = "SCALEX";
    8992    private final String SCALEY = "SCALEY";
     93    private final String SHEARX = "SHEARX";
     94    private final String SHEARY = "SHEARY";
    9095
    9196    /**
     
    215220            double scaley = m_scaley * m_initial_scale / Main.map.mapView.getDist100Pixel();
    216221            g.scale( scalex, scaley );
     222            // Shear
     223            g.shear(m_shearx, m_sheary);
    217224
    218225            // Draw picture
     
    258265
    259266    /**
     267     * Shear the picture. shearx and sheary will separately add to the
     268     * corresponding current value
     269     */
     270    public void shearPictureBy( double shearx, double sheary ) {
     271        m_shearx += shearx;
     272        m_sheary += sheary;
     273    }
     274
     275    /**
    260276     * Sets the image position to the initial position
    261277     */
     
    279295    }
    280296
     297
     298    /**
     299     * Sets the image to no shear
     300     */
     301    public void resetShear() {
     302        m_shearx = 0.0;
     303        m_sheary = 0.0;
     304    }
    281305    @Override
    282306    /**
     
    330354        props.put(SCALEY, "" + m_scaley);
    331355        props.put(ANGLE, "" + m_angle);
     356        props.put(SHEARX, "" + m_shearx);
     357        props.put(SHEARY, "" + m_sheary);
    332358    }
    333359
     
    358384            double scale_x = Double.valueOf( props.getProperty(SCALEX));
    359385            double scale_y = Double.valueOf( props.getProperty(SCALEY));
     386            double shear_x = Double.valueOf( props.getProperty(SHEARX));
     387            double shear_y = Double.valueOf( props.getProperty(SHEARY));
    360388            m_position.setLocation(pos_x, pos_y);
    361389            m_initial_position.setLocation(pos_x, pos_y);
     
    363391            m_scalex = scale_x;
    364392            m_scaley = scale_y;
     393            m_shearx = shear_x;
     394            m_sheary = shear_y;
    365395            m_initial_scale = in_scale;
    366396            // Refresh
     
    384414            reset_submenu.add( new ResetPictureAngleAction( PicLayerAbstract.this ) );
    385415            reset_submenu.add( new ResetPictureScaleAction( PicLayerAbstract.this ) );
     416            reset_submenu.add( new ResetPictureShearAction( PicLayerAbstract.this ) );
    386417            return reset_submenu;
    387418        }
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerPlugin.java

    r23190 r25219  
    5050    private IconToggleButton m_scaleyPictureButton = null;
    5151    private IconToggleButton m_scalexyPictureButton = null;
     52    private IconToggleButton m_shearPictureButton = null;
    5253
    5354    // Menu actions
     
    8990            ScaleXPictureAction scaleXPictureAction = new ScaleXPictureAction(newFrame);
    9091            ScaleYPictureAction scaleYPictureAction = new ScaleYPictureAction(newFrame);
     92            ShearPictureAction shearPictureAction = new ShearPictureAction(newFrame);
    9193            // Create plugin buttons and add them to the toolbar
    9294            m_movePictureButton = new IconToggleButton(movePictureAction);
     
    9597            m_scalexPictureButton = new IconToggleButton(scaleXPictureAction);
    9698            m_scaleyPictureButton = new IconToggleButton(scaleYPictureAction);
     99            m_shearPictureButton = new IconToggleButton(shearPictureAction);
    97100            newFrame.addMapMode(m_movePictureButton);
    98101            newFrame.addMapMode(m_rotatePictureButton);
     
    100103            newFrame.addMapMode(m_scalexPictureButton);
    101104            newFrame.addMapMode(m_scaleyPictureButton);
     105            newFrame.addMapMode(m_shearPictureButton);
    102106//            newFrame.toolGroup.add(m_movePictureButton);
    103107//            newFrame.toolGroup.add(m_rotatePictureButton);
     
    109113            m_scalexPictureButton.setVisible(true);
    110114            m_scaleyPictureButton.setVisible(true);
     115            m_shearPictureButton.setVisible(true);
    111116        }
    112117    }
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ResetPictureAllAction.java

    r23190 r25219  
    5555        m_owner.resetPosition();
    5656        m_owner.resetScale();
     57        m_owner.resetShear();
    5758        // Redraw
    5859        Main.map.mapView.repaint();
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/RotatePictureAction.java

    r24288 r25219  
    3232import org.openstreetmap.josm.tools.ImageProvider;
    3333
    34 //TODO: Move/Rotate/Scale action classes are similar. Do the redesign!
     34//TODO: Move/Rotate/Scale/Shear action classes are similar. Do the redesign!
    3535
    3636/**
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ScaleXPictureAction.java

    r24300 r25219  
    2828import org.openstreetmap.josm.tools.ImageProvider;
    2929
    30 // TODO: Move/Rotate/Scale action classes are similar. Do the redesign!
     30// TODO: Move/Rotate/Scale/Shear action classes are similar. Do the redesign!
    3131
    3232/**
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ScaleXYPictureAction.java

    r23190 r25219  
    2828import org.openstreetmap.josm.tools.ImageProvider;
    2929
    30 // TODO: Move/Rotate/Scale action classes are similar. Do the redesign!
     30// TODO: Move/Rotate/Scale/Shear action classes are similar. Do the redesign!
    3131
    3232/**
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ScaleYPictureAction.java

    r24300 r25219  
    2828import org.openstreetmap.josm.tools.ImageProvider;
    2929
    30 // TODO: Move/Rotate/Scale action classes are similar. Do the redesign!
     30// TODO: Move/Rotate/Scale/Shear action classes are similar. Do the redesign!
    3131
    3232/**
Note: See TracChangeset for help on using the changeset viewer.