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