「258-ol3ex.js」
var styles = [
/* We are using two different styles for the polygons: * - The first style is for the polygons themselves. * - The second style is to draw the vertices of the * polygons. * In a custom `geometry` function the vertices of a * polygon are returned as `MultiPoint` geometry, * which will be used to render the style. * 私たちは、ポリゴンのための二つの異なるスタイルを使用していま * す: * - 最初のスタイルは、ポリゴン自身のためのものです。 * - 第二のスタイルは、ポリゴンの頂点を描画するためです。 * `geometry`カスタムファンクションでは、ポリゴンの頂点は、ス * タイルを描画するために使用される`MultiPoint`ジオメトリとし * て返されます。 */
new ol.style.Style({
/** ol.style.Style
* Base class for vector feature rendering styles.
* ベクタフィーチャがスタイルを描画するための基本クラス。
* (ol3 API)
*/
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: 'blue', width: 3 }),
fill: new ol.style.Fill({
/** ol.style.Fill
* Set fill style for vector features.
* ベクタフィーチャの塗りつぶしスタイルを設定。(ol3 API)
*/
color: 'rgba(0, 0, 255, 0.1)' }) }),
new ol.style.Style({
image: new ol.style.Circle({
/** ol.style.Circle
* Set circle style for vector features.
* ベクタフィーチャの円のスタイルを設定。(ol3 API)
*/
radius: 5,
fill: new ol.style.Fill({
color: 'orange'
})
}),
geometry: function(feature) {
// return the coordinates of the first ring of the polygon // ポリゴンの最初のリングの座標を返します。
var coordinates = feature.getGeometry().getCoordinates()[0]; /** getGeometry() * Returns the Geometry associated with this feature * using the current geometry name property. By default, * this is geometry but it may be changed by calling * setGeometryName. * 現在のジオメトリネームプロパティを使用して、このフィーチャに * 関連したジオメトリを返します。デフォルトでは、ジオメトリです * が、setGeometryName を呼び出すことによって変更することがで * きます。(ol3 API) */
/** getCoordinates() * Returns: Coordinates.(ol3 API) */
return new ol.geom.MultiPoint(coordinates); /** ol.geom.MultiPoint * Multi-point geometry.(ol3 API) */
} }) ];
var source = new ol.source.GeoJSON(/** @type {olx.source.GeoJSONOptions} */ ({
/** ol.source.GeoJSON
* Static vector source in GeoJSON format
* GeoJSON フォーマットの静的ベクタソース。(ol3 API)
*/
/** @type * 値のタイプ(型)の説明 - 式などで表示 * (@use JSDoc[http://usejsdoc.org/]より) */
object: {
'type': 'FeatureCollection',
'crs': {
'type': 'name',
'properties': {
'name': 'EPSG:3857'
}
},
'features': [
{
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
[-3e6, 6e6], [-5e6, 6e6]]]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [[[-2e6, 6e6], [-2e6, 8e6], [0, 8e6],
[0, 6e6], [-2e6, 6e6]]]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
[3e6, 6e6], [1e6, 6e6]]]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [[[-2e6, -1e6], [-1e6, 1e6],
[0, -1e6], [-2e6, -1e6]]]
}
}
]
}
}));
var layer = new ol.layer.Vector({
/** ol.layer.Vector
* Vector data that is rendered client-side.
* クライアント側で描画されたベクタデータ。(ol3 API)
*/
source: source, style: styles });
var map = new ol.Map({
layers: [layer],
target: 'map',
view: new ol.View({
center: [0, 1000000],
zoom: 2
})
});


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