ラベル HTMLファイル の投稿を表示しています。 すべての投稿を表示
ラベル HTMLファイル の投稿を表示しています。 すべての投稿を表示

2017年11月28日火曜日

2 - ol4.5ex 175a - Vector Tile Info 1

「Vector Tile Info (vector-tile-info.html)」を参考に地図を表示してみます。
説明に次のようにあります。

Move your pointer over rendered features to display feature properties.

フィーチャプロパティを表示するために描画されたフィーチャ上でポインタを移動します。

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



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



(この状態でファイル名をキーボードで打つと検索欄が表示されて候補が絞り込めます。)

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



d 「ファイル」ウィンドウで「ol4proj」->「v4.5.0」->「examples」をクリックして選択し、「ファイル名」を「2175-ol4ex.html」と入力し、「完了」ボタンをクリックします。
(「ファイル」->「新規」->「その他」をクリックし、「ウィザードを選択」ダイアログで「Web」->「HTMLファイル」からテンプレートも作成できます。)







e 「vector-tile-info.html」の内容をコピーして「2175-ol4ex.html」に貼り付け、修正します。

f 同じように、新規に「2175-ol4ex.js」ファイルを作成し、「vector-tile-info.js」の内容をコピーして貼り付け、修正します。「svector-tile-info-require.js」も「2175-ol4ex-require.js」に貼り付けます。
(「ファイル」->「新規」->「JavaScript ソース・ファイル」をクリックし、「新規 JavaScript ファイル」ダイアログでテンプレートも作成できます。)






「2175-ol3ex.html」
<!DOCTYPE html>
<html lang="en-US">
 <head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge">
  <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.min.css" type="text/css">
  <link rel="stylesheet" href="./resources/prism/prism.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="vector-tile-info.css">

  <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch,requestAnimationFrame,Element.prototype.classList,URL"></script>
  <script src="./resources/zeroclipboard/ZeroClipboard.min.js"></script>
  <title>Vector Tile Info</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 Examples</a>
    </div>
    <!-- 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 class="active" href="index.html">Examples</a></li>
      <li><a href="../apidoc">API</a></li>
      <li><a href="https://github.com/openlayers/openlayers">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>4.5.0</span>. 
     The <a id="latest-link" href="#" class="alert-link">latest</a>
     is v<span id="latest-version"></span>.
   </div>
   <div class="row-fluid">
    <div class="span12">
     <h4 id="title">Vector Tile Info</h4>
     <div id="map" class="map">
     <pre id="info" />
     </div>
    </div>
   </div>
   <div class="row-fluid">
    <div class="span12">
     <p id="shortdesc">Getting feature information from 
      vector tiles.</p>
     <div id="docs"><p>Move your pointer over rendered 
      features to display feature properties.</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>
       </li>,
       <li>
        <a href="../apidoc/ol.View.html" title="API documentation for ol.View">ol.View</a>
       </li>,
       <li>
        <a href="../apidoc/ol.format.MVT.html" title="API documentation for ol.format.MVT">ol.format.MVT</a>
       </li>,
       <li>
        <a href="../apidoc/ol.layer.VectorTile.html" title="API documentation for ol.layer.VectorTile">ol.layer.VectorTile</a>
       </li>,
       <li>
        <a href="../apidoc/ol.source.VectorTile.html" title="API documentation for ol.source.VectorTile">ol.source.VectorTile</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="codepen-button">
      <i class="fa fa-codepen"></i> Edit
     </a>
    </div>
    <form method="POST" id="codepen-form" target="_blank" action="https://codepen.io/pen/define/">
     <textarea class="hidden" name="title">Vector Tile Info</textarea>
     <textarea class="hidden" name="description">Getting feature information from vector tiles.</textarea>
     <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>
  <!-- 
  <script src="loader.js?id=svector-tile-info"></script>
  -->
  <!-- ファイル修正 -->
  <script src="loader.js?id=2175-ol4ex"></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]) && '4.1.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 9 では動作しませんでした。ボタンを右クリックしたときに flash のコンテキストメニューが表示されると動作しています。

2 - ol4.5ex 174a - Street Labels 1

「Street Labels (street-labels.html)」を参考に地図を表示してみます。
説明に次のようにあります。

Example showing the use of a text style with placement: 'line' to render text along a path.

パスに沿ってテキストを描画するために「placement: 'line'」を使ったテキストスタイルの使用を示した例。


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



b 「ファイルを開く」ウィンドウで、「user」->「public_html」->「eclipse-workspace」->「ol4proj」-> 「v4.5.0」->「examples」->「street-labels.html」をクリックして選択し、「OK」ボタンをクリッ クします。
同じように「street-labels.js」を開きます。



(この状態でファイル名をキーボードで打つと検索欄が表示されて候補が絞り込めます。)

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



d 「ファイル」ウィンドウで「ol4proj」->「v4.5.0」->「examples」をクリックして選択し、「ファイル名」を「2174-ol4ex.html」と入力し、「完了」ボタンをクリックします。
(「ファイル」->「新規」->「その他」をクリックし、「ウィザードを選択」ダイアログで「Web」->「HTMLファイル」からテンプレートも作成できます。)







e 「street-labels.html」の内容をコピーして「2174-ol4ex.html」に貼り付け、修正します。

f 同じように、新規に「2174-ol4ex.js」ファイルを作成し、「street-labels.js」の内容をコピーして貼り付け、修正します。「street-labels-require.js」も「2174-ol4ex-require.js」に貼り付けます。
(「ファイル」->「新規」->「JavaScript ソース・ファイル」をクリックし、「新規 JavaScript ファイル」ダイアログでテンプレートも作成できます。)






