ラベル ArcGIS の投稿を表示しています。 すべての投稿を表示
ラベル ArcGIS の投稿を表示しています。 すべての投稿を表示

2016年5月31日火曜日

2 - ol3.16ex 154b - Image ArcGIS MapServer 2

「arcgis-image.js(2154-ol3ex.js)」は、マップを表示するための JavaScript ファイルです。

「2154-ol3ex.js」
var url = 'http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/' +
 'Specialty/ESRI_StateCityHighway_USA/MapServer';
var layers = [
 new ol.layer.Tile({
 /** ol.layer.Tile
  * For layer sources that provide pre-rendered, tiled
  * images in grids that are organized by zoom levels
  * for specific resolutions.
  * プリレンダリング(事前描画)を提供するレイヤソースのため
  * の、特定の解像度でのズームレベルによって編成されているグ
  * リッドのタイルイメージ。(ol3 API)
  */
  source: new ol.source.MapQuest({layer: 'sat'})
  /** source:
   * Source for this layer. Required.(ol3 API)
   */
  /** ol.source.MapQuest
   * Layer source for the MapQuest tile server.
   * MapQuest タイルサーバのレイヤソース。(ol3 API
   * 2 - ol3ex 23b - MapQuest example 2 参照)
   */
 }),
 new ol.layer.Image({
 /** ol.layer.Image
  * Server-rendered images that are available for arbitrary
  * extents and resolutions.
  * 任意の範囲と解像度で利用可能なサーバで描画されたイメージ。
  * (ol3 API)
  */
  source: new ol.source.ImageArcGISRest({
  /** ol.source.ImageArcGISRest
   * Source for data from ArcGIS Rest services providing
   * single, untiled images. Useful when underlying map
   * service has labels.If underlying map service is not
   * using labels, take advantage of ol image caching and
   * use ol.source.TileArcGISRest data source.
   * 単一の、タイルでない画像を提供する ArcGIS RESTサービスから
   * のデータのソース。基本となるマップサービスがラベルを持って
   * いときに有用です。基本となるマップサービスがラベルを使用し
   * ていない場合、ol の画像キャッシュを利用して 
   * ol.source.TileArcGISRest データソースを使用します。
   * (ol3 API[説明は Stable Only のチェックを外すと表示])
   */
   params: {},
   /** params
    * ArcGIS Rest parameters. This field is optional.
    * Service defaults will be used for any fields not
    * specified. FORMAT is PNG32 by default. F is IMAGE
    * by default. TRANSPARENT is true by default. BBOX,
    * SIZE, BBOXSR, and IMAGESR will be set dynamically.
    * SetLAYERS` to override the default service layer
    * visibility. See http://resources.arcgis.com/en/
    * help/arcgis-rest-api/index.html#/Export_Map/
    * 02r3000000v7000000/ for further reference.
    * ArcGIS のレストパラメータ。このフィールドはオプションで
    * す。サービスのデフォルトは、指定されていないすべてのフィー
    * ルドに使用されます。 FORMATは、デフォルトで PNG32 です。 
    * F は、デフォルトでIMAGE です。 TRANSPARENTは、デフォルト
    * で true です。BBOX、SIZE、BBOXSR、および IMAGESR は動的に
    * 設定されます。デフォルトのサービスレイヤの可視性をオーバー
    * ライドするために LAYERS` を設定します。さらに参考のために 
    * http://resources.arcgis.com/en/help/arcgis-rest-api/
    * index.html#/Export_Map/02r3000000v7000000/ を参照してく
    * ださい。
    * (ol3 API[説明は Stable Only のチェックを外すと表示])
    */
   url: url
   /** url
    * ArcGIS Rest service URL for a Map Service or Image
    * Service. The url should include /MapServer or
    * /ImageServer.
    * Map Service または Image Service のための ArcGIS REST 
    * サービスの URL。url は /MapServer または /ImageServer 
    * を含める必要があります。
    * (ol3 API[説明は Stable Only のチェックを外すと表示])
    */
  })
 })
];
var map = new ol.Map({
 layers: layers,
 target: 'map',
 view: new ol.View({
  center: [-10997148, 4569099],
  zoom: 4
 })
});
 

2 - ol3.16ex 154a - Image ArcGIS MapServer 1

「Image ArcGIS MapServer (arcgis-image.html)」を参考に地図を表示してみます。
説明に次のようにあります。

This example shows how to use a dynamic ArcGIS REST MapService. This source type supports Map and Image Services. For dyamic ArcGIS services.
この例は、ダイナミック ArcGIS REST MapService の使用方法を示しています。このソースタイプは、マップ(Map Service)とイメージサービス(Image Service)をサポートします。ダイナミック ArcGIS サービス用です。


HTML ファイルの作成
a Eclipse のメニューの「ファイル」->「ファイルを開く」をクリックします。





b 「ファイルを開く」ウィンドウで、「user」->「mapsite」->「ol3proj」->「v3.16.0」->「examples」->「arcgis-image.html」をクリックして選択し、「OK」ボタンをクリックします。
同じように「arcgis-image.js」を開きます。





c メニューの「ファイル」->「新規」 -> 「ファイル」をクリックします。




d 「ファイル」ウィンドウで「ol3proj」をクリックして選択し、「ファイル名」を「2154-ol3ex.html」と入力し、「次へ」ボタンをクリックします。








e 「File Template」ウィンドウで「HTML 5 Template」をクリックして選択し、「OK」ボタンをクリックします。











f 「arcgis-image.html」の内容をコピーして「2154-ol3ex.html」に貼り付け、修正します。
g 同じように、新規に「2154-ol3ex.js」ファイルを作成し、「File Template」ウィンドウで「JavaScript Template」をクリックして選択し、「完了」ボタンをクリックして、「arcgis-image.js」の内容をコピーして貼り付け、修正します。「arcgis-image-require.js」も「2154-ol3ex-require.js」に貼り付けます。

「2154-ol3ex.html」
<!doctype html>
<html lang="en">
 <head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="chrome=1">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" type="text/css">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-combined.min.css" type="text/css">
  <!--
  <link rel="stylesheet" href="../css/ol.css" type="text/css">
  <link rel="stylesheet" href="./resources/layout.css" type="text/css">

  <link rel="stylesheet" href="./resources/prism/prism.css" type="text/css">
  <script src="./resources/zeroclipboard/ZeroClipboard.min.js"></script>
  
  「resources」の位置が変わりました。
  -->
  <!-- ディレクトリ修正 -->
  <link rel="stylesheet" href="v3.16.0/css/ol.css" type="text/css">
  <link rel="stylesheet" href="v3.16.0/examples/resources/layout.css" type="text/css">

  <link rel="stylesheet" href="v3.16.0/examples/resources/prism/prism.css" type="text/css">
  <script src="v3.16.0/examples/resources/zeroclipboard/ZeroClipboard.min.js"></script>
  <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch"></script>
  <title>Image ArcGIS MapServer</title>
 </head>
 <body>
  <!-- 
  bootstrap-combined.min.css, ol.css, layout.css,
  CSSファイルで設定されたセレクタを使用。
  -->
  <header class="navbar" role="navigation">
   <div class="container">
    <div class="display-table pull-left" id="navbar-logo-container">
    <!--
    <a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png"> OpenLayers 3 Examples</a>
    -->
    <!-- ディレクトリ修正 -->
    <a class="navbar-brand" href="v3.16.0/examples/"><img src="v3.16.0/examples/resources/logo-70x70.png"> OpenLayers 3 Examples</a>
    <!-- menu items that get hidden below 768px width -->
    <nav class='collapse navbar-collapse navbar-responsive-collapse'>
     <ul class="nav navbar-nav pull-right">
      <!-- <li><a href="../doc">Docs</a></li> -->
      <li><a href="v3.16.0/doc">Docs</a></li>
      <li><a class="active" href="index.html">Examples</a></li>
      <!-- <li><a href="../apidoc">Docs</a></li> -->
      <li><a href="v3.16.0/apidoc">API</a></li>
      <li><a href="https://github.com/openlayers/ol3">Code</a></li>
     </ul>
    </nav>
   </div>
  </header>
  <div class="container-fluid">
   <div id="latest-check" class="alert alert-warning alert-dismissible" role="alert" style="display:none">
    <button id="latest-dismiss" type="button" class="close" data-dismiss="alert" aria-label="Close">
     <span aria-hidden="true">&times;</span>
    </button>
     This example uses OpenLayers v<span>3.16.0</span>. 
     The <a id="latest-link" href="#" class="alert-link">latest</a>
     is v<span id="latest-version"></span>.
   <div class="row-fluid">
    <div class="span12">
     <h4 id="title">Image ArcGIS MapServer</h4>
     <div id="map" class="map"></div>
    </div>
   </div>
   <div class="row-fluid">
    <div class="span12">
     <p id="shortdesc">Example of an image ArcGIS 
     layer.</p>
     <div id="docs"><p>This example shows how to use a 
      dynamic ArcGIS REST MapService. This source type 
      supports Map and Image Services. For dyamic ArcGIS 
      services.</p>
     </div>
     <div id="api-links">Related API documentation: 
      <ul class="inline">
       <li>
        <!-- <a href="../apidoc/ol.Map.html" title="API documentation for ol.Map">ol.Map</a> -->
        <a href="v3.16.0/apidoc/apidoc/ol.Map.html" title="API documentation for ol.Map">ol.Map</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.View.html" title="API documentation for ol.View">ol.View</a> -->
        <a href="v3.16.0/apidoc/apidoc/ol.View.html" title="API documentation for ol.View">ol.View</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.layer.Tile.html" title="API documentation for ol.layer.Tile">ol.layer.Tile</a> -->
        <a href="v3.16.0/apidoc/apidoc/ol.layer.Tile.html" title="API documentation for ol.layer.Tile">ol.layer.Tile</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.layer.Image.html" title="API documentation for ol.layer.Image">ol.layer.Image</a> -->
        <a href="v3.16.0/apidoc/apidoc/ol.layer.Image.html" title="API documentation for ol.layer.Image">ol.layer.Image</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.source.MapQuest.html" title="API documentation for ol.source.MapQuest">ol.source.MapQuest</a> -->
        <a href="v3.16.0/apidoc/apidoc/ol.source.MapQuest.html" title="API documentation for ol.source.MapQuest">ol.source.MapQuest</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.source.ImageArcGISRest.html" title="API documentation for ol.source.ImageArcGISRest">ol.source.ImageArcGISRest</a> -->
        <a href="v3.16.0/apidoc/apidoc/ol.source.ImageArcGISRest.html" title="API documentation for ol.source.ImageArcGISRest">ol.source.ImageArcGISRest</a>
       </li>
       </ui>
      </div>
     </div>
    </div>
    <div class="row-fluid">
     <div id="source-controls">
      <a id="copy-button">
       <i class="fa fa-clipboard"></i> Copy
      </a>
      <a id="jsfiddle-button">
       <i class="fa fa-jsfiddle"></i> Edit
      </a>
     </div>
     <form method="POST" id="jsfiddle-form" target="_blank" action="http://jsfiddle.net/api/post/jquery/1.11.0/">
     <textarea class="hidden" name="js">
