Rename _ol_render_webgl_TextReplay_ to WebGLTextReplay
This commit is contained in:
@@ -11,7 +11,7 @@ import WebGLCircleReplay from '../webgl/CircleReplay.js';
|
|||||||
import WebGLImageReplay from '../webgl/ImageReplay.js';
|
import WebGLImageReplay from '../webgl/ImageReplay.js';
|
||||||
import WebGLLineStringReplay from '../webgl/LineStringReplay.js';
|
import WebGLLineStringReplay from '../webgl/LineStringReplay.js';
|
||||||
import WebGLPolygonReplay from '../webgl/PolygonReplay.js';
|
import WebGLPolygonReplay from '../webgl/PolygonReplay.js';
|
||||||
import _ol_render_webgl_TextReplay_ from '../webgl/TextReplay.js';
|
import WebGLTextReplay from '../webgl/TextReplay.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
@@ -321,6 +321,6 @@ WebGLReplayGroup.BATCH_CONSTRUCTORS_ = {
|
|||||||
'Image': WebGLImageReplay,
|
'Image': WebGLImageReplay,
|
||||||
'LineString': WebGLLineStringReplay,
|
'LineString': WebGLLineStringReplay,
|
||||||
'Polygon': WebGLPolygonReplay,
|
'Polygon': WebGLPolygonReplay,
|
||||||
'Text': _ol_render_webgl_TextReplay_
|
'Text': WebGLTextReplay
|
||||||
};
|
};
|
||||||
export default WebGLReplayGroup;
|
export default WebGLReplayGroup;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import _ol_webgl_Buffer_ from '../../webgl/Buffer.js';
|
|||||||
* @param {ol.Extent} maxExtent Max extent.
|
* @param {ol.Extent} maxExtent Max extent.
|
||||||
* @struct
|
* @struct
|
||||||
*/
|
*/
|
||||||
const _ol_render_webgl_TextReplay_ = function(tolerance, maxExtent) {
|
const WebGLTextReplay = function(tolerance, maxExtent) {
|
||||||
WebGLTextureReplay.call(this, tolerance, maxExtent);
|
WebGLTextureReplay.call(this, tolerance, maxExtent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,13 +114,13 @@ const _ol_render_webgl_TextReplay_ = function(tolerance, maxExtent) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inherits(_ol_render_webgl_TextReplay_, WebGLTextureReplay);
|
inherits(WebGLTextReplay, WebGLTextureReplay);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_render_webgl_TextReplay_.prototype.drawText = function(geometry, feature) {
|
WebGLTextReplay.prototype.drawText = function(geometry, feature) {
|
||||||
if (this.text_) {
|
if (this.text_) {
|
||||||
let flatCoordinates = null;
|
let flatCoordinates = null;
|
||||||
const offset = 0;
|
const offset = 0;
|
||||||
@@ -208,7 +208,7 @@ _ol_render_webgl_TextReplay_.prototype.drawText = function(geometry, feature) {
|
|||||||
* @param {Array.<string>} lines Label to draw split to lines.
|
* @param {Array.<string>} lines Label to draw split to lines.
|
||||||
* @return {Array.<number>} Size of the label in pixels.
|
* @return {Array.<number>} Size of the label in pixels.
|
||||||
*/
|
*/
|
||||||
_ol_render_webgl_TextReplay_.prototype.getTextSize_ = function(lines) {
|
WebGLTextReplay.prototype.getTextSize_ = function(lines) {
|
||||||
const self = this;
|
const self = this;
|
||||||
const glyphAtlas = this.currAtlas_;
|
const glyphAtlas = this.currAtlas_;
|
||||||
const textHeight = lines.length * glyphAtlas.height;
|
const textHeight = lines.length * glyphAtlas.height;
|
||||||
@@ -239,7 +239,7 @@ _ol_render_webgl_TextReplay_.prototype.getTextSize_ = function(lines) {
|
|||||||
* @param {number} end End.
|
* @param {number} end End.
|
||||||
* @param {number} stride Stride.
|
* @param {number} stride Stride.
|
||||||
*/
|
*/
|
||||||
_ol_render_webgl_TextReplay_.prototype.drawText_ = function(flatCoordinates, offset,
|
WebGLTextReplay.prototype.drawText_ = function(flatCoordinates, offset,
|
||||||
end, stride) {
|
end, stride) {
|
||||||
let i, ii;
|
let i, ii;
|
||||||
for (i = offset, ii = end; i < ii; i += stride) {
|
for (i = offset, ii = end; i < ii; i += stride) {
|
||||||
@@ -252,7 +252,7 @@ _ol_render_webgl_TextReplay_.prototype.drawText_ = function(flatCoordinates, off
|
|||||||
* @private
|
* @private
|
||||||
* @param {string} char Character.
|
* @param {string} char Character.
|
||||||
*/
|
*/
|
||||||
_ol_render_webgl_TextReplay_.prototype.addCharToAtlas_ = function(char) {
|
WebGLTextReplay.prototype.addCharToAtlas_ = function(char) {
|
||||||
if (char.length === 1) {
|
if (char.length === 1) {
|
||||||
const glyphAtlas = this.currAtlas_;
|
const glyphAtlas = this.currAtlas_;
|
||||||
const state = this.state_;
|
const state = this.state_;
|
||||||
@@ -302,7 +302,7 @@ _ol_render_webgl_TextReplay_.prototype.addCharToAtlas_ = function(char) {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_render_webgl_TextReplay_.prototype.finish = function(context) {
|
WebGLTextReplay.prototype.finish = function(context) {
|
||||||
const gl = context.getGL();
|
const gl = context.getGL();
|
||||||
|
|
||||||
this.groupIndices.push(this.indices.length);
|
this.groupIndices.push(this.indices.length);
|
||||||
@@ -347,7 +347,7 @@ _ol_render_webgl_TextReplay_.prototype.finish = function(context) {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_render_webgl_TextReplay_.prototype.setTextStyle = function(textStyle) {
|
WebGLTextReplay.prototype.setTextStyle = function(textStyle) {
|
||||||
const state = this.state_;
|
const state = this.state_;
|
||||||
const textFillStyle = textStyle.getFill();
|
const textFillStyle = textStyle.getFill();
|
||||||
const textStrokeStyle = textStyle.getStroke();
|
const textStrokeStyle = textStyle.getStroke();
|
||||||
@@ -400,7 +400,7 @@ _ol_render_webgl_TextReplay_.prototype.setTextStyle = function(textStyle) {
|
|||||||
* @param {Object} state Font attributes.
|
* @param {Object} state Font attributes.
|
||||||
* @return {ol.WebglGlyphAtlas} Glyph atlas.
|
* @return {ol.WebglGlyphAtlas} Glyph atlas.
|
||||||
*/
|
*/
|
||||||
_ol_render_webgl_TextReplay_.prototype.getAtlas_ = function(state) {
|
WebGLTextReplay.prototype.getAtlas_ = function(state) {
|
||||||
let params = [];
|
let params = [];
|
||||||
let i;
|
let i;
|
||||||
for (i in state) {
|
for (i in state) {
|
||||||
@@ -436,7 +436,7 @@ _ol_render_webgl_TextReplay_.prototype.getAtlas_ = function(state) {
|
|||||||
* @param {Array.<string|number>} params Array of parameters.
|
* @param {Array.<string|number>} params Array of parameters.
|
||||||
* @return {string} Hash string.
|
* @return {string} Hash string.
|
||||||
*/
|
*/
|
||||||
_ol_render_webgl_TextReplay_.prototype.calculateHash_ = function(params) {
|
WebGLTextReplay.prototype.calculateHash_ = function(params) {
|
||||||
//TODO: Create a more performant, reliable, general hash function.
|
//TODO: Create a more performant, reliable, general hash function.
|
||||||
let i, ii;
|
let i, ii;
|
||||||
let hash = '';
|
let hash = '';
|
||||||
@@ -450,7 +450,7 @@ _ol_render_webgl_TextReplay_.prototype.calculateHash_ = function(params) {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_render_webgl_TextReplay_.prototype.getTextures = function(opt_all) {
|
WebGLTextReplay.prototype.getTextures = function(opt_all) {
|
||||||
return this.textures_;
|
return this.textures_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -458,7 +458,7 @@ _ol_render_webgl_TextReplay_.prototype.getTextures = function(opt_all) {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_render_webgl_TextReplay_.prototype.getHitDetectionTextures = function() {
|
WebGLTextReplay.prototype.getHitDetectionTextures = function() {
|
||||||
return this.textures_;
|
return this.textures_;
|
||||||
};
|
};
|
||||||
export default _ol_render_webgl_TextReplay_;
|
export default WebGLTextReplay;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import {createCanvasContext2D} from '../../../../../src/ol/dom.js';
|
import {createCanvasContext2D} from '../../../../../src/ol/dom.js';
|
||||||
import Point from '../../../../../src/ol/geom/Point.js';
|
import Point from '../../../../../src/ol/geom/Point.js';
|
||||||
import _ol_render_webgl_TextReplay_ from '../../../../../src/ol/render/webgl/TextReplay.js';
|
import WebGLTextReplay from '../../../../../src/ol/render/webgl/TextReplay.js';
|
||||||
import Fill from '../../../../../src/ol/style/Fill.js';
|
import Fill from '../../../../../src/ol/style/Fill.js';
|
||||||
import Stroke from '../../../../../src/ol/style/Stroke.js';
|
import Stroke from '../../../../../src/ol/style/Stroke.js';
|
||||||
import Text from '../../../../../src/ol/style/Text.js';
|
import Text from '../../../../../src/ol/style/Text.js';
|
||||||
@@ -28,7 +28,7 @@ describe('ol.render.webgl.TextReplay', function() {
|
|||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
const tolerance = 0.1;
|
const tolerance = 0.1;
|
||||||
const maxExtent = [-10000, -20000, 10000, 20000];
|
const maxExtent = [-10000, -20000, 10000, 20000];
|
||||||
replay = new _ol_render_webgl_TextReplay_(tolerance, maxExtent);
|
replay = new WebGLTextReplay(tolerance, maxExtent);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#setTextStyle', function() {
|
describe('#setTextStyle', function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user