Source: formats/kml/styles/KmlBalloonStyle.js

  1. /*
  2. * Copyright 2003-2006, 2009, 2017, 2020 United States Government, as represented
  3. * by the Administrator of the National Aeronautics and Space Administration.
  4. * All rights reserved.
  5. *
  6. * The NASAWorldWind/WebWorldWind platform is licensed under the Apache License,
  7. * Version 2.0 (the "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License
  9. * at http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software distributed
  12. * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  13. * CONDITIONS OF ANY KIND, either express or implied. See the License for the
  14. * specific language governing permissions and limitations under the License.
  15. *
  16. * NASAWorldWind/WebWorldWind also contains the following 3rd party Open Source
  17. * software:
  18. *
  19. * ES6-Promise – under MIT License
  20. * libtess.js – SGI Free Software License B
  21. * Proj4 – under MIT License
  22. * JSZip – under MIT License
  23. *
  24. * A complete listing of 3rd Party software notices and licenses included in
  25. * WebWorldWind can be found in the WebWorldWind 3rd-party notices and licenses
  26. * PDF found in code directory.
  27. */
  28. define([
  29. '../KmlElements',
  30. './KmlSubStyle',
  31. '../util/KmlNodeTransformers'
  32. ], function (
  33. KmlElements,
  34. KmlSubStyle,
  35. NodeTransformers
  36. ) {
  37. "use strict";
  38. /**
  39. * Constructs an KmlBalloonStyle. Applications usually don't call this constructor. It is called by {@link KmlFile}
  40. * as objects from KmlFile are read. This object is already concrete implementation.
  41. * @alias KmlBalloonStyle
  42. * @classdesc Contains the data associated with BalloonStyle node
  43. * @param options {Object}
  44. * @param options.objectNode {Node} Node representing BalloonStyle
  45. * @constructor
  46. * @throws {ArgumentError} If the node is null or undefined
  47. * @see https://developers.google.com/kml/documentation/kmlreference#balloonstyle
  48. * @augments KmlSubStyle
  49. */
  50. var KmlBalloonStyle = function (options) {
  51. KmlSubStyle.call(this, options);
  52. };
  53. KmlBalloonStyle.prototype = Object.create(KmlSubStyle.prototype);
  54. Object.defineProperties(KmlBalloonStyle.prototype, {
  55. /**
  56. * Represents background color of the balloon. It expects hexadecimal notation without #.
  57. * @memberof KmlBalloonStyle.prototype
  58. * @readonly
  59. * @type {String}
  60. */
  61. kmlBgColor: {
  62. get: function(){
  63. return this._factory.specific(this, {name: 'bgColor', transformer: NodeTransformers.string});
  64. }
  65. },
  66. /**
  67. * Represents color of the text in the balloon. It expects hexadecimal notation without #.
  68. * @memberof KmlBalloonStyle.prototype
  69. * @readonly
  70. * @type {String}
  71. */
  72. kmlTextColor: {
  73. get: function() {
  74. return this._factory.specific(this, {name: 'textColor', transformer: NodeTransformers.string});
  75. }
  76. },
  77. /**
  78. * Text which should be displayed in the balloon, otherwise feature name and description is displayed.
  79. * @memberof KmlBalloonStyle.prototype
  80. * @readonly
  81. * @type {String}
  82. */
  83. kmlText: {
  84. get: function(){
  85. return this._factory.specific(this, {name: 'text', transformer: NodeTransformers.string});
  86. }
  87. },
  88. /**
  89. * Either display or hide. When hide don't show the balloon at all.
  90. * @memberof KmlBalloonStyle.prototype
  91. * @readonly
  92. * @type {String}
  93. */
  94. kmlDisplayMode: {
  95. get: function() {
  96. return this._factory.specific(this, {name: 'displayMode', transformer: NodeTransformers.string});
  97. }
  98. }
  99. });
  100. KmlBalloonStyle.update = function(){
  101. };
  102. /**
  103. * @inheritDoc
  104. */
  105. KmlBalloonStyle.prototype.getTagNames = function() {
  106. return ['BalloonStyle'];
  107. };
  108. KmlElements.addKey(KmlBalloonStyle.prototype.getTagNames()[0], KmlBalloonStyle);
  109. return KmlBalloonStyle;
  110. });