1 var __extends = (this && this.__extends) || (function () {
  2     var extendStatics = function (d, b) {
  3         extendStatics = Object.setPrototypeOf ||
  4             ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5             function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6         return extendStatics(d, b);
  7     };
  8     return function (d, b) {
  9         extendStatics(d, b);
 10         function __() { this.constructor = d; }
 11         d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
 12     };
 13 })();
 14 /*
 15  * DO NOT MODIFY: this source code has been automatically generated from Java
 16  *                with JSweet (http://www.jsweet.org)
 17  *
 18  * Sweet Home 3D, Copyright (c) 2017 Emmanuel PUYBARET / eTeks <info@eteks.com>
 19  *
 20  * This program is free software; you can redistribute it and/or modify
 21  * it under the terms of the GNU General Public License as published by
 22  * the Free Software Foundation; either version 2 of the License, or
 23  * (at your option) any later version.
 24  *
 25  * This program is distributed in the hope that it will be useful,
 26  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 28  * GNU General Public License for more details.
 29  *
 30  * You should have received a copy of the GNU General Public License
 31  * along with this program; if not, write to the Free Software
 32  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 33  */
 34 /**
 35  * SAX handler for Sweet Home 3D XML stream. Read home should respect the following DTD:<pre>
 36  * <!ELEMENT home (property*, furnitureVisibleProperty*, environment?, backgroundImage?, print?, compass?, (camera | observerCamera)*, level*,
 37  * (pieceOfFurniture | doorOrWindow | furnitureGroup | light)*, wall*, room*, polyline*, dimensionLine*, label*)>
 38  * <!ATTLIST home
 39  * version CDATA #IMPLIED
 40  * name CDATA #IMPLIED
 41  * camera (observerCamera | topCamera) "topCamera"
 42  * selectedLevel CDATA #IMPLIED
 43  * wallHeight CDATA #IMPLIED
 44  * basePlanLocked (false | true) "false"
 45  * furnitureSortedProperty CDATA #IMPLIED
 46  * furnitureDescendingSorted (false | true) "false">
 47  *
 48  * <!ELEMENT property EMPTY>
 49  * <!ATTLIST property
 50  * name CDATA #REQUIRED
 51  * value CDATA #REQUIRED>
 52  *
 53  * <!ELEMENT furnitureVisibleProperty EMPTY>
 54  * <!ATTLIST furnitureVisibleProperty name CDATA #REQUIRED>
 55  *
 56  * <!ELEMENT environment (property*, (camera | observerCamera)*, texture?, texture?) >
 57  * <!ATTLIST environment
 58  * groundColor CDATA #IMPLIED
 59  * backgroundImageVisibleOnGround3D (false | true) "false"
 60  * skyColor CDATA #IMPLIED
 61  * lightColor CDATA #IMPLIED
 62  * wallsAlpha CDATA "0"
 63  * allLevelsVisible (false | true) "false"
 64  * observerCameraElevationAdjusted (false | true) "true"
 65  * ceillingLightColor CDATA #IMPLIED
 66  * drawingMode (FILL | OUTLINE | FILL_AND_OUTLINE) "FILL"
 67  * subpartSizeUnderLight CDATA "0"
 68  * photoWidth CDATA "400"
 69  * photoHeight CDATA "300"
 70  * photoAspectRatio (FREE_RATIO | VIEW_3D_RATIO | RATIO_4_3 | RATIO_3_2 | RATIO_16_9 | RATIO_2_1 | RATIO_24_10 | SQUARE_RATIO) "VIEW_3D_RATIO"
 71  * photoQuality CDATA "0"
 72  * videoWidth CDATA "320"
 73  * videoAspectRatio (RATIO_4_3 | RATIO_16_9 | RATIO_24_10) "RATIO_4_3"
 74  * videoQuality CDATA "0"
 75  * videoSpeed CDATA #IMPLIED
 76  * videoFrameRate CDATA "25">
 77  *
 78  * <!ELEMENT backgroundImage EMPTY>
 79  * <!ATTLIST backgroundImage
 80  * image CDATA #REQUIRED
 81  * scaleDistance CDATA #REQUIRED
 82  * scaleDistanceXStart CDATA #REQUIRED
 83  * scaleDistanceYStart CDATA #REQUIRED
 84  * scaleDistanceXEnd CDATA #REQUIRED
 85  * scaleDistanceYEnd CDATA #REQUIRED
 86  * xOrigin CDATA "0"
 87  * yOrigin CDATA "0"
 88  * visible (false | true) "true">
 89  *
 90  * <!ELEMENT print EMPTY>
 91  * <!ATTLIST print
 92  * headerFormat CDATA #IMPLIED
 93  * footerFormat CDATA #IMPLIED
 94  * planScale CDATA #IMPLIED
 95  * furniturePrinted (false | true) "true"
 96  * planPrinted (false | true) "true"
 97  * view3DPrinted (false | true) "true"
 98  * paperWidth CDATA #REQUIRED
 99  * paperHeight CDATA #REQUIRED
100  * paperTopMargin CDATA #REQUIRED
101  * paperLeftMargin CDATA #REQUIRED
102  * paperBottomMargin CDATA #REQUIRED
103  * paperRightMargin CDATA #REQUIRED
104  * paperOrientation (PORTRAIT | LANDSCAPE | REVERSE_LANDSCAPE) #REQUIRED>
105  *
106  * <!ELEMENT compass (property*)>
107  * <!ATTLIST compass
108  * x CDATA #REQUIRED
109  * y CDATA #REQUIRED
110  * diameter CDATA #REQUIRED
111  * northDirection CDATA "0"
112  * longitude CDATA #IMPLIED
113  * latitude CDATA #IMPLIED
114  * timeZone CDATA #IMPLIED
115  * visible (false | true) "true">
116  *
117  * <!ENTITY % cameraCommonAttributes
118  * 'id ID #IMPLIED
119  * name CDATA #IMPLIED
120  * lens (PINHOLE | NORMAL | FISHEYE | SPHERICAL) "PINHOLE"
121  * x CDATA #REQUIRED
122  * y CDATA #REQUIRED
123  * z CDATA #REQUIRED
124  * yaw CDATA #REQUIRED
125  * pitch CDATA #REQUIRED
126  * time CDATA #IMPLIED
127  * fieldOfView CDATA #REQUIRED'>
128  *
129  * <!ELEMENT camera (property*)>
130  * <!ATTLIST camera
131  * %cameraCommonAttributes;
132  * attribute (topCamera | storedCamera | cameraPath) #REQUIRED>
133  *
134  * <!ELEMENT observerCamera (property*)>
135  * <!ATTLIST observerCamera
136  * %cameraCommonAttributes;
137  * attribute (observerCamera | storedCamera | cameraPath) #REQUIRED
138  * fixedSize (false | true) "false">
139  *
140  * <!ELEMENT level (property*, backgroundImage?)>
141  * <!ATTLIST level
142  * id ID #REQUIRED
143  * name CDATA #REQUIRED
144  * elevation CDATA #REQUIRED
145  * floorThickness CDATA #REQUIRED
146  * height CDATA #REQUIRED
147  * elevationIndex CDATA "-1"
148  * visible (false | true) "true"
149  * viewable (false | true) "true">
150  *
151  * <!ENTITY % furnitureCommonAttributes
152  * 'id ID #IMPLIED
153  * name CDATA #REQUIRED
154  * angle CDATA "0"
155  * visible (false | true) "true"
156  * movable (false | true) "true"
157  * description CDATA #IMPLIED
158  * modelMirrored (false | true) "false"
159  * nameVisible (false | true) "false"
160  * nameAngle CDATA "0"
161  * nameXOffset CDATA "0"
162  * nameYOffset CDATA "0"
163  * price CDATA #IMPLIED'>
164  *
165  * <!ELEMENT furnitureGroup ((pieceOfFurniture | doorOrWindow | furnitureGroup | light)*, property*, textStyle?)>
166  * <!ATTLIST furnitureGroup
167  * %furnitureCommonAttributes;
168  * level IDREF #IMPLIED
169  * x CDATA #IMPLIED
170  * y CDATA #IMPLIED
171  * elevation CDATA #IMPLIED
172  * width CDATA #IMPLIED
173  * depth CDATA #IMPLIED
174  * height CDATA #IMPLIED
175  * dropOnTopElevation CDATA #IMPLIED>
176  *
177  * <!ENTITY % pieceOfFurnitureCommonAttributes
178  * 'level IDREF #IMPLIED
179  * catalogId CDATA #IMPLIED
180  * x CDATA #REQUIRED
181  * y CDATA #REQUIRED
182  * elevation CDATA "0"
183  * width CDATA #REQUIRED
184  * depth CDATA #REQUIRED
185  * height CDATA #REQUIRED
186  * dropOnTopElevation CDATA "1"
187  * information CDATA #IMPLIED
188  * model CDATA #IMPLIED
189  * icon CDATA #IMPLIED
190  * planIcon CDATA #IMPLIED
191  * modelRotation CDATA "1 0 0 0 1 0 0 0 1"
192  * modelCenteredAtOrigin CDATA #IMPLIED
193  * backFaceShown (false | true) "false"
194  * modelSize CDATA #IMPLIED
195  * doorOrWindow (false | true) "false"
196  * resizable (false | true) "true"
197  * deformable (false | true) "true"
198  * texturable (false | true) "true"
199  * staircaseCutOutShape CDATA #IMPLIED
200  * color CDATA #IMPLIED
201  * shininess CDATA #IMPLIED
202  * creator CDATA #IMPLIED
203  * valueAddedTaxPercentage CDATA #IMPLIED
204  * currency CDATA #IMPLIED'>
205  *
206  * <!ENTITY % pieceOfFurnitureHorizontalRotationAttributes
207  * 'horizontallyRotatable (false | true) "true"
208  * pitch CDATA "0"
209  * roll CDATA "0"
210  * widthInPlan CDATA #IMPLIED
211  * depthInPlan CDATA #IMPLIED
212  * heightInPlan CDATA #IMPLIED'>
213  *
214  * <!ELEMENT pieceOfFurniture (property*, textStyle?, texture?, material*, transformation*)>
215  * <!ATTLIST pieceOfFurniture
216  * %furnitureCommonAttributes;
217  * %pieceOfFurnitureCommonAttributes;
218  * %pieceOfFurnitureHorizontalRotationAttributes;>
219  *
220  * <!ELEMENT doorOrWindow (sash*, property*, textStyle?, texture?, material*, transformation*)>
221  * <!ATTLIST doorOrWindow
222  * %furnitureCommonAttributes;
223  * %pieceOfFurnitureCommonAttributes;
224  * wallThickness CDATA "1"
225  * wallDistance CDATA "0"
226  * wallWidth CDATA "1"
227  * wallLeft CDATA "0"
228  * wallHeight CDATA "1"
229  * wallTop CDATA "0"
230  * wallCutOutOnBothSides (false | true) "false"
231  * widthDepthDeformable (false | true) "true"
232  * cutOutShape CDATA #IMPLIED
233  * boundToWall (false | true) "true">
234  *
235  * <!ELEMENT sash EMPTY>
236  * <!ATTLIST sash
237  * xAxis CDATA #REQUIRED
238  * yAxis CDATA #REQUIRED
239  * width CDATA #REQUIRED
240  * startAngle CDATA #REQUIRED
241  * endAngle CDATA #REQUIRED>
242  *
243  * <!ELEMENT light (lightSource*, property*, textStyle?, texture?, material*, transformation*)>
244  * <!ATTLIST light
245  * %furnitureCommonAttributes;
246  * %pieceOfFurnitureCommonAttributes;
247  * %pieceOfFurnitureHorizontalRotationAttributes;
248  * power CDATA "0.5">
249  *
250  * <!ELEMENT lightSource EMPTY>
251  * <!ATTLIST lightSource
252  * x CDATA #REQUIRED
253  * y CDATA #REQUIRED
254  * z CDATA #REQUIRED
255  * color CDATA #REQUIRED
256  * diameter CDATA #IMPLIED>
257  *
258  * <!ELEMENT textStyle EMPTY>
259  * <!ATTLIST textStyle
260  * attribute (nameStyle | areaStyle | lengthStyle) #IMPLIED
261  * fontName CDATA #IMPLIED
262  * fontSize CDATA #REQUIRED
263  * bold (false | true) "false"
264  * italic (false | true) "false"
265  * alignment (LEFT | CENTER | RIGHT) "CENTER">
266  *
267  * <!ELEMENT texture EMPTY>
268  * <!ATTLIST texture
269  * attribute (groundTexture | skyTexture | leftSideTexture | rightSideTexture | floorTexture | ceilingTexture) #IMPLIED
270  * catalogId CDATA #IMPLIED
271  * name CDATA #REQUIRED
272  * width CDATA #REQUIRED
273  * height CDATA #REQUIRED
274  * xOffset CDATA "0"
275  * yOffset CDATA "0"
276  * angle CDATA "0"
277  * scale CDATA "1"
278  * creator CDATA #IMPLIED
279  * leftToRightOriented (true | false) "true"
280  * image CDATA #REQUIRED>
281  *
282  * <!ELEMENT material (texture?)>
283  * <!ATTLIST material
284  * name CDATA #REQUIRED
285  * key CDATA #IMPLIED
286  * color CDATA #IMPLIED
287  * shininess CDATA #IMPLIED>
288  *
289  * <!ELEMENT transformation EMPTY>
290  * <!ATTLIST transformation
291  * name CDATA #REQUIRED
292  * matrix CDATA #REQUIRED>
293  *
294  * <!ELEMENT wall (property*, texture?, texture?, baseboard?, baseboard?)>
295  * <!ATTLIST wall
296  * id ID #REQUIRED
297  * level IDREF #IMPLIED
298  * wallAtStart IDREF #IMPLIED
299  * wallAtEnd IDREF #IMPLIED
300  * xStart CDATA #REQUIRED
301  * yStart CDATA #REQUIRED
302  * xEnd CDATA #REQUIRED
303  * yEnd CDATA #REQUIRED
304  * height CDATA #IMPLIED
305  * heightAtEnd CDATA #IMPLIED
306  * thickness CDATA #REQUIRED
307  * arcExtent CDATA #IMPLIED
308  * pattern CDATA #IMPLIED
309  * topColor CDATA #IMPLIED
310  * leftSideColor CDATA #IMPLIED
311  * leftSideShininess CDATA "0"
312  * rightSideColor CDATA #IMPLIED
313  * rightSideShininess CDATA "0">
314  *
315  * <!ELEMENT baseboard (texture?)>
316  * <!ATTLIST baseboard
317  * attribute (leftSideBaseboard | rightSideBaseboard) #REQUIRED
318  * thickness CDATA #REQUIRED
319  * height CDATA #REQUIRED
320  * color CDATA #IMPLIED>
321  *
322  * <!ELEMENT room (property*, textStyle?, textStyle?, texture?, texture?, point+)>
323  * <!ATTLIST room
324  * id ID #IMPLIED
325  * level IDREF #IMPLIED
326  * name CDATA #IMPLIED
327  * nameAngle CDATA "0"
328  * nameXOffset CDATA "0"
329  * nameYOffset CDATA "-40"
330  * areaVisible (false | true) "false"
331  * areaAngle CDATA "0"
332  * areaXOffset CDATA "0"
333  * areaYOffset CDATA "0"
334  * floorVisible (false | true) "true"
335  * floorColor CDATA #IMPLIED
336  * floorShininess CDATA "0"
337  * ceilingVisible (false | true) "true"
338  * ceilingColor CDATA #IMPLIED
339  * ceilingShininess CDATA "0">
340  *
341  * <!ELEMENT point EMPTY>
342  * <!ATTLIST point
343  * x CDATA #REQUIRED
344  * y CDATA #REQUIRED>
345  *
346  * <!ELEMENT polyline (property*, point+)>
347  * <!ATTLIST polyline
348  * id ID #IMPLIED
349  * level IDREF #IMPLIED
350  * thickness CDATA "1"
351  * capStyle (BUTT | SQUARE | ROUND) "BUTT"
352  * joinStyle (BEVEL | MITER | ROUND | CURVED) "MITER"
353  * dashStyle (SOLID | DOT | DASH | DASH_DOT | DASH_DOT_DOT | CUSTOMIZED) "SOLID"
354  * dashPattern CDATA #IMPLIED
355  * dashOffset CDATA "0"
356  * startArrowStyle (NONE | DELTA | OPEN | DISC) "NONE"
357  * endArrowStyle (NONE | DELTA | OPEN | DISC) "NONE"
358  * elevation CDATA #IMPLIED
359  * color CDATA #IMPLIED
360  * closedPath (false | true) "false">
361  *
362  * <!ELEMENT dimensionLine (property*, textStyle?)>
363  * <!ATTLIST dimensionLine
364  * id ID #IMPLIED
365  * level IDREF #IMPLIED
366  * xStart CDATA #REQUIRED
367  * yStart CDATA #REQUIRED
368  * xEnd CDATA #REQUIRED
369  * yEnd CDATA #REQUIRED
370  * offset CDATA #REQUIRED>
371  *
372  * <!ELEMENT label (property*, textStyle?, text)>
373  * <!ATTLIST label
374  * id ID #IMPLIED
375  * level IDREF #IMPLIED
376  * x CDATA #REQUIRED
377  * y CDATA #REQUIRED
378  * angle CDATA "0"
379  * elevation CDATA "0"
380  * pitch CDATA #IMPLIED
381  * color CDATA #IMPLIED
382  * outlineColor CDATA #IMPLIED>
383  *
384  * <!ELEMENT text (#PCDATA)>
385  * </pre>
386  * with <code>home</code> as root element.
387  * Attributes named <code>attribute</code> indicate the names of the object fields
388  * where some elements should be stored.
389  * @author Emmanuel Puybaret
390  * @param {UserPreferences} preferences
391  * @class
392  * @extends DefaultHandler
393  */
394 var HomeXMLHandler = /** @class */ (function (_super) {
395     __extends(HomeXMLHandler, _super);
396     function HomeXMLHandler(preferences) {
397         var _this = this;
398         if (((preferences != null && preferences instanceof UserPreferences) || preferences === null)) {
399             var __args = arguments;
400             _this = _super.call(this) || this;
401             if (_this.preferences === undefined) {
402                 _this.preferences = null;
403             }
404             if (_this.home === undefined) {
405                 _this.home = null;
406             }
407             if (_this.homeElementName === undefined) {
408                 _this.homeElementName = null;
409             }
410             if (_this.labelText === undefined) {
411                 _this.labelText = null;
412             }
413             if (_this.leftSideBaseboard === undefined) {
414                 _this.leftSideBaseboard = null;
415             }
416             if (_this.rightSideBaseboard === undefined) {
417                 _this.rightSideBaseboard = null;
418             }
419             if (_this.homeBackgroundImage === undefined) {
420                 _this.homeBackgroundImage = null;
421             }
422             if (_this.backgroundImage === undefined) {
423                 _this.backgroundImage = null;
424             }
425             if (_this.materialTexture === undefined) {
426                 _this.materialTexture = null;
427             }
428             _this.buffer = { str: "", toString: function () { return this.str; } };
429             _this.elements = ([]);
430             _this.attributes = ([]);
431             _this.groupsFurniture = ([]);
432             _this.properties = ([]);
433             _this.textStyles = ([]);
434             _this.levels = ({});
435             _this.joinedWalls = ({});
436             _this.textures = ({});
437             _this.materials = ([]);
438             _this.transformations = ([]);
439             _this.sashes = ([]);
440             _this.lightSources = ([]);
441             _this.points = ([]);
442             _this.furnitureVisibleProperties = ([]);
443             _this.preferences = preferences != null ? preferences : new DefaultUserPreferences(false, null);
444         }
445         else if (preferences === undefined) {
446             var __args = arguments;
447             {
448                 var __args_1 = arguments;
449                 var preferences_1 = null;
450                 _this = _super.call(this) || this;
451                 if (_this.preferences === undefined) {
452                     _this.preferences = null;
453                 }
454                 if (_this.home === undefined) {
455                     _this.home = null;
456                 }
457                 if (_this.homeElementName === undefined) {
458                     _this.homeElementName = null;
459                 }
460                 if (_this.labelText === undefined) {
461                     _this.labelText = null;
462                 }
463                 if (_this.leftSideBaseboard === undefined) {
464                     _this.leftSideBaseboard = null;
465                 }
466                 if (_this.rightSideBaseboard === undefined) {
467                     _this.rightSideBaseboard = null;
468                 }
469                 if (_this.homeBackgroundImage === undefined) {
470                     _this.homeBackgroundImage = null;
471                 }
472                 if (_this.backgroundImage === undefined) {
473                     _this.backgroundImage = null;
474                 }
475                 if (_this.materialTexture === undefined) {
476                     _this.materialTexture = null;
477                 }
478                 _this.buffer = { str: "", toString: function () { return this.str; } };
479                 _this.elements = ([]);
480                 _this.attributes = ([]);
481                 _this.groupsFurniture = ([]);
482                 _this.properties = ([]);
483                 _this.textStyles = ([]);
484                 _this.levels = ({});
485                 _this.joinedWalls = ({});
486                 _this.textures = ({});
487                 _this.materials = ([]);
488                 _this.transformations = ([]);
489                 _this.sashes = ([]);
490                 _this.lightSources = ([]);
491                 _this.points = ([]);
492                 _this.furnitureVisibleProperties = ([]);
493                 _this.preferences = preferences_1 != null ? preferences_1 : new DefaultUserPreferences(false, null);
494             }
495             if (_this.preferences === undefined) {
496                 _this.preferences = null;
497             }
498             if (_this.home === undefined) {
499                 _this.home = null;
500             }
501             if (_this.homeElementName === undefined) {
502                 _this.homeElementName = null;
503             }
504             if (_this.labelText === undefined) {
505                 _this.labelText = null;
506             }
507             if (_this.leftSideBaseboard === undefined) {
508                 _this.leftSideBaseboard = null;
509             }
510             if (_this.rightSideBaseboard === undefined) {
511                 _this.rightSideBaseboard = null;
512             }
513             if (_this.homeBackgroundImage === undefined) {
514                 _this.homeBackgroundImage = null;
515             }
516             if (_this.backgroundImage === undefined) {
517                 _this.backgroundImage = null;
518             }
519             if (_this.materialTexture === undefined) {
520                 _this.materialTexture = null;
521             }
522             _this.buffer = { str: "", toString: function () { return this.str; } };
523             _this.elements = ([]);
524             _this.attributes = ([]);
525             _this.groupsFurniture = ([]);
526             _this.properties = ([]);
527             _this.textStyles = ([]);
528             _this.levels = ({});
529             _this.joinedWalls = ({});
530             _this.textures = ({});
531             _this.materials = ([]);
532             _this.transformations = ([]);
533             _this.sashes = ([]);
534             _this.lightSources = ([]);
535             _this.points = ([]);
536             _this.furnitureVisibleProperties = ([]);
537         }
538         else
539             throw new Error('invalid overload');
540         return _this;
541     }
542     /**
543      *
544      */
545     HomeXMLHandler.prototype.startDocument = function () {
546         this.home = null;
547         /* clear */ (this.elements.length = 0);
548         /* clear */ (this.attributes.length = 0);
549         /* clear */ (this.groupsFurniture.length = 0);
550         /* clear */ (function (obj) { for (var member in obj)
551             delete obj[member]; })(this.levels);
552         /* clear */ (function (obj) { for (var member in obj)
553             delete obj[member]; })(this.joinedWalls);
554     };
555     /**
556      *
557      * @param {string} uri
558      * @param {string} localName
559      * @param {string} name
560      * @param {Attributes} attributes
561      */
562     HomeXMLHandler.prototype.startElement = function (uri, localName, name, attributes) {
563         var _this = this;
564         /* setLength */ (function (sb, length) { return sb.str = sb.str.substring(0, length); })(this.buffer, 0);
565         /* push */ (this.elements.push(name) > 0);
566         var attributesMap = ({});
567         for (var i = 0; i < attributes.getLength(); i++) {
568             {
569                 /* put */ (attributesMap[attributes.getQName(i)] = attributes.getValue(i).replace(""", "\"").replace("<", "<").replace(">", ">").replace("&", "&"));
570             }
571             ;
572         }
573         /* push */ (this.attributes.push(attributesMap) > 0);
574         if (!("property" === name) && !("furnitureVisibleProperty" === name) && !("textStyle" === name)) {
575             /* push */ (this.properties.push({}) > 0);
576             /* push */ (this.textStyles.push({}) > 0);
577         }
578         if ("home" === name) {
579             this.setHome(this.createHome(name, attributesMap));
580             /* clear */ (this.furnitureVisibleProperties.length = 0);
581             this.homeBackgroundImage = null;
582         }
583         else if ("environment" === name) {
584             /* clear */ (function (obj) { for (var member in obj)
585                 delete obj[member]; })(this.textures);
586         }
587         else if ("level" === name) {
588             this.backgroundImage = null;
589         }
590         else if (("pieceOfFurniture" === name) || ("doorOrWindow" === name) || ("light" === name) || ("furnitureGroup" === name)) {
591             /* clear */ (function (obj) { for (var member in obj)
592                 delete obj[member]; })(this.textures);
593             /* clear */ (this.materials.length = 0);
594             /* clear */ (this.transformations.length = 0);
595             /* clear */ (this.sashes.length = 0);
596             /* clear */ (this.lightSources.length = 0);
597             if ("furnitureGroup" === name) {
598                 /* push */ (this.groupsFurniture.push([]) > 0);
599             }
600         }
601         else if ("room" === name) {
602             /* clear */ (function (obj) { for (var member in obj)
603                 delete obj[member]; })(this.textures);
604             /* clear */ (this.points.length = 0);
605         }
606         else if ("polyline" === name) {
607             /* clear */ (this.points.length = 0);
608         }
609         else if ("label" === name) {
610             this.labelText = null;
611         }
612         else if ("wall" === name) {
613             /* clear */ (function (obj) { for (var member in obj)
614                 delete obj[member]; })(this.textures);
615             this.leftSideBaseboard = null;
616             this.rightSideBaseboard = null;
617         }
618         else if ("baseboard" === name) {
619             /* remove */ (function (map) { var deleted = _this.textures[HomeXMLHandler.UNIQUE_ATTRIBUTE]; delete _this.textures[HomeXMLHandler.UNIQUE_ATTRIBUTE]; return deleted; })(this.textures);
620         }
621         else if ("material" === name) {
622             this.materialTexture = null;
623         }
624     };
625     /**
626      *
627      * @param {Array} ch
628      * @param {number} start
629      * @param {number} length
630      */
631     HomeXMLHandler.prototype.characters = function (ch, start, length) {
632         /* append */ (function (sb) { sb.str = sb.str.concat(ch.substr(start, length)); return sb; })(this.buffer);
633     };
634     /**
635      *
636      * @param {string} uri
637      * @param {string} localName
638      * @param {string} name
639      */
640     HomeXMLHandler.prototype.endElement = function (uri, localName, name) {
641         /* pop */ this.elements.pop();
642         var parent = (this.elements.length == 0) ? null : /* peek */ (function (s) { return s[s.length - 1]; })(this.elements);
643         var attributesMap = this.attributes.pop();
644         if (this.homeElementName != null && (this.homeElementName === name)) {
645             this.setHomeAttributes(this.home, name, attributesMap);
646         }
647         else if ("furnitureVisibleProperty" === name) {
648             try {
649                 if ( /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "name") == null) {
650                     throw new SAXException("Missing name attribute");
651                 }
652                 /* add */ (this.furnitureVisibleProperties.push(/* valueOf */ /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "name")) > 0);
653             }
654             catch (ex) {
655             }
656             ;
657         }
658         else if ("environment" === name) {
659             this.setEnvironmentAttributes(this.home.getEnvironment(), name, attributesMap);
660         }
661         else if ("compass" === name) {
662             this.setCompassAttributes(this.home.getCompass(), name, attributesMap);
663         }
664         else if ("print" === name) {
665             this.home.setPrint(this.createPrint(attributesMap));
666         }
667         else if ("level" === name) {
668             var level = this.createLevel(name, attributesMap);
669             this.setLevelAttributes(level, name, attributesMap);
670             /* put */ (this.levels[ /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "id")] = level);
671             this.home.addLevel(level);
672         }
673         else if (("camera" === name) || ("observerCamera" === name)) {
674             var camera = this.createCamera(name, attributesMap);
675             this.setCameraAttributes(camera, name, attributesMap);
676             var attribute = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "attribute");
677             if ("cameraPath" === attribute) {
678                 var cameraPath = (this.home.getEnvironment().getVideoCameraPath().slice(0));
679                 /* add */ (cameraPath.push(camera) > 0);
680                 this.home.getEnvironment().setVideoCameraPath(cameraPath);
681             }
682             else if ("topCamera" === attribute) {
683                 var topCamera = this.home.getTopCamera();
684                 topCamera.setCamera(camera);
685                 topCamera.setTime(camera.getTime());
686                 topCamera.setLens(camera.getLens());
687             }
688             else if ("observerCamera" === attribute) {
689                 var observerCamera = this.home.getObserverCamera();
690                 observerCamera.setCamera(camera);
691                 observerCamera.setTime(camera.getTime());
692                 observerCamera.setLens(camera.getLens());
693                 observerCamera.setFixedSize(camera.isFixedSize());
694             }
695             else if ("storedCamera" === attribute) {
696                 var storedCameras = (this.home.getStoredCameras().slice(0));
697                 /* add */ (storedCameras.push(camera) > 0);
698                 this.home.setStoredCameras(storedCameras);
699             }
700         }
701         else if (("pieceOfFurniture" === name) || ("doorOrWindow" === name) || ("light" === name) || ("furnitureGroup" === name)) {
702             var piece = "furnitureGroup" === name ? this.createFurnitureGroup(name, attributesMap, /* pop */ this.groupsFurniture.pop()) : this.createPieceOfFurniture(name, attributesMap);
703             this.setPieceOfFurnitureAttributes(piece, name, attributesMap);
704             if (this.homeElementName != null && (this.homeElementName === parent)) {
705                 this.home.addPieceOfFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture(piece);
706                 var levelId = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "level");
707                 if (levelId != null) {
708                     piece.setLevel(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.levels, levelId));
709                 }
710             }
711             else if ("furnitureGroup" === parent) {
712                 /* add */ ( /* peek */(function (s) { return s[s.length - 1]; })(this.groupsFurniture).push(piece) > 0);
713             }
714         }
715         else if ("wall" === name) {
716             var wall = this.createWall(name, attributesMap);
717             /* put */ (this.joinedWalls[ /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "id")] = new HomeXMLHandler.JoinedWall(wall, /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "wallAtStart"), /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "wallAtEnd")));
718             this.setWallAttributes(wall, name, attributesMap);
719             this.home.addWall(wall);
720             var levelId = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "level");
721             if (levelId != null) {
722                 wall.setLevel(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.levels, levelId));
723             }
724         }
725         else if ("baseboard" === name) {
726             var baseboard = this.createBaseboard(name, attributesMap);
727             if ("leftSideBaseboard" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "attribute")) {
728                 this.leftSideBaseboard = baseboard;
729             }
730             else {
731                 this.rightSideBaseboard = baseboard;
732             }
733         }
734         else if ("room" === name) {
735             var room = this.createRoom(name, attributesMap, /* toArray */ this.points.slice(0));
736             this.setRoomAttributes(room, name, attributesMap);
737             this.home.addRoom$com_eteks_sweethome3d_model_Room(room);
738             var levelId = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "level");
739             if (levelId != null) {
740                 room.setLevel(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.levels, levelId));
741             }
742         }
743         else if ("polyline" === name) {
744             var polyline = this.createPolyline(name, attributesMap, /* toArray */ this.points.slice(0));
745             this.setPolylineAttributes(polyline, name, attributesMap);
746             this.home.addPolyline$com_eteks_sweethome3d_model_Polyline(polyline);
747             var levelId = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "level");
748             if (levelId != null) {
749                 polyline.setLevel(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.levels, levelId));
750             }
751         }
752         else if ("dimensionLine" === name) {
753             var dimensionLine = this.createDimensionLine(name, attributesMap);
754             this.setDimensionLineAttributes(dimensionLine, name, attributesMap);
755             this.home.addDimensionLine(dimensionLine);
756             var levelId = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "level");
757             if (levelId != null) {
758                 dimensionLine.setLevel(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.levels, levelId));
759             }
760         }
761         else if ("label" === name) {
762             var label = this.createLabel(name, attributesMap, this.labelText);
763             this.setLabelAttributes(label, name, attributesMap);
764             this.home.addLabel(label);
765             var levelId = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "level");
766             if (levelId != null) {
767                 label.setLevel(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.levels, levelId));
768             }
769         }
770         else if ("text" === name) {
771             this.labelText = this.getCharacters();
772         }
773         else if ("textStyle" === name) {
774             var attribute = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "attribute");
775             /* put */ ( /* peek */(function (s) { return s[s.length - 1]; })(this.textStyles)[attribute != null ? attribute : HomeXMLHandler.UNIQUE_ATTRIBUTE] = this.createTextStyle(name, attributesMap));
776         }
777         else if ("texture" === name) {
778             if ("material" === parent) {
779                 this.materialTexture = this.createTexture(name, attributesMap);
780             }
781             else {
782                 var attribute = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "attribute");
783                 /* put */ (this.textures[attribute != null ? attribute : HomeXMLHandler.UNIQUE_ATTRIBUTE] = this.createTexture(name, attributesMap));
784             }
785         }
786         else if ("material" === name) {
787             /* add */ (this.materials.push(this.createMaterial(name, attributesMap)) > 0);
788         }
789         else if ("transformation" === name) {
790             var matrixAttribute = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "matrix");
791             if (matrixAttribute == null) {
792                 throw new SAXException("Missing attribute matrix");
793             }
794             else {
795                 var values = matrixAttribute.split(" ", 12);
796                 if (values.length < 12) {
797                     throw new SAXException("Missing values for attribute matrix");
798                 }
799                 try {
800                     var matrix = [[/* parseFloat */ parseFloat(values[0]), /* parseFloat */ parseFloat(values[1]), /* parseFloat */ parseFloat(values[2]), /* parseFloat */ parseFloat(values[3])], [/* parseFloat */ parseFloat(values[4]), /* parseFloat */ parseFloat(values[5]), /* parseFloat */ parseFloat(values[6]), /* parseFloat */ parseFloat(values[7])], [/* parseFloat */ parseFloat(values[8]), /* parseFloat */ parseFloat(values[9]), /* parseFloat */ parseFloat(values[10]), /* parseFloat */ parseFloat(values[11])]];
801                     var transformation = new Transformation(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "name"), matrix);
802                     /* add */ (this.transformations.push(this.resolveObject(transformation, name, attributesMap)) > 0);
803                 }
804                 catch (ex) {
805                     throw new SAXException("Invalid value for attribute matrix", ex);
806                 }
807                 ;
808             }
809         }
810         else if ("point" === name) {
811             /* add */ (this.points.push([this.parseFloat(attributesMap, "x"), this.parseFloat(attributesMap, "y")]) > 0);
812         }
813         else if ("sash" === name) {
814             var sash = new Sash(this.parseFloat(attributesMap, "xAxis"), this.parseFloat(attributesMap, "yAxis"), this.parseFloat(attributesMap, "width"), this.parseFloat(attributesMap, "startAngle"), this.parseFloat(attributesMap, "endAngle"));
815             /* add */ (this.sashes.push(this.resolveObject(sash, name, attributesMap)) > 0);
816         }
817         else if ("lightSource" === name) {
818             var lightSource = new LightSource(this.parseFloat(attributesMap, "x"), this.parseFloat(attributesMap, "y"), this.parseFloat(attributesMap, "z"), this.parseOptionalColor(attributesMap, "color"), this.parseOptionalFloat(attributesMap, "diameter"));
819             /* add */ (this.lightSources.push(this.resolveObject(lightSource, name, attributesMap)) > 0);
820         }
821         else if ("backgroundImage" === name) {
822             var backgroundImage = new BackgroundImage(this.parseContent(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "image"), null, false), this.parseFloat(attributesMap, "scaleDistance"), this.parseFloat(attributesMap, "scaleDistanceXStart"), this.parseFloat(attributesMap, "scaleDistanceYStart"), this.parseFloat(attributesMap, "scaleDistanceXEnd"), this.parseFloat(attributesMap, "scaleDistanceYEnd"), /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "xOrigin") != null ? this.parseFloat(attributesMap, "xOrigin") : 0, /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "yOrigin") != null ? this.parseFloat(attributesMap, "yOrigin") : 0, !("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "visible")));
823             backgroundImage = this.resolveObject(backgroundImage, name, attributesMap);
824             if (this.homeElementName != null && (this.homeElementName === parent)) {
825                 this.homeBackgroundImage = backgroundImage;
826             }
827             else {
828                 this.backgroundImage = backgroundImage;
829             }
830         }
831         else if ("property" === name) {
832             if (this.homeElementName != null) {
833                 /* put */ ( /* peek */(function (s) { return s[s.length - 1]; })(this.properties)[ /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "name")] = /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "value"));
834             }
835         }
836         if (!("property" === name) && !("furnitureVisibleProperty" === name) && !("textStyle" === name)) {
837             /* pop */ this.properties.pop();
838             /* pop */ this.textStyles.pop();
839         }
840     };
841     /**
842      * Returns the trimmed string of last element value.
843      * @return {string}
844      * @private
845      */
846     HomeXMLHandler.prototype.getCharacters = function () {
847         return this.buffer.str.replace(/"/g, '\"').replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&');
848     };
849     /**
850      *
851      */
852     HomeXMLHandler.prototype.endDocument = function () {
853         {
854             var array122 = /* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(this.joinedWalls);
855             for (var index121 = 0; index121 < array122.length; index121++) {
856                 var joinedWall = array122[index121];
857                 {
858                     var wall = joinedWall.getWall();
859                     if (joinedWall.getWallAtStartId() != null && !(joinedWall.getWallAtStartId() === wall.getId())) {
860                         var joinedWallAtStart = (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.joinedWalls, joinedWall.getWallAtStartId());
861                         if (joinedWallAtStart != null) {
862                             wall.setWallAtStart(joinedWallAtStart.getWall());
863                         }
864                     }
865                     if (joinedWall.getWallAtEndId() != null && !(joinedWall.getWallAtEndId() === wall.getId())) {
866                         var joinedWallAtEnd = (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.joinedWalls, joinedWall.getWallAtEndId());
867                         if (joinedWallAtEnd != null) {
868                             wall.setWallAtEnd(joinedWallAtEnd.getWall());
869                         }
870                     }
871                 }
872             }
873         }
874     };
875     /**
876      * Returns the object that will be stored in a home. This method is called for each home object created by this handler
877      * after its instantiation and returns <code>elementObject</code>. It might be overridden to substitute an object
878      * parsed from an XML element and its attributes for an other one of a different subclass if needed.
879      * @param {Object} elementObject
880      * @param {string} elementName
881      * @param {Object} attributes
882      * @return {Object}
883      */
884     HomeXMLHandler.prototype.resolveObject = function (elementObject, elementName, attributes) {
885         return elementObject;
886     };
887     /**
888      * Returns a new {@link Home} instance initialized from the given <code>attributes</code>.
889      * @return {Home} a home instance with its version set.
890      * @param {string} elementName
891      * @param {Object} attributes
892      * @private
893      */
894     HomeXMLHandler.prototype.createHome = function (elementName, attributes) {
895         var home;
896         if ( /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "wallHeight") != null) {
897             home = new Home(this.parseFloat(attributes, "wallHeight"));
898         }
899         else {
900             home = new Home();
901         }
902         var version = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "version");
903         if (version != null) {
904             try {
905                 home.setVersion(/* parseInt */ parseInt(version));
906             }
907             catch (ex) {
908                 throw new SAXException("Invalid value for integer attribute version", ex);
909             }
910             ;
911         }
912         return this.resolveObject(home, elementName, attributes);
913     };
914     /**
915      * Sets the attributes of the given <code>home</code>.
916      * If needed, this method should be called from {@link #endElement}.
917      * @param {Home} home
918      * @param {string} elementName
919      * @param {Object} attributes
920      */
921     HomeXMLHandler.prototype.setHomeAttributes = function (home, elementName, attributes) {
922         {
923             var array124 = /* entrySet */ (function (o) { var s = []; for (var e in o)
924                 s.push({ k: e, v: o[e], getKey: function () { return this.k; }, getValue: function () { return this.v; } }); return s; })(/* peek */ (function (s) { return s[s.length - 1]; })(this.properties));
925             for (var index123 = 0; index123 < array124.length; index123++) {
926                 var property = array124[index123];
927                 {
928                     home.setProperty(property.getKey(), property.getValue());
929                 }
930             }
931         }
932         if ( /* size */this.furnitureVisibleProperties.length > 0) {
933             this.home.setFurnitureVisibleProperties(this.furnitureVisibleProperties);
934         }
935         this.home.setBackgroundImage(this.homeBackgroundImage);
936         home.setName(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "name"));
937         var selectedLevelId = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "selectedLevel");
938         if (selectedLevelId != null) {
939             this.home.setSelectedLevel(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.levels, selectedLevelId));
940         }
941         if ("observerCamera" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "camera")) {
942             this.home.setCamera(this.home.getObserverCamera());
943         }
944         home.setBasePlanLocked("true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "basePlanLocked"));
945         var furnitureSortedProperty = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "furnitureSortedProperty");
946         if (furnitureSortedProperty != null) {
947             try {
948                 home.setFurnitureSortedProperty(/* valueOf */ furnitureSortedProperty);
949             }
950             catch (ex) {
951             }
952             ;
953         }
954         home.setFurnitureDescendingSorted("true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "furnitureDescendingSorted"));
955         if (attributes['structure']) {
956             home['structure'] = this.parseContent(attributes['structure'], null, false);
957         }
958     };
959     /**
960      * Sets the attributes of the given <code>environment</code>.
961      * If needed, this method should be called from {@link #endElement}.
962      * @param {HomeEnvironment} environment
963      * @param {string} elementName
964      * @param {Object} attributes
965      * @private
966      */
967     HomeXMLHandler.prototype.setEnvironmentAttributes = function (environment, elementName, attributes) {
968         this.setProperties(environment);
969         var groundColor = this.parseOptionalColor(attributes, "groundColor");
970         if (groundColor != null) {
971             environment.setGroundColor(groundColor);
972         }
973         environment.setGroundTexture(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.textures, "groundTexture"));
974         environment.setBackgroundImageVisibleOnGround3D("true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "backgroundImageVisibleOnGround3D"));
975         var skyColor = this.parseOptionalColor(attributes, "skyColor");
976         if (skyColor != null) {
977             environment.setSkyColor(skyColor);
978         }
979         environment.setSkyTexture(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.textures, "skyTexture"));
980         var lightColor = this.parseOptionalColor(attributes, "lightColor");
981         if (lightColor != null) {
982             environment.setLightColor(lightColor);
983         }
984         var wallsAlpha = this.parseOptionalFloat(attributes, "wallsAlpha");
985         if (wallsAlpha != null) {
986             environment.setWallsAlpha(wallsAlpha);
987         }
988         environment.setAllLevelsVisible("true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "allLevelsVisible"));
989         environment.setObserverCameraElevationAdjusted(!("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "observerCameraElevationAdjusted")));
990         var ceillingLightColor = this.parseOptionalColor(attributes, "ceillingLightColor");
991         if (ceillingLightColor != null) {
992             environment.setCeillingLightColor(ceillingLightColor);
993         }
994         var drawingMode = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "drawingMode");
995         if (drawingMode != null) {
996             try {
997                 environment.setDrawingMode(/* Enum.valueOf */ HomeEnvironment.DrawingMode[drawingMode]);
998             }
999             catch (ex) {
1000             }
1001             ;
1002         }
1003         var subpartSizeUnderLight = this.parseOptionalFloat(attributes, "subpartSizeUnderLight");
1004         if (subpartSizeUnderLight != null) {
1005             environment.setSubpartSizeUnderLight(subpartSizeUnderLight);
1006         }
1007         var photoWidth = this.parseOptionalInteger(attributes, "photoWidth");
1008         if (photoWidth != null) {
1009             environment.setPhotoWidth(photoWidth);
1010         }
1011         var photoHeight = this.parseOptionalInteger(attributes, "photoHeight");
1012         if (photoHeight != null) {
1013             environment.setPhotoHeight(photoHeight);
1014         }
1015         var photoAspectRatio = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "photoAspectRatio");
1016         if (photoAspectRatio != null) {
1017             try {
1018                 environment.setPhotoAspectRatio(/* Enum.valueOf */ AspectRatio[photoAspectRatio]);
1019             }
1020             catch (ex) {
1021             }
1022             ;
1023         }
1024         var photoQuality = this.parseOptionalInteger(attributes, "photoQuality");
1025         if (photoQuality != null) {
1026             environment.setPhotoQuality(photoQuality);
1027         }
1028         var videoWidth = this.parseOptionalInteger(attributes, "videoWidth");
1029         if (videoWidth != null) {
1030             environment.setVideoWidth(videoWidth);
1031         }
1032         var videoAspectRatio = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "videoAspectRatio");
1033         if (videoAspectRatio != null) {
1034             try {
1035                 environment.setVideoAspectRatio(/* Enum.valueOf */ AspectRatio[videoAspectRatio]);
1036             }
1037             catch (ex) {
1038             }
1039             ;
1040         }
1041         var videoQuality = this.parseOptionalInteger(attributes, "videoQuality");
1042         if (videoQuality != null) {
1043             environment.setVideoQuality(videoQuality);
1044         }
1045         var videoSpeed = this.parseOptionalFloat(attributes, "videoSpeed");
1046         if (videoSpeed != null) {
1047             environment.setVideoSpeed(videoSpeed);
1048         }
1049         var videoFrameRate = this.parseOptionalInteger(attributes, "videoFrameRate");
1050         if (videoFrameRate != null) {
1051             environment.setVideoFrameRate(videoFrameRate);
1052         }
1053     };
1054     /**
1055      * Returns a new {@link HomePrint} instance initialized from the given <code>attributes</code>.
1056      * @param {Object} attributes
1057      * @return {HomePrint}
1058      */
1059     HomeXMLHandler.prototype.createPrint = function (attributes) {
1060         var paperOrientation = HomePrint.PaperOrientation.PORTRAIT;
1061         try {
1062             if ( /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "paperOrientation") == null) {
1063                 throw new SAXException("Missing paperOrientation attribute");
1064             }
1065             paperOrientation = /* Enum.valueOf */ HomePrint.PaperOrientation[ /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "paperOrientation")];
1066         }
1067         catch (ex) {
1068         }
1069         ;
1070         var homePrint = new HomePrint(paperOrientation, this.parseFloat(attributes, "paperWidth"), this.parseFloat(attributes, "paperHeight"), this.parseFloat(attributes, "paperTopMargin"), this.parseFloat(attributes, "paperLeftMargin"), this.parseFloat(attributes, "paperBottomMargin"), this.parseFloat(attributes, "paperRightMargin"), !("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "furniturePrinted")), !("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "planPrinted")), !("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "view3DPrinted")), this.parseOptionalFloat(attributes, "planScale"), /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "headerFormat"), /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "footerFormat"));
1071         return this.resolveObject(homePrint, "print", attributes);
1072     };
1073     /**
1074      * Sets the attributes of the given <code>compass</code>.
1075      * If needed, this method should be called from {@link #endElement}.
1076      * @param {Compass} compass
1077      * @param {string} elementName
1078      * @param {Object} attributes
1079      */
1080     HomeXMLHandler.prototype.setCompassAttributes = function (compass, elementName, attributes) {
1081         this.setProperties(compass);
1082         compass.setX(this.parseOptionalFloat(attributes, "x"));
1083         compass.setY(this.parseOptionalFloat(attributes, "y"));
1084         compass.setDiameter(this.parseOptionalFloat(attributes, "diameter"));
1085         var northDirection = this.parseOptionalFloat(attributes, "northDirection");
1086         if (northDirection != null) {
1087             compass.setNorthDirection(northDirection);
1088         }
1089         var longitude = this.parseOptionalFloat(attributes, "longitude");
1090         if (longitude != null) {
1091             compass.setLongitude(longitude);
1092         }
1093         var latitude = this.parseOptionalFloat(attributes, "latitude");
1094         if (latitude != null) {
1095             compass.setLatitude(latitude);
1096         }
1097         var timeZone = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "timeZone");
1098         if (timeZone != null) {
1099             compass.setTimeZone(timeZone);
1100         }
1101         compass.setVisible(!("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "visible")));
1102     };
1103     /**
1104      * Returns a new {@link Camera} instance initialized from the given <code>attributes</code>.
1105      * @param {string} elementName
1106      * @param {Object} attributes
1107      * @return {Camera}
1108      * @private
1109      */
1110     HomeXMLHandler.prototype.createCamera = function (elementName, attributes) {
1111         var id = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "id");
1112         var x = this.parseFloat(attributes, "x");
1113         var y = this.parseFloat(attributes, "y");
1114         var z = this.parseFloat(attributes, "z");
1115         var yaw = this.parseFloat(attributes, "yaw");
1116         var pitch = this.parseFloat(attributes, "pitch");
1117         var fieldOfView = this.parseFloat(attributes, "fieldOfView");
1118         var camera;
1119         if ("observerCamera" === elementName) {
1120             camera = id != null ? new ObserverCamera(id, x, y, z, yaw, pitch, fieldOfView) : new ObserverCamera(x, y, z, yaw, pitch, fieldOfView);
1121         }
1122         else {
1123             camera = id != null ? new Camera(id, x, y, z, yaw, pitch, fieldOfView) : new Camera(x, y, z, yaw, pitch, fieldOfView);
1124         }
1125         return this.resolveObject(camera, elementName, attributes);
1126     };
1127     /**
1128      * Sets the attributes of the given <code>camera</code>.
1129      * If needed, this method should be called from {@link #endElement}.
1130      * @param {Camera} camera
1131      * @param {string} elementName
1132      * @param {Object} attributes
1133      */
1134     HomeXMLHandler.prototype.setCameraAttributes = function (camera, elementName, attributes) {
1135         this.setProperties(camera);
1136         if (camera != null && camera instanceof ObserverCamera) {
1137             camera.setFixedSize("true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "fixedSize"));
1138         }
1139         var lens = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "lens");
1140         if (lens != null) {
1141             try {
1142                 camera.setLens(/* Enum.valueOf */ Camera.Lens[lens]);
1143             }
1144             catch (ex) {
1145             }
1146             ;
1147         }
1148         var time = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "time");
1149         if (time != null) {
1150             try {
1151                 camera.setTime(/* parseLong */ parseInt(time));
1152             }
1153             catch (ex) {
1154                 throw new SAXException("Invalid value for long attribute time", ex);
1155             }
1156             ;
1157         }
1158         camera.setName(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "name"));
1159     };
1160     /**
1161      * Returns a new {@link Level} instance initialized from the given <code>attributes</code>.
1162      * @param {string} elementName
1163      * @param {Object} attributes
1164      * @return {Level}
1165      * @private
1166      */
1167     HomeXMLHandler.prototype.createLevel = function (elementName, attributes) {
1168         var id = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "id");
1169         var name = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "name");
1170         var elevation = this.parseFloat(attributes, "elevation");
1171         var floorThickness = this.parseFloat(attributes, "floorThickness");
1172         var height = this.parseFloat(attributes, "height");
1173         var level = id != null ? new Level(id, name, elevation, floorThickness, height) : new Level(name, elevation, floorThickness, height);
1174         return this.resolveObject(level, elementName, attributes);
1175     };
1176     /**
1177      * Sets the attributes of the given <code>level</code>.
1178      * If needed, this method should be called from {@link #endElement}.
1179      * @param {Level} level
1180      * @param {string} elementName
1181      * @param {Object} attributes
1182      */
1183     HomeXMLHandler.prototype.setLevelAttributes = function (level, elementName, attributes) {
1184         this.setProperties(level);
1185         level.setBackgroundImage(this.backgroundImage);
1186         var elevationIndex = this.parseOptionalInteger(attributes, "elevationIndex");
1187         if (elevationIndex != null) {
1188             level.setElevationIndex(elevationIndex);
1189         }
1190         level.setVisible(!("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "visible")));
1191         level.setViewable(!("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "viewable")));
1192     };
1193     /**
1194      * Returns a new {@link HomePieceOfFurniture} instance initialized from the given <code>attributes</code>.
1195      * @param {string} elementName
1196      * @param {Object} attributes
1197      * @return {HomePieceOfFurniture}
1198      * @private
1199      */
1200     HomeXMLHandler.prototype.createPieceOfFurniture = function (elementName, attributes) {
1201         var id = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "id");
1202         var catalogId = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "catalogId");
1203         var tags = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "tags") != null ? /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "tags").split(" ") : null;
1204         var elevation = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "elevation") != null ? this.parseFloat(attributes, "elevation") : 0;
1205         var dropOnTopElevation = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "dropOnTopElevation") != null ? this.parseFloat(attributes, "dropOnTopElevation") : 1;
1206         var modelRotation = null;
1207         if ( /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "modelRotation") != null) {
1208             var values = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "modelRotation").split(" ", 9);
1209             if (values.length < 9) {
1210                 throw new SAXException("Missing values for attribute modelRotation");
1211             }
1212             try {
1213                 modelRotation = [[/* parseFloat */ parseFloat(values[0]), /* parseFloat */ parseFloat(values[1]), /* parseFloat */ parseFloat(values[2])], [/* parseFloat */ parseFloat(values[3]), /* parseFloat */ parseFloat(values[4]), /* parseFloat */ parseFloat(values[5])], [/* parseFloat */ parseFloat(values[6]), /* parseFloat */ parseFloat(values[7]), /* parseFloat */ parseFloat(values[8])]];
1214             }
1215             catch (ex) {
1216                 throw new SAXException("Invalid value for attribute modelRotation", ex);
1217             }
1218             ;
1219         }
1220         var name = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "name");
1221         var description = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "description");
1222         var information = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "information");
1223         var creationDate = this.parseOptionalLong(attributes, "creationDate");
1224         var grade = this.parseOptionalFloat(attributes, "grade");
1225         var icon = this.parseContent(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "icon"), catalogId, false);
1226         var planIcon = this.parseContent(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "planIcon"), catalogId, false);
1227         var model = this.parseContent(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "model"), catalogId, false);
1228         var width = this.parseFloat(attributes, "width");
1229         var depth = this.parseFloat(attributes, "depth");
1230         var height = this.parseFloat(attributes, "height");
1231         var movable = !("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "movable"));
1232         var backFaceShown = "true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "backFaceShown");
1233         var modelSize = this.parseOptionalLong(attributes, "modelSize");
1234         var creator = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "creator");
1235         var resizable = !("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "resizable"));
1236         var deformable = !("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "deformable"));
1237         var texturable = !("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "texturable"));
1238         var price = this.parseOptionalDecimal(attributes, "price");
1239         var valueAddedTaxPercentage = this.parseOptionalDecimal(attributes, "valueAddedTaxPercentage");
1240         var currency = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "currency");
1241         var piece;
1242         if (("doorOrWindow" === elementName) || ("true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "doorOrWindow"))) {
1243             var wallThickness = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "wallThickness") != null ? this.parseFloat(attributes, "wallThickness") : 1;
1244             var wallDistance = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "wallDistance") != null ? this.parseFloat(attributes, "wallDistance") : 0;
1245             var cutOutShape = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "cutOutShape");
1246             if (cutOutShape == null && !("doorOrWindow" === elementName)) {
1247                 cutOutShape = PieceOfFurniture.DEFAULT_CUT_OUT_SHAPE;
1248             }
1249             var wallCutOutOnBothSides = "true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "wallCutOutOnBothSides");
1250             var widthDepthDeformable = !("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "widthDepthDeformable"));
1251             var catalogDoorOrWindow = new CatalogDoorOrWindow(catalogId, name, description, information, tags, creationDate, grade, icon, planIcon, model, width, depth, height, elevation, dropOnTopElevation, movable, cutOutShape, wallThickness, wallDistance, wallCutOutOnBothSides, widthDepthDeformable, /* toArray */ this.sashes.slice(0), modelRotation, backFaceShown, modelSize, creator, resizable, deformable, texturable, price, valueAddedTaxPercentage, currency);
1252             piece = id != null ? new HomeDoorOrWindow(id, catalogDoorOrWindow) : new HomeDoorOrWindow(catalogDoorOrWindow);
1253         }
1254         else {
1255             var staircaseCutOutShape = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "staircaseCutOutShape");
1256             var horizontallyRotatable = !("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "horizontallyRotatable"));
1257             if ("light" === elementName) {
1258                 var catalogLight = new CatalogLight(catalogId, name, description, information, tags, creationDate, grade, icon, planIcon, model, width, depth, height, elevation, dropOnTopElevation, movable, /* toArray */ this.lightSources.slice(0), staircaseCutOutShape, modelRotation, backFaceShown, modelSize, creator, resizable, deformable, texturable, horizontallyRotatable, price, valueAddedTaxPercentage, currency);
1259                 piece = id != null ? new HomeLight(id, catalogLight) : new HomeLight(catalogLight);
1260             }
1261             else {
1262                 var catalogPiece = new CatalogPieceOfFurniture(catalogId, name, description, information, tags, creationDate, grade, icon, planIcon, model, width, depth, height, elevation, dropOnTopElevation, movable, staircaseCutOutShape, modelRotation, backFaceShown, modelSize, creator, resizable, deformable, texturable, horizontallyRotatable, price, valueAddedTaxPercentage, currency);
1263                 piece = id != null ? new HomePieceOfFurniture(id, catalogPiece) : new HomePieceOfFurniture(catalogPiece);
1264             }
1265         }
1266         return this.resolveObject(piece, elementName, attributes);
1267     };
1268     /**
1269      * Returns a new {@link HomeFurnitureGroup} instance initialized from the given <code>attributes</code>.
1270      * @param {string} elementName
1271      * @param {Object} attributes
1272      * @param {HomePieceOfFurniture[]} furniture
1273      * @return {HomeFurnitureGroup}
1274      * @private
1275      */
1276     HomeXMLHandler.prototype.createFurnitureGroup = function (elementName, attributes, furniture) {
1277         var id = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "id");
1278         var angle = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "angle") != null ? this.parseFloat(attributes, "angle") : 0;
1279         var modelMirrored = "true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "modelMirrored");
1280         var name = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "name");
1281         var furnitureGroup = id != null ? new HomeFurnitureGroup(id, furniture, angle, modelMirrored, name) : new HomeFurnitureGroup(furniture, angle, modelMirrored, name);
1282         return this.resolveObject(furnitureGroup, elementName, attributes);
1283     };
1284     /**
1285      * Sets the attributes of the given <code>piece</code>.
1286      * If needed, this method should be called from {@link #endElement}.
1287      * @param {HomePieceOfFurniture} piece
1288      * @param {string} elementName
1289      * @param {Object} attributes
1290      */
1291     HomeXMLHandler.prototype.setPieceOfFurnitureAttributes = function (piece, elementName, attributes) {
1292         this.setProperties(piece);
1293         piece.setNameStyle(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(/* peek */ (function (s) { return s[s.length - 1]; })(this.textStyles), "nameStyle"));
1294         piece.setNameVisible("true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "nameVisible"));
1295         var nameAngle = this.parseOptionalFloat(attributes, "nameAngle");
1296         if (nameAngle != null) {
1297             piece.setNameAngle(nameAngle);
1298         }
1299         var nameXOffset = this.parseOptionalFloat(attributes, "nameXOffset");
1300         if (nameXOffset != null) {
1301             piece.setNameXOffset(nameXOffset);
1302         }
1303         var nameYOffset = this.parseOptionalFloat(attributes, "nameYOffset");
1304         if (nameYOffset != null) {
1305             piece.setNameYOffset(nameYOffset);
1306         }
1307         piece.setVisible(!("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "visible")));
1308         if (!(piece != null && piece instanceof HomeFurnitureGroup)) {
1309             var x = this.parseOptionalFloat(attributes, "x");
1310             if (x != null) {
1311                 piece.setX(x);
1312             }
1313             var y = this.parseOptionalFloat(attributes, "y");
1314             if (y != null) {
1315                 piece.setY(y);
1316             }
1317             var angle = this.parseOptionalFloat(attributes, "angle");
1318             if (angle != null) {
1319                 piece.setAngle(angle);
1320             }
1321             if (piece.isHorizontallyRotatable()) {
1322                 var pitch = this.parseOptionalFloat(attributes, "pitch");
1323                 if (pitch != null) {
1324                     piece.setPitch(pitch);
1325                 }
1326                 var roll = this.parseOptionalFloat(attributes, "roll");
1327                 if (roll != null) {
1328                     piece.setRoll(roll);
1329                 }
1330             }
1331             var widthInPlan = this.parseOptionalFloat(attributes, "widthInPlan");
1332             if (widthInPlan != null) {
1333                 piece.setWidthInPlan(widthInPlan);
1334             }
1335             var depthInPlan = this.parseOptionalFloat(attributes, "depthInPlan");
1336             if (depthInPlan != null) {
1337                 piece.setDepthInPlan(depthInPlan);
1338             }
1339             var heightInPlan = this.parseOptionalFloat(attributes, "heightInPlan");
1340             if (heightInPlan != null) {
1341                 piece.setHeightInPlan(heightInPlan);
1342             }
1343             if (this.home.getVersion() < 5500 || ("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "modelCenteredAtOrigin"))) {
1344                 piece.setModelCenteredAtOrigin(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "modelRotation") == null);
1345             }
1346             if (piece.isResizable()) {
1347                 piece.setModelMirrored("true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "modelMirrored"));
1348             }
1349             if (piece.isTexturable()) {
1350                 if ( /* size */this.materials.length > 0) {
1351                     piece.setModelMaterials(/* toArray */ this.materials.slice(0));
1352                 }
1353                 var color = this.parseOptionalColor(attributes, "color");
1354                 if (color != null) {
1355                     piece.setColor(color);
1356                 }
1357                 var texture = (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.textures, HomeXMLHandler.UNIQUE_ATTRIBUTE);
1358                 if (texture != null) {
1359                     piece.setTexture(texture);
1360                 }
1361                 var shininess = this.parseOptionalFloat(attributes, "shininess");
1362                 if (shininess != null) {
1363                     piece.setShininess(shininess);
1364                 }
1365             }
1366             if (piece.isDeformable()) {
1367                 if ( /* size */this.transformations.length > 0) {
1368                     piece.setModelTransformations(/* toArray */ this.transformations.slice(0));
1369                 }
1370             }
1371             if ((piece != null && piece instanceof HomeLight) && /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "power") != null) {
1372                 piece.setPower(this.parseFloat(attributes, "power"));
1373             }
1374             else if ((piece != null && piece instanceof HomeDoorOrWindow) && ("doorOrWindow" === elementName)) {
1375                 var doorOrWindow = piece;
1376                 doorOrWindow.setBoundToWall(!("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "boundToWall")));
1377                 var wallWidth = this.parseOptionalFloat(attributes, "wallWidth");
1378                 if (wallWidth != null) {
1379                     doorOrWindow.setWallWidth(wallWidth);
1380                 }
1381                 var wallLeft = this.parseOptionalFloat(attributes, "wallLeft");
1382                 if (wallLeft != null) {
1383                     doorOrWindow.setWallLeft(wallLeft);
1384                 }
1385                 var wallHeight = this.parseOptionalFloat(attributes, "wallHeight");
1386                 if (wallHeight != null) {
1387                     doorOrWindow.setWallHeight(wallHeight);
1388                 }
1389                 var wallTop = this.parseOptionalFloat(attributes, "wallTop");
1390                 if (wallTop != null) {
1391                     doorOrWindow.setWallTop(wallTop);
1392                 }
1393             }
1394         }
1395         else {
1396             piece.setCatalogId(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "catalogId"));
1397             piece.setDescription(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "description"));
1398             piece.setInformation(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "information"));
1399             piece.setCreator(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "creator"));
1400         }
1401     };
1402     /**
1403      * Returns a new {@link Wall} instance initialized from the given <code>attributes</code>.
1404      * @param {string} elementName
1405      * @param {Object} attributes
1406      * @return {Wall}
1407      * @private
1408      */
1409     HomeXMLHandler.prototype.createWall = function (elementName, attributes) {
1410         var id = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "id");
1411         var xStart = this.parseFloat(attributes, "xStart");
1412         var yStart = this.parseFloat(attributes, "yStart");
1413         var xEnd = this.parseFloat(attributes, "xEnd");
1414         var yEnd = this.parseFloat(attributes, "yEnd");
1415         var thickness = this.parseFloat(attributes, "thickness");
1416         var wall = id != null ? new Wall(id, xStart, yStart, xEnd, yEnd, thickness, 0) : new Wall(xStart, yStart, xEnd, yEnd, thickness, 0);
1417         return this.resolveObject(wall, elementName, attributes);
1418     };
1419     /**
1420      * Sets the attributes of the given <code>wall</code>.
1421      * If needed, this method should be called from {@link #endElement}.
1422      * @param {Wall} wall
1423      * @param {string} elementName
1424      * @param {Object} attributes
1425      */
1426     HomeXMLHandler.prototype.setWallAttributes = function (wall, elementName, attributes) {
1427         this.setProperties(wall);
1428         wall.setLeftSideBaseboard(this.leftSideBaseboard);
1429         wall.setRightSideBaseboard(this.rightSideBaseboard);
1430         wall.setHeight(this.parseOptionalFloat(attributes, "height"));
1431         wall.setHeightAtEnd(this.parseOptionalFloat(attributes, "heightAtEnd"));
1432         wall.setArcExtent(this.parseOptionalFloat(attributes, "arcExtent"));
1433         wall.setTopColor(this.parseOptionalColor(attributes, "topColor"));
1434         wall.setLeftSideColor(this.parseOptionalColor(attributes, "leftSideColor"));
1435         wall.setLeftSideTexture(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.textures, "leftSideTexture"));
1436         var leftSideShininess = this.parseOptionalFloat(attributes, "leftSideShininess");
1437         if (leftSideShininess != null) {
1438             wall.setLeftSideShininess(leftSideShininess);
1439         }
1440         wall.setRightSideColor(this.parseOptionalColor(attributes, "rightSideColor"));
1441         wall.setRightSideTexture(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.textures, "rightSideTexture"));
1442         var rightSideShininess = this.parseOptionalFloat(attributes, "rightSideShininess");
1443         if (rightSideShininess != null) {
1444             wall.setRightSideShininess(rightSideShininess);
1445         }
1446         var pattern = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "pattern");
1447         if (pattern != null) {
1448             try {
1449                 wall.setPattern(this.preferences.getPatternsCatalog().getPattern$java_lang_String(pattern));
1450             }
1451             catch (ex) {
1452             }
1453             ;
1454         }
1455     };
1456     /**
1457      * Returns a new {@link Room} instance initialized from the given <code>attributes</code>.
1458      * @param {string} elementName
1459      * @param {Object} attributes
1460      * @param {Array} points
1461      * @return {Room}
1462      * @private
1463      */
1464     HomeXMLHandler.prototype.createRoom = function (elementName, attributes, points) {
1465         var id = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "id");
1466         var room = id != null ? new Room(id, points) : new Room(points);
1467         return this.resolveObject(room, elementName, attributes);
1468     };
1469     /**
1470      * Sets the attributes of the given <code>room</code>.
1471      * If needed, this method should be called from {@link #endElement}.
1472      * @param {Room} room
1473      * @param {string} elementName
1474      * @param {Object} attributes
1475      */
1476     HomeXMLHandler.prototype.setRoomAttributes = function (room, elementName, attributes) {
1477         this.setProperties(room);
1478         room.setNameStyle(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(/* peek */ (function (s) { return s[s.length - 1]; })(this.textStyles), "nameStyle"));
1479         room.setAreaStyle(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(/* peek */ (function (s) { return s[s.length - 1]; })(this.textStyles), "areaStyle"));
1480         room.setName(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "name"));
1481         var nameAngle = this.parseOptionalFloat(attributes, "nameAngle");
1482         if (nameAngle != null) {
1483             room.setNameAngle(nameAngle);
1484         }
1485         var nameXOffset = this.parseOptionalFloat(attributes, "nameXOffset");
1486         if (nameXOffset != null) {
1487             room.setNameXOffset(nameXOffset);
1488         }
1489         var nameYOffset = this.parseOptionalFloat(attributes, "nameYOffset");
1490         if (nameYOffset != null) {
1491             room.setNameYOffset(nameYOffset);
1492         }
1493         room.setAreaVisible("true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "areaVisible"));
1494         var areaAngle = this.parseOptionalFloat(attributes, "areaAngle");
1495         if (areaAngle != null) {
1496             room.setAreaAngle(areaAngle);
1497         }
1498         var areaXOffset = this.parseOptionalFloat(attributes, "areaXOffset");
1499         if (areaXOffset != null) {
1500             room.setAreaXOffset(areaXOffset);
1501         }
1502         var areaYOffset = this.parseOptionalFloat(attributes, "areaYOffset");
1503         if (areaYOffset != null) {
1504             room.setAreaYOffset(areaYOffset);
1505         }
1506         room.setFloorVisible(!("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "floorVisible")));
1507         room.setFloorColor(this.parseOptionalColor(attributes, "floorColor"));
1508         room.setFloorTexture(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.textures, "floorTexture"));
1509         var floorShininess = this.parseOptionalFloat(attributes, "floorShininess");
1510         if (floorShininess != null) {
1511             room.setFloorShininess(floorShininess);
1512         }
1513         room.setCeilingVisible(!("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "ceilingVisible")));
1514         room.setCeilingColor(this.parseOptionalColor(attributes, "ceilingColor"));
1515         room.setCeilingTexture(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.textures, "ceilingTexture"));
1516         var ceilingShininess = this.parseOptionalFloat(attributes, "ceilingShininess");
1517         if (ceilingShininess != null) {
1518             room.setCeilingShininess(ceilingShininess);
1519         }
1520     };
1521     /**
1522      * Returns a new {@link Polyline} instance initialized from the given <code>attributes</code>.
1523      * @param {string} elementName
1524      * @param {Object} attributes
1525      * @param {Array} points
1526      * @return {Polyline}
1527      * @private
1528      */
1529     HomeXMLHandler.prototype.createPolyline = function (elementName, attributes, points) {
1530         var id = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "id");
1531         var polyline = id != null ? new Polyline(id, points) : new Polyline(points);
1532         return this.resolveObject(polyline, elementName, attributes);
1533     };
1534     /**
1535      * Sets the attributes of the given <code>polyline</code>.
1536      * If needed, this method should be called from {@link #endElement}.
1537      * @param {Polyline} polyline
1538      * @param {string} elementName
1539      * @param {Object} attributes
1540      */
1541     HomeXMLHandler.prototype.setPolylineAttributes = function (polyline, elementName, attributes) {
1542         this.setProperties(polyline);
1543         var thickness = this.parseOptionalFloat(attributes, "thickness");
1544         if (thickness != null) {
1545             polyline.setThickness(thickness);
1546         }
1547         var capStyle = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "capStyle");
1548         if (capStyle != null) {
1549             try {
1550                 polyline.setCapStyle(/* Enum.valueOf */ Polyline.CapStyle[capStyle]);
1551             }
1552             catch (ex) {
1553             }
1554             ;
1555         }
1556         var joinStyle = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "joinStyle");
1557         if (joinStyle != null) {
1558             try {
1559                 polyline.setJoinStyle(/* Enum.valueOf */ Polyline.JoinStyle[joinStyle]);
1560             }
1561             catch (ex) {
1562             }
1563             ;
1564         }
1565         var dashStyle = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "dashStyle");
1566         if (dashStyle != null) {
1567             try {
1568                 polyline.setDashStyle(/* Enum.valueOf */ Polyline.DashStyle[dashStyle]);
1569             }
1570             catch (ex) {
1571             }
1572             ;
1573         }
1574         var dashPattern = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "dashPattern");
1575         if (dashPattern != null) {
1576             try {
1577                 var values = dashPattern.split(" ");
1578                 var pattern = (function (s) { var a = []; while (s-- > 0)
1579                     a.push(0); return a; })(values.length);
1580                 for (var i = 0; i < values.length; i++) {
1581                     {
1582                         pattern[i] = /* parseFloat */ parseFloat(values[i]);
1583                     }
1584                     ;
1585                 }
1586                 polyline.setDashPattern(pattern);
1587             }
1588             catch (ex) {
1589                 throw new SAXException("Invalid value for dash pattern", ex);
1590             }
1591             ;
1592         }
1593         var dashOffset = this.parseOptionalFloat(attributes, "dashOffset");
1594         if (dashOffset != null) {
1595             polyline.setDashOffset(dashOffset);
1596         }
1597         var startArrowStyle = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "startArrowStyle");
1598         if (startArrowStyle != null) {
1599             try {
1600                 polyline.setStartArrowStyle(/* Enum.valueOf */ Polyline.ArrowStyle[startArrowStyle]);
1601             }
1602             catch (ex) {
1603             }
1604             ;
1605         }
1606         var endArrowStyle = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "endArrowStyle");
1607         if (endArrowStyle != null) {
1608             try {
1609                 polyline.setEndArrowStyle(/* Enum.valueOf */ Polyline.ArrowStyle[endArrowStyle]);
1610             }
1611             catch (ex) {
1612             }
1613             ;
1614         }
1615         var elevation = this.parseOptionalFloat(attributes, "elevation");
1616         if (elevation != null) {
1617             polyline.setVisibleIn3D(true);
1618             polyline.setElevation(elevation);
1619         }
1620         var color = this.parseOptionalColor(attributes, "color");
1621         if (color != null) {
1622             polyline.setColor(color);
1623         }
1624         polyline.setClosedPath("true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "closedPath"));
1625     };
1626     /**
1627      * Returns a new {@link DimensionLine} instance initialized from the given <code>attributes</code>.
1628      * @param {string} elementName
1629      * @param {Object} attributes
1630      * @return {DimensionLine}
1631      * @private
1632      */
1633     HomeXMLHandler.prototype.createDimensionLine = function (elementName, attributes) {
1634         var id = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "id");
1635         var xStart = this.parseFloat(attributes, "xStart");
1636         var yStart = this.parseFloat(attributes, "yStart");
1637         var xEnd = this.parseFloat(attributes, "xEnd");
1638         var yEnd = this.parseFloat(attributes, "yEnd");
1639         var offset = this.parseFloat(attributes, "offset");
1640         var dimensionLine = id != null ? new DimensionLine(id, xStart, yStart, xEnd, yEnd, offset) : new DimensionLine(xStart, yStart, xEnd, yEnd, offset);
1641         return this.resolveObject(dimensionLine, elementName, attributes);
1642     };
1643     /**
1644      * Sets the attributes of the given dimension line.
1645      * If needed, this method should be called from {@link #endElement}.
1646      * @param {DimensionLine} dimensionLine
1647      * @param {string} elementName
1648      * @param {Object} attributes
1649      */
1650     HomeXMLHandler.prototype.setDimensionLineAttributes = function (dimensionLine, elementName, attributes) {
1651         this.setProperties(dimensionLine);
1652         dimensionLine.setLengthStyle(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(/* peek */ (function (s) { return s[s.length - 1]; })(this.textStyles), "lengthStyle"));
1653     };
1654     /**
1655      * Returns a new {@link Label} instance initialized from the given <code>attributes</code>.
1656      * @param {string} elementName
1657      * @param {Object} attributes
1658      * @param {string} text
1659      * @return {Label}
1660      * @private
1661      */
1662     HomeXMLHandler.prototype.createLabel = function (elementName, attributes, text) {
1663         var id = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "id");
1664         var x = this.parseFloat(attributes, "x");
1665         var y = this.parseFloat(attributes, "y");
1666         var label = id != null ? new Label(id, text, x, y) : new Label(text, x, y);
1667         return this.resolveObject(label, elementName, attributes);
1668     };
1669     /**
1670      * Sets the attributes of the given <code>label</code>.
1671      * If needed, this method should be called from {@link #endElement}.
1672      * @param {Label} label
1673      * @param {string} elementName
1674      * @param {Object} attributes
1675      */
1676     HomeXMLHandler.prototype.setLabelAttributes = function (label, elementName, attributes) {
1677         this.setProperties(label);
1678         label.setStyle(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(/* peek */ (function (s) { return s[s.length - 1]; })(this.textStyles), HomeXMLHandler.UNIQUE_ATTRIBUTE));
1679         var angle = this.parseOptionalFloat(attributes, "angle");
1680         if (angle != null) {
1681             label.setAngle(angle);
1682         }
1683         var elevation = this.parseOptionalFloat(attributes, "elevation");
1684         if (elevation != null) {
1685             label.setElevation(elevation);
1686         }
1687         var pitch = this.parseOptionalFloat(attributes, "pitch");
1688         if (pitch != null) {
1689             label.setPitch(pitch);
1690         }
1691         label.setColor(this.parseOptionalColor(attributes, "color"));
1692         label.setOutlineColor(this.parseOptionalColor(attributes, "outlineColor"));
1693     };
1694     /**
1695      * Returns a new {@link Baseboard} instance initialized from the given <code>attributes</code>.
1696      * @param {string} elementName
1697      * @param {Object} attributes
1698      * @return {Baseboard}
1699      * @private
1700      */
1701     HomeXMLHandler.prototype.createBaseboard = function (elementName, attributes) {
1702         var baseboard = Baseboard.getInstance(this.parseFloat(attributes, "thickness"), this.parseFloat(attributes, "height"), this.parseOptionalColor(attributes, "color"), /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.textures, HomeXMLHandler.UNIQUE_ATTRIBUTE));
1703         return this.resolveObject(baseboard, elementName, attributes);
1704     };
1705     /**
1706      * Returns a new {@link TextStyle} instance initialized from the given <code>attributes</code>.
1707      * @param {string} elementName
1708      * @param {Object} attributes
1709      * @return {TextStyle}
1710      * @private
1711      */
1712     HomeXMLHandler.prototype.createTextStyle = function (elementName, attributes) {
1713         var alignment = TextStyle.Alignment.CENTER;
1714         var alignmentString = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "alignment");
1715         if (alignmentString != null) {
1716             try {
1717                 alignment = /* Enum.valueOf */ TextStyle.Alignment[alignmentString];
1718             }
1719             catch (ex) {
1720             }
1721             ;
1722         }
1723         var textStyle = new TextStyle(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "fontName"), this.parseFloat(attributes, "fontSize"), "true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "bold"), "true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "italic"), alignment);
1724         return this.resolveObject(textStyle, elementName, attributes);
1725     };
1726     /**
1727      * Returns a new {@link HomeTexture} instance initialized from the given <code>attributes</code>.
1728      * @param {string} elementName
1729      * @param {Object} attributes
1730      * @return {HomeTexture}
1731      * @private
1732      */
1733     HomeXMLHandler.prototype.createTexture = function (elementName, attributes) {
1734         var catalogId = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "catalogId");
1735         var texture = new HomeTexture(new CatalogTexture(catalogId, /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "name"), this.parseContent(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "image"), catalogId, true), this.parseFloat(attributes, "width"), this.parseFloat(attributes, "height"), /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "creator")), /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "xOffset") != null ? this.parseFloat(attributes, "xOffset") : 0, /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "yOffset") != null ? this.parseFloat(attributes, "yOffset") : 0, /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "angle") != null ? this.parseFloat(attributes, "angle") : 0, /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "scale") != null ? this.parseFloat(attributes, "scale") : 1, !("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "leftToRightOriented")));
1736         return this.resolveObject(texture, elementName, attributes);
1737     };
1738     /**
1739      * Returns a new {@link HomeMaterial} instance initialized from the given <code>attributes</code>.
1740      * @param {string} elementName
1741      * @param {Object} attributes
1742      * @return {HomeMaterial}
1743      * @private
1744      */
1745     HomeXMLHandler.prototype.createMaterial = function (elementName, attributes) {
1746         var material = new HomeMaterial(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "name"), /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "key"), this.parseOptionalColor(attributes, "color"), this.materialTexture, this.parseOptionalFloat(attributes, "shininess"));
1747         return this.resolveObject(material, elementName, attributes);
1748     };
1749     /**
1750      * Sets the properties of the given <code>object</code>.
1751      * @param {HomeObject} object
1752      * @private
1753      */
1754     HomeXMLHandler.prototype.setProperties = function (object) {
1755         {
1756             var array126 = /* entrySet */ (function (o) { var s = []; for (var e in o)
1757                 s.push({ k: e, v: o[e], getKey: function () { return this.k; }, getValue: function () { return this.v; } }); return s; })(/* peek */ (function (s) { return s[s.length - 1]; })(this.properties));
1758             for (var index125 = 0; index125 < array126.length; index125++) {
1759                 var property = array126[index125];
1760                 {
1761                     object.setProperty(property.getKey(), property.getValue());
1762                 }
1763             }
1764         }
1765     };
1766     /**
1767      * Returns the color integer from a hexadecimal string.
1768      * @param {Object} attributes
1769      * @param {string} name
1770      * @return {number}
1771      * @private
1772      */
1773     HomeXMLHandler.prototype.parseOptionalColor = function (attributes, name) {
1774         var color = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, name);
1775         if (color != null) {
1776             try {
1777                 return (parseInt(color, 16) | 0);
1778             }
1779             catch (ex) {
1780                 throw new SAXException("Invalid value for color attribute " + name, ex);
1781             }
1782             ;
1783         }
1784         else {
1785             return null;
1786         }
1787     };
1788     HomeXMLHandler.prototype.parseOptionalInteger = function (attributes, name) {
1789         var value = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, name);
1790         if (value != null) {
1791             try {
1792                 return /* parseInt */ parseInt(value);
1793             }
1794             catch (ex) {
1795                 throw new SAXException("Invalid value for integer attribute " + name, ex);
1796             }
1797             ;
1798         }
1799         else {
1800             return null;
1801         }
1802     };
1803     HomeXMLHandler.prototype.parseOptionalLong = function (attributes, name) {
1804         var value = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, name);
1805         if (value != null) {
1806             try {
1807                 return /* parseLong */ parseInt(value);
1808             }
1809             catch (ex) {
1810                 throw new SAXException("Invalid value for long attribute " + name, ex);
1811             }
1812             ;
1813         }
1814         else {
1815             return null;
1816         }
1817     };
1818     HomeXMLHandler.prototype.parseOptionalDecimal = function (attributes, name) {
1819         var value = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, name);
1820         if (value != null) {
1821             try {
1822                 return new Big(value);
1823             }
1824             catch (ex) {
1825                 throw new SAXException("Invalid value for decimal attribute " + name, ex);
1826             }
1827             ;
1828         }
1829         else {
1830             return null;
1831         }
1832     };
1833     HomeXMLHandler.prototype.parseOptionalFloat = function (attributes, name) {
1834         var value = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, name);
1835         if (value != null) {
1836             try {
1837                 return /* parseFloat */ parseFloat(value);
1838             }
1839             catch (ex) {
1840                 throw new SAXException("Invalid value for float attribute " + name, ex);
1841             }
1842             ;
1843         }
1844         else {
1845             return null;
1846         }
1847     };
1848     HomeXMLHandler.prototype.parseFloat = function (attributes, name) {
1849         var value = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, name);
1850         if (value != null) {
1851             try {
1852                 return /* parseFloat */ parseFloat(value);
1853             }
1854             catch (ex) {
1855                 throw new SAXException("Invalid value for float attribute " + name, ex);
1856             }
1857             ;
1858         }
1859         else {
1860             throw new SAXException("Missing float attribute " + name);
1861         }
1862     };
1863     /**
1864      * Returns the content object matching the given string.
1865      * @param {string} contentFile
1866      * @param {string} catalogId
1867      * @param {boolean} textureId
1868      * @return {Object}
1869      * @private
1870      */
1871     HomeXMLHandler.prototype.parseContent = function (contentFile, catalogId, textureId) {
1872         if (contentFile == null) {
1873             return null;
1874         }
1875         else if (contentFile.indexOf('://') >= 0) {
1876             return new URLContent(contentFile);
1877         }
1878         else {
1879             return new HomeURLContent('jar:' + this['homeUrl'] + '!/' + contentFile);
1880         }
1881     };
1882     /**
1883      * Sets the home that will be updated by this handler.
1884      * If a subclass of this handler uses a root element different from <code>home</code>,
1885      * it should call this method from {@link #startElement} to store the
1886      * {@link Home} subclass instance read from the XML stream.
1887      * @param {Home} home
1888      */
1889     HomeXMLHandler.prototype.setHome = function (home) {
1890         this.home = home;
1891         this.homeElementName = /* peek */ (function (s) { return s[s.length - 1]; })(this.elements);
1892     };
1893     /**
1894      * Returns the home read by this handler.
1895      * @return {Home}
1896      */
1897     HomeXMLHandler.prototype.getHome = function () {
1898         return this.home;
1899     };
1900     HomeXMLHandler.UNIQUE_ATTRIBUTE = "@&unique&@";
1901     return HomeXMLHandler;
1902 }(DefaultHandler));
1903 HomeXMLHandler["__class"] = "com.eteks.sweethome3d.io.HomeXMLHandler";
1904 HomeXMLHandler["__interfaces"] = ["org.xml.sax.ErrorHandler", "org.xml.sax.DTDHandler", "org.xml.sax.ContentHandler", "org.xml.sax.EntityResolver"];
1905 (function (HomeXMLHandler) {
1906     /**
1907      * Class storing the ID of the walls connected to a given wall.
1908      * @param {Wall} wall
1909      * @param {string} wallAtStartId
1910      * @param {string} wallAtEndId
1911      * @class
1912      */
1913     var JoinedWall = /** @class */ (function () {
1914         function JoinedWall(wall, wallAtStartId, wallAtEndId) {
1915             if (this.wall === undefined) {
1916                 this.wall = null;
1917             }
1918             if (this.wallAtStartId === undefined) {
1919                 this.wallAtStartId = null;
1920             }
1921             if (this.wallAtEndId === undefined) {
1922                 this.wallAtEndId = null;
1923             }
1924             this.wall = wall;
1925             this.wallAtStartId = wallAtStartId;
1926             this.wallAtEndId = wallAtEndId;
1927         }
1928         JoinedWall.prototype.getWall = function () {
1929             return this.wall;
1930         };
1931         JoinedWall.prototype.getWallAtStartId = function () {
1932             return this.wallAtStartId;
1933         };
1934         JoinedWall.prototype.getWallAtEndId = function () {
1935             return this.wallAtEndId;
1936         };
1937         return JoinedWall;
1938     }());
1939     HomeXMLHandler.JoinedWall = JoinedWall;
1940     JoinedWall["__class"] = "com.eteks.sweethome3d.io.HomeXMLHandler.JoinedWall";
1941 })(HomeXMLHandler || (HomeXMLHandler = {}));
1942 /**
1943  * Creates a patterns catalog.
1944  * @param {*[]} patterns
1945  * @class
1946  * @author Emmanuel Puybaret
1947  */
1948 var PatternsCatalog = /** @class */ (function () {
1949     function PatternsCatalog(patterns) {
1950         if (this.patterns === undefined) {
1951             this.patterns = null;
1952         }
1953         this.patterns = (patterns.slice(0));
1954     }
1955     /**
1956      * Returns the patterns list.
1957      * @return {*[]} a list of furniture.
1958      */
1959     PatternsCatalog.prototype.getPatterns = function () {
1960         return /* unmodifiableList */ this.patterns.slice(0);
1961     };
1962     /**
1963      * Returns the count of patterns in this category.
1964      * @return {number}
1965      */
1966     PatternsCatalog.prototype.getPatternsCount = function () {
1967         return /* size */ this.patterns.length;
1968     };
1969     PatternsCatalog.prototype.getPattern$int = function (index) {
1970         return /* get */ this.patterns[index];
1971     };
1972     PatternsCatalog.prototype.getPattern$java_lang_String = function (name) {
1973         for (var index127 = 0; index127 < this.patterns.length; index127++) {
1974             var pattern = this.patterns[index127];
1975             {
1976                 if (name === pattern.getName()) {
1977                     return pattern;
1978                 }
1979             }
1980         }
1981         throw new IllegalArgumentException("No pattern with name " + name);
1982     };
1983     /**
1984      * Returns the pattern with a given <code>name</code>.
1985      * @throws IllegalArgumentException if no pattern with the given <code>name</code> exists
1986      * @param {string} name
1987      * @return {Object}
1988      */
1989     PatternsCatalog.prototype.getPattern = function (name) {
1990         if (((typeof name === 'string') || name === null)) {
1991             return this.getPattern$java_lang_String(name);
1992         }
1993         else if (((typeof name === 'number') || name === null)) {
1994             return this.getPattern$int(name);
1995         }
1996         else
1997             throw new Error('invalid overload');
1998     };
1999     return PatternsCatalog;
2000 }());
2001 PatternsCatalog["__class"] = "com.eteks.sweethome3d.model.PatternsCatalog";
2002 /**
2003  * Create a print attributes for home from the given parameters.
2004  * @param {HomePrint.PaperOrientation} paperOrientation
2005  * @param {number} paperWidth
2006  * @param {number} paperHeight
2007  * @param {number} paperTopMargin
2008  * @param {number} paperLeftMargin
2009  * @param {number} paperBottomMargin
2010  * @param {number} paperRightMargin
2011  * @param {boolean} furniturePrinted
2012  * @param {boolean} planPrinted
2013  * @param {boolean} view3DPrinted
2014  * @param {number} planScale
2015  * @param {string} headerFormat
2016  * @param {string} footerFormat
2017  * @class
2018  * @author Emmanuel Puybaret
2019  */
2020 var HomePrint = /** @class */ (function () {
2021     function HomePrint(paperOrientation, paperWidth, paperHeight, paperTopMargin, paperLeftMargin, paperBottomMargin, paperRightMargin, furniturePrinted, planPrinted, view3DPrinted, planScale, headerFormat, footerFormat) {
2022         if (this.paperOrientation === undefined) {
2023             this.paperOrientation = null;
2024         }
2025         if (this.paperWidth === undefined) {
2026             this.paperWidth = 0;
2027         }
2028         if (this.paperHeight === undefined) {
2029             this.paperHeight = 0;
2030         }
2031         if (this.paperTopMargin === undefined) {
2032             this.paperTopMargin = 0;
2033         }
2034         if (this.paperLeftMargin === undefined) {
2035             this.paperLeftMargin = 0;
2036         }
2037         if (this.paperBottomMargin === undefined) {
2038             this.paperBottomMargin = 0;
2039         }
2040         if (this.paperRightMargin === undefined) {
2041             this.paperRightMargin = 0;
2042         }
2043         if (this.furniturePrinted === undefined) {
2044             this.furniturePrinted = false;
2045         }
2046         if (this.planPrinted === undefined) {
2047             this.planPrinted = false;
2048         }
2049         if (this.view3DPrinted === undefined) {
2050             this.view3DPrinted = false;
2051         }
2052         if (this.planScale === undefined) {
2053             this.planScale = null;
2054         }
2055         if (this.headerFormat === undefined) {
2056             this.headerFormat = null;
2057         }
2058         if (this.footerFormat === undefined) {
2059             this.footerFormat = null;
2060         }
2061         this.paperOrientation = paperOrientation;
2062         this.paperWidth = paperWidth;
2063         this.paperHeight = paperHeight;
2064         this.paperTopMargin = paperTopMargin;
2065         this.paperLeftMargin = paperLeftMargin;
2066         this.paperBottomMargin = paperBottomMargin;
2067         this.paperRightMargin = paperRightMargin;
2068         this.furniturePrinted = furniturePrinted;
2069         this.planPrinted = planPrinted;
2070         this.view3DPrinted = view3DPrinted;
2071         this.planScale = planScale;
2072         this.headerFormat = headerFormat;
2073         this.footerFormat = footerFormat;
2074     }
2075     /**
2076      * Returns the paper orientation.
2077      * @return {HomePrint.PaperOrientation}
2078      */
2079     HomePrint.prototype.getPaperOrientation = function () {
2080         return this.paperOrientation;
2081     };
2082     /**
2083      * Returns the margin at paper bottom in 1/72nds of an inch.
2084      * @return {number}
2085      */
2086     HomePrint.prototype.getPaperBottomMargin = function () {
2087         return this.paperBottomMargin;
2088     };
2089     /**
2090      * Returns the paper height in 1/72nds of an inch.
2091      * @return {number}
2092      */
2093     HomePrint.prototype.getPaperHeight = function () {
2094         return this.paperHeight;
2095     };
2096     /**
2097      * Returns the margin at paper left in 1/72nds of an inch.
2098      * @return {number}
2099      */
2100     HomePrint.prototype.getPaperLeftMargin = function () {
2101         return this.paperLeftMargin;
2102     };
2103     /**
2104      * Returns the margin at paper right in 1/72nds of an inch.
2105      * @return {number}
2106      */
2107     HomePrint.prototype.getPaperRightMargin = function () {
2108         return this.paperRightMargin;
2109     };
2110     /**
2111      * Returns the margin at paper top in 1/72nds of an inch.
2112      * @return {number}
2113      */
2114     HomePrint.prototype.getPaperTopMargin = function () {
2115         return this.paperTopMargin;
2116     };
2117     /**
2118      * Returns the paper width in 1/72nds of an inch.
2119      * @return {number}
2120      */
2121     HomePrint.prototype.getPaperWidth = function () {
2122         return this.paperWidth;
2123     };
2124     /**
2125      * Returns whether home furniture should be printed or not.
2126      * @return {boolean}
2127      */
2128     HomePrint.prototype.isFurniturePrinted = function () {
2129         return this.furniturePrinted;
2130     };
2131     /**
2132      * Returns whether home plan should be printed or not.
2133      * @return {boolean}
2134      */
2135     HomePrint.prototype.isPlanPrinted = function () {
2136         return this.planPrinted;
2137     };
2138     /**
2139      * Returns whether home 3D view should be printed or not.
2140      * @return {boolean}
2141      */
2142     HomePrint.prototype.isView3DPrinted = function () {
2143         return this.view3DPrinted;
2144     };
2145     /**
2146      * Returns the scale used to print home plan or
2147      * <code>null</code> if no special scale is desired.
2148      * @return {number}
2149      */
2150     HomePrint.prototype.getPlanScale = function () {
2151         return this.planScale;
2152     };
2153     /**
2154      * Returns the string format used to print page headers.
2155      * @return {string}
2156      */
2157     HomePrint.prototype.getHeaderFormat = function () {
2158         return this.headerFormat;
2159     };
2160     /**
2161      * Returns the string format used to print page footers.
2162      * @return {string}
2163      */
2164     HomePrint.prototype.getFooterFormat = function () {
2165         return this.footerFormat;
2166     };
2167     return HomePrint;
2168 }());
2169 HomePrint["__class"] = "com.eteks.sweethome3d.model.HomePrint";
2170 HomePrint["__interfaces"] = ["java.io.Serializable"];
2171 (function (HomePrint) {
2172     /**
2173      * Paper orientation.
2174      * @enum
2175      * @property {HomePrint.PaperOrientation} PORTRAIT
2176      * @property {HomePrint.PaperOrientation} LANDSCAPE
2177      * @property {HomePrint.PaperOrientation} REVERSE_LANDSCAPE
2178      * @class
2179      */
2180     var PaperOrientation;
2181     (function (PaperOrientation) {
2182         PaperOrientation[PaperOrientation["PORTRAIT"] = 0] = "PORTRAIT";
2183         PaperOrientation[PaperOrientation["LANDSCAPE"] = 1] = "LANDSCAPE";
2184         PaperOrientation[PaperOrientation["REVERSE_LANDSCAPE"] = 2] = "REVERSE_LANDSCAPE";
2185     })(PaperOrientation = HomePrint.PaperOrientation || (HomePrint.PaperOrientation = {}));
2186 })(HomePrint || (HomePrint = {}));
2187 /**
2188  * Create a category.
2189  * @param {string} name the name of the category.
2190  * @class
2191  * @author Emmanuel Puybaret
2192  */
2193 var TexturesCategory = /** @class */ (function () {
2194     function TexturesCategory(name) {
2195         if (this.name === undefined) {
2196             this.name = null;
2197         }
2198         if (this.textures === undefined) {
2199             this.textures = null;
2200         }
2201         this.name = name;
2202         this.textures = ([]);
2203     }
2204     TexturesCategory.COMPARATOR_$LI$ = function () { if (TexturesCategory.COMPARATOR == null) {
2205         TexturesCategory.COMPARATOR = /* getInstance */ { compare: function (o1, o2) { return o1.toString().localeCompare(o2.toString()); }, equals: function (o1, o2) { return o1.toString().localeCompare(o2.toString()) === 0; } };
2206     } return TexturesCategory.COMPARATOR; };
2207     ;
2208     /**
2209      * Returns the name of this category.
2210      * @return {string}
2211      */
2212     TexturesCategory.prototype.getName = function () {
2213         return this.name;
2214     };
2215     /**
2216      * Returns the textures list of this category sorted by name.
2217      * @return {CatalogTexture[]} a list of furniture.
2218      */
2219     TexturesCategory.prototype.getTextures = function () {
2220         return /* unmodifiableList */ this.textures.slice(0);
2221     };
2222     /**
2223      * Returns the count of textures in this category.
2224      * @return {number}
2225      */
2226     TexturesCategory.prototype.getTexturesCount = function () {
2227         return /* size */ this.textures.length;
2228     };
2229     /**
2230      * Returns the texture at a given <code>index</code>.
2231      * @param {number} index
2232      * @return {CatalogTexture}
2233      */
2234     TexturesCategory.prototype.getTexture = function (index) {
2235         return /* get */ this.textures[index];
2236     };
2237     /**
2238      * Returns the index of the given <code>texture</code>.
2239      * @param {CatalogTexture} texture
2240      * @return {number}
2241      */
2242     TexturesCategory.prototype.getIndexOfTexture = function (texture) {
2243         return this.textures.indexOf(texture);
2244     };
2245     /**
2246      * Adds a texture to this category.
2247      * @param {CatalogTexture} texture the texture to add.
2248      * @private
2249      */
2250     TexturesCategory.prototype.add = function (texture) {
2251         texture.setCategory(this);
2252         var index = (function (l, key) { var comp = function (a, b) { if (a.compareTo)
2253             return a.compareTo(b);
2254         else
2255             return a.localeCompare(b); }; var low = 0; var high = l.length - 1; while (low <= high) {
2256             var mid = (low + high) >>> 1;
2257             var midVal = l[mid];
2258             var cmp = comp(midVal, key);
2259             if (cmp < 0)
2260                 low = mid + 1;
2261             else if (cmp > 0)
2262                 high = mid - 1;
2263             else
2264                 return mid;
2265         } return -(low + 1); })(this.textures, texture);
2266         if (index < 0) {
2267             index = -index - 1;
2268         }
2269         /* add */ this.textures.splice(index, 0, texture);
2270     };
2271     /**
2272      * Deletes a texture from this category.
2273      * @param {CatalogTexture} texture the texture to remove.
2274      * @throws IllegalArgumentException if the texture doesn't exist in this category.
2275      * @private
2276      */
2277     TexturesCategory.prototype["delete"] = function (texture) {
2278         var textureIndex = this.textures.indexOf(texture);
2279         if (textureIndex === -1) {
2280             throw new IllegalArgumentException(this.name + " doesn\'t contain texture " + texture.getName());
2281         }
2282         this.textures = (this.textures.slice(0));
2283         /* remove */ this.textures.splice(textureIndex, 1)[0];
2284     };
2285     /**
2286      * Returns true if this category and the one in parameter have the same name.
2287      * @param {Object} obj
2288      * @return {boolean}
2289      */
2290     TexturesCategory.prototype.equals = function (obj) {
2291         return (obj != null && obj instanceof TexturesCategory) && TexturesCategory.COMPARATOR_$LI$().equals(this.name, obj.name);
2292     };
2293     /**
2294      *
2295      * @return {number}
2296      */
2297     TexturesCategory.prototype.hashCode = function () {
2298         return /* hashCode */ (function (o) { if (o.hashCode) {
2299             return o.hashCode();
2300         }
2301         else {
2302             return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0);
2303         } })(this.name);
2304     };
2305     /**
2306      * Compares the names of this category and the one in parameter.
2307      * @param {TexturesCategory} category
2308      * @return {number}
2309      */
2310     TexturesCategory.prototype.compareTo = function (category) {
2311         return TexturesCategory.COMPARATOR_$LI$().compare(this.name, category.name);
2312     };
2313     return TexturesCategory;
2314 }());
2315 TexturesCategory["__class"] = "com.eteks.sweethome3d.model.TexturesCategory";
2316 TexturesCategory["__interfaces"] = ["java.lang.Comparable"];
2317 var HomeRecorder;
2318 (function (HomeRecorder) {
2319     /**
2320      * Recorder type used as a hint to select a home recorder.
2321      * @enum
2322      * @property {HomeRecorder.Type} DEFAULT
2323      * The default recorder type.
2324      * @property {HomeRecorder.Type} COMPRESSED
2325      * A recorder type able to compress home data.
2326      * @class
2327      */
2328     var Type;
2329     (function (Type) {
2330         /**
2331          * The default recorder type.
2332          */
2333         Type[Type["DEFAULT"] = 0] = "DEFAULT";
2334         /**
2335          * A recorder type able to compress home data.
2336          */
2337         Type[Type["COMPRESSED"] = 1] = "COMPRESSED";
2338     })(Type = HomeRecorder.Type || (HomeRecorder.Type = {}));
2339 })(HomeRecorder || (HomeRecorder = {}));
2340 /**
2341  * Creates a catalog texture.
2342  * @param {string} id the ID of this texture
2343  * @param {string} name the name of this texture
2344  * @param {Object} image the content of the image used for this texture
2345  * @param {number} width the width of the texture in centimeters
2346  * @param {number} height the height of the texture in centimeters
2347  * @param {boolean} modifiable <code>true</code> if this texture can be modified
2348  * @param {string} creator
2349  * @class
2350  * @author Emmanuel Puybaret
2351  */
2352 var CatalogTexture = /** @class */ (function () {
2353     function CatalogTexture(id, name, image, width, height, creator, modifiable) {
2354         if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((image != null && (image.constructor != null && image.constructor["__interfaces"] != null && image.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || image === null) && ((typeof width === 'number') || width === null) && ((typeof height === 'number') || height === null) && ((typeof creator === 'string') || creator === null) && ((typeof modifiable === 'boolean') || modifiable === null)) {
2355             var __args = arguments;
2356             if (this.id === undefined) {
2357                 this.id = null;
2358             }
2359             if (this.name === undefined) {
2360                 this.name = null;
2361             }
2362             if (this.image === undefined) {
2363                 this.image = null;
2364             }
2365             if (this.width === undefined) {
2366                 this.width = 0;
2367             }
2368             if (this.height === undefined) {
2369                 this.height = 0;
2370             }
2371             if (this.creator === undefined) {
2372                 this.creator = null;
2373             }
2374             if (this.modifiable === undefined) {
2375                 this.modifiable = false;
2376             }
2377             if (this.category === undefined) {
2378                 this.category = null;
2379             }
2380             if (this.filterCollationKey === undefined) {
2381                 this.filterCollationKey = null;
2382             }
2383             this.id = id;
2384             this.name = name;
2385             this.image = image;
2386             this.width = width;
2387             this.height = height;
2388             this.creator = creator;
2389             this.modifiable = modifiable;
2390         }
2391         else if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((image != null && (image.constructor != null && image.constructor["__interfaces"] != null && image.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || image === null) && ((typeof width === 'number') || width === null) && ((typeof height === 'number') || height === null) && ((typeof creator === 'string') || creator === null) && modifiable === undefined) {
2392             var __args = arguments;
2393             {
2394                 var __args_2 = arguments;
2395                 var modifiable_1 = false;
2396                 if (this.id === undefined) {
2397                     this.id = null;
2398                 }
2399                 if (this.name === undefined) {
2400                     this.name = null;
2401                 }
2402                 if (this.image === undefined) {
2403                     this.image = null;
2404                 }
2405                 if (this.width === undefined) {
2406                     this.width = 0;
2407                 }
2408                 if (this.height === undefined) {
2409                     this.height = 0;
2410                 }
2411                 if (this.creator === undefined) {
2412                     this.creator = null;
2413                 }
2414                 if (this.modifiable === undefined) {
2415                     this.modifiable = false;
2416                 }
2417                 if (this.category === undefined) {
2418                     this.category = null;
2419                 }
2420                 if (this.filterCollationKey === undefined) {
2421                     this.filterCollationKey = null;
2422                 }
2423                 this.id = id;
2424                 this.name = name;
2425                 this.image = image;
2426                 this.width = width;
2427                 this.height = height;
2428                 this.creator = creator;
2429                 this.modifiable = modifiable_1;
2430             }
2431             if (this.id === undefined) {
2432                 this.id = null;
2433             }
2434             if (this.name === undefined) {
2435                 this.name = null;
2436             }
2437             if (this.image === undefined) {
2438                 this.image = null;
2439             }
2440             if (this.width === undefined) {
2441                 this.width = 0;
2442             }
2443             if (this.height === undefined) {
2444                 this.height = 0;
2445             }
2446             if (this.creator === undefined) {
2447                 this.creator = null;
2448             }
2449             if (this.modifiable === undefined) {
2450                 this.modifiable = false;
2451             }
2452             if (this.category === undefined) {
2453                 this.category = null;
2454             }
2455             if (this.filterCollationKey === undefined) {
2456                 this.filterCollationKey = null;
2457             }
2458         }
2459         else if (((typeof id === 'string') || id === null) && ((name != null && (name.constructor != null && name.constructor["__interfaces"] != null && name.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || name === null) && ((typeof image === 'number') || image === null) && ((typeof width === 'number') || width === null) && ((typeof height === 'boolean') || height === null) && creator === undefined && modifiable === undefined) {
2460             var __args = arguments;
2461             var name_1 = __args[0];
2462             var image_1 = __args[1];
2463             var width_1 = __args[2];
2464             var height_1 = __args[3];
2465             var modifiable_2 = __args[4];
2466             {
2467                 var __args_3 = arguments;
2468                 var id_1 = null;
2469                 var creator_1 = null;
2470                 if (this.id === undefined) {
2471                     this.id = null;
2472                 }
2473                 if (this.name === undefined) {
2474                     this.name = null;
2475                 }
2476                 if (this.image === undefined) {
2477                     this.image = null;
2478                 }
2479                 if (this.width === undefined) {
2480                     this.width = 0;
2481                 }
2482                 if (this.height === undefined) {
2483                     this.height = 0;
2484                 }
2485                 if (this.creator === undefined) {
2486                     this.creator = null;
2487                 }
2488                 if (this.modifiable === undefined) {
2489                     this.modifiable = false;
2490                 }
2491                 if (this.category === undefined) {
2492                     this.category = null;
2493                 }
2494                 if (this.filterCollationKey === undefined) {
2495                     this.filterCollationKey = null;
2496                 }
2497                 this.id = id_1;
2498                 this.name = name_1;
2499                 this.image = image_1;
2500                 this.width = width_1;
2501                 this.height = height_1;
2502                 this.creator = creator_1;
2503                 this.modifiable = modifiable_2;
2504             }
2505             if (this.id === undefined) {
2506                 this.id = null;
2507             }
2508             if (this.name === undefined) {
2509                 this.name = null;
2510             }
2511             if (this.image === undefined) {
2512                 this.image = null;
2513             }
2514             if (this.width === undefined) {
2515                 this.width = 0;
2516             }
2517             if (this.height === undefined) {
2518                 this.height = 0;
2519             }
2520             if (this.creator === undefined) {
2521                 this.creator = null;
2522             }
2523             if (this.modifiable === undefined) {
2524                 this.modifiable = false;
2525             }
2526             if (this.category === undefined) {
2527                 this.category = null;
2528             }
2529             if (this.filterCollationKey === undefined) {
2530                 this.filterCollationKey = null;
2531             }
2532         }
2533         else if (((typeof id === 'string') || id === null) && ((name != null && (name.constructor != null && name.constructor["__interfaces"] != null && name.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || name === null) && ((typeof image === 'number') || image === null) && ((typeof width === 'number') || width === null) && height === undefined && creator === undefined && modifiable === undefined) {
2534             var __args = arguments;
2535             var name_2 = __args[0];
2536             var image_2 = __args[1];
2537             var width_2 = __args[2];
2538             var height_2 = __args[3];
2539             {
2540                 var __args_4 = arguments;
2541                 var id_2 = null;
2542                 var creator_2 = null;
2543                 {
2544                     var __args_5 = arguments;
2545                     var modifiable_3 = false;
2546                     if (this.id === undefined) {
2547                         this.id = null;
2548                     }
2549                     if (this.name === undefined) {
2550                         this.name = null;
2551                     }
2552                     if (this.image === undefined) {
2553                         this.image = null;
2554                     }
2555                     if (this.width === undefined) {
2556                         this.width = 0;
2557                     }
2558                     if (this.height === undefined) {
2559                         this.height = 0;
2560                     }
2561                     if (this.creator === undefined) {
2562                         this.creator = null;
2563                     }
2564                     if (this.modifiable === undefined) {
2565                         this.modifiable = false;
2566                     }
2567                     if (this.category === undefined) {
2568                         this.category = null;
2569                     }
2570                     if (this.filterCollationKey === undefined) {
2571                         this.filterCollationKey = null;
2572                     }
2573                     this.id = id_2;
2574                     this.name = name_2;
2575                     this.image = image_2;
2576                     this.width = width_2;
2577                     this.height = height_2;
2578                     this.creator = creator_2;
2579                     this.modifiable = modifiable_3;
2580                 }
2581                 if (this.id === undefined) {
2582                     this.id = null;
2583                 }
2584                 if (this.name === undefined) {
2585                     this.name = null;
2586                 }
2587                 if (this.image === undefined) {
2588                     this.image = null;
2589                 }
2590                 if (this.width === undefined) {
2591                     this.width = 0;
2592                 }
2593                 if (this.height === undefined) {
2594                     this.height = 0;
2595                 }
2596                 if (this.creator === undefined) {
2597                     this.creator = null;
2598                 }
2599                 if (this.modifiable === undefined) {
2600                     this.modifiable = false;
2601                 }
2602                 if (this.category === undefined) {
2603                     this.category = null;
2604                 }
2605                 if (this.filterCollationKey === undefined) {
2606                     this.filterCollationKey = null;
2607                 }
2608             }
2609             if (this.id === undefined) {
2610                 this.id = null;
2611             }
2612             if (this.name === undefined) {
2613                 this.name = null;
2614             }
2615             if (this.image === undefined) {
2616                 this.image = null;
2617             }
2618             if (this.width === undefined) {
2619                 this.width = 0;
2620             }
2621             if (this.height === undefined) {
2622                 this.height = 0;
2623             }
2624             if (this.creator === undefined) {
2625                 this.creator = null;
2626             }
2627             if (this.modifiable === undefined) {
2628                 this.modifiable = false;
2629             }
2630             if (this.category === undefined) {
2631                 this.category = null;
2632             }
2633             if (this.filterCollationKey === undefined) {
2634                 this.filterCollationKey = null;
2635             }
2636         }
2637         else
2638             throw new Error('invalid overload');
2639     }
2640     CatalogTexture.__static_initialize = function () { if (!CatalogTexture.__static_initialized) {
2641         CatalogTexture.__static_initialized = true;
2642         CatalogTexture.__static_initializer_0();
2643     } };
2644     CatalogTexture.EMPTY_CRITERIA_$LI$ = function () { CatalogTexture.__static_initialize(); if (CatalogTexture.EMPTY_CRITERIA == null) {
2645         CatalogTexture.EMPTY_CRITERIA = [];
2646     } return CatalogTexture.EMPTY_CRITERIA; };
2647     ;
2648     CatalogTexture.COMPARATOR_$LI$ = function () { CatalogTexture.__static_initialize(); return CatalogTexture.COMPARATOR; };
2649     ;
2650     CatalogTexture.recentFilters_$LI$ = function () { CatalogTexture.__static_initialize(); return CatalogTexture.recentFilters; };
2651     ;
2652     CatalogTexture.__static_initializer_0 = function () {
2653         CatalogTexture.COMPARATOR = /* getInstance */ { compare: function (o1, o2) { return o1.toString().localeCompare(o2.toString()); }, equals: function (o1, o2) { return o1.toString().localeCompare(o2.toString()) === 0; } };
2654         /* setStrength */ CatalogTexture.COMPARATOR_$LI$();
2655         CatalogTexture.recentFilters = ({});
2656     };
2657     /**
2658      * Returns the ID of this texture or <code>null</code>.
2659      * @return {string}
2660      */
2661     CatalogTexture.prototype.getId = function () {
2662         return this.id;
2663     };
2664     /**
2665      * Returns the name of this texture.
2666      * @return {string}
2667      */
2668     CatalogTexture.prototype.getName = function () {
2669         return this.name;
2670     };
2671     /**
2672      * Returns the content of the image used for this texture.
2673      * @return {Object}
2674      */
2675     CatalogTexture.prototype.getImage = function () {
2676         return this.image;
2677     };
2678     /**
2679      * Returns the icon of this texture.
2680      * @return {Object} the image of this texture.
2681      */
2682     CatalogTexture.prototype.getIcon = function () {
2683         return this.getImage();
2684     };
2685     /**
2686      * Returns the width of the image in centimeters.
2687      * @return {number}
2688      */
2689     CatalogTexture.prototype.getWidth = function () {
2690         return this.width;
2691     };
2692     /**
2693      * Returns the height of the image in centimeters.
2694      * @return {number}
2695      */
2696     CatalogTexture.prototype.getHeight = function () {
2697         return this.height;
2698     };
2699     /**
2700      * Returns the creator of this texture or <code>null</code>.
2701      * @return {string}
2702      */
2703     CatalogTexture.prototype.getCreator = function () {
2704         return this.creator;
2705     };
2706     /**
2707      * Returns <code>true</code> if this texture is modifiable (not read from resources).
2708      * @return {boolean}
2709      */
2710     CatalogTexture.prototype.isModifiable = function () {
2711         return this.modifiable;
2712     };
2713     /**
2714      * Returns the category of this texture.
2715      * @return {TexturesCategory}
2716      */
2717     CatalogTexture.prototype.getCategory = function () {
2718         return this.category;
2719     };
2720     /**
2721      * Sets the category of this texture.
2722      * @param {TexturesCategory} category
2723      * @private
2724      */
2725     CatalogTexture.prototype.setCategory = function (category) {
2726         this.category = category;
2727     };
2728     /**
2729      *
2730      * Returns true if this texture and the one in parameter are the same objects.
2731      * Note that, from version 3.6, two textures can have the same name.
2732      * @param {Object} obj
2733      * @return {boolean}
2734      */
2735     CatalogTexture.prototype.equals = function (obj) {
2736         return /* equals */ (function (o1, o2) { if (o1 && o1.equals) {
2737             return o1.equals(o2);
2738         }
2739         else {
2740             return o1 === o2;
2741         } })(this, obj);
2742     };
2743     /**
2744      *
2745      * Returns default hash code.
2746      * @return {number}
2747      */
2748     CatalogTexture.prototype.hashCode = function () {
2749         return /* hashCode */ (function (o) { if (o.hashCode) {
2750             return o.hashCode();
2751         }
2752         else {
2753             return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0);
2754         } })(this);
2755     };
2756     /**
2757      *
2758      * Compares the names of this texture and the one in parameter.
2759      * @param {CatalogTexture} texture
2760      * @return {number}
2761      */
2762     CatalogTexture.prototype.compareTo = function (texture) {
2763         var nameComparison = CatalogTexture.COMPARATOR_$LI$().compare(this.name, texture.name);
2764         if (nameComparison !== 0) {
2765             return nameComparison;
2766         }
2767         else {
2768             return this.modifiable === texture.modifiable ? 0 : (this.modifiable ? 1 : -1);
2769         }
2770     };
2771     /**
2772      * Returns <code>true</code> if this texture matches the given <code>filter</code> text.
2773      * Each substring of the <code>filter</code> is considered as a search criterion that can match
2774      * the name, the category name or the creator of this texture.
2775      * @param {string} filter
2776      * @return {boolean}
2777      */
2778     CatalogTexture.prototype.matchesFilter = function (filter) {
2779         var filterCriteriaCollationKeys = this.getFilterCollationKeys(filter);
2780         var checkedCriteria = 0;
2781         if (filterCriteriaCollationKeys.length > 0) {
2782             var furnitureCollationKey = this.getTextureCollationKey();
2783             for (var i = 0; i < filterCriteriaCollationKeys.length; i++) {
2784                 {
2785                     if (this.isSubCollationKey(furnitureCollationKey, filterCriteriaCollationKeys[i], 0)) {
2786                         checkedCriteria++;
2787                     }
2788                     else {
2789                         break;
2790                     }
2791                 }
2792                 ;
2793             }
2794         }
2795         return checkedCriteria === filterCriteriaCollationKeys.length;
2796     };
2797     /**
2798      * Returns the collation key bytes of each criterion in the given <code>filter</code>.
2799      * @param {string} filter
2800      * @return {Array}
2801      * @private
2802      */
2803     /*private*/ CatalogTexture.prototype.getFilterCollationKeys = function (filter) {
2804         if (filter.length === 0) {
2805             return CatalogTexture.EMPTY_CRITERIA_$LI$();
2806         }
2807         var filterCollationKeys = (function (m, k) { return m[k] === undefined ? null : m[k]; })(CatalogTexture.recentFilters_$LI$(), filter);
2808         if (filterCollationKeys == null) {
2809             var filterCriteria = filter.split("\\s|\\p{Punct}|\\|");
2810             var filterCriteriaCollationKeys = ([]);
2811             for (var index128 = 0; index128 < filterCriteria.length; index128++) {
2812                 var criterion = filterCriteria[index128];
2813                 {
2814                     if (criterion.length > 0) {
2815                         /* add */ (filterCriteriaCollationKeys.push(CatalogTexture.COMPARATOR_$LI$().getCollationKey(criterion).toByteArray()) > 0);
2816                     }
2817                 }
2818             }
2819             if ( /* size */filterCriteriaCollationKeys.length === 0) {
2820                 filterCollationKeys = CatalogTexture.EMPTY_CRITERIA_$LI$();
2821             }
2822             else {
2823                 filterCollationKeys = /* toArray */ filterCriteriaCollationKeys.slice(0);
2824             }
2825             /* put */ (CatalogTexture.recentFilters_$LI$()[filter] = filterCollationKeys);
2826         }
2827         return filterCollationKeys;
2828     };
2829     /**
2830      * Returns the collation key bytes used to compare the given <code>texture</code> with filter.
2831      * @return {Array}
2832      * @private
2833      */
2834     /*private*/ CatalogTexture.prototype.getTextureCollationKey = function () {
2835         var _this = this;
2836         if (this.filterCollationKey == null) {
2837             var search = { str: "", toString: function () { return this.str; } };
2838             /* append */ (function (sb) { sb.str = sb.str.concat(_this.getName()); return sb; })(search);
2839             /* append */ (function (sb) { sb.str = sb.str.concat('|'); return sb; })(search);
2840             if (this.getCategory() != null) {
2841                 /* append */ (function (sb) { sb.str = sb.str.concat(_this.getCategory().getName()); return sb; })(search);
2842                 /* append */ (function (sb) { sb.str = sb.str.concat('|'); return sb; })(search);
2843             }
2844             if (this.getCreator() != null) {
2845                 /* append */ (function (sb) { sb.str = sb.str.concat(_this.getCreator()); return sb; })(search);
2846                 /* append */ (function (sb) { sb.str = sb.str.concat('|'); return sb; })(search);
2847             }
2848             this.filterCollationKey = CatalogTexture.COMPARATOR_$LI$().getCollationKey(/* toString */ search.str).toByteArray();
2849         }
2850         return this.filterCollationKey;
2851     };
2852     /**
2853      * Returns <code>true</code> if the given filter collation key is a sub part of the first array collator key.
2854      * @param {Array} collationKey
2855      * @param {Array} filterCollationKey
2856      * @param {number} start
2857      * @return {boolean}
2858      * @private
2859      */
2860     /*private*/ CatalogTexture.prototype.isSubCollationKey = function (collationKey, filterCollationKey, start) {
2861         for (var i = start, n = collationKey.length - 4, m = filterCollationKey.length - 4; i < n && i < n - m + 1; i++) {
2862             {
2863                 if (collationKey[i] === filterCollationKey[0]) {
2864                     for (var j = 1; j < m; j++) {
2865                         {
2866                             if (collationKey[i + j] !== filterCollationKey[j]) {
2867                                 return this.isSubCollationKey(collationKey, filterCollationKey, i + 1);
2868                             }
2869                         }
2870                         ;
2871                     }
2872                     return true;
2873                 }
2874             }
2875             ;
2876         }
2877         return false;
2878     };
2879     CatalogTexture.__static_initialized = false;
2880     return CatalogTexture;
2881 }());
2882 CatalogTexture["__class"] = "com.eteks.sweethome3d.model.CatalogTexture";
2883 CatalogTexture["__interfaces"] = ["com.eteks.sweethome3d.model.CatalogItem", "java.lang.Comparable", "com.eteks.sweethome3d.model.TextureImage", "java.io.Serializable"];
2884 /**
2885  * Creates a material instance from parameters.
2886  * @param {string} name
2887  * @param {Array} matrix
2888  * @class
2889  * @author Emmanuel Puybaret
2890  */
2891 var Transformation = /** @class */ (function () {
2892     function Transformation(name, matrix) {
2893         if (this.name === undefined) {
2894             this.name = null;
2895         }
2896         if (this.matrix === undefined) {
2897             this.matrix = null;
2898         }
2899         this.name = name;
2900         this.matrix = matrix;
2901     }
2902     /**
2903      * Returns the name of this transformation.
2904      * @return {string} the name of the transformation.
2905      */
2906     Transformation.prototype.getName = function () {
2907         return this.name;
2908     };
2909     /**
2910      * Returns the matrix of this transformation.
2911      * @return {Array} a 4x3 float array.
2912      */
2913     Transformation.prototype.getMatrix = function () {
2914         return [[this.matrix[0][0], this.matrix[0][1], this.matrix[0][2], this.matrix[0][3]], [this.matrix[1][0], this.matrix[1][1], this.matrix[1][2], this.matrix[1][3]], [this.matrix[2][0], this.matrix[2][1], this.matrix[2][2], this.matrix[2][3]]];
2915     };
2916     /**
2917      * Returns <code>true</code> if this transformation is equal to <code>object</code>.
2918      * @param {Object} object
2919      * @return {boolean}
2920      */
2921     Transformation.prototype.equals = function (object) {
2922         if (object != null && object instanceof Transformation) {
2923             var transformation = object;
2924             if (transformation.name === this.name) {
2925                 for (var i = 0; i < this.matrix.length; i++) {
2926                     {
2927                         for (var j = 0; j < this.matrix[i].length; j++) {
2928                             {
2929                                 if (transformation.matrix[i][j] !== this.matrix[i][j]) {
2930                                     return false;
2931                                 }
2932                             }
2933                             ;
2934                         }
2935                     }
2936                     ;
2937                 }
2938                 return true;
2939             }
2940         }
2941         return false;
2942     };
2943     /**
2944      * Returns a hash code for this transformation.
2945      * @return {number}
2946      */
2947     Transformation.prototype.hashCode = function () {
2948         return /* hashCode */ (function (o) { if (o.hashCode) {
2949             return o.hashCode();
2950         }
2951         else {
2952             return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0);
2953         } })(this.name) + /* deepHashCode */ (function (array) { function deepHashCode(array) { if (array == null)
2954             return 0; var hashCode = 1; for (var i = 0; i < array.length; i++) {
2955             var elementHashCode = 1;
2956             if (Array.isArray(array[i]))
2957                 elementHashCode = deepHashCode(array[i]);
2958             else if (typeof array[i] == 'number')
2959                 elementHashCode = (array[i] * 1000) | 0;
2960             hashCode = 31 * hashCode + elementHashCode;
2961         } return hashCode; } return deepHashCode; })(this.matrix);
2962     };
2963     return Transformation;
2964 }());
2965 Transformation["__class"] = "com.eteks.sweethome3d.model.Transformation";
2966 Transformation["__interfaces"] = ["java.io.Serializable"];
2967 /**
2968  * Creates a new light source.
2969  * @param {number} x
2970  * @param {number} y
2971  * @param {number} z
2972  * @param {number} color
2973  * @param {number} diameter
2974  * @class
2975  * @author Emmanuel Puybaret
2976  */
2977 var LightSource = /** @class */ (function () {
2978     function LightSource(x, y, z, color, diameter) {
2979         if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((typeof z === 'number') || z === null) && ((typeof color === 'number') || color === null) && ((typeof diameter === 'number') || diameter === null)) {
2980             var __args = arguments;
2981             if (this.x === undefined) {
2982                 this.x = 0;
2983             }
2984             if (this.y === undefined) {
2985                 this.y = 0;
2986             }
2987             if (this.z === undefined) {
2988                 this.z = 0;
2989             }
2990             if (this.color === undefined) {
2991                 this.color = 0;
2992             }
2993             if (this.diameter === undefined) {
2994                 this.diameter = null;
2995             }
2996             this.x = x;
2997             this.y = y;
2998             this.z = z;
2999             this.color = color;
3000             this.diameter = diameter;
3001         }
3002         else if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((typeof z === 'number') || z === null) && ((typeof color === 'number') || color === null) && diameter === undefined) {
3003             var __args = arguments;
3004             {
3005                 var __args_6 = arguments;
3006                 var diameter_1 = null;
3007                 if (this.x === undefined) {
3008                     this.x = 0;
3009                 }
3010                 if (this.y === undefined) {
3011                     this.y = 0;
3012                 }
3013                 if (this.z === undefined) {
3014                     this.z = 0;
3015                 }
3016                 if (this.color === undefined) {
3017                     this.color = 0;
3018                 }
3019                 if (this.diameter === undefined) {
3020                     this.diameter = null;
3021                 }
3022                 this.x = x;
3023                 this.y = y;
3024                 this.z = z;
3025                 this.color = color;
3026                 this.diameter = diameter_1;
3027             }
3028             if (this.x === undefined) {
3029                 this.x = 0;
3030             }
3031             if (this.y === undefined) {
3032                 this.y = 0;
3033             }
3034             if (this.z === undefined) {
3035                 this.z = 0;
3036             }
3037             if (this.color === undefined) {
3038                 this.color = 0;
3039             }
3040             if (this.diameter === undefined) {
3041                 this.diameter = null;
3042             }
3043         }
3044         else
3045             throw new Error('invalid overload');
3046     }
3047     /**
3048      * Returns the abscissa of this source.
3049      * @return {number}
3050      */
3051     LightSource.prototype.getX = function () {
3052         return this.x;
3053     };
3054     /**
3055      * Returns the ordinate of this source.
3056      * @return {number}
3057      */
3058     LightSource.prototype.getY = function () {
3059         return this.y;
3060     };
3061     /**
3062      * Returns the elevation of this source.
3063      * @return {number}
3064      */
3065     LightSource.prototype.getZ = function (