Ignore:
Timestamp:
2015-06-03T09:38:08+02:00 (9 years ago)
Author:
nokutu
Message:

Cleaned some code and prepared everything to be published

Location:
applications/editors/josm/plugins/mapillary
Files:
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/mapillary/README

    r30944 r31185  
    44Readme for your plugin
    55
    6     * Polyglot and HolgerMappt
     6    * nokutu <nokutu@openmailbox.org>
    77   
    88    * License: GPL v2 or later
    99     
    10     * Notes for future developers, if needed.
     10    * Feel free to contact me for any bug or suggestion.
  • applications/editors/josm/plugins/mapillary/build.xml

    r31183 r31185  
    2424         See http://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins
    2525    -->
    26     <property name="plugin.author" value="Nokutu"/>
     26    <property name="plugin.author" value="nokutu <nokutu@openmailbox.org>"/>
    2727    <property name="plugin.class" value="org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin"/>
    2828    <property name="plugin.description" value="Enables user to work with pictures hosted at mapillary.com"/>
     
    3030    <!-- <property name="plugin.link" value="..."/>-->
    3131    <!--<property name="plugin.early" value="..."/>-->
    32     <!--<property name="plugin.requires" value="commons-imaging"/>-->
     32    <property name="plugin.requires" value="commons-imaging"/>
    3333    <!--<property name="plugin.stage" value="..."/>-->
    3434   
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java

    r31176 r31185  
    11package org.openstreetmap.josm.plugins.mapillary;
    22
    3 import org.apache.commons.jcs.access.CacheAccess;
    43import org.openstreetmap.josm.Main;
    5 import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry;
    64import org.openstreetmap.josm.data.cache.CacheEntry;
    75import org.openstreetmap.josm.data.cache.CacheEntryAttributes;
    86import org.openstreetmap.josm.data.cache.ICachedLoaderListener;
    9 import org.openstreetmap.josm.data.cache.JCSCacheManager;
    107import org.openstreetmap.josm.plugins.mapillary.cache.MapillaryCache;
    118
    12 import java.io.IOException;
    139import java.util.ArrayList;
    14 import java.util.HashMap;
    1510import java.util.List;
    1611import java.util.concurrent.CopyOnWriteArrayList;
     
    147142        /**
    148143         * Selects a new image and then starts a new MapillaryImageDownloadThread
    149          * thread in order to download its surrounding thumbnails. If the
    150          * user does ctrl+click, this isn't triggered.
     144         * thread in order to download its surrounding thumbnails. If the user does
     145         * ctrl+click, this isn't triggered.
    151146         *
    152147         * @param image
     
    160155                        MapillaryToggleDialog.getInstance().setImage(selectedImage);
    161156                        MapillaryToggleDialog.getInstance().updateImage();
    162                         CacheAccess<String, BufferedImageCacheEntry> prev = null;
    163                         try {
    164                                 prev = JCSCacheManager.getCache("mapillary");
    165                         } catch (IOException e) {
    166                                 // TODO Auto-generated catch block
    167                                 e.printStackTrace();
    168                         }
    169157                        if (image.next() != null) {
    170158                                new MapillaryCache(image.next().getKey(),
    171                                                 MapillaryCache.Type.THUMBNAIL, prev, 200000, 200000,
    172                                                 new HashMap<String, String>()).submit(this, false);
     159                                                MapillaryCache.Type.THUMBNAIL).submit(
     160                                                this, false);
    173161                                if (image.next().next() != null)
    174162                                        new MapillaryCache(image.next().next().getKey(),
    175                                                         MapillaryCache.Type.THUMBNAIL, prev, 200000,
    176                                                         200000, new HashMap<String, String>()).submit(this,
    177                                                         false);
     163                                                        MapillaryCache.Type.THUMBNAIL)
     164                                                        .submit(this, false);
    178165                        }
    179166                        if (image.previous() != null) {
    180167                                new MapillaryCache(image.previous().getKey(),
    181                                                 MapillaryCache.Type.THUMBNAIL, prev, 200000, 200000,
    182                                                 new HashMap<String, String>()).submit(this, false);
     168                                                MapillaryCache.Type.THUMBNAIL).submit(
     169                                                this, false);
    183170                                if (image.previous().previous() != null)
    184171                                        new MapillaryCache(image.previous().previous().getKey(),
    185                                                         MapillaryCache.Type.THUMBNAIL, prev, 200000,
    186                                                         200000, new HashMap<String, String>()).submit(this,
    187                                                         false);
     172                                                        MapillaryCache.Type.THUMBNAIL)
     173                                                        .submit(this, false);
    188174                        }
    189175                }
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java

    r31183 r31185  
    11package org.openstreetmap.josm.plugins.mapillary;
     2
     3import java.io.IOException;
    24
    35import javax.swing.ImageIcon;
    46import javax.swing.JMenuItem;
    57
     8import org.apache.commons.jcs.access.CacheAccess;
     9import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry;
     10import org.openstreetmap.josm.data.cache.JCSCacheManager;
    611import org.openstreetmap.josm.gui.MainMenu;
    712import org.openstreetmap.josm.Main;
     
    2833                        "mapiconselected.png").get();
    2934        public static final int ICON_SIZE = 24;
     35       
     36        public static CacheAccess<String, BufferedImageCacheEntry> CACHE;
    3037
    3138        private final MapillaryDownloadAction downloadAction;
     
    4855                                false, 14);
    4956                EXPORT_MENU.setEnabled(false);
     57                try {
     58                        CACHE = JCSCacheManager.getCache("mapillary", 10, 10000, this.getPluginDir() + "/cache/");
     59                } catch (IOException e) {
     60                        Main.error(e);
     61                }
    5062        }
    5163
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryToggleDialog.java

    r31183 r31185  
    1111import java.io.IOException;
    1212import java.util.Arrays;
    13 import java.util.HashMap;
    14 
    15 import org.apache.commons.jcs.access.CacheAccess;
     13
    1614import org.openstreetmap.josm.Main;
    17 import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry;
    1815import org.openstreetmap.josm.data.cache.CacheEntry;
    1916import org.openstreetmap.josm.data.cache.CacheEntryAttributes;
     
    114111                                this.previousButton.setEnabled(false);
    115112
    116                         CacheAccess<String, BufferedImageCacheEntry> prev;
    117113                        try {
    118114                                this.mapillaryImageDisplay.setImage(null);
    119                                 prev = JCSCacheManager.getCache("mapillary");
     115                                MapillaryPlugin.CACHE = JCSCacheManager.getCache("mapillary");
    120116                                if (thumbnailCache != null)
    121117                                        thumbnailCache.cancelOutstandingTasks();
    122118                                thumbnailCache = new MapillaryCache(image.getKey(),
    123                                                 MapillaryCache.Type.THUMBNAIL, prev, 200000, 200000,
    124                                                 new HashMap<String, String>());
     119                                                MapillaryCache.Type.THUMBNAIL);
    125120                                thumbnailCache.submit(this, false);
    126121
     
    128123                                        imageCache.cancelOutstandingTasks();
    129124                                imageCache = new MapillaryCache(image.getKey(),
    130                                                 MapillaryCache.Type.FULL_IMAGE, prev, 200000, 200000,
    131                                                 new HashMap<String, String>());
     125                                                MapillaryCache.Type.FULL_IMAGE);
    132126                                imageCache.submit(this, false);
    133127                        } catch (IOException e) {
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/MapillaryCache.java

    r31176 r31185  
    33import java.net.MalformedURLException;
    44import java.net.URL;
    5 import java.util.Map;
     5import java.util.HashMap;
    66
    7 import org.apache.commons.jcs.access.behavior.ICacheAccess;
    87import org.openstreetmap.josm.Main;
    98import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry;
    109import org.openstreetmap.josm.data.cache.JCSCachedTileLoaderJob;
     10import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin;
    1111
    1212public class MapillaryCache extends
     
    2020        }
    2121
    22         public MapillaryCache(String key, Type type,
    23                         ICacheAccess<String, BufferedImageCacheEntry> cache,
    24                         int connectTimeout, int readTimeout, Map<String, String> headers) {
    25                 super(cache, connectTimeout, readTimeout, headers);
     22        public MapillaryCache(String key, Type type) {
     23                super(MapillaryPlugin.CACHE, 50000, 50000, new HashMap<String, String>());
    2624                this.key = key;
    2725                try {
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportDownloadThread.java

    r31176 r31185  
    44import java.io.ByteArrayInputStream;
    55import java.io.IOException;
    6 import java.net.MalformedURLException;
    7 import java.util.HashMap;
    86import java.util.concurrent.ArrayBlockingQueue;
    97
    108import javax.imageio.ImageIO;
    119
    12 import org.apache.commons.jcs.access.CacheAccess;
    1310import org.openstreetmap.josm.Main;
    14 import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry;
    1511import org.openstreetmap.josm.data.cache.CacheEntry;
    1612import org.openstreetmap.josm.data.cache.CacheEntryAttributes;
    1713import org.openstreetmap.josm.data.cache.ICachedLoaderListener;
    18 import org.openstreetmap.josm.data.cache.JCSCacheManager;
    1914import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    2015import org.openstreetmap.josm.plugins.mapillary.MapillaryImage;
     
    5045        @Override
    5146        public void run() {
    52                 try {
    53                         CacheAccess<String, BufferedImageCacheEntry> prev = JCSCacheManager
    54                                         .getCache("mapillary");
    55                         new MapillaryCache(image.getKey(), MapillaryCache.Type.FULL_IMAGE,
    56                                         prev, 200000, 200000, new HashMap<String, String>())
    57                                         .submit(this, false);
    58                 } catch (MalformedURLException e) {
    59                         Main.error(e);
    60                 } catch (IOException e) {
    61                         Main.error(e);
    62                 }
     47                new MapillaryCache(image.getKey(), MapillaryCache.Type.FULL_IMAGE).submit(this,
     48                                false);
     49
    6350        }
    6451
Note: See TracChangeset for help on using the changeset viewer.