Improve docs for style
This commit is contained in:
@@ -21,7 +21,9 @@ goog.require('ol.style.Style');
|
||||
* attribute properties, similar to the features in vector file formats like
|
||||
* GeoJSON.
|
||||
*
|
||||
* Features can be styled individually or use the style of their vector layer.
|
||||
* Features can be styled individually with `setStyle`; otherwise they use the
|
||||
* style of their vector layer or feature overlay.
|
||||
*
|
||||
* Note that attribute properties are set as {@link ol.Object} properties on
|
||||
* the feature object, so they are observable, and have get/set accessors.
|
||||
*
|
||||
@@ -176,9 +178,9 @@ ol.Feature.prototype.getGeometryName = function() {
|
||||
|
||||
/**
|
||||
* @return {ol.style.Style|Array.<ol.style.Style>|
|
||||
* ol.feature.FeatureStyleFunction} Return the style provided in the
|
||||
* constructor options or the last call to setStyle in the same format
|
||||
* that it was provided in.
|
||||
* ol.feature.FeatureStyleFunction} Return the style as set by setStyle in
|
||||
* the same format that it was provided in. If setStyle has not been run,
|
||||
* return `undefined`.
|
||||
* @api
|
||||
*/
|
||||
ol.Feature.prototype.getStyle = function() {
|
||||
|
||||
@@ -1,3 +1,80 @@
|
||||
/**
|
||||
* Feature styles.
|
||||
*
|
||||
* If no style is defined, the following default style is used:
|
||||
* ```js
|
||||
* var fill = new ol.style.Fill({
|
||||
* color: 'rgba(255,255,255,0.4)'
|
||||
* });
|
||||
* var stroke = new ol.style.Stroke({
|
||||
* color: '#3399CC',
|
||||
* width: 1.25
|
||||
* });
|
||||
* var styles = [
|
||||
* new ol.style.Style({
|
||||
* image: new ol.style.Circle({
|
||||
* fill: fill,
|
||||
* stroke: stroke,
|
||||
* radius: 5
|
||||
* }),
|
||||
* fill: fill,
|
||||
* stroke: stroke
|
||||
* })
|
||||
* ];
|
||||
* ```
|
||||
*
|
||||
* A separate editing style has the following defaults:
|
||||
* ```js
|
||||
* var white = [255, 255, 255, 1];
|
||||
* var blue = [0, 153, 255, 1];
|
||||
* var width = 3;
|
||||
* styles[ol.geom.GeometryType.POLYGON] = [
|
||||
* new ol.style.Style({
|
||||
* fill: new ol.style.Fill({
|
||||
* color: [255, 255, 255, 0.5]
|
||||
* })
|
||||
* })
|
||||
* ];
|
||||
* styles[ol.geom.GeometryType.MULTI_POLYGON] =
|
||||
* styles[ol.geom.GeometryType.POLYGON];
|
||||
* styles[ol.geom.GeometryType.LINE_STRING] = [
|
||||
* new ol.style.Style({
|
||||
* stroke: new ol.style.Stroke({
|
||||
* color: white,
|
||||
* width: width + 2
|
||||
* })
|
||||
* }),
|
||||
* new ol.style.Style({
|
||||
* stroke: new ol.style.Stroke({
|
||||
* color: blue,
|
||||
* width: width
|
||||
* })
|
||||
* })
|
||||
* ];
|
||||
* styles[ol.geom.GeometryType.MULTI_LINE_STRING] =
|
||||
* styles[ol.geom.GeometryType.LINE_STRING];
|
||||
* styles[ol.geom.GeometryType.POINT] = [
|
||||
* new ol.style.Style({
|
||||
* image: new ol.style.Circle({
|
||||
* radius: width * 2,
|
||||
* fill: new ol.style.Fill({
|
||||
* color: blue
|
||||
* }),
|
||||
* stroke: new ol.style.Stroke({
|
||||
* color: white,
|
||||
* width: width / 2
|
||||
* })
|
||||
* }),
|
||||
* zIndex: Infinity
|
||||
* })
|
||||
* ];
|
||||
* styles[ol.geom.GeometryType.MULTI_POINT] =
|
||||
* styles[ol.geom.GeometryType.POINT];
|
||||
* styles[ol.geom.GeometryType.GEOMETRY_COLLECTION] =
|
||||
* styles[ol.geom.GeometryType.POLYGON].concat(
|
||||
* styles[ol.geom.GeometryType.POINT]
|
||||
* );
|
||||
*```
|
||||
*
|
||||
* @namespace ol.style
|
||||
*/
|
||||
|
||||
@@ -7,6 +7,9 @@ goog.require('ol.color');
|
||||
/**
|
||||
* @classdesc
|
||||
* 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.
|
||||
*
|
||||
* @constructor
|
||||
* @param {olx.style.StrokeOptions=} opt_options Options.
|
||||
|
||||
Reference in New Issue
Block a user