- Timestamp:
- 2014-02-05T23:22:04+01:00 (11 years ago)
- Location:
- trunk
- Files:
-
- 9 deleted
- 12 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/data/defaultpresets.xml
r6813 r6814 2213 2213 </optional> 2214 2214 </item> 2215 <item name="Gondola" icon="presets/ gondola.png" type="way">2215 <item name="Gondola" icon="presets/aerialway.png" type="way"> 2216 2216 <link href="http://wiki.openstreetmap.org/wiki/Proposed_features/Piste_Maps" 2217 2217 fr.href="http://wiki.openstreetmap.org/wiki/FR:Proposed_features/Piste_Maps" -
trunk/src/org/openstreetmap/josm/actions/AlignInCircleAction.java
r6380 r6814 32 32 * Aligns all selected nodes within a circle. (Useful for roundabouts) 33 33 * 34 * @since 146 35 * 34 36 * @author Matthew Newton 35 37 * @author Petr Dlouhý … … 48 50 } 49 51 50 p ublic double distance(EastNorth n, EastNorth m) {52 private static double distance(EastNorth n, EastNorth m) { 51 53 double easd, nord; 52 54 easd = n.east() - m.east(); … … 55 57 } 56 58 57 public class PolarCoor {59 public static class PolarCoor { 58 60 double radius; 59 61 double angle; … … 250 252 * @return true if all nodes in the given collection are referred by the same object, and no other one (see #8431) 251 253 */ 252 protected boolean allowRegularPolygon(Collection<Node> nodes) {254 protected static boolean allowRegularPolygon(Collection<Node> nodes) { 253 255 Set<OsmPrimitive> allReferrers = new HashSet<OsmPrimitive>(); 254 256 for (Node n : nodes) { -
trunk/src/org/openstreetmap/josm/actions/CreateCircleAction.java
r6672 r6814 38 38 * BTW: Someone might want to implement projection corrections for this... 39 39 * 40 * @since 996 41 * 40 42 * @author Henry Loenwind, based on much copy&Paste from other Actions. 41 43 * @author Sebastian Masch … … 47 49 */ 48 50 public CreateCircleAction() { 49 super(tr("Create Circle"), " createcircle", tr("Create a circle from three selected nodes."),51 super(tr("Create Circle"), "aligncircle", tr("Create a circle from three selected nodes."), 50 52 Shortcut.registerShortcut("tools:createcircle", tr("Tool: {0}", tr("Create Circle")), 51 KeyEvent.VK_O, Shortcut.SHIFT), true );53 KeyEvent.VK_O, Shortcut.SHIFT), true, "createcircle", true); 52 54 putValue("help", ht("/Action/CreateCircle")); 53 55 } … … 276 278 Main.map.repaint(); 277 279 } 278 280 279 281 private static void notifyNodesNotOnCircle() { 280 282 new Notification( -
trunk/src/org/openstreetmap/josm/actions/DownloadReferrersAction.java
r6336 r6814 20 20 21 21 /** 22 * This action loads the set of primitives referring to the current selection from the OSM 23 * server. 24 * 22 * This action loads the set of primitives referring to the current selection from the OSM server. 23 * @since 1810 25 24 */ 26 public class DownloadReferrersAction extends JosmAction {25 public class DownloadReferrersAction extends JosmAction { 27 26 27 /** 28 * Constructs a new {@code DownloadReferrersAction}. 29 */ 28 30 public DownloadReferrersAction() { 29 super(tr("Download parent ways/relations..."), "downloadreferrers", tr("Download objects referring to one of the selected objects"), 30 Shortcut.registerShortcut("file:downloadreferrers", tr("File: {0}", tr("Download parent ways/relations...")), KeyEvent.VK_D, Shortcut.ALT_CTRL), true); 31 super(tr("Download parent ways/relations..."), "download", 32 tr("Download objects referring to one of the selected objects"), 33 Shortcut.registerShortcut("file:downloadreferrers", 34 tr("File: {0}", tr("Download parent ways/relations...")), KeyEvent.VK_D, Shortcut.ALT_CTRL), 35 true, "downloadreferrers", true); 31 36 putValue("help", ht("/Action/DownloadParentWaysAndRelation")); 32 37 } … … 41 46 * @exception IllegalArgumentException thrown if targetLayer is null 42 47 */ 43 static public void downloadReferrers(OsmDataLayer targetLayer, Collection<OsmPrimitive> children) throws IllegalArgumentException {48 public static void downloadReferrers(OsmDataLayer targetLayer, Collection<OsmPrimitive> children) throws IllegalArgumentException { 44 49 if (children == null || children.isEmpty()) return; 45 50 Main.worker.submit(new DownloadReferrersTask(targetLayer, children)); … … 55 60 * @exception IllegalArgumentException thrown if targetLayer is null 56 61 */ 57 static public void downloadReferrers(OsmDataLayer targetLayer, Map<Long, OsmPrimitiveType> children) throws IllegalArgumentException {62 public static void downloadReferrers(OsmDataLayer targetLayer, Map<Long, OsmPrimitiveType> children) throws IllegalArgumentException { 58 63 if (children == null || children.isEmpty()) return; 59 64 Main.worker.submit(new DownloadReferrersTask(targetLayer, children)); … … 64 69 * <code>type</code>. 65 70 * 66 *67 71 * @param targetLayer the target layer. Must not be null. 68 72 * @param id the primitive id. id > 0 required. … … 72 76 * @exception IllegalArgumentException thrown if type == null 73 77 */ 74 static public void downloadReferrers(OsmDataLayer targetLayer, long id, OsmPrimitiveType type) throws IllegalArgumentException {78 public static void downloadReferrers(OsmDataLayer targetLayer, long id, OsmPrimitiveType type) throws IllegalArgumentException { 75 79 if (id <= 0) 76 80 throw new IllegalArgumentException(MessageFormat.format("Id > 0 required, got {0}", id)); -
trunk/src/org/openstreetmap/josm/actions/JoinNodeWayAction.java
r6380 r6814 27 27 28 28 public class JoinNodeWayAction extends JosmAction { 29 30 /** 31 * Constructs a new {@code JoinNodeWayAction}. 32 */ 29 33 public JoinNodeWayAction() { 30 34 super(tr("Join Node to Way"), "joinnodeway", tr("Include a node into the nearest way segments"), … … 53 57 HashMap<Way, List<Integer>> insertPoints = new HashMap<Way, List<Integer>>(); 54 58 for (WaySegment ws : wss) { 55 // Maybe cleaner to pass a "isSelected" predicate to getNearestWaySeg ements, but this is atm.less invasive.59 // Maybe cleaner to pass a "isSelected" predicate to getNearestWaySegments, but this is less invasive. 56 60 if(restrictToSelectedWays && !ws.way.isSelected()) { 57 61 continue; -
trunk/src/org/openstreetmap/josm/actions/JosmAction.java
r6380 r6814 44 44 private SelectionChangeAdapter selectionChangeAdapter; 45 45 46 /** 47 * Returns the shortcut for this action. 48 * @return the shortcut for this action, or "No shortcut" if none is defined 49 */ 46 50 public Shortcut getShortcut() { 47 51 if (sc == null) { … … 110 114 } 111 115 116 /** 117 * Constructs a new {@code JosmAction}. 118 * 119 * Use this super constructor to setup your action. 120 * 121 * @param name the action's text as displayed on the menu (if it is added to a menu) 122 * @param iconName the filename of the icon to use 123 * @param tooltip a longer description of the action that will be displayed in the tooltip. Please note 124 * that html is not supported for menu actions on some platforms. 125 * @param shortcut a ready-created shortcut object or null if you don't want a shortcut. But you always 126 * do want a shortcut, remember you can always register it with group=none, so you 127 * won't be assigned a shortcut unless the user configures one. If you pass null here, 128 * the user CANNOT configure a shortcut for your action. 129 * @param registerInToolbar register this action for the toolbar preferences? 130 * @param installAdapters false, if you don't want to install layer changed and selection changed adapters 131 */ 112 132 public JosmAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean registerInToolbar, boolean installAdapters) { 113 133 this(name, iconName, tooltip, shortcut, registerInToolbar, null, installAdapters); 114 134 } 115 135 136 /** 137 * Constructs a new {@code JosmAction}. 138 * 139 * Use this super constructor to setup your action. 140 * 141 * @param name the action's text as displayed on the menu (if it is added to a menu) 142 * @param iconName the filename of the icon to use 143 * @param tooltip a longer description of the action that will be displayed in the tooltip. Please note 144 * that html is not supported for menu actions on some platforms. 145 * @param shortcut a ready-created shortcut object or null if you don't want a shortcut. But you always 146 * do want a shortcut, remember you can always register it with group=none, so you 147 * won't be assigned a shortcut unless the user configures one. If you pass null here, 148 * the user CANNOT configure a shortcut for your action. 149 * @param registerInToolbar register this action for the toolbar preferences? 150 */ 116 151 public JosmAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean registerInToolbar) { 117 152 this(name, iconName, tooltip, shortcut, registerInToolbar, null, true); 118 153 } 119 154 155 /** 156 * Constructs a new {@code JosmAction}. 157 */ 120 158 public JosmAction() { 121 159 this(true); 122 160 } 123 161 162 /** 163 * Constructs a new {@code JosmAction}. 164 * 165 * @param installAdapters false, if you don't want to install layer changed and selection changed adapters 166 */ 124 167 public JosmAction(boolean installAdapters) { 125 168 setHelpId(); … … 146 189 } 147 190 191 /** 192 * Sets the tooltip text of this action. 193 * @param tooltip The text to display in tooltip. Can be {@code null} 194 */ 148 195 public void setTooltip(String tooltip) { 149 196 if (tooltip != null) { -
trunk/src/org/openstreetmap/josm/actions/UpdateModifiedAction.java
r4982 r6814 14 14 /** 15 15 * This action synchronizes a set of primitives with their state on the server. 16 * 16 * @since 2682 17 17 */ 18 18 public class UpdateModifiedAction extends UpdateSelectionAction { 19 19 20 20 /** 21 * constructor21 * Constructs a new {@code UpdateModifiedAction}. 22 22 */ 23 23 public UpdateModifiedAction() { 24 super(tr("Update modified"), 25 "updatemodified", 24 super(tr("Update modified"), "updatedata", 26 25 tr("Updates the currently modified objects from the server (re-downloads data)"), 27 26 Shortcut.registerShortcut("file:updatemodified", 28 27 tr("File: {0}", tr("Update modified")), KeyEvent.VK_M, 29 28 Shortcut.ALT_CTRL), 30 true );29 true, "updatemodified"); 31 30 putValue("help", ht("/Action/UpdateModified")); 32 31 } -
trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java
r6336 r6814 26 26 /** 27 27 * This action synchronizes a set of primitives with their state on the server. 28 * 28 * @since 1670 29 29 */ 30 30 public class UpdateSelectionAction extends JosmAction { … … 34 34 * 35 35 * @param id the primitive id 36 * @param type The primitive type. Must be one of {@link OsmPrimitiveType#NODE NODE}, {@link OsmPrimitiveType#WAY WAY}, {@link OsmPrimitiveType#RELATION RELATION} 36 37 */ 37 38 public static void handlePrimitiveGoneException(long id, OsmPrimitiveType type) { 38 39 MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader(); 39 reader.append(getCurrentDataSet(), id, type);40 reader.append(getCurrentDataSet(), id, type); 40 41 try { 41 42 DataSet ds = reader.parseOsm(NullProgressMonitor.INSTANCE); … … 80 81 81 82 /** 82 * constructor83 * Constructs a new {@code UpdateSelectionAction}. 83 84 */ 84 85 public UpdateSelectionAction() { 85 super(tr("Update selection"), 86 "updateselection", 86 super(tr("Update selection"), "updatedata", 87 87 tr("Updates the currently selected objects from the server (re-downloads data)"), 88 88 Shortcut.registerShortcut("file:updateselection", 89 89 tr("File: {0}", tr("Update selection")), KeyEvent.VK_U, 90 90 Shortcut.ALT_CTRL), 91 true );91 true, "updateselection", true); 92 92 putValue("help", ht("/Action/UpdateSelection")); 93 93 } 94 public UpdateSelectionAction(String name, String iconName, String tooltip, 95 Shortcut shortcut, boolean register) { 96 super(name, iconName, tooltip, shortcut, register); 94 95 /** 96 * Constructs a new {@code UpdateSelectionAction}. 97 * 98 * @param name the action's text as displayed on the menu (if it is added to a menu) 99 * @param iconName the filename of the icon to use 100 * @param tooltip a longer description of the action that will be displayed in the tooltip. Please note 101 * that html is not supported for menu actions on some platforms. 102 * @param shortcut a ready-created shortcut object or null if you don't want a shortcut. But you always 103 * do want a shortcut, remember you can always register it with group=none, so you 104 * won't be assigned a shortcut unless the user configures one. If you pass null here, 105 * the user CANNOT configure a shortcut for your action. 106 * @param register register this action for the toolbar preferences? 107 * @param toolbarId identifier for the toolbar preferences. The iconName is used, if this parameter is null 108 */ 109 public UpdateSelectionAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean register, String toolbarId) { 110 super(name, iconName, tooltip, shortcut, register, toolbarId, true); 97 111 } 98 112 … … 111 125 } 112 126 113 /**114 * action handler115 */116 127 @Override 117 128 public void actionPerformed(ActionEvent e) { 118 129 if (! isEnabled()) 119 130 return; 120 Collection<OsmPrimitive> toUpdate = getData();131 Collection<OsmPrimitive> toUpdate = getData(); 121 132 if (toUpdate.isEmpty()) { 122 133 JOptionPane.showMessageDialog( … … 131 142 } 132 143 144 /** 145 * Returns the data on which this action operates. Override if needed. 146 * @return the data on which this action operates 147 */ 133 148 public Collection<OsmPrimitive> getData() { 134 149 return getCurrentDataSet().getAllSelected(); -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ConflictResolver.java
r6316 r6814 87 87 */ 88 88 protected void loadIcons() { 89 mergeComplete = ImageProvider.get("dialogs /conflict","mergecomplete.png" );90 mergeIncomplete = ImageProvider.get("dialogs/conflict", "mergeincomplete.png" );89 mergeComplete = ImageProvider.get("dialogs", "valid.png" ); 90 mergeIncomplete = ImageProvider.get("dialogs/conflict", "mergeincomplete.png" ); 91 91 } 92 92 -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/UrlBasedQueryPanel.java
r6453 r6814 23 23 import org.openstreetmap.josm.Main; 24 24 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 25 import org.openstreetmap.josm.gui.widgets.JosmTextField; 25 26 import org.openstreetmap.josm.io.ChangesetQuery; 27 import org.openstreetmap.josm.io.ChangesetQuery.ChangesetQueryUrlException; 26 28 import org.openstreetmap.josm.io.OsmApi; 27 import org.openstreetmap.josm.io.ChangesetQuery.ChangesetQueryUrlException;28 29 import org.openstreetmap.josm.tools.ImageProvider; 29 import org.openstreetmap.josm.gui.widgets.JosmTextField;30 30 31 31 … … 166 166 protected void feedbackValid() { 167 167 if (getCurrentFeedback().equals("valid")) return; 168 lblValid.setIcon(ImageProvider.get("dialogs /changeset", "valid"));168 lblValid.setIcon(ImageProvider.get("dialogs", "valid")); 169 169 lblValid.setToolTipText(""); 170 170 lblValid.putClientProperty("valid", "valid"); -
trunk/src/org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java
r6653 r6814 41 41 */ 42 42 public class OsmApiUrlInputPanel extends JPanel { 43 43 44 44 /** 45 45 * OSM API URL property key. … … 54 54 /** indicates whether to use the default OSM URL or not */ 55 55 private JCheckBox cbUseDefaultServerUrl; 56 56 57 57 private ApiUrlPropagator propagator; 58 58 … … 154 154 } 155 155 } 156 156 157 157 /** 158 158 * Returns the entered API URL, stripped of leading and trailing white characters. 159 * @return the entered API URL, stripped of leading and trailing white characters. 159 * @return the entered API URL, stripped of leading and trailing white characters. 160 160 * May be an empty string if nothing has been entered. In this case, it means the user wants to use {@link OsmApi#DEFAULT_API_URL}. 161 161 * @see Utils#strip(String) … … 189 189 public void run() { 190 190 if (task.isSuccess()) { 191 lblValid.setIcon(ImageProvider.get("dialogs /changeset", "valid"));191 lblValid.setIcon(ImageProvider.get("dialogs", "valid")); 192 192 lblValid.setToolTipText(tr("The API URL is valid.")); 193 193 lastTestedUrl = url; -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r6809 r6814 22 22 import java.io.StringReader; 23 23 import java.io.UnsupportedEncodingException; 24 import java.net.MalformedURLException;25 24 import java.net.URI; 26 25 import java.net.URL; … … 360 359 361 360 /** 362 * @see #get(java.lang.String, java.lang.String) 361 * @param name The icon name (base name with or without '.png' or '.svg' extension) 362 * @return the requested image or null if the request failed 363 * @see #get(String, String) 363 364 */ 364 365 public static ImageIcon get(String name) { … … 369 370 * Load an image with a given file name, but do not throw an exception 370 371 * when the image cannot be found. 371 * @see #get(java.lang.String, java.lang.String) 372 * 373 * @param subdir subdirectory the image lies in 374 * @param name The icon name (base name with or without '.png' or '.svg' extension) 375 * @return the requested image or null if the request failed 376 * @see #get(String, String) 372 377 */ 373 378 public static ImageIcon getIfAvailable(String subdir, String name) { … … 376 381 377 382 /** 378 * @see #getIfAvailable(java.lang.String, java.lang.String) 383 * @param name The icon name (base name with or without '.png' or '.svg' extension) 384 * @return the requested image or null if the request failed 385 * @see #getIfAvailable(String, String) 379 386 */ 380 387 public static ImageIcon getIfAvailable(String name) { … … 854 861 * @param img the image to be rotated. 855 862 * @param rotatedAngle the rotated angle, in degree, clockwise. It could be any double but we 856 * will mod it with 360 before using it. More over for caching performance, it will be rounded to 863 * will mod it with 360 before using it. More over for caching performance, it will be rounded to 857 864 * an entire value between 0 and 360. 858 865 * … … 863 870 return createRotatedImage(img, rotatedAngle, ImageResource.DEFAULT_DIMENSION); 864 871 } 865 872 866 873 /** 867 874 * Creates a rotated version of the input image, scaled to the given dimension. … … 869 876 * @param img the image to be rotated. 870 877 * @param rotatedAngle the rotated angle, in degree, clockwise. It could be any double but we 871 * will mod it with 360 before using it. More over for caching performance, it will be rounded to 878 * will mod it with 360 before using it. More over for caching performance, it will be rounded to 872 879 * an entire value between 0 and 360. 873 880 * @param dimension The requested dimensions. Use (-1,-1) for the original size … … 878 885 public static Image createRotatedImage(Image img, double rotatedAngle, Dimension dimension) { 879 886 CheckParameterUtil.ensureParameterNotNull(img, "img"); 880 887 881 888 // convert rotatedAngle to an integer value from 0 to 360 882 889 Long originalAngle = Math.round(rotatedAngle % 360); … … 884 891 originalAngle = 360L; 885 892 } 886 893 887 894 ImageResource imageResource = null; 888 895 … … 892 899 ROTATE_CACHE.put(img, cacheByAngle = new HashMap<Long, ImageResource>()); 893 900 } 894 901 895 902 imageResource = cacheByAngle.get(originalAngle); 896 903 897 904 if (imageResource == null) { 898 905 // convert originalAngle to a value from 0 to 90 … … 901 908 angle = 90.0; 902 909 } 903 910 904 911 double radian = Math.toRadians(angle); 905 912 906 913 new ImageIcon(img); // load completely 907 914 int iw = img.getWidth(null); … … 909 916 int w; 910 917 int h; 911 918 912 919 if ((originalAngle >= 0 && originalAngle <= 90) || (originalAngle > 180 && originalAngle <= 270)) { 913 920 w = (int) (iw * Math.sin(DEGREE_90 - radian) + ih * Math.sin(radian)); … … 921 928 Graphics g = image.getGraphics(); 922 929 Graphics2D g2d = (Graphics2D) g.create(); 923 930 924 931 // calculate the center of the icon. 925 932 int cx = iw / 2; 926 933 int cy = ih / 2; 927 934 928 935 // move the graphics center point to the center of the icon. 929 936 g2d.translate(w / 2, h / 2); 930 937 931 938 // rotate the graphics about the center point of the icon 932 939 g2d.rotate(Math.toRadians(originalAngle)); 933 940 934 941 g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); 935 942 g2d.drawImage(img, -cx, -cy, null); 936 943 937 944 g2d.dispose(); 938 945 new ImageIcon(image); // load completely … … 941 948 } 942 949 } 943 950 944 951 /** 945 952 * Creates a scaled down version of the input image to fit maximum dimensions. (Keeps aspect ratio) 946 953 * 947 954 * @param img the image to be scaled down. 948 * @param maxSize the maximum size in pixels (both for width and height) 955 * @param maxSize the maximum size in pixels (both for width and height) 949 956 * 950 957 * @return the image after scaling.
Note:
See TracChangeset
for help on using the changeset viewer.