Rename symbol to shape

This commit is contained in:
Éric Lemoine
2013-11-11 20:27:24 +01:00
committed by Tom Payne
parent ac2b650c96
commit 60ef4f214e
7 changed files with 12 additions and 12 deletions

View File

@@ -3,8 +3,8 @@ goog.require('ol.RendererHint');
goog.require('ol.View2D'); goog.require('ol.View2D');
goog.require('ol.geom.MultiPoint'); goog.require('ol.geom.MultiPoint');
goog.require('ol.layer.Tile'); goog.require('ol.layer.Tile');
goog.require('ol.shape');
goog.require('ol.source.MapQuestOpenAerial'); goog.require('ol.source.MapQuestOpenAerial');
goog.require('ol.symbol');
var map = new ol.Map({ var map = new ol.Map({
@@ -24,7 +24,7 @@ map.beforeRender(function(map, frameState) {
frameState.animate = true; frameState.animate = true;
return true; return true;
}); });
var imageStyle = ol.symbol.renderCircle(5, { var imageStyle = ol.shape.renderCircle(5, {
color: 'yellow' color: 'yellow'
}, { }, {
color: 'red', color: 'red',

View File

@@ -6,13 +6,13 @@ goog.require('ol.format.GeoJSON');
goog.require('ol.geom.LineString'); goog.require('ol.geom.LineString');
goog.require('ol.layer.Tile'); goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector'); goog.require('ol.layer.Vector');
goog.require('ol.shape');
goog.require('ol.source.OSM'); goog.require('ol.source.OSM');
goog.require('ol.source.Vector'); goog.require('ol.source.Vector');
goog.require('ol.style.DefaultStyleFunction'); goog.require('ol.style.DefaultStyleFunction');
goog.require('ol.symbol');
var image = ol.symbol.renderCircle(5, null, {color: 'red', width: 1}); var image = ol.shape.renderCircle(5, null, {color: 'red', width: 1});
var styleFunction = function(feature) { var styleFunction = function(feature) {
switch (feature.getGeometry().getType()) { switch (feature.getGeometry().getType()) {
case ol.geom.Type.POINT: case ol.geom.Type.POINT:

View File

@@ -8,9 +8,9 @@ goog.require('ol.extent');
goog.require('ol.geom.Point'); goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon'); goog.require('ol.geom.Polygon');
goog.require('ol.layer.Vector'); goog.require('ol.layer.Vector');
goog.require('ol.shape');
goog.require('ol.source.Vector'); goog.require('ol.source.Vector');
goog.require('ol.structs.RTree'); goog.require('ol.structs.RTree');
goog.require('ol.symbol');
/** /**
@@ -58,7 +58,7 @@ var vectorSource = new ol.source.Vector({
}); });
var style = { var style = {
image: ol.symbol.renderCircle(3, null, {color: 'red', width: 1}) image: ol.shape.renderCircle(3, null, {color: 'red', width: 1})
}; };
var colors = ['red', 'orange', 'yellow', 'blue', 'green', 'indigo', 'violet']; var colors = ['red', 'orange', 'yellow', 'blue', 'green', 'indigo', 'violet'];

View File

@@ -5,8 +5,8 @@ goog.require('ol.RendererHint');
goog.require('ol.View2D'); goog.require('ol.View2D');
goog.require('ol.geom.Point'); goog.require('ol.geom.Point');
goog.require('ol.layer.Vector'); goog.require('ol.layer.Vector');
goog.require('ol.shape');
goog.require('ol.source.Vector'); goog.require('ol.source.Vector');
goog.require('ol.symbol');
var count = 20000; var count = 20000;
@@ -23,11 +23,11 @@ for (var i = 0; i < count; ++i) {
var styles = { var styles = {
'10': { '10': {
image: ol.symbol.renderCircle( image: ol.shape.renderCircle(
5, {color: '#666666'}, {color: '#bada55', width: 1}) 5, {color: '#666666'}, {color: '#bada55', width: 1})
}, },
'20': { '20': {
image: ol.symbol.renderCircle( image: ol.shape.renderCircle(
10, {color: '#666666'}, {color: '#bada55', width: 1}) 10, {color: '#666666'}, {color: '#bada55', width: 1})
} }
}; };

1
src/ol/shape.exports Normal file
View File

@@ -0,0 +1 @@
@exportSymbol ol.shape.renderCircle

View File

@@ -2,7 +2,7 @@
// FIXME move to ol.render? // FIXME move to ol.render?
// FIXME find a sensible caching strategy // FIXME find a sensible caching strategy
goog.provide('ol.symbol'); goog.provide('ol.shape');
goog.require('goog.dom'); goog.require('goog.dom');
goog.require('goog.dom.TagName'); goog.require('goog.dom.TagName');
@@ -15,7 +15,7 @@ goog.require('ol.style');
* @param {?ol.style.Stroke} strokeStyle Stroke style. * @param {?ol.style.Stroke} strokeStyle Stroke style.
* @return {ol.style.Image} Image. * @return {ol.style.Image} Image.
*/ */
ol.symbol.renderCircle = function(radius, fillStyle, strokeStyle) { ol.shape.renderCircle = function(radius, fillStyle, strokeStyle) {
var canvas = /** @type {HTMLCanvasElement} */ var canvas = /** @type {HTMLCanvasElement} */
(goog.dom.createElement(goog.dom.TagName.CANVAS)); (goog.dom.createElement(goog.dom.TagName.CANVAS));

View File

@@ -1 +0,0 @@
@exportSymbol ol.symbol.renderCircle