Ignore:
Timestamp:
2015-06-23T10:14:53+02:00 (9 years ago)
Author:
nokutu
Message:

Added more types of signs to filters

Location:
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java

    r31284 r31297  
    234234            Main.map.mapView.zoomTo(MapillaryData.getInstance()
    235235                    .getSelectedImage().getLatLon());
    236         if (Main.map != null) {
     236        if (Main.map != null)
    237237            Main.map.mapView.repaint();
    238         }
    239238        fireSelectedImageChanged(oldImage, selectedImage);
    240239    }
     
    300299        // DO NOTHING
    301300    }
     301
     302    /**
     303     * Returns the amount of images contained by this object.
     304     *
     305     * @return
     306     */
     307    public int size() {
     308        return images.size();
     309    }
    302310}
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java

    r31284 r31297  
    77import org.openstreetmap.josm.plugins.mapillary.cache.MapillaryCache;
    88import org.openstreetmap.josm.plugins.mapillary.downloads.MapillaryDownloader;
     9import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryFilterDialog;
    910import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryToggleDialog;
    1011import org.openstreetmap.josm.Main;
     
    6263    public static MapillaryImage RED;
    6364
    64     private final MapillaryData mapillaryData = MapillaryData.getInstance();
     65    private final MapillaryData data = MapillaryData.getInstance();
    6566
    6667    public List<Bounds> bounds;
     
    6970    private MouseAdapter mouseAdapter;
    7071
    71     int highlightPointRadius = Main.pref.getInteger(
     72    private int highlightPointRadius = Main.pref.getInteger(
    7273            "mappaint.highlight.radius", 7);
    7374    private int highlightStep = Main.pref.getInteger("mappaint.highlight.step",
     
    105106    }
    106107
    107     public void startMouseAdapter() {
     108    private void startMouseAdapter() {
    108109        mouseAdapter = new MapillaryMouseAdapter();
    109110    }
     
    161162     */
    162163    public MapillaryData getMapillaryData() {
    163         return mapillaryData;
     164        return data;
    164165    }
    165166
     
    171172        MapillaryToggleDialog.getInstance().mapillaryImageDisplay
    172173                .setImage(null);
    173         MapillaryData.getInstance().getImages().clear();
     174        data.getImages().clear();
    174175        MapillaryLayer.INSTANCE = null;
    175176        MapillaryData.INSTANCE = null;
     
    190191    @Override
    191192    public boolean isModified() {
    192         for (MapillaryAbstractImage image : mapillaryData.getImages())
     193        for (MapillaryAbstractImage image : data.getImages())
    193194            if (image.isModified())
    194195                return true;
    195196        return false;
     197    }
     198   
     199    @Override
     200    public void setVisible(boolean visible) {
     201        super.setVisible(visible);
     202        for (MapillaryAbstractImage img : data.getImages())
     203            img.setVisible(visible);
     204        MapillaryFilterDialog.getInstance().refresh();
    196205    }
    197206
     
    209218           
    210219            // Sets blue and red lines and enables/disables the buttons
    211             if (mapillaryData.getSelectedImage() != null) {
     220            if (data.getSelectedImage() != null) {
    212221                MapillaryImage[] closestImages = getClosestImagesFromDifferentSequences();
    213                 Point selected = mv.getPoint(mapillaryData.getSelectedImage()
     222                Point selected = mv.getPoint(data.getSelectedImage()
    214223                        .getLatLon());
    215224                if (closestImages[0] != null) {
     
    233242            }
    234243            g.setColor(Color.WHITE);
    235             for (MapillaryAbstractImage imageAbs : mapillaryData.getImages()) {
     244            for (MapillaryAbstractImage imageAbs : data.getImages()) {
    236245                if (!imageAbs.isVisible())
    237246                    continue;
     
    247256                        g.drawLine(p.x, p.y, nextp.x, nextp.y);
    248257                    }
    249                    
     258
    250259                    ImageIcon icon;
    251                     if (!mapillaryData.getMultiSelectedImages().contains(image))
     260                    if (!data.getMultiSelectedImages().contains(image))
    252261                        icon = MapillaryPlugin.MAP_ICON;
    253262                    else
     
    263272                    MapillaryImportedImage image = (MapillaryImportedImage) imageAbs;
    264273                    ImageIcon icon;
    265                     if (!mapillaryData.getMultiSelectedImages().contains(image))
     274                    if (!data.getMultiSelectedImages().contains(image))
    266275                        icon = MapillaryPlugin.MAP_ICON_IMPORTED;
    267276                    else
     
    322331        g.drawImage(op.filter(bi, null), p.x - (width / 2), p.y - (height / 2),
    323332                Main.map.mapView);
    324         if (MapillaryData.getInstance().getHoveredImage() == image) {
     333        if (data.getHoveredImage() == image) {
    325334            drawPointHighlight(g, p, 16);
    326335        }
     
    358367     */
    359368    private MapillaryImage[] getClosestImagesFromDifferentSequences() {
    360         if (!(mapillaryData.getSelectedImage() instanceof MapillaryImage))
     369        if (!(data.getSelectedImage() instanceof MapillaryImage))
    361370            return new MapillaryImage[2];
    362         MapillaryImage selected = (MapillaryImage) mapillaryData
     371        MapillaryImage selected = (MapillaryImage) data
    363372                .getSelectedImage();
    364373        MapillaryImage[] ret = new MapillaryImage[2];
    365374        double[] distances = { SEQUENCE_MAX_JUMP_DISTANCE,
    366375                SEQUENCE_MAX_JUMP_DISTANCE };
    367         LatLon selectedCoords = mapillaryData.getSelectedImage().getLatLon();
    368         for (MapillaryAbstractImage imagePrev : mapillaryData.getImages()) {
     376        LatLon selectedCoords = data.getSelectedImage().getLatLon();
     377        for (MapillaryAbstractImage imagePrev : data.getImages()) {
    369378            if (!(imagePrev instanceof MapillaryImage))
    370379                continue;
     
    393402        if (ret[0] != null)
    394403            new MapillaryCache(ret[0].getKey(), MapillaryCache.Type.THUMBNAIL)
    395                     .submit(MapillaryData.getInstance(), false);
     404                    .submit(data, false);
    396405        if (ret[1] != null)
    397406            new MapillaryCache(ret[1].getKey(), MapillaryCache.Type.THUMBNAIL)
    398                     .submit(MapillaryData.getInstance(), false);
     407                    .submit(data, false);
    399408        return ret;
    400409    }
     
    407416        sb.append(tr("Total images:"));
    408417        sb.append(" ");
    409         sb.append(this.size());
     418        sb.append(data.size());
    410419        sb.append("\n");
    411420        return sb.toString();
     
    414423    @Override
    415424    public String getToolTipText() {
    416         return this.size() + " " + tr("images");
    417     }
    418 
    419     private int size() {
    420         return mapillaryData.getImages().size();
     425        return data.size() + " " + tr("images");
    421426    }
    422427
     
    485490    public void activeLayerChange(Layer oldLayer, Layer newLayer) {
    486491        if (newLayer == this) {
    487             if (MapillaryData.getInstance().getImages().size() > 0)
     492            if (data.size() > 0)
    488493                Main.map.statusLine.setHelpText(tr("Total images: {0}",
    489                         MapillaryData.getInstance().getImages().size()));
     494                        data.size()));
    490495            else
    491496                Main.map.statusLine.setHelpText(tr("No images found"));
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java

    r31284 r31297  
    129129    public void editLayerChanged(OsmDataLayer oldLayer, OsmDataLayer newLayer) {
    130130        if (oldLayer == null && newLayer != null) {
    131             DOWNLOAD_MENU.setEnabled(true);
    132             IMPORT_MENU.setEnabled(true);
    133             DOWNLOAD_VIEW_MENU.setEnabled(true);
     131            setMenuEnabled(DOWNLOAD_MENU, true);
     132            setMenuEnabled(IMPORT_MENU, true);
     133            setMenuEnabled(DOWNLOAD_VIEW_MENU, true);
    134134        } else if (oldLayer != null && newLayer == null) {
    135             DOWNLOAD_MENU.setEnabled(false);
    136             IMPORT_MENU.setEnabled(false);
    137             DOWNLOAD_VIEW_MENU.setEnabled(false);
     135            setMenuEnabled(DOWNLOAD_MENU, false);
     136            setMenuEnabled(IMPORT_MENU, false);
     137            setMenuEnabled(DOWNLOAD_VIEW_MENU, false);
    138138        }
    139139    }
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadAction.java

    r31278 r31297  
    4545        }
    4646    }
    47 
    4847}
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryFilterChooseSigns.java

    r31296 r31297  
    1212import org.openstreetmap.josm.tools.ImageProvider;
    1313
    14 public class MapillaryFilterChooseSigns extends JPanel implements ActionListener {
     14public class MapillaryFilterChooseSigns extends JPanel implements
     15        ActionListener {
    1516
    16     private JCheckBox maxspeed = new JCheckBox();
    17    
     17    private final JCheckBox maxspeed = new JCheckBox();
     18    private final JCheckBox stop = new JCheckBox();
     19    private final JCheckBox giveWay = new JCheckBox();
     20    private final JCheckBox roundabout = new JCheckBox();
     21    private final JCheckBox access = new JCheckBox();
     22
    1823    private static MapillaryFilterChooseSigns INSTANCE;
    19    
     24
    2025    public MapillaryFilterChooseSigns() {
     26        // Max speed sign
    2127        JPanel maxspeedPanel = new JPanel();
    2228        JLabel maxspeedLabel = new JLabel(tr("Speed limit"));
    23         maxspeedLabel.setIcon(new ImageProvider("styles/standard/vehicle/restriction/speed.png").get());
     29        maxspeedLabel.setIcon(new ImageProvider(
     30                "styles/standard/vehicle/restriction/speed.png").get());
    2431        maxspeedPanel.add(maxspeedLabel);
    2532        maxspeedPanel.add(maxspeed);
    2633        this.add(maxspeedPanel);
     34
     35        // Stop sign
     36        JPanel stopPanel = new JPanel();
     37        JLabel stopLabel = new JLabel(tr("Stop"));
     38        stopLabel.setIcon(new ImageProvider(
     39                "styles/standard/vehicle/restriction/stop.png").get());
     40        stopPanel.add(stopLabel);
     41        stopPanel.add(stop);
     42        this.add(stopPanel);
     43
     44        // Give way sign
     45        JPanel giveWayPanel = new JPanel();
     46        JLabel giveWayLabel = new JLabel(tr("Give way"));
     47        giveWayLabel.setIcon(new ImageProvider(
     48                "styles/standard/vehicle/restriction/right_of_way.png").get());
     49        giveWayPanel.add(giveWayLabel);
     50        giveWayPanel.add(giveWay);
     51        this.add(giveWayPanel);
     52
     53        // Roundabout sign
     54        JPanel roundaboutPanel = new JPanel();
     55        JLabel roundaboutLabel = new JLabel(tr("Give way"));
     56        roundaboutLabel.setIcon(new ImageProvider(
     57                "styles/standard/vehicle/restriction/roundabout_right.png")
     58                .get());
     59        roundaboutPanel.add(roundaboutLabel);
     60        roundaboutPanel.add(roundabout);
     61        this.add(roundaboutPanel);
     62
     63        // No entry sign
     64        // TODO need icon
     65        JPanel noEntryPanel = new JPanel();
     66        JLabel noEntryLabel = new JLabel(tr("No entry"));
     67        noEntryLabel.setIcon(new ImageProvider(
     68                "styles/standard/vehicle/restriction/access.png").get());
     69        noEntryPanel.add(noEntryLabel);
     70        noEntryPanel.add(access);
     71        this.add(noEntryPanel);
    2772    }
    28    
     73
    2974    public static MapillaryFilterChooseSigns getInstance() {
    3075        if (INSTANCE == null)
     
    3277        return INSTANCE;
    3378    }
    34    
     79
    3580    @Override
    3681    public void actionPerformed(ActionEvent arg0) {
    3782        // TODO Auto-generated method stub
    38        
     83
    3984    }
    4085
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryFilterDialog.java

    r31296 r31297  
    225225        }
    226226    }
    227    
     227
    228228    private class OnlySignsAction extends AbstractAction {
    229229        public OnlySignsAction() {
     
    237237    }
    238238
     239    /**
     240     * Opens a new window where you can specifically filter signs.
     241     *
     242     * @author nokutu
     243     *
     244     */
    239245    private class SignChooserAction extends AbstractAction {
    240246        public SignChooserAction() {
     
    245251        public void actionPerformed(ActionEvent arg0) {
    246252            JPanel dialog = MapillaryFilterChooseSigns.getInstance();
    247             JOptionPane pane = new JOptionPane(dialog, JOptionPane.PLAIN_MESSAGE,
    248                     JOptionPane.OK_CANCEL_OPTION);
     253            JOptionPane pane = new JOptionPane(dialog,
     254                    JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
    249255            JDialog dlg = pane.createDialog(Main.parent, tr("Choose signs"));
    250256            dlg.setMinimumSize(new Dimension(400, 150));
     
    252258            MapillaryFilterDialog.getInstance().refresh();
    253259            dlg.dispose();
    254 
    255260        }
    256261    }
    257262
    258263    public static void destroyInstance() {
    259         MapillaryFilterDialog.INSTANCE = null;       
     264        MapillaryFilterDialog.INSTANCE = null;
    260265    }
    261266}
Note: See TracChangeset for help on using the changeset viewer.