Changes between Version 2 and Version 3 of Uk:Help/Preferences/RemoteControl


Ignore:
Timestamp:
2012-01-28T16:47:02+01:00 (14 years ago)
Author:
andygol
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Uk:Help/Preferences/RemoteControl

    v2 v3  
    1 [[TranslatedPages(revision=4,outdated=Ця сторінка не має розгорнутого пояснення. Будь ласка\, допоможіть її покращити.)]]
     1[[TranslatedPages(revision=9)]]
    22
    33= Налаштування > Дистанційне керування =
    44
    5 [[Image(source:trunk/images/preferences/remotecontrol.png)]] '''Налаштування функцій дистанційного керування.'''
    6 
    7 Дистанційне керування дозволяє JOSM’му бути керованим з інших застосунків, наприклад з оглядачів, відкриваючи на прослуховування порт TCP (8111) на локальному комп’ютері для отримання команд.
     5[[Image(source:trunk/images/preferences/remotecontrol.png)]] **Налаштування функцій дистанційного керування.**
     6
     7Дистанційне керування дозволяє JOSM’му бути керованим з інших застосунків, наприклад з оглядачів, відкриваючи на прослуховування порт TCP (8111) на локальному комп’ютері для отримання команд.[[BR]]
     8**Примітка** З причин підтримання безпеки ця функція відключена у типових налаштуваннях, її треба ввімкнути вручну.
    89
    910
     
    1314
    1415
    15 * '''Включити  дистанційне керування''' дозволяє вмикати або вимикати цю функцію.
    16  * '''Завантаження даних через API'''
    17  * '''Імпорт даних за посиланням'''
    18  * '''Завантаження шарів із фоном'''
    19  * '''Зміна виділення'''
    20  * '''Зміна положення поточного вікна мапи'''
    21  * '''Створення нових об’єктів'''
    22  * '''Отримання версії протоколу'''
    23 
    24 * '''Підтверджувати всі дії Дистанційного керування вручну'''
     16* **Включити  дистанційне керування** дозволяє вмикати або вимикати цю функцію.
     17 * **Завантаження даних через API**
     18 * **Імпорт даних за посиланням**
     19 * **Завантаження шарів із фоном**
     20 * **Зміна виділення**
     21 * **Зміна положення поточного вікна мапи**
     22 * **Створення нових об’єктів**
     23 * **Отримання версії протоколу**
     24
     25* **Підтверджувати всі дії Дистанційного керування вручну**
     26
     27== Перелік команд ==
     28=== {{{load_and_zoom}}} ===
     29Команда для завантаження в JOSM даних габаритного прямокутника через API, та масштабування завантаженої ділянки та, необов’язково, виділення одного чи кількох об’єктів.
     30{{{
     31GET /load_and_zoom?left=…&right=…&top=…&bottom=…&select=object[,object…]
     32}}}
     33де
     34||= **Параметр** =||= **Обов’язковий/необов’язковий** =||= **Опис** =||
     35|| `left` || R || мінімальна довгота ||
     36|| `right` || R || максимальна довгота ||
     37|| `bottom` || R || мінімальна широта ||
     38|| `top` || R || максимальна широта ||
     39|| `select` || O || розділений комами перелік об’єктів, які потрібно виділити. Об’єкти вказуються комбінацією слів "way", "node" або "relation" та числовим id. Example: {{{select=way38473,node12399,node54646}}} ||
     40|| `addtags` || O || необов’язковий параметр для додавання теґів. Ключі та значення відокремлюються знаком "=", а кілька теґів можуть бути розділені "|". Спробуйте цей [http://localhost:8111/load_and_zoom?addtags=wikipedia:de=Wei%C3%9Fe_Gasse|maxspeed=5&select=way23071688,way23076176,way23076177,&left=13.739727546842&right=13.740890970188&top=51.049987191025&bottom=51.048466954325 приклад]. Працює також із командою zoom. Користувачу потрібно спочатку переглянути теґи та виділення перед тим, як теґи будуть застосовані до виділених об’єктів. ||
     41|| `new_layer` || O || Якщо «істина», завантажити до нового шару ||
     42
     43==== Приклад ====
     44
     45Запустіть JOSM (не забудьте увімкнути Дистанційне керування), потім клацніть на:
     46
     47[http://127.0.0.1:8111/load_and_zoom?left=8.19&right=8.20&top=48.605&bottom=48.590&select=node413602999]
     48
     49JOSM повинен завантажити ділянку у німецькому Шварцвальді та виділити вказану точку.
     50
     51=== {{{zoom}}} ===
     52Instructs JOSM to zoom to the specified area and optionally select one or more objects.
     53{{{
     54GET /zoom?left=...&right=...&top=...&bottom=...&select=object[,object...]
     55}}}
     56Accepts the same parameters as the {{{load_and_zoom}}} command and uses the same code for zoom and selection. The only difference is that no data will be loaded from the API.
     57
     58**Hint**: This command can also be used to select objects only. Just enter a small arbitrary area to the left..bottom entries and add the object list to the select= option.
     59=== {{{import}}} ===
     60Instructs JOSM to download the specified OSM file and add it to the current data set.
     61{{{
     62GET /import?url=...
     63}}}
     64
     65
     66
     67=== {{{imagery}}} ===
     68Instructs JOSM to add an imagery (WMS/TMS) layer.
     69{{{
     70GET /imagery?title=...&type=...&url=...
     71}}}
     72where
     73||= **Parameter** =||= **Required/Optional** =||= **Meaning** =||
     74|| `title` || O || The display name of the layer ||
     75|| `type` || O || Type of the layer. Possible values are `wms` and `tms` [[BR]] (since !RemoteControl Version 1.3) ||
     76|| `url` || R || The Request URL, including patterns. Must be the last parameter, everything after "&url=" is interpreted as URL, even if it contains "&" characters.  ||
     77
     78==== Examples ====
     79* TMS layer "osm" {{{http://tile.openstreetmap.org/{zoom}/{x}/{y}.png}}}
     80
     81[http://localhost:8111/imagery?title=osm&type=tms&url=http://tile.openstreetmap.org/%7Bzoom%7D/%7Bx%7D/%7By%7D.png]
     82
     83* WMS layer "landsat" {{{http://irs.gis-lab.info/?layers=landsat&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox} }}}
     84[http://localhost:8111/imagery?title=landsat&type=wms&url=http://irs.gis-lab.info/?layers=landsat&SRS=%7Bproj%7D&WIDTH=%7Bwidth%7D&HEIGHT=%7Bheight%7D&BBOX=%7Bbbox%7D]
     85
     86=== {{{load_object}}} ===
     87
     88Instructs JOSM to download objects with a given id.
     89{{{
     90GET /load_object?new_layer=true|false&objects=...
     91}}}
     92where
     93||= **Parameter** =||= **Required/Optional** =||= **Meaning** =||
     94|| `objects` || R || Comma separated list of object ids, e.g. "{{{n1234,n1235,w84,r958493}}}" ||
     95|| `new_layer` || O || If true, downloads to a new layer ||
     96
     97==== Example ====
     98
     99[http://localhost:8111/load_object?new_layer=true&objects=w106159509]
     100
     101=== {{{add_node}}} ===
     102
     103Instructs JOSM to create a new node at the given coordinates.
     104
     105**Note**: This action requires the permission ''Create new objects'' which is disabled by default.
     106
     107{{{
     108GET /add_node?lon=...&lat=...
     109}}}
     110where
     111||= **Parameter** =||= **Required/Optional** =||= **Meaning** =||
     112|| `lon` || R || The longitude of the node ||
     113|| `lat` || R || The latitude of the node ||
     114
     115==== Example ====
     116http://localhost:8111/add_node?lon=13.3&lat=53.2
     117
     118=== {{{add_way}}} ===
     119
     120Instructs JOSM to create a new way with new way nodes at given coordinates.
     121
     122**Note**: This action requires the permission ''Create new objects'' which is disabled by default.
     123
     124{{{
     125GET /add_way?way=lat1,lon1;lat2,lon2;...
     126}}}
     127where
     128||= **Parameter** =||= **Required/Optional** =||= **Meaning** =||
     129|| `way` || R || Pairs of latitude, longitude coordinates separated by semicolon. ||
     130
     131==== Example ====
     132
     133http://localhost:8111/add_way?way=53.2,13.3;53.3,13.3;53.3,13.2
     134
     135
     136=== {{{version}}} ===
     137This command returns the current protocol version of the installed !RemoteControl interface. Developers can use it to query for a running instance of JOSM and also determine whether the requested functionality is available in the client.
     138{{{
     139GET /version[?jsonp=callback]
     140}}}
     141
     142The command returns a json object containing an application identifier that is always "JOSM !RemoteControl", a major number and a minor number. Compatible protocol changes result in an increase of the minor number. Incompatible changes increase the major number. So a client application knowing of protocol version 1.0 can still talk to JOSM having 1.1. But it's not guaranteed to be working with 2.0. So the client should verify the major number.
     143
     144A typical output looks like this:
     145{{{
     146#!js
     147{
     148   "protocolversion": {
     149      "major": 1,
     150      "minor": 0
     151   },
     152   "application": "JOSM RemoteControl"
     153}
     154}}}
     155For older browsers not implementing [http://en.wikipedia.org/wiki/Cross-Origin_Resource_Sharing Cross-Origin Resource Sharing (CORS)] the command provides the possibility for jsonp callback. Load the URL in a script tag and supply the name of a callback that will receive the JSON data.
     156
     157Following is some sample code that checks for CORS capabilities and uses [http://en.wikipedia.org/wiki/JSONP JSONP] as a fallback solution.
     158{{{
     159#!js
     160// in addition to the CC-BY-SA of the wiki feel free to use the following source for any purpose without restrictions (PD)
     161// credits and additions appreciated: http://wiki.openstreetmap.org/wiki/User:Stephankn
     162
     163function checkJOSM(version){
     164   alert(version.application + " uses protocol version " + version.protocolversion.major + "." + version.protocolversion.minor);
     165   // do something useful, maybe showing edit button
     166}
     167
     168var url = "http://127.0.0.1:8111/version";
     169var useFallback = false;
     170// currently FF3.5, Safari 4 and IE8 implement CORS
     171if (XMLHttpRequest) {
     172   var request = new XMLHttpRequest();
     173   if ("withCredentials" in request) {
     174      request.open('GET', url, true);
     175      request.onreadystatechange = function(){
     176         if (request.readyState != 4) {
     177            return;
     178         }
     179         if (request.status == 200) {
     180            checkJOSM(eval('(' + request.responseText + ')'));
     181         }
     182      };
     183      request.send();
     184   }
     185   else if (XDomainRequest) {
     186      var xdr = new XDomainRequest();
     187      xdr.open("get", url);
     188      xdr.onload = function(){
     189         checkJOSM(eval('(' + xdr.responseText + ')'));
     190      };
     191      xdr.send();
     192   } else {
     193      useFallback = true;
     194   }
     195}
     196else {
     197   // no XMLHttpRequest available
     198   useFallback = true;
     199}
     200
     201if (useFallback) {
     202   // Use legacy jsonp call
     203   var s = document.createElement('script');
     204   s.src = url + '?jsonp=checkJOSM';
     205   s.type = 'text/javascript';
     206   
     207   if (document.getElementsByTagName('head').length > 0) {
     208      document.getElementsByTagName('head')[0].appendChild(s);
     209   }
     210   
     211}
     212}}}
     213
     214=== Other commands ===
     215Remotecontrol allows other plugins to add additional commands. The other registers a RequestHandler class and specifies a command to be handled by this class. The command syntax has to be defined by the other plugin.
     216
     217Reverter plugin since version 27091 makes use of this feature.
    25218
    26219== Дивись також ==