「2174-ol3ex.html」
<!DOCTYPE html>
<html lang="en-US">
 <head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge">
  <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.min.css" type="text/css">
  <link rel="stylesheet" href="./resources/prism/prism.css" type="text/css">
  <link rel="stylesheet" href="../css/ol.css" type="text/css">
  <link rel="stylesheet" href="./resources/layout.css" type="text/css">

  <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch,requestAnimationFrame,Element.prototype.classList,URL"></script>
  <script src="./resources/zeroclipboard/ZeroClipboard.min.js"></script>
  <title>Street Labels</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 Examples</a>
    </div>
    <!-- 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 class="active" href="index.html">Examples</a></li>
      <li><a href="../apidoc">API</a></li>
      <li><a href="https://github.com/openlayers/openlayers">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>4.5.0</span>. 
     The <a id="latest-link" href="#" class="alert-link">latest</a>
     is v<span id="latest-version"></span>.
   </div>
   <div class="row-fluid">
    <div class="span12">
     <h4 id="title">Tile Transitions</h4>
     <div id="map" class="map"></div>
     <label>
      render with an opacity transition
     <input id="transition" type="checkbox" checked>
    </label>
    </div>
   </div>
   <div class="row-fluid">
    <div class="span12">
     <p id="shortdesc">Render street names with a 
      custom render.</p>
     <div id="docs"><p>Example showing the use of a 
       text style with <code>placement: &amp#39;line&amp#39;
      </code> to render text along a path.</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>
       </li>,
       <li>
        <a href="../apidoc/ol.View.html" title="API documentation for ol.View">ol.View</a>
       </li>,
       <li>
        <a href="../apidoc/ol.extent.html" title="API documentation for ol.extent">ol.extent</a>
       </li>,
       <li>
        <a href="../apidoc/ol.format.GeoJSON.html" title="API documentation for ol.format.GeoJSON">ol.format.GeoJSON</a>
       </li>,
       <li>
        <a href="../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>
       </li>,
       <li>
        <a href="../apidoc/ol.source.BingMaps.html" title="API documentation for ol.source.BingMaps">ol.source.BingMaps</a>
       </li>,
       <li>
        <a href="../apidoc/ol.source.Vector.html" title="API documentation for ol.source.Vector">ol.source.Vector</a>
       </li>,
       <li>
        <a href="../apidoc/ol.style.Fill.html" title="API documentation for ol.style.Fill">ol.style.Fill</a>
       </li>,
       <li>
        <a href="../apidoc/ol.style.Style.html" title="API documentation for ol.style.Style">ol.style.Style</a>
       </li>,
       <li>
        <a href="../apidoc/ol.style.Text.html" title="API documentation for ol.style.Text">ol.style.Text</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="codepen-button">
      <i class="fa fa-codepen"></i> Edit
     </a>
    </div>
    <form method="POST" id="codepen-form" target="_blank" action="https://codepen.io/pen/define/">
     <textarea class="hidden" name="title">Street Labels</textarea>
     <textarea class="hidden" name="description">Render street names with a custom render.</textarea>
     <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>
  <!-- 
  <script src="loader.js?id=street-labels"></script>
  -->
  <!-- ファイル修正 -->
  <script src="loader.js?id=2174-ol4ex"></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]) && '4.1.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 9 では動作しませんでした。ボタンを右クリックしたときに flash のコンテキストメニューが表示されると動作しています。

2017年10月10日火曜日

2 - ol4.4ex 173a - Tile Transitions 1

「Tile Transitions(tile-transitions.html)」を参考に地図を表示してみます。
説明に次のようにあります。

By default tiles are rendered with an opacity transition - fading in over 250 ms. To disable this behavior, set the transition option of the tile source to 0.

デフォルトでは、タイルは不透明なトランジションでレンダリングされます。フェーディングは250ミリ秒を超えます。 この動作を無効にするには、タイルソースのトランジションオプションを0に設定します。



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



b 「ファイルを開く」ウィンドウで、「user」->「public_html」->「eclipse-workspace」->「ol4proj」-> 「v4.4.1」->「examples」->「tile-transitions.html」をクリックして選択し、「OK」ボタンをクリッ クします。
同じように「tile-transitions.js」を開きます。



(この状態でファイル名をキーボードで打つと検索欄が表示されて候補が絞り込めます。)

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



d 「ファイル」ウィンドウで「ol4proj」->「v4.4.1」->「examples」をクリックして選択し、「ファイル名」を「2173-ol4ex.html」と入力し、「完了」ボタンをクリックします。
(「ファイル」->「新規」->「その他」をクリックし、「ウィザードを選択」ダイアログで「Web」->「HTMLファイル」からテンプレートも作成できます。)







e 「tile-transitions.html」の内容をコピーして「2173-ol4ex.html」に貼り付け、修正します。

f 同じように、新規に「2173-ol4ex.js」ファイルを作成し、「tile-transitions.js」の内容をコピーして貼り付け、修正します。「tile-transitions-require.js」も「2173-ol4ex-require.js」に貼り付けます。
(「ファイル」->「新規」->「JavaScript ソース・ファイル」をクリックし、「新規 JavaScript ファイル」ダイアログでテンプレートも作成できます。)






