/**
l BeNomad BeMap JavaScript API - TextStyle
*/
/**
* @classdesc
* Base class for TextStyle.
* @public
* @constructor
* @param {Object} options See below the available values.
* @param {bemap.Color} options.color Set the volor of text.
* @param {int} options.size Set the size of text.
* @param {int} options.offsetX Set the offset X of text.
* @param {int} options.offsetY Set the offset Y of text.
* @param {bemap.Color} options.borderColor Set the color of text border.
* @param {int} options.borderWidth Set the Width of text border in pixels.
* @param {Boolean} options.type define the type of the line.
*/
bemap.TextStyle = function(options) {
var opts = options || {};
/**
* @type {Object}
* @protected
*/
this.native = null;
/**
* Color of text.
* @type {bemap.Color}
* @protected
*/
this.color = opts.color ? opts.color : new bemap.Color(0, 0, 0);
/**
* Width of text border.
* @type {int}
* @protected
*/
this.size = opts.size ? opts.size : 1;
/**
* offset X of text in pixels.
* @type {int}
* @protected
*/
this.offsetX = opts.offsetX ? opts.offsetX : 0;
/**
* offset Y of text in pixels.
* @type {int}
* @protected
*/
this.offsetY = opts.offsetY ? opts.offsetY : 0;
/**
* Color of text border.
* @type {bemap.Color}
* @protected
*/
this.borderColor = opts.borderColor ? opts.borderColor : new bemap.Color(255, 255, 255);
/**
* Width of text border.
* @type {int}
* @protected
*/
this.borderWidth = opts.borderWidth ? opts.borderWidth : 2;
};
/**
* Return the color of text.
* @return {bemap.Color} Return the color of text.
*/
bemap.TextStyle.prototype.getColor = function() {
return this.color;
};
/**
* Set the color of text.
* @param {bemap.Color} color the new color of text to set.
* @return {bemap.TextStyle} Return this.
*/
bemap.TextStyle.prototype.setColor = function(color) {
if (color && bemap.inheritsof(color, bemap.Color)) {
this.color = color;
}
return this;
};
/**
* Return the size of text.
* @return {int} Return the size of text.
*/
bemap.TextStyle.prototype.getSize = function() {
return this.size;
};
/**
* Set the size of text.
* @param {int} color the new size of text to set.
* @return {bemap.TextStyle} Return this.
*/
bemap.TextStyle.prototype.setSize = function(size) {
this.size = size;
return this;
};
/**
* Return the offset X of text.
* @return {int} Return the offset X of text.
*/
bemap.TextStyle.prototype.getOffsetX = function() {
return this.offsetX;
};
/**
* Set the offset X of text.
* @param {int} offsetX the new offset X of text to set.
* @return {bemap.TextStyle} Return this.
*/
bemap.TextStyle.prototype.setOffsetX = function(offsetX) {
this.offsetX = offsetX;
return this;
};
/**
* Return the offset Y of text.
* @return {int} Return the offset Y of text.
*/
bemap.TextStyle.prototype.getOffsetY = function() {
return this.offsetY;
};
/**
* Set the offset Y of text.
* @param {int} offsetY the new offset Y of text to set.
* @return {bemap.TextStyle} Return this.
*/
bemap.TextStyle.prototype.setOffsetY = function(offsetY) {
this.offsetY = offsetY;
return this;
};
/**
* Return the color of text border.
* @return {bemap.Color} Return the color of text border.
*/
bemap.TextStyle.prototype.getBorderColor = function() {
return this.borderColor;
};
/**
* Set the color of text border.
* @param {bemap.Color} borderColor the new color of text border to set.
* @return {bemap.TextStyle} Return this.
*/
bemap.TextStyle.prototype.setBorderColor = function(borderColor) {
if (borderColor && bemap.inheritsof(borderColor, bemap.Color)) {
this.borderColor = borderColor;
}
return this;
};
/**
* Return the width of text border in pixels.
* @return {int} Return the width of text border in pixels.
*/
bemap.TextStyle.prototype.getBorderWidth = function() {
return this.borderWidth;
};
/**
* Set the width of text border in pixels.
* @param {int} borderWidth the new width of text border to set (in pixels).
* @return {bemap.TextStyle} Return this.
*/
bemap.TextStyle.prototype.setBorderWidth = function(borderWidth) {
this.borderWidth = borderWidth;
return this;
};