123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- import Cartesian2 from "../Core/Cartesian2.js";
- import Color from "../Core/Color.js";
- import defaultValue from "../Core/defaultValue.js";
- import defined from "../Core/defined.js";
- import Event from "../Core/Event.js";
- import createPropertyDescriptor from "./createPropertyDescriptor.js";
- import Property from "./Property.js";
- var defaultColor = Color.WHITE;
- var defaultCellAlpha = 0.1;
- var defaultLineCount = new Cartesian2(8, 8);
- var defaultLineOffset = new Cartesian2(0, 0);
- var defaultLineThickness = new Cartesian2(1, 1);
- function GridMaterialProperty(options) {
- options = defaultValue(options, defaultValue.EMPTY_OBJECT);
- this._definitionChanged = new Event();
- this._color = undefined;
- this._colorSubscription = undefined;
- this._cellAlpha = undefined;
- this._cellAlphaSubscription = undefined;
- this._lineCount = undefined;
- this._lineCountSubscription = undefined;
- this._lineThickness = undefined;
- this._lineThicknessSubscription = undefined;
- this._lineOffset = undefined;
- this._lineOffsetSubscription = undefined;
- this.color = options.color;
- this.cellAlpha = options.cellAlpha;
- this.lineCount = options.lineCount;
- this.lineThickness = options.lineThickness;
- this.lineOffset = options.lineOffset;
- }
- Object.defineProperties(GridMaterialProperty.prototype, {
-
- isConstant: {
- get: function () {
- return (
- Property.isConstant(this._color) &&
- Property.isConstant(this._cellAlpha) &&
- Property.isConstant(this._lineCount) &&
- Property.isConstant(this._lineThickness) &&
- Property.isConstant(this._lineOffset)
- );
- },
- },
-
- definitionChanged: {
- get: function () {
- return this._definitionChanged;
- },
- },
-
- color: createPropertyDescriptor("color"),
-
- cellAlpha: createPropertyDescriptor("cellAlpha"),
-
- lineCount: createPropertyDescriptor("lineCount"),
-
- lineThickness: createPropertyDescriptor("lineThickness"),
-
- lineOffset: createPropertyDescriptor("lineOffset"),
- });
- GridMaterialProperty.prototype.getType = function (time) {
- return "Grid";
- };
- GridMaterialProperty.prototype.getValue = function (time, result) {
- if (!defined(result)) {
- result = {};
- }
- result.color = Property.getValueOrClonedDefault(
- this._color,
- time,
- defaultColor,
- result.color
- );
- result.cellAlpha = Property.getValueOrDefault(
- this._cellAlpha,
- time,
- defaultCellAlpha
- );
- result.lineCount = Property.getValueOrClonedDefault(
- this._lineCount,
- time,
- defaultLineCount,
- result.lineCount
- );
- result.lineThickness = Property.getValueOrClonedDefault(
- this._lineThickness,
- time,
- defaultLineThickness,
- result.lineThickness
- );
- result.lineOffset = Property.getValueOrClonedDefault(
- this._lineOffset,
- time,
- defaultLineOffset,
- result.lineOffset
- );
- return result;
- };
- GridMaterialProperty.prototype.equals = function (other) {
- return (
- this === other ||
- (other instanceof GridMaterialProperty &&
- Property.equals(this._color, other._color) &&
- Property.equals(this._cellAlpha, other._cellAlpha) &&
- Property.equals(this._lineCount, other._lineCount) &&
- Property.equals(this._lineThickness, other._lineThickness) &&
- Property.equals(this._lineOffset, other._lineOffset))
- );
- };
- export default GridMaterialProperty;
|