2015年7月9日木曜日

v3.7.0 がリリースされました

日本時間で(2015.7.3)に v3.7.0 がリリースされました。

Releases v3.7.0 - openlayers/ol3 GitHub
(https://github.com/openlayers/ol3/releases/tag/v3.7.0)より

v3.7.0
Summary

The v3.7.0 release includes features and fixes from 43 pull requests since v3.6.0. To simplify the code base, there were some changes to "experimental" features. Please follow the upgrade notes to make your applications work with the latest release.
3.7.0 リリースは 3.6.0 以降の40のプルリクエスト(訳注:Git でリクエストを出す機能)からの機能と修正が含まれています。コードベースを簡素化するために、「実験的」な機能に変更があります。最新のリリースでアプリケーションを動作させるにはアップグレードの注意事項に従ってください。

Upgrade notes

Removal of ol.FeatureOverlay
Instead of an ol.FeatureOverlay, we now use an ol.layer.Vector with an
ol.source.Vector. If you previously had:
ol.FeatureOverlay の代わりに、現在、ol.source.Vector と共に ol.layer.Vector を使用します。以前持っていたコード(は、):
var featureOverlay = new ol.FeatureOverlay({
 map: map,
 style: overlayStyle
});
featureOverlay.addFeature(feature);
featureOverlay.removeFeature(feature);
var collection = featureOverlay.getFeatures();


you will have to change this to:
次のように変更しなければなりません。
var collection = new ol.Collection();
var featureOverlay = new ol.layer.Vector({
 map: map,
 source: new ol.source.Vector({
  features: collection,
  useSpatialIndex: false // optional, might improve performance
 }),
 style: overlayStyle,
 updateWhileAnimating: true, // optional, for instant visual feedback
 updateWhileInteracting: true // optional, for instant visual feedback
});
featureOverlay.getSource().addFeature(feature);
featureOverlay.getSource().removeFeature(feature);


With the removal of ol.FeatureOverlay, zIndex symbolizer properties of overlays are no longer stacked per map, but per layer/overlay. If you previously had multiple feature overlays where you controlled the rendering order of features by using zIndex symbolizer properties, you can now achieve the same rendering order only if all overlay features are on the same layer.
ol.FeatureOverlay の削除と共に、オーバーレイの zIndex symbolizer 属性は、もはやマップごとにスタック(記憶)されないが、レイヤ/オーバーレイごとにされます。以前、zIndex symbolizer 属性を使用して、機能のレンダリング順序を制御した複数のフィーチャオーバーレイを持っていた場合、現在、すべてのオーバーレイフィーチャは同じレイヤにある場合にのみ、同じレンダリング順序を達成することができます。

Note that ol.FeatureOverlay#getFeatures() returned an {ol.Collection.<ol.Feature>}, whereas ol.source.Vector#getFeatures() returns an {Array.<ol.Feature>}.
ol.FeatureOverlay#getFeatures() は {ol.Collection.<ol.Feature>} を返すのに対して、ol.source.Vector#getFeatures() は {Array.<ol.Feature>} を返しすことに注意してください。


ol.TileCoord changes

Until now, the API exposed two different types of ol.TileCoord tile coordinates: internal ones that increase left to right and upward, and transformed ones that may increase downward, as defined by a transform function on the tile grid. With this change, the API now only exposes tile coordinates that increase left to right and upward.
今までは、 API は ol.TileCoord タイル座標の二つの異なる種類に公開しました:左から右へと上向きに増加する内部のもの、及びタイルグリッドに関する変換関数によって定義された、下方に増加する変換されたものです。この変更により、API は現在、左から右へと上方へ増加するタイル座標だけを公開します。

Previously, tile grids created by OpenLayers either had their origin at the top-left or at the bottom-left corner of the extent. To make it easier for application developers to transform tile coordinates to the common XYZ tiling scheme, all tile grids that OpenLayers creates internally have their origin now at the top-left corner of the extent.
以前は、OpenLayers によって作成されたタイルグリッドは、範囲の左上、または、左下隅いずれかにその起源を持っていました。それが、アプリケーション開発者がタイル座標を共通の XYZ タイルスキーマへ変換できるようにすることを簡単にし、OpenLayersが内部で作成するすべてのタイルグリッドは、現在、範囲の左上隅にその起源を持っています。

This change affects applications that configure a custom tileUrlFunction for an ol.source.Tile. Previously, the tileUrlFunction was called with rather unpredictable tile coordinates, depending on whether a tile coordinate transform took place before calling the tileUrlFunction. Now it is always called with OpenLayers tile coordinates. To transform these into the common XYZ tiling scheme, a custom tileUrlFunction has to change the y value (tile row) of the ol.TileCoord:
この変更は、ol.source.Tile のカスタム tileUrlFunction を設定するアプリケーションに影響します。以前は、tileUrlFunction は、tileUrlFunction を呼び出す前にタイル座標変換が実行されたかどうかによって、むしろ予測不可能なタイル座標で呼び出されました。現在は、常に OpenLayers タイル座標とともに呼び出されます。これらを共通の XYZ タイルスキーマに変換するために、カスタム tileUrlFunction は ol.TileCoord の y 値(タイル行)を変更することがあります。
function tileUrlFunction = function(tileCoord, pixelRatio, projection) {
 var urlTemplate = '{z}/{x}/{y}';
 return urlTemplate
  .replace('{z}', tileCoord[0].toString())
  .replace('{x}', tileCoord[1].toString())
  .replace('{y}', (-tileCoord[2] - 1).toString());
}


The ol.tilegrid.TileGrid#createTileCoordTransform() function which could be used to get the tile grid's tile coordinate transform function has been removed. This function was confusing and should no longer be needed now that application developers get tile coordinates in a known layout.
タイルグリッドのタイル座標変換関数を取得するために使用することができる ol.tilegrid.TileGrid#createTileCoordTransform()関数は削除されました。この関数は、混乱した、これで、アプリケーション開発者が既知のレイアウトのタイル座標を取得することを、現在、もはや必要としません。

The code snippets below show how your application code needs to be changed:
以下のコードスニペットは、アプリケーション·コードを変更する必要がある方法を示しています。

Old application code (with ol.tilegrid.TileGrid#createTileCoordTransform()):
var transform = source.getTileGrid().createTileCoordTransform();
var tileUrlFunction = function(tileCoord, pixelRatio, projection) {
 tileCoord = transform(tileCoord, projection);
 return 'http://mytiles.com/' +
  tileCoord[0] + '/' + tileCoord[1] + '/' + tileCoord[2] + '.png';
};


Old application code (with custom y transform):
var tileUrlFunction = function(tileCoord, pixelRatio, projection) {
 var z = tileCoord[0];
 var yFromBottom = tileCoord[2];
 var resolution = tileGrid.getResolution(z);
 var tileHeight = ol.size.toSize(tileSize)[1];
 var matrixHeight =
  Math.floor(ol.extent.getHeight(extent) / tileHeight / resolution);
 return 'http://mytiles.com/' +
  tileCoord[0] + '/' + tileCoord[1] + '/' +
  (matrixHeight - yFromBottom - 1) + '.png';

};


New application code (simple -y - 1 transform):
var tileUrlFunction = function(tileCoord, pixelRatio, projection) {
 return 'http://mytiles.com/' +
  tileCoord[0] + '/' + tileCoord[1] + '/' + (-tileCoord[2] - 1) + '.png';
};



Removal of ol.tilegrid.Zoomify

The replacement of ol.tilegrid.Zoomify is a plain ol.tilegrid.TileGrid, configured with extent, origin and resolutions. If the size passed to the ol.source.Zoomify source is [width, height], then the extent for the tile grid will be [0, -height, width, 0], and the origin will be [0, 0].
ol.tilegrid.Zoomify の交換は、範囲と原点、解像度で設定された、平易な ol.tilegrid.TileGrid です。 ol.source.Zoomify ソースに渡されたサイズが [width, height] の場合、それにより、タイルグリッドの範囲は [0、-height、width、0]、および、原点は [0,0] です。

Replace ol.View.fitExtent() and ol.View.fitGeometry() with ol.View.fit()
ol.View.fitExtent() は ol.View.fit() を使った ol.View.fitGeometry() に置き換えます。

● This combines two previously distinct functions into one more flexible call which takes either a geometry or an extent.
● Rename all calls to fitExtent and fitGeometry to fit.
● これは2つの以前の異なる関数を組み合わせ、ジオメトリまたは範囲を取得するもうひとつの柔軟な呼び出しにします。
● fitExtent のすべての呼び出しを fitGeometry と fit に置き換えます。


Change to ol.interaction.Modify

When single clicking a line or boundary within the pixelTolerance, a vertex is now created.
pixelTolerance 内のラインまたは境界をkウリックするとき、頂点を作成します。

(New features and fixes リストはサイトをみてください。)


v3.7.0 の examples を試してみます
OpenLayers 3 のホームページ(http://openlayers.org/)の「LATEST」の文中の「v3.7.0」をクリックします。
開いたページ「Downloads for the v3.7.0 release(http://openlayers.org/download/)」の「v3.7.0.zip」ボタンをクリックしてダウンロードします。
展開したフォルダを Eclipse の ol3proj にコピーします。

ディレクトリは次のようにしました。
ol3proj
|-v3.0.0/
|-v3.1.1/
|-v3.2.0/
|-v3.2.1/
|-v3.3.0/
|-v3.4.0/
|-v3.5.0/
|-v3.6.0/
|-v3.7.0/
|-2xx-ol3ex.html
|-2xx-ol3ex.js
|-2xx-ol3ex-require.js
|-loader.js
|-loader-v3.0.0.js
|-loader-v3.1.1.js
|-loader-v3.2.0.js
|-loader-v3.2.1.js
|-loader-v3.3.0.js
|-loader-v3.4.0.js
|-loader-v3.5.0.js

v.3.6.0 の loader.js の名前を loader-v3.6.0.js に変更し、v3.7.0/examples/loader.js を ol3proj 直下にコピーします。
ol3proj
|-v3.0.0/
|-v3.1.1/
|-v3.2.0/
|-v3.2.1/
|-v3.3.0/
|-v3.4.0/
|-v3.5.0/
|-v3.6.0/
|-v3.7.0/
|-2xx-ol3ex.html
|-2xx-ol3ex.js
|-2xx-ol3ex-require.js
|-loader.js
|-loader-v3.0.0.js
|-loader-v3.1.1.js
|-loader-v3.2.0.js
|-loader-v3.2.1.js
|-loader-v3.3.0.js
|-loader-v3.4.0.js
|-loader-v3.5.0.js
|-loader-v3.6.0.js

loader.js の内容を次のように修正します。

---
  if (!raw) {
    // document.write('<scr' + 'ipt type="text/javascript" src="../build/ol.js"></scr' + 'ipt>');
    // ディレクトリ修正
    document.write('<scr' + 'ipt type="text/javascript" src="v3.7.0/build/ol.js"></scr' + 'ipt>');

  } else {
    window.CLOSURE_NO_DEPS = true; // we've got our own deps file
    // document.write('<scr' + 'ipt type="text/javascript" src="../closure-library/closure/goog/base.js"></scr' + 'ipt>');
    // document.write('<scr' + 'ipt type="text/javascript" src="../build/ol-deps.js"></scr' + 'ipt>');
    // ディレクトリ修正
    document.write('<scr' + 'ipt type="text/javascript" src="v3.7.0/closure-library/closure/goog/base.js"></scr' + 'ipt>');
    document.write('<scr' + 'ipt type="text/javascript" src="v3.7.0/build/ol-deps.js"></scr' + 'ipt>');

    document.write('<scr' + 'ipt type="text/javascript" src="' + scriptId + '-require.js"></scr' + 'ipt>');
  }
  document.write('<scr' + 'ipt type="text/javascript" src="' + scriptId + '.js"></scr' + 'ipt>');
}());

0 件のコメント: