123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- define([
- '../Core/Cartesian2',
- '../Core/Color',
- '../Core/defined',
- '../Core/defineProperties',
- '../Core/Event',
- './createPropertyDescriptor',
- './Property'
- ], function(
- Cartesian2,
- Color,
- defined,
- defineProperties,
- Event,
- createPropertyDescriptor,
- Property) {
- "use strict";
- 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);
-
- var GridMaterialProperty = function() {
- 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 = undefined;
- this.cellAlpha = undefined;
- this.lineCount = undefined;
- this.lineThickness = undefined;
- this.lineOffset = undefined;
- };
- 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));
- };
- return GridMaterialProperty;
- });
|