OpenLayersのLayer Class Methodsについて[Chapter 9]

OpenLayersを使ってみる。[Chapter 9]

OpenLayersのLayer Objectについて[Chapter 8] に引き続き、OpenLayersのLayer Class Mtthodについて学んでみます。
OpenLayers 2.10 Beginner's Guideなる書籍の章立てにあわせて、OpenLayersの使い方を学んでいきます。

本Blog中のsource code等に関しては、あくまでも参考としてください。なにがあっても責任とれませんので。

Layer Class Method

ここまでで、Layer Classを学んできました。
ここでLayerの最後は、Base Layerの機能とmethodです。

Layer Class Methodの定義

非常に多くのlayer Class Methodがあります。
とりえず、原文のまま載せておきます。 日本語に訳せば良いのでしょうが、それほど難しいものはないので、各自翻訳にtryしてみてください。こちらのOpenLayers.Layer methodが非常に参考になります。先人に感謝です。

Function Description/Action parameters Return Value
setName( newName ) Set a new name for the layer based on the passed in string. This will also update the display name for the layer in the layer switcher control, and may trigger a changelayer event. newName:{String} The new name of the layer. -
addOptions( options ) Add additional options to the layer. The parameter behaves like the options parameter, and allows you to set properties on the layer. options: {Object} An anonymous object containing key:value pairs of layer properties and values. -
redraw() Redraws the layer.Returns true if the layer was successfully redrawn or false if the layer could not be redrawn.You will need to call thiswhile adding features to a vector layer, as we'll cover in Chapter 9. - {Boolean}
getVisibility() Checks if the layer is visible or not. Returns true if the layer is visible, false if not. - {Boolean}
SetVisibility( visibility ) Sets the visibility to true or false, hide/show the layer, and redraw it. The visibility determines if a layer should be shown or not. visibility:{Boolean} true to show the layer,false to hide the layer. -
calculateInRange() Returns true or false if the layer can be displayed at the map's current resolution. If the alwaysInRange property is true, this will always return true. - {Boolean}
setIsBaseLayer( is_base ) Will turn the layer into a base layer if true is passed in and false is passed in it will no longer make it a base layer. is_base: {Boolean} Set to true to make layer a base layer, false to make it an overlay layer. -
setOpacity( opacity ) Sets the opacity of a layer based on the value passed in. The passed in opacity value is a float with valid values from 0 to 1, with 0 being completely ransparent and 1 being fully opaque. 0.5 would be 50 percent transparent. opacity: {Float} Value of desired opacity. -



OpenLayersによるLayer Class Methodの基本を学びました。
次回は、Layerの最後で、Map Tilesについて学んでいきます。

そこんところ ヨロシク~~!!

OpenLayers Tutorialの目次に戻る。

Comments are closed.

Social Widgets powered by