// --- 省略 ---
&lt;/html&gt;</code></pre>
   </div>
  </div>
  <!--
  <script src="./resources/common.js"></script>
  <script src="./resources/prism/prism.min.js"></script>
  -->
  <!-- ディレクトリ修正
   CommonJS と
   prism.js
 -->
  <script src="v3.16.0/examples/resources/common.js"></script>
  <script src="v3.16.0/examples/resources/prism/prism.min.js"></script>
  <!-- 
  <script src="loader.js?id=arcgis-image"></script>
  -->
  <!-- ファイル修正 -->  <!-- ディレクトリ修正 -->
  <script src="loader.js?id=2154-ol3ex"></script>
  </body>
 <script>
  var packageUrl = 'https://raw.githubusercontent.com/openlayers/openlayers.github.io/build/package.json';
  fetch(packageUrl).then(function(response) {
  /** GlobalFetch.fetch()(This is an experimental technology)
   * The fetch() method of the GlobalFetch interface 
   * starts the process of fetching a resource. This 
   * returns a promise that resolves to the Response 
   * object representing the response to your request.
   * GlobalFetch インタフェースの fetch() メソッドは、リソー
   * スを取得する処理を開始します。これは要求に対する応答を表す 
   * Response オブジェクトに解決のプロミス(promise)を返しま
   * す。
   *(MDN[https://developer.mozilla.org/ja/docs/Web/API/
   * FGlobalFetch/fetch])
   */
   return response.json();
   /** Response(This is an experimental technology)
    * The Response interface of the Fetch API represents 
    * the response to a request.
    * Fetch API の Response インタフェースは、要求に対する応答
    * を表します。
    * (MDN[https://developer.mozilla.org/en-US/docs/Web/
    * API/Response])
    */
   /** Body.json()(This is an experimental technology)
    * The json() method of the Body mixin takes a Response 
    * stream and reads it to completion. It returns a 
    * promise that resolves with an object literal 
    * containing the JSON data.
    * Body mixin の json() メソッドは、Response ストリームを
    * 受け取り、それを完了させるために読み込みます。これは、
    * JSON データを含むオブジェクトリテラルで解決する約束
    * (promisee)を返します。
    * (MDN[https://developer.mozilla.org/en-US/docs/Web/
    * API/Body/json])
    */
  }).then(function(json) {
   var latestVersion = json.version;
   document.getElementById('latest-version').innerHTML = latestVersion;
   var url = window.location.href;
   var branchSearch = url.match(/\/([^\/]*)\/examples\//);
   /** String.prototype.match()
    * 正規表現 に対する 文字列 のマッチングの際に、そのマッチ結
    * 果を得るために使われます。
    * (MDN[https://developer.mozilla.org/ja/docs/Web/
    * JavaScript/Reference/Global_Objects/String/match])
    */
   var cookieText = 'dismissed=-' + latestVersion + '-';
   var dismissed = document.cookie.indexOf(cookieText) != -1;
   /** String.prototype.indexOf()
    * 呼び出す String オブジェクト 中で、指定された値が最初に現
    * れたインデックスを返します。fromIndex から検索を始め、値が
    * 見つからない場合は -1 を返します。
    * (MDN[https://developer.mozilla.org/ja/docs/Web/
    * JavaScript/Reference/Global_Objects/String/indexOf])
    */
   if (!dismissed && /^v[0-9\.]*$/.test(branchSearch[1]) && '3.16.0' != latestVersion) {
    var link = url.replace(branchSearch[0], '/latest/examples/');
    /** Location.replace()
     * The Location.replace() method replaces the current 
     * resource with the one at the provided URL. The 
     * difference from the assign() method is that after 
     * using replace() the current page will not be saved 
     * in session History, meaning the user won't be able 
     * to use the back button to navigate to it.
     * 指定された URL に現在の文書を置き換えます。 assign() メ
     * ソッドとの違いは、replace() を用いた後、現在のページは、
     * セッションの履歴には保持されないことです。つまり、ユーザ
     * は、置き換え前のページに戻るために、戻るボタンを使うこと
     * ができません。
     * (MDN[https://developer.mozilla.org/en-US/docs/Web/
     * API/Location/replace])
     */
    fetch(link, {method: 'head'}).then(function(response) {
     var a = document.getElementById('latest-link');
     a.href = response.status == 200 ? link : '../../latest/examples/';
     /** Response.status(This is an experimental technology)
      * The status read-only property of the Response 
      * interface contains the status code of the response 
      * (e.g., 200 for a success).
      * Response インタフェースの status 読み取り専用プロパティ
      * は、応答のステータス・コード(例えば、成功のために200)
      * を含みます。
     * (MDN[https://developer.mozilla.org/en-US/docs/Web/
     * API/Response/status])
      */
    });
    var latestCheck = document.getElementById('latest-check');
    latestCheck.style.display = '';
    document.getElementById('latest-dismiss').onclick = function() {
     latestCheck.style.display = 'none';
     document.cookie = cookieText;
    }
   }
  });
 </script>
</html>


COMMONJS は

COMMONJS
http://webpack.github.io/docs/commonjs.html

に、次のようにあります。

The CommonJS group defined a module format to solve JavaScript scope issues by making sure each module is executed in its own namespace.
This is achieved by forcing modules to explicitly export those variables it wants to expose to the “universe”, and also by defining those other modules required to properly work.
To achieve this CommonJS give you two tools:
the require() function, which allows to import a given module into the current scope.
the module object, which allows to export something from the current scope.

CommonJSグループは、それ自身の名前空間内で実行されている各モジュールを確認することによって、JavaScriptのスコープ問題を解決するためのモジュールフォーマットを定義しました。
これは、それが「universe(?)」に公開したい変数を明示的にエクスポートするモジュールを強制することによって、同じように、正常に動作するのに必要な他のモジュールを定義することによって、達成されます。
この CommonJS を達成するために2つのツールを与えます:
require()関数、指定したモジュールを現在のスコープにインポートすることができます。
モジュールオブジェクト、現在のスコープからエクスポートすることができます。


Prism は、

Prism
http://prismjs.com/

に、次のようにあります。

Prism is a lightweight, extensible syntax highlighter, built with modern web standards in mind. It’s a spin-off from Dabblet and is tested there daily by thousands.
Prismは、最新のWeb標準に構築されたことを考慮し軽量で拡張可能なシンタックスハイライトです。それは Dabblet からスピンオフで、何千人も日々そこで試験されています。


ZeroClipboard は

ZeroClipboard v2.x
http://zeroclipboard.org/

に、次のようにあります。

The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie and a JavaScript interface.
ZeroClipboard ライブラリは、見えない Adobe Flash ムービーとJavaScript のインターフェイスを使用してテキストをクリップボードにコピーする簡単な方法を提供します。

Debian 8 では動作しませんでした。ボタンを右クリックしたときに flash のコンテキストメニューが表示されると動作しています。

2015年5月23日土曜日

2 - ol3.5ex 120b - esri ArcGIS REST Feature Service example with editing 2

「vector-esri-edit.js(2120-ol3ex.js)」は、マップを表示するための JavaScript ファイルです。

「2120-ol3ex.js」
var serviceUrl = 'http://services.arcgis.com/rOo16HdIMeOBI4Mb/arcgis/rest/' +
 'services/PDX_Pedestrian_Districts/FeatureServer/';
var layer = '0';
var esrijsonFormat = new ol.format.EsriJSON();
/** ol.format.EsriJSON
 * Feature format for reading and writing data in the 
 * EsriJSON format.
 * EsriJSON フォーマットデータの読み込みと書き込みのための
 * フィーチャフォーマット。(ol3 API)
 */
var vectorSource = new ol.source.Vector({
/** ol.source.Vector 
 * Provides a source of features for vector layers.
 * ベクタレイヤのフィーチャのソースを提供します。(ol3 API)
 */
 loader: function(extent, resolution, projection) {
  var url = serviceUrl + layer + '/query/?f=json&' +
   'returnGeometry=true&spatialRel=esriSpatialRelIntersects&geometry=' +
   encodeURIComponent('{"xmin":' + extent[0] + ',"ymin":' +
   extent[1] + ',"xmax":' + extent[2] + ',"ymax":' + extent[3] +
   ',"spatialReference":{"wkid":102100}}') +
   '&geometryType=esriGeometryEnvelope&inSR=102100&outFields=*' +
   '&outSR=102100';
  $.ajax({url: url, dataType: 'jsonp', success: function(response) {
  /** jQuery.ajax( url [, settings ] )
   * Perform an asynchronous HTTP (Ajax) request.
   * 非同期HTTP(Ajax)要求を実行します。
   * (jQuery[http://api.jquery.com/jQuery.ajax/])
   */
   if (response.error) {
    alert(response.error.message + '\n' +
     response.error.details.join('\n'));
   } else {
   // dataProjection will be read from document
   var features = esrijsonFormat.readFeatures(response, {
    /** readFeatures(source, opt_options)
     * Read all features from a EsriJSON source.
     *  Works with both Feature and FeatureCollection 
     * sources.
     * EsriJSON ソースからすべてのフィーチャを読み取ります。
     * フィーチャとフィーチャコレクションソースの両方で動作し
     * ます。
    * (ol3 API[説明は Stable Only のチェックを外すと表示])
     */
     featureProjection: projection
    });
    if (features.length > 0) {
     vectorSource.addFeatures(features);
     /** addFeatures(features)
      * Add a batch of features to the source.
      * フィーチャのバッチをソースに追加します。(ol3 API)
      */
    }
   }
  }});
 },
 strategy: ol.loadingstrategy.tile(new ol.tilegrid.XYZ({
 /** ol.loadingstrategy.tile(tileGrid)
  * Creates a strategy function for loading features 
  * based on a tile grid.
  * タイルグリッドに基づいて、ローディングフィーチャためのス
  * トラテジ関数を作成します。
  * (ol3 API[説明は Stable Only のチェックを外すと表示])
  */
 /** ol.tilegrid.XYZ
  * Set the grid pattern for sources accessing XYZ 
  * tiled-image servers.
  * XYZタイル画像サーバにアクセスするソースのグリッドパターン
  * を設定します。(ol3 API)
  */
  tileSize: 512
 }))
});
var vector = new ol.layer.Vector({
/** ol.layer.Vector
 * Vector data that is rendered client-side.
 * クライアント側で描画されたベクタデータ。(ol3 API)
 */
 source: vectorSource
});
var draw = new ol.interaction.Draw({
 /** ol.interaction.Draw 
  * Interaction that allows drawing geometries.
  * ジオメトリの描画を認めるインターラクション。(ol3 API)
  */
 source: vectorSource,
 type: /** @type {ol.geom.GeometryType} */ ('Polygon')
 /** @type 
  * 値のタイプ(型)の説明 - 式などで表示
  * (@use JSDoc[http://usejsdoc.org/]より)
  */
});
var select = new ol.interaction.Select();
/** ol.interaction.Select 
 * Handles selection of vector data. A 
 * ol.FeatureOverlay is maintained internally to 
 * store the selected feature(s). Which features 
 * are selected is determined by the condition 
 * option, and optionally the toggle or add/remove 
 * options.
 * ベクタデータの選択を処理します。 ol.FeatureOverlay 
 * は、選択したフィーチャを格納するために内部的に維持され
 * ています。選択されているどのフィーチャでも条件オプショ
 * ン、そして部分的にトグルまたは追加/削除オプションによっ
 * て決定されます。(ol3 API)
 */
select.setActive(false);
/** setActive(active)
 * Activate or deactivate the interaction.
 * インターラクションを有効または無効にします。
 * (ol3 API[説明は Stable Only のチェックを外すと表示])
 */
var selected = select.getFeatures();
/** getFeatures()
 * Get the selected features.
 * 選択されたフィーチャを取得します。
 * Return: Features collection(ol3 API)
 */
var modify = new ol.interaction.Modify({
/** ol.interaction.Modify 
 * Interaction for modifying vector data.
 * ベクタデータを変形するためのインタラクション。
 * (ol3 API)
 */
 features: selected
});
modify.setActive(false);
var typeSelect = document.getElementById('type');
/**
 * Let user change the interaction type.
 * @param {Event} e Change event.
 */
/** 「@param」
 * The @param tag provides the name, type, and 
 * description of a function parameter.
 * The @param tag requires you to specify the name of 
 * the parameter you are documenting. You can also 
 * include the parameter's type, enclosed in curly 
 * brackets, and a description of the parameter.
 * @paramタグは、関数パラメータの名前と型、説明を提供します。
 * @paramタグを使用すると、文書化されたパラメータの名前を
 * 指定する必要があります。また、パラメータのタイプと、中括弧
 * で囲まれたおよびパラメータの説明を含めることができます。
 * (@use JSDoc [http://usejsdoc.org/tags-param.html])
 */
typeSelect.onchange = function(e) {
/** GlobalEventHandlers.onchange()
 * The onchange property sets and returns the event handler 
 * for the change event.
 * onchange プロパティは、change イベントに対してイベントハ
 * ンドラを設定、および、返します。
 * (MDN[https://developer.mozilla.org/en-US/docs/Web/
 * API/GlobalEventHandlers/onchange])
 */
 draw.setActive(typeSelect.value === 'DRAW');
 select.setActive(typeSelect.value === 'MODIFY');
 modify.setActive(typeSelect.value === 'MODIFY');
};
var dirty = {};
selected.on('add', function(evt) {
/** on
 * Listen for a certain type of event.
 * あるタイプのイベントをリッスンします。(ol3 API)
 */
 var feature = evt.element;
 feature.on('change', function(evt) {
  dirty[evt.target.getId()] = true;
  /** getId()
   * Return: id(ol3 API)
   */
 });
});
selected.on('remove', function(evt) {
 var feature = evt.element;
 var fid = feature.getId();
 if (dirty[fid] === true) {
  var payload = '[' + esrijsonFormat.writeFeature(feature, {
  /** writeFeature(feature, opt_options)
   * Encode a feature as a EsriJSON Feature string.
   * EsriJSON フィーチャ文字列としてフィーチャをエンコード
   * (符号化)します。
   * (ol3 API[説明は Stable Only のチェックを外すと表示])
   */
   featureProjection: map.getView().getProjection()
   /** getView()
    * Get the view associated with this map. A view 
    * manages properties such as center and resolution.
    * このマップと関連するビューを取得します。ビューは、
    * 中心や解像度のような属性を管理します。
    * Return: The view that controls this map.(ol3 API)
    */
   /** getProjection()
    * Get the projection associated with the position.
    * 位置をともなった投影を取得します。(ol3 API)
    */
  }) + ']';
  var url = serviceUrl + layer + '/updateFeatures';
  $.post(url, { f: 'json', features: payload }).done(function(data) {
   /** jQuery.post( url [,data] [,success] [,dataType] )
    * Load data from the server using a HTTP POST request.
    * HTTP POST リクエストを使ってサーバからデータをロードします。
    * (jQUERY[http://api.jquery.com/jquery.post/])
    */
   /** deferred.done( doneCallbacks [, doneCallbacks ] )
    * Add handlers to be called when the Deferred object is 
    * resolved.
    * Deferred オブジェクトが resolve のとき呼び出されるハンド
    * ラを追加します。
    * (jQuery[http://api.jquery.com/deferred.done/])
    */
    var result = JSON.parse(data);
    /** JSON.parse()
     * JSON.parse() メソッドは文字列を JSON として解析し、また
     * 任意で解析によって作り出された値を変換します。
     * (MDN[https://developer.mozilla.org/ja/docs/Web/
     * JavaScript/Reference/Global_Objects/JSON/parse])
     */
    if (result.updateResults && result.updateResults.length > 0) {
    if (result.updateResults[0].success !== true) {
     var error = result.updateResults[0].error;
      alert(error.description + ' (' + error.code + ')');
    } else {
     delete dirty[fid];
    }
   }
  });
 }
});
draw.on('drawend', function(evt) {
 var feature = evt.feature;
 var payload = '[' + esrijsonFormat.writeFeature(feature, {
  featureProjection: map.getView().getProjection()
 }) + ']';
 var url = serviceUrl + layer + '/addFeatures';
 $.post(url, { f: 'json', features: payload }).done(function(data) {
  var result = JSON.parse(data);
  if (result.addResults && result.addResults.length > 0) {
   if (result.addResults[0].success === true) {
    feature.setId(result.addResults[0]['objectId']);
    /** setId()
     * Set a unique id for this feature. The id may be 
     * used to retrieve a feature from a vector source 
     * with the ol.source.Vector#getFeatureById method.
     * このフィーチャの一意のIDを設定します。 id は 
     * ol.source.Vector の getFeatureById メソッドによる
     * ベクタソースからフィーチャを取り出すために使用する
     * ことができます。(ol3 API)
     */
    vectorSource.clear();
    /** clear(opt_fast)
     * Remove all features from the source.
     * ソースからすべてのフィーチャを削除します。(ol3 API)
     */
   } else {
    var error = result.addResults[0].error;
    alert(error.description + ' (' + error.code + ')');
   }
  }
 });
});
var attribution = new ol.Attribution({
/** ol.Attribution
 * An attribution for a layer source.
 * レイヤソースの属性(ol3 API)
 */
 html: 'Tiles &copy; <a href="http://services.arcgisonline.com/ArcGIS/' +
  'rest/services/World_Topo_Map/MapServer">ArcGIS</a>'
});
var raster = new ol.layer.Tile({
/** ol.layer.Tile 
 * For layer sources that provide pre-rendered, tiled 
 * images in grids that are organized by zoom levels for 
 * specific resolutions. 
 * プリレンダリング(事前描画)を提供するレイヤソースのための、
 * 特定の解像度でのズームレベルによって編成されているグリッドの
 * タイルイメージ。(ol3 API)
 */
 source: new ol.source.XYZ({
 /** ol.source.XYZ
  * Layer source for tile data with URLs in a set XYZ 
  * format.
  * セットXYZ形式のURLを持つタイルデータのレイヤソース。
  * (ol3 API)
  */
  attributions: [attribution],
  url: 'http://server.arcgisonline.com/ArcGIS/rest/services/' +
   'World_Topo_Map/MapServer/tile/{z}/{y}/{x}'
 })
});
var map = new ol.Map({
 interactions: ol.interaction.defaults().extend([draw, select, modify]),
 /** ol.interaction.defaults
  * Set of interactions included in maps by default. 
  * Specific interactions can be excluded by setting 
  * the appropriate option to false in the constructor 
  * options, but the order of the interactions is fixed. 
  * If you want to specify a different order for 
  * interactions, you will need to create your own 
  * ol.interaction.Interaction instances and insert 
  * them into a ol.Collection in the order you want 
  * before creating your ol.Map instance.
  * デフォルトでマップに含まれるインターラクションのセット。
  * 具体的なインターラクションは、コンストラクタのオプションで
  * 適切なオプションをfalseに設定することで除外することができます
  * が、インターラクションの順番は固定されています。インターラク
  * ションに対して別の順番を指定したい場合は、独自の
  * ol.interaction.Interaction インスタンスを作成し、
  * ol.Map インスタンスを作成する前に、望む順番で 
  * ol.Collection にそれらを挿入する必要があります。(ol3 API)
  * new ol.interaction.DragRotateAndZoom()
  *(訳注:インターラクションの順番は、API を参照してください。)
  */
 layers: [raster, vector],
 target: document.getElementById('map'),
 view: new ol.View({
  center: ol.proj.transform([-122.619, 45.512], 'EPSG:4326', 'EPSG:3857'),
  /** ol.proj.transform(coordinate, source, destination)
   * Transforms a coordinate from source projection to 
   * destination projection. This returns a new coordinate 
   * (and does not modify the original).
   * ソース投影から変換先投影に座標変換します。これは、新しい座標
   * を返します(オリジナルを変更しません)。(ol3 API)
   */
  zoom: 12
 })
});

2 - ol3.5ex 120a - esri ArcGIS REST Feature Service example with editing 1

「esri ArcGIS REST Feature Service example with editing (vector-esri-edit.html)」を参考に地図を表示してみます。
説明に次のようにあります。

This example loads features from ArcGIS REST Feature Service and allows to add new features or update existing features.
この例は、ArcGIS REST フィーチャサービス空フィーチャをロードし、新しいフィーチャを追加およびすでにあるフィーチャを更新することを許可します。


HTML ファイルの作成
a Eclipse のメニューの「ファイル」->「ファイルを開く」をクリックします。





b 「ファイルを開く」ウィンドウで、「user」->「mapsite」->「ol3proj」->「v3.5.0」->「examples」->「vector-esri-edit.html」をクリックして選択し、「OK」ボタンをクリックします。
同じように「vector-esri-edit.js」を開きます。





c メニューの「ファイル」->「新規」 -> 「ファイル」をクリックします。



d 「ファイル」ウィンドウで「ol3proj」をクリックして選択し、「ファイル名」を「2120-ol3ex.html」と入力し、「次へ」ボタンをクリックします。








e 「File Template」ウィンドウで「HTML 5 Template」をクリックして選択し、「OK」ボタンをクリックします。











f 「vector-esri-edit.html」の内容をコピーして「2120-ol3ex.html」に貼り付け、修正します。
g 同じように、新規に「2120-ol3ex.js」ファイルを作成し、「File Template」ウィンドウで「JavaScript Template」をクリックして選択し、「完了」ボタンをクリックして、「vector-esri-edit.js」の内容をコピーして貼り付け、修正します。「vector-esri-edit-require.js」も「2120-ol3ex-require.js」に貼り付けます。

「2120-ol3ex.html」
<!doctype html>
<html lang="en">
 <head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="chrome=1">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" type="text/css">
  <!--
  <link rel="stylesheet" href="../css/ol.css" type="text/css">
  <link rel="stylesheet" href="./resources/layout.css" type="text/css">

  <link rel="stylesheet" href="./resources/prism/prism.css" type="text/css">
  <script src="./resources/zeroclipboard/ZeroClipboard.min.js"></script>
  「resources」の位置が変わりました。
  -->
  <!-- ディレクトリ修正 -->
  <link rel="stylesheet" href="v3.5.0/css/ol.css" type="text/css">
  <link rel="stylesheet" href="v3.5.0/examples/resources/layout.css" type="text/css">

  <link rel="stylesheet" href="v3.5.0/examples/resources/prism/prism.css" type="text/css">
  <script src="v3.5.0/examples/resources/zeroclipboard/ZeroClipboard.min.js"></script>
  <title>esri ArcGIS REST Feature Service example
   with editing</title>
 </head>
 <body>
  <!-- 
  bootstrap-combined.min.css, ol.css, layout.css
  CSSファイルで設定されたセレクタを使用。
  -->
  <div class="navbar navbar-inverse navbar-fixed-top">
   <div class="navbar-inner">
    <div class="container">
     <!--
     <a class="brand" href="./"><img src="./resources/logo-70x70.png"> OpenLayers 3 Examples</a>
     -->
     <!-- ディレクトリ修正 -->
     <a class="brand" href="v3.5.0/examples/"><img src="v3.5.0/examples/resources/logo-70x70.png"> OpenLayers 3 Examples</a>
    </div>
   </div>
  </div>
  <div class="container-fluid">
   <div class="row-fluid">
    <div class="span12">
     <div id="map" class="map"></div>
     <form class="form-inline">
      <label>Draw or modify &nbsp;</label>
      <select id="type">
       <option value="DRAW">Draw</option>
       <option value="MODIFY">Modify</option>
      </select>
     </form>
    </div>
   </div>
   <div class="row-fluid">
    <div class="span12">
     <h4 id="title">esri ArcGIS REST Feature Service example
      with editing</h4>
     <p id="shortdesc">Example of using an ArcGIS REST 
      Feature Service in an editing application.</p>
     <div id="docs">
      <p>This example loads new features from ArcGIS 
       REST Feature Service and allows to add new features 
       or update existing features.
       </p>
     </div>
     <div id="tags">vector, esri, ArcGIS, REST, Feature, 
     Service, bbox, loading, server, edit, updateFeature, 
     addFeature</div>
     <div id="api-links">Related API documentation: 
      <ul class="inline">
       <li>
        <!--<a href="../apidoc/ol.Attribution.html" title="API documentation for ol.Attribution">ol.Attribution>/a> -->
        <a href="v3.5.0/apidoc/ol.Attribution.html" title="API documentation for ol.Attribution">ol.Attribution</a>
       </li>,
       <li>
        <!--<a href="../apidoc/ol.Map.html" title="API documentation for ol.Map">ol.Map>/a> -->
        <a href="v3.5.0/apidoc/ol.Map.html" title="API documentation for ol.Map">ol.Map</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.View.html" title="API documentation for ol.View">ol.View>/a> -->
        <a href="v3.5.0/apidoc/ol.View.html" title="API documentation for ol.View">ol.View</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.format.EsriJSON.html" title="API documentation for ol.format.EsriJSON">ol.format.EsriJSON>/a> -->
        <a href="v3.5.0/apidoc/ol.format.EsriJSON.html" title="API documentation for ol.format.EsriJSON">ol.format.EsriJSON</a>
       </li>,
        <!-- <a href="../apidoc/ol.interaction.html" title="API documentation for ol.interaction">ol.interaction>/a> -->
        <a href="v3.5.0/apidoc/ol.interaction.html" title="API documentation for ol.interaction">ol.interaction</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.interaction.Draw.html" title="API documentation for ol.interaction.Draw">ol.interaction.Draw>/a> -->
        <a href="v3.5.0/apidoc/ol.interaction.Draw.html" title="API documentation for ol.interaction.Draw">ol.interaction.Draw</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.interaction.Modify.html" title="API documentation for ol.interaction.Modify">ol.interaction.Modify>/a> -->
        <a href="v3.5.0/apidoc/ol.interaction.Modify.html" title="API documentation for ol.interaction.Modify">ol.interaction.Modify</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.interaction.Select.html" title="API documentation for ol.interaction.Select">ol.interaction.Select>/a> -->
        <a href="v3.5.0/apidoc/ol.interaction.Select.html" title="API documentation for ol.interaction.Select">ol.interaction.Select</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.layer.Tile.html" title="API documentation for ol.layer.Tile">ol.layer.Tile>/a> -->
        <a href="v3.5.0/apidoc/ol.layer.Tile.html" title="API documentation for ol.layer.Tile">ol.layer.Tile</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.layer.Vector.html" title="API documentation for ol.layer.Vector">ol.layer.Vector>/a> -->
        <a href="v3.5.0/apidoc/ol.layer.Vector.html" title="API documentation for ol.layer.Vector">ol.layer.Vector</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.loadingstrategy.html" title="API documentation for ol.loadingstrategy">ol.loadingstrategy</a> -->
        <a href="v3.5.0/apidoc/ol.loadingstrategy.html" title="API documentation for ol.loadingstrategy">ol.loadingstrategy</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.proj.html" title="API documentation for ol.proj">ol.proj</a> -->
        <a href="v3.5.0/apidoc/ol.proj.html" title="API documentation for ol.proj">ol.proj</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.source.Vector.html" title="API documentation for ol.source.Vector">ol.source.Vector</a> -->
        <a href="v3.5.0/apidoc/ol.source.Vector.html" title="API documentation for ol.source.Vector">ol.source.Vector</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.source.XYZ.html" title="API documentation for ol.source.XYZ">ol.source.XYZ</a> -->
        <a href="v3.5.0/apidoc/ol.source.XYZ.html" title="API documentation for ol.source.XYZ">ol.source.XYZ</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.tilegrid.XYZ.html" title="API documentation for ol.tilegrid.XYZ">ol.tilegrid.XYZ</a> -->
        <a href="v3.5.0/apidoc/ol.tilegrid.XYZ.html" title="API documentation for ol.tilegrid.XYZ">ol.tilegrid.XYZ</a>
       </li>
      </ui>
     </div>
   </div>
  </div>
  <div class="row-fluid">
   <hr>
   <form method="POST" target="_blank" action="http://jsfiddle.net/api/post/jquery/1.11.0/">
    <input type="button" class="btn btn-info" id="copy-button" value="Copy example code">
    <input type="submit" class="btn btn-primary" id="jsfiddle-button" value="Create JSFiddle">
    <textarea class="hidden" name="js">
// --- 省略 ---
&lt;/html&gt;</code></pre>
    </div>
   </div>
  </div>
  <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js"></script>
  <!--
  <script src="./resources/common.js"></script>
  <script src="./resources/prism/prism.min.js"></script>
  -->
  <!-- ディレクトリ修正
   CommonJS と
   prism.js
 -->
  <script src="v3.5.0/examples/resources/common.js"></script>
  <script src="v3.5.0/examples/resources/prism/prism.min.js"></script>
  <!-- 
  <script src="loader.js?id=vector-esri-edit"></script>
  -->
  <!-- ファイル修正 -->  <!-- ディレクトリ修正 -->
  <script src="loader.js?id=2120-ol3ex"></script>
  </body>
</html>


COMMONJS は

COMMONJS
http://webpack.github.io/docs/commonjs.html

に、次のようにあります。

The CommonJS group defined a module format to solve JavaScript scope issues by making sure each module is executed in its own namespace.
This is achieved by forcing modules to explicitly export those variables it wants to expose to the “universe”, and also by defining those other modules required to properly work.
To achieve this CommonJS give you two tools:
the require() function, which allows to import a given module into the current scope.
the module object, which allows to export something from the current scope.

CommonJSグループは、それ自身の名前空間内で実行されている各モジュールを確認することによって、JavaScriptのスコープ問題を解決するためのモジュールフォーマットを定義しました。
これは、それが「universe(?)」に公開したい変数を明示的にエクスポートするモジュールを強制することによって、同じように、正常に動作するのに必要な他のモジュールを定義することによって、達成されます。
この CommonJS を達成するために2つのツールを与えます:
require()関数、指定したモジュールを現在のスコープにインポートすることができます。
モジュールオブジェクト、現在のスコープからエクスポートすることができます。


Prism は、

Prism
http://prismjs.com/

に、次のようにあります。

Prism is a lightweight, extensible syntax highlighter, built with modern web standards in mind. It’s a spin-off from Dabblet and is tested there daily by thousands.
Prismは、最新のWeb標準に構築されたことを考慮し軽量で拡張可能なシンタックスハイライトです。それは Dabblet からスピンオフで、何千人も日々そこで試験されています。


ZeroClipboard は

ZeroClipboard v2.x
http://zeroclipboard.org/

に、次のようにあります。

The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie and a JavaScript interface.
ZeroClipboard ライブラリは、見えない Adobe Flash ムービーとJavaScript のインターフェイスを使用してテキストをクリップボードにコピーする簡単な方法を提供します。

Debian 8 では動作しませんでした。ボタンを右クリックしたときに flash のコンテキストメニューが表示されると動作しています。

2 - ol3.5ex 119b - esri ArcGIS REST Feature Service example 2

「vector-esri.js(2119-ol3ex.js)」は、マップを表示するための JavaScript ファイルです。

「2119-ol3ex.js」
var serviceUrl = 'http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/' +
 'Petroleum/KSFields/FeatureServer/';
var layer = '0';
var esrijsonFormat = new ol.format.EsriJSON();
/** ol.format.EsriJSON
 * Feature format for reading and writing data in the 
 * EsriJSON format.
 * EsriJSON フォーマットデータの読み込みと書き込みのための
 * フィーチャフォーマット。(ol3 API)
 */
var styleCache = {
 'ABANDONED': [
  new ol.style.Style({
  /** ol.style.Style 
   * Base class for vector feature rendering styles.
   * ベクタフィーチャがスタイルを描画するための基本クラス。
   * (ol3 API)
   */
   fill: new ol.style.Fill({
   /** ol.style.Fill 
    * Set fill style for vector features.
    * ベクタフィーチャの塗りつぶしスタイルを設定。(ol3 API)
    */
    color: 'rgba(225, 225, 225, 255)'
   }),
   stroke: new ol.style.Stroke({
   /** ol.style.Stroke 
    * Set stroke style for vector features. 
    * Note that the defaults given are the Canvas defaults, 
    * which will be used if option is not defined. 
    * The get functions return whatever was entered 
    * in the options;  they will not return the default.
    * ベクタフィーチャのためのストロークスタイルの設定。
    * デフォルトは、オプションが定義されていない場合に使用され
    * る Canvas のデフォルトを与えられることに注意してください。
    * GET関数は、オプションで入力されたものはすべて返します。
    * それらはデフォルトを返しません。(ol3 API)
    */
    color: 'rgba(0, 0, 0, 255)',
    width: 0.4
   })
  })
 ],
 'GAS': [
  new ol.style.Style({
   fill: new ol.style.Fill({
    color: 'rgba(255, 0, 0, 255)'
   }),
   stroke: new ol.style.Stroke({
    color: 'rgba(110, 110, 110, 255)',
    width: 0.4
   })
  })
 ],
 'OIL': [
  new ol.style.Style({
   fill: new ol.style.Fill({
    color: 'rgba(56, 168, 0, 255)'
   }),
   stroke: new ol.style.Stroke({
    color: 'rgba(110, 110, 110, 255)',
    width: 0
   })
  })
 ],
 'OILGAS': [
  new ol.style.Style({
   fill: new ol.style.Fill({
    color: 'rgba(168, 112, 0, 255)'
   }),
   stroke: new ol.style.Stroke({
    color: 'rgba(110, 110, 110, 255)',
    width: 0.4
   })
  })
 ]
};
var vectorSource = new ol.source.Vector({
/*: ol.source.Vector 
 * Provides a source of features for vector layers.
 * ベクタレイヤのフィーチャのソースを提供します。(ol3 API)
 */
 loader: function(extent, resolution, projection) {
  var url = serviceUrl + layer + '/query/?f=json&' +
   'returnGeometry=true&spatialRel=esriSpatialRelIntersects&geometry=' +
   encodeURIComponent('{"xmin":' + extent[0] + ',"ymin":' +
   extent[1] + ',"xmax":' + extent[2] + ',"ymax":' + extent[3] +
   ',"spatialReference":{"wkid":102100}}') +
   '&geometryType=esriGeometryEnvelope&inSR=102100&outFields=*' +
   '&outSR=102100';
  $.ajax({url: url, dataType: 'jsonp', success: function(response) {
  /** jQuery.ajax( url [, settings ] )
   * Perform an asynchronous HTTP (Ajax) request.
   * 非同期HTTP(Ajax)要求を実行します。
   * (jQuery[http://api.jquery.com/jQuery.ajax/])
   */
   if (response.error) {
    alert(response.error.message + '\n' +
     response.error.details.join('\n'));
   } else {
    // dataProjection will be read from document
    var features = esrijsonFormat.readFeatures(response, {
    /** readFeatures(source, opt_options)
     * Read all features from a EsriJSON source.
     *  Works with both Feature and FeatureCollection 
     * sources.
     * EsriJSON ソースからすべてのフィーチャを読み取ります。
     * フィーチャとフィーチャコレクションソースの両方で動作し
     * ます。
    * (ol3 API[説明は Stable Only のチェックを外すと表示])
     */
     featureProjection: projection
    });
    if (features.length > 0) {
     vectorSource.addFeatures(features);
     /** addFeatures(features)
      * Add a batch of features to the source.
      * フィーチャのバッチをソースに追加します。(ol3 API)
      */
    }
   }
  }});
 },
 strategy: ol.loadingstrategy.tile(new ol.tilegrid.XYZ({
 /** ol.loadingstrategy.tile(tileGrid)
  * Creates a strategy function for loading features 
  * based on a tile grid.
  * タイルグリッドに基づいて、ローディングフィーチャためのス
  * トラテジ関数を作成します。
  * (ol3 API[説明は Stable Only のチェックを外すと表示])
  */
 /** ol.tilegrid.XYZ
  * Set the grid pattern for sources accessing XYZ 
  * tiled-image servers.
  * XYZタイル画像サーバにアクセスするソースのグリッドパターン
  * を設定します。(ol3 API)
  */
  tileSize: 512
  }))
});
var vector = new ol.layer.Vector({
/** ol.layer.Vector
 * Vector data that is rendered client-side.
 * クライアント側で描画されたベクタデータ。(ol3 API)
 */
 source: vectorSource,
 style: function(feature, resolution) {
  var classify = feature.get('activeprod');
  /** get(key)
   * Gets a value.(ol3 API)
   */
  return styleCache[classify];
 }
});
var attribution = new ol.Attribution({
/** ol.Attribution
 * An attribution for a layer source.
 * レイヤソースの属性(ol3 API)
 */
 html: 'Tiles &copy; <a href="http://services.arcgisonline.com/ArcGIS/' +
  'rest/services/World_Topo_Map/MapServer">ArcGIS</a>'
});
var raster = new ol.layer.Tile({
/** ol.layer.Tile 
 * For layer sources that provide pre-rendered, tiled 
 * images in grids that are organized by zoom levels for 
 * specific resolutions. 
 * プリレンダリング(事前描画)を提供するレイヤソースのための、
 * 特定の解像度でのズームレベルによって編成されているグリッドの
 * タイルイメージ。(ol3 API)
 */
 source: new ol.source.XYZ({
 /** ol.source.XYZ
  * Layer source for tile data with URLs in a set XYZ 
  * format.
  * セットXYZ形式のURLを持つタイルデータのレイヤソース。
  * (ol3 API)
  */
  attributions: [attribution],
  url: 'http://server.arcgisonline.com/ArcGIS/rest/services/' +
   'World_Topo_Map/MapServer/tile/{z}/{y}/{x}'
 })
});
var map = new ol.Map({
 layers: [raster, vector],
 target: document.getElementById('map'),
 view: new ol.View({
  center: ol.proj.transform([-97.6114, 38.8403], 'EPSG:4326', 'EPSG:3857'),
  /** ol.proj.transform(coordinate, source, destination)
   * Transforms a coordinate from source projection to 
   * destination projection. This returns a new coordinate 
   * (and does not modify the original).
   * ソース投影から変換先投影に座標変換します。これは、新しい座標
   * を返します(オリジナルを変更しません)。(ol3 API)
   */
  zoom: 7
 })
});
var displayFeatureInfo = function(pixel) {
 var features = [];
 map.forEachFeatureAtPixel(pixel, function(feature, layer) {
 /** forEachFeatureAtPixel
  * Detect features that intersect a pixel on the viewport, 
  * and execute a callback with each intersecting feature. 
  * Layers included in the detection can be configured 
  * through opt_layerFilter. Feature overlays will always 
  * be included in the detection.
  * ビューポート上のピクセルと交差するフィーチャを検出し、
  * 各交差するフィーチャとコールバックを実行します。
  * 検出に含まれるレイヤが opt_layerFilter を通じて
  * 設定することができます。フィーチャーオーバーレイは
  * 常に検出に含まれます。(ol3 API)
  */
  features.push(feature);
  /** push(elem)
   * Insert the provided element at the end of the 
   * collection.
   * コレクションの最後に供給されたエレメントに挿入します。
   * Name: elem, Type: T, Description: Element
   * (ol3 API)
   */
 });
 if (features.length > 0) {
  var info = [];
  var i, ii;
  for (i = 0, ii = features.length; i < ii; ++i) {
   info.push(features[i].get('field_name'));
   /** Array.push
    * 与えられた要素を追加することによって配列を変異させ、
    * その配列の新しい長さを返します。
    * (MDN [https://developer.mozilla.org/ja/docs/Web/
    * JavaScript/Reference/Global_Objects/Array/push])
    */
  }
  document.getElementById('info').innerHTML = info.join(', ') || '(unknown)';
  /** element.innerHTML
   * innerHTML は、与えられた要素に含まれる全てのマークアップ
   * と内容を設定または取得します。
   * (MDN[https://developer.mozilla.org/ja/docs/Web/
   * API/element.innerHTML])
   */
  /** Array.join
   * 配列の全ての要素を繋いで文字列にします。
   * (MDN [https://developer.mozilla.org/ja/docs/Web/
   * JavaScript/Reference/Global_Objects/Array/join])
   */
  map.getTarget().style.cursor = 'pointer';
  /** getTarget()
   * Get the target in which this map is rendered. 
   * Note that this returns what is entered as an option or  
   * in setTarget: if that was an element, it returns an 
   * element; if a string, it returns that.
   * レンダリングされたこのマップのターゲットを取得します。
   * これはオプションとして、または setTarget に入力されている
   * ものを返すことに注意してください:それが要素ならば、要素
   * を返します。文字列ならば、それを返します。(ol3 API)
   */
 } else {
  document.getElementById('info').innerHTML = '&nbsp;';
  map.getTarget().style.cursor = '';
 }
};
map.on('pointermove', function(evt) {
/** on
 * Listen for a certain type of event.
 * あるタイプのイベントをリッスンします。(ol3 API)
 */
/** pointermove
 * Triggered when a pointer is moved. Note that on 
 * touch devices this is triggered when the map is 
 * panned, so is not the same as mousemove.
 * ポインタが移動されたときにトリガされます。タッチデバイス
 * で、マップがパンされるときにこれはトリガーされ、 mousemove 
 * と同じではないことに注意してください。
 * (ol3 API)
 */
 if (evt.dragging) {
  return;
 }
 var pixel = map.getEventPixel(evt.originalEvent);
 /** getEventPixel()
  * Returns the map pixel position for a browser event.
  * ブラウザイベントに対して、マップのピクセル位置を返します。
  * (ol3 API)
  */
 displayFeatureInfo(pixel);
});
map.on('click', function(evt) {
 displayFeatureInfo(evt.pixel);
});
 

2 - ol3.5ex 119a - esri ArcGIS REST Feature Service example 1

「esri ArcGIS REST Feature Service example (vector-esri.html)」を参考に地図を表示してみます。
説明に次のようにあります。

This example loads new features from ArcGIS REST Feature Service when the view extent changes.
この例では、ArcGIS REST フィーチャサービス時に、ビュー·エクステントの変更から新しいフィーチャをロードします。


HTML ファイルの作成
a Eclipse のメニューの「ファイル」->「ファイルを開く」をクリックします。





b 「ファイルを開く」ウィンドウで、「user」->「mapsite」->「ol3proj」->「v3.5.0」->「examples」->「vector-esri.html」をクリックして選択し、「OK」ボタンをクリックします。
同じように「vector-esri.js」を開きます。





c メニューの「ファイル」->「新規」 -> 「ファイル」をクリックします。



d 「ファイル」ウィンドウで「ol3proj」をクリックして選択し、「ファイル名」を「2119-ol3ex.html」と入力し、「次へ」ボタンをクリックします。








e 「File Template」ウィンドウで「HTML 5 Template」をクリックして選択し、「OK」ボタンをクリックします。











f 「vector-esri.html」の内容をコピーして「2119-ol3ex.html」に貼り付け、修正します。
g 同じように、新規に「2119-ol3ex.js」ファイルを作成し、「File Template」ウィンドウで「JavaScript Template」をクリックして選択し、「完了」ボタンをクリックして、「vector-esri.js」の内容をコピーして貼り付け、修正します。「vector-esri-require.js」も「2119-ol3ex-require.js」に貼り付けます。

「2119-ol3ex.html」
<!doctype html>
<html lang="en">
 <head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="chrome=1">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" type="text/css">
  <!--
  <link rel="stylesheet" href="../css/ol.css" type="text/css">
  <link rel="stylesheet" href="./resources/layout.css" type="text/css">

  <link rel="stylesheet" href="./resources/prism/prism.css" type="text/css">
  <script src="./resources/zeroclipboard/ZeroClipboard.min.js"></script>
  「resources」の位置が変わりました。
  -->
  <!-- ディレクトリ修正 -->
  <link rel="stylesheet" href="v3.5.0/css/ol.css" type="text/css">
  <link rel="stylesheet" href="v3.5.0/examples/resources/layout.css" type="text/css">

  <link rel="stylesheet" href="v3.5.0/examples/resources/prism/prism.css" type="text/css">
  <script src="v3.5.0/examples/resources/zeroclipboard/ZeroClipboard.min.js"></script>
  <title>esri ArcGIS REST Feature Service example</title>
 </head>
 <body>
  <!-- 
  bootstrap-combined.min.css, ol.css, layout.css,
  CSSファイルで設定されたセレクタを使用。
  -->
  <div class="navbar navbar-inverse navbar-fixed-top">
   <div class="navbar-inner">
    <div class="container">
     <!--
     <a class="brand" href="./"><img src="./resources/logo-70x70.png"> OpenLayers 3 Examples</a>
     -->
     <!-- ディレクトリ修正 -->
     <a class="brand" href="v3.5.0/examples/"><img src="v3.5.0/examples/resources/logo-70x70.png"> OpenLayers 3 Examples</a>
    </div>
   </div>
  </div>
  <div class="container-fluid">
   <div class="row-fluid">
    <div class="span12">
     <div id="map" class="map"></div>
     <div class="span4 offset4 pull-right">
      <div id="info" class="alert alert-success">
       &nbsp;
      </div>
     </div>
    </div>
   </div>
   <div class="row-fluid">
    <div class="span12">
     <h4 id="title">esri ArcGIS REST Feature Service example</h4>
     <p id="shortdesc">Example of using an ArcGIS REST 
      Feature Service with a BBOX strategy. </p>
     <div id="docs">
      <p>This example loads new features from ArcGIS 
       REST Feature Service when the view extent changes. 
       </p>
     </div>
     <div id="tags">vector, esri, ArcGIS, REST, Feature, 
     Service, bbox, loading, server</div>
     <div id="api-links">Related API documentation: 
      <ul class="inline">
       <li>
        <!--<a href="../apidoc/ol.Attribution.html" title="API documentation for ol.Attribution">ol.Attribution>/a> -->
        <a href="v3.5.0/apidoc/ol.Attribution.html" title="API documentation for ol.Attribution">ol.Attribution</a>
       </li>,
       <li>
        <!--<a href="../apidoc/ol.Map.html" title="API documentation for ol.Map">ol.Map>/a> -->
        <a href="v3.5.0/apidoc/ol.Map.html" title="API documentation for ol.Map">ol.Map</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.View.html" title="API documentation for ol.View">ol.View>/a> -->
        <a href="v3.5.0/apidoc/ol.View.html" title="API documentation for ol.View">ol.View</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.format.EsriJSON.html" title="API documentation for ol.format.EsriJSON">ol.format.EsriJSON>/a> -->
        <a href="v3.5.0/apidoc/ol.format.EsriJSON.html" title="API documentation for ol.format.EsriJSON">ol.format.EsriJSON</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.layer.Tile.html" title="API documentation for ol.layer.Tile">ol.layer.Tile>/a> -->
        <a href="v3.5.0/apidoc/ol.layer.Tile.html" title="API documentation for ol.layer.Tile">ol.layer.Tile</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.layer.Vector.html" title="API documentation for ol.layer.Vector">ol.layer.Vector>/a> -->
        <a href="v3.5.0/apidoc/ol.layer.Vector.html" title="API documentation for ol.layer.Vector">ol.layer.Vector</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.loadingstrategy.html" title="API documentation for ol.loadingstrategy">ol.loadingstrategy</a> -->
        <a href="v3.5.0/apidoc/ol.loadingstrategy.html" title="API documentation for ol.loadingstrategy">ol.loadingstrategy</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.proj.html" title="API documentation for ol.proj">ol.proj</a> -->
        <a href="v3.5.0/apidoc/ol.proj.html" title="API documentation for ol.proj">ol.proj</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.source.Vector.html" title="API documentation for ol.source.Vector">ol.source.Vector</a> -->
        <a href="v3.5.0/apidoc/ol.source.Vector.html" title="API documentation for ol.source.Vector">ol.source.Vector</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.source.XYZ.html" title="API documentation for ol.source.XYZ">ol.source.XYZ</a> -->
        <a href="v3.5.0/apidoc/ol.source.XYZ.html" title="API documentation for ol.source.XYZ">ol.source.XYZ</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.style.Fill.html" title="API documentation for ol.style.Fill">ol.style.Fill</a> -->
        <a href="v3.5.0/apidoc/ol.style.Fill.html" title="API documentation for ol.style.Fill">ol.style.Fill</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.style.Stroke.html" title="API documentation for ol.style.Stroke">ol.style.Stroke</a> -->
        <a href="v3.5.0/apidoc/ol.style.Stroke.html" title="API documentation for ol.style.Stroke">ol.style.Stroke</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.style.Style.html" title="API documentation for ol.style.Style">ol.style.Style</a> -->
        <a href="v3.5.0/apidoc/ol.style.Style.html" title="API documentation for ol.style.Style">ol.style.Style</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.tilegrid.XYZ.html" title="API documentation for ol.tilegrid.XYZ">ol.tilegrid.XYZ</a> -->
        <a href="v3.5.0/apidoc/ol.tilegrid.XYZ.html" title="API documentation for ol.tilegrid.XYZ">ol.tilegrid.XYZ</a>
       </li>
      </ui>
     </div>
   </div>
  </div>
  <div class="row-fluid">
   <hr>
   <form method="POST" target="_blank" action="http://jsfiddle.net/api/post/jquery/1.11.0/">
    <input type="button" class="btn btn-info" id="copy-button" value="Copy example code">
    <input type="submit" class="btn btn-primary" id="jsfiddle-button" value="Create JSFiddle">
    <textarea class="hidden" name="js">
// --- 省略 ---
&lt;/html&gt;</code></pre>
    </div>
   </div>
  </div>
  <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js"></script>
  <!--
  <script src="./resources/common.js"></script>
  <script src="./resources/prism/prism.min.js"></script>
  -->
  <!-- ディレクトリ修正
   CommonJS と
   prism.js
 -->
  <script src="v3.5.0/examples/resources/common.js"></script>
  <script src="v3.5.0/examples/resources/prism/prism.min.js"></script>
  <!-- 
  <script src="loader.js?id=vector-esri"></script>
  -->
  <!-- ファイル修正 -->  <!-- ディレクトリ修正 -->
  <script src="loader.js?id=2119-ol3ex"></script>
  </body>
</html>


COMMONJS は

COMMONJS
http://webpack.github.io/docs/commonjs.html

に、次のようにあります。

The CommonJS group defined a module format to solve JavaScript scope issues by making sure each module is executed in its own namespace.
This is achieved by forcing modules to explicitly export those variables it wants to expose to the “universe”, and also by defining those other modules required to properly work.
To achieve this CommonJS give you two tools:
the require() function, which allows to import a given module into the current scope.
the module object, which allows to export something from the current scope.

CommonJSグループは、それ自身の名前空間内で実行されている各モジュールを確認することによって、JavaScriptのスコープ問題を解決するためのモジュールフォーマットを定義しました。
これは、それが「universe(?)」に公開したい変数を明示的にエクスポートするモジュールを強制することによって、同じように、正常に動作するのに必要な他のモジュールを定義することによって、達成されます。
この CommonJS を達成するために2つのツールを与えます:
require()関数、指定したモジュールを現在のスコープにインポートすることができます。
モジュールオブジェクト、現在のスコープからエクスポートすることができます。


Prism は、

Prism
http://prismjs.com/

に、次のようにあります。

Prism is a lightweight, extensible syntax highlighter, built with modern web standards in mind. It’s a spin-off from Dabblet and is tested there daily by thousands.
Prismは、最新のWeb標準に構築されたことを考慮し軽量で拡張可能なシンタックスハイライトです。それは Dabblet からスピンオフで、何千人も日々そこで試験されています。


ZeroClipboard は

ZeroClipboard v2.x
http://zeroclipboard.org/

に、次のようにあります。

The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie and a JavaScript interface.
ZeroClipboard ライブラリは、見えない Adobe Flash ムービーとJavaScript のインターフェイスを使用してテキストをクリップボードにコピーする簡単な方法を提供します。

Debian 8 では動作しませんでした。ボタンを右クリックしたときに flash のコンテキストメニューが表示されると動作しています。

2015年3月8日日曜日

2 - ol3.3ex 79b - Tiled ArcGIS MapServer example 2

「arcgis-tiled.js(279-ol3ex.js)」は、マップを表示するための JavaScript ファイルです。

Specialty/ESRI_StateCityHighway_USA (MapServer)
(http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer)
について次のようにあります。

Service Description: This service provides census information for U.S. cities and states including total population, racial counts, and more. It also includes highways. This is a sample service hosted by ESRI, powered by ArcGIS Server. ESRI has provided this example so that you may practice using ArcGIS APIs for JavaScript, Flex, and Silverlight. ESRI reserves the right to change or remove this service at any time and without notice.

サービスの説明:このサービスは、米国の都市と州の人口調査情報を提供し、総人口、人種カウント、およびその他多くを含みます。高速道路も含まれています。これは、ArcGIS Server による ESRI によってホストされているサンプルのサービスです。JavaScript、Flex、および Silverlight 用の ArcGIS API 使用することで練習できるように ESRI はこの例を提供してきました。 ESRI はいつでも変更、または、予告なしにこのサービスを削除する権利を留保します。


「279-ol3ex.js」
var url = 'http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/' +
 'Specialty/ESRI_StateCityHighway_USA/MapServer';
var layers = [
 new ol.layer.Tile({
  /** ol.layer.Tile 
   * For layer sources that provide pre-rendered, tiled 
   * images in grids that are organized by zoom levels for 
   * specific resolutions. 
   * プリレンダリング(事前描画)を提供するレイヤソースのための、
   * 特定の解像度でのズームレベルによって編成されているグリッドの
   * タイルイメージ。(ol3 API)
   */
  source: new ol.source.MapQuest({layer: 'sat'})
  /** ol.source.MapQuest
   * Layer source for the MapQuest tile server.
   * MapQuest タイルサーバのレイヤソース。(ol3 API
   * 2 - ol3ex 23b - MapQuest example 2 参照)
   */
 }),
 new ol.layer.Tile({
  extent: [-13884991, 2870341, -7455066, 6338219],
  source: new ol.source.TileArcGISRest({
  /** ol.source.TileArcGISRest
   * Layer source for tile data from ArcGIS Rest 
   * services. Map and Image Services are supported.
   * For cached ArcGIS services, better performance 
   * is available using the ol.source.XYZ data 
   * source.
   * ArcGIS REST サービスからのタイルデータのレイヤソース。
   * 地図と画像サービスがサポートされています。キャッシュされた 
   * ArcGIS サービスのため、ol.source.XYZ データソースを
   * 使用することでより良いパフォーマンスが利用できます。
   * (ol3 API)
   */
   url: url
  })
 })
];
var map = new ol.Map({
 layers: layers,
 target: 'map',
 view: new ol.View({
  center: [-10997148, 4569099],
  zoom: 4
 })
});

2 - ol3.3ex 79a - Tiled ArcGIS MapServer example 1

「Tiled ArcGIS MapServer example (arcgis-tiled.html)」を参考に地図を表示してみます。


HTML ファイルの作成
a Eclipse のメニューの「ファイル」->「ファイルを開く」をクリックします。





b 「ファイルを開く」ウィンドウで、「user」->「mapsite」->「ol3proj」->「v3.3.0」->「examples」->「arcgis-tiled.html」をクリックして選択し、「OK」ボタンをクリックします。
同じように「arcgis-tiled.js」を開きます。





c メニューの「ファイル」->「新規」 -> 「ファイル」をクリックします。



d 「ファイル」ウィンドウで「ol3proj」をクリックして選択し、「ファイル名」を「279-ol3ex.html」と入力し、「次へ」ボタンをクリックします。








e 「File Template」ウィンドウで「HTML 5 Template」をクリックして選択し、「OK」ボタンをクリックします。











f 「arcgis-tiled.html」の内容をコピーして「279-ol3ex.html」に貼り付け、修正します。
g 同じように、新規に「279-ol3ex.js」ファイルを作成し、「File Template」ウィンドウで「JavaScript Template」をクリックして選択し、「完了」ボタンをクリックして、「arcgis-tiled.js」の内容をコピーして貼り付け、修正します。「arcgis-tiled-require.js」も「279-ol3ex-require.js」に貼り付けます。


「279-ol3ex.html」
<!doctype html>
<html lang="en">
 <head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="chrome=1">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<!--
  <link rel="stylesheet" href="../css/ol.css" type="text/css">
  <link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
  <link rel="stylesheet" href="../resources/layout.css" type="text/css">
  <link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
-->
  <!-- ディレクトリ修正 -->
  <link rel="stylesheet" href="v3.3.0/css/ol.css" type="text/css">
  <link rel="stylesheet" href="v3.3.0/resources/bootstrap/css/bootstrap.min.css" type="text/css">
  <link rel="stylesheet" href="v3.3.0/resources/layout.css" type="text/css">
  <link rel="stylesheet" href="v3.3.0/resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
  <title>Tiled ArcGIS MapServer example</title>
 </head>
 <body>
  <!-- 
  bootstrap.min.css, bootstrap-responsive.min.css で設定されたセレクタを使用。
  -->
  <div class="navbar navbar-inverse navbar-fixed-top">
   <div class="navbar-inner">
    <div class="container">
     <!--
     <a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
     -->
     <!-- ディレクトリ修正 -->
     <a class="brand" href="v3.3.0/examples/"><img src="v3.3.0/resources/logo.png"> OpenLayers 3 Examples</a>
    </div>
   </div>
  </div>
  <div class="container-fluid">
   <div class="row-fluid">
    <div class="span12">
     <div id="map" class="map"></div>
    </div>
   </div>
   <div class="row-fluid">
    <div class="span12">
    <h4 id="title">Tiled ArcGIS MapServer example</h4>
     <p id="shortdesc">Example of a tiled ArcGIS layer.</p>
     <div id="docs">
      <!--
      <p>See the <a href="arcgis-tiled.js" target="_blank">arcgis-tiled.js source</a> to see how this is done.</p>
      -->
      <!-- ファイル修正 -->
      <p>See the <a href="279-ol3ex.js" target="_blank">279-ol3ex.js source</a> to see how this is done.</p>
     </div>
     <div id="tags">arcgis, tile, tilelayer</div>
    </div>
   </div>
  </div>
  <!--
  <script src="../resources/jquery.min.js" type="text/javascript"></script>
  <script src="../resources/example-behaviour.js" type="text/javascript"></script>
  -->
  <!-- ディレクトリ修正
   jQuery Minified版と
   example-behaviour.js(Examples用 JSコード[文字コードなど])
  -->
  <script src="v3.3.0/resources/jquery.min.js" type="text/javascript"></script>
  <script src="v3.3.0/resources/example-behaviour.js" type="text/javascript"></script>
  <!--
  <script src="loader.js?id=arcgis-tiled" type="text/javascript"></script>
  -->
  <!-- ファイル修正 -->  <!-- ディレクトリ修正 -->
  <script src="loader.js?id=279-ol3ex" type="text/javascript"></script>
 </body>
</html>