「2173-ol3ex.html」
<!DOCTYPE html>
<html lang="en-US">
 <head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge">
  <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.min.css" type="text/css">
  <link rel="stylesheet" href="./resources/prism/prism.css" type="text/css">
  <link rel="stylesheet" href="../css/ol.css" type="text/css">
  <link rel="stylesheet" href="./resources/layout.css" type="text/css">

  <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch,requestAnimationFrame,Element.prototype.classList,URL"></script>
  <script src="./resources/zeroclipboard/ZeroClipboard.min.js"></script>
  <title>Tile Transitions</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 Examples</a>
    </div>
    <!-- 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 class="active" href="index.html">Examples</a></li>
      <li><a href="../apidoc">API</a></li>
      <li><a href="https://github.com/openlayers/openlayers">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>4.3.1</span>. 
     The <a id="latest-link" href="#" class="alert-link">latest</a>
     is v<span id="latest-version"></span>.
   </div>
   <div class="row-fluid">
    <div class="span12">
     <h4 id="title">Tile Transitions</h4>
     <div id="map" class="map"></div>
     <label>
      render with an opacity transition
     <input id="transition" type="checkbox" checked>
    </label>
    </div>
   </div>
   <div class="row-fluid">
    <div class="span12">
     <p id="shortdesc">Custom configuration for opacity 
      transitions on tiles.</p>
     <div id="docs"><p>By default tiles are rendered 
      with an opacity transition - fading in over 250 ms.  
      To disable this behavior, set the <code>transition
      </code> option of the tile source to 0.</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>
       </li>,
       <li>
        <a href="../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>
       </li>,
       <li>
        <a href="../apidoc/ol.source.XYZ.html" title="API documentation for ol.source.XYZ">ol.source.XYZ</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="codepen-button">
      <i class="fa fa-codepen"></i> Edit
     </a>
    </div>
    <form method="POST" id="codepen-form" target="_blank" action="https://codepen.io/pen/define/">
     <textarea class="hidden" name="title">Tile Transitions</textarea>
     <textarea class="hidden" name="description">Custom configuration for opacity transitions on tiles.</textarea>
     <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>
  <!-- 
  <script src="loader.js?id=tile-transitions"></script>
  -->
  <!-- ファイル修正 -->
  <script src="loader.js?id=2173-ol4ex"></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]) && '4.1.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 9 では動作しませんでした。ボタンを右クリックしたときに flash のコンテキストメニューが表示されると動作しています。

2017年8月30日水曜日

2 - ol4.3ex 172a - Vector Label Decluttering 1

「Vector Label Decluttering(vector-label-decluttering.html) 」を参考に地図を表示してみます。
説明に次のようにあります。

A custom renderer function is used instead of an ol.style.Text to label the countries of the world. Only texts that are not wider than their country's bounding box are considered and handed over to Labelgun for decluttering.

ol.style.Text の代わりにカスタムレンダラ関数を使用して、世界の国にラベルを付けます。 国のバウンディングボックスよりも幅の広くないテキストだけが考慮され、decluttering のために Labelgun に引き渡されます。


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



b 「ファイルを開く」ウィンドウで、「user」->「eclipse-workspace」->「ol4proj」-> 「v4.3.1」->「examples」->「vector-label-decluttering.html」をクリックして選択し、「OK」ボタンをクリッ クします。
同じように「vector-label-decluttering.js」を開きます。



(この状態でファイル名をキーボードで打つと検索欄が表示されて候補が絞り込めます。)

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



d 「ファイル」ウィンドウで「ol4proj」->「v4.3.1」->「examples」をクリックして選択し、「ファイル名」を「2172-ol4ex.html」と入力し、「完了」ボタンをクリックします。
(「ファイル」->「新規」->「その他」をクリックし、「ウィザードを選択」ダイアログで「Web」->「HTMLファイル」からテンプレートも作成できます。)







e 「vector-label-decluttering.html」の内容をコピーして「2172-ol4ex.html」に貼り付け、修正します。

f 同じように、新規に「2172-ol4ex.js」ファイルを作成し、「vector-label-decluttering.js」の内容をコピーして貼り付け、修正します。「vector-label-decluttering-require.js」も「2172-ol4ex-require.js」に貼り付けます。
(「ファイル」->「新規」->「JavaScript ソース・ファイル」をクリックし、「新規 JavaScript ファイル」ダイアログでテンプレートも作成できます。)






「2172-ol3ex.html」
<!DOCTYPE html>
<html lang="en-US">
 <head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge">
  <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.min.css" type="text/css">
  <link rel="stylesheet" href="./resources/prism/prism.css" type="text/css">
  <link rel="stylesheet" href="../css/ol.css" type="text/css">
  <link rel="stylesheet" href="./resources/layout.css" type="text/css">

  <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Set""></script>
  <script src="https://unpkg.com/rbush@2.0.1/rbush.min.js"></script>
  <script src="https://unpkg.com/labelgun@0.1.1/lib/labelgun.min.js"></script>
  <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch,requestAnimationFrame,Element.prototype.classList,URL"></script>
  <script src="./resources/zeroclipboard/ZeroClipboard.min.js"></script>
  <title>Vector Label Decluttering</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 Examples</a>
    </div>
    <!-- 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 class="active" href="index.html">Examples</a></li>
      <li><a href="../apidoc">API</a></li>
      <li><a href="https://github.com/openlayers/openlayers">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>4.3.1</span>. 
     The <a id="latest-link" href="#" class="alert-link">latest</a>
     is v<span id="latest-version"></span>.
   </div>
   <div class="row-fluid">
    <div class="span12">
     <h4 id="title">Street Labels</h4>
     <div id="map" class="map"></div>
    </div>
   </div>
   <div class="row-fluid">
    <div class="span12">
     <p id="shortdesc">Render street names with a custom 
       render.</p>
     <div id="docs"><p>A custom <code>renderer 
      </code>function is used instead of an <code>
      ol.style.Text</code> to label the countries of the 
      world. Only texts that are not wider than their 
      country's bounding box are considered and handed over 
      to <a href="https://github.com/Geovation/labelgun">
      Labelgun</a> for decluttering.</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>
       </li>,
       <li>
        <a href="../apidoc/ol.View.html" title="API documentation for ol.View">ol.View</a>
       </li>,
       <li>
        <a href="../apidoc/ol.extent.html" title="API documentation for ol.extent">ol.extent</a>
       </li>,
       <li>
        <a href="../apidoc/ol.format.GeoJSON.html" title="API documentation for ol.format.GeoJSON">ol.format.GeoJSON</a>
       </li>,
       <li>
        <a href="../apidoc/ol.layer.Vector.html" title="API documentation for ol.layer.Vector">ol.layer.Vector</a>
       </li>,
       <li>
        <a href="../apidoc/ol.source.Vector.html" title="API documentation for ol.source.Vector">ol.source.Vector</a>
       </li>,
       <li>
        <a href="../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>
       </li>,
       <li>
        <a href="../apidoc/ol.style.Style.html" title="API documentation for ol.style.Style">ol.style.Style</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="codepen-button">
      <i class="fa fa-codepen"></i> Edit
     </a>
    </div>
    <form method="POST" id="codepen-form" target="_blank" action="https://codepen.io/pen/define/">
     <textarea class="hidden" name="title">Vector Label Decluttering</textarea>
     <textarea class="hidden" name="description">Label decluttering with a custom renderer.</textarea>
     <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>
  <!-- 
  <script src="loader.js?id=vector-label-decluttering"></script>
  -->
  <!-- ファイル修正 -->
  <script src="loader.js?id=2172-ol4ex"></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]) && '4.1.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 9 では動作しませんでした。ボタンを右クリックしたときに flash のコンテキストメニューが表示されると動作しています。

