Changeset 486 in josm


Ignore:
Timestamp:
2007-12-14T02:00:43+01:00 (12 years ago)
Author:
framm
Message:
  • built-in mappaint. mappaint plugin no longer required and will be removed from configuration on startup. toggle mappaint view using "wireframe" option in view menu.
Location:
trunk
Files:
332 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/.classpath

    r402 r486  
    22<classpath>
    33        <classpathentry kind="src" path="src"/>
    4         <classpathentry excluding="build/|dist/|src/|test/" including="images/|presets/" kind="src" path=""/>
     4        <classpathentry excluding="build/|dist/|src/|test/" including="images/|presets/|styles/" kind="src" path=""/>
    55        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    66        <classpathentry kind="lib" path="lib/metadata-extractor-2.3.1-nosun.jar"/>
  • trunk/build.xml

    r445 r486  
    3030                </copy>
    3131
     32                <!-- styles -->
     33                <copy todir="build/styles">
     34                        <fileset dir="styles" />
     35                </copy>
     36
    3237                <!-- create josm-custom.jar -->
    3338                <delete file="dist/josm-custom.jar"/>
  • trunk/src/org/openstreetmap/josm/Main.java

    r463 r486  
    5353import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    5454import org.openstreetmap.josm.gui.layer.OsmDataLayer.CommandQueueListener;
     55import org.openstreetmap.josm.gui.preferences.MapPaintPreference;
    5556import org.openstreetmap.josm.gui.preferences.TaggingPresetPreference;
    5657import org.openstreetmap.josm.gui.preferences.ToolbarPreferences;
     
    120121         */
    121122        public final MainMenu menu;
    122 
    123 
    124123
    125124
     
    186185
    187186                TaggingPresetPreference.initialize();
     187                MapPaintPreference.initialize();
    188188
    189189                toolbar.refreshToolbarControl();
     
    203203                if (System.getProperty("josm.plugins") != null)
    204204                        plugins.addAll(Arrays.asList(System.getProperty("josm.plugins").split(",")));
     205               
     206                // we remove mappaint from the preferences on startup but this is just
     207                // in case it crept in through the properties:
     208                if (plugins.contains("mappaint")) {
     209                        plugins.remove("mappaint");
     210                        System.out.println("Warning - loading of mappaint plugin was requested. This JOSM version has built-in mappaint support. The plugin is not required.");
     211                }
     212               
    205213                if (plugins.isEmpty())
    206214                        return;
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r480 r486  
    136136                return all;
    137137        }
     138       
    138139        synchronized public boolean getBoolean(final String key) {
    139140                return getBoolean(key, false);
     
    144145                return properties.containsKey(key) ? Boolean.parseBoolean(properties.get(key)) : def;
    145146        }
    146 
    147147
    148148        synchronized public void put(final String key, final String value) {
     
    159159                firePreferenceChanged(key, Boolean.toString(value));
    160160        }
    161 
    162161
    163162        private final void firePreferenceChanged(final String key, final String value) {
     
    207206                properties.put("projection", "org.openstreetmap.josm.data.projection.Epsg4326");
    208207                properties.put("draw.segment.direction", "true");
     208                properties.put("draw.wireframe", "false");
    209209                properties.put("layerlist.visible", "true");
    210210                properties.put("propertiesdialog.visible", "true");
  • trunk/src/org/openstreetmap/josm/data/coor/Coordinate.java

    r456 r486  
    33
    44import java.io.Serializable;
    5 
    6 
    7 
    85
    96/**
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java

    r367 r486  
    2121
    2222/**
    23  * A visitor that paint a simple scheme of every primitive it visits to a
     23 * A visitor that paints a simple scheme of every primitive it visits to a
    2424 * previous set graphic environment.
    2525 *
  • trunk/src/org/openstreetmap/josm/gui/GettingStarted.java

    r484 r486  
    5050                panel = new JPanel(new GridBagLayout());
    5151               
    52                 panel.add(new JLabel(tr("<html><h2>You are running the latest \"modeless\" JOSM version.</h2>" +
    53                                 "<h3>This version (almost) does away with the old edit modes, like \"add node and connect\"<br>" +
    54                                 "etc.; instead, there are only four modes: zoom, select, edit, and delete." +
    55                                 "<br>The edit mode will do what you want in most cases (also see the mini help about<br>" +
    56                                 "modifier keys at the bottom of the screen).</h3>" +
    57                 "<h3>If this is the first time you use JOSM since 08 October, you will also find that with the<br>" +
    58                 "0.5 API, segments have gone and relations have been added. You will find general<br>" +
    59                 "information about the changes on the OSM wiki, and there's a page on using relations<br>"+
    60                 "in the JOSM online help." +
     52                panel.add(new JLabel(tr("<html><h2>You are running the latest JOSM version with built-in mappaint support.</h2>" +
     53                "<h3>The mappaint plugin is no longer necessary and has been removed from your configuration<br>" +
     54                "file (if it was present). You can now switch between the \"classic\" display and the mappaint<br>" +
     55                "style by toggling the \"Wireframe\" option in the \"View\" menu.</h3>" +
     56                "<h3>If you have not used new JOSM versions for a while, you will also discover that this JOSM<br>" +
     57                "is \"modeless\". It (almost) does away with the old edit modes, like \"add node and connect\" etc.;<br>"+
     58                "instead, there are only four modes: zoom, select, edit, and delete. The edit mode will do what<br>"+
     59                "you want in most cases (also see the mini help about modifier keys at the bottom of the screen)." +
    6160                "</h3>")), GBC.eol());
    6261               
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r442 r486  
    111111                        } else {
    112112                                Main.pref.load();
     113                               
     114                                // this is temporary code to ease the transition to built-in mappaint
     115                                List<String> plugins = new LinkedList<String>();
     116                                if (Main.pref.hasKey("plugins"))
     117                                        plugins.addAll(Arrays.asList(Main.pref.get("plugins").split(",")));
     118                                                               
     119                                if (plugins.contains("mappaint")) {
     120                                        plugins.remove("mappaint");
     121                                        // XXX is there really no "public static String.join" or something?
     122                                        StringBuilder tmp = new StringBuilder();
     123                                        for (String p : plugins) { if (tmp.length()>0) tmp.append(","); tmp.append(p); }
     124                                        Main.pref.put("plugins", tmp.toString());
     125                                        Main.pref.put("draw.wireframe", false);
     126                                } else if (!Main.pref.hasKey("draw.wireframe")) {
     127                                        Main.pref.put("draw.wireframe", true);
     128                                }
    113129                        }
    114130                } catch (final IOException e1) {
  • trunk/src/org/openstreetmap/josm/gui/MainMenu.java

    r466 r486  
    1010
    1111import javax.swing.Action;
     12import javax.swing.JCheckBoxMenuItem;
    1213import javax.swing.JMenu;
    1314import javax.swing.JMenuBar;
     
    1516import javax.swing.KeyStroke;
    1617
     18import org.openstreetmap.josm.Main;
    1719import org.openstreetmap.josm.actions.JosmAction;
    1820import org.openstreetmap.josm.actions.AboutAction;
     
    4446import org.openstreetmap.josm.actions.search.SearchAction;
    4547import org.openstreetmap.josm.data.DataSetChecker;
     48import org.openstreetmap.josm.data.Preferences;
    4649
    4750/**
     
    156159                    current.setAccelerator(autoScaleAction.shortCut);
    157160        }
     161        viewMenu.addSeparator();
     162
     163        // TODO move code to an "action" like the others?
     164        final JCheckBoxMenuItem wireframe = new JCheckBoxMenuItem(tr("Wireframe view"));
     165        wireframe.setSelected(Main.pref.getBoolean("draw.wireframe", true));     
     166        wireframe.setAccelerator(KeyStroke.getKeyStroke("alt W"));
     167        wireframe.addActionListener(new ActionListener() {
     168                public void actionPerformed(ActionEvent ev) {
     169                        Main.pref.put("draw.wireframe", wireframe.isSelected());
     170                        Main.map.mapView.repaint();
     171                }
     172        });
     173        viewMenu.add(wireframe);
     174       
    158175                add(viewMenu);
    159176
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r483 r486  
    4141import org.openstreetmap.josm.data.osm.Way;
    4242import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
     43import org.openstreetmap.josm.data.osm.visitor.MapPaintVisitor;
    4344import org.openstreetmap.josm.data.osm.visitor.MergeVisitor;
    4445import org.openstreetmap.josm.data.osm.visitor.SimplePaintVisitor;
     
    116117        public final LinkedList<DataChangeListener> listenerDataChanged = new LinkedList<DataChangeListener>();
    117118       
    118         private SimplePaintVisitor mapPainter = new SimplePaintVisitor();
    119 
     119        private SimplePaintVisitor wireframeMapPainter = new SimplePaintVisitor();
     120        private MapPaintVisitor standardMapPainter = new MapPaintVisitor();
     121       
    120122        /**
    121123         * Construct a OsmDataLayer.
     
    158160                        }
    159161                }
    160                 mapPainter.setGraphics(g);
    161                 mapPainter.setNavigatableComponent(mv);
    162                 mapPainter.inactive = inactive;
    163                 mapPainter.visitAll(data);
     162               
     163                if (Main.pref.getBoolean("draw.wireframe")) {
     164                        wireframeMapPainter.setGraphics(g);
     165                        wireframeMapPainter.setNavigatableComponent(mv);
     166                        wireframeMapPainter.inactive = inactive;
     167                        wireframeMapPainter.visitAll(data);
     168                }
     169                else
     170                {
     171                        standardMapPainter.setGraphics(g);
     172                        standardMapPainter.setNavigatableComponent(mv);
     173                        standardMapPainter.inactive = inactive;
     174                        standardMapPainter.visitAll(data);
     175                }
    164176                Main.map.conflictDialog.paintConflicts(g, mv);
    165177        }
     
    321333        }
    322334
    323 
    324         public void setMapPainter(SimplePaintVisitor mapPainter) {
    325         this.mapPainter = mapPainter;
    326     }
    327        
    328335        public void fireDataChange() {
    329336                for (DataChangeListener dcl : listenerDataChanged) {
  • trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java

    r319 r486  
    101101                settings.add(new DrawingPreference());
    102102                settings.add(new ColorPreference());
     103                settings.add(new MapPaintPreference());
    103104                settings.add(new ServerAccessPreference());
    104105                settings.add(new CsvPreference());
Note: See TracChangeset for help on using the changeset viewer.