Ignore:
Timestamp:
2013-03-22T22:18:26+01:00 (12 years ago)
Author:
zverik
Message:

ImageryID refactoring and javadocs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/GetImageryOffsetAction.java

    r29381 r29384  
    2020 * Download a list of imagery offsets for the current position, let user choose which one to use.
    2121 *
    22  * @author zverik
     22 * @author Zverik
     23 * @license WTFPL
    2324 */
    2425public class GetImageryOffsetAction extends JosmAction {
    2526   
     27    /**
     28     * Initialize the action. Sets "Ctrl+Alt+I" shortcut: the only shortcut in this plugin.
     29     */
    2630    public GetImageryOffsetAction() {
    2731        super(tr("Get Imagery Offset..."), "getoffset", tr("Download offsets for current imagery from a server"),
     
    3034    }
    3135
     36    /**
     37     * The action just executes {@link DownloadOffsetsTask}.
     38     */
    3239    public void actionPerformed(ActionEvent e) {
    3340        if( Main.map == null || Main.map.mapView == null || !Main.map.isVisible() )
     
    4451    }
    4552
     53    /**
     54     * This action is enabled when there's a map, mapView and one of the layers
     55     * is an imagery layer.
     56     */
    4657    @Override
    4758    protected void updateEnabledState() {
     
    5566    }
    5667   
    57     private void showOffsetDialog( List<ImageryOffsetBase> offsets, ImageryLayer layer ) {
     68    /**
     69     * Display a dialog for choosing between offsets. If there are no offsets in
     70     * the list, displays the relevant message instead.
     71     * @param offsets List of offset objects to choose from.
     72     */
     73    private void showOffsetDialog( List<ImageryOffsetBase> offsets ) {
    5874        if( offsets.isEmpty() ) {
    5975            JOptionPane.showMessageDialog(Main.parent,
     
    6783    }
    6884
     85    /**
     86     * A task that downloads offsets for a given position and imagery layer,
     87     * then parses resulting XML and calls
     88     * {@link #showOffsetDialog(java.util.List)} on success.
     89     */
    6990    class DownloadOffsetsTask extends SimpleOffsetQueryTask {
    7091        private ImageryLayer layer;
    7192        private List<ImageryOffsetBase> offsets;
    7293
     94        /**
     95         * Initializes query object from the parameters.
     96         * @param center A center point of a map view.
     97         * @param layer The topmost imagery layer.
     98         * @param imagery Imagery ID for the layer.
     99         */
    73100        public DownloadOffsetsTask( LatLon center, ImageryLayer layer, String imagery ) {
    74101            super(null, tr("Loading imagery offsets..."));
     
    87114        }
    88115
     116        /**
     117         * Displays offset dialog on success.
     118         */
    89119        @Override
    90120        protected void afterFinish() {
    91121            if( !cancelled && offsets != null )
    92                 showOffsetDialog(offsets, layer);
     122                showOffsetDialog(offsets);
    93123        }
    94124       
     125        /**
     126         * Parses the response with {@link IODBReader}.
     127         * @param inp Response input stream.
     128         * @throws iodb.SimpleOffsetQueryTask.UploadException Thrown on XML parsing error.
     129         */
    95130        @Override
    96131        protected void processResponse( InputStream inp ) throws UploadException {
Note: See TracChangeset for help on using the changeset viewer.