2 - ol4.3ex 171b - Street Labels 2

「street-labels.js(2171-ol4ex.js)」は、マップを表示するための JavaScript ファイルです。

「2171-ol4ex.js」
var emptyFn = function() {};
var labelEngine = new labelgun['default'](emptyFn, emptyFn);
/** labelgun(hideLabel, showLabel, entries)
 * Create a label gun instance with a hide and show label 
 * callback.
 * hide と show label コールバックで label gun インスタンスを
 * 作成します。
 * (JSDoc[http://tech.geovation.uk/labelgun/documentation/
 * labelgun.html])
 */
var context, pixelRatio; 
// Will be set in the map's postcompose listener
function measureText(text) {
 return context.measureText(text).width * pixelRatio;
 /** CanvasRenderingContext2D.measureText()
  * The CanvasRenderingContext2D.measureText() method 
  * returns a TextMetrics object that contains information 
  * about the measured text (such as its width for example).
  * CanvasRenderingContext2D.measureText() メソッドは、
  * (例えば幅などの)測定されたテキストについて情報を含む  
  * TextMetricsオブジェクトを返します。
  * (MDN[https://developer.mozilla.org/en-US/docs/Web/
  * API/CanvasRenderingContext2D/measureText])
  */
}
var extent, letters; 
// Will be set in the style's renderer function
function collectDrawData(letter, x, y, angle) {
 ol.extent.extend(extent, [x, y, x, y]);
 /** ol.extent.extend(extent1, extent2)
  * Modify an extent to include another extent.
  * もう一つの範囲を含むために、範囲を修正します。
  * (ol4 API)
  */
 letters.push([x, y, angle, letter]);
 /** Array.prototype.push()
  * The push() method adds one or more elements to the end 
  * of an array and returns the new length of the array.
  * push() メソッドは、配列の末尾に 1 つ以上の要素を追加し、新
  * しい配列の数を返します。
  * (MDN[https://developer.mozilla.org/en-US/docs/Web/
  * JavaScript/Reference/Global_Objects/Array/push])
  */
}
var style = new ol.style.Style({
/** ol.style.Style 
 * Container for vector feature rendering styles. Any 
 * changes made to the style or its children through 
 * set*() methods will not take effect until the feature 
 * or layer that uses the style is re-rendered.
 * ベクタフィーチャがスタイルを描画するためのコンテナ。
 * スタイルや set*() メソッドを通じてその子に加えられた変
 * 更は、スタイルを使用するフィーチャまたはレイヤが再レン
 * ダリングされるまで有効になりません。
 * (ol4 API)
 */
 renderer: function(coords, context) {
 /** renderer:
  * Custom renderer. When configured, fill, stroke and 
  * image will be ignored, and the provided function will 
  * be called with each render frame for each geometry.
  * カスタムレンダラ。設定されたとき、fill と stroke、 image
  * は無視され、 提供されたファンクションは各ジオメトリに対
  * する各描画フレームを呼び出します。
  * (ol4 API)
  */
  var feature = context.feature;
  var text = feature.get('name');
  /** get(key)
   * Gets a value.(ol4 API)
   */
  // Only create label when geometry has a long and straight segment
  var path = labelSegment(coords, Math.PI / 8, measureText(text));
  /** labelSegment(path, maxAngle, labelLength)
   * path: Array<Array<number>>, Path represented in 
   * coordinate pairs.
   * 座標と対で表されるパス。
   * maxAngle: number Maximum angle in radians for a 
   * suitable segment.
   * 適切なセグメントの最大角度(ラジアン)。
   * labelLength: number, Required segment length for the 
   * label.
   * ラベルの必要とされるセグメント長。
   * (labelSegment[https://github.com/ahocevar/
   * label-segment])
   */
  /** Math.PI()
   * The Math.PI property represents the ratio of the 
   * circumference of a circle to its diameter, 
   * approximately 3.14159:
   * Math.PIプロパティは、円周とその直径の比(約3.14159)を表し
   * ます。
   * (MDN[https://developer.mozilla.org/en-US/docs/Web/
   * JavaScript/Reference/Global_Objects/Math/PI])
   */
  if (path) {
   extent = ol.extent.createEmpty();
   /** ol.extent.createEmpty
    * Create an empty extent.(ol4 API)
    */
   letters = [];
   textPath(text, path, measureText, collectDrawData);
   /** textPath(text, path, measureText, draw, textArea)
    * text: string, Text to draw along the path.
    * パスに沿って描画されるテキスト。
    * path: Array<Array<number>>, Path represented in 
    * coordinate pairs.
    * 座標と対で表されるパス。
    * measureText: Function, Function that takes a text as 
    * argument and returns the width of the provided text.
    * 引数としてテキストをとり、指定されたテキストの幅を返す
    * 関数。
    * draw: Function, Function that takes a letter, its x 
    * coordinate, y coordinate and angle (in radians) as 
    * arguments. It is typically used to draw the provided 
    * letter to a canvas.
    * 文字、そのx座標、y座標、角度(ラジアン)を引数とする関
    * 数。 これは通常、指定された文字をキャンバスに描画するた
    * めに使用されます。
    * textAlign: string, Text alignment along the path. One 
    * of 'left', 'center', 'right'. (optional, default 
    * 'center')
    * パスに沿ったテキストの配置。 「左」、「中央」、「右」の
    * いずれか。 
    * (オプション、デフォルトは 'center')
    * (textPath[https://github.com/ahocevar/textpath])
    */
   ol.extent.buffer(extent, 5 * pixelRatio, extent);
   /** ol.extent.buffer(extent, value, opt_extent)
    * Return extent increased by the provided value.
    * 提供された値によって拡大した範囲を返します。
    * (ol4 API)
    */
   var bounds = {
    bottomLeft: ol.extent.getBottomLeft(extent),
    /** ol.extent.getBottomLeft(extent)
     * Get the bottom left coordinate of an extent.
     * 範囲の左下の座標を取得します。
     * (ol4 API)
     */
    topRight: ol.extent.getTopRight(extent)
    /** ol.extent.getTopRight(extent)
     * Get the top right coordinate of an extent.
     * 範囲の右上の座標を取得します。
     * (ol4 API)
     */
   };
   labelEngine.ingestLabel(bounds, feature.getId(), 1, letters, text, false);
   /** ingestLabel
    * Creates a label if it does not already exist, then 
    * adds it to the tree, and renders it based on whether 
    * it can be shown.
    * ラベルがまだ存在しない場合は作成し、ツリーに追加し、表示
    * 可能かどうかに基づいてレンダリングします。
    * (JSDoc[http://tech.geovation.uk/labelgun/
    * documentation/module-labelgun.html])
    */
   /** getId()
    * Get the feature identifier. This is a stable 
    * identifier for the feature and is either set when 
    * reading data from a remote source or set explicitly 
    * by calling ol.Feature#setId.
    * フィーチャ識別子を取得します。これは、フィーチャの安定し
    * た識別子で、リモートソースからデータを読み取るか、
    * ol.Feature#setid を呼び出すことによって明示的に設定した
    * 場合のいずれかのセットです。(ol4 API)
    */
  }
 }
});
var rasterLayer = 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. 
 * プリレンダリング(事前描画)を提供するレイヤソースのた
 * めの、特定の解像度でのズームレベルによって編成されてい
 * るグリッドのタイルイメージ。(ol4 API)
 */
 source: new ol.source.BingMaps({
 /** ol.source.BingMaps
  * Layer source for Bing Maps tile data.(ol4 API)
  */
  key: 'As1Hi...(省略)',
  imagerySet: 'Aerial'
 })
});
var source = new ol.source.Vector();
/** ol.source.Vector
 * Provides a source of features for vector layers. 
 * Vector features provided by this source are suitable 
 * for editing. See ol.source.VectorTile for vector 
 * data that is optimized for rendering.
 * ベクタレイヤのフィーチャのソースを用意します。このソース
 * が提供するベクタフィーチャは、編集に適しています。レンダ
 * リングのために最適化されたベクタデータの 
 * ol.source.VectorTile を参照してください。(ol4 API)
 */
