90 lines
1.7 KiB
JavaScript
90 lines
1.7 KiB
JavaScript
/**
|
|
* R3.DrawRange
|
|
* @param implementation
|
|
* @param apiDrawRange
|
|
* @param parentGeometry
|
|
* @constructor
|
|
*/
|
|
R3.DrawRange = function (
|
|
implementation,
|
|
apiDrawRange,
|
|
parentGeometry
|
|
) {
|
|
|
|
this.implementation = implementation;
|
|
this.implementation.isNotThreeThrow();
|
|
|
|
if (R3.Utils.UndefinedOrNull(apiDrawRange)) {
|
|
apiDrawRange = {};
|
|
}
|
|
|
|
if (R3.Utils.UndefinedOrNull(parentGeometry)) {
|
|
parentGeometry = null;
|
|
}
|
|
this.parentGeometry = parentGeometry;
|
|
|
|
/**
|
|
* Mongo doesn't store Infinity
|
|
*/
|
|
if (apiDrawRange.count === null) {
|
|
apiDrawRange.count = Infinity;
|
|
}
|
|
|
|
R3.API.DrawRange.call(
|
|
this,
|
|
apiDrawRange.id,
|
|
apiDrawRange.name,
|
|
apiDrawRange.parentEntity,
|
|
apiDrawRange.start,
|
|
apiDrawRange.count
|
|
);
|
|
|
|
this.createInstance();
|
|
};
|
|
|
|
R3.DrawRange.prototype = Object.create(R3.Component.prototype);
|
|
R3.DrawRange.prototype.constructor = R3.DrawRange;
|
|
|
|
/**
|
|
* Creates an instance R3.DrawRange
|
|
* @returns {*}
|
|
*/
|
|
R3.DrawRange.prototype.createInstance = function() {
|
|
|
|
this.instance = {
|
|
start : this.start,
|
|
count : this.count
|
|
}
|
|
|
|
};
|
|
|
|
/**
|
|
* Updates R3.DrawRange instance
|
|
* @param property
|
|
*/
|
|
R3.DrawRange.prototype.updateInstance = function(property) {
|
|
|
|
console.warn('update the geometry instead');
|
|
|
|
if (property === 'start') {
|
|
}
|
|
|
|
if (property === 'count') {
|
|
}
|
|
|
|
};
|
|
|
|
/**
|
|
* R3.DrawRange to R3.API.DrawRange
|
|
* @returns {R3.API.DrawRange}
|
|
*/
|
|
R3.DrawRange.prototype.toApiObject = function() {
|
|
return new R3.API.DrawRange(
|
|
this.id,
|
|
this.name,
|
|
R3.Utils.IdOrNull(this.parentEntity),
|
|
this.start,
|
|
this.count
|
|
);
|
|
};
|