This repository has been archived by the owner on Nov 1, 2023. It is now read-only.
forked from JOSM/Mapillary
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add additional rendering options (similar to GPX track rendering)
Signed-off-by: Taylor Smock <[email protected]>
- Loading branch information
Showing
8 changed files
with
417 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
...a/org/openstreetmap/josm/plugins/mapillary/gui/layer/MapillaryCustomizeDrawingAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// License: GPL. For details, see LICENSE file. | ||
package org.openstreetmap.josm.plugins.mapillary.gui.layer; | ||
|
||
import static org.openstreetmap.josm.tools.I18n.tr; | ||
|
||
import java.awt.Component; | ||
import java.awt.event.ActionEvent; | ||
import java.util.LinkedList; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
import javax.swing.AbstractAction; | ||
import javax.swing.Action; | ||
import javax.swing.BorderFactory; | ||
import javax.swing.JMenuItem; | ||
import javax.swing.JOptionPane; | ||
import javax.swing.JScrollPane; | ||
|
||
import org.openstreetmap.josm.gui.MainApplication; | ||
import org.openstreetmap.josm.gui.layer.Layer; | ||
import org.openstreetmap.josm.gui.layer.gpx.CustomizeDrawingAction; | ||
import org.openstreetmap.josm.gui.util.GuiHelper; | ||
import org.openstreetmap.josm.plugins.mapillary.gui.preferences.display.MapillaryGPXSettingsPanel; | ||
import org.openstreetmap.josm.tools.ImageProvider; | ||
|
||
/** | ||
* Customize Mapillary drawing | ||
*/ | ||
public class MapillaryCustomizeDrawingAction extends AbstractAction | ||
implements Layer.LayerAction, Layer.MultiLayerAction { | ||
private transient List<Layer> layers; | ||
|
||
/** | ||
* Create a new {@link CustomizeDrawingAction} | ||
* | ||
* @param l The layers that should be customized | ||
*/ | ||
public MapillaryCustomizeDrawingAction(List<Layer> l) { | ||
this(); | ||
layers = l; | ||
} | ||
|
||
/** | ||
* Create a new {@link CustomizeDrawingAction} | ||
* | ||
* @param l The layer that should be customized | ||
*/ | ||
public MapillaryCustomizeDrawingAction(Layer l) { | ||
this(); | ||
layers = new LinkedList<>(); | ||
layers.add(l); | ||
} | ||
|
||
private MapillaryCustomizeDrawingAction() { | ||
super(tr("Customize Mapillary track drawing")); | ||
new ImageProvider("preference").getResource().attachImageIcon(this, true); | ||
} | ||
|
||
@Override | ||
public boolean supportLayers(List<Layer> layers) { | ||
return layers.stream().allMatch(MapillaryLayer.class::isInstance); | ||
} | ||
|
||
@Override | ||
public Component createMenuComponent() { | ||
return new JMenuItem(this); | ||
} | ||
|
||
@Override | ||
public Action getMultiLayerAction(List<Layer> layers) { | ||
return new CustomizeDrawingAction(layers); | ||
} | ||
|
||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
MapillaryGPXSettingsPanel panel = new MapillaryGPXSettingsPanel(layers.stream() | ||
.filter(MapillaryLayer.class::isInstance).map(MapillaryLayer.class::cast).collect(Collectors.toList())); | ||
JScrollPane scrollpane = GuiHelper.embedInVerticalScrollPane(panel); | ||
scrollpane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); | ||
int answer = JOptionPane.showConfirmDialog(MainApplication.getMainFrame(), scrollpane, | ||
tr("Customize track drawing"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); | ||
if (answer == JOptionPane.CANCEL_OPTION || answer == JOptionPane.CLOSED_OPTION) { | ||
return; | ||
} | ||
panel.savePreferences(); | ||
MainApplication.getMainPanel().repaint(); | ||
layers.forEach(Layer::invalidate); | ||
} | ||
|
||
} |
Oops, something went wrong.