// Request streets from OSM, using the Overpass API
fetch('https://overpass-api.de/api/interpreter', {
/** WindowOrWorkerGlobalScope.fetch()
 * The fetch() method of the WindowOrWorkerGlobalScope 
 * mixin starts the process of fetching a resource from 
 * the network. This returns a promise that resolves to 
 * the Response object representing the response to your 
 * request.
 * WindowOrWorkerGlobalScope mixin の fetch() メソッドは、
 * ネットワークからリソースを取得する処理を開始します。これは
 * 要求に 対する応答を表す Response オブジェクトに解決のプロ
 * ミス(promise)を返します。
 *(MDN[https://developer.mozilla.org/en-US/docs/Web/API/
 * WindowOrWorkerGlobalScope/fetch])
 */
 method: 'POST',
 /** method:
  *  The request method, e.g., GET, POST.
  */
 body: '(way["highway"](48.19642,16.32580,48.22050,16.41986));(._;>;);out meta;'
 /** body:
  * Any body that you want to add to your request: this 
  * can be a Blob, BufferSource, FormData, URLSearchParams, 
  * or USVString object. Note that a request using the GET 
  * or HEAD method cannot have a body.
  * リクエストに追加する body。これは、Blob や、BufferSource、
  * FormData、URLSearchParams、USVString オブジェクトです。
  * GET、または、HEAD メソッドを使用するリクエストは、body を持
  * てないことに注意してください。
  */
}).then(function(response) {
 return response.text();
}).then(function(responseText) {
 var features = new ol.format.OSMXML().readFeatures(responseText, {
 /** ol.format.OSMXML 
  * Feature format for reading data in the OSMXML format.
  * OSMXML フォーマットのデータを読み込むためのフィーチャ
  * フォーマット。(ol4 API)
  */
  featureProjection: 'EPSG:3857'
 });
 source.addFeatures(features);
 /** addFeatures(features)
  * Add a batch of features to the source.
  * ソースにフィーチャのバッチを追加します。(ol4 API)
  */
});
var vectorLayer = new ol.layer.Vector({
/** ol.layer.Vector
 * Vector data that is rendered client-side.
 * クライアント側で描画されるベクタデータ。(ol4 API)
 */
 source: source,
 style: function(feature) {
  if (feature.getGeometry().getType() == 'LineString' && feature.get('name')) {
  /** getGeometry()
   * Get the feature's default geometry. A feature may 
   * have any number of named geometries. The "default" 
   * geometry (the one that is rendered by default) is 
   * set when calling ol.Feature#setGeometry.
   * フィーチャのデフォルトのジオメトリを取得します。フィーチャ
   * は、任意の数の指定のジオメトリのを有することができます。
   * 「デフォルト」のジオメトリ(デフォルトでレンダリングされ
   * るもの)が ol.Feature#setGeometry を呼び出すときに
   * 設定されています。(ol4 API)
   */
   /** getType()
    * Get the type of this geometry.(ol4 API)
    */
   return style;
  }
 }
});
var viewExtent = [1817379, 6139595, 1827851, 6143616];
var map = new ol.Map({
 layers: [rasterLayer, vectorLayer],
 target: 'map',
 view: new ol.View({
  extent: viewExtent,
  center: ol.extent.getCenter(viewExtent),
  /** ol.extent.getCenter(extent)
   * Get the center coordinate of an extent.
   * 範囲の中心座標を取得します。(ol4 API)
   */
  zoom: 17,
  minZoom: 14
 })
});
vectorLayer.on('precompose', function() {
/** on(type, listener, opt_this)
 * Listen for a certain type of event.
 * ある型のイベントをリッスンします。(ol4 API)
 */
 labelEngine.destroy();
 /** destroy()
  * Destroy the collision tree and labels.
  * コリジョン(衝突)ツリーとラベルを破棄します。
  * (JSDoc[http://tech.geovation.uk/labelgun/documentation/
  * labelgun.html])
  */
});
vectorLayer.on('postcompose', function(e) {
 context = e.context;
 pixelRatio = e.frameState.pixelRatio;
 /** frameState
  * An object representing the current render frame state.
  * 現在の描画フレームの状態を表すオブジェクト。(ol4 API)
  */
 context.save();
 /** CanvasRenderingContext2D.save()
  * The CanvasRenderingContext2D.save() method of the 
  * Canvas 2D API saves the entire state of the canvas 
  * by pushing the current state onto a stack.
  * Canvas 2D API の CanvasRenderingContext2D.save()
  * メソッドは、スタック上に現在の状態を最後に追加するこ
  * とにより、キャンバスの状態全体を保存します。
  * (MDN[https://developer.mozilla.org/en-US/docs/Web/
  * API/CanvasRenderingContext2D/save])
  */
 context.font = 'normal 11px "Open Sans", "Arial Unicode MS"';
 /** CanvasRenderingContext2D.font
  * The CanvasRenderingContext2D.font property of the 
  * Canvas 2D API specifies the current text style being 
  * used when drawing text. This string uses the same 
  * syntax as the CSS font specifier. The default font 
  * is 10px sans-serif.
  * Canvas 2D APIのCanvasRenderingContext2D.font プロパ
  * ティは、テキストを描画するときに使用される現在のテキスト
  * スタイルを指定します。 この文字列は、CSSフォント記述子と
  * 同じ構文を使用します。 デフォルトのフォントは 10px 
  * sans-serif です。
  * (MDN[https://developer.mozilla.org/en-US/docs/Web/
  * API/CanvasRenderingContext2D/font])
  */
 context.fillStyle = 'white';
 /** CanvasRenderingContext2D.fillStyle
  * The CanvasRenderingContext2D.fillStyle property of 
  * the Canvas 2D API specifies the color or style to 
  * use inside shapes. The default is #000 (black).
  * Canvas 2D API の CanvasRenderingContext2D.fillStyle 
  * プロパティは、図形の内側に使用する色やスタイルを指定し
  * ます。デフォルトでは、#000(黒)です。
  * (MDN[https://developer.mozilla.org/en-US/docs/Web/
  * API/CanvasRenderingContext2D/fillStyle])
  */
 context.textBaseline = 'middle';
 /** CanvasRenderingContext2D.textBaseline
  * The CanvasRenderingContext2D.textBaseline property 
  * of the Canvas 2D API specifies the current text 
  * baseline being used when drawing text.
  * Canvas 2D API の CanvasRenderingContext2D.textBaseline 
  * プロパティは、テキストを描画するとき使用される現在のテキス
  * トのベースライン(baseline)を指定します。デフォルトでは、
  * #000(黒)です。
  * (MDN[https://developer.mozilla.org/en-US/docs/Web/
  * API/CanvasRenderingContext2D/textBaseline])
  */
 context.textAlign = 'center';
 /** CanvasRenderingContext2D.textAlign
  * The CanvasRenderingContext2D.textAlign property of 
  * the Canvas 2D API specifies the current text 
  * alignment being used when drawing text. Beware that 
  * the alignment is based on the x value of the 
  * CanvasRenderingContext2D.fillText method. So if 
  * textAlign="center", then the text would be drawn at 
  * x-50%*width.
  * Canvas 2D API の CanvasRenderingContext2D.textAlign 
  * プロパティは、テキストを描画するときに使用される現在のテキ
  * ストの配置を指定します。 配置は、
  * CanvasRenderingContext2D.fillText メソッドのx値に
  * 基づいていることに注意してください。 したがって、
  * textAlign = "center" の場合、テキストは x-50%*width 
  * の位置から描画されます。
  * (MDN[https://developer.mozilla.org/en-US/docs/Web/
  * API/CanvasRenderingContext2D/textAlign])
  */
 var labels = labelEngine.getShown();
 /** getShown()
  * Return an array of all shown labels.
  * 表示されたラベルすべての配列を返します。
  * (JSDoc[http://tech.geovation.uk/labelgun/documentation/
  * labelgun.html])
  */
 for (var i = 0, ii = labels.length; i < ii; ++i) {
  // Render label letter by letter
  var letters = labels[i].labelObject;
  /** labelObject(ingestLabel のパラメータ)
   * The object representing the actual label object from 
   * your mapping library.
   * マッピングライブラリの実際の label オブジェクトを表すオ
   * ブジェクト。
   * (JSDoc[http://tech.geovation.uk/labelgun/documentation/
   * labelgun.html])
   */
  for (var j = 0, jj = letters.length; j < jj; ++j) {
   var labelData = letters[j];
   context.save();
   context.translate(labelData[0], labelData[1]);
   /** CanvasRenderingContext2D.translate()
    * The CanvasRenderingContext2D.translate() method of the 
    * Canvas 2D API adds a translation transformation by 
    * moving the canvas and its origin x horizontally and y 
    * vertically on the grid.
    * Canvas 2D API の CanvasRenderingContext2D.translate()
    * メソッドは、canvas およびその元のグリッド上の x 垂直方向、
    * および y 水平方向を移動することによる変換変形を追加します。
    * (MDN[https://developer.mozilla.org/en-US/docs/Web/
    * API/CanvasRenderingContext2D/translate])
    */
   context.rotate(labelData[2]);
   /** CanvasRenderingContext2D.rotate()
    * The CanvasRenderingContext2D.rotate() method of the 
    * Canvas 2D API adds a rotation to the transformation 
    * matrix. The angle argument represents a clockwise 
    * rotation angle and is expressed in radians.
    * Canvas 2D APIのCanvasRenderingContext2D.rotate() 
    * メソッドは、変換行列に回転を追加します。 angle 引数は時計
    * 回りの回転角度を表し、ラジアンで表されます。
    * (MDN[https://developer.mozilla.org/en-US/docs/Web/
    * API/CanvasRenderingContext2D/rotate])
    */
   context.scale(pixelRatio, pixelRatio);
   /** CanvasRenderingContext2D.scale()
    * The CanvasRenderingContext2D.scale() method of the 
    * Canvas 2D API adds a scaling transformation to the 
    * canvas units by x horizontally and by y vertically.
    * Canvas 2D API の CanvasRenderingContext2D.scale()
    * メソッドは、x 水平方向、および y 垂直方向によってキャン
    * バス単位に伸縮変形を追加します。
    * (MDN[https://developer.mozilla.org/en-US/docs/Web/
    * API/CanvasRenderingContext2D/scale])
    */
   context.fillText(labelData[3], 0, 0);
   /** CanvasRenderingContext2D.fillText()
    * The CanvasRenderingContext2D.fillText() method of the 
    * Canvas 2D API fills a given text at the given (x, y) 
    * position. If the optional fourth parameter for a 
    * maximum width is provided, the text will be scaled to 
    * fit that width.
    * Canvas 2D APIのCanvasRenderingContext2D.fillText() 
    * メソッドは、指定された(x、y)位置で指定されたテキストを
    * 塗りつぶします。 最大幅のオプションの4番目のパラメータを
    * 指定すると、テキストはその幅に合わせて拡大/縮小されます。
    * (MDN[https://developer.mozilla.org/en-US/docs/Web/
    * API/CanvasRenderingContext2D/fillText])
    */
   context.restore();
   /** CanvasRenderingContext2D.restore()
    * The CanvasRenderingContext2D.restore() method of the 
    * Canvas 2D API restores the most recently saved canvas 
    * state by popping the top entry in the drawing state 
    * stack. If there is no saved state, this method does 
    * nothing.
    * Canvas 2D API の CanvasRenderingContext2D.restore()
    * メソッドは、描画状態のスタックの一番上のエントリを抜き
    * 出すことによって、最後に保存されたキャンバスの状態を復
    * 元します。全く保存された状態が存在しない場合、このメソッ
    * ドは何もしません。
    * (MDN[https://developer.mozilla.org/en-US/docs/Web/
    * API/CanvasRenderingContext2D/restore])
    */
  }
 }
 context.restore();
});

