123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436 |
- import defaultValue from "../Core/defaultValue.js";
- import defined from "../Core/defined.js";
- import DeveloperError from "../Core/DeveloperError.js";
- import Event from "../Core/Event.js";
- import createPropertyDescriptor from "./createPropertyDescriptor.js";
- import NodeTransformationProperty from "./NodeTransformationProperty.js";
- import PropertyBag from "./PropertyBag.js";
- function createNodeTransformationProperty(value) {
- return new NodeTransformationProperty(value);
- }
- function createNodeTransformationPropertyBag(value) {
- return new PropertyBag(value, createNodeTransformationProperty);
- }
- function createArticulationStagePropertyBag(value) {
- return new PropertyBag(value);
- }
- function ModelGraphics(options) {
- this._definitionChanged = new Event();
- this._show = undefined;
- this._showSubscription = undefined;
- this._uri = undefined;
- this._uriSubscription = undefined;
- this._scale = undefined;
- this._scaleSubscription = undefined;
- this._minimumPixelSize = undefined;
- this._minimumPixelSizeSubscription = undefined;
- this._maximumScale = undefined;
- this._maximumScaleSubscription = undefined;
- this._incrementallyLoadTextures = undefined;
- this._incrementallyLoadTexturesSubscription = undefined;
- this._runAnimations = undefined;
- this._runAnimationsSubscription = undefined;
- this._clampAnimations = undefined;
- this._clampAnimationsSubscription = undefined;
- this._shadows = undefined;
- this._shadowsSubscription = undefined;
- this._heightReference = undefined;
- this._heightReferenceSubscription = undefined;
- this._silhouetteColor = undefined;
- this._silhouetteColorSubscription = undefined;
- this._silhouetteSize = undefined;
- this._silhouetteSizeSubscription = undefined;
- this._color = undefined;
- this._colorSubscription = undefined;
- this._colorBlendMode = undefined;
- this._colorBlendModeSubscription = undefined;
- this._colorBlendAmount = undefined;
- this._colorBlendAmountSubscription = undefined;
- this._imageBasedLightingFactor = undefined;
- this._imageBasedLightingFactorSubscription = undefined;
- this._lightColor = undefined;
- this._lightColorSubscription = undefined;
- this._distanceDisplayCondition = undefined;
- this._distanceDisplayConditionSubscription = undefined;
- this._nodeTransformations = undefined;
- this._nodeTransformationsSubscription = undefined;
- this._articulations = undefined;
- this._articulationsSubscription = undefined;
- this._clippingPlanes = undefined;
- this._clippingPlanesSubscription = undefined;
- this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT));
- }
- Object.defineProperties(ModelGraphics.prototype, {
-
- definitionChanged: {
- get: function () {
- return this._definitionChanged;
- },
- },
-
- show: createPropertyDescriptor("show"),
-
- uri: createPropertyDescriptor("uri"),
-
- scale: createPropertyDescriptor("scale"),
-
- minimumPixelSize: createPropertyDescriptor("minimumPixelSize"),
-
- maximumScale: createPropertyDescriptor("maximumScale"),
-
- incrementallyLoadTextures: createPropertyDescriptor(
- "incrementallyLoadTextures"
- ),
-
- runAnimations: createPropertyDescriptor("runAnimations"),
-
- clampAnimations: createPropertyDescriptor("clampAnimations"),
-
- shadows: createPropertyDescriptor("shadows"),
-
- heightReference: createPropertyDescriptor("heightReference"),
-
- silhouetteColor: createPropertyDescriptor("silhouetteColor"),
-
- silhouetteSize: createPropertyDescriptor("silhouetteSize"),
-
- color: createPropertyDescriptor("color"),
-
- colorBlendMode: createPropertyDescriptor("colorBlendMode"),
-
- colorBlendAmount: createPropertyDescriptor("colorBlendAmount"),
-
- imageBasedLightingFactor: createPropertyDescriptor(
- "imageBasedLightingFactor"
- ),
-
- lightColor: createPropertyDescriptor("lightColor"),
-
- distanceDisplayCondition: createPropertyDescriptor(
- "distanceDisplayCondition"
- ),
-
- nodeTransformations: createPropertyDescriptor(
- "nodeTransformations",
- undefined,
- createNodeTransformationPropertyBag
- ),
-
- articulations: createPropertyDescriptor(
- "articulations",
- undefined,
- createArticulationStagePropertyBag
- ),
-
- clippingPlanes: createPropertyDescriptor("clippingPlanes"),
- });
- ModelGraphics.prototype.clone = function (result) {
- if (!defined(result)) {
- return new ModelGraphics(this);
- }
- result.show = this.show;
- result.uri = this.uri;
- result.scale = this.scale;
- result.minimumPixelSize = this.minimumPixelSize;
- result.maximumScale = this.maximumScale;
- result.incrementallyLoadTextures = this.incrementallyLoadTextures;
- result.runAnimations = this.runAnimations;
- result.clampAnimations = this.clampAnimations;
- result.heightReference = this._heightReference;
- result.silhouetteColor = this.silhouetteColor;
- result.silhouetteSize = this.silhouetteSize;
- result.color = this.color;
- result.colorBlendMode = this.colorBlendMode;
- result.colorBlendAmount = this.colorBlendAmount;
- result.imageBasedLightingFactor = this.imageBasedLightingFactor;
- result.lightColor = this.lightColor;
- result.distanceDisplayCondition = this.distanceDisplayCondition;
- result.nodeTransformations = this.nodeTransformations;
- result.articulations = this.articulations;
- result.clippingPlanes = this.clippingPlanes;
- return result;
- };
- ModelGraphics.prototype.merge = function (source) {
-
- if (!defined(source)) {
- throw new DeveloperError("source is required.");
- }
-
- this.show = defaultValue(this.show, source.show);
- this.uri = defaultValue(this.uri, source.uri);
- this.scale = defaultValue(this.scale, source.scale);
- this.minimumPixelSize = defaultValue(
- this.minimumPixelSize,
- source.minimumPixelSize
- );
- this.maximumScale = defaultValue(this.maximumScale, source.maximumScale);
- this.incrementallyLoadTextures = defaultValue(
- this.incrementallyLoadTextures,
- source.incrementallyLoadTextures
- );
- this.runAnimations = defaultValue(this.runAnimations, source.runAnimations);
- this.clampAnimations = defaultValue(
- this.clampAnimations,
- source.clampAnimations
- );
- this.shadows = defaultValue(this.shadows, source.shadows);
- this.heightReference = defaultValue(
- this.heightReference,
- source.heightReference
- );
- this.silhouetteColor = defaultValue(
- this.silhouetteColor,
- source.silhouetteColor
- );
- this.silhouetteSize = defaultValue(
- this.silhouetteSize,
- source.silhouetteSize
- );
- this.color = defaultValue(this.color, source.color);
- this.colorBlendMode = defaultValue(
- this.colorBlendMode,
- source.colorBlendMode
- );
- this.colorBlendAmount = defaultValue(
- this.colorBlendAmount,
- source.colorBlendAmount
- );
- this.imageBasedLightingFactor = defaultValue(
- this.imageBasedLightingFactor,
- source.imageBasedLightingFactor
- );
- this.lightColor = defaultValue(this.lightColor, source.lightColor);
- this.distanceDisplayCondition = defaultValue(
- this.distanceDisplayCondition,
- source.distanceDisplayCondition
- );
- this.clippingPlanes = defaultValue(
- this.clippingPlanes,
- source.clippingPlanes
- );
- var sourceNodeTransformations = source.nodeTransformations;
- if (defined(sourceNodeTransformations)) {
- var targetNodeTransformations = this.nodeTransformations;
- if (defined(targetNodeTransformations)) {
- targetNodeTransformations.merge(sourceNodeTransformations);
- } else {
- this.nodeTransformations = new PropertyBag(
- sourceNodeTransformations,
- createNodeTransformationProperty
- );
- }
- }
- var sourceArticulations = source.articulations;
- if (defined(sourceArticulations)) {
- var targetArticulations = this.articulations;
- if (defined(targetArticulations)) {
- targetArticulations.merge(sourceArticulations);
- } else {
- this.articulations = new PropertyBag(sourceArticulations);
- }
- }
- };
- export default ModelGraphics;
|