11import {
22 ensureArray ,
33 ensureNumberArray ,
4+ ensureNumber ,
5+ ensureString ,
46 JsonDict ,
57 parseState ,
68 StateInput ,
79} from './VisorStateCommon.tsx' ;
10+ import type { FieldAssociation } from './vtkInfo/VisorVtkDataArray.tsx' ;
811
912export default class VisorSpectrumState {
1013 private _id : string = '' ;
14+ private _arrayName : string = '' ;
15+ private _type : FieldAssociation | undefined = undefined ;
16+ private _numComponents : number = 0 ;
1117 private _magnitudeRange : number [ ] | undefined = undefined ;
1218 private _ranges : ( number [ ] | undefined ) [ ] = [ ] ;
1319
@@ -28,6 +34,36 @@ export default class VisorSpectrumState {
2834 }
2935 }
3036
37+ get arrayName ( ) : string {
38+ return this . _arrayName ;
39+ }
40+
41+ setArrayName ( val : string | null | undefined ) : void {
42+ if ( val != null ) {
43+ this . _arrayName = ensureString ( val , 'val' ) ;
44+ }
45+ }
46+
47+ get type ( ) : FieldAssociation | undefined {
48+ return this . _type ;
49+ }
50+
51+ setType ( val : FieldAssociation | null | undefined ) : void {
52+ if ( val != null ) {
53+ this . _type = val ;
54+ }
55+ }
56+
57+ get numComponents ( ) : number {
58+ return this . _numComponents ;
59+ }
60+
61+ setNumComponents ( val : number | null | undefined ) : void {
62+ if ( val != null ) {
63+ this . _numComponents = ensureNumber ( val , 'val' ) ;
64+ }
65+ }
66+
3167 get magnitudeRange ( ) : number [ ] | undefined {
3268 return this . _magnitudeRange ;
3369 }
@@ -83,6 +119,11 @@ export default class VisorSpectrumState {
83119 }
84120
85121 this . setId ( thisId ) ;
122+ this . setArrayName ( data . arrayName === undefined ? this . _arrayName : data . arrayName ) ;
123+ this . setType ( data . type === undefined ? this . _type : data . type ) ;
124+ this . setNumComponents (
125+ data . numComponents === undefined ? this . _numComponents : data . numComponents
126+ ) ;
86127 this . setMagnitudeRange (
87128 data . magnitudeRange === undefined ? this . _magnitudeRange : data . magnitudeRange ,
88129 replace
@@ -99,6 +140,9 @@ export default class VisorSpectrumState {
99140 toDict ( ) : JsonDict {
100141 return {
101142 id : this . id ,
143+ arrayName : this . arrayName ,
144+ type : this . type ,
145+ numComponents : this . numComponents ,
102146 magnitudeRange : this . magnitudeRange ,
103147 ranges : this . ranges ,
104148 } ;
0 commit comments