「290-ol3ex.js」
var atlasManager = new ol.style.AtlasManager({
/** ol.style.AtlasManager(opt_options)
* Manages the creation of image atlases.
* Images added to this manager will be inserted into
* an atlas, which will be used for rendering. The
* size given in the constructor is the size for the
* first atlas. After that, when new atlases are
* created, they will have twice the size as the
* latest atlas (until maxSize is reached).
* If an application uses many images or very large
* images, it is recommended to set a higher size
* value to avoid the creation of too many atlases.
* 画像アトラスの作成を管理します。
* このマネージャに追加された画像は、レンダリングするために
* 使用されるアトラス内に挿入されます。コンストラクタで指定
* されたサイズは、最初のアトラスのためのサイズです。その後、
* 新しいアトラスが作成されたとき、それらは、(maxSize に
* 到達するまで)最後のアトラスの倍のサイズがあります。
* アプリケーションが多くの画像または非常に大きな画像を使用
* している場合、あまりにも多くのアトラスの作成を避けるため
* に、より高いサイズの値を設定することを推奨します。
* (ol3 API[説明は Stable Only のチェックを外すと表示])
*/
/** we increase the initial size so that all symbols * fit into a single atlas image. * すべてのシンボルが単一のアトラス画像に修めるために、初期 * サイズを増やします。 */
initialSize: 512 });
var symbolInfo = [{
opacity: 1.0,
scale: 1.0,
fillColor: 'rgba(255, 153, 0, 0.4)',
strokeColor: 'rgba(255, 204, 0, 0.2)'
}, {
opacity: 0.75,
scale: 1.25,
fillColor: 'rgba(70, 80, 224, 0.4)',
strokeColor: 'rgba(12, 21, 138, 0.2)'
}, {
opacity: 0.5,
scale: 1.5,
fillColor: 'rgba(66, 150, 79, 0.4)',
strokeColor: 'rgba(20, 99, 32, 0.2)'
}, {
opacity: 1.0,
scale: 1.0,
fillColor: 'rgba(176, 61, 35, 0.4)',
strokeColor: 'rgba(145, 43, 20, 0.2)'
}];
var radiuses = [3, 6, 9, 15, 19, 25];
var symbolCount = symbolInfo.length * radiuses.length * 2;
var symbols = [];
var i, j;
for (i = 0; i < symbolInfo.length; ++i) {
var info = symbolInfo[i];
for (j = 0; j < radiuses.length; ++j) {
// circle symbol
symbols.push(new ol.style.Circle({
/** push(elem)
* Insert the provided element at the end of the
* collection.
* コレクションの最後に供給されたエレメントに挿入します。
* Name: elem, Type: T, Description: Element
* (ol3 API)
*/
/** ol.style.Circle * Set circle style for vector features. * ベクタフィーチャの円のスタイルを設定。(ol3 API) */
opacity: info.opacity, scale: info.scale, radius: radiuses[j],
fill: new ol.style.Fill({
/** ol.style.Fill
* Set fill style for vector features.
* ベクタフィーチャの塗りつぶしスタイルを設定。(ol3 API)
*/
color: info.fillColor }),
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: info.strokeColor, width: 1 }),
/** by passing the atlas manager to the symbol, * the symbol will be added to an atlas. * シンボルにアトラスマネージャを通すことによって、 * シンボルはアトラスに追加されます。 */
atlasManager: atlasManager }));
// star symbol
symbols.push(new ol.style.RegularShape({
/** ol.style.RegularShape
* Set regular shape style for vector features. The
* resulting shape will be a regular polygon when
* radius is provided, or a star when radius1 and
* radius2 are provided.
* ベクタフィーチャの規則的な形状のスタイルを設定します。生じた
* 形状は、radius が提供されたとき正多角形になり、または、
* radius1 と radius2 が提供されたとき星形になります。
* (ol3 API)
*/
points: 8, /** points: * Number of points for stars and regular polygons. * In case of a polygon, the number of points is * the number of sides. * 星形と正多角形の点の数。ポリゴンの場合、点の数は辺の数です。 * (ol3 API[説明は Stable Only のチェックを外すと表示]) */
opacity: info.opacity, scale: info.scale,
radius: radiuses[j], /** radius: * Radius of a regular polygon. *(ol3 API[説明は Stable Only のチェックを外すと表示]) */
radius2: radiuses[j] * 0.7, /** radius2: * Outer radius of a star. *(ol3 API[説明は Stable Only のチェックを外すと表示]) */
angle: 1.4, /** angle: * Shape's angle in radians. A value of 0 will * have one of the shape's point facing up. * Default value is 0. * ラジウス単位の形状の角度。値 0 は、表を上にした一つの * 形状の点です。デフォル値は 0 です。 * (ol3 API[説明は Stable Only のチェックを外すと表示]) */
fill: new ol.style.Fill({
// Fill style.(ol3 API)
color: info.fillColor
}),
stroke: new ol.style.Stroke({
// Stroke style.(ol3 API)
color: info.strokeColor,
width: 1
}),
atlasManager: atlasManager
}));
}
}
var featureCount = 50000;
var features = new Array(featureCount); /** Array(arraylength) * JavaScript は配列を扱うことができます。配列とは順序を持つ複数 * のデータの集合であり、JavaScript のグローバルオブジェクトであ * る Array は、高位の、(C言語等で云うところの)「リスト」の様 * な、配列のコンストラクタです。 * arraylength * Array コンストラクタに渡される唯一の引数(arrayLength)に 0 * から 4,294,967,295( 232-1 ) までの整数値を指定する場合は、そ * の値を要素数とする配列が作成されます。その際に範囲外の値を指 * 定した場合には、例外: RangeError がスローされます。 * (MDN[https://developer.mozilla.org/ja/docs/Web/ * JavaScript/Reference/Global_Objects/Array]) */
var feature, geometry;
var e = 25000000;
for (i = 0; i < featureCount; ++i) {
geometry = new ol.geom.Point( /** ol.geom.Point * Point geometry.(ol3 API) */
[2 * e * Math.random() - e, 2 * e * Math.random() - e]); /** Math.random() * The Math.random() function returns a floating-point, * pseudo-random number in the range [0, 1) that is, * from 0 (inclusive) up to but not including 1 * (exclusive), which you can then scale to your * desired range. The implementation selects the * initial seed to the random number generation * algorithm; it cannot be chosen or reset by the * user. * Math.random() 関数は浮動小数点を返し、0 と 1 の範囲の * 擬似乱数、すなわち 0 以上 1 未満、で、任意の範囲に合わせ * ることができます。インプリメンテーションは、乱数発生アル * ゴリズムのためにイニシャルシードを選択しますが、ユーザが * 選んだりリセットできません。 * (MDN[https://developer.mozilla.org/en-US/docs/Web/ * JavaScript/Reference/Global_Objects/Math/random]) */
feature = new ol.Feature(geometry); /** ol.Feature * A vector object for geographic features with a geometry * and other attribute properties, similar to the features * in vector file formats like GeoJSON. * GeoJSONのようなベクトルファイル形式のフィーチャに類似した、 * ジオメトリとその他の属性プロパティを持つ地物フィーチャのため * のベクトルオブジェクト。(ol3 API) */
feature.setStyle( /** setStyle * Set the style for the feature. This can be a * single style object, an array of styles, or a * function that takes a resolution and returns an * array of styles. If it is null the feature has * no style (a null style). * フィーチャのスタイルを設定します。これは、単一のスタイル * オブジェクト、スタイルの配列、または、解像度を取りスタイ * ルの配列を返す関数とすることができます。それが null の * 場合フィーチャは、スタイル(ヌルスタイル)を持っていませ * ん。(ol3 API) */
new ol.style.Style({
/** ol.style.Style
* Base class for vector feature rendering styles.
* ベクタフィーチャがスタイルを描画するための基本クラス。
* (ol3 API)
*/
image: symbols[i % symbolCount] /** %(モジュロ) * 二項演算子です。2 つのオペランドで除算したときの、整数の余 * りを返します。 * (MDN[https://developer.mozilla.org/ja/docs/Web/ * JavaScript/Guide/Expressions_and_Operators]) */
}) ); features[i] = feature; }
var vectorSource = new ol.source.Vector({
/*: ol.source.Vector
* Provides a source of features for vector layers.
* ベクタレイヤのフィーチャのソースを提供します。(ol3 API)
*/
features: features
});
var vector = new ol.layer.Vector({
source: vectorSource
});
// Use the "webgl" renderer by default.
var renderer = exampleNS.getRendererFromQueryString(); /** 'example-behavior.js' により URL にある renderer を返します */
if (!renderer) {
renderer = 'webgl';
}
var map = new ol.Map({
renderer: renderer,
layers: [vector],
target: document.getElementById('map'),
view: new ol.View({
center: [0, 0],
zoom: 4
})
});


0 件のコメント:
コメントを投稿