/* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ import {SuperMap} from '../SuperMap'; import {Util} from '../commontypes/Util'; /** * @class SuperMap.ThemeStyle * @classdesc 客æ·ç«¯ä¸é¢å¾é£æ ¼ç±»ã * @category Visualization Theme * @param {Object} options - å¯éåæ°ã * @param {boolean} [options.fill=true] - æ¯å¦å¡«å ï¼ä¸éè¦å¡«å å设置为 falseã妿 fill ä¸ stroke åæ¶ä¸º falseï¼å°æ fill ä¸ stroke çé»è®¤å¼æ¸²æå¾å±ã * @param {string} [options.fillColor='#000000'] - åå è¿å¶å¡«å é¢è²ã * @param {number} [options.fillOpacity=1] - å¡«å ä¸éæåº¦ãåå¼èå´[0, 1]ã * @param {boolean} [options.stroke=false] - æ¯å¦æè¾¹ï¼ä¸éè¦æè¾¹å设置为falseã妿 fill ä¸ stroke åæ¶ä¸º falseï¼å°æ fill ä¸ stroke çé»è®¤å¼æ¸²æå¾å±ã * @param {string} [options.strokeColor='#000000'] - åå è¿å¶æè¾¹é¢è²ã * @param {number} [options.strokeOpacity=1] - æè¾¹çä¸éæåº¦ãåå¼èå´[0, 1]ã * @param {number} [options.strokeWidth=1] - 线宽度/æè¾¹å®½åº¦ã * @param {string} [options.strokeLinecap='butt'] - çº¿å¸½æ ·å¼ãstrokeLinecap æä¸ç§ç±»å âbutt", "round", "square"ã * @param {string} [options.strokeLineJoin='iter'] - çº¿æ®µè¿æ¥æ ·å¼ãstrokeLineJoin æä¸ç§ç±»å âmiter", "round", "bevel"ã * @param {string} [options.strokeDashstyle='solid'] - è线类åãstrokeDashstyle æå «ç§ç±»å âdot",âdash",âdashdot",âlongdash",âlongdashdot",âsolid", "dashed", "dotted"ãsolid 表示å®çº¿ã * @param {number} [options.pointRadius=6] - ç¹åå¾,åä½ä¸ºåç´ ã * @param {number} [options.shadowBlur=0] - é´å½±æ¨¡ç³åº¦ï¼ï¼å¤§äº 0 ææ;ï¼ã注ï¼è¯·å° shadowColor 屿§ä¸ shadowBlur 屿§ä¸èµ·ä½¿ç¨ï¼æ¥å建é´å½±ã * @param {string} [options.shadowColor='#000000'] - é´å½±é¢è²ã注ï¼è¯·å° shadowColor 屿§ä¸ shadowBlur 屿§ä¸èµ·ä½¿ç¨ï¼æ¥å建é´å½±ã * @param {number} [options.shadowOffsetX=0] - é´å½± X æ¹ååç§»å¼ã * @param {number} [options.shadowOffsetY=0] - é´å½± Y æ¹ååç§»å¼ã * @param {string} options.label - ä¸é¢è¦ç´ éå ææ¬æ ç¾å 容ã * @param {string} [options.fontColor] - éå ææ¬åä½é¢è²ã * @param {number} [options.fontSize=12] - éå ææ¬åä½å¤§å°,å使¯åç´ ã * @param {string} [options.fontStyle='normal'] - éå ææ¬å使 ·å¼ãå¯è®¾å¼ï¼"normal", "italic", "oblique"ã * @param {string} [options.fontVariant='normal'] - éå ææ¬åä½åä½ãå¯è®¾å¼ï¼"normal", "small-caps"ã * @param {string} [options.fontWeight='normal'] - éå ææ¬åä½ç²ç»ãå¯è®¾å¼ï¼"normal", "bold", "bolder", "lighter"ã * @param {string} [options.fontFamily='arial,sans-serif'] - éå ææ¬åä½ç³»åãfontFamily 弿¯å使åç§°æ/åç±»æåç§°çä¸ä¸ªä¼å è¡¨ï¼æ¯ä¸ªå¼éå·åå²ï¼ * æµè§å¨ä¼ä½¿ç¨å®å¯è¯å«ç第ä¸ä¸ªå¯ä»¥ä½¿ç¨å ·ä½çåä½åç§°ï¼"times"ã"courier"ã"arial"ï¼æåä½ç³»ååç§° * ï¼"serif"ã"sans-serif"ã"cursive"ã"fantasy"ã"monospace"ï¼ã * @param {string} [options.labelPosition='top'] - éå ææ¬ä½ç½®, å¯ä»¥æ¯ 'inside', 'left', 'right', 'top', 'bottom'ã * @param {string} [options.labelAlign='center'] - éå ææ¬æ°´å¹³å¯¹é½ãå¯ä»¥æ¯ 'left', 'right', 'center'ã * @param {string} [options.labelBaseline='middle'] - éå ææ¬åç´å¯¹é½ã å¯ä»¥æ¯ 'top', 'bottom', 'middle' ã * @param {number} [options.labelXOffset=0] - éå ææ¬å¨xè½´æ¹åçåç§»éã * @param {number} [options.labelYOffset=0] - éå ææ¬å¨yè½´æ¹åçåç§»éã */ export class ThemeStyle { constructor(options) { options = options || {}; /** * @member {boolean} [SuperMap.ThemeStyle.prototype.fill=true] * @description æ¯å¦å¡«å ï¼ä¸éè¦å¡«å å设置为 falseã妿 fill ä¸ stroke åæ¶ä¸º falseï¼å°æ fill ä¸ stroke çé»è®¤å¼æ¸²æå¾å±ã */ this.fill = true; /** * @member {string} [SuperMap.ThemeStyle.prototype.fillColor="#000000"] * @description åå è¿å¶å¡«å é¢è²ã */ this.fillColor = "#000000"; /** * @member {number} [SuperMap.ThemeStyle.prototype.fillOpacity=1] * @description å¡«å ä¸éæåº¦ãåå¼èå´[0, 1]ã */ this.fillOpacity = 1; /** * @member {boolean} [SuperMap.ThemeStyle.prototype.stroke=false] * @description æ¯å¦æè¾¹ï¼ä¸éè¦æè¾¹å设置为falseã妿 fill ä¸ stroke åæ¶ä¸º falseï¼å°æ fill ä¸ stroke çé»è®¤å¼æ¸²æå¾å±ã */ this.stroke = false; /** * @member {string} [SuperMap.ThemeStyle.prototype.strokeColor="#000000"] * @description åå è¿å¶æè¾¹é¢è²ã */ this.strokeColor = "#000000"; /** * @member {number} [SuperMap.ThemeStyle.prototype.strokeOpacity=1] * @description æè¾¹çä¸éæåº¦ãåå¼èå´[0, 1]ã */ this.strokeOpacity = 1; /** * @member {number} [SuperMap.ThemeStyle.prototype.strokeWidth=1] * @description 线宽度/æè¾¹å®½åº¦ã */ this.strokeWidth = 1; /** * @member {string} [SuperMap.ThemeStyle.prototype.strokeLinecap="butt"] * @description çº¿å¸½æ ·å¼ï¼strokeLinecap æä¸ç§ç±»å âbutt", "round", "square" ã */ this.strokeLinecap = "butt"; /** * @member {string} [SuperMap.ThemeStyle.prototype.strokeLineJoin="miter"] * @description çº¿æ®µè¿æ¥æ ·å¼ï¼strokeLineJoin æä¸ç§ç±»å âmiter", "round", "bevel"ã */ this.strokeLineJoin = "miter"; /** * @member {string} [SuperMap.ThemeStyle.prototype.strokeDashstyle="solid"] * @description è线类åï¼ strokeDashstyle æå «ç§ç±»å âdot",âdash",âdashdot",âlongdash",âlongdashdot",âsolid", "dashed", "dotted"; * solid 表示å®çº¿ã */ this.strokeDashstyle = "solid"; /** * @member {number} [SuperMap.ThemeStyle.prototype.pointRadius=6] * @description ç¹åå¾ãåä½ä¸ºåç´ ã */ this.pointRadius = 6; /** * @member {number} [SuperMap.ThemeStyle.prototype.shadowBlur=0] * @description é´å½±æ¨¡ç³åº¦ï¼ï¼å¤§äº 0 ææï¼ã注ï¼è¯·å° shadowColor 屿§ä¸ shadowBlur 屿§ä¸èµ·ä½¿ç¨ï¼æ¥å建é´å½±ã */ this.shadowBlur = 0; /** * @member {string} [SuperMap.ThemeStyle.prototype.shadowColor='#000000'] * @description é´å½±é¢è²ã注ï¼è¯·å° shadowColor 屿§ä¸ shadowBlur 屿§ä¸èµ·ä½¿ç¨ï¼æ¥å建é´å½±ã */ this.shadowColor = "#000000"; /** * @member {number} [SuperMap.ThemeStyle.prototype.shadowOffsetX=0] * @description é´å½± X æ¹ååç§»å¼ã */ this.shadowOffsetX = 0; /** * @member {number} SuperMap.ThemeStyle.prototype.shadowOffsetY * @description Y æ¹ååç§»å¼ã */ this.shadowOffsetY = 0; /** * @member {string} [SuperMap.ThemeStyle.prototype.label] * @description ä¸é¢è¦ç´ éå ææ¬æ ç¾å 容ã */ this.label = ""; /** * @member {boolean} [SuperMap.ThemeStyle.prototype.labelRect=false] * @description æ¯å¦æ¾ç¤ºææ¬æ ç¾ç©å½¢èæ¯ã */ this.labelRect = false; /** * @member {string} [SuperMap.ThemeStyle.prototype.fontColor] * @description éå ææ¬åä½é¢è²ã */ this.fontColor = ""; /** * @member {number} [SuperMap.ThemeStyle.prototype.fontSize=12] * @description éå ææ¬åä½å¤§å°,å使¯åç´ ã */ this.fontSize = 12; /** * @member {string} [SuperMap.ThemeStyle.prototype.fontStyle="normal"] * @description éå ææ¬å使 ·å¼ãå¯è®¾å¼ï¼"normal", "italic", "oblique"ã */ this.fontStyle = "normal"; /** * @member {string} [SuperMap.ThemeStyle.prototype.fontVariant="normal"] * @description éå ææ¬åä½åä½ãå¯è®¾å¼ï¼"normal", "small-caps"ã */ this.fontVariant = "normal"; /** * @member {string} [SuperMap.ThemeStyle.prototype.fontWeight="normal"] * @description éå ææ¬åä½ç²ç»ãå¯è®¾å¼ï¼"normal", "bold", "bolder", "lighter"ã */ this.fontWeight = "normal"; /** * @member {string} [SuperMap.ThemeStyle.prototype.fontFamily="arial,sans-serif"] * @description éå ææ¬åä½ç³»åãfontFamily 弿¯å使åç§°æ/åç±»æåç§°çä¸ä¸ªä¼å è¡¨ï¼æ¯ä¸ªå¼éå·åå²ï¼æµè§å¨ä¼ä½¿ç¨å®å¯è¯å«ç第ä¸ä¸ª * å¯ä»¥ä½¿ç¨å ·ä½çåä½åç§°ï¼"times"ã"courier"ã"arial"ï¼æåä½ç³»ååç§°ï¼"serif"ã"sans-serif"ã"cursive"ã"fantasy"ã"monospace"ï¼ã */ this.fontFamily = "arial,sans-serif"; /** * @member {string} [SuperMap.ThemeStyle.prototype.labelPosition='top'] * @description éå ææ¬ä½ç½®, å¯ä»¥æ¯ 'inside', 'left', 'right', 'top', 'bottom'ã */ this.labelPosition = "top"; /** * @member {string} [SuperMap.ThemeStyle.prototype.labelAlign='center'] * @description éå ææ¬æ°´å¹³å¯¹é½ãå¯ä»¥æ¯ 'left', 'right', 'center'ã */ this.labelAlign = "center"; /** * @member {string} [SuperMap.ThemeStyle.prototype.labelBaseline='middle'] * @description éå ææ¬åç´å¯¹é½ã å¯ä»¥æ¯ 'top', 'bottom', 'middle'ã */ this.labelBaseline = "middle"; /** * @member {number} [SuperMap.ThemeStyle.prototype.labelXOffset=0] * @description éå ææ¬å¨ X è½´æ¹åçåç§»éã */ this.labelXOffset = 0; /** * @member {number} [SuperMap.ThemeStyle.prototype.labelYOffset=0] * @description éå ææ¬å¨ Y è½´æ¹åçåç§»éã */ this.labelYOffset = 0; Util.extend(this, options); } } SuperMap.ThemeStyle = ThemeStyle;