| Version 2 (modified by , 6 years ago) ( diff ) |
|---|
Aangepaste XML configuratiebestanden voor JOSM
Voorbeelden (Zie opmerkingen in XML)
- Gecategoriseerde voorbeelden scripts.zip
- Installeren van voorkeuzen en stijlen: seamap.xml, seamap_ForOfflineInstallation.zip
- Afbeeldingslaag, plug-in en opties fijn afstemmen (vooralsnog alleen Russische vertaling): forestMapping.xml
Voorkeuren aanvullen of vervangen opdrachten
De volgende code voegt nog een afbeelding toe aan de lijst:
<config> <preferences operation="append"> <!-- Any preferences.xml fragment can be used here --> <tag key="download.autorun" value="true"/> <!-- example of simple preference modification - download.autorun := true --> <maps key="imagery.entries"> <map> <tag key="name" value="ScanEx IRS"/> <tag key="type" value="scanex"/> <tag key="url" value="IRS"/> <tag key="attribution-text" value="IRS"/> <tag key="attribution-url" value="http://irs.gis-lab.info/"/> </map> </maps> </preferences> </config>
Als in plaats daarvan <preferences operation="replace"> wordt gebruikt, zullen alle andere elementen <map> worden verwijderd uit imagery.entries !
Een ander voorbeeld:
<config> <preferences operation="replace"> <!-- old content of draw.anglesnap.angles will be deleted --> <list key="draw.anglesnap.angles"> <entry value="30"/> <entry value="45"/> <entry value="60"/> </list> </preferences> </config>
Bestandsbewerkingen - downloaden, verwijderen, uitpakken
<config> <delete path="plugins/tmp"/> <!-- delete recursively plugins/tmp from preferences directory --> <!-- base = "prefs" - delete from preferences folder base = "plugins" - delete from plugins folder base = "cache" - delete from cache folder --> <delete path="splug" base="plugins"/> <!-- delete recursively splug folder from preferences directory --> <!--<delete path="." base="cache"/> delete cache folder --> <download url="http://svn.openstreetmap.org/applications/editors/josm/dist/buildings_tools.jar" path="plugins/tmp/bt.jar" mkdir="true" unzip="true"/> <!-- download file from url and place as "path" if mkdir="true", then all necessary directories will be created if unzip="true", then zip/jar file will be exanded and then deleted --> <download url="https://wiki.openstreetmap.org/w/images/7/79/Public-images-osm_logo.svg" path="1/logo.svg" mkdir="true" base="cache"/> <download url="file://localhost/e:/a.zip" path="qqq/a.zip" unzip="true" mkdir="true"/> <!-- copy from local folder and unzip --> </config>
Plug-in bewerkingen: installeren, uitschakelen, verwijderen
<config> <!-- installeer en verwijder plug-ins zonder te verwijderen plastic_laf.jar --> <plugin install="buildings_tools;wayselector" remove="plastic_laf"/> <plugin delete="proj4j"/> <!-- disable plugin and delete jar --> </config>
Variabelen, berichtenvensters en de gebruiker vragen
<config> <ask var="r" text="Kies alstublieft iets!" options="0;1;2"/> <messagebox text="U koos ${r}" type="i"/> <if test="${r==0}"> <messagebox text="r=0!"/> </if> <else> <messagebox text="nee, r!=0 - r=${r} feitelijk!"/> </else> <if test="${r==1 || r==2}"> <messagebox text="r=1 of 2!"/> </if> <if test="${r!=2 && r!=0}"> <messagebox text="Het is niet 0, het is niet 2 , dus is het = 1!"/> </if> <if test="${r!=2}"> <break/> </if> <ask var="r" text="Kies alstublieft iets!" options="A;B"/> <messagebox text="U koos knop nummer ${r}" type="i"/> </config>
JavaScript API
<config> <script><![CDATA[ API.messageBox('i','Hello!'); txt = API.askText("Enter something..."); i = API.askOption("Select background color","red;green;black"); if (i==0) API.pref['color.background']="#770000"; if (i==1) API.pref['color.background']="#007700"; if (i==2) API.pref['color.background']="#000000"; color = API.pref['color.background']; API.messageBox('i',"<html><span color='"+color+"'> You entered "+txt+"</span></html>"); if ( API.askOption("Do you want to test downloading and plugins?","") == 0 ) { // "" in askOption means Yes/No dialog API.downloadFile("http://svn.openstreetmap.org/applications/editors/josm/dist/buildings_tools.jar", "1/2/a.jar","cache"); API.downloadAndUnpackFile("http://svn.openstreetmap.org/applications/editors/josm/dist/buildings_tools.jar", "1/2a/a.jar","cache"); if( API.askOption("Do you want to delete downloaded files?","") == 0) { API.deleteFile("1","cache"); } API.pluginInstall("AlignWays"); if( API.askOption("Do you want to uninstall utilsplugin2","") == 0) { API.pluginUninstall("utilsplugin2"); } } importPackage(org.openstreetmap.josm.data); CustomConfigurator.exportPreferencesKeysByPatternToFile ("e:/config.xml", true, ".*"); //println(JSON.stringify(API.prefs)); // JSON works only on JDK1.7 //println(JSON.stringify(API.fragments)); // JSON works only on JDK1.7 ]]> </script> </config>
Zie ook
- Development discussie: #4421
Note:
See TracWiki
for help on using the wiki.