171x-ol4.png

2 - ol4.3ex 171a - Street Labels 1

「Street Labels(street-labels.html) 」を参考に地図を表示してみます。
説明に次のようにあります。

Example showing the use of a custom renderer to render text along a path. Labelgun is used to avoid label collisions. label-segment makes sure that labels are placed on suitable street segments. textpath arranges the letters of a label along the geometry. The data is fetched from OSM using the Overpass API.

例は、パスに沿ってテキストを描画するカスタムレンダラの使用を示しています。Labelgun は、ラベルの衝突を避けるために使用されます。label-segment は、ラベルが適したストリートセグメントに配置されることを確実にします。textpath は、ジオメトリに沿ってラベルの文字を配置します。データは、Overpass API を使用することで OSM から取得します。


Labelgun
Labelgun は、「GitHub-Geovation/labelgun: reducing label clutter across mapping libraries(https://github.com/Geovation/labelgun)」に次のようにあります。

Labelgun is a mapping library agnostic labelling engine. It allows you to avoid cluttering in mapping popups and labels, providing precedence to labels of your choice.
The library makes three assumptions:

● Each label has a bounding rectangle (Min X, Min Y, Max X, Max Y)
● Each label has a weight
● You can provide a function that will hide and show a label (e.g. through CSS class or JavaScript function)

Labelgunは、マッピングライブラリにとらわれないラベリングエンジンです。 これにより、ポップアップとラベルのマッピングが乱雑にならず、選択したラベルに優先順位を付けることができます。
ライブラリは3つの前提があります。

●各ラベルは境界矩形(Min X、Min Y、Max X、Max Y)を持っています。
●各ラベルには太さがあります
●ラベルを表示/非表示する機能を(CSS クラス、または、JavaScript 関数などを通して)提供することができます。


RBush
RBush は、「RBush — a high-performance JavaScript R-tree-based 2D spatial index for points and rectangles (https://github.com/mourner/rbush)」に次のようにあります。

RBush is a high-performance JavaScript library for 2D spatial indexing of points and rectangles. It's based on an optimized R-tree data structure with bulk insertion support.

Spatial index is a special data structure for points and rectangles that allows you to perform queries like "all items within this bounding box" very efficiently (e.g. hundreds of times faster than looping over all items). It's most commonly used in maps and data visualizations.

RBushは、点と矩形の2次元空間インデクス用の高性能JavaScriptライブラリです。 バルク挿入をサポートする最適化されたRツリーデータ構造に基づいています。空間インデックスは、「このバウンディングボックス内のすべてのアイテム」などのクエリを非常に効率的に実行(例えば、すべてのアイテムをループするより数百倍高速)できるようになる点や矩形の特殊なデータ構造です。 地図やデータの視覚化で最も一般的に使用されます。


textpath
textpathは、「ahocevar/textpath: Renderer agnostic utility for drawing text along a path(https://github.com/ahocevar/textpath)」に次のようにあります。

Renderer agnostic utility for drawing text along a path.
パスに沿ってテキストを描画するためのレンダラに依存しないユーティリティ。


label-segment
label-segmentは、「ahocevar/label-segment: Find suitable segments of a path for its label text (https://github.com/ahocevar/label-segment)」に次のようにあります。

Find suitable segments of a path for its label text.
ラベルテキストのパスの適切なセグメントを探します。


HTML ファイルの作成

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




b 「ファイルを開く」ウィンドウで、「user」->「eclipse-workspace」->「ol4proj」-> 「v4.3.1」->「examples」->「street-labels.html」をクリックして選択し、「OK」ボタンをクリッ クします。
同じように「street-labels.js」を開きます。

(この状態でファイル名をキーボードで打つと検索欄が表示されて候補が絞り込めます。)


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




d 「ファイル」ウィンドウで「ol4proj」->「v4.3.1」->「examples」をクリックして選択し、「ファイル名」を「2171-ol4ex.html」と入力し、「完了」ボタンをクリックします。
(「ファイル」->「新規」->「その他」をクリックし、「ウィザードを選択」ダイアログで「Web」->「HTMLファイル」からテンプレートも作成できます。)






e 「street-labels.html」の内容をコピーして「2171-ol4ex.html」に貼り付け、修正します。

f 同じように、新規に「2171-ol4ex.js」ファイルを作成し、「street-labels.js」の内容をコピーして貼り付け、修正します。「ostreet-labels-require.js」も「2171-ol4ex-require.js」に貼り付けます。
(「ファイル」->「新規」->「JavaScript ソース・ファイル」をクリックし、「新規 JavaScript ファイル」ダイアログでテンプレートも作成できます。)






「2171-ol3ex.html」
<!DOCTYPE html>
<html lang="en-US">
 <head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge">
  <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.min.css" type="text/css">
  <link rel="stylesheet" href="./resources/prism/prism.css" type="text/css">
  <link rel="stylesheet" href="../css/ol.css" type="text/css">
  <link rel="stylesheet" href="./resources/layout.css" type="text/css">

  <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Set""></script>
  <script src="https://unpkg.com/rbush@2.0.1/rbush.min.js"></script>
  <script src="https://unpkg.com/labelgun@0.1.1/lib/labelgun.min.js"></script>
  <script src="https://unpkg.com/textpath@1.0.1/dist/textpath.js"></script>
  <script src="https://unpkg.com/label-segment@1.0.0/dist/label-segment.js"></script>
  <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch,requestAnimationFrame,Element.prototype.classList,URL"></script>
  <script src="./resources/zeroclipboard/ZeroClipboard.min.js"></script>
  <title>Street Labels</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 Examples</a>
    </div>
    <!-- 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 class="active" href="index.html">Examples</a></li>
      <li><a href="../apidoc">API</a></li>
      <li><a href="https://github.com/openlayers/openlayers">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>4.3.1</span>. 
     The <a id="latest-link" href="#" class="alert-link">latest</a>
     is v<span id="latest-version"></span>.
   </div>
   <div class="row-fluid">
    <div class="span12">
     <h4 id="title">Street Labels</h4>
     <div id="map" class="map"></div>
    </div>
   </div>
   <div class="row-fluid">
    <div class="span12">
     <p id="shortdesc">Render street names with a custom 
       render.</p>
     <div id="docs"><p>Example showing the use of a custom 
       renderer to render text along a path. 
       <a href="https://github.com/Geovation/labelgun">
       Labelgun</a> is used to avoid label collisions. 
       <a href="https://github.com/ahocevar/label-segment">
       label-segment</a> makes sure that labels are placed 
       on suitable street segments. 
       <a href="https://github.com/ahocevar/textpath">
       textpath</a> arranges the letters of a label along the 
       geometry. The data is fetched from OSM using the 
       <a href="https://overpass-api.de">Overpass API</a>.</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>
       </li>,
       <li>
        <a href="../apidoc/ol.View.html" title="API documentation for ol.View">ol.View</a>
       </li>,
       <li>
        <a href="../apidoc/ol.extent.html" title="API documentation for ol.extent">ol.extent</a>
       </li>,
       <li>
        <a href="../apidoc/ol.format.OSMXML.html" title="API documentation for ol.format.OSMXML">ol.format.OSMXML</a>
       </li>,
       <li>
        <a href="../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>
       </li>,
       <li>
        <a href="../apidoc/ol.source.BingMaps.html" title="API documentation for ol.source.BingMaps">ol.source.BingMaps</a>
       </li>,
       <li>
        <a href="../apidoc/ol.source.Vector.html" title="API documentation for ol.source.Vector">ol.source.Vector</a>
       </li>,
       <li>
        <a href="../apidoc/ol.style.Style.html" title="API documentation for ol.style.Style">ol.style.Style</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="codepen-button">
      <i class="fa fa-codepen"></i> Edit
     </a>
    </div>
    <form method="POST" id="codepen-form" target="_blank" action="https://codepen.io/pen/define/">
     <textarea class="hidden" name="title">Street Labels</textarea>
     <textarea class="hidden" name="description">Render street names with a custom render.</textarea>
     <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>
  <!-- 
  <script src="loader.js?id=street-labels"></script>
  -->
  <!-- ファイル修正 -->
  <script src="loader.js?id=2171-ol4ex"></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]) && '4.1.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 9 では動作しませんでした。ボタンを右クリックしたときに flash のコンテキストメニューが表示されると動作しています。