164 | | There are still a couple of global objects accessible through [source:/trunk/src/org/openstreetmap/josm/Main.java Main], though. |
165 | | |
166 | | ||Main.parent||This is the parent of all GUI elements. Use this as first parameter to JOptionPane.show* if you want to popup a message|| |
167 | | ||Main.pref|| This is the global preferences file, loaded from {{{${josm.home}/preferences}}}. Use {{{Main.pref.get(...)}}} and {{{Main.pref.put(...)}}} to access the preferences. They will be saved immediately after a put, so don't put anything you dont want to have there. Please, prefix custom plugin preferences with your plugin name. || |
168 | | ||Main.proj||This is the current [source:/trunk/src/org/openstreetmap/josm/data/projection/Projection.java Projection] used in JOSM. If you want to translate between Lat/Lon and East/North, use {{{Main.proj.latlon2eastnorth}}} and {{{Main.proj.eastnorth2latlon}}}.|| |
169 | | ||Main.map.mapView||This is the main UI component in JOSM to paint the map. You usually access this to call methods like {{{getCenter()}}}, {{{getScale()}}} or {{{zoomTo()}}}. '''Beware''': {{{Main.map}}} can be null when no layers are created yet.|| |
170 | | ||Main.getLayerManager()||This provides you with the list of layers that are currently displayed.|| |
| 164 | In 2017 The Plugin API was reworked to make the source more modular. [source:/trunk/src/org/openstreetmap/josm/Main.java Main] object was removed and replaced by other more modular API. These are some of the new objects: |
| 165 | |
| 166 | ||MainApplication.getMainFrame()||This is the parent of all GUI elements. Use this as first parameter to JOptionPane.show* if you want to popup a message|| |
| 167 | ||Config.getPref()|| This is the global preferences file, loaded from {{{${josm.home}/preferences}}}. Use {{{Config.getPref().get(key)}}} and {{{Config.getPref().put(key,value)}}} to access the preferences. They will be saved immediately after a put, so don't put anything you dont want to have there. Please, prefix custom plugin preferences with your plugin name. || |
| 168 | ||Projection||This is the current [source:/trunk/src/org/openstreetmap/josm/data/projection/Projection.java Projection] used in JOSM. If you want to translate between Lat/Lon and East/North, use {{{Projection.latlon2eastnorth}}} and {{{Projection.latlon2eastnorth}}}.|| |
| 169 | ||MainApplication.getMap().mapView||This is the main UI component in JOSM to paint the map. You usually access this to call methods like {{{getCenter()}}}, {{{getScale()}}} or {{{zoomTo()}}}. '''Beware''': {{{MainApplication.getMap()}}} can be null when no layers are created yet.|| |
| 170 | ||MainApplication.getLayerManager()||This provides you with the list of layers that are currently displayed.|| |